Cleanup merge issues and linter concerns

This commit is contained in:
bgbsww
2024-01-28 11:40:27 -05:00
parent 29213ecb57
commit 408b4dcd85
3 changed files with 43 additions and 1230 deletions

View File

@@ -40,14 +40,6 @@
#include <BRepFeat_MakePrism.hxx>
#include <BRepPrimAPI_MakeHalfSpace.hxx>
// FIXME?
// including <BRepPrimAPI_MakeHalfSpace.hxx> instead of the incomplete class declaration
// below results in a broken link on Windows but builds on other platforms. I suspect
// that's why these class declarations appear in the RT branch.
// Something about how that compiler is mangling the names? Maybe we're missing a
// magic windows specific qualifier on the declarations.
class BRepPrimAPI_MakeHalfSpace;
class gp_Ax1;
class gp_Ax2;
class gp_Pln;
@@ -62,7 +54,6 @@ namespace Part
{
class TopoShapeCache;
class TopoShape;
/* A special sub-class to indicate null shapes
*/
@@ -731,9 +722,9 @@ public:
* a self reference so that multiple operations can be carried out
* for the same shape in the same line of code.
*/
// TopoShape& makeElementShellFromWires(const std::vector<TopoShape>& wires,
// bool silent = true,
// const char* op = nullptr);
TopoShape& makeElementShellFromWires(const std::vector<TopoShape>& wires,
bool silent = true,
const char* op = nullptr);
/* Make a shell with input wires
*
* @param wires: input wires
@@ -743,10 +734,10 @@ public:
*
* @return Return the new shape. The TopoShape itself is not modified.
*/
// TopoShape& makeElementShellFromWires(bool silent = true, const char* op = nullptr)
// {
// return makeElementShellFromWires(getSubTopoShapes(TopAbs_WIRE), silent, op);
// }
TopoShape& makeElementShellFromWires(bool silent = true, const char* op = nullptr)
{
return makeElementShellFromWires(getSubTopoShapes(TopAbs_WIRE), silent, op);
}
TopoShape& makeElementFace(const std::vector<TopoShape>& shapes,
const char* op = nullptr,
@@ -1195,11 +1186,11 @@ private:
struct PartExport MapperMaker: TopoShape::Mapper
{
BRepBuilderAPI_MakeShape& maker;
MapperMaker(BRepBuilderAPI_MakeShape& maker)
explicit MapperMaker(BRepBuilderAPI_MakeShape& maker)
: maker(maker)
{}
virtual const std::vector<TopoDS_Shape>& modified(const TopoDS_Shape& s) const override;
virtual const std::vector<TopoDS_Shape>& generated(const TopoDS_Shape& s) const override;
const std::vector<TopoDS_Shape>& modified(const TopoDS_Shape& s) const override;
const std::vector<TopoDS_Shape>& generated(const TopoDS_Shape& s) const override;
};
} // namespace Part

View File

@@ -42,7 +42,6 @@
#include "TopoShape.h"
#include "TopoShapeCache.h"
#include "TopoShapeOpCode.h"
#include "FaceMaker.h"
#include "TopoShapeOpCode.h"
@@ -263,6 +262,7 @@ size_t checkSubshapeCount(const TopoShape& topoShape1,
}
return count;
}
} // namespace
void TopoShape::setupChild(Data::ElementMap::MappedChildElements& child,
@@ -316,7 +316,7 @@ void warnIfLogging()
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("hasher mismatch"); // NOLINT
}
};
}
void hasherMismatchError()
{
@@ -392,11 +392,11 @@ void TopoShape::mapSubElementTypeForShape(const TopoShape& other,
sids.clear();
}
}
std::ostringstream ss;
char elementType {shapeName(type)[0]};
if (!elementMap()) {
FC_THROWM(NullShapeException, "No element map"); // NOLINT
}
std::ostringstream ss;
elementMap()->encodeElementName(elementType, name, ss, &sids, Tag, op, other.Tag);
elementMap()->setElementName(element, name, Tag, &sids);
}
@@ -530,7 +530,7 @@ struct ShapeInfo
, shapetype(TopoShape::shapeName(type).c_str())
{}
int count() const
[[nodiscard]] int count() const
{
return cache.count();
}
@@ -1301,10 +1301,10 @@ TopoShape::makeElementCompound(const std::vector<TopoShape>& shapes, const char*
struct MapperSewing: Part::TopoShape::Mapper
{
BRepBuilderAPI_Sewing& maker;
MapperSewing(BRepBuilderAPI_Sewing& maker)
explicit MapperSewing(BRepBuilderAPI_Sewing& maker)
: maker(maker)
{}
virtual const std::vector<TopoDS_Shape>& modified(const TopoDS_Shape& s) const override
const std::vector<TopoDS_Shape>& modified(const TopoDS_Shape& s) const override
{
_res.clear();
try {
@@ -1343,14 +1343,14 @@ struct MapperThruSections: MapperMaker
lastProfile = profiles.back();
}
}
virtual const std::vector<TopoDS_Shape>& generated(const TopoDS_Shape& s) const override
const std::vector<TopoDS_Shape>& generated(const TopoDS_Shape& s) const override
{
MapperMaker::generated(s);
if (_res.size()) {
if ( ! _res.empty()) {
return _res;
}
try {
auto& tmaker = static_cast<BRepOffsetAPI_ThruSections&>(maker);
auto& tmaker = dynamic_cast<BRepOffsetAPI_ThruSections&>(maker);
auto shape = tmaker.GeneratedFace(s);
if (!shape.IsNull()) {
_res.push_back(shape);
@@ -1531,7 +1531,7 @@ Data::MappedName TopoShape::setElementComboName(const Data::IndexedName& element
const Data::ElementIDRefs* _sids)
{
if (names.empty()) {
return Data::MappedName();
return Data::MappedName {};
}
std::string _marker;
if (!marker) {
@@ -1610,7 +1610,7 @@ TopoShape TopoShape::splitWires(std::vector<TopoShape>* inner, SplitWireReorient
tmp = BRepTools::OuterWire(TopoDS::Face(getSubShape(TopAbs_FACE, 1)));
}
if (tmp.IsNull()) {
return TopoShape();
return TopoShape {};
}
const auto& wires = getSubTopoShapes(TopAbs_WIRE);
auto it = wires.begin();
@@ -1677,91 +1677,9 @@ TopoShape TopoShape::splitWires(std::vector<TopoShape>* inner, SplitWireReorient
}
}
}
return TopoShape();
return TopoShape {};
}
TopoShape& TopoShape::makeElementShape(BRepBuilderAPI_MakeShape& mkShape,
const TopoShape& source,
const char* op)
{
std::vector<TopoShape> sources(1, source);
return makeElementShape(mkShape, sources, op);
}
TopoShape& TopoShape::makeElementShape(BRepBuilderAPI_MakeShape& mkShape,
const std::vector<TopoShape>& shapes,
const char* op)
{
return makeShapeWithElementMap(mkShape.Shape(), MapperMaker(mkShape), shapes, op);
}
TopoShape&
TopoShape::makeElementShape(BRepOffsetAPI_ThruSections& mk, const TopoShape& source, const char* op)
{
if (!op) {
op = Part::OpCodes::ThruSections;
}
return makeElementShape(mk, std::vector<TopoShape>(1, source), op);
}
TopoShape& TopoShape::makeElementShape(BRepOffsetAPI_ThruSections& mk,
const std::vector<TopoShape>& sources,
const char* op)
{
if (!op) {
op = Part::OpCodes::ThruSections;
}
return makeShapeWithElementMap(mk.Shape(), MapperThruSections(mk, sources), sources, op);
}
TopoShape& TopoShape::makeElementShape(BRepBuilderAPI_Sewing& mk,
const std::vector<TopoShape>& shapes,
const char* op)
{
if (!op) {
op = Part::OpCodes::Sewing;
}
return makeShapeWithElementMap(mk.SewedShape(), MapperSewing(mk), shapes, op);
}
TopoShape&
TopoShape::makeElementShape(BRepBuilderAPI_Sewing& mkShape, const TopoShape& source, const char* op)
{
if (!op) {
op = Part::OpCodes::Sewing;
}
return makeElementShape(mkShape, std::vector<TopoShape>(1, source), op);
}
struct MapperSewing: Part::TopoShape::Mapper
{
BRepBuilderAPI_Sewing& maker;
MapperSewing(BRepBuilderAPI_Sewing& maker)
: maker(maker)
{}
virtual const std::vector<TopoDS_Shape>& modified(const TopoDS_Shape& s) const override
{
_res.clear();
try {
const auto& shape = maker.Modified(s);
if (!shape.IsNull() && !shape.IsSame(s)) {
_res.push_back(shape);
}
else {
const auto& sshape = maker.ModifiedSubShape(s);
if (!sshape.IsNull() && !sshape.IsSame(s)) {
_res.push_back(sshape);
}
}
}
catch (const Standard_Failure& e) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Exception on shape mapper: " << e.GetMessageString());
}
}
return _res;
}
};
struct MapperFill: Part::TopoShape::Mapper
{
BRepFill_Generator& maker;
@@ -1911,26 +1829,26 @@ TopoShape& TopoShape::makeElementShell(bool silent, const char* op)
return *this;
}
// TopoShape& TopoShape::makeElementShellFromWires(const std::vector<TopoShape>& wires,
// bool silent,
// const char* op)
// {
// BRepFill_Generator maker;
// for (auto& w : wires) {
// if (w.shapeType(silent) == TopAbs_WIRE) {
// maker.AddWire(TopoDS::Wire(w.getShape()));
// }
// }
// if (wires.empty()) {
// if (silent) {
// _Shape.Nullify();
// return *this;
// }
// FC_THROWM(NullShapeException, "No input shapes");
// }
// maker.Perform();
// this->makeShapeWithElementMap(maker.Shell(), MapperFill(maker), wires, op);
// return *this;
// }
TopoShape& TopoShape::makeElementShellFromWires(const std::vector<TopoShape>& wires,
bool silent,
const char* op)
{
BRepFill_Generator maker;
for (auto& w : wires) {
if (w.shapeType(silent) == TopAbs_WIRE) {
maker.AddWire(TopoDS::Wire(w.getShape()));
}
}
if (wires.empty()) {
if (silent) {
_Shape.Nullify();
return *this;
}
FC_THROWM(NullShapeException, "No input shapes");
}
maker.Perform();
this->makeShapeWithElementMap(maker.Shell(), MapperFill(maker), wires, op);
return *this;
}
} // namespace Part