[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
committed by
WandererFan
parent
a207d11fa4
commit
e92ed45df9
@@ -100,7 +100,7 @@ public:
|
||||
&Module::removeSvgTags,
|
||||
"string = removeSvgTags(string) -- Removes the opening and closing svg tags\n"
|
||||
"and other metatags from a svg code, making it embeddable");
|
||||
initialize("This module is the Drawing module.");// register with Python
|
||||
initialize("This module is the Drawing module."); // register with Python
|
||||
}
|
||||
|
||||
virtual ~Module()
|
||||
@@ -381,4 +381,4 @@ PyObject* initModule()
|
||||
return Base::Interpreter().addModule(new Module);
|
||||
}
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
@@ -216,9 +216,9 @@ void SVGOutput::printCircle(const BRepAdaptor_Curve& c, std::ostream& out)
|
||||
// arc of circle
|
||||
else {
|
||||
// See also https://developer.mozilla.org/en/SVG/Tutorial/Paths
|
||||
char xar = '0'; // x-axis-rotation
|
||||
char las = (l - f > D_PI) ? '1' : '0';// large-arc-flag
|
||||
char swp = (a < 0) ? '1' : '0';// sweep-flag, i.e. clockwise (0) or counter-clockwise (1)
|
||||
char xar = '0'; // x-axis-rotation
|
||||
char las = (l - f > D_PI) ? '1' : '0'; // large-arc-flag
|
||||
char swp = (a < 0) ? '1' : '0'; // sweep-flag, i.e. clockwise (0) or counter-clockwise (1)
|
||||
out << "<path d=\"M" << s.X() << " " << s.Y() << " A" << r << " " << r << " " << xar << " "
|
||||
<< las << " " << swp << " " << e.X() << " " << e.Y() << "\" />";
|
||||
}
|
||||
@@ -263,8 +263,8 @@ void SVGOutput::printEllipse(const BRepAdaptor_Curve& c, int id, std::ostream& o
|
||||
}
|
||||
// arc of ellipse
|
||||
else {
|
||||
char las = (l - f > D_PI) ? '1' : '0';// large-arc-flag
|
||||
char swp = (a < 0) ? '1' : '0';// sweep-flag, i.e. clockwise (0) or counter-clockwise (1)
|
||||
char las = (l - f > D_PI) ? '1' : '0'; // large-arc-flag
|
||||
char swp = (a < 0) ? '1' : '0'; // sweep-flag, i.e. clockwise (0) or counter-clockwise (1)
|
||||
out << "<path d=\"M" << s.X() << " " << s.Y() << " A" << r1 << " " << r2 << " " << angle
|
||||
<< " " << las << " " << swp << " " << e.X() << " " << e.Y() << "\" />" << std::endl;
|
||||
}
|
||||
@@ -492,20 +492,20 @@ void DXFOutput::printCircle(const BRepAdaptor_Curve& c, std::ostream& out)
|
||||
//<< p.Y() << "\" r =\"" << r << "\" />";
|
||||
out << 0 << endl;
|
||||
out << "CIRCLE" << endl;
|
||||
out << 8 << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl;// Layer number
|
||||
out << 8 << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl; // Layer number
|
||||
out << "100" << endl;
|
||||
out << "AcDbEntity" << endl;
|
||||
out << "100" << endl;
|
||||
out << "AcDbCircle" << endl;
|
||||
out << 10 << endl; // Centre X
|
||||
out << p.X() << endl;// X in WCS coordinates
|
||||
out << 10 << endl; // Centre X
|
||||
out << p.X() << endl; // X in WCS coordinates
|
||||
out << 20 << endl;
|
||||
out << p.Y() << endl;// Y in WCS coordinates
|
||||
out << p.Y() << endl; // Y in WCS coordinates
|
||||
out << 30 << endl;
|
||||
out << 0 << endl; // Z in WCS coordinates-leaving flat
|
||||
out << 40 << endl;//
|
||||
out << r << endl; // Radius
|
||||
out << 0 << endl; // Z in WCS coordinates-leaving flat
|
||||
out << 40 << endl; //
|
||||
out << r << endl; // Radius
|
||||
}
|
||||
|
||||
|
||||
@@ -535,26 +535,26 @@ void DXFOutput::printCircle(const BRepAdaptor_Curve& c, std::ostream& out)
|
||||
}
|
||||
out << 0 << endl;
|
||||
out << "ARC" << endl;
|
||||
out << 8 << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl;// Layer number
|
||||
out << 8 << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl; // Layer number
|
||||
out << "100" << endl;
|
||||
out << "AcDbEntity" << endl;
|
||||
out << "100" << endl;
|
||||
out << "AcDbCircle" << endl;
|
||||
out << 10 << endl; // Centre X
|
||||
out << p.X() << endl;// X in WCS coordinates
|
||||
out << 10 << endl; // Centre X
|
||||
out << p.X() << endl; // X in WCS coordinates
|
||||
out << 20 << endl;
|
||||
out << p.Y() << endl;// Y in WCS coordinates
|
||||
out << p.Y() << endl; // Y in WCS coordinates
|
||||
out << 30 << endl;
|
||||
out << 0 << endl; // Z in WCS coordinates
|
||||
out << 40 << endl;//
|
||||
out << r << endl; // Radius
|
||||
out << 0 << endl; // Z in WCS coordinates
|
||||
out << 40 << endl; //
|
||||
out << r << endl; // Radius
|
||||
out << "100" << endl;
|
||||
out << "AcDbArc" << endl;
|
||||
out << 50 << endl;
|
||||
out << start_angle << endl;// Start angle
|
||||
out << start_angle << endl; // Start angle
|
||||
out << 51 << endl;
|
||||
out << end_angle << endl;// End angle
|
||||
out << end_angle << endl; // End angle
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,35 +606,35 @@ void DXFOutput::printEllipse(const BRepAdaptor_Curve& c, int /*id*/, std::ostrea
|
||||
}
|
||||
out << 0 << endl;
|
||||
out << "ELLIPSE" << endl;
|
||||
out << 8 << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl;// Layer number
|
||||
out << 8 << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl; // Layer number
|
||||
out << "100" << endl;
|
||||
out << "AcDbEntity" << endl;
|
||||
out << "100" << endl;
|
||||
out << "AcDbEllipse" << endl;
|
||||
out << 10 << endl; // Centre X
|
||||
out << p.X() << endl;// X in WCS coordinates
|
||||
out << 10 << endl; // Centre X
|
||||
out << p.X() << endl; // X in WCS coordinates
|
||||
out << 20 << endl;
|
||||
out << p.Y() << endl;// Y in WCS coordinates
|
||||
out << p.Y() << endl; // Y in WCS coordinates
|
||||
out << 30 << endl;
|
||||
out << 0 << endl; // Z in WCS coordinates
|
||||
out << 11 << endl; //
|
||||
out << major_x << endl;// Major X
|
||||
out << 0 << endl; // Z in WCS coordinates
|
||||
out << 11 << endl; //
|
||||
out << major_x << endl; // Major X
|
||||
out << 21 << endl;
|
||||
out << major_y << endl;// Major Y
|
||||
out << major_y << endl; // Major Y
|
||||
out << 31 << endl;
|
||||
out << 0 << endl; // Major Z
|
||||
out << 40 << endl; //
|
||||
out << ratio << endl;// Ratio
|
||||
out << 0 << endl; // Major Z
|
||||
out << 40 << endl; //
|
||||
out << ratio << endl; // Ratio
|
||||
out << 41 << endl;
|
||||
out << start_angle << endl;// Start angle
|
||||
out << start_angle << endl; // Start angle
|
||||
out << 42 << endl;
|
||||
out << end_angle << endl;// End angle
|
||||
out << end_angle << endl; // End angle
|
||||
}
|
||||
|
||||
void DXFOutput::printBSpline(const BRepAdaptor_Curve& c,
|
||||
int id,
|
||||
std::ostream& out)// Not even close yet- DF
|
||||
std::ostream& out) // Not even close yet- DF
|
||||
{
|
||||
try {
|
||||
std::stringstream str;
|
||||
@@ -674,14 +674,14 @@ void DXFOutput::printBSpline(const BRepAdaptor_Curve& c,
|
||||
|
||||
str << 0 << endl
|
||||
<< "SPLINE" << endl
|
||||
<< 8 << endl // Group code for layer name
|
||||
<< "sheet_layer" << endl// Layer name
|
||||
<< 8 << endl // Group code for layer name
|
||||
<< "sheet_layer" << endl // Layer name
|
||||
<< "100" << endl
|
||||
<< "AcDbEntity" << endl
|
||||
<< "100" << endl
|
||||
<< "AcDbSpline" << endl
|
||||
<< 70 << endl
|
||||
<< spline->IsRational() * 4 << endl// flags
|
||||
<< spline->IsRational() * 4 << endl // flags
|
||||
<< 71 << endl
|
||||
<< spline->Degree() << endl
|
||||
<< 72 << endl
|
||||
@@ -689,7 +689,7 @@ void DXFOutput::printBSpline(const BRepAdaptor_Curve& c,
|
||||
<< 73 << endl
|
||||
<< poles.Length() << endl
|
||||
<< 74 << endl
|
||||
<< 0 << endl;// fitpoints
|
||||
<< 0 << endl; // fitpoints
|
||||
|
||||
for (int i = knotsequence.Lower(); i <= knotsequence.Upper(); i++) {
|
||||
str << 40 << endl << knotsequence(i) << endl;
|
||||
@@ -729,22 +729,22 @@ void DXFOutput::printGeneric(const BRepAdaptor_Curve& c, int /*id*/, std::ostrea
|
||||
|
||||
out << "0" << endl;
|
||||
out << "LINE" << endl;
|
||||
out << "8" << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl;// Layer name
|
||||
out << "8" << endl; // Group code for layer name
|
||||
out << "sheet_layer" << endl; // Layer name
|
||||
out << "100" << endl;
|
||||
out << "AcDbEntity" << endl;
|
||||
out << "100" << endl;
|
||||
out << "AcDbLine" << endl;
|
||||
out << "10" << endl; // Start point of line
|
||||
out << PS.X() << endl;// X in WCS coordinates
|
||||
out << "10" << endl; // Start point of line
|
||||
out << PS.X() << endl; // X in WCS coordinates
|
||||
out << "20" << endl;
|
||||
out << PS.Y() << endl;// Y in WCS coordinates
|
||||
out << PS.Y() << endl; // Y in WCS coordinates
|
||||
out << "30" << endl;
|
||||
out << "0" << endl; // Z in WCS coordinates
|
||||
out << "11" << endl; // End point of line
|
||||
out << PE.X() << endl;// X in WCS coordinates
|
||||
out << "0" << endl; // Z in WCS coordinates
|
||||
out << "11" << endl; // End point of line
|
||||
out << PE.X() << endl; // X in WCS coordinates
|
||||
out << "21" << endl;
|
||||
out << PE.Y() << endl;// Y in WCS coordinates
|
||||
out << PE.Y() << endl; // Y in WCS coordinates
|
||||
out << "31" << endl;
|
||||
out << "0" << endl;// Z in WCS coordinates
|
||||
out << "0" << endl; // Z in WCS coordinates
|
||||
}
|
||||
|
||||
@@ -72,6 +72,6 @@ private:
|
||||
void printGeneric(const BRepAdaptor_Curve&, int id, std::ostream&);
|
||||
};
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
#endif// DRAWING_EXPORT_H
|
||||
#endif // DRAWING_EXPORT_H
|
||||
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -115,7 +115,7 @@ void FeaturePage::onChanged(const App::Property* prop)
|
||||
void FeaturePage::onDocumentRestored()
|
||||
{
|
||||
// Needs to be tmp. set because otherwise the custom text gets overridden (#0002064)
|
||||
this->StatusBits.set(App::Restore);// the 'Restore' flag
|
||||
this->StatusBits.set(App::Restore); // the 'Restore' flag
|
||||
|
||||
Base::FileInfo templateInfo(Template.getValue());
|
||||
if (!templateInfo.exists()) {
|
||||
@@ -133,7 +133,7 @@ void FeaturePage::onDocumentRestored()
|
||||
Template.setValue(path);
|
||||
}
|
||||
|
||||
this->StatusBits.reset(App::Restore);// the 'Restore' flag
|
||||
this->StatusBits.reset(App::Restore); // the 'Restore' flag
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn* FeaturePage::execute(void)
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
//@}
|
||||
};
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif// DRAWING_FEATUREPROJECTION
|
||||
#endif // DRAWING_FEATUREPROJECTION
|
||||
|
||||
@@ -113,4 +113,4 @@ const char* Drawing::FeatureViewPython::getViewProviderName(void) const
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<Drawing::FeatureView>;
|
||||
}// namespace App
|
||||
} // namespace App
|
||||
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
|
||||
using FeatureViewPython = App::FeaturePythonT<FeatureView>;
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -98,4 +98,4 @@ const char* Drawing::FeatureViewAnnotationPython::getViewProviderName(void) cons
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<Drawing::FeatureViewAnnotation>;
|
||||
}// namespace App
|
||||
} // namespace App
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
using FeatureViewAnnotationPython = App::FeaturePythonT<FeatureViewAnnotation>;
|
||||
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -155,4 +155,4 @@ const char* Drawing::FeatureViewPartPython::getViewProviderName(void) const
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<Drawing::FeatureViewPart>;
|
||||
}// namespace App
|
||||
} // namespace App
|
||||
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
using FeatureViewPartPython = App::FeaturePythonT<FeatureViewPart>;
|
||||
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -146,4 +146,4 @@ const char* Drawing::FeatureViewSymbolPython::getViewProviderName(void) const
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<Drawing::FeatureViewSymbol>;
|
||||
}// namespace App
|
||||
} // namespace App
|
||||
|
||||
@@ -66,7 +66,7 @@ protected:
|
||||
using FeatureViewSymbolPython = App::FeaturePythonT<FeatureViewSymbol>;
|
||||
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,5 +72,5 @@
|
||||
#include <BRepAdaptor_HCurve.hxx>
|
||||
#endif
|
||||
|
||||
#endif// _PreComp_
|
||||
#endif // _PreComp_
|
||||
#endif
|
||||
|
||||
@@ -87,16 +87,16 @@ void ProjectionAlgos::execute(void)
|
||||
// extracting the result sets:
|
||||
HLRBRep_HLRToShape shapes(brep_hlr);
|
||||
|
||||
V = build3dCurves(shapes.VCompound()); // hard edge visibly
|
||||
V1 = build3dCurves(shapes.Rg1LineVCompound());// Smoth edges visibly
|
||||
VN = build3dCurves(shapes.RgNLineVCompound());// contour edges visibly
|
||||
VO = build3dCurves(shapes.OutLineVCompound());// contours apparents visibly
|
||||
VI = build3dCurves(shapes.IsoLineVCompound());// isoparamtriques visibly
|
||||
H = build3dCurves(shapes.HCompound()); // hard edge invisibly
|
||||
H1 = build3dCurves(shapes.Rg1LineHCompound());// Smoth edges invisibly
|
||||
HN = build3dCurves(shapes.RgNLineHCompound());// contour edges invisibly
|
||||
HO = build3dCurves(shapes.OutLineHCompound());// contours apparents invisibly
|
||||
HI = build3dCurves(shapes.IsoLineHCompound());// isoparamtriques invisibly
|
||||
V = build3dCurves(shapes.VCompound()); // hard edge visibly
|
||||
V1 = build3dCurves(shapes.Rg1LineVCompound()); // Smoth edges visibly
|
||||
VN = build3dCurves(shapes.RgNLineVCompound()); // contour edges visibly
|
||||
VO = build3dCurves(shapes.OutLineVCompound()); // contours apparents visibly
|
||||
VI = build3dCurves(shapes.IsoLineVCompound()); // isoparamtriques visibly
|
||||
H = build3dCurves(shapes.HCompound()); // hard edge invisibly
|
||||
H1 = build3dCurves(shapes.Rg1LineHCompound()); // Smoth edges invisibly
|
||||
HN = build3dCurves(shapes.RgNLineHCompound()); // contour edges invisibly
|
||||
HO = build3dCurves(shapes.OutLineHCompound()); // contours apparents invisibly
|
||||
HI = build3dCurves(shapes.IsoLineHCompound()); // isoparamtriques invisibly
|
||||
}
|
||||
|
||||
string ProjectionAlgos::getSVG(ExtractionType type,
|
||||
|
||||
@@ -63,25 +63,25 @@ public:
|
||||
XmlAttributes H0_style = XmlAttributes(),
|
||||
XmlAttributes H1_style = XmlAttributes());
|
||||
std::string
|
||||
getDXF(ExtractionType type, double scale, double tolerance);// added by Dan Falck 2011/09/25
|
||||
getDXF(ExtractionType type, double scale, double tolerance); // added by Dan Falck 2011/09/25
|
||||
|
||||
|
||||
const TopoDS_Shape& Input;
|
||||
const Base::Vector3d& Direction;
|
||||
|
||||
TopoDS_Shape V; // hard edge visibly
|
||||
TopoDS_Shape V1;// Smoth edges visibly
|
||||
TopoDS_Shape VN;// contour edges visibly
|
||||
TopoDS_Shape VO;// contours apparents visibly
|
||||
TopoDS_Shape VI;// isoparamtriques visibly
|
||||
TopoDS_Shape H; // hard edge invisibly
|
||||
TopoDS_Shape H1;// Smoth edges invisibly
|
||||
TopoDS_Shape HN;// contour edges invisibly
|
||||
TopoDS_Shape HO;// contours apparents invisibly
|
||||
TopoDS_Shape HI;// isoparamtriques invisibly
|
||||
TopoDS_Shape V; // hard edge visibly
|
||||
TopoDS_Shape V1; // Smoth edges visibly
|
||||
TopoDS_Shape VN; // contour edges visibly
|
||||
TopoDS_Shape VO; // contours apparents visibly
|
||||
TopoDS_Shape VI; // isoparamtriques visibly
|
||||
TopoDS_Shape H; // hard edge invisibly
|
||||
TopoDS_Shape H1; // Smoth edges invisibly
|
||||
TopoDS_Shape HN; // contour edges invisibly
|
||||
TopoDS_Shape HO; // contours apparents invisibly
|
||||
TopoDS_Shape HI; // isoparamtriques invisibly
|
||||
};
|
||||
|
||||
}// namespace Drawing
|
||||
} // namespace Drawing
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,4 +44,4 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif// DRAWING_GLOBAL_H
|
||||
#endif // DRAWING_GLOBAL_H
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
add_varargs_method("open", &Module::open);
|
||||
add_varargs_method("insert", &Module::importer);
|
||||
add_varargs_method("export", &Module::exporter);
|
||||
initialize("This module is the DrawingGui module.");// register with Python
|
||||
initialize("This module is the DrawingGui module."); // register with Python
|
||||
}
|
||||
|
||||
virtual ~Module()
|
||||
@@ -209,7 +209,7 @@ private:
|
||||
|
||||
Drawing::ProjectionAlgos project(shape, dir);
|
||||
str_out << project.getDXF(type, scale, tol);
|
||||
break;// TODO: How to add several shapes?
|
||||
break; // TODO: How to add several shapes?
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,4 +237,4 @@ PyObject* initModule()
|
||||
return Base::Interpreter().addModule(new Module);
|
||||
}
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
@@ -507,7 +507,7 @@ void DrawingView::printPdf()
|
||||
item->setData(Qt::UserRole, QVariant(QPageSize::A4));
|
||||
item = new QListWidgetItem(tr("A5"), listWidget);
|
||||
item->setData(Qt::UserRole, QVariant(QPageSize::A5));
|
||||
int index = 4;// by default A4
|
||||
int index = 4; // by default A4
|
||||
for (int i = 0; i < listWidget->count(); i++) {
|
||||
if (listWidget->item(i)->data(Qt::UserRole).toInt() == m_pageSize) {
|
||||
index = i;
|
||||
@@ -646,36 +646,36 @@ void DrawingView::print(QPrinter* printer)
|
||||
QPageSize::PageSizeId DrawingView::getPageSize(int w, int h) const
|
||||
{
|
||||
static const float paperSizes[][2] = {
|
||||
{210, 297}, // A4
|
||||
{176, 250}, // B5
|
||||
{215.9f, 279.4f},// Letter
|
||||
{215.9f, 355.6f},// Legal
|
||||
{190.5f, 254}, // Executive
|
||||
{841, 1189}, // A0
|
||||
{594, 841}, // A1
|
||||
{420, 594}, // A2
|
||||
{297, 420}, // A3
|
||||
{148, 210}, // A5
|
||||
{105, 148}, // A6
|
||||
{74, 105}, // A7
|
||||
{52, 74}, // A8
|
||||
{37, 52}, // A8
|
||||
{1000, 1414}, // B0
|
||||
{707, 1000}, // B1
|
||||
{31, 44}, // B10
|
||||
{500, 707}, // B2
|
||||
{353, 500}, // B3
|
||||
{250, 353}, // B4
|
||||
{125, 176}, // B6
|
||||
{88, 125}, // B7
|
||||
{62, 88}, // B8
|
||||
{33, 62}, // B9
|
||||
{163, 229}, // C5E
|
||||
{105, 241}, // US Common
|
||||
{110, 220}, // DLE
|
||||
{210, 330}, // Folio
|
||||
{431.8f, 279.4f},// Ledger
|
||||
{279.4f, 431.8f} // Tabloid
|
||||
{210, 297}, // A4
|
||||
{176, 250}, // B5
|
||||
{215.9f, 279.4f}, // Letter
|
||||
{215.9f, 355.6f}, // Legal
|
||||
{190.5f, 254}, // Executive
|
||||
{841, 1189}, // A0
|
||||
{594, 841}, // A1
|
||||
{420, 594}, // A2
|
||||
{297, 420}, // A3
|
||||
{148, 210}, // A5
|
||||
{105, 148}, // A6
|
||||
{74, 105}, // A7
|
||||
{52, 74}, // A8
|
||||
{37, 52}, // A8
|
||||
{1000, 1414}, // B0
|
||||
{707, 1000}, // B1
|
||||
{31, 44}, // B10
|
||||
{500, 707}, // B2
|
||||
{353, 500}, // B3
|
||||
{250, 353}, // B4
|
||||
{125, 176}, // B6
|
||||
{88, 125}, // B7
|
||||
{62, 88}, // B8
|
||||
{33, 62}, // B9
|
||||
{163, 229}, // C5E
|
||||
{105, 241}, // US Common
|
||||
{110, 220}, // DLE
|
||||
{210, 330}, // Folio
|
||||
{431.8f, 279.4f}, // Ledger
|
||||
{279.4f, 431.8f} // Tabloid
|
||||
};
|
||||
|
||||
QPageSize::PageSizeId ps = QPageSize::Custom;
|
||||
|
||||
@@ -133,6 +133,6 @@ private:
|
||||
QPageSize::PageSizeId m_pageSize;
|
||||
};
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
#endif// DRAWINGGUI_DRAWINGVIEW_H
|
||||
#endif // DRAWINGGUI_DRAWINGVIEW_H
|
||||
|
||||
@@ -64,6 +64,6 @@
|
||||
#include <QTimer>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#endif//_PreComp_
|
||||
#endif //_PreComp_
|
||||
|
||||
#endif// DRAWINGGUI_PRECOMPILED_H
|
||||
#endif // DRAWINGGUI_PRECOMPILED_H
|
||||
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
|
||||
#endif// DRAWINGGUI_TASKDIALOG
|
||||
#endif // DRAWINGGUI_TASKDIALOG
|
||||
|
||||
@@ -42,7 +42,7 @@ using namespace DrawingGui;
|
||||
using namespace std;
|
||||
namespace bp = boost::placeholders;
|
||||
|
||||
#if 0// needed for Qt's lupdate utility
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
qApp->translate("QObject", "Make axonometric...");
|
||||
qApp->translate("QObject", "Edit axonometric settings...");
|
||||
qApp->translate("QObject", "Make orthographic");
|
||||
@@ -51,12 +51,12 @@ namespace bp = boost::placeholders;
|
||||
|
||||
void pagesize(string& page_template, int dims[4], int block[4])
|
||||
{
|
||||
dims[0] = 10;// default to A4_Landscape with 10mm margins
|
||||
dims[0] = 10; // default to A4_Landscape with 10mm margins
|
||||
dims[1] = 10;
|
||||
dims[2] = 287;
|
||||
dims[3] = 200;
|
||||
|
||||
block[0] = block[1] = 0;// default to no title block
|
||||
block[0] = block[1] = 0; // default to no title block
|
||||
block[2] = block[3] = 0;
|
||||
|
||||
int t0, t1, t2, t3 = 0;
|
||||
@@ -65,8 +65,8 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
Base::FileInfo fi(page_template);
|
||||
if (!fi.isReadable()) {
|
||||
fi.setFile(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName());
|
||||
if (!fi.isReadable()) {// if so then really shouldn't have been able to get this far, but
|
||||
// just in case...
|
||||
if (!fi.isReadable()) { // if so then really shouldn't have been able to get this far, but
|
||||
// just in case...
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
&dims[0],
|
||||
&dims[1],
|
||||
&dims[2],
|
||||
&dims[3]);// eg " <!-- Working space 10 10 410 287 -->"
|
||||
&dims[3]); // eg " <!-- Working space 10 10 410 287 -->"
|
||||
getline(file, line);
|
||||
|
||||
if (line.find("<!-- Title block") != string::npos) {
|
||||
@@ -92,13 +92,13 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
&t0,
|
||||
&t1,
|
||||
&t2,
|
||||
&t3);// eg " <!-- Working space 10 10 410 287 -->"
|
||||
&t3); // eg " <!-- Working space 10 10 410 287 -->"
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (line.find("metadata") != string::npos) {// give up if we meet a metadata tag
|
||||
if (line.find("metadata") != string::npos) { // give up if we meet a metadata tag
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,26 +108,26 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
|
||||
|
||||
if (t3 != 0) {
|
||||
block[2] = t2 - t0;// block width
|
||||
block[3] = t3 - t1;// block height
|
||||
block[2] = t2 - t0; // block width
|
||||
block[3] = t3 - t1; // block height
|
||||
|
||||
if (t0 <= dims[0]) {// title block on left
|
||||
if (t0 <= dims[0]) { // title block on left
|
||||
block[0] = -1;
|
||||
}
|
||||
else if (t2 >= dims[2]) {// title block on right
|
||||
else if (t2 >= dims[2]) { // title block on right
|
||||
block[0] = 1;
|
||||
}
|
||||
|
||||
if (t1 <= dims[1]) {// title block at top
|
||||
if (t1 <= dims[1]) { // title block at top
|
||||
block[1] = 1;
|
||||
}
|
||||
else if (t3 >= dims[3]) {// title block at bottom
|
||||
else if (t3 >= dims[3]) { // title block at bottom
|
||||
block[1] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
dims[2] -= dims[0];// width
|
||||
dims[3] -= dims[1];// height
|
||||
dims[2] -= dims[0]; // width
|
||||
dims[3] -= dims[1]; // height
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ void orthoview::set_data(int r_x, int r_y)
|
||||
rel_y = r_y;
|
||||
|
||||
char label[15];
|
||||
sprintf(label, "Ortho_%i_%i", rel_x, rel_y);// label name for view, based on relative position
|
||||
sprintf(label, "Ortho_%i_%i", rel_x, rel_y); // label name for view, based on relative position
|
||||
|
||||
this_view->Label.setValue(label);
|
||||
ortho = ((rel_x * rel_y) == 0);
|
||||
@@ -288,7 +288,7 @@ OrthoViews::OrthoViews(App::Document* doc, const char* pagename, const char* par
|
||||
Gui::Application::Instance->showViewProvider(page);
|
||||
load_page();
|
||||
|
||||
min_space = 15;// should be preferenced
|
||||
min_space = 15; // should be preferenced
|
||||
|
||||
min_r_x = max_r_x = 0;
|
||||
min_r_y = max_r_y = 0;
|
||||
@@ -357,15 +357,15 @@ void OrthoViews::load_page()
|
||||
title = true;
|
||||
|
||||
// max vertical space avoiding title block
|
||||
small_v[1] = large[1]; // y margin same as large page
|
||||
small_v[3] = large[3]; // y size same as large page
|
||||
small_v[2] = large[2] - block[2];// x width same as large width - block width
|
||||
small_v[1] = large[1]; // y margin same as large page
|
||||
small_v[3] = large[3]; // y size same as large page
|
||||
small_v[2] = large[2] - block[2]; // x width same as large width - block width
|
||||
if (block[0] == -1) {
|
||||
small_v[0] = large[0] + block[2];// x margin same as large + block width
|
||||
small_v[0] = large[0] + block[2]; // x margin same as large + block width
|
||||
horiz = &min_r_x;
|
||||
}
|
||||
else {
|
||||
small_v[0] = large[0];// x margin same as large
|
||||
small_v[0] = large[0]; // x margin same as large
|
||||
horiz = &max_r_x;
|
||||
}
|
||||
|
||||
@@ -387,8 +387,8 @@ void OrthoViews::load_page()
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::calc_layout_size()// calculate the real world size of given view layout, assuming
|
||||
// no space
|
||||
void OrthoViews::calc_layout_size() // calculate the real world size of given view layout, assuming
|
||||
// no space
|
||||
{
|
||||
// note that views in relative positions x = -4, -2, 0 , 2 etc etc
|
||||
// have width = orientated part width
|
||||
@@ -403,44 +403,44 @@ void OrthoViews::calc_layout_size()// calculate the real world size of given vie
|
||||
layout_height += (ceil(max_r_y / 2.0) + ceil(-min_r_y / 2.0)) * depth;
|
||||
}
|
||||
|
||||
void OrthoViews::choose_page()// chooses which bit of page space to use depending upon layout &
|
||||
// titleblock
|
||||
void OrthoViews::choose_page() // chooses which bit of page space to use depending upon layout &
|
||||
// titleblock
|
||||
{
|
||||
int h = abs(
|
||||
*horiz);// how many views in direction of title block (horiz points to min_r_x or max_r_x)
|
||||
int h = abs(*horiz); // how many views in direction of title block (horiz points to min_r_x or
|
||||
// max_r_x)
|
||||
int v = abs(*vert);
|
||||
float layout_corner_width = (1 + floor(h / 2.0)) * width
|
||||
+ ceil(h / 2.0) * depth;// from (0, 0) view inclusively, how wide and tall is the layout in
|
||||
// the direction of the title block
|
||||
+ ceil(h / 2.0) * depth; // from (0, 0) view inclusively, how wide and tall is the layout
|
||||
// in the direction of the title block
|
||||
float layout_corner_height = (1 + floor(v / 2.0)) * height + ceil(v / 2.0) * depth;
|
||||
float rel_space_x = layout_corner_width / layout_width
|
||||
- 1.0 * block[2] / large[2];// relative to respective sizes, how much space between (0, 0)
|
||||
// and title block,
|
||||
- 1.0 * block[2] / large[2]; // relative to respective sizes, how much space between (0, 0)
|
||||
// and title block,
|
||||
float rel_space_y = layout_corner_height / layout_height
|
||||
- 1.0 * block[3]
|
||||
/ large[3];// can be -ve if block extends into / beyond (0, 0) view
|
||||
- 1.0 * block[3] / large[3]; // can be -ve if block extends into /
|
||||
// beyond (0, 0) view
|
||||
float view_x, view_y, v_x_r, v_y_r;
|
||||
bool interferes = false;
|
||||
float a, b;
|
||||
|
||||
for (int i = min_r_x; i <= max_r_x; i++) {
|
||||
for (int j = min_r_y; j <= max_r_y; j++) {
|
||||
if (index(i, j) != -1)// is there a view in this position?
|
||||
if (index(i, j) != -1) // is there a view in this position?
|
||||
{
|
||||
a = i * block[0]
|
||||
* 0.5;// reflect i and j so as +ve is in direction of title block ##
|
||||
* 0.5; // reflect i and j so as +ve is in direction of title block ##
|
||||
b = j * block[1] * 0.5;
|
||||
view_x = ceil(a + 0.5) * width
|
||||
+ ceil(a) * depth;// extreme coords of view in direction of block, measured from
|
||||
// far corner of (0, 0) view,
|
||||
+ ceil(a) * depth; // extreme coords of view in direction of block, measured
|
||||
// from far corner of (0, 0) view,
|
||||
view_y = ceil(b + 0.5) * height
|
||||
+ ceil(b) * depth;// can be -ve if view is on opposite side
|
||||
// of (0, 0) from title block
|
||||
v_x_r = view_x / layout_width;// make relative
|
||||
+ ceil(b) * depth; // can be -ve if view is on opposite
|
||||
// side of (0, 0) from title block
|
||||
v_x_r = view_x / layout_width; // make relative
|
||||
v_y_r = view_y / layout_height;
|
||||
if (v_x_r > rel_space_x
|
||||
&& v_y_r > rel_space_y) {// ## so that can use > in this condition regardless of
|
||||
// position of block
|
||||
&& v_y_r > rel_space_y) { // ## so that can use > in this condition regardless
|
||||
// of position of block
|
||||
interferes = true;
|
||||
}
|
||||
}
|
||||
@@ -461,7 +461,7 @@ void OrthoViews::choose_page()// chooses which bit of page space to use dependin
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::calc_scale()// compute scale required to meet minimum space requirements
|
||||
void OrthoViews::calc_scale() // compute scale required to meet minimum space requirements
|
||||
{
|
||||
float scale_x, scale_y, working_scale;
|
||||
|
||||
@@ -474,24 +474,24 @@ void OrthoViews::calc_scale()// compute scale required to meet minimum space req
|
||||
// 'sensible' scale, rather than 0.28457239... eg if working_scale = 0.115, then we want to use
|
||||
// 0.1, similarly 7.65 -> 5, and 76.5 -> 50
|
||||
|
||||
float exponent = floor(log10(working_scale));// if working_scale = a * 10^b, what is b?
|
||||
working_scale *= pow(10, -exponent); // now find what 'a' is.
|
||||
float exponent = floor(log10(working_scale)); // if working_scale = a * 10^b, what is b?
|
||||
working_scale *= pow(10, -exponent); // now find what 'a' is.
|
||||
|
||||
float valid_scales[2][8] = {
|
||||
{1, 1.25, 2, 2.5, 3.75, 5, 7.5, 10},// equate to 1:10, 1:8, 1:5, 1:4, 3:8, 1:2, 3:4, 1:1
|
||||
{1, 1.5, 2, 3, 4, 5, 8, 10}}; // equate to 1:1, 3:2, 2:1, 3:1, 4:1, 5:1, 8:1, 10:1
|
||||
{1, 1.25, 2, 2.5, 3.75, 5, 7.5, 10}, // equate to 1:10, 1:8, 1:5, 1:4, 3:8, 1:2, 3:4, 1:1
|
||||
{1, 1.5, 2, 3, 4, 5, 8, 10}}; // equate to 1:1, 3:2, 2:1, 3:1, 4:1, 5:1, 8:1, 10:1
|
||||
|
||||
int i = 7;
|
||||
while (valid_scales[(exponent >= 0)][i]
|
||||
> working_scale) {// choose closest value smaller than 'a' from list.
|
||||
i -= 1; // choosing top list if exponent -ve, bottom list for +ve exponent
|
||||
> working_scale) { // choose closest value smaller than 'a' from list.
|
||||
i -= 1; // choosing top list if exponent -ve, bottom list for +ve exponent
|
||||
}
|
||||
|
||||
scale = valid_scales[(exponent >= 0)][i]
|
||||
* pow(10, exponent);// now have the appropriate scale, reapply the *10^b
|
||||
* pow(10, exponent); // now have the appropriate scale, reapply the *10^b
|
||||
}
|
||||
|
||||
void OrthoViews::calc_offsets()// calcs SVG coords for centre of upper left view
|
||||
void OrthoViews::calc_offsets() // calcs SVG coords for centre of upper left view
|
||||
{
|
||||
// space_x is the empty clear white space between views
|
||||
// gap_x is the centre - centre distance between views
|
||||
@@ -517,7 +517,7 @@ void OrthoViews::calc_offsets()// calcs SVG coords for centre of upper left view
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_views()// process all views - scale & positions
|
||||
void OrthoViews::set_views() // process all views - scale & positions
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
@@ -534,7 +534,7 @@ void OrthoViews::set_views()// process all views - scale & positions
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::process_views()// update scale and positions of views
|
||||
void OrthoViews::process_views() // update scale and positions of views
|
||||
{
|
||||
if (autodims) {
|
||||
calc_layout_size();
|
||||
@@ -573,7 +573,8 @@ void OrthoViews::set_smooth(bool state)
|
||||
parent_doc->recompute();
|
||||
}
|
||||
|
||||
void OrthoViews::set_primary(gp_Dir facing, gp_Dir right)// set the orientation of the primary view
|
||||
void OrthoViews::set_primary(gp_Dir facing,
|
||||
gp_Dir right) // set the orientation of the primary view
|
||||
{
|
||||
primary.SetDirection(facing);
|
||||
primary.SetXDirection(right);
|
||||
@@ -591,16 +592,16 @@ void OrthoViews::set_primary(gp_Dir facing, gp_Dir right)// set the orientation
|
||||
}
|
||||
else {
|
||||
views[0]->set_projection(primary);
|
||||
set_all_orientations();// reorient all other views appropriately
|
||||
set_all_orientations(); // reorient all other views appropriately
|
||||
process_views();
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_orientation(int index)// set orientation of single view
|
||||
void OrthoViews::set_orientation(int index) // set orientation of single view
|
||||
{
|
||||
double rotation;
|
||||
int n; // how many 90* rotations from primary view?
|
||||
gp_Dir dir;// rotate about primary x axis (if in a relative y position) or y axis?
|
||||
int n; // how many 90* rotations from primary view?
|
||||
gp_Dir dir; // rotate about primary x axis (if in a relative y position) or y axis?
|
||||
gp_Ax2 cs;
|
||||
|
||||
if (views[index]->ortho) {
|
||||
@@ -613,16 +614,16 @@ void OrthoViews::set_orientation(int index)// set orientation of single view
|
||||
n = -views[index]->rel_y;
|
||||
}
|
||||
|
||||
rotation = n * rotate_coeff * M_PI / 2;// rotate_coeff is -1 or 1 for 1st or 3rd angle
|
||||
rotation = n * rotate_coeff * M_PI / 2; // rotate_coeff is -1 or 1 for 1st or 3rd angle
|
||||
cs = primary.Rotated(gp_Ax1(gp_Pnt(0, 0, 0), dir), rotation);
|
||||
views[index]->set_projection(cs);
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_all_orientations()// set orientations of all views (ie projection or primary
|
||||
// changed)
|
||||
void OrthoViews::set_all_orientations() // set orientations of all views (ie projection or primary
|
||||
// changed)
|
||||
{
|
||||
for (unsigned int i = 1; i < views.size(); i++)// start from 1 - the 0 is the primary view
|
||||
for (unsigned int i = 1; i < views.size(); i++) // start from 1 - the 0 is the primary view
|
||||
{
|
||||
if (views[i]->ortho) {
|
||||
set_orientation(i);
|
||||
@@ -633,7 +634,7 @@ void OrthoViews::set_all_orientations()// set orientations of all views (ie proj
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_projection(int proj)// 1 = 1st angle, 3 = 3rd angle
|
||||
void OrthoViews::set_projection(int proj) // 1 = 1st angle, 3 = 3rd angle
|
||||
{
|
||||
if (proj == 3) {
|
||||
rotate_coeff = 1;
|
||||
@@ -646,7 +647,7 @@ void OrthoViews::set_projection(int proj)// 1 = 1st angle, 3 = 3rd angle
|
||||
process_views();
|
||||
}
|
||||
|
||||
void OrthoViews::add_view(int rel_x, int rel_y)// add a new view to the layout
|
||||
void OrthoViews::add_view(int rel_x, int rel_y) // add a new view to the layout
|
||||
{
|
||||
if (index(rel_x, rel_y) == -1) {
|
||||
orthoview* view = new orthoview(parent_doc, part, page, &bbox);
|
||||
@@ -676,7 +677,7 @@ void OrthoViews::add_view(int rel_x, int rel_y)// add a new view to the layout
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::del_view(int rel_x, int rel_y)// remove a view from the layout
|
||||
void OrthoViews::del_view(int rel_x, int rel_y) // remove a view from the layout
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
@@ -691,9 +692,9 @@ void OrthoViews::del_view(int rel_x, int rel_y)// remove a view from the layout
|
||||
min_r_x = max_r_x = 0;
|
||||
min_r_y = max_r_y = 0;
|
||||
|
||||
for (unsigned int i = 1; i < views.size(); i++)// start from 1 - the 0 is the primary view
|
||||
for (unsigned int i = 1; i < views.size(); i++) // start from 1 - the 0 is the primary view
|
||||
{
|
||||
min_r_x = min(min_r_x, views[i]->rel_x);// calculate extremes from remaining views
|
||||
min_r_x = min(min_r_x, views[i]->rel_x); // calculate extremes from remaining views
|
||||
max_r_x = max(max_r_x, views[i]->rel_x);
|
||||
min_r_y = min(min_r_y, views[i]->rel_y);
|
||||
max_r_y = max(max_r_y, views[i]->rel_y);
|
||||
@@ -709,7 +710,7 @@ void OrthoViews::del_view(int rel_x, int rel_y)// remove a view from the layout
|
||||
void OrthoViews::del_all()
|
||||
{
|
||||
boost::signals2::shared_connection_block blocker(connectDocumentDeletedObject);
|
||||
for (int i = views.size() - 1; i >= 0; i--)// count downwards to delete from back
|
||||
for (int i = views.size() - 1; i >= 0; i--) // count downwards to delete from back
|
||||
{
|
||||
views[i]->deleteme();
|
||||
delete views[i];
|
||||
@@ -717,7 +718,7 @@ void OrthoViews::del_all()
|
||||
}
|
||||
}
|
||||
|
||||
int OrthoViews::is_Ortho(int rel_x, int rel_y)// is the view at r_x, r_y an ortho or axo one?
|
||||
int OrthoViews::is_Ortho(int rel_x, int rel_y) // is the view at r_x, r_y an ortho or axo one?
|
||||
{
|
||||
int result = index(rel_x, rel_y);
|
||||
|
||||
@@ -728,7 +729,7 @@ int OrthoViews::is_Ortho(int rel_x, int rel_y)// is the view at r_x, r_y an orth
|
||||
return result;
|
||||
}
|
||||
|
||||
int OrthoViews::index(int rel_x, int rel_y)// index in vector of view, -1 if doesn't exist
|
||||
int OrthoViews::index(int rel_x, int rel_y) // index in vector of view, -1 if doesn't exist
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
@@ -744,7 +745,7 @@ int OrthoViews::index(int rel_x, int rel_y)// index in vector of view, -1 if doe
|
||||
|
||||
void OrthoViews::set_Axo_scale(int rel_x,
|
||||
int rel_y,
|
||||
float axo_scale)// set an axo scale independent of ortho ones
|
||||
float axo_scale) // set an axo scale independent of ortho ones
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
@@ -762,7 +763,7 @@ void OrthoViews::set_Axo(int rel_x,
|
||||
gp_Dir right,
|
||||
bool away,
|
||||
int axo,
|
||||
bool tri)// set custom axonometric view
|
||||
bool tri) // set custom axonometric view
|
||||
{
|
||||
double rotations[2];
|
||||
|
||||
@@ -810,18 +811,18 @@ void OrthoViews::set_Axo(int rel_x,
|
||||
parent_doc->recompute();
|
||||
}
|
||||
|
||||
void OrthoViews::set_Axo(int rel_x, int rel_y)// set view to default axo projection
|
||||
void OrthoViews::set_Axo(int rel_x, int rel_y) // set view to default axo projection
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
if (num != -1) {
|
||||
gp_Dir up = primary.YDirection();// default to view from up and right
|
||||
gp_Dir up = primary.YDirection(); // default to view from up and right
|
||||
gp_Dir right = primary.XDirection();
|
||||
bool away = false;
|
||||
|
||||
if (rel_x * rel_y != 0)// but change default if it's a diagonal position
|
||||
if (rel_x * rel_y != 0) // but change default if it's a diagonal position
|
||||
{
|
||||
if (rotate_coeff == 1)// third angle
|
||||
if (rotate_coeff == 1) // third angle
|
||||
{
|
||||
away = (rel_y < 0);
|
||||
|
||||
@@ -832,7 +833,7 @@ void OrthoViews::set_Axo(int rel_x, int rel_y)// set view to default axo project
|
||||
right = primary.XDirection();
|
||||
}
|
||||
}
|
||||
else// first angle
|
||||
else // first angle
|
||||
{
|
||||
away = (rel_y > 0);
|
||||
|
||||
@@ -848,7 +849,7 @@ void OrthoViews::set_Axo(int rel_x, int rel_y)// set view to default axo project
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_Ortho(int rel_x, int rel_y)// return view to orthographic
|
||||
void OrthoViews::set_Ortho(int rel_x, int rel_y) // return view to orthographic
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
@@ -896,7 +897,7 @@ void OrthoViews::auto_dims(bool setting)
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_configs(float configs[5])// for autodims off, set scale & positionings
|
||||
void OrthoViews::set_configs(float configs[5]) // for autodims off, set scale & positionings
|
||||
{
|
||||
if (!autodims) {
|
||||
scale = configs[0];
|
||||
@@ -908,7 +909,7 @@ void OrthoViews::set_configs(float configs[5])// for autodims off, set scale & p
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::get_configs(float configs[5])// get scale & positionings
|
||||
void OrthoViews::get_configs(float configs[5]) // get scale & positionings
|
||||
{
|
||||
configs[0] = scale;
|
||||
configs[1] = offset_x;
|
||||
@@ -948,24 +949,24 @@ TaskOrthoViews::TaskOrthoViews(QWidget* parent)
|
||||
// **********************************************************************
|
||||
|
||||
// [x+2][y+2]
|
||||
c_boxes[0][2] = ui->cb02;// left most, x = -2, y = 0
|
||||
c_boxes[0][2] = ui->cb02; // left most, x = -2, y = 0
|
||||
c_boxes[1][1] = ui->cb11;
|
||||
c_boxes[1][2] = ui->cb12;
|
||||
c_boxes[1][3] = ui->cb13;
|
||||
c_boxes[2][0] = ui->cb20;// top most, x = 0, y = -2
|
||||
c_boxes[2][0] = ui->cb20; // top most, x = 0, y = -2
|
||||
c_boxes[2][1] = ui->cb21;
|
||||
c_boxes[2][2] = ui->cb22;// centre (primary view) checkbox x = y = 0.
|
||||
c_boxes[2][2] = ui->cb22; // centre (primary view) checkbox x = y = 0.
|
||||
c_boxes[2][3] = ui->cb23;
|
||||
c_boxes[2][4] = ui->cb24;// bottom most, x = 0, y = 2
|
||||
c_boxes[2][4] = ui->cb24; // bottom most, x = 0, y = 2
|
||||
c_boxes[3][1] = ui->cb31;
|
||||
c_boxes[3][2] = ui->cb32;
|
||||
c_boxes[3][3] = ui->cb33;
|
||||
c_boxes[4][2] = ui->cb42;// right most, x = 2, y = 0
|
||||
c_boxes[4][2] = ui->cb42; // right most, x = 2, y = 0
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if ((abs(i - 2) + abs(j - 2))
|
||||
< 3)// if i,j combination corresponds to valid check box, then proceed with:
|
||||
< 3) // if i,j combination corresponds to valid check box, then proceed with:
|
||||
{
|
||||
connect(c_boxes[i][j], SIGNAL(toggled(bool)), this, SLOT(cb_toggled(bool)));
|
||||
connect(c_boxes[i][j],
|
||||
@@ -1018,7 +1019,7 @@ TaskOrthoViews::TaskOrthoViews(QWidget* parent)
|
||||
orthos->set_primary(facing, right);
|
||||
|
||||
txt_return = false;
|
||||
}// end of constructor
|
||||
} // end of constructor
|
||||
|
||||
TaskOrthoViews::~TaskOrthoViews()
|
||||
{
|
||||
@@ -1056,7 +1057,7 @@ void TaskOrthoViews::ShowContextMenu(const QPoint& pos)
|
||||
if (selectedItem) {
|
||||
QString text = selectedItem->text();
|
||||
|
||||
if (text == str_1)// make axo
|
||||
if (text == str_1) // make axo
|
||||
{
|
||||
orthos->set_Axo(dx, -dy);
|
||||
axo_r_x = dx;
|
||||
@@ -1065,7 +1066,7 @@ void TaskOrthoViews::ShowContextMenu(const QPoint& pos)
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
setup_axo_tab();
|
||||
}
|
||||
else if (text == str_2)// edit axo
|
||||
else if (text == str_2) // edit axo
|
||||
{
|
||||
axo_r_x = dx;
|
||||
axo_r_y = dy;
|
||||
@@ -1073,7 +1074,7 @@ void TaskOrthoViews::ShowContextMenu(const QPoint& pos)
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
setup_axo_tab();
|
||||
}
|
||||
else if (text == str_3)// make ortho
|
||||
else if (text == str_3) // make ortho
|
||||
{
|
||||
orthos->set_Ortho(dx, -dy);
|
||||
if (dx == axo_r_x && dy == axo_r_y) {
|
||||
@@ -1104,7 +1105,7 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
|
||||
if (toggle) {
|
||||
orthos->add_view(dx, -dy);
|
||||
if (dx * dy != 0)// adding an axo view
|
||||
if (dx * dy != 0) // adding an axo view
|
||||
{
|
||||
axo_r_x = dx;
|
||||
axo_r_y = dy;
|
||||
@@ -1113,11 +1114,11 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
setup_axo_tab();
|
||||
}
|
||||
}
|
||||
else// removing a view
|
||||
else // removing a view
|
||||
{
|
||||
if (!orthos->is_Ortho(dx, -dy))// is it an axo one?
|
||||
if (!orthos->is_Ortho(dx, -dy)) // is it an axo one?
|
||||
{
|
||||
if (dx == axo_r_x && dy == axo_r_y)// is it the one currently being edited?
|
||||
if (dx == axo_r_x && dy == axo_r_y) // is it the one currently being edited?
|
||||
{
|
||||
axo_r_x = 0;
|
||||
axo_r_y = 0;
|
||||
@@ -1132,7 +1133,7 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
|
||||
void TaskOrthoViews::projectionChanged(int index)
|
||||
{
|
||||
int proj = 3 - 2 * index;// index = 0 = third angle
|
||||
int proj = 3 - 2 * index; // index = 0 = third angle
|
||||
orthos->set_projection(proj);
|
||||
|
||||
set_configs();
|
||||
@@ -1140,24 +1141,24 @@ void TaskOrthoViews::projectionChanged(int index)
|
||||
|
||||
void TaskOrthoViews::setPrimary(int /*dir*/)
|
||||
{
|
||||
int p_sel = ui->view_from->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axis_right->currentIndex();// index for entry selected for 'rightwards axis'
|
||||
int p_sel = ui->view_from->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axis_right->currentIndex(); // index for entry selected for 'rightwards axis'
|
||||
|
||||
int p_vec[3] = {0, 0, 0};// will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0};// will be vector for 'rightwards axis'
|
||||
int p_vec[3] = {0, 0, 0}; // will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0}; // will be vector for 'rightwards axis'
|
||||
int r[2] = {0, 1};
|
||||
|
||||
int pos = 1 - 2 * int(p_sel / 3);// 1 if p_sel = 0, 1, 2 or -1 if p_sel = 3, 4, 5
|
||||
p_sel = p_sel % 3; // p_sel = 0, 1, 2
|
||||
int pos = 1 - 2 * int(p_sel / 3); // 1 if p_sel = 0, 1, 2 or -1 if p_sel = 3, 4, 5
|
||||
p_sel = p_sel % 3; // p_sel = 0, 1, 2
|
||||
p_vec[p_sel] = pos;
|
||||
|
||||
for (int i = p_sel; i < 2;
|
||||
i++) {// make r[2] to be, {0, 1}, {0, 2}, or {1, 2} depending upon p_sel
|
||||
i++) { // make r[2] to be, {0, 1}, {0, 2}, or {1, 2} depending upon p_sel
|
||||
r[i] += 1;
|
||||
}
|
||||
|
||||
pos = 1 - 2 * int(r_sel / 2);// 1 if r_sel = 0, 1 or -1 if r_sel = 3, 4
|
||||
r_sel = r_sel % 2; // r_sel = 0, 1
|
||||
pos = 1 - 2 * int(r_sel / 2); // 1 if r_sel = 0, 1 or -1 if r_sel = 3, 4
|
||||
r_sel = r_sel % 2; // r_sel = 0, 1
|
||||
r_vec[r[r_sel]] = pos;
|
||||
|
||||
gp_Dir facing = gp_Dir(p_vec[0], p_vec[1], p_vec[2]);
|
||||
@@ -1200,7 +1201,7 @@ void TaskOrthoViews::smooth(int i)
|
||||
|
||||
void TaskOrthoViews::toggle_auto(int i)
|
||||
{
|
||||
if (i == 2)// auto scale switched on
|
||||
if (i == 2) // auto scale switched on
|
||||
{
|
||||
orthos->auto_dims(true);
|
||||
ui->label_4->setEnabled(false);
|
||||
@@ -1208,7 +1209,7 @@ void TaskOrthoViews::toggle_auto(int i)
|
||||
ui->label_6->setEnabled(false);
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
inputs[j]->setEnabled(false);// disable user input boxes
|
||||
inputs[j]->setEnabled(false); // disable user input boxes
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1218,7 +1219,7 @@ void TaskOrthoViews::toggle_auto(int i)
|
||||
ui->label_6->setEnabled(true);
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
inputs[j]->setEnabled(true);// enable user input boxes
|
||||
inputs[j]->setEnabled(true); // enable user input boxes
|
||||
}
|
||||
set_configs();
|
||||
}
|
||||
@@ -1305,15 +1306,15 @@ void TaskOrthoViews::setup_axo_tab()
|
||||
|
||||
void TaskOrthoViews::change_axo(int /*p*/)
|
||||
{
|
||||
int u_sel = ui->axoUp->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axoRight->currentIndex();// index for entry selected for 'rightwards axis'
|
||||
int u_sel = ui->axoUp->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axoRight->currentIndex(); // index for entry selected for 'rightwards axis'
|
||||
|
||||
int u_vec[3] = {0, 0, 0};// will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0};// will be vector for 'rightwards axis'
|
||||
int u_vec[3] = {0, 0, 0}; // will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0}; // will be vector for 'rightwards axis'
|
||||
int r[2] = {0, 1};
|
||||
|
||||
int pos = 1 - 2 * int(u_sel / 3);// 1 if p_sel = 0,1,2 or -1 if p_sel = 3,4,5
|
||||
u_sel = u_sel % 3; // p_sel = 0,1,2
|
||||
int pos = 1 - 2 * int(u_sel / 3); // 1 if p_sel = 0,1,2 or -1 if p_sel = 3,4,5
|
||||
u_sel = u_sel % 3; // p_sel = 0,1,2
|
||||
u_vec[u_sel] = pos;
|
||||
|
||||
for (int i = u_sel; i < 2; i++) {
|
||||
@@ -1381,13 +1382,13 @@ void TaskOrthoViews::set_configs()
|
||||
bool TaskOrthoViews::user_input()
|
||||
{
|
||||
if (txt_return) {
|
||||
txt_return = false; // return was pressed while text box had focus
|
||||
ui->label_7->setFocus();// move focus out of text box
|
||||
return true; // return that we were editing
|
||||
txt_return = false; // return was pressed while text box had focus
|
||||
ui->label_7->setFocus(); // move focus out of text box
|
||||
return true; // return that we were editing
|
||||
}
|
||||
else {
|
||||
return false;// return that we weren't editing ---> treat as clicking OK... we can close the
|
||||
// GUI
|
||||
return false; // return that we weren't editing ---> treat as clicking OK... we can close
|
||||
// the GUI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,26 +67,26 @@ public:
|
||||
private:
|
||||
void calcCentre();
|
||||
|
||||
public: // these aren't used by orthoView, but just informational, hence public
|
||||
bool ortho; // orthonometric? or axonometric
|
||||
bool auto_scale; // scale for axonometric has not been manually changed?
|
||||
int rel_x, rel_y;// relative position of this view
|
||||
bool away, tri; // binary parameters for axonometric view
|
||||
int axo; // 0 / 1 / 2 = iso / di / tri metric
|
||||
public: // these aren't used by orthoView, but just informational, hence public
|
||||
bool ortho; // orthonometric? or axonometric
|
||||
bool auto_scale; // scale for axonometric has not been manually changed?
|
||||
int rel_x, rel_y; // relative position of this view
|
||||
bool away, tri; // binary parameters for axonometric view
|
||||
int axo; // 0 / 1 / 2 = iso / di / tri metric
|
||||
gp_Dir up,
|
||||
right;// directions prior to rotations (ie, what was used to orientate the projection)
|
||||
right; // directions prior to rotations (ie, what was used to orientate the projection)
|
||||
|
||||
private:
|
||||
App::Document* parent_doc;
|
||||
Drawing::FeatureViewPart* this_view;
|
||||
|
||||
std::string myname;
|
||||
float x, y; // 2D projection coords of bbox centre relative to origin
|
||||
float cx, cy, cz; // coords of bbox centre in 3D space
|
||||
float pageX, pageY; // required coords of centre of bbox projection on page
|
||||
float scale; // scale of projection
|
||||
gp_Dir X_dir, Y_dir, Z_dir;// directions of projection, X_dir makes x on page, Y_dir is y on
|
||||
// page, Z_dir is out of page
|
||||
float x, y; // 2D projection coords of bbox centre relative to origin
|
||||
float cx, cy, cz; // coords of bbox centre in 3D space
|
||||
float pageX, pageY; // required coords of centre of bbox projection on page
|
||||
float scale; // scale of projection
|
||||
gp_Dir X_dir, Y_dir, Z_dir; // directions of projection, X_dir makes x on page, Y_dir is y on
|
||||
// page, Z_dir is out of page
|
||||
};
|
||||
|
||||
|
||||
@@ -128,11 +128,12 @@ public:
|
||||
|
||||
private:
|
||||
void set_orientation(int index);
|
||||
void load_page();// get page / titleblock dims from template
|
||||
void load_page(); // get page / titleblock dims from template
|
||||
void choose_page(); // determine correct portion of page to use to avoid interference with
|
||||
// title block
|
||||
void
|
||||
choose_page();// determine correct portion of page to use to avoid interference with title block
|
||||
void set_all_orientations();// update orientations of all views following change in primary view
|
||||
void calc_layout_size(); // what's the real world size of chosen layout, excluding spaces
|
||||
set_all_orientations(); // update orientations of all views following change in primary view
|
||||
void calc_layout_size(); // what's the real world size of chosen layout, excluding spaces
|
||||
void calc_offsets();
|
||||
void set_views();
|
||||
void calc_scale();
|
||||
@@ -148,28 +149,28 @@ private:
|
||||
App::DocumentObject* part;
|
||||
App::DocumentObject* page;
|
||||
|
||||
int large[4];// arrays containing page size info [margin_x, margin_y, size_x, size_y] = [x1, y1,
|
||||
// x2-x1, y2-y1]
|
||||
int large[4]; // arrays containing page size info [margin_x, margin_y, size_x, size_y] = [x1,
|
||||
// y1, x2-x1, y2-y1]
|
||||
int small_h[4],
|
||||
small_v[4];// page size avoiding title block, using maximum horizontal / vertical space
|
||||
int* page_dims;// points to one of above arrays for which set of page dimensions to use
|
||||
int block[4];// title block info [corner x, corner y, width, height], eg [-1, 1, w, h] is in top
|
||||
// left corner
|
||||
small_v[4]; // page size avoiding title block, using maximum horizontal / vertical space
|
||||
int* page_dims; // points to one of above arrays for which set of page dimensions to use
|
||||
int block[4]; // title block info [corner x, corner y, width, height], eg [-1, 1, w, h] is in
|
||||
// top left corner
|
||||
bool title;
|
||||
int *horiz,
|
||||
*vert;// points to min or max r_x / r_y depending upon which corner title block is in
|
||||
*vert; // points to min or max r_x / r_y depending upon which corner title block is in
|
||||
|
||||
int rotate_coeff; // 1st (= -1) or 3rd (= 1) angle
|
||||
int min_r_x, max_r_x; // extreme relative positions of views
|
||||
int min_r_y, max_r_y; // " " "
|
||||
float width, height, depth; // of non-scaled primary view
|
||||
float layout_width, layout_height;// of non-scaled layout without spaces
|
||||
float gap_x, gap_y, min_space; // required spacing between views
|
||||
float offset_x, offset_y; // coords of centre of upper left view
|
||||
int rotate_coeff; // 1st (= -1) or 3rd (= 1) angle
|
||||
int min_r_x, max_r_x; // extreme relative positions of views
|
||||
int min_r_y, max_r_y; // " " "
|
||||
float width, height, depth; // of non-scaled primary view
|
||||
float layout_width, layout_height; // of non-scaled layout without spaces
|
||||
float gap_x, gap_y, min_space; // required spacing between views
|
||||
float offset_x, offset_y; // coords of centre of upper left view
|
||||
float scale;
|
||||
int num_gaps_x,
|
||||
num_gaps_y;// how many gaps between views/edges? = num of views in given direction + 1
|
||||
gp_Ax2 primary;// coord system of primary view
|
||||
num_gaps_y; // how many gaps between views/edges? = num of views in given direction + 1
|
||||
gp_Ax2 primary; // coord system of primary view
|
||||
|
||||
bool hidden, smooth;
|
||||
bool autodims;
|
||||
@@ -178,7 +179,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TaskOrthoViews: public QWidget//: public Gui::TaskView::TaskBox
|
||||
class TaskOrthoViews: public QWidget //: public Gui::TaskView::TaskBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -214,12 +215,12 @@ private:
|
||||
Ui_TaskOrthoViews* ui;
|
||||
|
||||
OrthoViews* orthos;
|
||||
QCheckBox* c_boxes[5][5];// matrix of pointers to gui checkboxes
|
||||
QLineEdit* inputs[5]; // pointers to manual position/scale boxes
|
||||
QCheckBox* c_boxes[5][5]; // matrix of pointers to gui checkboxes
|
||||
QLineEdit* inputs[5]; // pointers to manual position/scale boxes
|
||||
|
||||
float data[5]; // scale, x_pos, y_pos, horiz, vert
|
||||
int axo_r_x, axo_r_y;// relative position of axo view currently being edited
|
||||
bool txt_return; // flag to show if return was pressed while editing a text box;
|
||||
float data[5]; // scale, x_pos, y_pos, horiz, vert
|
||||
int axo_r_x, axo_r_y; // relative position of axo view currently being edited
|
||||
bool txt_return; // flag to show if return was pressed while editing a text box;
|
||||
};
|
||||
|
||||
|
||||
@@ -246,7 +247,7 @@ private:
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
|
||||
#endif// GUI_TASKVIEW_OrthoViews_H
|
||||
#endif // GUI_TASKVIEW_OrthoViews_H
|
||||
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
QPointer<DrawingView> view;
|
||||
};
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
|
||||
#endif// DRAWINGGUI_VIEWPROVIDERPAGE_H
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERPAGE_H
|
||||
|
||||
@@ -128,7 +128,7 @@ PROPERTY_SOURCE_TEMPLATE(DrawingGui::ViewProviderDrawingViewPython,
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingGuiExport ViewProviderPythonFeatureT<DrawingGui::ViewProviderDrawingView>;
|
||||
}// namespace Gui
|
||||
} // namespace Gui
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
//@}
|
||||
};
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
|
||||
#endif// DRAWINGGUI_VIEWPROVIDERVIEW_H
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERVIEW_H
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
using namespace DrawingGui;
|
||||
|
||||
#if 0// needed for Qt's lupdate utility
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
qApp->translate("Workbench", "Drawing");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ protected:
|
||||
Gui::ToolBarItem* setupCommandBars() const;
|
||||
};
|
||||
|
||||
}// namespace DrawingGui
|
||||
} // namespace DrawingGui
|
||||
|
||||
|
||||
#endif// DRAWING_WORKBENCH_H
|
||||
#endif // DRAWING_WORKBENCH_H
|
||||
|
||||
Reference in New Issue
Block a user