[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2023-09-12 13:03:02 +00:00
committed by WandererFan
parent a207d11fa4
commit e92ed45df9
435 changed files with 2669 additions and 2645 deletions

View File

@@ -45,4 +45,4 @@
#endif
#endif
#endif// ASSEMBLY_GLOBAL_H
#endif // ASSEMBLY_GLOBAL_H

View File

@@ -1456,7 +1456,7 @@ void Cloud::Module::LinkXSetValue(std::string filename)
size_t header = filename.find_first_of(":");
string protocol = filename.substr(0, header);
string url_new = filename.substr(header + 3);// url_new is the url excluding the http part
string url_new = filename.substr(header + 3); // url_new is the url excluding the http part
size_t part2 = url_new.find_first_of("/");
string path = url_new.substr(part2 + 1);
// Starting from here the Document doesn't exist we must create it

View File

@@ -169,7 +169,7 @@ public:
&Module::sCloudRegion,
"Region(string) -- Specify Amazon s3 Region");
initialize("This module is the Cloud module.");// register with Python
initialize("This module is the Cloud module."); // register with Python
}
virtual ~Module()
@@ -244,6 +244,6 @@ protected:
};
}// namespace Cloud
} // namespace Cloud
void readFiles(Cloud::CloudReader reader, Base::XMLReader* xmlreader);

View File

@@ -29,7 +29,7 @@
// Exporting of App classes
#ifdef FC_OS_WIN32
#define CloudAppExport __declspec(dllexport)
#else// for Linux
#else // for Linux
#define CloudAppExport
#endif
@@ -55,6 +55,6 @@
// Xerces
#include <xercesc/util/XercesDefs.hpp>
#endif//_PreComp_
#endif //_PreComp_
#endif

View File

@@ -42,7 +42,7 @@ public:
Module()
: Py::ExtensionModule<Module>("CloudGui")
{
initialize("This module is the CloudGui module.");// register with Python
initialize("This module is the CloudGui module."); // register with Python
}
virtual ~Module()
@@ -56,7 +56,7 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace CloudGui
} // namespace CloudGui
/* Python entry */

View File

@@ -30,7 +30,7 @@
#ifdef FC_OS_WIN32
#define CloudAppExport __declspec(dllimport)
#define CloudGuiExport __declspec(dllexport)
#else// for Linux
#else // for Linux
#define CloudAppExport
#define CloudGuiExport
#endif
@@ -62,6 +62,6 @@
#include <Gui/QtAll.h>
#endif
#endif//_PreComp_
#endif //_PreComp_
#endif// GUI_PRECOMPILED_H
#endif // GUI_PRECOMPILED_H

View File

@@ -42,7 +42,7 @@ protected:
// Gui::ToolBarItem* setupToolBars() const;
};
}// namespace CloudGui
} // namespace CloudGui
#endif// Cloud_WORKBENCH_H
#endif // Cloud_WORKBENCH_H

View File

@@ -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

View File

@@ -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
}

View File

@@ -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

View File

@@ -67,7 +67,7 @@ protected:
};
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -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)

View File

@@ -70,7 +70,7 @@ private:
};
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -63,7 +63,7 @@ public:
//@}
};
}// namespace Drawing
} // namespace Drawing
#endif// DRAWING_FEATUREPROJECTION
#endif // DRAWING_FEATUREPROJECTION

View File

@@ -113,4 +113,4 @@ const char* Drawing::FeatureViewPython::getViewProviderName(void) const
// explicit template instantiation
template class DrawingExport FeaturePythonT<Drawing::FeatureView>;
}// namespace App
} // namespace App

View File

@@ -64,7 +64,7 @@ protected:
using FeatureViewPython = App::FeaturePythonT<FeatureView>;
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -98,4 +98,4 @@ const char* Drawing::FeatureViewAnnotationPython::getViewProviderName(void) cons
// explicit template instantiation
template class DrawingExport FeaturePythonT<Drawing::FeatureViewAnnotation>;
}// namespace App
} // namespace App

View File

@@ -64,7 +64,7 @@ public:
using FeatureViewAnnotationPython = App::FeaturePythonT<FeatureViewAnnotation>;
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -155,4 +155,4 @@ const char* Drawing::FeatureViewPartPython::getViewProviderName(void) const
// explicit template instantiation
template class DrawingExport FeaturePythonT<Drawing::FeatureViewPart>;
}// namespace App
} // namespace App

View File

@@ -72,7 +72,7 @@ private:
using FeatureViewPartPython = App::FeaturePythonT<FeatureViewPart>;
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -63,7 +63,7 @@ public:
}
};
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -146,4 +146,4 @@ const char* Drawing::FeatureViewSymbolPython::getViewProviderName(void) const
// explicit template instantiation
template class DrawingExport FeaturePythonT<Drawing::FeatureViewSymbol>;
}// namespace App
} // namespace App

View File

@@ -66,7 +66,7 @@ protected:
using FeatureViewSymbolPython = App::FeaturePythonT<FeatureViewSymbol>;
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -52,7 +52,7 @@ public:
};
}// namespace Drawing
} // namespace Drawing
#endif

View File

@@ -72,5 +72,5 @@
#include <BRepAdaptor_HCurve.hxx>
#endif
#endif// _PreComp_
#endif // _PreComp_
#endif

View File

@@ -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,

View File

@@ -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

View File

@@ -44,4 +44,4 @@
#endif
#endif
#endif// DRAWING_GLOBAL_H
#endif // DRAWING_GLOBAL_H

View File

@@ -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

View File

@@ -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;

View File

@@ -133,6 +133,6 @@ private:
QPageSize::PageSizeId m_pageSize;
};
}// namespace DrawingGui
} // namespace DrawingGui
#endif// DRAWINGGUI_DRAWINGVIEW_H
#endif // DRAWINGGUI_DRAWINGVIEW_H

View File

@@ -64,6 +64,6 @@
#include <QTimer>
#include <QWheelEvent>
#endif//_PreComp_
#endif //_PreComp_
#endif// DRAWINGGUI_PRECOMPILED_H
#endif // DRAWINGGUI_PRECOMPILED_H

View File

@@ -63,7 +63,7 @@ private:
Gui::TaskView::TaskBox* taskbox;
};
}// namespace DrawingGui
} // namespace DrawingGui
#endif// DRAWINGGUI_TASKDIALOG
#endif // DRAWINGGUI_TASKDIALOG

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -82,7 +82,7 @@ private:
QPointer<DrawingView> view;
};
}// namespace DrawingGui
} // namespace DrawingGui
#endif// DRAWINGGUI_VIEWPROVIDERPAGE_H
#endif // DRAWINGGUI_VIEWPROVIDERPAGE_H

View File

@@ -128,7 +128,7 @@ PROPERTY_SOURCE_TEMPLATE(DrawingGui::ViewProviderDrawingViewPython,
// explicit template instantiation
template class DrawingGuiExport ViewProviderPythonFeatureT<DrawingGui::ViewProviderDrawingView>;
}// namespace Gui
} // namespace Gui
// ----------------------------------------------------------------------------

View File

@@ -98,7 +98,7 @@ public:
//@}
};
}// namespace DrawingGui
} // namespace DrawingGui
#endif// DRAWINGGUI_VIEWPROVIDERVIEW_H
#endif // DRAWINGGUI_VIEWPROVIDERVIEW_H

View File

@@ -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

View File

@@ -46,7 +46,7 @@ protected:
Gui::ToolBarItem* setupCommandBars() const;
};
}// namespace DrawingGui
} // namespace DrawingGui
#endif// DRAWING_WORKBENCH_H
#endif // DRAWING_WORKBENCH_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <climits>
@@ -123,7 +123,7 @@ public:
&Module::writeDXFObject,
"writeDXFObject([objects],filename [,version,usePolyline,optionSource]): Exports "
"DocumentObject(s) to a DXF file.");
initialize("This module is the Import module.");// register with Python
initialize("This module is the Import module."); // register with Python
}
~Module() override = default;
@@ -765,4 +765,4 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace Import
} // namespace Import

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <Quantity_ColorRGBA.hxx>
@@ -39,7 +39,7 @@
#include <climits>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>// for Precision::Confusion()
#include <gp_Pln.hxx> // for Precision::Confusion()
#include <gp_Trsf.hxx>
#endif

View File

@@ -45,7 +45,7 @@ namespace App
class Document;
class DocumentObject;
class Part;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -120,6 +120,6 @@ private:
};
}// namespace Import
} // namespace Import
#endif// IMPORT_EXPORTOCAF_H
#endif // IMPORT_EXPORTOCAF_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <BRepBndLib.hxx>
@@ -43,7 +43,7 @@
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_Location.hxx>
#include <climits>
#include <gp_Pln.hxx>// for Precision::Confusion()
#include <gp_Pln.hxx> // for Precision::Confusion()
#include <gp_Trsf.hxx>
#endif
@@ -553,7 +553,7 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
jt = myColorMap.find(shape.HashCode(INT_MAX));
App::Color partColor(0.8f, 0.8f, 0.8f);
#if 0// TODO
#if 0 // TODO
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part);
if (vp && vp->isDerivedFrom(PartGui::ViewProviderPart::getClassTypeId())) {
if (jt != myColorMap.end()) {
@@ -601,7 +601,7 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
}
if (found_face_color) {
#if 0// TODO
#if 0 // TODO
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part);
if (vp && vp->isDerivedFrom(PartGui::ViewProviderPartExt::getClassTypeId())) {
static_cast<PartGui::ViewProviderPartExt*>(vp)->DiffuseColor.setValues(faceColors);

View File

@@ -47,7 +47,7 @@ namespace App
{
class Document;
class DocumentObject;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -140,6 +140,6 @@ private:
std::map<Standard_Integer, std::string> myNameMap;
};
}// namespace Import
} // namespace Import
#endif// IMPORT_IMPORTOCAF_H
#endif // IMPORT_IMPORTOCAF_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <Interface_Static.hxx>
@@ -1071,7 +1071,7 @@ static Standard_Boolean FindSHUO(const TDF_LabelSequence& theLabels,
// check for any upper_usage
::XCAFDoc_ShapeTool::GetSHUOUpperUsage(anSHUO->Label(), aUpLabels);
if (aUpLabels.Length() > 0) {
continue;// reject if there is one
continue; // reject if there is one
}
int j = 2;
for (; anSHUO->NbChildren(); ++j) {

View File

@@ -50,7 +50,7 @@ namespace App
{
class Document;
class DocumentObject;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -292,6 +292,6 @@ private:
ExportOCAFOptions options;
};
}// namespace Import
} // namespace Import
#endif// IMPORT_IMPORTOCAF2_H
#endif // IMPORT_IMPORTOCAF2_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <Quantity_Color.hxx>

