[TechDraw] Simplify return logic
Easy warmup
This commit is contained in:
committed by
WandererFan
parent
17b457a783
commit
6df0a20214
@@ -176,8 +176,7 @@ TopoDS_Edge CosmeticEdge::TopoDS_EdgeFromVectors(Base::Vector3d pt1, Base::Vecto
|
||||
Base::Vector3d p2 = DrawUtil::invertY(pt2);
|
||||
gp_Pnt gp1(p1.x, p1.y, p1.z);
|
||||
gp_Pnt gp2(p2.x, p2.y, p2.z);
|
||||
TopoDS_Edge e = BRepBuilderAPI_MakeEdge(gp1, gp2);
|
||||
return e;
|
||||
return BRepBuilderAPI_MakeEdge(gp1, gp2);
|
||||
}
|
||||
|
||||
TechDraw::BaseGeomPtr CosmeticEdge::scaledGeometry(double scale)
|
||||
|
||||
@@ -158,8 +158,7 @@ std::string CosmeticExtension::addCosmeticEdge(Base::Vector3d start,
|
||||
TechDraw::CosmeticEdge* ce = new TechDraw::CosmeticEdge(start, end);
|
||||
edges.push_back(ce);
|
||||
CosmeticEdges.setValues(edges);
|
||||
std::string result = ce->getTagAsString();
|
||||
return result;
|
||||
return ce->getTagAsString();
|
||||
}
|
||||
|
||||
std::string CosmeticExtension::addCosmeticEdge(TechDraw::BaseGeomPtr bg)
|
||||
@@ -169,8 +168,7 @@ std::string CosmeticExtension::addCosmeticEdge(TechDraw::BaseGeomPtr bg)
|
||||
TechDraw::CosmeticEdge* ce = new TechDraw::CosmeticEdge(bg);
|
||||
edges.push_back(ce);
|
||||
CosmeticEdges.setValues(edges);
|
||||
std::string result = ce->getTagAsString();
|
||||
return result;
|
||||
return ce->getTagAsString();
|
||||
}
|
||||
|
||||
//get CE by unique id
|
||||
@@ -258,8 +256,7 @@ std::string CosmeticExtension::addCenterLine(Base::Vector3d start,
|
||||
TechDraw::CenterLine* cl = new TechDraw::CenterLine(start, end);
|
||||
cLines.push_back(cl);
|
||||
CenterLines.setValues(cLines);
|
||||
std::string result = cl->getTagAsString();
|
||||
return result;
|
||||
return cl->getTagAsString();
|
||||
}
|
||||
|
||||
std::string CosmeticExtension::addCenterLine(TechDraw::CenterLine* cl)
|
||||
@@ -268,8 +265,7 @@ std::string CosmeticExtension::addCenterLine(TechDraw::CenterLine* cl)
|
||||
std::vector<CenterLine*> cLines = CenterLines.getValues();
|
||||
cLines.push_back(cl);
|
||||
CenterLines.setValues(cLines);
|
||||
std::string result = cl->getTagAsString();
|
||||
return result;
|
||||
return cl->getTagAsString();
|
||||
}
|
||||
|
||||
|
||||
@@ -280,8 +276,7 @@ std::string CosmeticExtension::addCenterLine(TechDraw::BaseGeomPtr bg)
|
||||
TechDraw::CenterLine* cl = new TechDraw::CenterLine(bg);
|
||||
cLines.push_back(cl);
|
||||
CenterLines.setValues(cLines);
|
||||
std::string result = cl->getTagAsString();
|
||||
return result;
|
||||
return cl->getTagAsString();
|
||||
}
|
||||
|
||||
|
||||
@@ -361,8 +356,7 @@ std::string CosmeticExtension::addGeomFormat(TechDraw::GeomFormat* gf)
|
||||
TechDraw::GeomFormat* newGF = new TechDraw::GeomFormat(gf);
|
||||
formats.push_back(newGF);
|
||||
GeomFormats.setValues(formats);
|
||||
std::string result = newGF->getTagAsString();
|
||||
return result;
|
||||
return newGF->getTagAsString();
|
||||
}
|
||||
|
||||
|
||||
@@ -407,10 +401,9 @@ TechDraw::GeomFormat* CosmeticExtension::getGeomFormatBySelection(std::string na
|
||||
TechDraw::GeomFormat* CosmeticExtension::getGeomFormatBySelection(int i) const
|
||||
{
|
||||
// Base::Console().Message("CEx::getCEBySelection(%d)\n", i);
|
||||
std::stringstream ss;
|
||||
ss << "Edge" << i;
|
||||
std::string eName = ss.str();
|
||||
return getGeomFormatBySelection(eName);
|
||||
std::stringstream edgeName;
|
||||
edgeName << "Edge" << i;
|
||||
return getGeomFormatBySelection(edgeName.str());
|
||||
}
|
||||
|
||||
void CosmeticExtension::removeGeomFormat(std::string delTag)
|
||||
|
||||
@@ -221,8 +221,7 @@ short DrawView::mustExecute() const
|
||||
////you must override this in derived class
|
||||
QRectF DrawView::getRect() const
|
||||
{
|
||||
QRectF result(0, 0,1, 1);
|
||||
return result;
|
||||
return QRectF(0, 0,1, 1);
|
||||
}
|
||||
|
||||
//get the rectangle centered on the position
|
||||
|
||||
@@ -137,10 +137,9 @@ App::DocumentObjectExecReturn *DrawViewArch::execute()
|
||||
|
||||
std::string DrawViewArch::getSVGHead()
|
||||
{
|
||||
std::string head = std::string("<svg\\n") +
|
||||
std::string(" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\\n") +
|
||||
std::string(" xmlns:freecad=\"http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace\">\\n");
|
||||
return head;
|
||||
return std::string("<svg\\n") +
|
||||
std::string(" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\\n") +
|
||||
std::string(" xmlns:freecad=\"http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace\">\\n");
|
||||
}
|
||||
|
||||
std::string DrawViewArch::getSVGTail()
|
||||
|
||||
@@ -244,8 +244,7 @@ Base::Vector3d DrawViewBalloon::getOriginOffset() const
|
||||
double ox = OriginX.getValue();
|
||||
double oy = OriginY.getValue();
|
||||
Base::Vector3d org(ox, oy, 0.0);
|
||||
Base::Vector3d offset = pos - org;
|
||||
return offset;
|
||||
return Base::Vector3d(pos - org);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -38,8 +38,7 @@ std::string DrawViewDimExtentPy::representation() const
|
||||
PyObject* DrawViewDimExtentPy::tbd(PyObject* args)
|
||||
{
|
||||
(void) args;
|
||||
PyObject *pyText = nullptr;
|
||||
return pyText;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -124,16 +124,14 @@ App::DocumentObjectExecReturn *DrawViewDraft::execute()
|
||||
|
||||
std::string DrawViewDraft::getSVGHead()
|
||||
{
|
||||
std::string head = std::string("<svg\\n") +
|
||||
std::string(" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\\n") +
|
||||
std::string(" xmlns:freecad=\"http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace\">\\n");
|
||||
return head;
|
||||
return std::string("<svg\\n") +
|
||||
std::string(" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\\n") +
|
||||
std::string(" xmlns:freecad=\"http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace\">\\n");
|
||||
}
|
||||
|
||||
std::string DrawViewDraft::getSVGTail()
|
||||
{
|
||||
std::string tail = "\\n</svg>";
|
||||
return tail;
|
||||
return "\\n</svg>";
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
@@ -159,10 +159,8 @@ DrawViewPart::~DrawViewPart()
|
||||
std::vector<TopoDS_Shape> DrawViewPart::getSourceShape2d() const
|
||||
{
|
||||
// Base::Console().Message("DVP::getSourceShape2d()\n");
|
||||
std::vector<TopoDS_Shape> result;
|
||||
const std::vector<App::DocumentObject*>& links = getAllSources();
|
||||
result = ShapeExtractor::getShapes2d(links);
|
||||
return result;
|
||||
return ShapeExtractor::getShapes2d(links);
|
||||
}
|
||||
|
||||
TopoDS_Shape DrawViewPart::getSourceShape() const
|
||||
|
||||
@@ -87,7 +87,7 @@ QRectF DrawViewSymbol::getRect() const
|
||||
{
|
||||
double w = 64.0;//must default to something
|
||||
double h = 64.0;
|
||||
return (QRectF(0, 0, w, h));
|
||||
return QRectF(0, 0, w, h);
|
||||
}
|
||||
|
||||
//!Assume all svg files fit the page and/or the user will scale manually
|
||||
|
||||
@@ -1004,16 +1004,14 @@ Base::Vector3d TechDraw::findCentroidVec(const TopoDS_Shape& shape, const Base::
|
||||
{
|
||||
// Base::Console().Message("GO::findCentroidVec() - 1\n");
|
||||
gp_Pnt p = TechDraw::findCentroid(shape, direction);
|
||||
Base::Vector3d result(p.X(), p.Y(), p.Z());
|
||||
return result;
|
||||
return Base::Vector3d(p.X(), p.Y(), p.Z());
|
||||
}
|
||||
|
||||
Base::Vector3d TechDraw::findCentroidVec(const TopoDS_Shape& shape, const gp_Ax2& cs)
|
||||
{
|
||||
// Base::Console().Message("GO::findCentroidVec() - 2\n");
|
||||
gp_Pnt p = TechDraw::findCentroid(shape, cs);
|
||||
Base::Vector3d result(p.X(), p.Y(), p.Z());
|
||||
return result;
|
||||
return Base::Vector3d(p.X(), p.Y(), p.Z());
|
||||
}
|
||||
|
||||
//! Returns the XY plane center of shape with respect to coordSys
|
||||
|
||||
@@ -73,8 +73,7 @@ double LineSet::getMaxY()
|
||||
|
||||
bool LineSet::isDashed()
|
||||
{
|
||||
bool result = m_hatchLine.isDashed();
|
||||
return result;
|
||||
return m_hatchLine.isDashed();
|
||||
}
|
||||
|
||||
//! calculates the apparent start point (ie start of overlay line) for dashed lines
|
||||
@@ -414,18 +413,16 @@ double PATLineSpec::getSlope()
|
||||
|
||||
//only dealing with angles -180:180 for now
|
||||
if (angle > 90.0) {
|
||||
angle = -(180.0 - angle);
|
||||
angle = -(180.0 - angle);
|
||||
} else if (angle < -90.0) {
|
||||
angle = (180 + angle);
|
||||
}
|
||||
double slope = tan(angle * M_PI/180.0);
|
||||
return slope;
|
||||
return tan(angle * M_PI/180.0);
|
||||
}
|
||||
|
||||
bool PATLineSpec::isDashed()
|
||||
{
|
||||
bool result = !m_dashParms.empty();
|
||||
return result;
|
||||
return !m_dashParms.empty();
|
||||
}
|
||||
|
||||
//! X component of distance between lines
|
||||
@@ -470,8 +467,7 @@ DashSpec DashSpec::reversed()
|
||||
{
|
||||
std::vector<double> p = get();
|
||||
std::reverse(p.begin(), p.end());
|
||||
DashSpec result(p);
|
||||
return result;
|
||||
return DashSpec(p);
|
||||
}
|
||||
|
||||
void DashSpec::dump(const char* title)
|
||||
|
||||
@@ -155,8 +155,7 @@ Base::Vector3d LandmarkDimension::projectPoint(const Base::Vector3d& pt, DrawVie
|
||||
gp_Pnt2d prjPnt;
|
||||
projector.Project(gPt, prjPnt);
|
||||
Base::Vector3d result(prjPnt.X(), prjPnt.Y(), 0.0);
|
||||
result = DrawUtil::invertY(result);
|
||||
return result;
|
||||
return DrawUtil::invertY(result);
|
||||
}
|
||||
|
||||
int LandmarkDimension::getRefType() const
|
||||
@@ -171,10 +170,7 @@ DrawViewPart* LandmarkDimension::getViewPart() const
|
||||
std::vector<App::DocumentObject*> refs2d = References2D.getValues();
|
||||
App::DocumentObject* obj = refs2d.front();
|
||||
DrawViewPart* dvp = dynamic_cast<DrawViewPart*>(obj);
|
||||
if (dvp) {
|
||||
result = dvp;
|
||||
}
|
||||
return result;
|
||||
return dvp;
|
||||
}
|
||||
|
||||
void LandmarkDimension::onDocumentRestored()
|
||||
|
||||
@@ -66,17 +66,16 @@ void LineGroup::init()
|
||||
|
||||
double LineGroup::getWeight(std::string s)
|
||||
{
|
||||
double result = 0.55;
|
||||
if (s == "Thin") {
|
||||
result = m_thin;
|
||||
return m_thin;
|
||||
} else if (s == "Graphic") {
|
||||
result = m_graphic;
|
||||
return m_graphic;
|
||||
} else if (s == "Thick") {
|
||||
result = m_thick;
|
||||
return m_thick;
|
||||
} else if (s == "Extra") {
|
||||
result = m_extra;
|
||||
return m_extra;
|
||||
}
|
||||
return result;
|
||||
return 0.55;
|
||||
}
|
||||
|
||||
void LineGroup::setWeight(std::string s, double weight)
|
||||
|
||||
Reference in New Issue
Block a user