mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Data Exchange - Update Readers with ShapeHealing parameters #247
All instances of using XSAlgo_AlgoContainer are replaced with XSAlgo_ShapeProcessor. Parameters for XSAlgo_ShapeProcessor operations are now can be passes via the updated interface of respective classes. Staqtic function to read processing parameters from file is added to XSAlgo_ShapeProcessor.
This commit is contained in:
committed by
Pasukhin Dmitry
parent
bb84ecf5c6
commit
f5a02d2b0c
@@ -216,7 +216,7 @@
|
||||
#include <XCAFDimTolObjects_DatumObject.hxx>
|
||||
#include <XCAFView_Object.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
@@ -568,7 +568,7 @@ void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theMo
|
||||
Standard_Real aScaleFactorMM = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
aScaleFactorMM = UnitsMethods::GetCasCadeLengthUnit();
|
||||
// Sets length unit to the document
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter);
|
||||
@@ -2368,7 +2368,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
// calculate units
|
||||
Handle(StepVisual_DraughtingModel) aDModel =
|
||||
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aTP->Model());
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
|
||||
@@ -2477,7 +2477,7 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
||||
}
|
||||
if (!aSDR.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(theTR->Model());
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aSDR, aTP, aLocalFactors);
|
||||
@@ -2915,7 +2915,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
{
|
||||
Handle(StepGeom_Axis2Placement3d) anAx
|
||||
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aTP->Model());
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aSRWP, aTP, aLocalFactors);
|
||||
@@ -4455,7 +4455,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
if (!aDMIA.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aModel);
|
||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP, aLocalFactors);
|
||||
@@ -4811,7 +4811,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
if (!aDModel.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aTP->Model());
|
||||
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
|
||||
}
|
||||
@@ -5368,6 +5368,49 @@ Standard_Boolean STEPCAFControl_Reader::GetViewMode() const
|
||||
return myViewMode;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myReader.SetParameters(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myReader.SetParameters(std::move(theParameters));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myReader.SetParameters(theParameters, theAdditionalParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Reader::ParameterMap& STEPCAFControl_Reader::GetParameters() const
|
||||
{
|
||||
return myReader.GetParameters();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
return myReader.SetShapeProcessFlags(theFlags);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Reader::ProcessingFlags& STEPCAFControl_Reader::GetShapeProcessFlags() const
|
||||
{
|
||||
return myReader.GetShapeProcessFlags();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadMetadata
|
||||
//purpose :
|
||||
|
@@ -59,10 +59,12 @@ class Transfer_Binder;
|
||||
class STEPCAFControl_Reader
|
||||
{
|
||||
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
|
||||
//! PropsMode to Standard_True.
|
||||
@@ -209,9 +211,38 @@ public:
|
||||
|
||||
const XCAFDoc_DataMapOfShapeLabel& GetShapeLabelMap() const { return myMap; }
|
||||
|
||||
protected:
|
||||
//! Sets parameters for shape processing.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(const ParameterMap& theParameters);
|
||||
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! Parameters are moved from the input map.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(ParameterMap&& theParameters);
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! Parameters from @p theParameters are copied to the internal map.
|
||||
//! Parameters from @p theAdditionalParameters 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 SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const 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& GetParameters() const;
|
||||
|
||||
//! Sets flags defining operations to be performed on shapes.
|
||||
//! @param theFlags The flags defining operations to be performed on shapes.
|
||||
Standard_EXPORT void SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags);
|
||||
|
||||
//! 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;
|
||||
|
||||
protected:
|
||||
//! Translates STEP file already loaded into the reader
|
||||
//! into the document
|
||||
//! If num==0, translates all roots, else only root number num
|
||||
@@ -319,7 +350,6 @@ protected:
|
||||
Standard_EXPORT virtual TCollection_ExtendedString convertName (const TCollection_AsciiString& theName) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Internal method. Import all Datum attributes and set them to XCAF object. Set connection of Datum to GeomTolerance (theGDTL).
|
||||
Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
const TDF_Label theGDTL,
|
||||
@@ -361,7 +391,6 @@ private:
|
||||
Handle(TDataStd_NamedData)& theAttr) const;
|
||||
|
||||
private:
|
||||
|
||||
STEPControl_Reader myReader;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
|
||||
XCAFDoc_DataMapOfShapeLabel myMap;
|
||||
@@ -375,7 +404,6 @@ private:
|
||||
Standard_Boolean myMatMode;
|
||||
Standard_Boolean myViewMode;
|
||||
NCollection_DataMap<Handle(Standard_Transient), TDF_Label> myGDTMap;
|
||||
|
||||
};
|
||||
|
||||
#endif // _STEPCAFControl_Reader_HeaderFile
|
||||
|
@@ -212,7 +212,7 @@
|
||||
#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
|
||||
#include <XCAFPrs_Style.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferWriter.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
@@ -361,7 +361,7 @@ void STEPCAFControl_Writer::prepareUnit(const TDF_Label& theLabel,
|
||||
}
|
||||
else
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
theModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
theLocalFactors.SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
@@ -563,6 +563,49 @@ Standard_Boolean STEPCAFControl_Writer::ExternFile(const Standard_CString theNam
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myWriter.SetParameters(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myWriter.SetParameters(std::move(theParameters));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myWriter.SetParameters(theParameters, theAdditionalParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Writer::ParameterMap& STEPCAFControl_Writer::GetParameters() const
|
||||
{
|
||||
return myWriter.GetParameters();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
myWriter.SetShapeProcessFlags(theFlags);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Writer::ProcessingFlags& STEPCAFControl_Writer::GetShapeProcessFlags() const
|
||||
{
|
||||
return myWriter.GetShapeProcessFlags();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer
|
||||
//purpose :
|
||||
|
@@ -52,8 +52,10 @@ class STEPCAFControl_Writer
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
public:
|
||||
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
|
||||
//! PropsMode to Standard_True.
|
||||
@@ -212,8 +214,38 @@ public:
|
||||
|
||||
Standard_Boolean GetMaterialMode() const { return myMatMode; }
|
||||
|
||||
protected:
|
||||
//! Sets parameters for shape processing.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(const ParameterMap& theParameters);
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! Parameters are moved from the input map.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(ParameterMap&& theParameters);
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! Parameters from @p theParameters are copied to the internal map.
|
||||
//! Parameters from @p theAdditionalParameters 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 SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const 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& GetParameters() const;
|
||||
|
||||
//! Sets flags defining operations to be performed on shapes.
|
||||
//! @param theFlags The flags defining operations to be performed on shapes.
|
||||
Standard_EXPORT void SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags);
|
||||
|
||||
//! 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;
|
||||
|
||||
protected:
|
||||
//! Transfers labels to a STEP model
|
||||
//! Returns True if translation is OK
|
||||
//! isExternFile setting from transferExternFiles method
|
||||
|
Reference in New Issue
Block a user