View File

@@ -42,7 +42,7 @@ namespace App
{
class Document;
class DocumentObject;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -90,6 +90,6 @@ private:
};
}// namespace Import
} // namespace Import
#endif// IMPORT_ImportOCAFAssembly_H
#endif // IMPORT_ImportOCAFAssembly_H

View File

@@ -32,7 +32,7 @@
#pragma warning(disable : 4251)
#pragma warning(disable : 4275)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
@@ -53,6 +53,6 @@
// Base
#include <Mod/Part/App/OpenCascadeAll.h>
#endif//_PreComp_
#endif //_PreComp_
#endif

View File

@@ -43,7 +43,7 @@ public:
int read(const char* fileName);
};
}// namespace Import
} // namespace Import
#endif// IMPORT_STEPSHAPE_H
#endif // IMPORT_STEPSHAPE_H

View File

@@ -36,7 +36,7 @@ std::string StepShapePy::representation() const
return {"<StepShape object>"};
}
PyObject* StepShapePy::PyMake(struct _typeobject*, PyObject*, PyObject*)// Python wrapper
PyObject* StepShapePy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of StepShapePy and the Twin object
return new StepShapePy(new StepShape);

View File

@@ -425,8 +425,8 @@ std::string ImpExpDxfRead::Deformat(const char* text)
{
// this function removes DXF formatting from texts
std::stringstream ss;
bool escape = false; // turned on when finding an escape character
bool longescape = false;// turned on for certain escape codes that expect additional chars
bool escape = false; // turned on when finding an escape character
bool longescape = false; // turned on for certain escape codes that expect additional chars
for (unsigned int i = 0; i < strlen(text); i++) {
if (text[i] == '\\') {
escape = true;
@@ -472,7 +472,7 @@ void ImpExpDxfRead::AddGraphics() const
TopoDS_Compound comp;
builder.MakeCompound(comp);
std::string k = i->first;
if (k == "0") {// FreeCAD doesn't like an object name being '0'...
if (k == "0") { // FreeCAD doesn't like an object name being '0'...
k = "LAYER_0";
}
std::vector<Part::TopoShape*> v = i->second;
@@ -563,7 +563,7 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
@@ -571,11 +571,11 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
else {// no overrides, do what's right!
else { // no overrides, do what's right!
if (m_version < 14) {
exportPolyline(adapt);
}
@@ -584,12 +584,12 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
}
}
}
else {// it's an arc
else { // it's an arc
if (m_polyOverride) {
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
@@ -597,11 +597,11 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
else {// no overrides, do what's right!
else { // no overrides, do what's right!
if (m_version < 14) {
exportPolyline(adapt);
}
@@ -616,7 +616,7 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
@@ -624,11 +624,11 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
else {// no overrides, do what's right!
else { // no overrides, do what's right!
if (m_version < 14) {
exportPolyline(adapt);
}
@@ -683,11 +683,11 @@ bool ImpExpDxfWrite::gp_PntEqual(gp_Pnt p1, gp_Pnt p2)
bool ImpExpDxfWrite::gp_PntCompare(gp_Pnt p1, gp_Pnt p2)
{
bool result = false;
if (!(p1.IsEqual(p2, Precision::Confusion()))) { // ie v1 != v2
if (!(fabs(p1.X() - p2.X()) < Precision::Confusion())) {// x1 != x2
if (!(p1.IsEqual(p2, Precision::Confusion()))) { // ie v1 != v2
if (!(fabs(p1.X() - p2.X()) < Precision::Confusion())) { // x1 != x2
result = p1.X() < p2.X();
}
else if (!(fabs(p1.Y() - p2.Y()) < Precision::Confusion())) {// y1 != y2
else if (!(fabs(p1.Y() - p2.Y()) < Precision::Confusion())) { // y1 != y2
result = p1.Y() < p2.Y();
}
else {
@@ -720,7 +720,7 @@ void ImpExpDxfWrite::exportEllipse(BRepAdaptor_Curve& c)
double major = ellp.MajorRadius();
double minor = ellp.MinorRadius();
gp_Dir xaxis = ellp.XAxis().Direction();// direction of major axis
gp_Dir xaxis = ellp.XAxis().Direction(); // direction of major axis
// rotation appears to be the clockwise(?) angle between major & +Y??
double rotation = xaxis.AngleWithRef(gp_Dir(0, 1, 0), gp_Dir(0, 0, 1));
@@ -765,7 +765,7 @@ void ImpExpDxfWrite::exportEllipseArc(BRepAdaptor_Curve& c)
double major = ellp.MajorRadius();
double minor = ellp.MinorRadius();
gp_Dir xaxis = ellp.XAxis().Direction();// direction of major axis
gp_Dir xaxis = ellp.XAxis().Direction(); // direction of major axis
// rotation appears to be the clockwise angle between major & +Y??
double rotation = xaxis.AngleWithRef(gp_Dir(0, 1, 0), gp_Dir(0, 0, 1));
@@ -778,14 +778,14 @@ void ImpExpDxfWrite::exportEllipseArc(BRepAdaptor_Curve& c)
gp_Vec v1(m, s);
gp_Vec v2(m, e);
gp_Vec v3(0, 0, 1);
double a = v3.DotCross(v1, v2);// a = v3 dot (v1 cross v2)
// relates to "handedness" of 3 vectors
// a > 0 ==> v2 is CCW from v1 (righthanded)?
// a < 0 ==> v2 is CW from v1 (lefthanded)?
double a = v3.DotCross(v1, v2); // a = v3 dot (v1 cross v2)
// relates to "handedness" of 3 vectors
// a > 0 ==> v2 is CCW from v1 (righthanded)?
// a < 0 ==> v2 is CW from v1 (lefthanded)?
double startAngle = fmod(f, 2.0 * M_PI);// revolutions
double startAngle = fmod(f, 2.0 * M_PI); // revolutions
double endAngle = fmod(l, 2.0 * M_PI);
bool endIsCW = (a < 0) ? true : false;// if !endIsCW swap(start,end)
bool endIsCW = (a < 0) ? true : false; // if !endIsCW swap(start,end)
// not sure if this is a hack or not. seems to make valid arcs.
if (!endIsCW) {
startAngle = -startAngle;
@@ -810,7 +810,7 @@ void ImpExpDxfWrite::exportBSpline(BRepAdaptor_Curve& c)
spline = approx.Curve();
}
else {
if (approx.HasResult()) {// result, but not within tolerance
if (approx.HasResult()) { // result, but not within tolerance
spline = approx.Curve();
Base::Console().Message("DxfWrite::exportBSpline - result not within tolerance\n");
}
@@ -840,7 +840,7 @@ void ImpExpDxfWrite::exportBSpline(BRepAdaptor_Curve& c)
sd.flag = spline->IsClosed();
sd.flag += spline->IsPeriodic() * 2;
sd.flag += spline->IsRational() * 4;
sd.flag += 8;// planar spline
sd.flag += 8; // planar spline
sd.degree = spline->Degree();
sd.control_points = spline->NbPoles();

View File

@@ -66,8 +66,8 @@ public:
void AddGraphics() const override;
// FreeCAD-specific functions
void AddObject(Part::TopoShape* shape);// Called by OnRead functions to add Part objects
std::string Deformat(const char* text);// Removes DXF formatting from texts
void AddObject(Part::TopoShape* shape); // Called by OnRead functions to add Part objects
std::string Deformat(const char* text); // Removes DXF formatting from texts
std::string getOptionSource()
{
@@ -146,7 +146,7 @@ protected:
void exportBSpline(BRepAdaptor_Curve& c);
void exportBCurve(BRepAdaptor_Curve& c);
void exportLine(BRepAdaptor_Curve& c);
void exportLWPoly(BRepAdaptor_Curve& c);// LWPolyline not supported in R12?
void exportLWPoly(BRepAdaptor_Curve& c); // LWPolyline not supported in R12?
void exportPolyline(BRepAdaptor_Curve& c);
// std::string m_optionSource;
@@ -155,6 +155,6 @@ protected:
bool optionExpPoints;
};
}// namespace Import
} // namespace Import
#endif// IMPEXPDXF_H
#endif // IMPEXPDXF_H

View File

@@ -34,14 +34,14 @@ Base::Vector3d toVector3d(const double* a)
}
CDxfWrite::CDxfWrite(const char* filepath)
:// TODO: these should probably be parameters in config file
// handles:
// boilerplate 0 - A00
// used by dxf.cpp A01 - FFFE
// ACAD HANDSEED FFFF
: // TODO: these should probably be parameters in config file
// handles:
// boilerplate 0 - A00
// used by dxf.cpp A01 - FFFE
// ACAD HANDSEED FFFF
m_handle(0xA00)
,// room for 2560 handles in boilerplate files
, // room for 2560 handles in boilerplate files
// m_entityHandle(0x300), //don't need special ranges for handles
// m_layerHandle(0x30),
// m_blockHandle(0x210),
@@ -417,7 +417,7 @@ void CDxfWrite::makeBlockSectionHead()
(*m_ssBlock) << m_savePaperSpaceHandle << endl;
(*m_ssBlock) << "100" << endl;
(*m_ssBlock) << "AcDbEntity" << endl;
(*m_ssBlock) << " 67" << endl;// paper_space flag
(*m_ssBlock) << " 67" << endl; // paper_space flag
(*m_ssBlock) << " 1" << endl;
}
(*m_ssBlock) << " 8" << endl;
@@ -531,24 +531,24 @@ void CDxfWrite::putLine(const Base::Vector3d s,
(*outStream) << "100" << endl;
(*outStream) << "AcDbEntity" << endl;
}
(*outStream) << " 8" << endl; // Group code for layer name
(*outStream) << getLayerName() << endl;// Layer number
(*outStream) << " 8" << endl; // Group code for layer name
(*outStream) << getLayerName() << endl; // Layer number
if (m_version > 12) {
(*outStream) << "100" << endl;
(*outStream) << "AcDbLine" << endl;
}
(*outStream) << " 10" << endl;// Start point of line
(*outStream) << s.x << endl; // X in WCS coordinates
(*outStream) << " 10" << endl; // Start point of line
(*outStream) << s.x << endl; // X in WCS coordinates
(*outStream) << " 20" << endl;
(*outStream) << s.y << endl;// Y in WCS coordinates
(*outStream) << s.y << endl; // Y in WCS coordinates
(*outStream) << " 30" << endl;
(*outStream) << s.z << endl; // Z in WCS coordinates
(*outStream) << " 11" << endl;// End point of line
(*outStream) << e.x << endl; // X in WCS coordinates
(*outStream) << s.z << endl; // Z in WCS coordinates
(*outStream) << " 11" << endl; // End point of line
(*outStream) << e.x << endl; // X in WCS coordinates
(*outStream) << " 21" << endl;
(*outStream) << e.y << endl;// Y in WCS coordinates
(*outStream) << e.y << endl; // Y in WCS coordinates
(*outStream) << " 31" << endl;
(*outStream) << e.z << endl;// Z in WCS coordinates
(*outStream) << e.z << endl; // Z in WCS coordinates
}
@@ -568,37 +568,37 @@ void CDxfWrite::writeLWPolyLine(const LWPolyDataOut& pd)
(*m_ssEntity) << "AcDbEntity" << endl;
}
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;// 100 groups are not part of R12
(*m_ssEntity) << "100" << endl; // 100 groups are not part of R12
(*m_ssEntity) << "AcDbPolyline" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
(*m_ssEntity) << " 90" << endl;
(*m_ssEntity) << pd.nVert << endl;// number of vertices
(*m_ssEntity) << pd.nVert << endl; // number of vertices
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << pd.Flag << endl;
(*m_ssEntity) << " 43" << endl;
(*m_ssEntity) << "0" << endl;// Constant width opt
(*m_ssEntity) << "0" << endl; // Constant width opt
// (*m_ssEntity) << pd.Width << endl; //Constant width opt
// (*m_ssEntity) << " 38" << endl;
// (*m_ssEntity) << pd.Elev << endl; // Elevation
// (*m_ssEntity) << " 39" << endl;
// (*m_ssEntity) << pd.Thick << endl; // Thickness
for (auto& p : pd.Verts) {
(*m_ssEntity) << " 10" << endl;// Vertices
(*m_ssEntity) << " 10" << endl; // Vertices
(*m_ssEntity) << p.x << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << p.y << endl;
}
for (auto& s : pd.StartWidth) {
(*m_ssEntity) << " 40" << endl;
(*m_ssEntity) << s << endl;// Start Width
(*m_ssEntity) << s << endl; // Start Width
}
for (auto& e : pd.EndWidth) {
(*m_ssEntity) << " 41" << endl;
(*m_ssEntity) << e << endl;// End Width
(*m_ssEntity) << e << endl; // End Width
}
for (auto& b : pd.Bulge) {// Bulge
for (auto& b : pd.Bulge) { // Bulge
(*m_ssEntity) << " 42" << endl;
(*m_ssEntity) << b << endl;
}
@@ -626,13 +626,13 @@ void CDxfWrite::writePolyline(const LWPolyDataOut& pd)
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl;
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;// 100 groups are not part of R12
(*m_ssEntity) << "100" << endl; // 100 groups are not part of R12
(*m_ssEntity) << "AcDbPolyline" << endl;
}
(*m_ssEntity) << " 66" << endl;
(*m_ssEntity) << " 1" << endl;// vertices follow
(*m_ssEntity) << " 1" << endl; // vertices follow
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << "0.0" << endl;
(*m_ssEntity) << " 20" << endl;
@@ -675,18 +675,18 @@ void CDxfWrite::writePoint(const double* s)
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbPoint" << endl;
}
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << s[0] << endl;// X in WCS coordinates
(*m_ssEntity) << s[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << s[1] << endl;// Y in WCS coordinates
(*m_ssEntity) << s[1] << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << s[2] << endl;// Z in WCS coordinates
(*m_ssEntity) << s[2] << endl; // Z in WCS coordinates
}
void CDxfWrite::writeArc(const double* s, const double* e, const double* c, bool dir)
@@ -714,31 +714,31 @@ void CDxfWrite::writeArc(const double* s, const double* e, const double* c, bool
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer number
// (*m_ssEntity) << " 62" << endl;
// (*m_ssEntity) << " 0" << endl;
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer number
// (*m_ssEntity) << " 62" << endl;
// (*m_ssEntity) << " 0" << endl;
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbCircle" << endl;
}
(*m_ssEntity) << " 10" << endl;// Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 10" << endl; // Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c[1] << endl;// Y in WCS coordinates
(*m_ssEntity) << c[1] << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl;// Radius
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl; // Radius
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbArc" << endl;
}
(*m_ssEntity) << " 50" << endl;
(*m_ssEntity) << start_angle << endl;// Start angle
(*m_ssEntity) << start_angle << endl; // Start angle
(*m_ssEntity) << " 51" << endl;
(*m_ssEntity) << end_angle << endl;// End angle
(*m_ssEntity) << end_angle << endl; // End angle
}
void CDxfWrite::writeCircle(const double* c, double radius)
@@ -753,20 +753,20 @@ void CDxfWrite::writeCircle(const double* c, double radius)
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer number
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer number
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbCircle" << endl;
}
(*m_ssEntity) << " 10" << endl;// Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 10" << endl; // Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c[1] << endl;// Y in WCS coordinates
// (*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c[1] << endl; // Y in WCS coordinates
// (*m_ssEntity) << " 30" << endl;
// (*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl;// Radius
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl; // Radius
}
void CDxfWrite::writeEllipse(const double* c,
@@ -784,7 +784,7 @@ void CDxfWrite::writeEllipse(const double* c,
double ratio = minor_radius / major_radius;
if (!endIsCW) {// end is NOT CW from start
if (!endIsCW) { // end is NOT CW from start
double temp = start_angle;
start_angle = end_angle;
end_angle = temp;
@@ -799,36 +799,37 @@ void CDxfWrite::writeEllipse(const double* c,
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer number
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer number
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEllipse" << endl;
}
(*m_ssEntity) << " 10" << endl;// Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 10" << endl; // Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c[1] << endl;// Y in WCS coordinates
(*m_ssEntity) << c[1] << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 11" << endl;//
(*m_ssEntity) << m[0] << endl; // Major X
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 11" << endl; //
(*m_ssEntity) << m[0] << endl; // Major X
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << m[1] << endl;// Major Y
(*m_ssEntity) << m[1] << endl; // Major Y
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << m[2] << endl; // Major Z
(*m_ssEntity) << " 40" << endl;//
(*m_ssEntity) << ratio << endl;// Ratio
// (*m_ssEntity) << "210" << endl; //extrusion dir??
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "220" << endl;
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "230" << endl;
// (*m_ssEntity) << "1" << endl;
(*m_ssEntity) << m[2] << endl; // Major Z
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << ratio
<< endl; // Ratio
// (*m_ssEntity) << "210" << endl; //extrusion dir??
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "220" << endl;
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "230" << endl;
// (*m_ssEntity) << "1" << endl;
(*m_ssEntity) << " 41" << endl;
(*m_ssEntity) << start_angle << endl;// Start angle (radians [0..2pi])
(*m_ssEntity) << start_angle << endl; // Start angle (radians [0..2pi])
(*m_ssEntity) << " 42" << endl;
(*m_ssEntity) << end_angle << endl;// End angle
(*m_ssEntity) << end_angle << endl; // End angle
}
//***************************
@@ -846,8 +847,8 @@ void CDxfWrite::writeSpline(const SplineDataOut& sd)
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbSpline" << endl;
@@ -860,7 +861,7 @@ void CDxfWrite::writeSpline(const SplineDataOut& sd)
(*m_ssEntity) << "1" << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << sd.flag << endl;// flags
(*m_ssEntity) << sd.flag << endl; // flags
(*m_ssEntity) << " 71" << endl;
(*m_ssEntity) << sd.degree << endl;
(*m_ssEntity) << " 72" << endl;
@@ -895,19 +896,19 @@ void CDxfWrite::writeSpline(const SplineDataOut& sd)
for (auto& c : sd.control) {
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << c.x << endl;// X in WCS coordinates
(*m_ssEntity) << c.x << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c.y << endl;// Y in WCS coordinates
(*m_ssEntity) << c.y << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c.z << endl;// Z in WCS coordinates
(*m_ssEntity) << c.z << endl; // Z in WCS coordinates
}
for (auto& f : sd.fit) {
(*m_ssEntity) << " 11" << endl;
(*m_ssEntity) << f.x << endl;// X in WCS coordinates
(*m_ssEntity) << f.x << endl; // X in WCS coordinates
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << f.y << endl;// Y in WCS coordinates
(*m_ssEntity) << f.y << endl; // Y in WCS coordinates
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << f.z << endl;// Z in WCS coordinates
(*m_ssEntity) << f.z << endl; // Z in WCS coordinates
}
}
@@ -990,7 +991,7 @@ void CDxfWrite::putText(const char* text,
}
// (*outStream) << " 39" << endl;
// (*outStream) << 0 << endl; //thickness
(*outStream) << " 10" << endl;// first alignment point
(*outStream) << " 10" << endl; // first alignment point
(*outStream) << location1.x << endl;
(*outStream) << " 20" << endl;
(*outStream) << location1.y << endl;
@@ -1008,14 +1009,14 @@ void CDxfWrite::putText(const char* text,
// (*outStream) << 0 << endl;
(*outStream) << " 7" << endl;
(*outStream) << "STANDARD" << endl;// style
(*outStream) << "STANDARD" << endl; // style
// (*outStream) << " 71" << endl; //default
// (*outStream) << "0" << endl;
(*outStream) << " 72" << endl;
(*outStream) << horizJust << endl;
//// (*outStream) << " 73" << endl;
//// (*outStream) << "0" << endl;
(*outStream) << " 11" << endl;// second alignment point
(*outStream) << " 11" << endl; // second alignment point
(*outStream) << location2.x << endl;
(*outStream) << " 21" << endl;
(*outStream) << location2.y << endl;
@@ -1114,14 +1115,14 @@ void CDxfWrite::writeLinearDim(const double* textMidPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << " 10" << endl; // dimension line definition point
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl; // dimension line definition point
(*m_ssEntity) << lineDefPoint[0] << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << lineDefPoint[1] << endl;
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << lineDefPoint[2] << endl;
(*m_ssEntity) << " 11" << endl;// text mid point
(*m_ssEntity) << " 11" << endl; // text mid point
(*m_ssEntity) << textMidPoint[0] << endl;
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << textMidPoint[1] << endl;
@@ -1129,18 +1130,18 @@ void CDxfWrite::writeLinearDim(const double* textMidPoint,
(*m_ssEntity) << textMidPoint[2] << endl;
if (type == ALIGNED) {
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 1 << endl;// dimType1 = Aligned
(*m_ssEntity) << 1 << endl; // dimType1 = Aligned
}
if ((type == HORIZONTAL) || (type == VERTICAL)) {
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 32 << endl;// dimType0 = Aligned + 32 (bit for unique block)?
(*m_ssEntity) << 32 << endl; // dimType0 = Aligned + 32 (bit for unique block)?
}
// (*m_ssEntity) << " 71" << endl; // not R12
// (*m_ssEntity) << 1 << endl; // attachPoint ??1 = topleft
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// linear dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1202,7 +1203,7 @@ void CDxfWrite::writeAngularDim(const double* textMidPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << endExt2[0] << endl;
@@ -1219,14 +1220,14 @@ void CDxfWrite::writeAngularDim(const double* textMidPoint,
(*m_ssEntity) << textMidPoint[2] << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 2 << endl;// dimType 2 = Angular 5 = Angular 3 point
// +32 for block?? (not R12)
(*m_ssEntity) << 2 << endl; // dimType 2 = Angular 5 = Angular 3 point
// +32 for block?? (not R12)
// (*m_ssEntity) << " 71" << endl; // not R12? not required?
// (*m_ssEntity) << 5 << endl; // attachPoint 5 = middle
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// angular dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1295,27 +1296,27 @@ void CDxfWrite::writeRadialDim(const double* centerPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << " 10" << endl; // arc center point
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl; // arc center point
(*m_ssEntity) << centerPoint[0] << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << centerPoint[1] << endl;
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << centerPoint[2] << endl;
(*m_ssEntity) << " 11" << endl;// text mid point
(*m_ssEntity) << " 11" << endl; // text mid point
(*m_ssEntity) << textMidPoint[0] << endl;
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << textMidPoint[1] << endl;
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << textMidPoint[2] << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 4 << endl;// dimType 4 = Radius
// (*m_ssEntity) << " 71" << endl; // not R12
(*m_ssEntity) << 4 << endl; // dimType 4 = Radius
// (*m_ssEntity) << " 71" << endl; // not R12
// (*m_ssEntity) << 1 << endl; // attachPoint 5 = middle center
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// radial dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1327,7 +1328,7 @@ void CDxfWrite::writeRadialDim(const double* centerPoint,
(*m_ssEntity) << arcPoint[1] << endl;
(*m_ssEntity) << " 35" << endl;
(*m_ssEntity) << arcPoint[2] << endl;
(*m_ssEntity) << " 40" << endl;// leader length????
(*m_ssEntity) << " 40" << endl; // leader length????
(*m_ssEntity) << 0 << endl;
writeDimBlockPreamble();
@@ -1360,27 +1361,27 @@ void CDxfWrite::writeDiametricDim(const double* textMidPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << arcPoint1[0] << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << arcPoint1[1] << endl;
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << arcPoint1[2] << endl;
(*m_ssEntity) << " 11" << endl;// text mid point
(*m_ssEntity) << " 11" << endl; // text mid point
(*m_ssEntity) << textMidPoint[0] << endl;
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << textMidPoint[1] << endl;
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << textMidPoint[2] << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 3 << endl;// dimType 3 = Diameter
// (*m_ssEntity) << " 71" << endl; // not R12
(*m_ssEntity) << 3 << endl; // dimType 3 = Diameter
// (*m_ssEntity) << " 71" << endl; // not R12
// (*m_ssEntity) << 5 << endl; // attachPoint 5 = middle center
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// diametric dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1392,7 +1393,7 @@ void CDxfWrite::writeDiametricDim(const double* textMidPoint,
(*m_ssEntity) << arcPoint2[1] << endl;
(*m_ssEntity) << " 35" << endl;
(*m_ssEntity) << arcPoint2[2] << endl;
(*m_ssEntity) << " 40" << endl;// leader length????
(*m_ssEntity) << " 40" << endl; // leader length????
(*m_ssEntity) << 0 << endl;
writeDimBlockPreamble();
@@ -1430,7 +1431,7 @@ void CDxfWrite::writeDimBlockPreamble()
(*m_ssBlock) << "AcDbBlockBegin" << endl;
}
(*m_ssBlock) << " 2" << endl;
(*m_ssBlock) << "*" << getLayerName() << endl;// blockName
(*m_ssBlock) << "*" << getLayerName() << endl; // blockName
(*m_ssBlock) << " 70" << endl;
(*m_ssBlock) << " 1" << endl;
(*m_ssBlock) << " 10" << endl;
@@ -1440,7 +1441,7 @@ void CDxfWrite::writeDimBlockPreamble()
(*m_ssBlock) << " 30" << endl;
(*m_ssBlock) << 0.0 << endl;
(*m_ssBlock) << " 3" << endl;
(*m_ssBlock) << "*" << getLayerName() << endl;// blockName
(*m_ssBlock) << "*" << getLayerName() << endl; // blockName
(*m_ssBlock) << " 1" << endl;
(*m_ssBlock) << " " << endl;
}
@@ -1482,7 +1483,7 @@ void CDxfWrite::writeLinearDimBlock(const double* textMidPoint,
{
Base::Vector3d e1S(e1Start[0], e1Start[1], e1Start[2]);
Base::Vector3d e2S(e2Start[0], e2Start[1], e2Start[2]);
Base::Vector3d dl(dimLine[0], dimLine[1], dimLine[2]);// point on DimLine (somewhere!)
Base::Vector3d dl(dimLine[0], dimLine[1], dimLine[2]); // point on DimLine (somewhere!)
Base::Vector3d perp = dl.DistanceToLineSegment(e2S, e1S);
Base::Vector3d e1E = e1S - perp;
Base::Vector3d e2E = e2S - perp;
@@ -1499,13 +1500,13 @@ void CDxfWrite::writeLinearDimBlock(const double* textMidPoint,
e1E = Base::Vector3d(x, y, 0.0);
x = e2Start[0];
e2E = Base::Vector3d(x, y, 0.0);
perp = Base::Vector3d(0, -1, 0);// down
para = Base::Vector3d(1, 0, 0); // right
perp = Base::Vector3d(0, -1, 0); // down
para = Base::Vector3d(1, 0, 0); // right
if (dimLine[1] > e1Start[1]) {
perp = Base::Vector3d(0, 1, 0);// up
perp = Base::Vector3d(0, 1, 0); // up
}
if (e1Start[0] > e2Start[0]) {
para = Base::Vector3d(-1, 0, 0);// left
para = Base::Vector3d(-1, 0, 0); // left
}
angle = 0;
}
@@ -1526,8 +1527,8 @@ void CDxfWrite::writeLinearDimBlock(const double* textMidPoint,
angle = 90;
}
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
putLine(e2S, e2E, m_ssBlock, getBlockHandle(), m_saveBlkRecordHandle);
@@ -1569,7 +1570,7 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
const double* endExt2,
const char* dimText)
{
Base::Vector3d e1S(startExt1[0], startExt1[1], startExt1[2]);// apex
Base::Vector3d e1S(startExt1[0], startExt1[1], startExt1[2]); // apex
Base::Vector3d e2S(startExt2[0], startExt2[1], startExt2[2]);
Base::Vector3d e1E(endExt1[0], endExt1[1], endExt1[2]);
Base::Vector3d e2E(endExt2[0], endExt2[1], endExt2[2]);
@@ -1595,7 +1596,7 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
double radius = (e2S - linePt).Length();
(*m_ssBlock) << " 0" << endl;
(*m_ssBlock) << "ARC" << endl;// dimline arc
(*m_ssBlock) << "ARC" << endl; // dimline arc
(*m_ssBlock) << " 5" << endl;
(*m_ssBlock) << getBlockHandle() << endl;
if (m_version > 12) {
@@ -1613,21 +1614,21 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
(*m_ssBlock) << "AcDbCircle" << endl;
}
(*m_ssBlock) << " 10" << endl;
(*m_ssBlock) << startExt2[0] << endl;// arc center
(*m_ssBlock) << startExt2[0] << endl; // arc center
(*m_ssBlock) << " 20" << endl;
(*m_ssBlock) << startExt2[1] << endl;
(*m_ssBlock) << " 30" << endl;
(*m_ssBlock) << startExt2[2] << endl;
(*m_ssBlock) << " 40" << endl;
(*m_ssBlock) << radius << endl;// radius
(*m_ssBlock) << radius << endl; // radius
if (m_version > 12) {
(*m_ssBlock) << "100" << endl;
(*m_ssBlock) << "AcDbArc" << endl;
}
(*m_ssBlock) << " 50" << endl;
(*m_ssBlock) << startAngle << endl;// start angle
(*m_ssBlock) << startAngle << endl; // start angle
(*m_ssBlock) << " 51" << endl;
(*m_ssBlock) << endAngle << endl;// end angle
(*m_ssBlock) << endAngle << endl; // end angle
putText(dimText,
toVector3d(textMidPoint),
@@ -1650,8 +1651,8 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
Base::Vector3d perp1(-tanP1.y, tanP1.x, tanP1.z);
Base::Vector3d tanP2 = (arrow2Start - endTan).Normalize();
Base::Vector3d perp2(-tanP2.y, tanP2.x, tanP2.z);
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
Base::Vector3d barb1 = arrow1Start + perp1 * arrowWidth - tanP1 * arrowLen;
Base::Vector3d barb2 = arrow1Start - perp1 * arrowWidth - tanP1 * arrowLen;
@@ -1690,8 +1691,8 @@ void CDxfWrite::writeRadialDimBlock(const double* centerPoint,
Base::Vector3d c(centerPoint[0], centerPoint[1], centerPoint[2]);
Base::Vector3d a(arcPoint[0], arcPoint[1], arcPoint[2]);
Base::Vector3d para = a - c;
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
para.Normalize();
Base::Vector3d perp(-para.y, para.x, para.z);
Base::Vector3d arrowStart = a;
@@ -1727,8 +1728,8 @@ void CDxfWrite::writeDiametricDimBlock(const double* textMidPoint,
Base::Vector3d a1(arcPoint1[0], arcPoint1[1], arcPoint1[2]);
Base::Vector3d a2(arcPoint2[0], arcPoint2[1], arcPoint2[2]);
Base::Vector3d para = a2 - a1;
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
para.Normalize();
Base::Vector3d perp(-para.y, para.x, para.z);
Base::Vector3d arrowStart = a1;
@@ -1803,7 +1804,7 @@ CDxfRead::CDxfRead(const char* filepath)
m_ColorIndex = 0;
m_eUnits = eMillimeters;
m_measurement_inch = false;
strcpy(m_layer_name, "0");// Default layer name
strcpy(m_layer_name, "0"); // Default layer name
memset(m_section_name, '\0', sizeof(m_section_name));
memset(m_block_name, '\0', sizeof(m_block_name));
m_ignore_errors = true;
@@ -1842,7 +1843,7 @@ double CDxfRead::mm(double value) const
switch (m_eUnits) {
case eUnspecified:
return (value * 1.0);// We don't know any better.
return (value * 1.0); // We don't know any better.
case eInches:
return (value * 25.4);
case eFeet:
@@ -1884,9 +1885,9 @@ double CDxfRead::mm(double value) const
case eParsecs:
return (value * 30856774879000000000.0);
default:
return (value * 1.0);// We don't know any better.
} // End switch
}// End mm() method
return (value * 1.0); // We don't know any better.
} // End switch
} // End mm() method
bool CDxfRead::ReadLine()
@@ -1914,12 +1915,12 @@ bool CDxfRead::ReadLine()
hidden = false;
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
case 6:// line style name follows
case 6: // line style name follows
get_line();
if (m_str[0] == 'h' || m_str[0] == 'H') {
hidden = true;
@@ -2017,7 +2018,7 @@ bool CDxfRead::ReadLine()
}
catch (...) {
if (!IgnoreErrors()) {
throw;// Re-throw the exception.
throw; // Re-throw the exception.
}
}
@@ -2046,7 +2047,7 @@ bool CDxfRead::ReadPoint()
OnReadPoint(s);
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2113,7 +2114,7 @@ bool CDxfRead::ReadPoint()
}
catch (...) {
if (!IgnoreErrors()) {
throw;// Re-throw the exception.
throw; // Re-throw the exception.
}
}
@@ -2122,10 +2123,10 @@ bool CDxfRead::ReadPoint()
bool CDxfRead::ReadArc()
{
double start_angle = 0.0;// in degrees
double start_angle = 0.0; // in degrees
double end_angle = 0.0;
double radius = 0.0;
double c[3] = {0, 0, 0};// centre
double c[3] = {0, 0, 0}; // centre
double z_extrusion_dir = 1.0;
bool hidden = false;
@@ -2147,12 +2148,12 @@ bool CDxfRead::ReadArc()
hidden = false;
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
case 6:// line style name follows
case 6: // line style name follows
get_line();
if (m_str[0] == 'h' || m_str[0] == 'H') {
hidden = true;
@@ -2285,7 +2286,7 @@ bool CDxfRead::ReadSpline()
ResolveColorIndex();
OnReadSpline(sd);
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2545,7 +2546,7 @@ bool CDxfRead::ReadSpline()
bool CDxfRead::ReadCircle()
{
double radius = 0.0;
double c[3] = {0, 0, 0};// centre
double c[3] = {0, 0, 0}; // centre
bool hidden = false;
while (!((*m_ifs).eof())) {
@@ -2565,14 +2566,14 @@ bool CDxfRead::ReadCircle()
hidden = false;
return true;
case 6:// line style name follows
case 6: // line style name follows
get_line();
if (m_str[0] == 'h' || m_str[0] == 'H') {
hidden = true;
}
break;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2649,7 +2650,7 @@ bool CDxfRead::ReadCircle()
bool CDxfRead::ReadText()
{
double c[3];// coordinate
double c[3]; // coordinate
double height = 0.03082;
std::string textPrefix;
@@ -2667,7 +2668,7 @@ bool CDxfRead::ReadText()
switch (n) {
case 0:
return false;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2771,11 +2772,11 @@ bool CDxfRead::ReadText()
bool CDxfRead::ReadEllipse()
{
double c[3] = {0, 0, 0};// centre
double m[3] = {0, 0, 0};// major axis point
double ratio = 0; // ratio of major to minor axis
double start = 0; // start of arc
double end = 0; // end of arc
double c[3] = {0, 0, 0}; // centre
double m[3] = {0, 0, 0}; // major axis point
double ratio = 0; // ratio of major to minor axis
double start = 0; // start of arc
double end = 0; // end of arc
while (!((*m_ifs).eof())) {
get_line();
@@ -2792,7 +2793,7 @@ bool CDxfRead::ReadEllipse()
ResolveColorIndex();
OnReadEllipse(c, m, ratio, start, end);
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2963,7 +2964,7 @@ AddPolyLinePoint(CDxfRead* dxf_read, double x, double y, double z, bool bulge_fo
}
catch (...) {
if (!dxf_read->IgnoreErrors()) {
throw;// Re-throw it.
throw; // Re-throw it.
}
}
}
@@ -3012,7 +3013,7 @@ bool CDxfRead::ReadLwPolyLine()
}
next_item_found = true;
break;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -3129,11 +3130,11 @@ bool CDxfRead::ReadVertex(double* pVertex, bool* bulge_found, double* bulge)
switch (n) {
case 0:
ResolveColorIndex();
put_line(m_str);// read one line too many. put it back.
put_line(m_str); // read one line too many. put it back.
return (x_found && y_found);
break;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -3323,7 +3324,7 @@ void CDxfRead::OnReadCircle(const double* c, double radius, bool hidden)
OnReadCircle(s,
c,
false,
hidden);// false to change direction because otherwise the arc length is zero
hidden); // false to change direction because otherwise the arc length is zero
}
void CDxfRead::OnReadEllipse(const double* c,
@@ -3347,9 +3348,9 @@ void CDxfRead::OnReadEllipse(const double* c,
bool CDxfRead::ReadInsert()
{
double c[3] = {0, 0, 0};// coordinate
double s[3] = {1, 1, 1};// scale
double rot = 0.0; // rotation
double c[3] = {0, 0, 0}; // coordinate
double s[3] = {1, 1, 1}; // scale
double rot = 0.0; // rotation
char name[1024] = {0};
while (!((*m_ifs).eof())) {
@@ -3472,10 +3473,10 @@ bool CDxfRead::ReadInsert()
bool CDxfRead::ReadDimension()
{
double s[3] = {0, 0, 0};// startpoint
double e[3] = {0, 0, 0};// endpoint
double p[3] = {0, 0, 0};// dimpoint
double rot = -1.0; // rotation
double s[3] = {0, 0, 0}; // startpoint
double e[3] = {0, 0, 0}; // endpoint
double p[3] = {0, 0, 0}; // dimpoint
double rot = -1.0; // rotation
while (!((*m_ifs).eof())) {
get_line();
@@ -3701,13 +3702,13 @@ void CDxfRead::put_line(const char* value)
bool CDxfRead::ReadUnits()
{
get_line();// Skip to next line.
get_line();// Skip to next line.
get_line(); // Skip to next line.
get_line(); // Skip to next line.
int n = 0;
if (sscanf(m_str, "%d", &n) == 1) {
m_eUnits = eDxfUnits_t(n);
return (true);
}// End if - then
} // End if - then
else {
printf("CDxfRead::ReadUnits() Failed to get integer from '%s'\n", m_str);
return (false);
@@ -3732,7 +3733,7 @@ bool CDxfRead::ReadLayer()
std::istringstream ss;
ss.imbue(std::locale("C"));
switch (n) {
case 0:// next item found, so finish with line
case 0: // next item found, so finish with line
if (layername.empty()) {
printf("CDxfRead::ReadLayer() - no layer name\n");
return false;
@@ -3740,7 +3741,7 @@ bool CDxfRead::ReadLayer()
m_layer_ColorIndex_map[layername] = colorIndex;
return true;
case 2:// Layer name follows
case 2: // Layer name follows
get_line();
layername = m_str;
break;
@@ -3753,8 +3754,8 @@ bool CDxfRead::ReadLayer()
}
break;
case 6: // linetype name
case 70:// layer flags
case 6: // linetype name
case 70: // layer flags
case 100:
case 290:
case 370:
@@ -3812,8 +3813,8 @@ bool CDxfRead::ReadDWGCodePage()
{
get_line();
get_line();
assert(m_CodePage == nullptr);// If not, we have found two DWGCODEPAGE variables or DoRead was
// called twice on the same CDxfRead object.
assert(m_CodePage == nullptr); // If not, we have found two DWGCODEPAGE variables or DoRead was
// called twice on the same CDxfRead object.
m_CodePage = new std::string(m_str);
return ResolveEncoding();
@@ -3825,7 +3826,7 @@ bool CDxfRead::ResolveEncoding()
delete m_encoding;
m_encoding = nullptr;
}
if (m_version >= R2007) {// Note this does not include RUnknown, but does include RLater
if (m_version >= R2007) { // Note this does not include RUnknown, but does include RLater
m_encoding = new std::string("utf_8");
stringToUTF8 = &CDxfRead::UTF8ToUTF8;
}
@@ -3856,7 +3857,7 @@ bool CDxfRead::ResolveEncoding()
Base::PyGILStateLocker lock;
PyObject* pyDecoder = PyCodec_Decoder(m_encoding->c_str());
if (pyDecoder == nullptr) {
return false;// A key error exception will have been placed.
return false; // A key error exception will have been placed.
}
PyObject* pyUTF8Decoder = PyCodec_Decoder("utf_8");
assert(pyUTF8Decoder != nullptr);
@@ -3916,7 +3917,7 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
return;
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "$MEASUREMENT")) {
get_line();
@@ -3928,21 +3929,21 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
}
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "$ACADVER")) {
if (!ReadVersion()) {
return;
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "$DWGCODEPAGE")) {
if (!ReadDWGCodePage()) {
return;
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "0")) {
get_line();
@@ -3955,7 +3956,7 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
}
strcpy(m_block_name, "");
}// End if - then
} // End if - then
else if (!strcmp(m_str, "TABLE")) {
get_line();
get_line();
@@ -3977,12 +3978,12 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
return;
}
continue;
}// End if - then
} // End if - then
else if (!strcmp(m_str, "ENDSEC")) {
strcpy(m_section_name, "");
strcpy(m_block_name, "");
}// End if - then
} // End if - then
else if (!strcmp(m_str, "LINE")) {
if (!ReadLine()) {
printf("CDxfRead::DoRead() Failed to read line\n");
@@ -4078,7 +4079,7 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
void CDxfRead::ResolveColorIndex()
{
if (m_ColorIndex == ColorBylayer)// if color = layer color, replace by color from layer
if (m_ColorIndex == ColorBylayer) // if color = layer color, replace by color from layer
{
m_ColorIndex = m_layer_ColorIndex_map[std::string(m_layer_name)];
}

View File

@@ -21,11 +21,11 @@
#include <Mod/Import/ImportGlobal.h>
typedef int ColorIndex_t;// DXF color index
typedef int ColorIndex_t; // DXF color index
typedef enum
{
eUnspecified = 0,// Unspecified (No units)
eUnspecified = 0, // Unspecified (No units)
eInches,
eFeet,
eMiles,
@@ -319,7 +319,7 @@ private:
std::map<std::string, ColorIndex_t>
m_layer_ColorIndex_map;// Mapping from layer name -> layer color index
m_layer_ColorIndex_map; // Mapping from layer name -> layer color index
const ColorIndex_t ColorBylayer = 256;
const ColorIndex_t ColorByBlock = 0;
@@ -360,27 +360,27 @@ private:
protected:
ColorIndex_t m_ColorIndex;
eDXFVersion_t m_version;// Version from $ACADVER variable in DXF
eDXFVersion_t m_version; // Version from $ACADVER variable in DXF
const char* (CDxfRead::*stringToUTF8)(const char*) const;
private:
const std::string* m_CodePage;// Code Page name from $DWGCODEPAGE or null if none/not read yet
const std::string* m_CodePage; // Code Page name from $DWGCODEPAGE or null if none/not read yet
// The following was going to be python's canonical name for the encoding, but this is (a) not
// easily found and (b) does not speed up finding the encoding object.
const std::string* m_encoding;// A name for the encoding implied by m_version and m_CodePage
const std::string* m_encoding; // A name for the encoding implied by m_version and m_CodePage
const char* UTF8ToUTF8(const char* encoded) const;
const char* GeneralToUTF8(const char* encoded) const;
public:
ImportExport CDxfRead(const char* filepath);// this opens the file
ImportExport virtual ~CDxfRead(); // this closes the file
ImportExport CDxfRead(const char* filepath); // this opens the file
ImportExport virtual ~CDxfRead(); // this closes the file
ImportExport bool Failed()
{
return m_fail;
}
ImportExport void DoRead(
const bool ignore_errors = false);// this reads the file and calls the following functions
const bool ignore_errors = false); // this reads the file and calls the following functions
ImportExport double mm(double value) const;

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <climits>
@@ -385,7 +385,7 @@ public:
&Module::exporter,
"export(list,string) -- Export a list of objects into a single file.");
add_varargs_method("ocaf", &Module::ocaf, "ocaf(string) -- Browse the ocaf structure.");
initialize("This module is the ImportGui module.");// register with Python
initialize("This module is the ImportGui module."); // register with Python
}
private:
@@ -917,4 +917,4 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace ImportGui
} // namespace ImportGui

View File

@@ -32,7 +32,7 @@
#pragma warning(disable : 4005)
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
@@ -94,6 +94,6 @@
#endif
#endif//_PreComp_
#endif //_PreComp_
#endif// __PRECOMPILED_GUI__
#endif // __PRECOMPILED_GUI__

View File

@@ -45,7 +45,7 @@ protected:
Gui::ToolBarItem* setupCommandBars() const override;
};
}// namespace ImportGui
} // namespace ImportGui
#endif// IMPORT_WORKBENCH_H
#endif // IMPORT_WORKBENCH_H

View File

@@ -44,4 +44,4 @@
#endif
#endif
#endif// IMPORT_GLOBAL_H
#endif // IMPORT_GLOBAL_H

View File

@@ -36,7 +36,7 @@ public:
Module()
: Py::ExtensionModule<Module>("Inspection")
{
initialize("This module is the Inspection module.");// register with Python
initialize("This module is the Inspection module."); // register with Python
}
private:
@@ -47,7 +47,7 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace Inspection
} // namespace Inspection
/* Python entry */

View File

@@ -283,7 +283,7 @@ protected:
private:
Base::Matrix4D _transform;
};
}// namespace Inspection
} // namespace Inspection
InspectNominalMesh::InspectNominalMesh(const Mesh::MeshObject& rMesh, float offset)
: _mesh(rMesh.getKernel())
@@ -321,7 +321,7 @@ InspectNominalMesh::~InspectNominalMesh()
float InspectNominalMesh::getDistance(const Base::Vector3f& point) const
{
if (!_box.IsInBox(point)) {
return FLT_MAX;// must be inside bbox
return FLT_MAX; // must be inside bbox
}
std::vector<unsigned long> indices;
@@ -398,11 +398,11 @@ InspectNominalFastMesh::~InspectNominalFastMesh()
float InspectNominalFastMesh::getDistance(const Base::Vector3f& point) const
{
if (!_box.IsInBox(point)) {
return FLT_MAX;// must be inside bbox
return FLT_MAX; // must be inside bbox
}
std::set<unsigned long> indices;
#if 0// a point in a neighbour grid can be nearer
#if 0 // a point in a neighbour grid can be nearer
std::vector<unsigned long> elements;
_pGrid->GetElements(point, elements);
indices.insert(elements.begin(), elements.end());
@@ -444,7 +444,7 @@ float InspectNominalFastMesh::getDistance(const Base::Vector3f& point) const
InspectNominalPoints::InspectNominalPoints(const Points::PointKernel& Kernel, float /*offset*/)
: _rKernel(Kernel)
{
int uGridPerAxis = 50;// totally 125.000 grid elements
int uGridPerAxis = 50; // totally 125.000 grid elements
this->_pGrid = new Points::PointsGrid(Kernel, uGridPerAxis);
}
@@ -763,7 +763,7 @@ public:
int m_numv {0};
double m_sumsq {0.0};
};
}// namespace Inspection
} // namespace Inspection
PROPERTY_SOURCE(Inspection::Feature, App::DocumentObject)
@@ -849,7 +849,7 @@ App::DocumentObjectExecReturn* Feature::execute()
// clang-format on
#if 0
#if 1// test with some huge data sets
#if 1 // test with some huge data sets
std::vector<unsigned long> index(actual->countPoints());
std::generate(index.begin(), index.end(), Base::iotaGen<unsigned long>(0));
DistanceInspection check(this->SearchRadius.getValue(), actual, inspectNominal);

View File

@@ -38,7 +38,7 @@ namespace MeshCore
{
class MeshKernel;
class MeshGrid;
}// namespace MeshCore
} // namespace MeshCore
namespace Mesh
{
@@ -287,7 +287,7 @@ public:
}
};
}// namespace Inspection
} // namespace Inspection
#endif// INSPECTION_FEATURE_H
#endif // INSPECTION_FEATURE_H

View File

@@ -29,7 +29,7 @@
#pragma warning(disable : 4005)
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
@@ -55,6 +55,6 @@
#include <QFutureWatcher>
#include <QtConcurrentMap>
#endif//_PreComp_
#endif //_PreComp_
#endif

View File

@@ -43,7 +43,7 @@ public:
Module()
: Py::ExtensionModule<Module>("InspectionGui")
{
initialize("This module is the InspectionGui module.");// register with Python
initialize("This module is the InspectionGui module."); // register with Python
}
private:
@@ -54,7 +54,7 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace InspectionGui
} // namespace InspectionGui
/* Python entry */

View File

@@ -29,7 +29,7 @@
#pragma warning(disable : 4005)
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
@@ -61,6 +61,6 @@
#include <QMenu>
#include <QMessageBox>
#endif//_PreComp_
#endif //_PreComp_
#endif// GUI_PRECOMPILED_H
#endif // GUI_PRECOMPILED_H

View File

@@ -104,7 +104,7 @@ ViewProviderInspection::ViewProviderInspection()
pcPointStyle->ref();
pcPointStyle->style = SoDrawStyle::POINTS;
pcPointStyle->pointSize = PointSize.getValue();
SelectionStyle.setValue(1);// BBOX
SelectionStyle.setValue(1); // BBOX
}
ViewProviderInspection::~ViewProviderInspection()
@@ -521,7 +521,7 @@ public:
private:
QPointer<QWidget> widget;
};
}// namespace InspectionGui
} // namespace InspectionGui
void ViewProviderInspection::inspectCallback(void* ud, SoEventCallback* n)
{
@@ -651,7 +651,7 @@ bool calcWeights(const SbVec3f& v1,
return fabs(w0 + w1 + w2 - 1.0f) < 0.001f;
}
}// namespace InspectionGui
} // namespace InspectionGui
QString ViewProviderInspection::inspectDistance(const SoPickedPoint* pp) const
{

View File

@@ -40,7 +40,7 @@ namespace Gui
{
class SoFCColorBar;
class View3DInventorViewer;
}// namespace Gui
} // namespace Gui
namespace InspectionGui
{
@@ -123,7 +123,7 @@ public:
QIcon getIcon() const override;
};
}// namespace InspectionGui
} // namespace InspectionGui
#endif// INSPECTIOGUI_VIEWPROVIDERINSPECTION_H
#endif // INSPECTIOGUI_VIEWPROVIDERINSPECTION_H

