[TechDraw] Simplify return logic
Easy warmup
This commit is contained in:
committed by
WandererFan
parent
122ab14d92
commit
70c9cf0fc0
@@ -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)
|
||||
|
||||
@@ -695,8 +695,6 @@ long int TechDraw::mapGeometryTypeToDimType(long int dimType, DimensionGeometryT
|
||||
return DrawViewDimension::Angle;
|
||||
case isAngle3Pt:
|
||||
return DrawViewDimension::Angle3Pt;
|
||||
default:
|
||||
return dimType;
|
||||
}
|
||||
} else if (geometry2d != isViewReference) {
|
||||
switch (geometry2d) {
|
||||
@@ -710,8 +708,6 @@ long int TechDraw::mapGeometryTypeToDimType(long int dimType, DimensionGeometryT
|
||||
return DrawViewDimension::Angle;
|
||||
case isAngle3Pt:
|
||||
return DrawViewDimension::Angle3Pt;
|
||||
default:
|
||||
return dimType;
|
||||
}
|
||||
}
|
||||
return dimType;
|
||||
|
||||
@@ -59,8 +59,7 @@ void DlgTemplateField::setFieldContent(std::string content)
|
||||
|
||||
QString DlgTemplateField::getFieldContent()
|
||||
{
|
||||
QString result = ui->leInput->text();
|
||||
return result;
|
||||
return ui->leInput->text();
|
||||
}
|
||||
|
||||
void DlgTemplateField::accept()
|
||||
|
||||
@@ -434,6 +434,5 @@ std::pair<Base::Vector3d, Base::Vector3d> DrawGuiUtil::getProjDirFromFace(App::D
|
||||
}
|
||||
}
|
||||
|
||||
dirs = std::make_pair(projDir, rotVec);
|
||||
return dirs;
|
||||
return std::make_pair(projDir, rotVec);
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ bool QGCustomImage::load(QPixmap map)
|
||||
|
||||
QSize QGCustomImage::imageSize()
|
||||
{
|
||||
QSize result = m_px.size() * scale();
|
||||
return result;
|
||||
return m_px.size() * scale();
|
||||
}
|
||||
|
||||
void QGCustomImage::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
|
||||
@@ -111,9 +111,7 @@ int QGIMatting::getHoleStyle()
|
||||
//need this because QQGIG only updates BR when items added/deleted.
|
||||
QRectF QGIMatting::boundingRect() const
|
||||
{
|
||||
QRectF result ;
|
||||
result = childrenBoundingRect().adjusted(-1, -1, 1,1);
|
||||
return result;
|
||||
return childrenBoundingRect().adjusted(-1, -1, 1,1);
|
||||
}
|
||||
|
||||
void QGIMatting::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
|
||||
@@ -293,8 +293,7 @@ double QGIRichAnno::prefPointSize()
|
||||
// double mmToPts = 2.83; //theoretical value
|
||||
double mmToPts = 2.00; //practical value. seems to be reasonable for common fonts.
|
||||
|
||||
double ptsSize = round(fontSize * mmToPts);
|
||||
return ptsSize;
|
||||
return round(fontSize * mmToPts);
|
||||
}
|
||||
|
||||
void QGIRichAnno::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) {
|
||||
|
||||
@@ -414,8 +414,7 @@ QPointF QGISectionLine::getArrowPosition(Base::Vector3d arrowDir, QPointF refPoi
|
||||
double offsetLength = m_extLen + Rez::guiX(QGIArrow::getPrefArrowSize());
|
||||
QPointF offsetVec = offsetLength * qArrowDir;
|
||||
|
||||
QPointF arrowPos = refPoint + offsetVec;
|
||||
return arrowPos;
|
||||
return QPointF(refPoint + offsetVec);
|
||||
}
|
||||
|
||||
void QGISectionLine::setFont(QFont f, double fsize)
|
||||
|
||||
@@ -52,8 +52,7 @@ double Rez::guiX(double x)
|
||||
|
||||
Base::Vector3d Rez::guiX(Base::Vector3d v)
|
||||
{
|
||||
Base::Vector3d result(guiX(v.x), guiX(v.y), guiX(v.z));
|
||||
return result;
|
||||
return Base::Vector3d(guiX(v.x), guiX(v.y), guiX(v.z));
|
||||
}
|
||||
|
||||
Base::Vector2d Rez::guiX(Base::Vector3d v, bool planar)
|
||||
@@ -75,8 +74,7 @@ double Rez::appX(double x)
|
||||
|
||||
Base::Vector3d Rez::appX(Base::Vector3d v)
|
||||
{
|
||||
Base::Vector3d result(appX(v.x), appX(v.y), appX(v.z));
|
||||
return result;
|
||||
return Base::Vector3d(appX(v.x), appX(v.y), appX(v.z));
|
||||
}
|
||||
|
||||
QPointF Rez::appX(QPointF p)
|
||||
@@ -89,36 +87,30 @@ QPointF Rez::appX(QPointF p)
|
||||
//Misc conversions
|
||||
QPointF Rez::guiPt(QPointF p)
|
||||
{
|
||||
QPointF result = p;
|
||||
result *= getRezFactor();
|
||||
return result;
|
||||
return p * getRezFactor();
|
||||
}
|
||||
|
||||
QPointF Rez::appPt(QPointF p)
|
||||
{
|
||||
QPointF result(appX(p.x()), appX(p.y()));
|
||||
return result;
|
||||
return QPointF(appX(p.x()), appX(p.y()));
|
||||
}
|
||||
|
||||
QRectF Rez::guiRect(QRectF r)
|
||||
{
|
||||
QRectF result(guiX(r.left()),
|
||||
return QRectF(guiX(r.left()),
|
||||
guiX(r.top()),
|
||||
guiX(r.width()),
|
||||
guiX(r.height()));
|
||||
return result;
|
||||
}
|
||||
|
||||
QSize Rez::guiSize(QSize s)
|
||||
{
|
||||
QSize result((int)guiX(s.width()), (int)guiX(s.height()));
|
||||
return result;
|
||||
return QSize((int)guiX(s.width()), (int)guiX(s.height()));
|
||||
}
|
||||
|
||||
QSize Rez::appSize(QSize s)
|
||||
{
|
||||
QSize result((int)appX(s.width()), (int)appX(s.height()));
|
||||
return result;
|
||||
return QSize((int)appX(s.width()), (int)appX(s.height()));
|
||||
}
|
||||
|
||||
double Rez::getParameter()
|
||||
|
||||
@@ -531,8 +531,7 @@ QPointF TaskDetail::getAnchorScene()
|
||||
Base::Vector3d xyScene = Rez::guiX(basePos);
|
||||
Base::Vector3d anchorOffsetScene = Rez::guiX(anchorPos) * scale;
|
||||
Base::Vector3d netPos = xyScene + anchorOffsetScene;
|
||||
QPointF qAnchor(netPos.x, netPos.y);
|
||||
return qAnchor;
|
||||
return QPointF(netPos.x, netPos.y);
|
||||
}
|
||||
|
||||
// protects against stale pointers
|
||||
|
||||
@@ -82,13 +82,10 @@ float lineAttributes::getWidthValue()
|
||||
switch(EdgeWidth(width)) {
|
||||
case EdgeWidth::small:
|
||||
return 0.18f;
|
||||
break;
|
||||
case EdgeWidth::middle:
|
||||
return 0.35f;
|
||||
break;
|
||||
case EdgeWidth::thick:
|
||||
return 0.5f;
|
||||
break;
|
||||
default:
|
||||
return 0.35f;
|
||||
}
|
||||
|
||||
@@ -151,8 +151,7 @@ std::vector<App::DocumentObject*> ViewProviderLeader::claimChildren() const
|
||||
return temp;
|
||||
}
|
||||
catch (...) {
|
||||
std::vector<App::DocumentObject*> tmp;
|
||||
return tmp;
|
||||
return std::vector<App::DocumentObject*>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -796,15 +796,13 @@ int MRichTextEdit::getDefFontSizeNum()
|
||||
// double mmToPts = 2.83; //theoretical value
|
||||
double mmToPts = 2.00; //practical value. seems to be reasonable for common fonts.
|
||||
|
||||
int ptsSize = round(fontSize * mmToPts);
|
||||
return ptsSize;
|
||||
return round(fontSize * mmToPts);
|
||||
}
|
||||
|
||||
QString MRichTextEdit::getDefFontSize()
|
||||
{
|
||||
// Base::Console().Message("MRTE::getDefFontSize()\n");
|
||||
QString result = QString::number(getDefFontSizeNum());
|
||||
return result;
|
||||
return QString::number(getDefFontSizeNum());
|
||||
}
|
||||
|
||||
//not used.
|
||||
|
||||
Reference in New Issue
Block a user