Update container type to OCCT to avoid allocation on creating.
Refactor shape processing parameter handling to use XSAlgo_ShapeProcessor for consistency.
FixMode FixIntersectingWiresMode = FixMode::FixOrNot;
FixMode FixLoopWiresMode = FixMode::FixOrNot;
FixMode FixSplitFaceMode = FixMode::FixOrNot;
- FixMode AutoCorrectPrecisionMode = FixMode::FixOrNot;
+ FixMode AutoCorrectPrecisionMode = FixMode::Fix;
FixMode ModifyTopologyMode = FixMode::NotFix;
FixMode ModifyGeometryMode = FixMode::Fix;
FixMode ClosedWireMode = FixMode::Fix;
//=============================================================================
-void IGESControl_Writer::SetShapeFixParameters(const ParameterMap& theParameters)
+void IGESControl_Writer::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
myShapeProcParams = theParameters;
}
//=============================================================================
-void IGESControl_Writer::SetShapeFixParameters(ParameterMap&& theParameters)
+void IGESControl_Writer::SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
myShapeProcParams = std::move(theParameters);
}
//=============================================================================
-void IGESControl_Writer::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+void IGESControl_Writer::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
- myShapeProcParams.clear();
- XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
- for (const auto& aParam : theAdditionalParameters)
- {
- if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
- {
- myShapeProcParams[aParam.first] = aParam.second;
- }
- }
+ XSAlgo_ShapeProcessor::SetShapeFixParameters(theParameters,
+ theAdditionalParameters,
+ myShapeProcParams);
}
//=============================================================================
void IGESControl_Writer::InitializeMissingParameters()
{
- if (GetShapeFixParameters().empty())
+ if (GetShapeFixParameters().IsEmpty())
{
SetShapeFixParameters(DEIGES_Parameters::GetDefaultShapeFixParameters());
}
#include <Standard_CString.hxx>
#include <Standard_OStream.hxx>
#include <Message_ProgressRange.hxx>
-
-#include <unordered_map>
+#include <XSAlgo_ShapeProcessor.hxx>
struct DE_ShapeFixParameters;
class Transfer_FinderProcess;
public:
DEFINE_STANDARD_ALLOC
- using ParameterMap = std::unordered_map<std::string, std::string>;
- // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
- // we use a pair. The first element is the flags, the second element is a boolean value that
- // indicates whether the flags were set.
- using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
-
public:
//! Creates a writer object with the
//! default unit (millimeters) and write mode (Face).
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- inline const ParameterMap& GetShapeFixParameters() const { return myShapeProcParams; }
+ inline const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const
+ {
+ return myShapeProcParams;
+ }
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
IGESData_BasicEditor myEditor;
Standard_Integer myWriteMode;
Standard_Boolean myIsComputed;
- ParameterMap myShapeProcParams; //!< Parameters for shape processing.
- ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format off
+ XSAlgo_ShapeProcessor::ParameterMap myShapeProcParams; //!< Parameters for shape processing.
+ XSAlgo_ShapeProcessor::ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format on
};
#endif // _IGESControl_Writer_HeaderFile
// Set tolerances for shape processing.
// These parameters are calculated inside IGESToBRep_Actor::Transfer() and cannot be set from
// outside.
- Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetShapeFixParameters();
+ XSAlgo_ShapeProcessor::ParameterMap aParameters = GetShapeFixParameters();
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", theeps, true, aParameters);
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d",
CAS.GetMaxTol(),
//=============================================================================
-void IGESToBRep_Reader::SetShapeFixParameters(const ParameterMap& theParameters)
+void IGESToBRep_Reader::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
myShapeProcParams = theParameters;
}
//=============================================================================
-void IGESToBRep_Reader::SetShapeFixParameters(ParameterMap&& theParameters)
+void IGESToBRep_Reader::SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
myShapeProcParams = std::move(theParameters);
}
//=============================================================================
-void IGESToBRep_Reader::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+void IGESToBRep_Reader::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
- myShapeProcParams.clear();
- XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
- for (const auto& aParam : theAdditionalParameters)
- {
- if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
- {
- myShapeProcParams[aParam.first] = aParam.second;
- }
- }
+ XSAlgo_ShapeProcessor::SetShapeFixParameters(theParameters,
+ theAdditionalParameters,
+ myShapeProcParams);
}
//=============================================================================
void IGESToBRep_Reader::InitializeMissingParameters()
{
- if (GetShapeFixParameters().empty())
+ if (GetShapeFixParameters().IsEmpty())
{
SetShapeFixParameters(DEIGES_Parameters::GetDefaultShapeFixParameters());
}
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
#include <TopTools_SequenceOfShape.hxx>
-
-#include <unordered_map>
+#include <XSAlgo_ShapeProcessor.hxx>
struct DE_ShapeFixParameters;
class IGESData_IGESModel;
public:
DEFINE_STANDARD_ALLOC
- using ParameterMap = std::unordered_map<std::string, std::string>;
- // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
- // we use a pair. The first element is the flags, the second element is a boolean value that
- // indicates whether the flags were set.
- using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
-
public:
//! Creates a Reader
Standard_EXPORT IGESToBRep_Reader();
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- inline const ParameterMap& GetShapeFixParameters() const { return myShapeProcParams; }
+ inline const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const
+ {
+ return myShapeProcParams;
+ }
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
TopTools_SequenceOfShape theShapes;
Handle(IGESToBRep_Actor) theActor;
Handle(Transfer_TransientProcess) theProc;
- ParameterMap myShapeProcParams; //!< Parameters for shape processing.
- ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format off
+ XSAlgo_ShapeProcessor::ParameterMap myShapeProcParams; //!< Parameters for shape processing.
+ XSAlgo_ShapeProcessor::ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format on
};
#endif // _IGESToBRep_Reader_HeaderFile
//=============================================================================
-void STEPCAFControl_Reader::SetShapeFixParameters(const ParameterMap& theParameters)
+void STEPCAFControl_Reader::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
myReader.SetShapeFixParameters(theParameters);
}
//=============================================================================
-void STEPCAFControl_Reader::SetShapeFixParameters(ParameterMap&& theParameters)
+void STEPCAFControl_Reader::SetShapeFixParameters(
+ XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
myReader.SetShapeFixParameters(std::move(theParameters));
}
//=============================================================================
-void STEPCAFControl_Reader::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+void STEPCAFControl_Reader::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
myReader.SetShapeFixParameters(theParameters, theAdditionalParameters);
}
//=============================================================================
-const STEPCAFControl_Reader::ParameterMap& STEPCAFControl_Reader::GetShapeFixParameters() const
+const XSAlgo_ShapeProcessor::ParameterMap& STEPCAFControl_Reader::GetShapeFixParameters() const
{
return myReader.GetShapeFixParameters();
}
//=============================================================================
-const STEPCAFControl_Reader::ProcessingFlags& STEPCAFControl_Reader::GetShapeProcessFlags() const
+const XSAlgo_ShapeProcessor::ProcessingFlags& STEPCAFControl_Reader::GetShapeProcessFlags() const
{
return myReader.GetShapeProcessFlags();
}
public:
DEFINE_STANDARD_ALLOC
- using ParameterMap = XSControl_Reader::ParameterMap;
- using ProcessingFlags = XSControl_Reader::ProcessingFlags;
-
public:
//! Creates a reader with an empty
//! STEP model and sets ColorMode, LayerMode, NameMode and
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- Standard_EXPORT const ParameterMap& GetShapeFixParameters() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const;
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
//! Returns flags defining operations to be performed on shapes.
//! @return Pair of values defining operations to be performed on shapes and a boolean value
//! that indicates whether the flags were set.
- Standard_EXPORT const ProcessingFlags& GetShapeProcessFlags() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const;
protected:
//! Translates STEP file already loaded into the reader
//=============================================================================
-void STEPCAFControl_Writer::SetShapeFixParameters(const ParameterMap& theParameters)
+void STEPCAFControl_Writer::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
myWriter.SetShapeFixParameters(theParameters);
}
//=============================================================================
-void STEPCAFControl_Writer::SetShapeFixParameters(ParameterMap&& theParameters)
+void STEPCAFControl_Writer::SetShapeFixParameters(
+ XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
myWriter.SetShapeFixParameters(std::move(theParameters));
}
//=============================================================================
-void STEPCAFControl_Writer::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+void STEPCAFControl_Writer::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
myWriter.SetShapeFixParameters(theParameters, theAdditionalParameters);
}
//=============================================================================
-const STEPCAFControl_Writer::ParameterMap& STEPCAFControl_Writer::GetShapeFixParameters() const
+const XSAlgo_ShapeProcessor::ParameterMap& STEPCAFControl_Writer::GetShapeFixParameters() const
{
return myWriter.GetShapeFixParameters();
}
//=============================================================================
-const STEPCAFControl_Writer::ProcessingFlags& STEPCAFControl_Writer::GetShapeProcessFlags() const
+const XSAlgo_ShapeProcessor::ProcessingFlags& STEPCAFControl_Writer::GetShapeProcessFlags() const
{
return myWriter.GetShapeProcessFlags();
}
public:
DEFINE_STANDARD_ALLOC
- using ParameterMap = STEPControl_Writer::ParameterMap;
- using ProcessingFlags = STEPControl_Writer::ProcessingFlags;
-
public:
//! Creates a writer with an empty
//! STEP model and sets ColorMode, LayerMode, NameMode and
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- Standard_EXPORT const ParameterMap& GetShapeFixParameters() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const;
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
//! Returns flags defining operations to be performed on shapes.
//! @return Pair of values defining operations to be performed on shapes and a boolean value
//! that indicates whether the flags were set.
- Standard_EXPORT const ProcessingFlags& GetShapeProcessFlags() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const;
protected:
//! Transfers labels to a STEP model
// Set tolerances for shape processing.
// These parameters are calculated inside STEPControl_ActorRead::Transfer() and cannot be set
// from outside.
- Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetShapeFixParameters();
+ XSAlgo_ShapeProcessor::ParameterMap aParameters = GetShapeFixParameters();
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", myPrecision, true, aParameters);
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", myMaxTol, true, aParameters);
- XSAlgo_ShapeProcessor::SetParameter("FixShape.NonManifold",
- std::to_string(true),
- true,
- aParameters);
+ XSAlgo_ShapeProcessor::SetParameter("FixShape.NonManifold", "1", true, aParameters);
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
TopoDS_Shape fixedResult =
aShapeProcessor.ProcessShape(comp, GetProcessingFlags().first, aPS1.Next());
// Set tolerances for shape processing.
// These parameters are calculated inside STEPControl_ActorRead::Transfer() and cannot be set
// from outside.
- Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetShapeFixParameters();
+ XSAlgo_ShapeProcessor::ParameterMap aParameters = GetShapeFixParameters();
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", myPrecision, true, aParameters);
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", myMaxTol, true, aParameters);
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
{
TopoDS_Shape S = sb->Result();
- Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetShapeFixParameters();
+ XSAlgo_ShapeProcessor::ParameterMap aParameters = GetShapeFixParameters();
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", myPrecision, true, aParameters);
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", myMaxTol, true, aParameters);
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
TopoDS_Shape aShape = xShape;
- Transfer_ActorOfFinderProcess::ParameterMap aParameters = GetShapeFixParameters();
+ XSAlgo_ShapeProcessor::ParameterMap aParameters = GetShapeFixParameters();
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", Tol, true, aParameters);
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d",
aStepModel->InternalParameters.ReadMaxPrecisionVal,
//=============================================================================
-void STEPControl_Writer::SetShapeFixParameters(const ParameterMap& theParameters)
+void STEPControl_Writer::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
{
//=============================================================================
-void STEPControl_Writer::SetShapeFixParameters(ParameterMap&& theParameters)
+void STEPControl_Writer::SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
{
//=============================================================================
-void STEPControl_Writer::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+void STEPControl_Writer::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
{
//=============================================================================
-const STEPControl_Writer::ParameterMap& STEPControl_Writer::GetShapeFixParameters() const
+const XSAlgo_ShapeProcessor::ParameterMap& STEPControl_Writer::GetShapeFixParameters() const
{
- static const ParameterMap anEmptyMap;
- const Handle(Transfer_ActorOfFinderProcess) anActor = GetActor();
+ static const XSAlgo_ShapeProcessor::ParameterMap anEmptyMap;
+ const Handle(Transfer_ActorOfFinderProcess) anActor = GetActor();
return anActor.IsNull() ? anEmptyMap : anActor->GetShapeFixParameters();
}
//=============================================================================
-const STEPControl_Writer::ProcessingFlags& STEPControl_Writer::GetShapeProcessFlags() const
+const XSAlgo_ShapeProcessor::ProcessingFlags& STEPControl_Writer::GetShapeProcessFlags() const
{
- static const ProcessingFlags anEmptyFlags;
- const Handle(Transfer_ActorOfFinderProcess) anActor = GetActor();
+ static const XSAlgo_ShapeProcessor::ProcessingFlags anEmptyFlags;
+ const Handle(Transfer_ActorOfFinderProcess) anActor = GetActor();
return anActor.IsNull() ? anEmptyFlags : anActor->GetShapeProcessFlags();
}
void STEPControl_Writer::InitializeMissingParameters()
{
- if (GetShapeFixParameters().empty())
+ if (GetShapeFixParameters().IsEmpty())
{
SetShapeFixParameters(DESTEP_Parameters::GetDefaultShapeFixParameters());
}
#include <STEPControl_StepModelType.hxx>
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
+#include <XSAlgo_ShapeProcessor.hxx>
#include <unordered_map>
public:
DEFINE_STANDARD_ALLOC
- using ParameterMap = std::unordered_map<std::string, std::string>;
- // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
- // we use a pair. The first element is the flags, the second element is a boolean value that
- // indicates whether the flags were set.
- using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
-
//! Creates a Writer from scratch
Standard_EXPORT STEPControl_Writer();
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- Standard_EXPORT const ParameterMap& GetShapeFixParameters() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const;
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
//! Returns flags defining operations to be performed on shapes.
//! @return Pair of values defining operations to be performed on shapes and a boolean value
//! that indicates whether the flags were set.
- Standard_EXPORT const ProcessingFlags& GetShapeProcessFlags() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const;
private:
//! Returns the Actor for the Transfer of an Entity.
//=================================================================================================
-Standard_Boolean ShapeProcess::Perform(const Handle(ShapeProcess_Context)& theContext,
- const OperationsFlags& theOperations,
- const Message_ProgressRange& theProgress)
+Standard_Boolean ShapeProcess::Perform(const Handle(ShapeProcess_Context)& theContext,
+ const ShapeProcess::OperationsFlags& theOperations,
+ const Message_ProgressRange& theProgress)
{
if (!theContext)
{
//=================================================================================================
std::vector<std::pair<const char*, Handle(ShapeProcess_Operator)>> ShapeProcess::getOperators(
- const OperationsFlags& theFlags)
+ const ShapeProcess::OperationsFlags& theFlags)
{
std::vector<std::pair<const char*, Handle(ShapeProcess_Operator)>> aResult;
for (std::underlying_type<Operation>::type anOperation = Operation::First;
//=============================================================================
-void Transfer_ActorOfFinderProcess::SetShapeFixParameters(const ParameterMap& theParameters)
+void Transfer_ActorOfFinderProcess::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
myShapeProcParams = theParameters;
}
//=============================================================================
-void Transfer_ActorOfFinderProcess::SetShapeFixParameters(ParameterMap&& theParameters)
+void Transfer_ActorOfFinderProcess::SetShapeFixParameters(
+ XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
myShapeProcParams = std::move(theParameters);
}
//=============================================================================
void Transfer_ActorOfFinderProcess::SetShapeFixParameters(
- const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
- myShapeProcParams.clear();
- XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
- for (const auto& aParam : theAdditionalParameters)
- {
- if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
- {
- myShapeProcParams[aParam.first] = aParam.second;
- }
- }
+ XSAlgo_ShapeProcessor::SetShapeFixParameters(theParameters,
+ theAdditionalParameters,
+ myShapeProcParams);
}
//=============================================================================
#include <Standard.hxx>
#include <ShapeProcess.hxx>
#include <Transfer_ActorOfProcessForFinder.hxx>
-
-#include <unordered_map>
+#include <XSAlgo_ShapeProcessor.hxx>
struct DE_ShapeFixParameters;
class Transfer_Binder;
//! a user. To be interpreted for each norm
class Transfer_ActorOfFinderProcess : public Transfer_ActorOfProcessForFinder
{
-public:
- using ParameterMap = std::unordered_map<std::string, std::string>;
- // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
- // we use a pair. The first element is the flags, the second element is a boolean value that
- // indicates whether the flags were set.
- using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
-
public:
Standard_EXPORT Transfer_ActorOfFinderProcess();
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- inline const ParameterMap& GetShapeFixParameters() const { return myShapeProcParams; }
+ inline const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const
+ {
+ return myShapeProcParams;
+ }
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
//! Returns flags defining operations to be performed on shapes.
//! @return Pair of values defining operations to be performed on shapes and a boolean value
//! that indicates whether the flags were set.
- inline const ProcessingFlags& GetShapeProcessFlags() const { return myShapeProcFlags; }
+ inline const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const
+ {
+ return myShapeProcFlags;
+ }
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess, Transfer_ActorOfProcessForFinder)
Standard_Integer themodetrans;
private:
- ParameterMap myShapeProcParams; //!< Parameters for shape processing.
- ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format off
+ XSAlgo_ShapeProcessor::ParameterMap myShapeProcParams; //!< Parameters for shape processing.
+ XSAlgo_ShapeProcessor::ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format on
};
#endif // _Transfer_ActorOfFinderProcess_HeaderFile
//=============================================================================
-void Transfer_ActorOfTransientProcess::SetShapeFixParameters(const ParameterMap& theParameters)
+void Transfer_ActorOfTransientProcess::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
myShapeProcParams = theParameters;
}
//=============================================================================
-void Transfer_ActorOfTransientProcess::SetShapeFixParameters(ParameterMap&& theParameters)
+void Transfer_ActorOfTransientProcess::SetShapeFixParameters(
+ XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
myShapeProcParams = std::move(theParameters);
}
//=============================================================================
void Transfer_ActorOfTransientProcess::SetShapeFixParameters(
- const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
- myShapeProcParams.clear();
- XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
- for (const auto& aParam : theAdditionalParameters)
- {
- if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
- {
- myShapeProcParams[aParam.first] = aParam.second;
- }
- }
+ XSAlgo_ShapeProcessor::SetShapeFixParameters(theParameters,
+ theAdditionalParameters,
+ myShapeProcParams);
}
//=============================================================================
#include <ShapeProcess.hxx>
#include <Standard.hxx>
#include <Transfer_ActorOfProcessForTransient.hxx>
-
-#include <unordered_map>
+#include <XSAlgo_ShapeProcessor.hxx>
struct DE_ShapeFixParameters;
class Transfer_Binder;
//! The original class was renamed. Compatibility only
class Transfer_ActorOfTransientProcess : public Transfer_ActorOfProcessForTransient
{
-public:
- using ParameterMap = std::unordered_map<std::string, std::string>;
- // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
- // we use a pair. The first element is the flags, the second element is a boolean value that
- // indicates whether the flags were set.
- using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
-
public:
Standard_EXPORT Transfer_ActorOfTransientProcess();
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- inline const ParameterMap& GetShapeFixParameters() const { return myShapeProcParams; }
+ inline const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const
+ {
+ return myShapeProcParams;
+ }
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
//! @return Pair: the flags defining operations to be performed on shapes and a boolean value that
//! indicates
//! whether the flags were set.
- inline const ProcessingFlags& GetProcessingFlags() const { return myShapeProcFlags; }
+ inline const XSAlgo_ShapeProcessor::ProcessingFlags& GetProcessingFlags() const
+ {
+ return myShapeProcFlags;
+ }
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess, Transfer_ActorOfProcessForTransient)
private:
- ParameterMap myShapeProcParams; //!< Parameters for shape processing.
- ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format off
+ XSAlgo_ShapeProcessor::ParameterMap myShapeProcParams; //!< Parameters for shape processing.
+ XSAlgo_ShapeProcessor::ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
+ // clang-format on
};
#endif // _Transfer_ActorOfTransientProcess_HeaderFile
#include <sstream>
#include <unordered_set>
-namespace
-{
-//! Function to split a string based on multiple delimiters.
-//! @param aString String to split.
-//! @param delimiters Set of delimiters.
-//! @return Vector of tokens.
-std::vector<std::string> splitString(const std::string& aString,
- const std::unordered_set<char>& delimiters)
-{
- std::vector<std::string> aResult;
- std::string aCurrentToken;
-
- for (char aCurrentCharacter : aString)
- {
- if (delimiters.find(aCurrentCharacter) != delimiters.end())
- {
- if (!aCurrentToken.empty())
- {
- aResult.emplace_back(std::move(aCurrentToken));
- aCurrentToken.clear();
- }
- }
- else
- {
- aCurrentToken += aCurrentCharacter;
- }
- }
-
- if (!aCurrentToken.empty())
- {
- aResult.emplace_back(std::move(aCurrentToken));
- }
-
- return aResult;
-}
-} // namespace
-
//=============================================================================
-XSAlgo_ShapeProcessor::XSAlgo_ShapeProcessor(const ParameterMap& theParameters,
- const DE_ShapeFixParameters& theShapeFixParameters)
+XSAlgo_ShapeProcessor::XSAlgo_ShapeProcessor(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters,
+ const DE_ShapeFixParameters& theShapeFixParameters)
: myParameters(theParameters)
{
FillParameterMap(theShapeFixParameters, false, myParameters);
XSAlgo_ShapeProcessor::XSAlgo_ShapeProcessor(const DE_ShapeFixParameters& theParameters)
{
- ParameterMap aMap;
+ XSAlgo_ShapeProcessor::ParameterMap aMap;
FillParameterMap(theParameters, false, aMap);
myParameters = aMap;
}
//=============================================================================
-TopoDS_Shape XSAlgo_ShapeProcessor::ProcessShape(const TopoDS_Shape& theShape,
- const OperationsFlags& theOperations,
- const Message_ProgressRange& theProgress)
+TopoDS_Shape XSAlgo_ShapeProcessor::ProcessShape(const TopoDS_Shape& theShape,
+ const ShapeProcess::OperationsFlags& theOperations,
+ const Message_ProgressRange& theProgress)
{
if (theShape.IsNull())
{
void XSAlgo_ShapeProcessor::initializeContext(const TopoDS_Shape& theShape)
{
myContext = new ShapeProcess_ShapeContext(theShape, nullptr);
- for (const auto& aParameter : myParameters)
+ for (XSAlgo_ShapeProcessor::ParameterMap::Iterator aParameterIter(myParameters);
+ aParameterIter.More();
+ aParameterIter.Next())
{
- myContext->ResourceManager()->SetResource(aParameter.first.c_str(), aParameter.second.c_str());
+ myContext->ResourceManager()->SetResource(aParameterIter.Key().ToCString(),
+ aParameterIter.Value().ToCString());
}
// Read and set detalization level.
- auto aDetalizationLevelPtr = myParameters.find("DetalizationLevel");
- if (aDetalizationLevelPtr != myParameters.end())
+ TCollection_AsciiString aResult;
+ if (myParameters.Find("DetalizationLevel", aResult) && aResult.IsIntegerValue())
{
const TopAbs_ShapeEnum aDetalizationLevel =
- static_cast<TopAbs_ShapeEnum>(std::stoi(aDetalizationLevelPtr->second.c_str()));
+ static_cast<TopAbs_ShapeEnum>(aResult.IntegerValue());
myContext->SetDetalisation(aDetalizationLevel);
}
// Read and set non-manifold flag.
- auto aNonManifoldPtr = myParameters.find("NonManifold");
- if (aNonManifoldPtr != myParameters.end())
+ if (myParameters.Find("NonManifold", aResult) && aResult.IsIntegerValue())
{
- const Standard_Boolean aNonManifold =
- static_cast<Standard_Boolean>(std::stoi(aNonManifoldPtr->second.c_str()));
+ const Standard_Boolean aNonManifold = static_cast<Standard_Boolean>(aResult.IntegerValue());
myContext->SetNonManifold(aNonManifold);
}
}
//=============================================================================
XSAlgo_ShapeProcessor::ProcessingData XSAlgo_ShapeProcessor::ReadProcessingData(
- const std::string& theFileResourceName,
- const std::string& theScopeResourceName)
+ const TCollection_AsciiString& theFileResourceName,
+ const TCollection_AsciiString& theScopeResourceName)
{
- const Standard_CString aFileName = Interface_Static::CVal(theFileResourceName.c_str());
+ const Standard_CString aFileName = Interface_Static::CVal(theFileResourceName.ToCString());
Handle(ShapeProcess_ShapeContext) aContext =
new ShapeProcess_ShapeContext(TopoDS_Shape(), aFileName);
if (!aContext->ResourceManager()->IsInitialized())
// If resource file wasn't found, use static values instead
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
}
- const std::string aScope = Interface_Static::CVal(theScopeResourceName.c_str());
+ const TCollection_AsciiString aScope = Interface_Static::CVal(theScopeResourceName.ToCString());
// Copy parameters to the result.
- ParameterMap aResultParameters;
- OperationsFlags aResultFlags;
+ XSAlgo_ShapeProcessor::ParameterMap aResultParameters;
+ ShapeProcess::OperationsFlags aResultFlags;
const Resource_DataMapOfAsciiStringAsciiString& aMap = aContext->ResourceManager()->GetMap();
- using RMapIter = Resource_DataMapOfAsciiStringAsciiString::Iterator;
- for (RMapIter anIter(aMap); anIter.More(); anIter.Next())
+
+ for (Resource_DataMapOfAsciiStringAsciiString::Iterator anIter(aMap); anIter.More();
+ anIter.Next())
{
- std::string aKey = anIter.Key().ToCString();
- const size_t aScopePosition = aKey.find(aScope);
- if (aScopePosition != 0)
+ TCollection_AsciiString aKey = anIter.Key();
+ if (!aKey.StartsWith(aScope))
{
// Ignore all parameters that don't start with the specified scope.
continue;
}
- // Remove the scope from the key + 1 for the dot.
+
+ // Remove scope prefix and dot
// "FromIGES.FixShape.FixFreeFaceMode" -> "FixShape.FixFreeFaceMode"
- aKey.erase(0, aScope.size() + 1);
- if (aKey != "exec.op")
- {
- // If it is not an operation flag, add it to the parameters.
- aResultParameters[aKey] = anIter.Value().ToCString();
- }
- else
+ aKey = aKey.SubString(aScope.Length() + 2, aKey.Length());
+
+ if (aKey.IsEqual("exec.op"))
{
- // Parse operations flags.
- const std::vector<std::string> anOperationStrings =
- splitString(anIter.Value().ToCString(), {' ', '\t', ',', ';'});
- for (const auto& anOperationString : anOperationStrings)
+ // Parse operation flags using Token method
+ Standard_Integer aTokenCount = 1;
+ TCollection_AsciiString aToken;
+ const TCollection_AsciiString aSeparators(" \t,;");
+
+ while (!(aToken = anIter.Value().Token(aSeparators.ToCString(), aTokenCount)).IsEmpty())
{
- std::pair<ShapeProcess::Operation, bool> anOperationFlag =
- ShapeProcess::ToOperationFlag(anOperationString.c_str());
+ std::pair<ShapeProcess::Operation, Standard_Boolean> anOperationFlag =
+ ShapeProcess::ToOperationFlag(aToken.ToCString());
if (anOperationFlag.second)
{
aResultFlags.set(anOperationFlag.first);
}
+ aTokenCount++;
}
}
+ else
+ {
+ aResultParameters.Bind(aKey, anIter.Value());
+ }
}
return {aResultParameters, aResultFlags};
}
SetParameter("FixShape.MaxTolerance3d", theParameters.MaxTolerance3d, theIsReplace, theMap);
SetParameter("FixShape.MinTolerance3d", theParameters.MinTolerance3d, theIsReplace, theMap);
SetParameter("DetalizationLevel",
- std::to_string(theParameters.DetalizationLevel),
+ TCollection_AsciiString(static_cast<int>(theParameters.DetalizationLevel)),
+ theIsReplace,
+ theMap);
+ SetParameter("NonManifold",
+ TCollection_AsciiString(static_cast<int>(theParameters.NonManifold)),
theIsReplace,
theMap);
- SetParameter("NonManifold", std::to_string(theParameters.NonManifold), theIsReplace, theMap);
SetParameter("FixShape.FixFreeShellMode", theParameters.FixFreeShellMode, theIsReplace, theMap);
SetParameter("FixShape.FixFreeFaceMode", theParameters.FixFreeFaceMode, theIsReplace, theMap);
SetParameter("FixShape.FixFreeWireMode", theParameters.FixFreeWireMode, theIsReplace, theMap);
//=============================================================================
-void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
- DE_ShapeFixParameters::FixMode theValue,
- const bool theIsReplace,
- ParameterMap& theMap)
+void XSAlgo_ShapeProcessor::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters,
+ XSAlgo_ShapeProcessor::ParameterMap& theTargetParameterMap)
{
- SetParameter(theKey,
- std::to_string(
- static_cast<std::underlying_type<DE_ShapeFixParameters::FixMode>::type>(theValue)),
- theIsReplace,
- theMap);
+ theTargetParameterMap.Clear();
+ XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, theTargetParameterMap);
+ for (XSAlgo_ShapeProcessor::ParameterMap::Iterator aParamIter(theAdditionalParameters);
+ aParamIter.More();
+ aParamIter.Next())
+ {
+ if (!theTargetParameterMap.IsBound(aParamIter.Key()))
+ {
+ theTargetParameterMap.Bind(aParamIter.Key(), aParamIter.Value());
+ }
+ }
}
//=============================================================================
-void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
- double theValue,
- const bool theIsReplace,
- ParameterMap& theMap)
+void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
+ const DE_ShapeFixParameters::FixMode theValue,
+ const bool theIsReplace,
+ XSAlgo_ShapeProcessor::ParameterMap& theMap)
{
- // Note that conversion with std::to_string() here is not possible, since it normally preserves
- // only first 6 digits (before C++26). As a result, any value of 1e-7 or below will turn into 0.
- // By using std::ostringstream with std::setprecision(6) formatting we will preserve first 6
- // SIGNIFICANT digits.
- std::ostringstream aStrStream;
- aStrStream << std::setprecision(6) << theValue;
- SetParameter(theKey, aStrStream.str(), theIsReplace, theMap);
+ SetParameter(
+ theKey,
+ TCollection_AsciiString(static_cast<int>(
+ static_cast<std::underlying_type<DE_ShapeFixParameters::FixMode>::type>(theValue))),
+ theIsReplace,
+ theMap);
}
//=============================================================================
-void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
- std::string&& theValue,
- const bool theIsReplace,
- ParameterMap& theMap)
+void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
+ const double theValue,
+ const bool theIsReplace,
+ XSAlgo_ShapeProcessor::ParameterMap& theMap)
+{
+ SetParameter(theKey, TCollection_AsciiString(theValue), theIsReplace, theMap);
+}
+
+//=============================================================================
+
+void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
+ const TCollection_AsciiString& theValue,
+ const bool theIsReplace,
+ XSAlgo_ShapeProcessor::ParameterMap& theMap)
{
if (theIsReplace)
{
- theMap[theKey] = std::move(theValue);
+ theMap.Bind(theKey, theValue);
}
else
{
- theMap.emplace(theKey, std::move(theValue));
+ if (!theMap.IsBound(theKey))
+ {
+ theMap.Bind(theKey, theValue);
+ }
}
}
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <unordered_map>
-
class ShapeProcess_ShapeContext;
class ShapeExtend_MsgRegistrator;
class Transfer_TransientProcess;
class XSAlgo_ShapeProcessor
{
public:
- using OperationsFlags = ShapeProcess::OperationsFlags;
- using ParameterMap = std::unordered_map<std::string, std::string>;
- using ProcessingData = std::pair<ParameterMap, OperationsFlags>;
+ using ParameterMap = NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>;
+ using ProcessingData = std::pair<ParameterMap, ShapeProcess::OperationsFlags>;
+ // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
+ // we use a pair. The first element is the flags, the second element is a boolean value that
+ // indicates whether the flags were set.
+ using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
public:
//! Constructor.
//! @param theOperations Operations to be performed.
//! @param theProgress Progress indicator.
//! @return Processed shape. May be the same as the input shape if no modifications were made.
- Standard_EXPORT TopoDS_Shape ProcessShape(const TopoDS_Shape& theShape,
- const OperationsFlags& theOperations,
- const Message_ProgressRange& theProgress);
+ Standard_EXPORT TopoDS_Shape ProcessShape(const TopoDS_Shape& theShape,
+ const ShapeProcess::OperationsFlags& theOperations,
+ const Message_ProgressRange& theProgress);
//! Get the context of the last processing.
//! Only valid after the ProcessShape() method was called.
//! of the scope. For example, parameter "read.iges.sequence" may contain string
//! "FromIGES".
//! @return Read parameter map.
- Standard_EXPORT static ProcessingData ReadProcessingData(const std::string& theFileResourceName,
- const std::string& theScopeResourceName);
+ Standard_EXPORT static ProcessingData ReadProcessingData(
+ const TCollection_AsciiString& theFileResourceName,
+ const TCollection_AsciiString& theScopeResourceName);
//! Fill the parameter map with the values from the specified parameters.
//! @param theParameters Parameters to be used in the processing.
const bool theIsReplace,
ParameterMap& theMap);
+ //! Sets parameters for shape processing.
+ //! Parameters from @p theParameters are copied to the output map.
+ //! Parameters from @p theAdditionalParameters are copied to the output map
+ //! if they are not present in @p theParameters.
+ //! @param theParameters the parameters for shape processing.
+ //! @param theAdditionalParameters the additional parameters for shape processing.
+ //! @param theTargetParameterMap Map to set the parameters in.
+ Standard_EXPORT static void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
+ const ParameterMap& theAdditionalParameters,
+ ParameterMap& theTargetParameterMap);
+
//! Set the parameter in the map.
//! @param theKey Key of the parameter.
//! @param theValue Value of the parameter.
//! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists
//! in the map.
//! @param theMap Map to set the parameter in.
- Standard_EXPORT static void SetParameter(const char* theKey,
- DE_ShapeFixParameters::FixMode theValue,
- const bool theIsReplace,
- ParameterMap& theMap);
+ Standard_EXPORT static void SetParameter(const char* theKey,
+ const DE_ShapeFixParameters::FixMode theValue,
+ const bool theIsReplace,
+ XSAlgo_ShapeProcessor::ParameterMap& theMap);
//! Set the parameter in the map.
//! @param theKey Key of the parameter.
//! in the map.
//! @param theMap Map to set the parameter in.
Standard_EXPORT static void SetParameter(const char* theKey,
- double theValue,
+ const double theValue,
const bool theIsReplace,
ParameterMap& theMap);
//! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists
//! in the map.
//! @param theMap Map to set the parameter in.
- Standard_EXPORT static void SetParameter(const char* theKey,
- std::string&& theValue,
- const bool theIsReplace,
- ParameterMap& theMap);
+ Standard_EXPORT static void SetParameter(const char* theKey,
+ const TCollection_AsciiString& theValue,
+ const bool theIsReplace,
+ ParameterMap& theMap);
//! The function is designed to set the length unit for the application before performing a
//! transfer operation. It ensures that the length unit is correctly configured based on the
//=============================================================================
-void XSControl_Reader::SetShapeFixParameters(const ParameterMap& theParameters)
+void XSControl_Reader::SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
{
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
{
//=============================================================================
-void XSControl_Reader::SetShapeFixParameters(ParameterMap&& theParameters)
+void XSControl_Reader::SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
{
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
{
//=============================================================================
-void XSControl_Reader::SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters)
+void XSControl_Reader::SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters)
{
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
{
//=============================================================================
-const XSControl_Reader::ParameterMap& XSControl_Reader::GetShapeFixParameters() const
+const XSAlgo_ShapeProcessor::ParameterMap& XSControl_Reader::GetShapeFixParameters() const
{
- static const ParameterMap anEmptyMap;
- const Handle(Transfer_ActorOfTransientProcess) anActor = GetActor();
+ static const XSAlgo_ShapeProcessor::ParameterMap anEmptyMap;
+ const Handle(Transfer_ActorOfTransientProcess) anActor = GetActor();
return anActor.IsNull() ? anEmptyMap : anActor->GetShapeFixParameters();
}
//=============================================================================
-const XSControl_Reader::ProcessingFlags& XSControl_Reader::GetShapeProcessFlags() const
+const XSAlgo_ShapeProcessor::ProcessingFlags& XSControl_Reader::GetShapeProcessFlags() const
{
- static const ProcessingFlags anEmptyFlags;
- const Handle(Transfer_ActorOfTransientProcess) anActor = GetActor();
+ static const XSAlgo_ShapeProcessor::ProcessingFlags anEmptyFlags;
+ const Handle(Transfer_ActorOfTransientProcess) anActor = GetActor();
return anActor.IsNull() ? anEmptyFlags : anActor->GetProcessingFlags();
}
void XSControl_Reader::InitializeMissingParameters()
{
- if (GetShapeFixParameters().empty())
+ if (GetShapeFixParameters().IsEmpty())
{
SetShapeFixParameters(GetDefaultShapeFixParameters());
}
#include <Standard_Integer.hxx>
#include <IFSelect_PrintCount.hxx>
#include <Message_ProgressRange.hxx>
-
-#include <unordered_map>
+#include <XSAlgo_ShapeProcessor.hxx>
class XSControl_WorkSession;
class Interface_InterfaceModel;
public:
DEFINE_STANDARD_ALLOC
- using ParameterMap = std::unordered_map<std::string, std::string>;
- // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
- // we use a pair. The first element is the flags, the second element is a boolean value that
- // indicates whether the flags were set.
- using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
-
//! Creates a Reader from scratch (creates an empty WorkSession)
//! A WorkSession or a Controller must be provided before running
Standard_EXPORT XSControl_Reader();
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const ParameterMap& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(
+ const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
//! Sets parameters for shape processing.
//! Parameters are moved from the input map.
//! @param theParameters the parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(ParameterMap&& theParameters);
+ Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
//! Sets parameters for shape processing.
//! Parameters from @p theParameters are copied to the internal map.
//! if they are not present in @p theParameters.
//! @param theParameters the parameters for shape processing.
//! @param theAdditionalParameters the additional parameters for shape processing.
- Standard_EXPORT void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters,
- const ParameterMap& theAdditionalParameters = {});
+ Standard_EXPORT void SetShapeFixParameters(
+ const DE_ShapeFixParameters& theParameters,
+ const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
//! Returns parameters for shape processing that was set by SetParameters() method.
//! @return the parameters for shape processing. Empty map if no parameters were set.
- Standard_EXPORT const ParameterMap& GetShapeFixParameters() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const;
//! Sets flags defining operations to be performed on shapes.
//! @param theFlags The flags defining operations to be performed on shapes.
//! Returns flags defining operations to be performed on shapes.
//! @return Pair of values defining operations to be performed on shapes and a boolean value
//! that indicates whether the flags were set.
- Standard_EXPORT const ProcessingFlags& GetShapeProcessFlags() const;
+ Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const;
protected:
//! Returns a sequence of produced shapes
provider.IGES.OCC.healing.intersecting.wires : -1
provider.IGES.OCC.healing.loop.wires : -1
provider.IGES.OCC.healing.split.face : -1
-provider.IGES.OCC.healing.auto.correct.precision : -1
+provider.IGES.OCC.healing.auto.correct.precision : 1
provider.IGES.OCC.healing.modify.topology : 0
provider.IGES.OCC.healing.modify.geometry : 1
provider.IGES.OCC.healing.closed.wire : 1
provider.STEP.OCC.healing.intersecting.wires : -1
provider.STEP.OCC.healing.loop.wires : -1
provider.STEP.OCC.healing.split.face : -1
-provider.STEP.OCC.healing.auto.correct.precision : -1
+provider.STEP.OCC.healing.auto.correct.precision : 1
provider.STEP.OCC.healing.modify.topology : 0
provider.STEP.OCC.healing.modify.geometry : 1
provider.STEP.OCC.healing.closed.wire : 1
provider.IGES.OCC.healing.intersecting.wires : -1
provider.IGES.OCC.healing.loop.wires : -1
provider.IGES.OCC.healing.split.face : -1
-provider.IGES.OCC.healing.auto.correct.precision : -1
+provider.IGES.OCC.healing.auto.correct.precision : 1
provider.IGES.OCC.healing.modify.topology : 0
provider.IGES.OCC.healing.modify.geometry : 1
provider.IGES.OCC.healing.closed.wire : 1
provider.STEP.OCC.healing.intersecting.wires : -1
provider.STEP.OCC.healing.loop.wires : -1
provider.STEP.OCC.healing.split.face : -1
-provider.STEP.OCC.healing.auto.correct.precision : -1
+provider.STEP.OCC.healing.auto.correct.precision : 1
provider.STEP.OCC.healing.modify.topology : 0
provider.STEP.OCC.healing.modify.geometry : 1
provider.STEP.OCC.healing.closed.wire : 1