View File

@@ -70,7 +70,7 @@ public:
private:
SingleSelectionItem* _compItem;
};
}// namespace InspectionGui
} // namespace InspectionGui
/* TRANSLATOR InspectionGui::DlgVisualInspectionImp */

View File

@@ -52,6 +52,6 @@ private:
QPushButton* buttonOk;
};
}// namespace InspectionGui
} // namespace InspectionGui
#endif// INSPECTIONGUI_VISUALINSPECTION_H
#endif // INSPECTIONGUI_VISUALINSPECTION_H

View File

@@ -42,7 +42,7 @@ protected:
Gui::ToolBarItem* setupToolBars() const override;
};
}// namespace InspectionGui
} // namespace InspectionGui
#endif// Inspection_WORKBENCH_H
#endif // Inspection_WORKBENCH_H

View File

@@ -44,4 +44,4 @@
#endif
#endif
#endif// INSPECTION_GLOBAL_H
#endif // INSPECTION_GLOBAL_H

View File

@@ -56,4 +56,4 @@ void AppJtReaderExport initJtReader()
}
}// extern "C" {
} // extern "C" {

View File

@@ -34,4 +34,4 @@ unsigned int iterSize(void);
/** clears the internal structure */
void clearData(void);
#endif// __JtReader_h__
#endif // __JtReader_h__

