LGTM: [skip ci] fix: Large object passed by value

This commit is contained in:
wmayer
2020-07-24 18:32:31 +02:00
parent 75ba0b8a77
commit d5d7d65bfc
20 changed files with 48 additions and 48 deletions

View File

@@ -230,7 +230,7 @@ void orthoview::smooth(bool state)
this_view->ShowSmoothLines.setValue(state);
}
void orthoview::set_projection(gp_Ax2 cs)
void orthoview::set_projection(const gp_Ax2& cs)
{
gp_Ax2 actual_cs;
gp_Dir actual_X;

View File

@@ -47,7 +47,7 @@ public:
~orthoview();
void set_data(int r_x, int r_y);
void set_projection(gp_Ax2 cs);
void set_projection(const gp_Ax2& cs);
void setPos(float = 0, float = 0);
void setScale(float newscale);
float getScale();

View File

@@ -95,7 +95,7 @@ public:
private:
// Helper functions
double vertex_error(SymmetricMatrix q, double x, double y, double z);
double vertex_error(const SymmetricMatrix& q, double x, double y, double z);
double calculate_error(int id_v1, int id_v2, vec3f &p_result);
bool flipped(vec3f p,int i0,int i1,Vertex &v0,Vertex &v1,std::vector<int> &deleted);
void update_triangles(int i0,Vertex &v,std::vector<int> &deleted,int &deleted_triangles);
@@ -494,7 +494,7 @@ void Simplify::compact_mesh()
// Error between vertex and Quadric
double Simplify::vertex_error(SymmetricMatrix q, double x, double y, double z)
double Simplify::vertex_error(const SymmetricMatrix& q, double x, double y, double z)
{
return q[0]*x*x + 2*q[1]*x*y + 2*q[2]*x*z + 2*q[3]*x + q[4]*y*y
+ 2*q[5]*y*z + 2*q[6]*y + q[7]*z*z + 2*q[8]*z + q[9];

View File

@@ -977,7 +977,7 @@ AttachEngine3D* AttachEngine3D::copy() const
return p;
}
Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origPlacement) const
Base::Placement AttachEngine3D::calculateAttachedPlacement(const Base::Placement& origPlacement) const
{
const eMapMode mmode = this->mapMode;
if (mmode == mmDeactivated)
@@ -1627,7 +1627,7 @@ AttachEnginePlane *AttachEnginePlane::copy() const
return p;
}
Base::Placement AttachEnginePlane::calculateAttachedPlacement(Base::Placement origPlacement) const
Base::Placement AttachEnginePlane::calculateAttachedPlacement(const Base::Placement& origPlacement) const
{
//re-use Attacher3d
Base::Placement plm;
@@ -1691,7 +1691,7 @@ AttachEngineLine *AttachEngineLine::copy() const
return p;
}
Base::Placement AttachEngineLine::calculateAttachedPlacement(Base::Placement origPlacement) const
Base::Placement AttachEngineLine::calculateAttachedPlacement(const Base::Placement& origPlacement) const
{
eMapMode mmode = this->mapMode;
@@ -1960,7 +1960,7 @@ AttachEnginePoint *AttachEnginePoint::copy() const
return p;
}
Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement origPlacement) const
Base::Placement AttachEnginePoint::calculateAttachedPlacement(const Base::Placement& origPlacement) const
{
eMapMode mmode = this->mapMode;

View File

@@ -224,7 +224,7 @@ public: //methods
const Base::Placement &attachmentOffset = Base::Placement());
virtual void setUp(const AttachEngine &another);
virtual AttachEngine* copy() const = 0;
virtual Base::Placement calculateAttachedPlacement(Base::Placement origPlacement) const = 0;
virtual Base::Placement calculateAttachedPlacement(const Base::Placement& origPlacement) const = 0;
/**
* @brief placementFactory calculates placement from Z axis direction,
@@ -422,7 +422,7 @@ class PartExport AttachEngine3D : public AttachEngine
public:
AttachEngine3D();
virtual AttachEngine3D* copy() const;
virtual Base::Placement calculateAttachedPlacement(Base::Placement origPlacement) const;
virtual Base::Placement calculateAttachedPlacement(const Base::Placement& origPlacement) const;
private:
double calculateFoldAngle(gp_Vec axA, gp_Vec axB, gp_Vec edA, gp_Vec edB) const;
};
@@ -434,7 +434,7 @@ class PartExport AttachEnginePlane : public AttachEngine
public:
AttachEnginePlane();
virtual AttachEnginePlane* copy() const;
virtual Base::Placement calculateAttachedPlacement(Base::Placement origPlacement) const;
virtual Base::Placement calculateAttachedPlacement(const Base::Placement& origPlacement) const;
};
//attacher specialized for datum lines
@@ -444,7 +444,7 @@ class PartExport AttachEngineLine : public AttachEngine
public:
AttachEngineLine();
virtual AttachEngineLine* copy() const;
virtual Base::Placement calculateAttachedPlacement(Base::Placement origPlacement) const;
virtual Base::Placement calculateAttachedPlacement(const Base::Placement& origPlacement) const;
};
//attacher specialized for datum points
@@ -454,7 +454,7 @@ class PartExport AttachEnginePoint : public AttachEngine
public:
AttachEnginePoint();
virtual AttachEnginePoint* copy() const;
virtual Base::Placement calculateAttachedPlacement(Base::Placement origPlacement) const;
virtual Base::Placement calculateAttachedPlacement(const Base::Placement& origPlacement) const;
private:
gp_Pnt getProximityPoint(eMapMode mode, const TopoDS_Shape& s1, const TopoDS_Shape& s2) const;

View File

@@ -144,7 +144,7 @@ void FaceMakerBullseye::Build_Essence()
}
FaceMakerBullseye::FaceDriller::FaceDriller(gp_Pln plane, TopoDS_Wire outerWire)
FaceMakerBullseye::FaceDriller::FaceDriller(const gp_Pln& plane, TopoDS_Wire outerWire)
{
this->myPlane = plane;
this->myFace = TopoDS_Face();
@@ -159,7 +159,7 @@ FaceMakerBullseye::FaceDriller::FaceDriller(gp_Pln plane, TopoDS_Wire outerWire)
builder.Add(this->myFace, outerWire);
}
bool FaceMakerBullseye::FaceDriller::hitTest(gp_Pnt point) const
bool FaceMakerBullseye::FaceDriller::hitTest(const gp_Pnt& point) const
{
double u,v;
GeomAPI_ProjectPointOnSurf(point, myHPlane).LowerDistanceParameters(u,v);

View File

@@ -74,17 +74,17 @@ protected:
class FaceDriller
{
public:
FaceDriller(gp_Pln plane, TopoDS_Wire outerWire);
FaceDriller(const gp_Pln& plane, TopoDS_Wire outerWire);
/**
* @brief hitTest: returns True if point is on the face
* @param point
*/
bool hitTest(gp_Pnt point) const;
bool hitTest(const gp_Pnt& point) const;
void addHole(TopoDS_Wire w);
TopoDS_Face Face() {return myFace;}
const TopoDS_Face& Face() const {return myFace;}
public:
/**
* @brief wireDirection: determines direction of wire with respect to

View File

@@ -235,7 +235,7 @@ Base::Vector3d Extrusion::calculateShapeNormal(const App::PropertyLink& shapeLin
return Base::Vector3d(normal.X(), normal.Y(), normal.Z());
}
TopoShape Extrusion::extrudeShape(const TopoShape source, Extrusion::ExtrusionParameters params)
TopoShape Extrusion::extrudeShape(const TopoShape& source, const Extrusion::ExtrusionParameters& params)
{
TopoDS_Shape result;
gp_Vec vec = gp_Vec(params.dir).Multiplied(params.lengthFwd+params.lengthRev);//total vector of extrusion
@@ -332,7 +332,7 @@ App::DocumentObjectExecReturn *Extrusion::execute(void)
}
}
void Extrusion::makeDraft(ExtrusionParameters params, const TopoDS_Shape& shape, std::list<TopoDS_Shape>& drafts)
void Extrusion::makeDraft(const ExtrusionParameters& params, const TopoDS_Shape& shape, std::list<TopoDS_Shape>& drafts)
{
double distanceFwd = tan(params.taperAngleFwd)*params.lengthFwd;
double distanceRev = tan(params.taperAngleRev)*params.lengthRev;

View File

@@ -87,7 +87,7 @@ public:
* @param params: extrusion parameters
* @return result of extrusion
*/
static TopoShape extrudeShape(TopoShape source, ExtrusionParameters params);
static TopoShape extrudeShape(const TopoShape& source, const ExtrusionParameters& params);
/**
* @brief fetchAxisLink: read AxisLink to obtain the direction and
@@ -121,7 +121,7 @@ public: //mode enumerations
static const char* eDirModeStrings[];
protected:
static void makeDraft(ExtrusionParameters params, const TopoDS_Shape&, std::list<TopoDS_Shape>&);
static void makeDraft(const ExtrusionParameters& params, const TopoDS_Shape&, std::list<TopoDS_Shape>&);
protected:

View File

@@ -250,7 +250,7 @@ void Command::setCenter(const Base::Vector3d &pos, bool clockwise)
Parameters[k] = kval;
}
Command Command::transform(const Base::Placement other)
Command Command::transform(const Base::Placement& other)
{
Base::Placement plac = getPlacement();
plac *= other;

View File

@@ -56,7 +56,7 @@ namespace Path
void setFromGCode (const std::string&); // sets the parameters from the contents of the given GCode string
void setFromPlacement (const Base::Placement&); // sets the parameters from the contents of the given placement
bool has(const std::string&) const; // returns true if the given string exists in the parameters
Command transform(const Base::Placement); // returns a transformed copy of this command
Command transform(const Base::Placement&); // returns a transformed copy of this command
double getValue(const std::string &name) const; // returns the value of a given parameter
void scaleBy(double factor); // scales the receiver - use for imperial/metric conversions

View File

@@ -125,7 +125,7 @@ void TaskRobot6Axis::createPlacementDlg(void)
}
void TaskRobot6Axis::viewTcp(const Base::Placement pos)
void TaskRobot6Axis::viewTcp(const Base::Placement& pos)
{
double A,B,C;
pos.getRotation().getYawPitchRoll(A,B,C);
@@ -141,7 +141,7 @@ void TaskRobot6Axis::viewTcp(const Base::Placement pos)
ui->label_TCP->setText(result);
}
void TaskRobot6Axis::viewTool(const Base::Placement pos)
void TaskRobot6Axis::viewTool(const Base::Placement& pos)
{
double A,B,C;
pos.getRotation().getYawPitchRoll(A,B,C);

View File

@@ -68,8 +68,8 @@ private Q_SLOTS:
protected:
Robot::RobotObject *pcRobot;
void viewTcp(const Base::Placement pos);
void viewTool(const Base::Placement pos);
void viewTcp(const Base::Placement& pos);
void viewTool(const Base::Placement& pos);
void setColor(int i,float angle, QLineEdit &lineEdit);
private:

View File

@@ -113,7 +113,7 @@ TaskTrajectory::~TaskTrajectory()
}
void TaskTrajectory::viewTool(const Base::Placement pos)
void TaskTrajectory::viewTool(const Base::Placement& pos)
{
double A,B,C;
pos.getRotation().getYawPitchRoll(A,B,C);

View File

@@ -81,7 +81,7 @@ Q_SIGNALS:
protected:
void setTo(void);
void viewTool(const Base::Placement pos);
void viewTool(const Base::Placement& pos);
QTimer *timer;

View File

@@ -439,7 +439,7 @@ bool DrawUtil::vectorLess(const Base::Vector3d& v1, const Base::Vector3d& v2)
}
//!convert fromPoint in coordinate system fromSystem to reference coordinate system
Base::Vector3d DrawUtil::toR3(const gp_Ax2 fromSystem, const Base::Vector3d fromPoint)
Base::Vector3d DrawUtil::toR3(const gp_Ax2& fromSystem, const Base::Vector3d& fromPoint)
{
gp_Pnt gFromPoint(fromPoint.x,fromPoint.y,fromPoint.z);
gp_Pnt gToPoint;
@@ -1247,7 +1247,7 @@ QString DrawUtil::qbaToDebug(const QByteArray & line)
}
void DrawUtil::dumpCS(const char* text,
gp_Ax2 CS)
const gp_Ax2& CS)
{
gp_Dir baseAxis = CS.Direction();
gp_Dir baseX = CS.XDirection();
@@ -1261,7 +1261,7 @@ void DrawUtil::dumpCS(const char* text,
}
void DrawUtil::dumpCS3(const char* text,
gp_Ax3 CS)
const gp_Ax3& CS)
{
gp_Dir baseAxis = CS.Direction();
gp_Dir baseX = CS.XDirection();

View File

@@ -93,7 +93,7 @@ class TechDrawExport DrawUtil {
static std::string formatVector(const QPointF& v);
static bool vectorLess(const Base::Vector3d& v1, const Base::Vector3d& v2);
static Base::Vector3d toR3(const gp_Ax2 fromSystem, const Base::Vector3d fromPoint);
static Base::Vector3d toR3(const gp_Ax2& fromSystem, const Base::Vector3d& fromPoint);
static bool checkParallel(const Base::Vector3d v1, const Base::Vector3d v2, double tolerance = FLT_EPSILON);
//! rotate vector by angle radians around axis through org
static Base::Vector3d vecRotate(Base::Vector3d vec,
@@ -172,8 +172,8 @@ class TechDrawExport DrawUtil {
static void countEdges(const char* label, const TopoDS_Shape& s);
static const char* printBool(bool b);
static QString qbaToDebug(const QByteArray& line);
static void dumpCS(const char* text, gp_Ax2 CS);
static void dumpCS3(const char* text, gp_Ax3 CS);
static void dumpCS(const char* text, const gp_Ax2& CS);
static void dumpCS3(const char* text, const gp_Ax3& CS);
static void dumpEdges(const char* text, const TopoDS_Shape& s);
};

View File

@@ -172,7 +172,7 @@ void GeometryObject::clear()
//!set up a hidden line remover and project a shape with it
void GeometryObject::projectShape(const TopoDS_Shape& input,
const gp_Ax2 viewAxis)
const gp_Ax2& viewAxis)
{
// Base::Console().Message("GO::projectShape() - %s\n", m_parentName.c_str());
// Clear previous Geometry
@@ -295,7 +295,7 @@ TopoDS_Shape GeometryObject::invertGeometry(const TopoDS_Shape s)
//!set up a hidden line remover and project a shape with it
void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input,
const gp_Ax2 viewAxis)
const gp_Ax2 &viewAxis)
{
// Clear previous Geometry
clear();
@@ -404,7 +404,7 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input,
}
TopoDS_Shape GeometryObject::projectFace(const TopoDS_Shape &face,
const gp_Ax2 CS)
const gp_Ax2 &CS)
{
// Base::Console().Message("GO::projectFace()\n");
if(face.IsNull()) {
@@ -939,7 +939,7 @@ gp_Pnt TechDraw::findCentroid(const TopoDS_Shape &shape,
//! Returns the centroid of shape, as viewed according to direction
gp_Pnt TechDraw::findCentroid(const TopoDS_Shape &shape,
const gp_Ax2 viewAxis)
const gp_Ax2 &viewAxis)
{
// Base::Console().Message("GO::findCentroid() - 2\n");
// Base::Vector3d origin(0.0,0.0,0.0);
@@ -976,7 +976,7 @@ Base::Vector3d TechDraw::findCentroidVec(const TopoDS_Shape &shape,
}
Base::Vector3d TechDraw::findCentroidVec(const TopoDS_Shape &shape,
const gp_Ax2 cs)
const gp_Ax2 &cs)
{
// Base::Console().Message("GO::findCentroidVec() - 2\n");
gp_Pnt p = TechDraw::findCentroid(shape,cs);

View File

@@ -75,11 +75,11 @@ TopoDS_Shape TechDrawExport moveShape(const TopoDS_Shape &input,
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape &shape,
const Base::Vector3d &direction);
gp_Pnt TechDrawExport findCentroid(const TopoDS_Shape &shape,
const gp_Ax2 viewAxis);
const gp_Ax2 &viewAxis);
Base::Vector3d TechDrawExport findCentroidVec(const TopoDS_Shape &shape,
const Base::Vector3d &direction);
Base::Vector3d TechDrawExport findCentroidVec(const TopoDS_Shape &shape,
const gp_Ax2 cs);
const gp_Ax2& cs);
gp_Ax2 TechDrawExport getViewAxis(const Base::Vector3d origin,
const Base::Vector3d& direction,
@@ -113,11 +113,11 @@ public:
void setEdgeGeometry(std::vector<BaseGeom*> newGeoms) {edgeGeom = newGeoms; }
void projectShape(const TopoDS_Shape &input,
const gp_Ax2 viewAxis);
const gp_Ax2 &viewAxis);
void projectShapeWithPolygonAlgo(const TopoDS_Shape &input,
const gp_Ax2 viewAxis);
const gp_Ax2 &viewAxis);
TopoDS_Shape projectFace(const TopoDS_Shape &face,
const gp_Ax2 CS);
const gp_Ax2 &CS);
void extractGeometry(edgeClass category, bool visible);
void addFaceGeom(Face * f);

View File

@@ -115,10 +115,10 @@ public:
LineSet() {}
~LineSet() {}
void setPATLineSpec(PATLineSpec s) { m_hatchLine = s; }
void setPATLineSpec(const PATLineSpec& s) { m_hatchLine = s; }
void setEdges(std::vector<TopoDS_Edge> e) {m_edges = e;}
void setGeoms(std::vector<TechDraw::BaseGeom*> g) {m_geoms = g;}
void setBBox(Bnd_Box bb) {m_box = bb;}
void setBBox(const Bnd_Box& bb) {m_box = bb;}
std::vector<TopoDS_Edge> getEdges(void) { return m_edges; }
TopoDS_Edge getEdge(int i) {return m_edges.at(i);}