lint / review cleanups

This commit is contained in:
bgbsww
2024-01-22 11:01:19 -05:00
parent 1490de0087
commit 31a6eb5a4a
5 changed files with 33 additions and 38 deletions

View File

@@ -206,17 +206,10 @@ void Part::FaceMaker::postBuild() {
std::vector<Data::MappedName> names;
Data::ElementIDRefs sids;
#if 0
for (auto &e : edgeNames) {
names.insert(e.name);
sids += e.sids;
}
#else
// We just use the first source element name to make the face name more
// stable
names.push_back(edgeNames.begin()->name);
sids = edgeNames.begin()->sids;
#endif
this->myTopoShape.setElementComboName(
Data::IndexedName::fromConst("Face",i),names,op,nullptr,&sids);
}

View File

@@ -86,7 +86,7 @@ public:
virtual const TopoDS_Face& Face();
#if OCC_VERSION_HEX >= 0x070600
virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange());
void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) override;
#else
virtual void Build();
#endif

View File

@@ -655,11 +655,11 @@ public:
*/
TopoShape &makeElementCompound(const std::vector<TopoShape> &shapes, const char *op=nullptr, bool force=true);
TopoShape &makeElementFace(const std::vector<TopoShape> &shapes,
const char *op = nullptr,
const char *maker = nullptr,
const gp_Pln *pln = nullptr);
/** Make a planar face with the input wire or edge
TopoShape& makeElementFace(const std::vector<TopoShape>& shapes,
const char* op = nullptr,
const char* maker = nullptr,
const gp_Pln* pln = nullptr);
/** Make a planar face with the input wire or edge
*
* @param shape: input shape. Can be either edge, wire, or compound of
* those two types
@@ -675,11 +675,11 @@ public:
* multiple operations can be carried out for the same shape in the
* same line of code.
*/
TopoShape &makeElementFace(const TopoShape &shape,
const char *op = nullptr,
const char *maker = nullptr,
const gp_Pln *pln = nullptr);
/** Make a planar face using this shape
TopoShape& makeElementFace(const TopoShape& shape,
const char* op = nullptr,
const char* maker = nullptr,
const gp_Pln* pln = nullptr);
/** Make a planar face using this shape
*
* @param op: optional string to be encoded into topo naming for indicating
* the operation
@@ -690,20 +690,22 @@ public:
* @return The function returns a new planar face made using the wire or edge
* inside this shape. The shape itself is not modified.
*/
TopoShape makeElementFace(const char *op = nullptr,
const char *maker = nullptr,
const gp_Pln *pln = nullptr) const {
return TopoShape(0,Hasher).makeElementFace(*this,op,maker,pln);
TopoShape makeElementFace(const char* op = nullptr,
const char* maker = nullptr,
const gp_Pln* pln = nullptr) const
{
return TopoShape(0, Hasher).makeElementFace(*this, op, maker, pln);
}
/// Filling style when making a BSpline face
enum FillingStyle {
enum class FillingStyle
{
/// The style with the flattest patches
FillingStyle_Strech,
Stretch,
/// A rounded style of patch with less depth than those of Curved
FillingStyle_Coons,
Coons,
/// The style with the most rounded patches
FillingStyle_Curved,
Curved,
};

View File

@@ -552,7 +552,7 @@ TopoShape::makeElementCompound(const std::vector<TopoShape>& shapes, const char*
TopoShape& TopoShape::makeElementFace(const TopoShape& shape,
const char* op,
const char* maker,
const gp_Pln* pln)
const gp_Pln* plane)
{
std::vector<TopoShape> shapes;
if (shape.isNull()) {
@@ -564,13 +564,13 @@ TopoShape& TopoShape::makeElementFace(const TopoShape& shape,
else {
shapes.push_back(shape);
}
return makeElementFace(shapes, op, maker, pln);
return makeElementFace(shapes, op, maker, plane);
}
TopoShape& TopoShape::makeElementFace(const std::vector<TopoShape>& shapes,
const char* op,
const char* maker,
const gp_Pln* pln)
const gp_Pln* plane)
{
if (!maker || !maker[0]) {
maker = "Part::FaceMakerBullseye";
@@ -578,16 +578,16 @@ TopoShape& TopoShape::makeElementFace(const std::vector<TopoShape>& shapes,
std::unique_ptr<FaceMaker> mkFace = FaceMaker::ConstructFromType(maker);
mkFace->MyHasher = Hasher;
mkFace->MyOp = op;
if (pln) {
mkFace->setPlane(*pln);
if (plane) {
mkFace->setPlane(*plane);
}
for (auto& s : shapes) {
if (s.getShape().ShapeType() == TopAbs_COMPOUND) {
mkFace->useTopoCompound(s);
for (auto& shape : shapes) {
if (shape.getShape().ShapeType() == TopAbs_COMPOUND) {
mkFace->useTopoCompound(shape);
}
else {
mkFace->addTopoShape(s);
mkFace->addTopoShape(shape);
}
}
mkFace->Build();
@@ -634,7 +634,7 @@ TopoShape& TopoShape::makeElementFace(const std::vector<TopoShape>& shapes,
* elementMapPrefix.
* @param op The op text passed to the element name encoder along with the TopoShape Tag
* @param _sids If defined, records the sub ids processed.
*
*
* @return The encoded, possibly hashed name.
*/
Data::MappedName TopoShape::setElementComboName(const Data::IndexedName& element,

View File

@@ -426,8 +426,8 @@ TEST_F(TopoShapeExpansionTest, splitWires)
EXPECT_FLOAT_EQ(PartTestHelpers::getLength(wire.getShape()), 2 + 2 + 3 + 3);
EXPECT_FLOAT_EQ(PartTestHelpers::getLength(inner.front().getShape()), M_PI * R * 2);
EXPECT_EQ(wire.getShape().Orientation(), TopAbs_REVERSED);
for (Part::TopoShape ts : inner) {
EXPECT_EQ(ts.getShape().Orientation(), TopAbs_FORWARD);
for (Part::TopoShape& shape : inner) {
EXPECT_EQ(shape.getShape().Orientation(), TopAbs_FORWARD);
}
}