View File

@@ -13,7 +13,7 @@
#ifdef FC_OS_WIN32
#define MeshExport __declspec(dllimport)
#define AppJtReaderExport __declspec(dllexport)
#else// for Linux
#else // for Linux
#define MeshExport
#define AppJtReaderExport
#endif
@@ -26,7 +26,7 @@
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4275)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
// standard
@@ -51,6 +51,6 @@
// sys
#include <sys/types.h>
#endif//_PreComp_
#endif //_PreComp_
#endif

View File

@@ -124,7 +124,7 @@ void CurveProjectorShape::projectCurve(const TopoDS_Edge& aEdge,
Base::Vector3f cResultPoint, cSplitPoint, cPlanePnt, cPlaneNormal;
MeshCore::FacetIndex uStartFacetIdx, uCurFacetIdx;
MeshCore::FacetIndex uLastFacetIdx =
MeshCore::FACET_INDEX_MAX - 1;// use another value as FACET_INDEX_MAX
MeshCore::FACET_INDEX_MAX - 1; // use another value as FACET_INDEX_MAX
MeshCore::FacetIndex auNeighboursIdx[3];
bool GoOn;
@@ -1106,7 +1106,7 @@ void MeshProjection::projectEdgeToEdge(const TopoDS_Edge& aEdge,
const std::list<MeshCore::FacetIndex>& auFaces = it->second;
if (auFaces.size() > 2) {
continue;// non-manifold edge -> don't handle this
continue; // non-manifold edge -> don't handle this
}
// if ( clBB.IsOut( gp_Pnt(cE0.x, cE0.y, cE0.z) ) && clBB.IsOut( gp_Pnt(cE1.x, cE1.y,
// cE1.z) ) )

View File

@@ -38,7 +38,7 @@ namespace MeshCore
class MeshKernel;
class MeshGeomFacet;
class MeshFacetGrid;
}// namespace MeshCore
} // namespace MeshCore
using MeshCore::MeshGeomFacet;
using MeshCore::MeshKernel;
@@ -255,6 +255,6 @@ private:
const MeshKernel& _rcMesh;
};
}// namespace MeshPart
} // namespace MeshPart
#endif

