mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Coding - Refactor ShapeHealingMap to NCollection #346
Update container type to OCCT to avoid allocation on creating. Refactor shape processing parameter handling to use XSAlgo_ShapeProcessor for consistency.
This commit is contained in:
@@ -1000,13 +1000,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
// 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());
|
||||
@@ -1698,7 +1695,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
// 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);
|
||||
@@ -1885,7 +1882,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
{
|
||||
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);
|
||||
|
@@ -1045,7 +1045,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape(
|
||||
|
||||
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,
|
||||
|
@@ -199,7 +199,8 @@ void STEPControl_Writer::PrintStatsTransfer(const Standard_Integer what,
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::SetShapeFixParameters(const ParameterMap& theParameters)
|
||||
void STEPControl_Writer::SetShapeFixParameters(
|
||||
const XSAlgo_ShapeProcessor::ParameterMap& theParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
|
||||
{
|
||||
@@ -209,7 +210,7 @@ void STEPControl_Writer::SetShapeFixParameters(const ParameterMap& theParameters
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::SetShapeFixParameters(ParameterMap&& theParameters)
|
||||
void STEPControl_Writer::SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
|
||||
{
|
||||
@@ -219,8 +220,9 @@ void STEPControl_Writer::SetShapeFixParameters(ParameterMap&& theParameters)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -230,10 +232,10 @@ void STEPControl_Writer::SetShapeFixParameters(const DE_ShapeFixParameters& theP
|
||||
|
||||
//=============================================================================
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -249,10 +251,10 @@ void STEPControl_Writer::SetShapeProcessFlags(const ShapeProcess::OperationsFlag
|
||||
|
||||
//=============================================================================
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -279,7 +281,7 @@ Handle(Transfer_ActorOfFinderProcess) STEPControl_Writer::GetActor() const
|
||||
|
||||
void STEPControl_Writer::InitializeMissingParameters()
|
||||
{
|
||||
if (GetShapeFixParameters().empty())
|
||||
if (GetShapeFixParameters().IsEmpty())
|
||||
{
|
||||
SetShapeFixParameters(DESTEP_Parameters::GetDefaultShapeFixParameters());
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <STEPControl_StepModelType.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -46,12 +47,6 @@ class STEPControl_Writer
|
||||
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();
|
||||
|
||||
@@ -138,12 +133,13 @@ public:
|
||||
|
||||
//! 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.
|
||||
@@ -151,12 +147,13 @@ public:
|
||||
//! 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.
|
||||
@@ -165,7 +162,7 @@ public:
|
||||
//! 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.
|
||||
|
Reference in New Issue
Block a user