[Path] cleanup formatting of Area.cpp/.h

- MSVC always kind of "stumbled" over this file, therefore it was on my ToDo lost to let run MSVC's syntax unification over this file

- still many MSVC warnings, but now some less
This commit is contained in:
Uwe
2022-06-19 17:49:08 +02:00
parent 1adff3f917
commit 4a052dc34a
2 changed files with 1297 additions and 1230 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -48,27 +48,27 @@ namespace Path
/** Store libarea algorithm configuration */
struct PathExport CAreaParams {
PARAM_DECLARE(PARAM_FNAME,AREA_PARAMS_CAREA)
PARAM_DECLARE(PARAM_FNAME, AREA_PARAMS_CAREA);
CAreaParams();
};
/** Store all Area configurations */
struct PathExport AreaParams: CAreaParams {
PARAM_DECLARE(PARAM_FNAME,AREA_PARAMS_AREA)
PARAM_DECLARE(PARAM_FNAME, AREA_PARAMS_AREA);
bool operator==(const AreaParams &other) const {
bool operator==(const AreaParams& other) const {
#define AREA_COMPARE(_param) \
if(PARAM_FIELD(NAME,_param)!=other.PARAM_FIELD(NAME,_param)) return false;
PARAM_FOREACH(AREA_COMPARE,AREA_PARAMS_CAREA)
PARAM_FOREACH(AREA_COMPARE,AREA_PARAMS_AREA)
PARAM_FOREACH(AREA_COMPARE, AREA_PARAMS_CAREA);
PARAM_FOREACH(AREA_COMPARE, AREA_PARAMS_AREA);
return true;
}
bool operator!=(const AreaParams &other) const {
bool operator!=(const AreaParams& other) const {
return !(*this == other);
}
void dump(const char *) const;
void dump(const char*) const;
AreaParams();
};
@@ -85,7 +85,7 @@ struct PathExport AreaStaticParams: AreaParams {
struct PathExport CAreaConfig {
/** For saving current libarea settings */
PARAM_DECLARE(PARAM_FNAME,AREA_PARAMS_CAREA)
PARAM_DECLARE(PARAM_FNAME, AREA_PARAMS_CAREA);
/** The constructor automatically saves current setting and apply user defined ones
*
@@ -94,7 +94,7 @@ struct PathExport CAreaConfig {
* arc unfiting and fitting is lossy. And repeatedly perform these operation
* may cause shape deformation. So it is best to delay arc fitting until the
* final step*/
CAreaConfig(const CAreaParams &p, bool noFitArcs=true);
CAreaConfig(const CAreaParams& p, bool noFitArcs = true);
/** The destructor restores the setting, and thus exception safe. */
~CAreaConfig();
@@ -111,9 +111,9 @@ public:
short op;
TopoDS_Shape shape;
Shape(short opCode, const TopoDS_Shape &s)
Shape(short opCode, const TopoDS_Shape& s)
:op(opCode)
,shape(s)
, shape(s)
{}
};
@@ -142,17 +142,17 @@ protected:
/** Called by build() to add children shape
*
* Mainly for checking if there is any faces for auto fill*/
void addToBuild(CArea &area, const TopoDS_Shape &shape);
void addToBuild(CArea& area, const TopoDS_Shape& shape);
/** Called internally to obtain the combined children shapes */
TopoDS_Shape toShape(CArea &area, short fill, int reorient=0);
TopoDS_Shape toShape(CArea& area, short fill, int reorient = 0);
/** Obtain a list of offset areas
*
* See #AREA_PARAMS_OFFSET for description of the arguments.
*/
void makeOffset(std::list<std::shared_ptr<CArea> > &areas,
PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_OFFSET), bool from_center=false);
void makeOffset(std::list<std::shared_ptr<CArea> >& areas,
PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OFFSET), bool from_center = false);
/** Make a pocket of the combined shape
*
@@ -160,18 +160,18 @@ protected:
*/
TopoDS_Shape makePocket();
void explode(const TopoDS_Shape &shape);
void explode(const TopoDS_Shape& shape);
TopoDS_Shape findPlane(const TopoDS_Shape &shape, gp_Trsf &trsf);
TopoDS_Shape findPlane(const TopoDS_Shape& shape, gp_Trsf& trsf);
std::list<Shape> getProjectedShapes(const gp_Trsf &trsf, bool inverse=true) const;
std::list<Shape> getProjectedShapes(const gp_Trsf& trsf, bool inverse = true) const;
public:
/** Declare all parameters defined in #AREA_PARAMS_ALL as member variable */
PARAM_ENUM_DECLARE(AREA_PARAMS_ALL)
PARAM_ENUM_DECLARE(AREA_PARAMS_ALL);
Area(const AreaParams *params = nullptr);
Area(const Area &other, bool deep_copy=true);
Area(const AreaParams* params = nullptr);
Area(const Area& other, bool deep_copy = true);
virtual ~Area();
bool isBuilt() const;
@@ -187,7 +187,7 @@ public:
* If no working plane are set, Area will try to find a working plane from
* the added children shape using the same algorithm
*/
void setPlane(const TopoDS_Shape &shape);
void setPlane(const TopoDS_Shape& shape);
/** Return the current active workplane
*
@@ -197,7 +197,7 @@ public:
* If no workplane is set using setPlane(), the active workplane is derived from
* the added children shapes using the same algorithm empolyed by setPlane().
*/
TopoDS_Shape getPlane(gp_Trsf *trsf=nullptr);
TopoDS_Shape getPlane(gp_Trsf* trsf = nullptr);
/** Add a child shape with given operation code
*
@@ -208,7 +208,7 @@ public:
* \arg \c shape: the child shape
* \arg \c op: operation code, see #AREA_PARAMS_OPCODE
*/
void add(const TopoDS_Shape &shape,PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_OPCODE));
void add(const TopoDS_Shape& shape, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OPCODE));
/** Generate an offset of the combined shape
@@ -217,14 +217,14 @@ public:
* If more than one offset is requested, a compound shape is return
* containing all offset shapes as wires regardless of \c Fill setting.
*/
TopoDS_Shape makeOffset(int index=-1, PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_OFFSET),
int reoirent=0, bool from_center=false);
TopoDS_Shape makeOffset(int index = -1, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_OFFSET),
int reoirent = 0, bool from_center = false);
/** Make a pocket of the combined shape
*
* See #AREA_PARAMS_POCKET for description of the arguments.
*/
TopoDS_Shape makePocket(int index=-1, PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_POCKET));
TopoDS_Shape makePocket(int index = -1, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_POCKET));
/** Make a pocket of the combined shape
*
@@ -239,12 +239,12 @@ public:
* is only one argument, namely \c mode for section mode.
*/
std::vector<std::shared_ptr<Area> > makeSections(
PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_SECTION_EXTRA),
const std::vector<double> &heights = std::vector<double>(),
const TopoDS_Shape &plane = TopoDS_Shape());
PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_SECTION_EXTRA),
const std::vector<double>& heights = std::vector<double>(),
const TopoDS_Shape& plane = TopoDS_Shape());
/** Config this Area object */
void setParams(const AreaParams &params);
void setParams(const AreaParams& params);
const std::list<Shape> getChildren() const {
@@ -252,7 +252,7 @@ public:
}
/** Get the current configuration */
const AreaParams &getParams() const {
const AreaParams& getParams() const {
return myParams;
}
@@ -263,13 +263,13 @@ public:
*
* \arg \c deleteShapes: if true, delete all children shapes.
*/
void clean(bool deleteShapes=false);
void clean(bool deleteShapes = false);
/** Get the combined shape
* \arg \c index: index of the section, -1 for all sections. No effect on
* non-sectioned area.
*/
TopoDS_Shape getShape(int index=-1);
TopoDS_Shape getShape(int index = -1);
/** Return the number of sections */
std::size_t getSectionCount() {
@@ -287,8 +287,8 @@ public:
* \arg \c to_edges: if true, discretize all curves, and insert as open
* line segments
* */
static void addWire(CArea &area, const TopoDS_Wire &wire, const gp_Trsf *trsf=nullptr,
double deflection=0.01, bool to_edges=false);
static void addWire(CArea& area, const TopoDS_Wire& wire, const gp_Trsf* trsf = nullptr,
double deflection = 0.01, bool to_edges = false);
/** Add a OCC generic shape to CArea
*
@@ -307,10 +307,10 @@ public:
* \return Returns the number of non coplaner. Planar testing only happens
* if \c plane is supplied
* */
static int addShape(CArea &area, const TopoDS_Shape &shape, const gp_Trsf *trsf=nullptr,
double deflection=0.01,const TopoDS_Shape *plane = nullptr,
bool force_coplanar=true, CArea *areaOpen=nullptr, bool to_edges=false,
bool reorient=true);
static int addShape(CArea& area, const TopoDS_Shape& shape, const gp_Trsf* trsf = nullptr,
double deflection = 0.01, const TopoDS_Shape* plane = nullptr,
bool force_coplanar = true, CArea* areaOpen = nullptr, bool to_edges = false,
bool reorient = true);
/** Convert curves in CArea into an OCC shape
*
@@ -319,8 +319,8 @@ public:
* \arg \c trsf: optional transform matrix to transform the shape back into
* its original position.
* */
static TopoDS_Shape toShape(const CArea &area, bool fill,
const gp_Trsf *trsf=nullptr, int reoirent=0);
static TopoDS_Shape toShape(const CArea& area, bool fill,
const gp_Trsf* trsf = nullptr, int reoirent = 0);
/** Convert a single curve into an OCC wire
*
@@ -328,10 +328,10 @@ public:
* \arg \c trsf: optional transform matrix to transform the shape back into
* its original position.
* */
static TopoDS_Shape toShape(const CCurve &curve, const gp_Trsf *trsf=nullptr, int reorient=0);
static TopoDS_Shape toShape(const CCurve& curve, const gp_Trsf* trsf = nullptr, int reorient = 0);
/** Check if two OCC shape is coplanar */
static bool isCoplanar(const TopoDS_Shape &s1, const TopoDS_Shape &s2);
static bool isCoplanar(const TopoDS_Shape& s1, const TopoDS_Shape& s2);
/** Group shapes by their plane, and return a list of sorted wires
*
@@ -353,9 +353,9 @@ public:
*
* \return sorted wires
*/
static std::list<TopoDS_Shape> sortWires(const std::list<TopoDS_Shape> &shapes,
bool has_start=false, gp_Pnt *pstart=nullptr, gp_Pnt *pend=nullptr, double *stepdown_hint=nullptr,
short *arc_plane = nullptr, PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_SORT));
static std::list<TopoDS_Shape> sortWires(const std::list<TopoDS_Shape>& shapes,
bool has_start = false, gp_Pnt* pstart = nullptr, gp_Pnt* pend = nullptr, double* stepdown_hint = nullptr,
short* arc_plane = nullptr, PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_SORT));
/** Convert a list of wires to gcode
*
@@ -366,25 +366,25 @@ public:
*
* See #AREA_PARAMS_PATH for other arguments
*/
static void toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
const gp_Pnt *pstart=nullptr, gp_Pnt *pend=nullptr,
PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_PATH));
static void toPath(Toolpath& path, const std::list<TopoDS_Shape>& shapes,
const gp_Pnt* pstart = nullptr, gp_Pnt* pend = nullptr,
PARAM_ARGS_DEF(PARAM_FARG, AREA_PARAMS_PATH));
static int project(TopoDS_Shape &out, const TopoDS_Shape &in,
const AreaParams *params = nullptr,
const TopoDS_Shape *work_plane = nullptr);
static int project(TopoDS_Shape& out, const TopoDS_Shape& in,
const AreaParams* params = nullptr,
const TopoDS_Shape* work_plane = nullptr);
static void setWireOrientation(TopoDS_Wire& wire, const gp_Dir &dir, bool ccw);
static void setWireOrientation(TopoDS_Wire& wire, const gp_Dir& dir, bool ccw);
PARAM_ENUM_DECLARE(AREA_PARAMS_PATH)
PARAM_ENUM_DECLARE(AREA_PARAMS_PATH);
static void abort(bool aborting);
static bool aborting();
static void setDefaultParams(const AreaStaticParams &params);
static const AreaStaticParams &getDefaultParams();
static void setDefaultParams(const AreaStaticParams& params);
static const AreaStaticParams& getDefaultParams();
static void showShape(const TopoDS_Shape &shape, const char *name, const char *fmt=nullptr, ...);
static void showShape(const TopoDS_Shape& shape, const char* name, const char* fmt = nullptr, ...);
};
} //namespace Path