View File

@@ -256,24 +256,24 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1,
gts_face_class(),
gts_edge_class(),
gts_vertex_class());
if (Type == 0) {// union
if (Type == 0) { // union
gts_surface_inter_boolean(si, s3, GTS_1_OUT_2);
gts_surface_inter_boolean(si, s3, GTS_2_OUT_1);
}
else if (Type == 1) {// inter
else if (Type == 1) { // inter
gts_surface_inter_boolean(si, s3, GTS_1_IN_2);
gts_surface_inter_boolean(si, s3, GTS_2_IN_1);
}
else if (Type == 2) {// diff
else if (Type == 2) { // diff
gts_surface_inter_boolean(si, s3, GTS_1_OUT_2);
gts_surface_inter_boolean(si, s3, GTS_2_IN_1);
gts_surface_foreach_face(si->s2, (GtsFunc)gts_triangle_revert, NULL);
gts_surface_foreach_face(s2, (GtsFunc)gts_triangle_revert, NULL);
}
else if (Type == 3) {// cut inner
else if (Type == 3) { // cut inner
gts_surface_inter_boolean(si, s3, GTS_1_IN_2);
}
else if (Type == 4) {// cut outer
else if (Type == 4) { // cut outer
gts_surface_inter_boolean(si, s3, GTS_1_OUT_2);
}
@@ -571,12 +571,12 @@ void MeshAlgos::LoftOnCurve(MeshCore::MeshKernel& ResultMesh,
ConnectMap[V1] = actPoint;
}
if (i)// not the first row or something to connect to
if (i) // not the first row or something to connect to
{
for (l = 0; l < actPoint.size(); l++) {
if (l)// not first point in row
if (l) // not first point in row
{
if (i == res - 1 && bEnd) {// if last row and a end to connect
if (i == res - 1 && bEnd) { // if last row and a end to connect
actPoint = ConnectMap[V2];
}

View File

@@ -116,6 +116,6 @@ public:
*/
};
}// namespace MeshPart
} // namespace MeshPart
#endif

View File

@@ -170,7 +170,7 @@ FaceUnwrapper::FaceUnwrapper(const TopoDS_Face& face)
void FaceUnwrapper::findFlatNodes(int steps, double val)
{
std::vector<long> fixed_pins;// TODO: INPUT
std::vector<long> fixed_pins; // TODO: INPUT
lscmrelax::LscmRelax mesh_flattener(this->xyz_nodes.transpose(),
this->tris.transpose(),
fixed_pins);

View File

@@ -78,4 +78,4 @@ public:
};
// clang-format on
#endif// MESHFLATTENING
#endif // MESHFLATTENING

View File

@@ -74,13 +74,13 @@
#include <NETGENPlugin_Hypothesis_2D.hxx>
#include <NETGENPlugin_NETGEN_2D.hxx>
#include <NETGENPlugin_SimpleHypothesis_2D.hxx>
#endif// HAVE_NETGEN
#endif // HAVE_NETGEN
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif// HAVE_SMESH
#endif // HAVE_SMESH
using namespace MeshPart;
@@ -159,7 +159,7 @@ struct Vertex
if (fabs(this->z - v.z) >= deflection) {
return this->z < v.z;
}
return false;// points are considered to be equal
return false; // points are considered to be equal
}
};
@@ -313,7 +313,7 @@ public:
return meshdata;
}
};
}// namespace MeshPart
} // namespace MeshPart
// ----------------------------------------------------------------------------
@@ -398,7 +398,7 @@ Mesh::MeshObject* Mesher::createMesh() const
hyp2d->SetQuadAllowed(allowquad);
hyp2d->SetOptimize(optimize);
hyp2d->SetSecondOrder(
secondOrder);// apply bisecting to create four triangles out of one
secondOrder); // apply bisecting to create four triangles out of one
hypoth.push_back(hyp2d);
#if SMESH_VERSION_MAJOR >= 9
@@ -531,7 +531,7 @@ Mesh::MeshObject* Mesher::createMesh() const
}
return meshdata;
#endif// HAVE_SMESH
#endif // HAVE_SMESH
}
Mesh::MeshObject* Mesher::createFrom(SMESH_Mesh* mesh) const

