[TD]Lint/Tidy/Review comments applied
This commit is contained in:
@@ -76,7 +76,7 @@ void pointPair::invertY()
|
||||
m_second = DU::invertY(m_second);
|
||||
}
|
||||
|
||||
void pointPair::dump(std::string text) const
|
||||
void pointPair::dump(std::string &text) const
|
||||
{
|
||||
Base::Console().Message("pointPair - %s\n", text.c_str());
|
||||
Base::Console().Message("pointPair - first: %s second: %s\n",
|
||||
@@ -132,7 +132,7 @@ void anglePoints::invertY()
|
||||
m_vertex = DU::invertY(m_vertex);
|
||||
}
|
||||
|
||||
void anglePoints::dump(std::string text) const
|
||||
void anglePoints::dump(std::string &text) const
|
||||
{
|
||||
Base::Console().Message("anglePoints - %s\n", text.c_str());
|
||||
Base::Console().Message("anglePoints - ends - first: %s second: %s\n",
|
||||
@@ -140,24 +140,19 @@ void anglePoints::dump(std::string text) const
|
||||
Base::Console().Message("anglePoints - vertex: %s\n", DU::formatVector(vertex()).c_str());
|
||||
}
|
||||
|
||||
arcPoints::arcPoints()
|
||||
arcPoints::arcPoints() :
|
||||
isArc(false),
|
||||
radius(0.0),
|
||||
arcCW(false)
|
||||
{
|
||||
isArc = false;
|
||||
radius = 0.0;
|
||||
center = Base::Vector3d(0.0, 0.0, 0.0);
|
||||
onCurve.first(Base::Vector3d(0.0, 0.0, 0.0));
|
||||
onCurve.second(Base::Vector3d(0.0, 0.0, 0.0));
|
||||
arcEnds.first(Base::Vector3d(0.0, 0.0, 0.0));
|
||||
arcEnds.second(Base::Vector3d(0.0, 0.0, 0.0));
|
||||
midArc = Base::Vector3d(0.0, 0.0, 0.0);
|
||||
arcCW = false;
|
||||
}
|
||||
|
||||
arcPoints::arcPoints(const arcPoints& ap)
|
||||
: isArc(ap.isArc), radius(ap.radius), center(ap.center), onCurve(ap.onCurve),
|
||||
arcEnds(ap.arcEnds), midArc(ap.midArc), arcCW(ap.arcCW)
|
||||
{}
|
||||
|
||||
arcPoints& arcPoints::operator=(const arcPoints& ap)
|
||||
{
|
||||
isArc = ap.isArc;
|
||||
@@ -219,7 +214,7 @@ void arcPoints::invertY()
|
||||
midArc = DU::invertY(midArc);
|
||||
}
|
||||
|
||||
void arcPoints::dump(std::string text) const
|
||||
void arcPoints::dump(std::string &text) const
|
||||
{
|
||||
Base::Console().Message("arcPoints - %s\n", text.c_str());
|
||||
Base::Console().Message("arcPoints - radius: %.3f center: %s\n", radius,
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void project(DrawViewPart* dvp);
|
||||
void mapToPage(DrawViewPart* dvp);
|
||||
void invertY();
|
||||
void dump(std::string text) const;
|
||||
void dump(std::string& text) const;
|
||||
|
||||
private:
|
||||
Base::Vector3d m_first;
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
void project(DrawViewPart* dvp);
|
||||
void mapToPage(DrawViewPart* dvp);
|
||||
void invertY();
|
||||
void dump(std::string text) const;
|
||||
void dump(std::string& text) const;
|
||||
|
||||
private:
|
||||
pointPair m_ends;
|
||||
@@ -99,7 +99,7 @@ class TechDrawExport arcPoints
|
||||
{
|
||||
public:
|
||||
arcPoints();
|
||||
arcPoints(const arcPoints& ap);
|
||||
arcPoints(const arcPoints& ap) = default;
|
||||
|
||||
arcPoints& operator= (const arcPoints& ap);
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
void project(DrawViewPart* dvp);
|
||||
void mapToPage(DrawViewPart* dvp);
|
||||
void invertY();
|
||||
void dump(std::string text) const;
|
||||
void dump(std::string& text) const;
|
||||
|
||||
//TODO: setters and getters
|
||||
bool isArc;
|
||||
|
||||
@@ -49,24 +49,26 @@ TopoDS_Shape ReferenceEntry::getGeometry() const
|
||||
{
|
||||
// Base::Console().Message("RE::getGeometry()\n");
|
||||
if ( getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) ) {
|
||||
TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
auto dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
std::string gType = geomType();
|
||||
if (gType == "Vertex") {
|
||||
auto vgeom = dvp->getVertex(getSubName());
|
||||
return vgeom->getOCCVertex();
|
||||
} else if (gType == "Edge") {
|
||||
}
|
||||
if (gType == "Edge") {
|
||||
auto egeom = dvp->getEdge(getSubName());
|
||||
return egeom->getOCCEdge();
|
||||
} else if (gType == "Face") {
|
||||
}
|
||||
if (gType == "Face") {
|
||||
auto fgeom = dvp->getFace(getSubName());
|
||||
return fgeom->toOccFace();
|
||||
}
|
||||
//Base::Console().Message("RE::getGeometry - returns null shape! - gType: %s\n", gType.c_str());
|
||||
return TopoDS_Shape();
|
||||
return {};
|
||||
}
|
||||
|
||||
Part::TopoShape shape = Part::Feature::getTopoShape(getObject());
|
||||
App::GeoFeature* geoFeat = dynamic_cast<App::GeoFeature*>(getObject());
|
||||
auto geoFeat = dynamic_cast<App::GeoFeature*>(getObject());
|
||||
if (geoFeat) {
|
||||
shape.setPlacement(geoFeat->globalPlacement());
|
||||
}
|
||||
@@ -102,7 +104,7 @@ App::DocumentObject* ReferenceEntry::getObject() const
|
||||
return m_object;
|
||||
}
|
||||
|
||||
Part::TopoShape ReferenceEntry::asTopoShape()
|
||||
Part::TopoShape ReferenceEntry::asTopoShape() const
|
||||
{
|
||||
// Base::Console().Message("RE::asTopoShape()\n");
|
||||
TopoDS_Shape geom = getGeometry();
|
||||
@@ -110,37 +112,36 @@ Part::TopoShape ReferenceEntry::asTopoShape()
|
||||
if (geom.ShapeType() == TopAbs_VERTEX) {
|
||||
TopoDS_Vertex vert = TopoDS::Vertex(geom);
|
||||
return asTopoShapeVertex(vert);
|
||||
} else if (geom.ShapeType() == TopAbs_EDGE) {
|
||||
}
|
||||
if (geom.ShapeType() == TopAbs_EDGE) {
|
||||
TopoDS_Edge edge = TopoDS::Edge(geom);
|
||||
return asTopoShapeEdge(edge);
|
||||
} else {
|
||||
throw Base::RuntimeError("Dimension Reference has unsupported geometry");
|
||||
}
|
||||
return Part::TopoShape();
|
||||
throw Base::RuntimeError("Dimension Reference has unsupported geometry");
|
||||
}
|
||||
|
||||
Part::TopoShape ReferenceEntry::asTopoShapeVertex(TopoDS_Vertex vert)
|
||||
Part::TopoShape ReferenceEntry::asTopoShapeVertex(TopoDS_Vertex& vert) const
|
||||
{
|
||||
Base::Vector3d point = DU::toVector3d(BRep_Tool::Pnt(vert));
|
||||
if (!is3d()) {
|
||||
TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
auto dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
point = point / dvp->getScale();
|
||||
}
|
||||
BRepBuilderAPI_MakeVertex mkVert(DU::togp_Pnt(point));
|
||||
return Part::TopoShape(mkVert.Vertex());
|
||||
return { mkVert.Vertex() };
|
||||
}
|
||||
|
||||
Part::TopoShape ReferenceEntry::asTopoShapeEdge(TopoDS_Edge edge)
|
||||
Part::TopoShape ReferenceEntry::asTopoShapeEdge(TopoDS_Edge &edge) const
|
||||
{
|
||||
// Base::Console().Message("RE::asTopoShapeEdge()\n");
|
||||
TopoDS_Edge unscaledEdge = edge;
|
||||
if (!is3d()) {
|
||||
// 2d reference - projected and scaled. scale might have changed, so we need to unscale
|
||||
TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
auto dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
TopoDS_Shape unscaledShape = TechDraw::scaleShape(edge, 1.0 / dvp->getScale());
|
||||
unscaledEdge = TopoDS::Edge(unscaledShape);
|
||||
}
|
||||
return Part::TopoShape(unscaledEdge);
|
||||
return { unscaledEdge };
|
||||
}
|
||||
|
||||
std::string ReferenceEntry::geomType() const
|
||||
@@ -155,9 +156,6 @@ bool ReferenceEntry::isWholeObject() const
|
||||
|
||||
bool ReferenceEntry::is3d() const
|
||||
{
|
||||
if ( getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId());
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ public:
|
||||
std::string geomType() const;
|
||||
bool isWholeObject() const;
|
||||
|
||||
Part::TopoShape asTopoShape();
|
||||
Part::TopoShape asTopoShapeVertex(TopoDS_Vertex vert);
|
||||
Part::TopoShape asTopoShapeEdge(TopoDS_Edge edge);
|
||||
Part::TopoShape asTopoShape() const;
|
||||
Part::TopoShape asTopoShapeVertex(TopoDS_Vertex &vert) const;
|
||||
Part::TopoShape asTopoShapeEdge(TopoDS_Edge& edge) const;
|
||||
|
||||
bool is3d() const;
|
||||
|
||||
|
||||
@@ -529,11 +529,13 @@ double DrawViewDimension::getDimValue()
|
||||
//nothing to measure
|
||||
return result;
|
||||
}
|
||||
if (!getViewPart())
|
||||
if (!getViewPart()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!getViewPart()->hasGeometry())//happens when loading saved document
|
||||
if (!getViewPart()->hasGeometry()) { //happens when loading saved document
|
||||
return result;
|
||||
}
|
||||
|
||||
if (MeasureType.isValue("True")) {
|
||||
// True Values
|
||||
@@ -1233,7 +1235,7 @@ ReferenceVector DrawViewDimension::getReferences3d() const
|
||||
return refs3d;
|
||||
}
|
||||
|
||||
void DrawViewDimension::replaceReferenceSubElement2d(int iRef, std::string newSubelement)
|
||||
void DrawViewDimension::replaceReferenceSubElement2d(int iRef, std::string& newSubelement)
|
||||
{
|
||||
// Base::Console().Message("DVD::replaceReferenceSubElement2d(%d, %s)\n", iRef, newSubelement.c_str());
|
||||
ReferenceVector refs = getReferences2d();
|
||||
@@ -1241,7 +1243,7 @@ void DrawViewDimension::replaceReferenceSubElement2d(int iRef, std::string newSu
|
||||
setReferences2d(refs);
|
||||
}
|
||||
|
||||
void DrawViewDimension::replaceReferenceSubElement3d(int iRef, std::string newSubelement)
|
||||
void DrawViewDimension::replaceReferenceSubElement3d(int iRef, std::string& newSubelement)
|
||||
{
|
||||
ReferenceVector refs = getReferences3d();
|
||||
refs.at(iRef).setSubName(newSubelement);
|
||||
|
||||
@@ -176,7 +176,7 @@ protected:
|
||||
virtual pointPair getPointsEdgeVert(ReferenceVector references);
|
||||
|
||||
virtual arcPoints getArcParameters(ReferenceVector references);
|
||||
virtual arcPoints arcPointsFromBaseGeom(TechDraw::BaseGeomPtr base);
|
||||
virtual arcPoints arcPointsFromBaseGeom(BaseGeomPtr base);
|
||||
virtual arcPoints arcPointsFromEdge(TopoDS_Edge occEdge);
|
||||
|
||||
virtual anglePoints getAnglePointsTwoEdges(ReferenceVector references);
|
||||
@@ -203,8 +203,8 @@ protected:
|
||||
std::string recoverChangedEdge3d(int iReference);
|
||||
std::string recoverChangedVertex2d(int iReference);
|
||||
std::string recoverChangedVertex3d(int iReference);
|
||||
void replaceReferenceSubElement2d(int iRef, std::string newSubelement);
|
||||
void replaceReferenceSubElement3d(int iRef, std::string newSubelement);
|
||||
void replaceReferenceSubElement2d(int iRef, std::string &newSubelement);
|
||||
void replaceReferenceSubElement3d(int iRef, std::string &newSubelement);
|
||||
|
||||
std::vector<Part::TopoShape> getEdges(const Part::TopoShape& inShape);
|
||||
std::vector<Part::TopoShape> getVertexes(const Part::TopoShape& inShape);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace TechDraw {
|
||||
class TechDrawExport GeometryMatcher {
|
||||
public:
|
||||
GeometryMatcher() {}
|
||||
GeometryMatcher(DrawViewDimension* dim) { m_dimension = dim; }
|
||||
explicit GeometryMatcher(DrawViewDimension* dim) { m_dimension = dim; }
|
||||
~GeometryMatcher() = default;
|
||||
|
||||
bool compareGeometry(Part::TopoShape geom1, Part::TopoShape geom2);
|
||||
|
||||
@@ -159,7 +159,7 @@ class TechDrawGuiExport QGIViewDimension : public QGIView
|
||||
public:
|
||||
enum {Type = QGraphicsItem::UserType + 106};
|
||||
|
||||
explicit QGIViewDimension();
|
||||
QGIViewDimension();
|
||||
~QGIViewDimension() = default;
|
||||
|
||||
void setViewPartFeature(TechDraw::DrawViewDimension *obj);
|
||||
|
||||
Reference in New Issue
Block a user