[TechDraw] Improve DimensionGeometry.cpp typing
Make type safe by using const keywords when appropriate and improve memory handling by using references when appropriate.
This commit is contained in:
committed by
WandererFan
parent
575489b816
commit
bb50fd1079
@@ -44,14 +44,14 @@ pointPair::pointPair(const pointPair& pp)
|
||||
}
|
||||
|
||||
//move the points by offset
|
||||
void pointPair::move(Base::Vector3d offset)
|
||||
void pointPair::move(const Base::Vector3d& offset)
|
||||
{
|
||||
m_first = m_first - offset;
|
||||
m_second = m_second - offset;
|
||||
}
|
||||
|
||||
// project the points onto the dvp's paper plane.
|
||||
void pointPair::project(DrawViewPart* dvp)
|
||||
void pointPair::project(const DrawViewPart* dvp)
|
||||
{
|
||||
m_first = dvp->projectPoint(m_first) * dvp->getScale();
|
||||
m_second = dvp->projectPoint(m_second) * dvp->getScale();
|
||||
@@ -60,7 +60,7 @@ void pointPair::project(DrawViewPart* dvp)
|
||||
// map the points onto the dvp's XY coordinate system
|
||||
// this routine is no longer needed since we now use the hlr projector instead
|
||||
// of "projectToPlane" from Vector3d
|
||||
void pointPair::mapToPage(DrawViewPart* dvp)
|
||||
void pointPair::mapToPage(const DrawViewPart* dvp)
|
||||
{
|
||||
gp_Trsf xOXYZ;
|
||||
gp_Ax3 OXYZ;
|
||||
@@ -80,7 +80,7 @@ void pointPair::invertY()
|
||||
m_second = DU::invertY(m_second);
|
||||
}
|
||||
|
||||
void pointPair::dump(std::string text) const
|
||||
void pointPair::dump(const std::string& text) const
|
||||
{
|
||||
Base::Console().Message("pointPair - %s\n", text.c_str());
|
||||
Base::Console().Message("pointPair - first: %s second: %s\n",
|
||||
@@ -104,14 +104,14 @@ anglePoints& anglePoints::operator=(const anglePoints& ap)
|
||||
}
|
||||
|
||||
// move the points by offset
|
||||
void anglePoints::move(Base::Vector3d offset)
|
||||
void anglePoints::move(const Base::Vector3d& offset)
|
||||
{
|
||||
m_ends.move(offset);
|
||||
m_vertex = m_vertex - offset;
|
||||
}
|
||||
|
||||
// project the points onto the dvp's paper plane.
|
||||
void anglePoints::project(DrawViewPart* dvp)
|
||||
void anglePoints::project(const DrawViewPart* dvp)
|
||||
{
|
||||
m_ends.project(dvp);
|
||||
m_vertex = dvp->projectPoint(m_vertex) * dvp->getScale();
|
||||
@@ -119,7 +119,7 @@ void anglePoints::project(DrawViewPart* dvp)
|
||||
|
||||
// map the points onto the dvp's XY coordinate system
|
||||
// obsolete. see above.
|
||||
void anglePoints::mapToPage(DrawViewPart* dvp)
|
||||
void anglePoints::mapToPage(const DrawViewPart* dvp)
|
||||
{
|
||||
m_ends.mapToPage(dvp);
|
||||
|
||||
@@ -138,7 +138,7 @@ void anglePoints::invertY()
|
||||
m_vertex = DU::invertY(m_vertex);
|
||||
}
|
||||
|
||||
void anglePoints::dump(std::string text) const
|
||||
void anglePoints::dump(const std::string& text) const
|
||||
{
|
||||
Base::Console().Message("anglePoints - %s\n", text.c_str());
|
||||
Base::Console().Message("anglePoints - ends - first: %s second: %s\n",
|
||||
@@ -171,7 +171,7 @@ arcPoints& arcPoints::operator=(const arcPoints& ap)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void arcPoints::move(Base::Vector3d offset)
|
||||
void arcPoints::move(const Base::Vector3d& offset)
|
||||
{
|
||||
center = center - offset;
|
||||
onCurve.first(onCurve.first() - offset);
|
||||
@@ -181,7 +181,7 @@ void arcPoints::move(Base::Vector3d offset)
|
||||
midArc = midArc - offset;
|
||||
}
|
||||
|
||||
void arcPoints::project(DrawViewPart* dvp)
|
||||
void arcPoints::project(const DrawViewPart* dvp)
|
||||
{
|
||||
radius = radius * dvp->getScale();
|
||||
center = dvp->projectPoint(center) * dvp->getScale();
|
||||
@@ -193,7 +193,7 @@ void arcPoints::project(DrawViewPart* dvp)
|
||||
}
|
||||
|
||||
// obsolete. see above
|
||||
void arcPoints::mapToPage(DrawViewPart* dvp)
|
||||
void arcPoints::mapToPage(const DrawViewPart* dvp)
|
||||
{
|
||||
gp_Trsf xOXYZ;
|
||||
gp_Ax3 OXYZ;
|
||||
@@ -222,7 +222,7 @@ void arcPoints::invertY()
|
||||
midArc = DU::invertY(midArc);
|
||||
}
|
||||
|
||||
void arcPoints::dump(std::string text) const
|
||||
void arcPoints::dump(const std::string& text) const
|
||||
{
|
||||
Base::Console().Message("arcPoints - %s\n", text.c_str());
|
||||
Base::Console().Message("arcPoints - radius: %.3f center: %s\n", radius,
|
||||
|
||||
Reference in New Issue
Block a user