View File

@@ -256,6 +256,6 @@ private:
std::string buffer;
};
}// namespace MeshPart
} // namespace MeshPart
#endif// MESHPART_MESHER_H
#endif // MESHPART_MESHER_H

View File

@@ -78,5 +78,5 @@
#include <TopoDS_Shape.hxx>
#include <gp_Pln.hxx>
#endif// _PreComp_
#endif // _PreComp_
#endif

View File

@@ -51,7 +51,7 @@ public:
Module()
: Py::ExtensionModule<Module>("MeshPartGui")
{
initialize("This module is the MeshPartGui module.");// register with Python
initialize("This module is the MeshPartGui module."); // register with Python
}
private:
@@ -62,7 +62,7 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace MeshPartGui
} // namespace MeshPartGui
/* Python entry */

View File

@@ -169,7 +169,7 @@ private:
bool connectEdges;
double epsilon;
};
}// namespace MeshPartGui
} // namespace MeshPartGui
CrossSections::CrossSections(const Base::BoundBox3d& bb, QWidget* parent, Qt::WindowFlags fl)
: QDialog(parent, fl)
@@ -296,7 +296,7 @@ void CrossSections::apply()
bool connectEdges = ui->checkBoxConnect->isChecked();
double eps = ui->spinEpsilon->value();
#if 1// multi-threaded sections
#if 1 // multi-threaded sections
for (auto it : obj) {
const Mesh::MeshObject& mesh = static_cast<Mesh::Feature*>(it)->Mesh.getValue();

View File

@@ -110,6 +110,6 @@ private:
Gui::TaskView::TaskBox* taskbox;
};
}// namespace MeshPartGui
} // namespace MeshPartGui
#endif// MESHPARTGUI_CROSSSECTIONS_H
#endif // MESHPARTGUI_CROSSSECTIONS_H

View File

@@ -319,7 +319,7 @@ public:
std::list<std::vector<Base::Vector3f>> cutLines;
bool wireClosed {false};
double distance {1};
double cosAngle {0.7071};// 45 degree
double cosAngle {0.7071}; // 45 degree
bool approximate {true};
ViewProviderCurveOnMesh* curve;
Gui::ViewProviderDocumentObject* mesh {0};

View File

@@ -41,7 +41,7 @@ namespace Gui
{
class View3DInventor;
class ViewProvider;
}// namespace Gui
} // namespace Gui
namespace MeshPartGui
{
@@ -102,6 +102,6 @@ private:
std::unique_ptr<Private> d_ptr;
};
}// namespace MeshPartGui
} // namespace MeshPartGui
#endif// MESHPARTGUI_CURVEONMESH_H
#endif // MESHPARTGUI_CURVEONMESH_H

View File

@@ -76,6 +76,6 @@
#include <Inventor/nodes/SoPointSet.h>
#include <Inventor/nodes/SoSeparator.h>
#endif//_PreComp_
#endif //_PreComp_
#endif// __PRECOMPILED_GUI__
#endif // __PRECOMPILED_GUI__

View File

@@ -83,6 +83,6 @@ private:
Gui::TaskView::TaskBox* taskbox;
};
}// namespace MeshPartGui
} // namespace MeshPartGui
#endif// MESHPART_GUI_TASKCURVEONMESH_H
#endif // MESHPART_GUI_TASKCURVEONMESH_H

View File

@@ -35,7 +35,7 @@ namespace App
{
class Document;
class SubObjectT;
}// namespace App
} // namespace App
namespace MeshPartGui
{
@@ -140,6 +140,6 @@ private:
Tessellation* widget;
};
}// namespace MeshPartGui
} // namespace MeshPartGui
#endif// MESHPARTGUI_TESSELLATION_H
#endif // MESHPARTGUI_TESSELLATION_H

View File

@@ -32,7 +32,7 @@
using namespace MeshPartGui;
#if 0// needed for Qt's lupdate utility
#if 0 // needed for Qt's lupdate utility
qApp->translate("Workbench", "MeshPart");
#endif

View File

@@ -45,7 +45,7 @@ protected:
Gui::ToolBarItem* setupCommandBars() const override;
};
}// namespace MeshPartGui
} // namespace MeshPartGui
#endif// MESHPARTGUI_WORKBENCH_H
#endif // MESHPARTGUI_WORKBENCH_H

View File

@@ -44,4 +44,4 @@
#endif
#endif
#endif// MESHPART_GLOBAL_H
#endif // MESHPART_GLOBAL_H

View File

@@ -56,7 +56,7 @@ public:
&Module::show,
"show(points,[string]) -- Add the points to the active document or "
"create one if no document exists.");
initialize("This module is the Points module.");// register with Python
initialize("This module is the Points module."); // register with Python
}
private:
@@ -434,4 +434,4 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace Points
} // namespace Points

View File

@@ -228,7 +228,7 @@ public:
//@}
};
}// namespace Points
} // namespace Points
#endif// POINTS_POINTPROPERTIES_H
#endif // POINTS_POINTPROPERTIES_H

View File

@@ -30,7 +30,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/math/special_functions/fpclassify.hpp>// needed for compilation on some systems
#include <boost/math/special_functions/fpclassify.hpp> // needed for compilation on some systems
#include <boost/regex.hpp>
#endif
@@ -535,7 +535,7 @@ lzfDecompress(const void* const in_data, unsigned int in_len, void* out_data, un
*op++ = *ref++;
/* FALLTHRU */
case 0:
*op++ = *ref++;// two octets more
*op++ = *ref++; // two octets more
*op++ = *ref++;
}
}
@@ -543,7 +543,7 @@ lzfDecompress(const void* const in_data, unsigned int in_len, void* out_data, un
return (static_cast<unsigned int>(op - static_cast<unsigned char*>(out_data)));
}
}// namespace Points
} // namespace Points
PlyReader::PlyReader() = default;
@@ -733,7 +733,7 @@ std::size_t PlyReader::readHeader(std::istream& in,
in.read(ply, 3);
in.ignore(1);
if (!in || (ply[0] != 'p') || (ply[1] != 'l') || (ply[2] != 'y')) {
throw Base::BadFormatError("Not a ply file");// wrong header
throw Base::BadFormatError("Not a ply file"); // wrong header
}
while (std::getline(in, line)) {
@@ -807,8 +807,8 @@ std::size_t PlyReader::readHeader(std::istream& in,
std::list<std::string> number;
if (list[1] == "list") {
number.insert(number.end(), list.begin(), list.end());
number.pop_front();// property
number.pop_front();// list
number.pop_front(); // property
number.pop_front(); // list
number.pop_back();
}
else {
@@ -1768,7 +1768,7 @@ private:
PointKernel points;
std::vector<Base::Vector3f> normals;
};
}// namespace
} // namespace
E57Reader::E57Reader(bool Color, bool State, double Distance)
: useColor {Color}

View File

@@ -177,7 +177,7 @@ public:
void write(const std::string& filename) override;
};
}// namespace Points
} // namespace Points
#endif

View File

@@ -96,7 +96,7 @@ PROPERTY_SOURCE_TEMPLATE(Points::FeatureCustom, Points::Feature)
// explicit template instantiation
template class PointsExport FeatureCustomT<Points::Feature>;
}// namespace App
} // namespace App
// ---------------------------------------------------------
@@ -113,4 +113,4 @@ const char* Points::FeaturePython::getViewProviderName() const
// explicit template instantiation
template class PointsExport FeaturePythonT<Points::Feature>;
}// namespace App
} // namespace App

Some files were not shown because too many files have changed in this diff Show More