1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-20 11:54:07 +03:00

Fixing remarks

This commit is contained in:
dkulikov 2025-04-03 09:57:36 +01:00
parent d39110dda6
commit 709412d78a
41 changed files with 465 additions and 573 deletions

View File

@ -2,14 +2,13 @@
set(OCCT_TKDESTEP_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKDESTEP_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDESTEP_GTests_FILES set(OCCT_TKDESTEP_GTests_FILES
MergeSTEPEntities_Axis2Placement3dProcessor_Test.cxx StepTidy_BaseTestFixture.pxx
MergeSTEPEntities_BaseTestFixture.hxx StepTidy_Axis2Placement3dReducer_Test.cxx
MergeSTEPEntities_CartesianPointProcessor_Test.cxx StepTidy_CartesianPointReducer_Test.cxx
MergeSTEPEntities_CircleProcessor_Test.cxx StepTidy_CircleReducer_Test.cxx
MergeSTEPEntities_DirectionProcessor_Test.cxx StepTidy_DirectionReducer_Test.cxx
MergeSTEPEntities_LineProcessor_Test.cxx StepTidy_LineReducer_Test.cxx
MergeSTEPEntities_PlaneProcessor_Test.cxx StepTidy_PlaneReducer_Test.cxx
MergeSTEPEntities_Merger_Test.cxx StepTidy_Merger_Test.cxx
StepTidy_VectorReducer_Test.cxx
MergeSTEPEntities_VectorProcessor_Test.cxx
) )

View File

@ -11,9 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_Axis2Placement3dProcessor.hxx> #include <StepTidy_Axis2Placement3dReducer.pxx>
#include <StepGeom_Plane.hxx> #include <StepGeom_Plane.hxx>
#include <StepRepr_ItemDefinedTransformation.hxx> #include <StepRepr_ItemDefinedTransformation.hxx>
@ -30,26 +30,26 @@
#include <StepShape_AdvancedBrepShapeRepresentation.hxx> #include <StepShape_AdvancedBrepShapeRepresentation.hxx>
#include <StepGeom_SphericalSurface.hxx> #include <StepGeom_SphericalSurface.hxx>
class MergeSTEPEntities_Axis2Placement3dProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_Axis2Placement3dReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
//! Perform removal of duplicate entities. //! Perform removal of duplicate entities.
TColStd_MapOfTransient replaceDuplicateAxis2Placement3ds() TColStd_MapOfTransient replaceDuplicateAxis2Placement3ds()
{ {
MergeSTEPEntities_Axis2Placement3dProcessor aProcessor(myWS); StepTidy_Axis2Placement3dReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that Axis2Placement3ds with the same coordinates and different names are not merged. // Check that Axis2Placement3ds with the same coordinates and different names are not merged.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, DifferentNames) TEST_F(StepTidy_Axis2Placement3dReducerTest, DifferentNames)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d("Axis1"); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d("Axis1");
@ -73,7 +73,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, DifferentNames)
} }
// Check that equal Axis2Placement3ds are merged for StepShape_GeometricCurveSet. // Check that equal Axis2Placement3ds are merged for StepShape_GeometricCurveSet.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_Plane) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_Plane)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -98,7 +98,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_Plane)
} }
// Check that equal Axis2Placement3ds are merged for StepRepr_ItemDefinedTransformation. // Check that equal Axis2Placement3ds are merged for StepRepr_ItemDefinedTransformation.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepRepr_ItemDefinedTransformation) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepRepr_ItemDefinedTransformation)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -124,7 +124,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepRepr_ItemDefinedTran
} }
// Check that equal Axis2Placement3ds are merged for StepGeom_CylindricalSurface. // Check that equal Axis2Placement3ds are merged for StepGeom_CylindricalSurface.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_CylindricalSurface) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_CylindricalSurface)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -149,7 +149,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_CylindricalSurf
} }
// Check that equal Axis2Placement3ds are merged for StepShape_ShapeRepresentation. // Check that equal Axis2Placement3ds are merged for StepShape_ShapeRepresentation.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepShape_ShapeRepresentation) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepShape_ShapeRepresentation)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -184,7 +184,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepShape_ShapeRepresent
} }
// Check that equal Axis2Placement3ds are merged for StepRepr_ConstructiveGeometryRepresentation. // Check that equal Axis2Placement3ds are merged for StepRepr_ConstructiveGeometryRepresentation.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepRepr_ConstructiveGeometryRepresentation) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepRepr_ConstructiveGeometryRepresentation)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -221,7 +221,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepRepr_ConstructiveGeo
} }
// Check that equal Axis2Placement3ds are merged for StepGeom_Circle. // Check that equal Axis2Placement3ds are merged for StepGeom_Circle.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_Circle) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_Circle)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -250,7 +250,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_Circle)
} }
// Check that equal Axis2Placement3ds are merged for StepVisual_PresentationLayerAssignment. // Check that equal Axis2Placement3ds are merged for StepVisual_PresentationLayerAssignment.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepVisual_PresentationLayerAssignment) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepVisual_PresentationLayerAssignment)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -291,7 +291,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepVisual_PresentationL
} }
// Check that equal Axis2Placement3ds are merged for StepVisual_StyledItem. // Check that equal Axis2Placement3ds are merged for StepVisual_StyledItem.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepVisual_StyledItem) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepVisual_StyledItem)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -320,7 +320,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepVisual_StyledItem)
} }
// Check that equal Axis2Placement3ds are merged for StepGeom_Ellipse. // Check that equal Axis2Placement3ds are merged for StepGeom_Ellipse.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_Ellipse) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_Ellipse)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -349,7 +349,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_Ellipse)
} }
// Check that equal Axis2Placement3ds are merged for StepGeom_ConicalSurface. // Check that equal Axis2Placement3ds are merged for StepGeom_ConicalSurface.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_ConicalSurface) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_ConicalSurface)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -374,7 +374,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_ConicalSurface)
} }
// Check that equal Axis2Placement3ds are merged for StepGeom_ToroidalSurface. // Check that equal Axis2Placement3ds are merged for StepGeom_ToroidalSurface.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_ToroidalSurface) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_ToroidalSurface)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -399,7 +399,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_ToroidalSurface
} }
// Check that equal Axis2Placement3ds are merged for StepShape_AdvancedBrepShapeRepresentation. // Check that equal Axis2Placement3ds are merged for StepShape_AdvancedBrepShapeRepresentation.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepShape_AdvancedBrepShapeRepresentation) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepShape_AdvancedBrepShapeRepresentation)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();
@ -436,7 +436,7 @@ TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepShape_AdvancedBrepSh
} }
// Check that equal Axis2Placement3ds are merged for StepGeom_SphericalSurface. // Check that equal Axis2Placement3ds are merged for StepGeom_SphericalSurface.
TEST_F(MergeSTEPEntities_Axis2Placement3dProcessorTest, StepGeom_SphericalSurface) TEST_F(StepTidy_Axis2Placement3dReducerTest, StepGeom_SphericalSurface)
{ {
// Creating Axis2Placement3ds. // Creating Axis2Placement3ds.
Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anAxis1 = addAxis2Placement3d();

View File

@ -11,8 +11,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_BaseTestFixture_HeaderFile #ifndef _StepTidy_BaseTestFixture_HeaderFile
#define _MergeSTEPEntities_BaseTestFixture_HeaderFile #define _StepTidy_BaseTestFixture_HeaderFile
#include <STEPControl_Controller.hxx> #include <STEPControl_Controller.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
@ -26,11 +26,11 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
class MergeSTEPEntities_BaseTestFixture : public testing::Test class StepTidy_BaseTestFixture : public testing::Test
{ {
protected: protected:
// Initialize the work session and model. // Initialize the work session and model.
MergeSTEPEntities_BaseTestFixture() StepTidy_BaseTestFixture()
: myWS() : myWS()
{ {
STEPControl_Controller::Init(); STEPControl_Controller::Init();
@ -191,4 +191,4 @@ protected:
Handle(XSControl_WorkSession) myWS; Handle(XSControl_WorkSession) myWS;
}; };
#endif // _MergeSTEPEntities_BaseTestFixture_HeaderFile #endif // _StepTidy_BaseTestFixture_HeaderFile

View File

@ -11,9 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_CartesianPointProcessor.hxx> #include <StepTidy_CartesianPointReducer.pxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
@ -30,26 +30,26 @@
#include <StepVisual_PresentationLayerAssignment.hxx> #include <StepVisual_PresentationLayerAssignment.hxx>
#include <StepVisual_StyledItem.hxx> #include <StepVisual_StyledItem.hxx>
class MergeSTEPEntities_CartesianPointProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_CartesianPointReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
// Perform removal of duplicate Cartesian points. // Perform removal of duplicate Cartesian points.
TColStd_MapOfTransient replaceDuplicateCartesianPoints() TColStd_MapOfTransient replaceDuplicateCartesianPoints()
{ {
MergeSTEPEntities_CartesianPointProcessor aProcessor(myWS); StepTidy_CartesianPointReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that points with the same coordinates and different names are not merged. // Check that points with the same coordinates and different names are not merged.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, DifferentNames) TEST_F(StepTidy_CartesianPointReducerTest, DifferentNames)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint("FirstPt"); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint("FirstPt");
@ -85,7 +85,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, DifferentNames)
// Check that points with the same coordinates and same names are // Check that points with the same coordinates and same names are
// merged for StepGeom_Axis2Placement3d. // merged for StepGeom_Axis2Placement3d.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_Axis2Placement3d) TEST_F(StepTidy_CartesianPointReducerTest, StepGeom_Axis2Placement3d)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -122,7 +122,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_Axis2Placement3d)
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepShape_VertexPoint. // for StepShape_VertexPoint.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepShape_VertexPoint) TEST_F(StepTidy_CartesianPointReducerTest, StepShape_VertexPoint)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -148,7 +148,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepShape_VertexPoint)
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepShape_GeometricCurveSet. // for StepShape_GeometricCurveSet.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepShape_GeometricCurveSet) TEST_F(StepTidy_CartesianPointReducerTest, StepShape_GeometricCurveSet)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -186,7 +186,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepShape_GeometricCurveSe
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepVisual_PresentationLayerAssignment. // for StepVisual_PresentationLayerAssignment.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepVisual_PresentationLayerAssignment) TEST_F(StepTidy_CartesianPointReducerTest, StepVisual_PresentationLayerAssignment)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -230,7 +230,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepVisual_PresentationLay
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepVisual_StyledItem. // for StepVisual_StyledItem.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepVisual_StyledItem) TEST_F(StepTidy_CartesianPointReducerTest, StepVisual_StyledItem)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -260,7 +260,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepVisual_StyledItem)
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepGeom_BSplineCurveWithKnots. // for StepGeom_BSplineCurveWithKnots.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineCurveWithKnots) TEST_F(StepTidy_CartesianPointReducerTest, StepGeom_BSplineCurveWithKnots)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -270,7 +270,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineCurveWithK
Handle(StepGeom_HArray1OfCartesianPoint) aFirstControlPoints = Handle(StepGeom_HArray1OfCartesianPoint) aFirstControlPoints =
new StepGeom_HArray1OfCartesianPoint(1, 1); new StepGeom_HArray1OfCartesianPoint(1, 1);
aFirstControlPoints->SetValue(1, aPt1); aFirstControlPoints->SetValue(1, aPt1);
addToModel(aFirstControlPoints);
Handle(StepGeom_BSplineCurveWithKnots) aFirstCurve = new StepGeom_BSplineCurveWithKnots; Handle(StepGeom_BSplineCurveWithKnots) aFirstCurve = new StepGeom_BSplineCurveWithKnots;
aFirstCurve->Init(new TCollection_HAsciiString, aFirstCurve->Init(new TCollection_HAsciiString,
1, 1,
@ -287,7 +286,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineCurveWithK
Handle(StepGeom_HArray1OfCartesianPoint) aSecondControlPoints = Handle(StepGeom_HArray1OfCartesianPoint) aSecondControlPoints =
new StepGeom_HArray1OfCartesianPoint(1, 1); new StepGeom_HArray1OfCartesianPoint(1, 1);
aSecondControlPoints->SetValue(1, aPt2); aSecondControlPoints->SetValue(1, aPt2);
addToModel(aSecondControlPoints);
Handle(StepGeom_BSplineCurveWithKnots) aSecondCurve = new StepGeom_BSplineCurveWithKnots; Handle(StepGeom_BSplineCurveWithKnots) aSecondCurve = new StepGeom_BSplineCurveWithKnots;
aSecondCurve->Init(new TCollection_HAsciiString, aSecondCurve->Init(new TCollection_HAsciiString,
1, 1,
@ -310,7 +308,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineCurveWithK
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepGeom_Line. // for StepGeom_Line.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_Line) TEST_F(StepTidy_CartesianPointReducerTest, StepGeom_Line)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -336,7 +334,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_Line)
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepGeom_BSplineSurfaceWithKnots. // for StepGeom_BSplineSurfaceWithKnots.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineSurfaceWithKnots) TEST_F(StepTidy_CartesianPointReducerTest, StepGeom_BSplineSurfaceWithKnots)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -346,7 +344,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineSurfaceWit
Handle(StepGeom_HArray2OfCartesianPoint) aFirstControlPoints = Handle(StepGeom_HArray2OfCartesianPoint) aFirstControlPoints =
new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1); new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1);
aFirstControlPoints->SetValue(1, 1, aPt1); aFirstControlPoints->SetValue(1, 1, aPt1);
addToModel(aFirstControlPoints);
Handle(StepGeom_BSplineSurfaceWithKnots) aFirstSurface = new StepGeom_BSplineSurfaceWithKnots; Handle(StepGeom_BSplineSurfaceWithKnots) aFirstSurface = new StepGeom_BSplineSurfaceWithKnots;
aFirstSurface->Init(new TCollection_HAsciiString, aFirstSurface->Init(new TCollection_HAsciiString,
1, 1,
@ -367,7 +364,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineSurfaceWit
Handle(StepGeom_HArray2OfCartesianPoint) aSecondControlPoints = Handle(StepGeom_HArray2OfCartesianPoint) aSecondControlPoints =
new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1); new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1);
aSecondControlPoints->SetValue(1, 1, aPt2); aSecondControlPoints->SetValue(1, 1, aPt2);
addToModel(aSecondControlPoints);
Handle(StepGeom_BSplineSurfaceWithKnots) aSecondSurface = new StepGeom_BSplineSurfaceWithKnots; Handle(StepGeom_BSplineSurfaceWithKnots) aSecondSurface = new StepGeom_BSplineSurfaceWithKnots;
aSecondSurface->Init(new TCollection_HAsciiString, aSecondSurface->Init(new TCollection_HAsciiString,
1, 1,
@ -394,7 +390,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_BSplineSurfaceWit
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepGeom_Axis1Placement. // for StepGeom_Axis1Placement.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_Axis1Placement) TEST_F(StepTidy_CartesianPointReducerTest, StepGeom_Axis1Placement)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -420,7 +416,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepGeom_Axis1Placement)
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepRepr_Representation. // for StepRepr_Representation.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepRepr_Representation) TEST_F(StepTidy_CartesianPointReducerTest, StepRepr_Representation)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -456,8 +452,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, StepRepr_Representation)
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve. // for StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, TEST_F(StepTidy_CartesianPointReducerTest, StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)
StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)
{ {
// Creating Cartesian points. // Creating Cartesian points.
Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint(); Handle(StepGeom_CartesianPoint) aPt1 = addCartesianPoint();
@ -467,7 +462,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest,
Handle(StepGeom_HArray1OfCartesianPoint) aFirstControlPoints = Handle(StepGeom_HArray1OfCartesianPoint) aFirstControlPoints =
new StepGeom_HArray1OfCartesianPoint(1, 1); new StepGeom_HArray1OfCartesianPoint(1, 1);
aFirstControlPoints->SetValue(1, aPt1); aFirstControlPoints->SetValue(1, aPt1);
addToModel(aFirstControlPoints);
Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aFirstCurve = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aFirstCurve =
new StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve; new StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve;
aFirstCurve->Init(new TCollection_HAsciiString, aFirstCurve->Init(new TCollection_HAsciiString,
@ -486,7 +480,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest,
Handle(StepGeom_HArray1OfCartesianPoint) aSecondControlPoints = Handle(StepGeom_HArray1OfCartesianPoint) aSecondControlPoints =
new StepGeom_HArray1OfCartesianPoint(1, 1); new StepGeom_HArray1OfCartesianPoint(1, 1);
aSecondControlPoints->SetValue(1, aPt2); aSecondControlPoints->SetValue(1, aPt2);
addToModel(aSecondControlPoints);
Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aSecondCurve = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aSecondCurve =
new StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve; new StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve;
aSecondCurve->Init(new TCollection_HAsciiString, aSecondCurve->Init(new TCollection_HAsciiString,
@ -511,7 +504,7 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest,
// Check that points with the same coordinates and same names are merged // Check that points with the same coordinates and same names are merged
// for StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface. // for StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface.
TEST_F(MergeSTEPEntities_CartesianPointProcessorTest, TEST_F(StepTidy_CartesianPointReducerTest,
StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
{ {
// Creating Cartesian points. // Creating Cartesian points.
@ -522,7 +515,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest,
Handle(StepGeom_HArray2OfCartesianPoint) aFirstControlPoints = Handle(StepGeom_HArray2OfCartesianPoint) aFirstControlPoints =
new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1); new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1);
aFirstControlPoints->SetValue(1, 1, aPt1); aFirstControlPoints->SetValue(1, 1, aPt1);
addToModel(aFirstControlPoints);
Handle(StepGeom_BSplineSurfaceWithKnots) aFirstBSSWN = new StepGeom_BSplineSurfaceWithKnots; Handle(StepGeom_BSplineSurfaceWithKnots) aFirstBSSWN = new StepGeom_BSplineSurfaceWithKnots;
aFirstBSSWN->Init(new TCollection_HAsciiString, aFirstBSSWN->Init(new TCollection_HAsciiString,
1, 1,
@ -556,7 +548,6 @@ TEST_F(MergeSTEPEntities_CartesianPointProcessorTest,
Handle(StepGeom_HArray2OfCartesianPoint) aSecondControlPoints = Handle(StepGeom_HArray2OfCartesianPoint) aSecondControlPoints =
new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1); new StepGeom_HArray2OfCartesianPoint(1, 1, 1, 1);
aSecondControlPoints->SetValue(1, 1, aPt2); aSecondControlPoints->SetValue(1, 1, aPt2);
addToModel(aSecondControlPoints);
Handle(StepGeom_BSplineSurfaceWithKnots) aSecondBSSWN = new StepGeom_BSplineSurfaceWithKnots; Handle(StepGeom_BSplineSurfaceWithKnots) aSecondBSSWN = new StepGeom_BSplineSurfaceWithKnots;
aSecondBSSWN->Init(new TCollection_HAsciiString, aSecondBSSWN->Init(new TCollection_HAsciiString,
1, 1,

View File

@ -11,34 +11,34 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_CircleProcessor.hxx> #include <StepTidy_CircleReducer.pxx>
#include <StepShape_EdgeCurve.hxx> #include <StepShape_EdgeCurve.hxx>
#include <StepGeom_SurfaceCurve.hxx> #include <StepGeom_SurfaceCurve.hxx>
#include <StepGeom_SeamCurve.hxx> #include <StepGeom_SeamCurve.hxx>
class MergeSTEPEntities_CircleProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_CircleReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
//! Perform removal of duplicate entities. //! Perform removal of duplicate entities.
TColStd_MapOfTransient replaceDuplicateCircles() TColStd_MapOfTransient replaceDuplicateCircles()
{ {
MergeSTEPEntities_CircleProcessor aProcessor(myWS); StepTidy_CircleReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that Circles with the same coordinates and different names are not merged. // Check that Circles with the same coordinates and different names are not merged.
TEST_F(MergeSTEPEntities_CircleProcessorTest, DifferentNames) TEST_F(StepTidy_CircleReducerTest, DifferentNames)
{ {
// Creating Circles. // Creating Circles.
Handle(StepGeom_Circle) aCircle1 = addCircle("Circle1"); Handle(StepGeom_Circle) aCircle1 = addCircle("Circle1");
@ -70,7 +70,7 @@ TEST_F(MergeSTEPEntities_CircleProcessorTest, DifferentNames)
} }
// Check that equal Circles are merged for StepShape_EdgeCurve. // Check that equal Circles are merged for StepShape_EdgeCurve.
TEST_F(MergeSTEPEntities_CircleProcessorTest, StepShape_EdgeCurve) TEST_F(StepTidy_CircleReducerTest, StepShape_EdgeCurve)
{ {
// Creating Circles. // Creating Circles.
Handle(StepGeom_Circle) aCircle1 = addCircle(); Handle(StepGeom_Circle) aCircle1 = addCircle();
@ -103,7 +103,7 @@ TEST_F(MergeSTEPEntities_CircleProcessorTest, StepShape_EdgeCurve)
} }
// Check that equal Circles are merged for StepGeom_SurfaceCurve. // Check that equal Circles are merged for StepGeom_SurfaceCurve.
TEST_F(MergeSTEPEntities_CircleProcessorTest, StepGeom_SurfaceCurve) TEST_F(StepTidy_CircleReducerTest, StepGeom_SurfaceCurve)
{ {
// Creating Circles. // Creating Circles.
Handle(StepGeom_Circle) aCircle1 = addCircle(); Handle(StepGeom_Circle) aCircle1 = addCircle();
@ -134,7 +134,7 @@ TEST_F(MergeSTEPEntities_CircleProcessorTest, StepGeom_SurfaceCurve)
} }
// Check that equal Circles are merged for StepGeom_SeamCurve. // Check that equal Circles are merged for StepGeom_SeamCurve.
TEST_F(MergeSTEPEntities_CircleProcessorTest, StepGeom_SeamCurve) TEST_F(StepTidy_CircleReducerTest, StepGeom_SeamCurve)
{ {
// Creating Circles. // Creating Circles.
Handle(StepGeom_Circle) aCircle1 = addCircle(); Handle(StepGeom_Circle) aCircle1 = addCircle();

View File

@ -11,33 +11,33 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_DirectionProcessor.hxx> #include <StepTidy_DirectionReducer.pxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
class MergeSTEPEntities_DirectionProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_DirectionReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
//! Perform removal of duplicate entities. //! Perform removal of duplicate entities.
TColStd_MapOfTransient replaceDuplicateDirections() TColStd_MapOfTransient replaceDuplicateDirections()
{ {
MergeSTEPEntities_DirectionProcessor aProcessor(myWS); StepTidy_DirectionReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that directions with the same coordinates and different names are not merged. // Check that directions with the same coordinates and different names are not merged.
TEST_F(MergeSTEPEntities_DirectionProcessorTest, DifferentNames) TEST_F(StepTidy_DirectionReducerTest, DifferentNames)
{ {
// Creating directions. // Creating directions.
Handle(StepGeom_Direction) aDir1 = addDirection("dir1"); Handle(StepGeom_Direction) aDir1 = addDirection("dir1");
@ -62,7 +62,7 @@ TEST_F(MergeSTEPEntities_DirectionProcessorTest, DifferentNames)
// Check that directions with the same coordinates and same names are // Check that directions with the same coordinates and same names are
// merged for StepGeom_Axis1Placement. // merged for StepGeom_Axis1Placement.
TEST_F(MergeSTEPEntities_DirectionProcessorTest, StepGeom_Axis1Placement) TEST_F(StepTidy_DirectionReducerTest, StepGeom_Axis1Placement)
{ {
// Creating directions. // Creating directions.
Handle(StepGeom_Direction) aDir1 = addDirection(); Handle(StepGeom_Direction) aDir1 = addDirection();
@ -97,7 +97,7 @@ TEST_F(MergeSTEPEntities_DirectionProcessorTest, StepGeom_Axis1Placement)
// Check that directions with the same coordinates and same names are // Check that directions with the same coordinates and same names are
// merged for StepGeom_Axis2Placement. // merged for StepGeom_Axis2Placement.
TEST_F(MergeSTEPEntities_DirectionProcessorTest, StepGeom_Axis2Placement) TEST_F(StepTidy_DirectionReducerTest, StepGeom_Axis2Placement)
{ {
// Creating directions. // Creating directions.
Handle(StepGeom_Direction) aDir1 = addDirection(); Handle(StepGeom_Direction) aDir1 = addDirection();
@ -132,7 +132,7 @@ TEST_F(MergeSTEPEntities_DirectionProcessorTest, StepGeom_Axis2Placement)
// Check that points with the same coordinates and same names are // Check that points with the same coordinates and same names are
// merged for StepGeom_Vector. // merged for StepGeom_Vector.
TEST_F(MergeSTEPEntities_DirectionProcessorTest, StepGeom_Vector) TEST_F(StepTidy_DirectionReducerTest, StepGeom_Vector)
{ {
// Creating directions. // Creating directions.
Handle(StepGeom_Direction) aDir1 = addDirection(); Handle(StepGeom_Direction) aDir1 = addDirection();

View File

@ -11,9 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_LineProcessor.hxx> #include <StepTidy_LineReducer.pxx>
#include <StepShape_EdgeCurve.hxx> #include <StepShape_EdgeCurve.hxx>
#include <StepGeom_TrimmedCurve.hxx> #include <StepGeom_TrimmedCurve.hxx>
@ -22,26 +22,26 @@
#include <StepGeom_SeamCurve.hxx> #include <StepGeom_SeamCurve.hxx>
#include <StepRepr_RepresentationContext.hxx> #include <StepRepr_RepresentationContext.hxx>
class MergeSTEPEntities_LineProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_LineReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
//! Perform removal of duplicate entities. //! Perform removal of duplicate entities.
TColStd_MapOfTransient replaceDuplicateLines() TColStd_MapOfTransient replaceDuplicateLines()
{ {
MergeSTEPEntities_LineProcessor aProcessor(myWS); StepTidy_LineReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that Lines with different names are not merged. // Check that Lines with different names are not merged.
TEST_F(MergeSTEPEntities_LineProcessorTest, DifferentNames) TEST_F(StepTidy_LineReducerTest, DifferentNames)
{ {
// Creating Lines. // Creating Lines.
Handle(StepGeom_Line) aLine1 = addLine("Line1"); Handle(StepGeom_Line) aLine1 = addLine("Line1");
@ -73,7 +73,7 @@ TEST_F(MergeSTEPEntities_LineProcessorTest, DifferentNames)
} }
// Check that equal Lines are merged for StepShape_EdgeCurve. // Check that equal Lines are merged for StepShape_EdgeCurve.
TEST_F(MergeSTEPEntities_LineProcessorTest, StepShape_EdgeCurve) TEST_F(StepTidy_LineReducerTest, StepShape_EdgeCurve)
{ {
// Creating Lines. // Creating Lines.
Handle(StepGeom_Line) aLine1 = addLine(); Handle(StepGeom_Line) aLine1 = addLine();
@ -106,7 +106,7 @@ TEST_F(MergeSTEPEntities_LineProcessorTest, StepShape_EdgeCurve)
} }
// Check that equal Lines are merged for StepGeom_TrimmedCurve. // Check that equal Lines are merged for StepGeom_TrimmedCurve.
TEST_F(MergeSTEPEntities_LineProcessorTest, StepGeom_TrimmedCurve) TEST_F(StepTidy_LineReducerTest, StepGeom_TrimmedCurve)
{ {
// Creating Lines. // Creating Lines.
Handle(StepGeom_Line) aLine1 = addLine(); Handle(StepGeom_Line) aLine1 = addLine();
@ -141,7 +141,7 @@ TEST_F(MergeSTEPEntities_LineProcessorTest, StepGeom_TrimmedCurve)
} }
// Check that equal Lines are merged for StepGeom_SurfaceCurve. // Check that equal Lines are merged for StepGeom_SurfaceCurve.
TEST_F(MergeSTEPEntities_LineProcessorTest, StepGeom_SurfaceCurve) TEST_F(StepTidy_LineReducerTest, StepGeom_SurfaceCurve)
{ {
// Creating Lines. // Creating Lines.
Handle(StepGeom_Line) aLine1 = addLine(); Handle(StepGeom_Line) aLine1 = addLine();
@ -172,7 +172,7 @@ TEST_F(MergeSTEPEntities_LineProcessorTest, StepGeom_SurfaceCurve)
} }
// Check that equal Lines are merged for StepRepr_DefinitionalRepresentation. // Check that equal Lines are merged for StepRepr_DefinitionalRepresentation.
TEST_F(MergeSTEPEntities_LineProcessorTest, StepRepr_DefinitionalRepresentation) TEST_F(StepTidy_LineReducerTest, StepRepr_DefinitionalRepresentation)
{ {
// Creating Lines. // Creating Lines.
Handle(StepGeom_Line) aLine1 = addLine(); Handle(StepGeom_Line) aLine1 = addLine();
@ -208,7 +208,7 @@ TEST_F(MergeSTEPEntities_LineProcessorTest, StepRepr_DefinitionalRepresentation)
} }
// Check that equal Lines are merged for StepGeom_SeamCurve. // Check that equal Lines are merged for StepGeom_SeamCurve.
TEST_F(MergeSTEPEntities_LineProcessorTest, StepGeom_SeamCurve) TEST_F(StepTidy_LineReducerTest, StepGeom_SeamCurve)
{ {
// Creating Lines. // Creating Lines.
Handle(StepGeom_Line) aLine1 = addLine(); Handle(StepGeom_Line) aLine1 = addLine();

View File

@ -11,13 +11,13 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_Merger.hxx> #include <StepTidy_DuplicateCleaner.hxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
class MergeSTEPEntities_MergerTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_DuplicateCleanerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
// Get the number of entities of the specified type. // Get the number of entities of the specified type.
@ -39,13 +39,13 @@ protected:
//! Perform removal of duplicate entities points. //! Perform removal of duplicate entities points.
void performRemoval() void performRemoval()
{ {
MergeSTEPEntities_Merger aMerger(myWS); StepTidy_DuplicateCleaner aMerger(myWS);
aMerger.Perform(); aMerger.Perform();
} }
}; };
// Check that entities with the same coordinates and different names are not merged. // Check that entities with the same coordinates and different names are not merged.
TEST_F(MergeSTEPEntities_MergerTest, DifferentEntities) TEST_F(StepTidy_DuplicateCleanerTest, DifferentEntities)
{ {
// Creating directions. // Creating directions.
Handle(StepGeom_Direction) aDir1 = addDirection("dir1"); Handle(StepGeom_Direction) aDir1 = addDirection("dir1");
@ -75,7 +75,7 @@ TEST_F(MergeSTEPEntities_MergerTest, DifferentEntities)
// Check that entities with the same coordinates and same names are // Check that entities with the same coordinates and same names are
// merged for StepGeom_Axis1Placement. // merged for StepGeom_Axis1Placement.
TEST_F(MergeSTEPEntities_MergerTest, EqualEntities) TEST_F(StepTidy_DuplicateCleanerTest, EqualEntities)
{ {
// Creating directions. // Creating directions.
Handle(StepGeom_Direction) aDir1 = addDirection(); Handle(StepGeom_Direction) aDir1 = addDirection();

View File

@ -11,34 +11,34 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_PlaneProcessor.hxx> #include <StepTidy_PlaneReducer.pxx>
#include <StepShape_AdvancedFace.hxx> #include <StepShape_AdvancedFace.hxx>
#include <StepGeom_Pcurve.hxx> #include <StepGeom_Pcurve.hxx>
#include <StepRepr_DefinitionalRepresentation.hxx> #include <StepRepr_DefinitionalRepresentation.hxx>
class MergeSTEPEntities_PlaneProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_PlaneReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
//! Perform removal of duplicate entities. //! Perform removal of duplicate entities.
TColStd_MapOfTransient replaceDuplicatePlanes() TColStd_MapOfTransient replaceDuplicatePlanes()
{ {
MergeSTEPEntities_PlaneProcessor aProcessor(myWS); StepTidy_PlaneReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that Planes with different names are not merged. // Check that Planes with different names are not merged.
TEST_F(MergeSTEPEntities_PlaneProcessorTest, DifferentNames) TEST_F(StepTidy_PlaneReducerTest, DifferentNames)
{ {
// Creating Planes. // Creating Planes.
Handle(StepGeom_Plane) aPlane1 = addPlane("Plane1"); Handle(StepGeom_Plane) aPlane1 = addPlane("Plane1");
@ -68,7 +68,7 @@ TEST_F(MergeSTEPEntities_PlaneProcessorTest, DifferentNames)
} }
// Check that equal Planes are merged for StepShape_AdvancedFace. // Check that equal Planes are merged for StepShape_AdvancedFace.
TEST_F(MergeSTEPEntities_PlaneProcessorTest, StepShape_AdvancedFace) TEST_F(StepTidy_PlaneReducerTest, StepShape_AdvancedFace)
{ {
// Creating Planes. // Creating Planes.
Handle(StepGeom_Plane) aPlane1 = addPlane(); Handle(StepGeom_Plane) aPlane1 = addPlane();
@ -99,7 +99,7 @@ TEST_F(MergeSTEPEntities_PlaneProcessorTest, StepShape_AdvancedFace)
} }
// Check that equal Planes are merged for StepGeom_Pcurve. // Check that equal Planes are merged for StepGeom_Pcurve.
TEST_F(MergeSTEPEntities_PlaneProcessorTest, StepGeom_Pcurve) TEST_F(StepTidy_PlaneReducerTest, StepGeom_Pcurve)
{ {
// Creating Planes. // Creating Planes.
Handle(StepGeom_Plane) aPlane1 = addPlane(); Handle(StepGeom_Plane) aPlane1 = addPlane();

View File

@ -11,32 +11,32 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include "MergeSTEPEntities_BaseTestFixture.hxx" #include "StepTidy_BaseTestFixture.pxx"
#include <MergeSTEPEntities_VectorProcessor.hxx> #include <StepTidy_VectorReducer.pxx>
#include <StepGeom_Line.hxx> #include <StepGeom_Line.hxx>
class MergeSTEPEntities_VectorProcessorTest : public MergeSTEPEntities_BaseTestFixture class StepTidy_VectorReducerTest : public StepTidy_BaseTestFixture
{ {
protected: protected:
//! Perform removal of duplicate entities. //! Perform removal of duplicate entities.
TColStd_MapOfTransient replaceDuplicateVectors() TColStd_MapOfTransient replaceDuplicateVectors()
{ {
MergeSTEPEntities_VectorProcessor aProcessor(myWS); StepTidy_VectorReducer aReducer(myWS);
for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= myWS->Model()->NbEntities(); ++anIndex)
{ {
aProcessor.ProcessEntity(myWS->Model()->Value(anIndex)); aReducer.ProcessEntity(myWS->Model()->Value(anIndex));
} }
TColStd_MapOfTransient aRemovedEntities; TColStd_MapOfTransient aRemovedEntities;
aProcessor.Perform(aRemovedEntities); aReducer.Perform(aRemovedEntities);
return aRemovedEntities; return aRemovedEntities;
} }
}; };
// Check that Vectors with the same coordinates and different names are not merged. // Check that Vectors with the same coordinates and different names are not merged.
TEST_F(MergeSTEPEntities_VectorProcessorTest, DifferentNames) TEST_F(StepTidy_VectorReducerTest, DifferentNames)
{ {
// Creating Vectors. // Creating Vectors.
Handle(StepGeom_Vector) aVec1 = addVector("vec1"); Handle(StepGeom_Vector) aVec1 = addVector("vec1");
@ -64,7 +64,7 @@ TEST_F(MergeSTEPEntities_VectorProcessorTest, DifferentNames)
// Check that Vectors with the same coordinates and same names are // Check that Vectors with the same coordinates and same names are
// merged for StepGeom_Axis1Placement. // merged for StepGeom_Axis1Placement.
TEST_F(MergeSTEPEntities_VectorProcessorTest, StepGeom_Line) TEST_F(StepTidy_VectorReducerTest, StepGeom_Line)
{ {
// Creating Vectors. // Creating Vectors.
Handle(StepGeom_Vector) aVec1 = addVector(); Handle(StepGeom_Vector) aVec1 = addVector();

View File

@ -1,30 +0,0 @@
# Source files for STEPControl package
set(OCCT_MergeSTEPEntities_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_MergeSTEPEntities_FILES
MergeSTEPEntities_Axis2Placement2dHasher.hxx
MergeSTEPEntities_Axis2Placement3dHasher.hxx
MergeSTEPEntities_Axis2Placement3dProcessor.cxx
MergeSTEPEntities_Axis2Placement3dProcessor.hxx
MergeSTEPEntities_CartesianPointHasher.hxx
MergeSTEPEntities_CartesianPointProcessor.cxx
MergeSTEPEntities_CartesianPointProcessor.hxx
MergeSTEPEntities_CircleHasher.hxx
MergeSTEPEntities_CircleProcessor.cxx
MergeSTEPEntities_CircleProcessor.hxx
MergeSTEPEntities_DirectionHasher.hxx
MergeSTEPEntities_DirectionProcessor.cxx
MergeSTEPEntities_DirectionProcessor.hxx
MergeSTEPEntities_EntityProcessor.hxx
MergeSTEPEntities_LineHasher.hxx
MergeSTEPEntities_LineProcessor.cxx
MergeSTEPEntities_LineProcessor.hxx
MergeSTEPEntities_Merger.cxx
MergeSTEPEntities_Merger.hxx
MergeSTEPEntities_PlaneHasher.hxx
MergeSTEPEntities_PlaneProcessor.cxx
MergeSTEPEntities_PlaneProcessor.hxx
MergeSTEPEntities_VectorHasher.hxx
MergeSTEPEntities_VectorProcessor.cxx
MergeSTEPEntities_VectorProcessor.hxx
)

View File

@ -1,46 +0,0 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_Merger_HeaderFile
#define _MergeSTEPEntities_Merger_HeaderFile
#include <TColStd_MapOfTransient.hxx>
class XSControl_WorkSession;
//! A class to merge STEP entities.
//! This class is used to merge equal STEP entities in the work session and remove duplicates.
//! More detailed information about merging entities cam be found in
//! MergeSTEPEntities_EntityProcessor class and its descendants.
class MergeSTEPEntities_Merger
{
public:
//! Constructor.
//! @param theWS the work session to merge entities in.
Standard_EXPORT MergeSTEPEntities_Merger(Handle(XSControl_WorkSession) theWS);
//! Perform the merging of entities.
//! All entities in a model stored in the provided work session that are considered equal to
//! each other will be merged, and duplicates will be removed.
Standard_EXPORT void Perform();
private:
//! Remove entities from the work session.
//! @param theToRemove the entities to remove.
void removeEntities(const TColStd_MapOfTransient& theToRemove);
private:
Handle(XSControl_WorkSession) myWS; //!< The work session containing the model with entities.
};
#endif // _MergeSTEPEntities_Merger_HeaderFile

View File

@ -41,5 +41,5 @@ set(OCCT_TKDESTEP_LIST_OF_PACKAGES
APIHeaderSection APIHeaderSection
HeaderSection HeaderSection
DESTEP DESTEP
MergeSTEPEntities StepTidy
) )

View File

@ -312,6 +312,12 @@ void RWStepGeom_RWBSplineCurveWithKnots::Check(const Handle(StepGeom_BSplineCurv
{ {
ach->AddFail("ERROR: No.of KnotMultiplicities not equal No.of Knots"); ach->AddFail("ERROR: No.of KnotMultiplicities not equal No.of Knots");
} }
if (nbMult == 0)
{
ach->AddFail("ERROR: No.of KnotMultiplicities is equal to 0");
return;
}
Standard_Integer i; // svv Jan 10 2000: porting on DEC Standard_Integer i; // svv Jan 10 2000: porting on DEC
for (i = 1; i <= nbMult - 1; i++) for (i = 1; i <= nbMult - 1; i++)
{ {

View File

@ -0,0 +1,30 @@
# Source files for StepTidy package
set(OCCT_StepTidy_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_StepTidy_FILES
StepTidy_Axis2Placement2dHasher.pxx
StepTidy_Axis2Placement3dHasher.pxx
StepTidy_Axis2Placement3dReducer.cxx
StepTidy_Axis2Placement3dReducer.pxx
StepTidy_CartesianPointHasher.pxx
StepTidy_CartesianPointReducer.cxx
StepTidy_CartesianPointReducer.pxx
StepTidy_CircleHasher.pxx
StepTidy_CircleReducer.cxx
StepTidy_CircleReducer.pxx
StepTidy_DirectionHasher.pxx
StepTidy_DirectionReducer.cxx
StepTidy_DirectionReducer.pxx
StepTidy_EntityReducer.pxx
StepTidy_LineHasher.pxx
StepTidy_LineReducer.cxx
StepTidy_LineReducer.pxx
StepTidy_DuplicateCleaner.cxx
StepTidy_DuplicateCleaner.hxx
StepTidy_PlaneHasher.pxx
StepTidy_PlaneReducer.cxx
StepTidy_PlaneReducer.pxx
StepTidy_VectorHasher.pxx
StepTidy_VectorReducer.cxx
StepTidy_VectorReducer.pxx
)

View File

@ -11,27 +11,27 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_Axis2Placement2dHasher_HeaderFile #ifndef _StepTidy_Axis2Placement2dHasher_HeaderFile
#define _MergeSTEPEntities_Axis2Placement2dHasher_HeaderFile #define _StepTidy_Axis2Placement2dHasher_HeaderFile
#include <StepTidy_CartesianPointHasher.pxx>
#include <StepTidy_DirectionHasher.pxx>
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Axis2Placement2d.hxx> #include <StepGeom_Axis2Placement2d.hxx>
#include <MergeSTEPEntities_CartesianPointHasher.hxx>
#include <MergeSTEPEntities_DirectionHasher.hxx>
//! OCCT-style hasher for StepGeom_Axis2Placement2d entities. //! OCCT-style hasher for StepGeom_Axis2Placement2d entities.
//! Currently only used for implementation of hasher for StepGeom_Circle. //! Currently only used for implementation of hasher for StepGeom_Circle.
struct MergeSTEPEntities_Axis2Placement2dHasher struct StepTidy_Axis2Placement2dHasher
{ {
// Hashes the axis placements. // Hashes the axis placements.
std::size_t operator()(const Handle(StepGeom_Axis2Placement2d)& thePlacement) const noexcept std::size_t operator()(const Handle(StepGeom_Axis2Placement2d)& thePlacement) const noexcept
{ {
// Prepare an array of hashes for the location, axis, and ref direction. // Prepare an array of hashes for the location, axis, and ref direction.
// Optimal seed is used for the axis and ref direction if they are not present. // Optimal seed is used for the axis and ref direction if they are not present.
const size_t aHashes[2]{MergeSTEPEntities_CartesianPointHasher{}(thePlacement->Location()), const size_t aHashes[2]{StepTidy_CartesianPointHasher{}(thePlacement->Location()),
thePlacement->HasRefDirection() thePlacement->HasRefDirection()
? MergeSTEPEntities_DirectionHasher{}(thePlacement->RefDirection()) ? StepTidy_DirectionHasher{}(thePlacement->RefDirection())
: opencascade::MurmurHash::optimalSeed()}; : opencascade::MurmurHash::optimalSeed()};
const size_t aHash = opencascade::hashBytes(aHashes, sizeof(aHashes)); const size_t aHash = opencascade::hashBytes(aHashes, sizeof(aHashes));
if (thePlacement->Name().IsNull()) if (thePlacement->Name().IsNull())
@ -61,8 +61,8 @@ struct MergeSTEPEntities_Axis2Placement2dHasher
} }
// Compare location, axis, and ref direction. // Compare location, axis, and ref direction.
const bool isSameLocation = MergeSTEPEntities_CartesianPointHasher{}(thePlacement1->Location(), const bool isSameLocation =
thePlacement2->Location()); StepTidy_CartesianPointHasher{}(thePlacement1->Location(), thePlacement2->Location());
// Have to check if the axis is present and compare it. // Have to check if the axis is present and compare it.
// Have to check if the ref direction is present and compare it. // Have to check if the ref direction is present and compare it.
const bool isSameRefDirectionFlag = const bool isSameRefDirectionFlag =
@ -70,11 +70,11 @@ struct MergeSTEPEntities_Axis2Placement2dHasher
const bool isSameRefDirection = const bool isSameRefDirection =
isSameRefDirectionFlag isSameRefDirectionFlag
&& (!thePlacement1->HasRefDirection() && (!thePlacement1->HasRefDirection()
|| MergeSTEPEntities_DirectionHasher{}(thePlacement1->RefDirection(), || StepTidy_DirectionHasher{}(thePlacement1->RefDirection(),
thePlacement2->RefDirection())); thePlacement2->RefDirection()));
return isSameLocation && isSameRefDirection; return isSameLocation && isSameRefDirection;
} }
}; };
#endif // _MergeSTEPEntities_Axis2Placement2dHasher_HeaderFile #endif // _StepTidy_Axis2Placement2dHasher_HeaderFile

View File

@ -11,30 +11,29 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_Axis2Placement3dHasher_HeaderFile #ifndef _StepTidy_Axis2Placement3dHasher_HeaderFile
#define _MergeSTEPEntities_Axis2Placement3dHasher_HeaderFile #define _StepTidy_Axis2Placement3dHasher_HeaderFile
#include <StepTidy_CartesianPointHasher.pxx>
#include <StepTidy_DirectionHasher.pxx>
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <MergeSTEPEntities_CartesianPointHasher.hxx>
#include <MergeSTEPEntities_DirectionHasher.hxx>
//! OCCT-style hasher for StepGeom_Axis2Placement3d entities. //! OCCT-style hasher for StepGeom_Axis2Placement3d entities.
struct MergeSTEPEntities_Axis2Placement3dHasher struct StepTidy_Axis2Placement3dHasher
{ {
// Hashes the axis placements. // Hashes the axis placements.
std::size_t operator()(const Handle(StepGeom_Axis2Placement3d)& thePlacement) const noexcept std::size_t operator()(const Handle(StepGeom_Axis2Placement3d)& thePlacement) const noexcept
{ {
// Prepare an array of hashes for the location, axis, and ref direction. // Prepare an array of hashes for the location, axis, and ref direction.
// Optimal seed is used for the axis and ref direction if they are not present. // Optimal seed is used for the axis and ref direction if they are not present.
const size_t aHashes[3]{MergeSTEPEntities_CartesianPointHasher{}(thePlacement->Location()), const size_t aHashes[3]{
thePlacement->HasAxis() StepTidy_CartesianPointHasher{}(thePlacement->Location()),
? MergeSTEPEntities_DirectionHasher{}(thePlacement->Axis()) thePlacement->HasAxis() ? StepTidy_DirectionHasher{}(thePlacement->Axis())
: opencascade::MurmurHash::optimalSeed(), : opencascade::MurmurHash::optimalSeed(),
thePlacement->HasRefDirection() thePlacement->HasRefDirection() ? StepTidy_DirectionHasher{}(thePlacement->RefDirection())
? MergeSTEPEntities_DirectionHasher{}(thePlacement->RefDirection()) : opencascade::MurmurHash::optimalSeed()};
: opencascade::MurmurHash::optimalSeed()};
const size_t aHash = opencascade::hashBytes(aHashes, sizeof(aHashes)); const size_t aHash = opencascade::hashBytes(aHashes, sizeof(aHashes));
if (thePlacement->Name().IsNull()) if (thePlacement->Name().IsNull())
{ {
@ -63,25 +62,25 @@ struct MergeSTEPEntities_Axis2Placement3dHasher
} }
// Compare location, axis, and ref direction. // Compare location, axis, and ref direction.
const bool isSameLocation = MergeSTEPEntities_CartesianPointHasher{}(thePlacement1->Location(), const bool isSameLocation =
thePlacement2->Location()); StepTidy_CartesianPointHasher{}(thePlacement1->Location(), thePlacement2->Location());
// Have to check if the axis is present and compare it. // Have to check if the axis is present and compare it.
const bool isSameAxisFlag = thePlacement1->HasAxis() == thePlacement2->HasAxis(); const bool isSameAxisFlag = thePlacement1->HasAxis() == thePlacement2->HasAxis();
const bool isSameAxis = const bool isSameAxis =
isSameAxisFlag isSameAxisFlag
&& (!thePlacement1->HasAxis() && (!thePlacement1->HasAxis()
|| MergeSTEPEntities_DirectionHasher{}(thePlacement1->Axis(), thePlacement2->Axis())); || StepTidy_DirectionHasher{}(thePlacement1->Axis(), thePlacement2->Axis()));
// Have to check if the ref direction is present and compare it. // Have to check if the ref direction is present and compare it.
const bool isSameRefDirectionFlag = const bool isSameRefDirectionFlag =
thePlacement1->HasRefDirection() == thePlacement2->HasRefDirection(); thePlacement1->HasRefDirection() == thePlacement2->HasRefDirection();
const bool isSameRefDirection = const bool isSameRefDirection =
isSameRefDirectionFlag isSameRefDirectionFlag
&& (!thePlacement1->HasRefDirection() && (!thePlacement1->HasRefDirection()
|| MergeSTEPEntities_DirectionHasher{}(thePlacement1->RefDirection(), || StepTidy_DirectionHasher{}(thePlacement1->RefDirection(),
thePlacement2->RefDirection())); thePlacement2->RefDirection()));
return isSameLocation && isSameAxis && isSameRefDirection; return isSameLocation && isSameAxis && isSameRefDirection;
} }
}; };
#endif // _MergeSTEPEntities_Axis2Placement3dHasher_HeaderFile #endif // _StepTidy_Axis2Placement3dHasher_HeaderFile

View File

@ -11,7 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <MergeSTEPEntities_Axis2Placement3dProcessor.hxx> #include <StepTidy_Axis2Placement3dReducer.pxx>
#include <StepGeom_Plane.hxx> #include <StepGeom_Plane.hxx>
#include <StepRepr_ItemDefinedTransformation.hxx> #include <StepRepr_ItemDefinedTransformation.hxx>
@ -29,10 +29,9 @@
//================================================================================================== //==================================================================================================
MergeSTEPEntities_Axis2Placement3dProcessor::MergeSTEPEntities_Axis2Placement3dProcessor( StepTidy_Axis2Placement3dReducer::StepTidy_Axis2Placement3dReducer(
const Handle(XSControl_WorkSession)& theWS) const Handle(XSControl_WorkSession)& theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_Axis2Placement3d, : StepTidy_EntityReducer<StepGeom_Axis2Placement3d, StepTidy_Axis2Placement3dHasher>(theWS)
MergeSTEPEntities_Axis2Placement3dHasher>(theWS)
{ {
registerReplacer(STANDARD_TYPE(StepGeom_Plane), replacePlane); registerReplacer(STANDARD_TYPE(StepGeom_Plane), replacePlane);
registerReplacer(STANDARD_TYPE(StepRepr_ItemDefinedTransformation), registerReplacer(STANDARD_TYPE(StepRepr_ItemDefinedTransformation),
@ -55,7 +54,7 @@ MergeSTEPEntities_Axis2Placement3dProcessor::MergeSTEPEntities_Axis2Placement3dP
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replacePlane( bool StepTidy_Axis2Placement3dReducer::replacePlane(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -71,7 +70,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replacePlane(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceItemDefinedTransformation( bool StepTidy_Axis2Placement3dReducer::replaceItemDefinedTransformation(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -94,7 +93,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceItemDefinedTransformati
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceCylindricalSurface( bool StepTidy_Axis2Placement3dReducer::replaceCylindricalSurface(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -111,7 +110,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceCylindricalSurface(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceShapeRepresentation( bool StepTidy_Axis2Placement3dReducer::replaceShapeRepresentation(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -133,7 +132,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceShapeRepresentation(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceConstructiveGeometryRepresentation( bool StepTidy_Axis2Placement3dReducer::replaceConstructiveGeometryRepresentation(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -155,7 +154,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceConstructiveGeometryRep
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceCircle( bool StepTidy_Axis2Placement3dReducer::replaceCircle(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -172,7 +171,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceCircle(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replacePresentationLayerAssignment( bool StepTidy_Axis2Placement3dReducer::replacePresentationLayerAssignment(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -195,7 +194,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replacePresentationLayerAssign
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceStyledItem( bool StepTidy_Axis2Placement3dReducer::replaceStyledItem(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -211,7 +210,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceStyledItem(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceEllipse( bool StepTidy_Axis2Placement3dReducer::replaceEllipse(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -228,7 +227,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceEllipse(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceConicalSurface( bool StepTidy_Axis2Placement3dReducer::replaceConicalSurface(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -244,7 +243,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceConicalSurface(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceToroidalSurface( bool StepTidy_Axis2Placement3dReducer::replaceToroidalSurface(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -261,7 +260,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceToroidalSurface(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceAdvancedBrepShapeRepresentation( bool StepTidy_Axis2Placement3dReducer::replaceAdvancedBrepShapeRepresentation(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -283,7 +282,7 @@ bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceAdvancedBrepShapeRepres
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_Axis2Placement3dProcessor::replaceSphericalSurface( bool StepTidy_Axis2Placement3dReducer::replaceSphericalSurface(
const Handle(StepGeom_Axis2Placement3d)& theOldEntity, const Handle(StepGeom_Axis2Placement3d)& theOldEntity,
const Handle(StepGeom_Axis2Placement3d)& theNewEntity, const Handle(StepGeom_Axis2Placement3d)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)

View File

@ -11,25 +11,23 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_Axis2Placement3dProcessor_HeaderFile #ifndef _StepTidy_Axis2Placement3dReducer_HeaderFile
#define _MergeSTEPEntities_Axis2Placement3dProcessor_HeaderFile #define _StepTidy_Axis2Placement3dReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_Axis2Placement3dHasher.hxx> #include <StepTidy_Axis2Placement3dHasher.pxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
//! Processor for merging StepGeom_Axis2Placement3d entities. //! Processor for merging StepGeom_Axis2Placement3d entities.
//! This processor merges axis placements with the same location, axis, and ref direction. //! This processor merges axis placements with the same location, axis, and ref direction.
class MergeSTEPEntities_Axis2Placement3dProcessor class StepTidy_Axis2Placement3dReducer
: public MergeSTEPEntities_EntityProcessor<StepGeom_Axis2Placement3d, : public StepTidy_EntityReducer<StepGeom_Axis2Placement3d, StepTidy_Axis2Placement3dHasher>
MergeSTEPEntities_Axis2Placement3dHasher>
{ {
public: public:
//! Constructor. Stores the work session and registers replacer functions. //! Constructor. Stores the work session and registers replacer functions.
//! @param theWS the work session. //! @param theWS the work session.
Standard_EXPORT MergeSTEPEntities_Axis2Placement3dProcessor( Standard_EXPORT StepTidy_Axis2Placement3dReducer(const Handle(XSControl_WorkSession)& theWS);
const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replaces the old axis placement with the new one in the StepGeom_Plane entity. //! Replaces the old axis placement with the new one in the StepGeom_Plane entity.
@ -157,4 +155,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_DirectionProcessor_HeaderFile #endif // _StepTidy_DirectionReducer_HeaderFile

View File

@ -11,15 +11,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_CartesianPointHasher_HeaderFile #ifndef _StepTidy_CartesianPointHasher_HeaderFile
#define _MergeSTEPEntities_CartesianPointHasher_HeaderFile #define _StepTidy_CartesianPointHasher_HeaderFile
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
//! OCCT-style hasher for StepGeom_CartesianPoint entities. //! OCCT-style hasher for StepGeom_CartesianPoint entities.
struct MergeSTEPEntities_CartesianPointHasher struct StepTidy_CartesianPointHasher
{ {
// Hashes the Cartesian point by its name and coordinates. // Hashes the Cartesian point by its name and coordinates.
std::size_t operator()(const Handle(StepGeom_CartesianPoint)& theCartesianPoint) const noexcept std::size_t operator()(const Handle(StepGeom_CartesianPoint)& theCartesianPoint) const noexcept
@ -71,4 +71,4 @@ struct MergeSTEPEntities_CartesianPointHasher
} }
}; };
#endif // _MergeSTEPEntities_CartesianPointHasher_HeaderFile #endif // _StepTidy_CartesianPointHasher_HeaderFile

View File

@ -11,7 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <MergeSTEPEntities_CartesianPointProcessor.hxx> #include <StepTidy_CartesianPointReducer.pxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
@ -29,10 +29,9 @@
//================================================================================================== //==================================================================================================
MergeSTEPEntities_CartesianPointProcessor::MergeSTEPEntities_CartesianPointProcessor( StepTidy_CartesianPointReducer::StepTidy_CartesianPointReducer(
const Handle(XSControl_WorkSession)& theWS) const Handle(XSControl_WorkSession)& theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_CartesianPoint, : StepTidy_EntityReducer<StepGeom_CartesianPoint, StepTidy_CartesianPointHasher>(theWS)
MergeSTEPEntities_CartesianPointHasher>(theWS)
{ {
registerReplacer(STANDARD_TYPE(StepGeom_Axis1Placement), replaceAxis1Placement); registerReplacer(STANDARD_TYPE(StepGeom_Axis1Placement), replaceAxis1Placement);
registerReplacer(STANDARD_TYPE(StepGeom_Axis2Placement3d), replaceAxis2Placement3d); registerReplacer(STANDARD_TYPE(StepGeom_Axis2Placement3d), replaceAxis2Placement3d);
@ -53,7 +52,7 @@ MergeSTEPEntities_CartesianPointProcessor::MergeSTEPEntities_CartesianPointProce
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceAxis2Placement3d( bool StepTidy_CartesianPointReducer::replaceAxis2Placement3d(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -70,7 +69,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceAxis2Placement3d(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceVertexPoint( bool StepTidy_CartesianPointReducer::replaceVertexPoint(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -86,7 +85,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceVertexPoint(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceGeometricCurveSet( bool StepTidy_CartesianPointReducer::replaceGeometricCurveSet(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -107,7 +106,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceGeometricCurveSet(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replacePresentationLayerAssignment( bool StepTidy_CartesianPointReducer::replacePresentationLayerAssignment(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -129,7 +128,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replacePresentationLayerAssignme
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceStyledItem( bool StepTidy_CartesianPointReducer::replaceStyledItem(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -145,7 +144,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceStyledItem(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceBSplineCurveWithKnots( bool StepTidy_CartesianPointReducer::replaceBSplineCurveWithKnots(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -168,7 +167,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceBSplineCurveWithKnots(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceLine( bool StepTidy_CartesianPointReducer::replaceLine(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -184,7 +183,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceLine(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceBSplineSurfaceWithKnots( bool StepTidy_CartesianPointReducer::replaceBSplineSurfaceWithKnots(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -213,7 +212,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceBSplineSurfaceWithKnots(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceAxis1Placement( bool StepTidy_CartesianPointReducer::replaceAxis1Placement(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -229,7 +228,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceAxis1Placement(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceRepresentation( bool StepTidy_CartesianPointReducer::replaceRepresentation(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -251,7 +250,7 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceRepresentation(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor::replaceBSplineCurveWithKnotsAndRationalBSplineCurve( bool StepTidy_CartesianPointReducer::replaceBSplineCurveWithKnotsAndRationalBSplineCurve(
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -274,11 +273,10 @@ bool MergeSTEPEntities_CartesianPointProcessor::replaceBSplineCurveWithKnotsAndR
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CartesianPointProcessor:: bool StepTidy_CartesianPointReducer::replaceBSplineSurfaceWithKnotsAndRationalBSplineSurface(
replaceBSplineSurfaceWithKnotsAndRationalBSplineSurface( const Handle(StepGeom_CartesianPoint)& theOldEntity,
const Handle(StepGeom_CartesianPoint)& theOldEntity, const Handle(StepGeom_CartesianPoint)& theNewEntity,
const Handle(StepGeom_CartesianPoint)& theNewEntity, Handle(Standard_Transient) theSharing)
Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) aSharing = Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) aSharing =
Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)::DownCast(theSharing); Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)::DownCast(theSharing);

View File

@ -11,28 +11,26 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_CartesianPointProcessor_HeaderFile #ifndef _StepTidy_CartesianPointReducer_HeaderFile
#define _MergeSTEPEntities_CartesianPointProcessor_HeaderFile #define _StepTidy_CartesianPointReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_CartesianPointHasher.hxx> #include <StepTidy_CartesianPointHasher.pxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
//! Processor for merging StepGeom_CartesianPoint entities. //! Processor for merging StepGeom_CartesianPoint entities.
//! This processor is responsible for merging Cartesian points with the same coordinates and names. //! This processor is responsible for merging Cartesian points with the same coordinates and names.
//! It is used to remove duplicate Cartesian points from the STEP model. //! It is used to remove duplicate Cartesian points from the STEP model.
//! See MergeSTEPEntities_EntityProcessor for the description of the processor workflow. //! See StepTidy_EntityReducer for the description of the Reducer workflow.
class MergeSTEPEntities_CartesianPointProcessor class StepTidy_CartesianPointReducer
: public MergeSTEPEntities_EntityProcessor<StepGeom_CartesianPoint, : public StepTidy_EntityReducer<StepGeom_CartesianPoint, StepTidy_CartesianPointHasher>
MergeSTEPEntities_CartesianPointHasher>
{ {
public: public:
//! Constructor. Accepts a work session containing the model to process. //! Constructor. Accepts a work session containing the model to process.
//! Registers replacer functions for all supported sharing entities. //! Registers replacer functions for all supported sharing entities.
//! @param theWS Work session. //! @param theWS Work session.
Standard_EXPORT MergeSTEPEntities_CartesianPointProcessor( Standard_EXPORT StepTidy_CartesianPointReducer(const Handle(XSControl_WorkSession)& theWS);
const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replaces the old Cartesian point with the new Cartesian point in //! Replaces the old Cartesian point with the new Cartesian point in
@ -160,4 +158,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_CartesianPointProcessor_HeaderFile #endif // _StepTidy_CartesianPointReducer_HeaderFile

View File

@ -11,27 +11,27 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_CircleHasher_HeaderFile #ifndef _StepTidy_CircleHasher_HeaderFile
#define _MergeSTEPEntities_CircleHasher_HeaderFile #define _StepTidy_CircleHasher_HeaderFile
#include <MergeSTEPEntities_Axis2Placement2dHasher.hxx> #include <StepTidy_Axis2Placement2dHasher.pxx>
#include <MergeSTEPEntities_Axis2Placement3dHasher.hxx> #include <StepTidy_Axis2Placement3dHasher.pxx>
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Circle.hxx> #include <StepGeom_Circle.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
//! OCCT-style hasher for StepGeom_Circle entities. //! OCCT-style hasher for StepGeom_Circle entities.
struct MergeSTEPEntities_CircleHasher struct StepTidy_CircleHasher
{ {
//! Returns hash for a Circle entity. //! Returns hash for a Circle entity.
std::size_t operator()(const Handle(StepGeom_Circle)& theCircle) const noexcept std::size_t operator()(const Handle(StepGeom_Circle)& theCircle) const noexcept
{ {
const size_t aPositionHash = const size_t aPositionHash =
!theCircle->Position().Axis2Placement2d().IsNull() !theCircle->Position().Axis2Placement2d().IsNull()
? MergeSTEPEntities_Axis2Placement2dHasher{}(theCircle->Position().Axis2Placement2d()) ? StepTidy_Axis2Placement2dHasher{}(theCircle->Position().Axis2Placement2d())
: !theCircle->Position().Axis2Placement3d().IsNull() : !theCircle->Position().Axis2Placement3d().IsNull()
? MergeSTEPEntities_Axis2Placement3dHasher{}(theCircle->Position().Axis2Placement3d()) ? StepTidy_Axis2Placement3dHasher{}(theCircle->Position().Axis2Placement3d())
: opencascade::MurmurHash::optimalSeed(); : opencascade::MurmurHash::optimalSeed();
const size_t aRadiusHash = opencascade::hash(static_cast<int>(theCircle->Radius())); const size_t aRadiusHash = opencascade::hash(static_cast<int>(theCircle->Radius()));
@ -72,16 +72,16 @@ struct MergeSTEPEntities_CircleHasher
if (theCircle1->Position().CaseNumber() == 1) if (theCircle1->Position().CaseNumber() == 1)
{ {
if (!MergeSTEPEntities_Axis2Placement2dHasher{}(theCircle1->Position().Axis2Placement2d(), if (!StepTidy_Axis2Placement2dHasher{}(theCircle1->Position().Axis2Placement2d(),
theCircle2->Position().Axis2Placement2d())) theCircle2->Position().Axis2Placement2d()))
{ {
return false; return false;
} }
} }
else if (theCircle1->Position().CaseNumber() == 2) else if (theCircle1->Position().CaseNumber() == 2)
{ {
if (!MergeSTEPEntities_Axis2Placement3dHasher{}(theCircle1->Position().Axis2Placement3d(), if (!StepTidy_Axis2Placement3dHasher{}(theCircle1->Position().Axis2Placement3d(),
theCircle2->Position().Axis2Placement3d())) theCircle2->Position().Axis2Placement3d()))
{ {
return false; return false;
} }
@ -98,4 +98,4 @@ struct MergeSTEPEntities_CircleHasher
} }
}; };
#endif // _MergeSTEPEntities_CircleHasher_HeaderFile #endif // _StepTidy_CircleHasher_HeaderFile

View File

@ -11,20 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
// Copyright (c) 2025 OPEN CASCADE SAS #include <StepTidy_CircleReducer.pxx>
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MergeSTEPEntities_CircleProcessor.hxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <StepShape_EdgeCurve.hxx> #include <StepShape_EdgeCurve.hxx>
@ -33,9 +20,8 @@
//================================================================================================== //==================================================================================================
MergeSTEPEntities_CircleProcessor::MergeSTEPEntities_CircleProcessor( StepTidy_CircleReducer::StepTidy_CircleReducer(const Handle(XSControl_WorkSession)& theWS)
const Handle(XSControl_WorkSession)& theWS) : StepTidy_EntityReducer<StepGeom_Circle, StepTidy_CircleHasher>(theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_Circle, MergeSTEPEntities_CircleHasher>(theWS)
{ {
registerReplacer(STANDARD_TYPE(StepShape_EdgeCurve), replaceEdgeCurve); registerReplacer(STANDARD_TYPE(StepShape_EdgeCurve), replaceEdgeCurve);
registerReplacer(STANDARD_TYPE(StepGeom_SurfaceCurve), replaceSurfaceCurve); registerReplacer(STANDARD_TYPE(StepGeom_SurfaceCurve), replaceSurfaceCurve);
@ -44,10 +30,9 @@ MergeSTEPEntities_CircleProcessor::MergeSTEPEntities_CircleProcessor(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CircleProcessor::replaceEdgeCurve( bool StepTidy_CircleReducer::replaceEdgeCurve(const Handle(StepGeom_Circle)& theOldEntity,
const Handle(StepGeom_Circle)& theOldEntity, const Handle(StepGeom_Circle)& theNewEntity,
const Handle(StepGeom_Circle)& theNewEntity, Handle(Standard_Transient) theSharing)
Handle(Standard_Transient) theSharing)
{ {
Handle(StepShape_EdgeCurve) aSharing = Handle(StepShape_EdgeCurve)::DownCast(theSharing); Handle(StepShape_EdgeCurve) aSharing = Handle(StepShape_EdgeCurve)::DownCast(theSharing);
if (aSharing->EdgeGeometry() == theOldEntity) if (aSharing->EdgeGeometry() == theOldEntity)
@ -60,10 +45,9 @@ bool MergeSTEPEntities_CircleProcessor::replaceEdgeCurve(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CircleProcessor::replaceSurfaceCurve( bool StepTidy_CircleReducer::replaceSurfaceCurve(const Handle(StepGeom_Circle)& theOldEntity,
const Handle(StepGeom_Circle)& theOldEntity, const Handle(StepGeom_Circle)& theNewEntity,
const Handle(StepGeom_Circle)& theNewEntity, Handle(Standard_Transient) theSharing)
Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_SurfaceCurve) aSharing = Handle(StepGeom_SurfaceCurve)::DownCast(theSharing); Handle(StepGeom_SurfaceCurve) aSharing = Handle(StepGeom_SurfaceCurve)::DownCast(theSharing);
if (aSharing->Curve3d() == theOldEntity) if (aSharing->Curve3d() == theOldEntity)
@ -76,10 +60,9 @@ bool MergeSTEPEntities_CircleProcessor::replaceSurfaceCurve(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_CircleProcessor::replaceSeamCurve( bool StepTidy_CircleReducer::replaceSeamCurve(const Handle(StepGeom_Circle)& theOldEntity,
const Handle(StepGeom_Circle)& theOldEntity, const Handle(StepGeom_Circle)& theNewEntity,
const Handle(StepGeom_Circle)& theNewEntity, Handle(Standard_Transient) theSharing)
Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_SeamCurve) aSharing = Handle(StepGeom_SeamCurve)::DownCast(theSharing); Handle(StepGeom_SeamCurve) aSharing = Handle(StepGeom_SeamCurve)::DownCast(theSharing);
if (aSharing->Curve3d() == theOldEntity) if (aSharing->Curve3d() == theOldEntity)

View File

@ -11,23 +11,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_CircleProcessor_HeaderFile #ifndef _StepTidy_CircleReducer_HeaderFile
#define _MergeSTEPEntities_CircleProcessor_HeaderFile #define _StepTidy_CircleReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_CircleHasher.hxx> #include <StepTidy_CircleHasher.pxx>
#include <StepGeom_Circle.hxx> #include <StepGeom_Circle.hxx>
//! Processor for merging StepGeom_Circle entities. //! Processor for merging StepGeom_Circle entities.
//! This processor merges circles with the same position and radius and names. //! This processor merges circles with the same position and radius and names.
class MergeSTEPEntities_CircleProcessor class StepTidy_CircleReducer : public StepTidy_EntityReducer<StepGeom_Circle, StepTidy_CircleHasher>
: public MergeSTEPEntities_EntityProcessor<StepGeom_Circle, MergeSTEPEntities_CircleHasher>
{ {
public: public:
//! Constructor. Stores the work session and registers replacer functions. //! Constructor. Stores the work session and registers replacer functions.
//! @param theWS the work session. //! @param theWS the work session.
Standard_EXPORT MergeSTEPEntities_CircleProcessor(const Handle(XSControl_WorkSession)& theWS); Standard_EXPORT StepTidy_CircleReducer(const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replacer function for StepShape_EdgeCurve entities. //! Replacer function for StepShape_EdgeCurve entities.
@ -61,4 +60,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_CircleProcessor_HeaderFile #endif // _StepTidy_CircleReducer_HeaderFile

View File

@ -11,15 +11,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_DirectionHasher_HeaderFile #ifndef _StepTidy_DirectionHasher_HeaderFile
#define _MergeSTEPEntities_DirectionHasher_HeaderFile #define _StepTidy_DirectionHasher_HeaderFile
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Direction.hxx> #include <StepGeom_Direction.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
//! OCCT-style hasher for StepGeom_Direction entities. //! OCCT-style hasher for StepGeom_Direction entities.
struct MergeSTEPEntities_DirectionHasher struct StepTidy_DirectionHasher
{ {
// Hashes the direction by its name and direction ratios. // Hashes the direction by its name and direction ratios.
std::size_t operator()(const Handle(StepGeom_Direction)& theDirection) const noexcept std::size_t operator()(const Handle(StepGeom_Direction)& theDirection) const noexcept
@ -75,4 +75,4 @@ struct MergeSTEPEntities_DirectionHasher
} }
}; };
#endif // _MergeSTEPEntities_DirectionHasher_HeaderFile #endif // _StepTidy_DirectionHasher_HeaderFile

View File

@ -11,20 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
// Copyright (c) 2025 OPEN CASCADE SAS #include <StepTidy_DirectionReducer.pxx>
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MergeSTEPEntities_DirectionProcessor.hxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
@ -33,10 +20,8 @@
//================================================================================================== //==================================================================================================
MergeSTEPEntities_DirectionProcessor::MergeSTEPEntities_DirectionProcessor( StepTidy_DirectionReducer::StepTidy_DirectionReducer(const Handle(XSControl_WorkSession)& theWS)
const Handle(XSControl_WorkSession)& theWS) : StepTidy_EntityReducer<StepGeom_Direction, StepTidy_DirectionHasher>(theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_Direction, MergeSTEPEntities_DirectionHasher>(
theWS)
{ {
registerReplacer(STANDARD_TYPE(StepGeom_Axis1Placement), replaceAxis1Placement); registerReplacer(STANDARD_TYPE(StepGeom_Axis1Placement), replaceAxis1Placement);
registerReplacer(STANDARD_TYPE(StepGeom_Axis2Placement3d), replaceAxis2Placement3d); registerReplacer(STANDARD_TYPE(StepGeom_Axis2Placement3d), replaceAxis2Placement3d);
@ -45,7 +30,7 @@ MergeSTEPEntities_DirectionProcessor::MergeSTEPEntities_DirectionProcessor(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_DirectionProcessor::replaceAxis1Placement( bool StepTidy_DirectionReducer::replaceAxis1Placement(
const Handle(StepGeom_Direction)& theOldEntity, const Handle(StepGeom_Direction)& theOldEntity,
const Handle(StepGeom_Direction)& theNewEntity, const Handle(StepGeom_Direction)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -61,7 +46,7 @@ bool MergeSTEPEntities_DirectionProcessor::replaceAxis1Placement(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_DirectionProcessor::replaceAxis2Placement3d( bool StepTidy_DirectionReducer::replaceAxis2Placement3d(
const Handle(StepGeom_Direction)& theOldEntity, const Handle(StepGeom_Direction)& theOldEntity,
const Handle(StepGeom_Direction)& theNewEntity, const Handle(StepGeom_Direction)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -83,10 +68,9 @@ bool MergeSTEPEntities_DirectionProcessor::replaceAxis2Placement3d(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_DirectionProcessor::replaceVector( bool StepTidy_DirectionReducer::replaceVector(const Handle(StepGeom_Direction)& theOldEntity,
const Handle(StepGeom_Direction)& theOldEntity, const Handle(StepGeom_Direction)& theNewEntity,
const Handle(StepGeom_Direction)& theNewEntity, Handle(Standard_Transient) theSharing)
Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_Vector) aSharing = Handle(StepGeom_Vector)::DownCast(theSharing); Handle(StepGeom_Vector) aSharing = Handle(StepGeom_Vector)::DownCast(theSharing);
if (aSharing->Orientation() == theOldEntity) if (aSharing->Orientation() == theOldEntity)

View File

@ -11,11 +11,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_DirectionProcessor_HeaderFile #ifndef _StepTidy_DirectionReducer_HeaderFile
#define _MergeSTEPEntities_DirectionProcessor_HeaderFile #define _StepTidy_DirectionReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_DirectionHasher.hxx> #include <StepTidy_DirectionHasher.pxx>
#include <StepGeom_Direction.hxx> #include <StepGeom_Direction.hxx>
@ -23,15 +23,14 @@
//! This processor merges directions with the same direction ratios and names. //! This processor merges directions with the same direction ratios and names.
//! The processor replaces all occurrences of the old directions with the new ones. //! The processor replaces all occurrences of the old directions with the new ones.
//! The processor does not remove old directions from the model. //! The processor does not remove old directions from the model.
//! See MergeSTEPEntities_EntityProcessor for the description of the processor workflow. //! See StepTidy_EntityReducer for the description of the Reducer workflow.
class MergeSTEPEntities_DirectionProcessor class StepTidy_DirectionReducer
: public MergeSTEPEntities_EntityProcessor<StepGeom_Direction, : public StepTidy_EntityReducer<StepGeom_Direction, StepTidy_DirectionHasher>
MergeSTEPEntities_DirectionHasher>
{ {
public: public:
//! Constructor. Stores the work session and registers replacer functions. //! Constructor. Stores the work session and registers replacer functions.
//! @param theWS the work session. //! @param theWS the work session.
Standard_EXPORT MergeSTEPEntities_DirectionProcessor(const Handle(XSControl_WorkSession)& theWS); Standard_EXPORT StepTidy_DirectionReducer(const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replaces the old direction with the new one in the StepGeom_Axis1Placement entity. //! Replaces the old direction with the new one in the StepGeom_Axis1Placement entity.
@ -62,4 +61,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_DirectionProcessor_HeaderFile #endif // _StepTidy_DirectionReducer_HeaderFile

View File

@ -11,29 +11,29 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <MergeSTEPEntities_Merger.hxx> #include <StepTidy_DuplicateCleaner.hxx>
#include <Interface_EntityIterator.hxx> #include <Interface_EntityIterator.hxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <MergeSTEPEntities_Axis2Placement3dProcessor.hxx> #include <StepTidy_Axis2Placement3dReducer.pxx>
#include <MergeSTEPEntities_CartesianPointProcessor.hxx> #include <StepTidy_CartesianPointReducer.pxx>
#include <MergeSTEPEntities_DirectionProcessor.hxx> #include <StepTidy_DirectionReducer.pxx>
#include <MergeSTEPEntities_LineProcessor.hxx> #include <StepTidy_LineReducer.pxx>
#include <MergeSTEPEntities_VectorProcessor.hxx> #include <StepTidy_VectorReducer.pxx>
#include <MergeSTEPEntities_PlaneProcessor.hxx> #include <StepTidy_PlaneReducer.pxx>
#include <MergeSTEPEntities_CircleProcessor.hxx> #include <StepTidy_CircleReducer.pxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
//================================================================================================== //==================================================================================================
MergeSTEPEntities_Merger::MergeSTEPEntities_Merger(Handle(XSControl_WorkSession) theWS) StepTidy_DuplicateCleaner::StepTidy_DuplicateCleaner(Handle(XSControl_WorkSession) theWS)
: myWS(theWS) : myWS(theWS)
{ {
} }
//================================================================================================== //==================================================================================================
void MergeSTEPEntities_Merger::Perform() void StepTidy_DuplicateCleaner::Perform()
{ {
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWS->Model()); Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWS->Model());
if (aModel.IsNull()) if (aModel.IsNull())
@ -41,37 +41,37 @@ void MergeSTEPEntities_Merger::Perform()
return; return;
} }
//! Initialize processors. //! Initialize Reducers.
MergeSTEPEntities_CartesianPointProcessor aCartesianPointProcessor(myWS); StepTidy_CartesianPointReducer aCartesianPointReducer(myWS);
MergeSTEPEntities_DirectionProcessor aDirectionProcessor(myWS); StepTidy_DirectionReducer aDirectionReducer(myWS);
MergeSTEPEntities_Axis2Placement3dProcessor aAxis2Placement3dProcessor(myWS); StepTidy_Axis2Placement3dReducer aAxis2Placement3dReducer(myWS);
MergeSTEPEntities_VectorProcessor aVectorProcessor(myWS); StepTidy_VectorReducer aVectorReducer(myWS);
MergeSTEPEntities_LineProcessor aLineProcessor(myWS); StepTidy_LineReducer aLineReducer(myWS);
MergeSTEPEntities_PlaneProcessor aPlaneProcessor(myWS); StepTidy_PlaneReducer aPlaneReducer(myWS);
MergeSTEPEntities_CircleProcessor aCircleProcessor(myWS); StepTidy_CircleReducer aCircleReducer(myWS);
// Process all entities. // Process all entities.
for (Standard_Integer anIndex = 1; anIndex <= aModel->NbEntities(); ++anIndex) for (Standard_Integer anIndex = 1; anIndex <= aModel->NbEntities(); ++anIndex)
{ {
const Handle(Standard_Transient) anEntity = aModel->Value(anIndex); const Handle(Standard_Transient) anEntity = aModel->Value(anIndex);
aCartesianPointProcessor.ProcessEntity(anEntity); aCartesianPointReducer.ProcessEntity(anEntity);
aDirectionProcessor.ProcessEntity(anEntity); aDirectionReducer.ProcessEntity(anEntity);
aAxis2Placement3dProcessor.ProcessEntity(anEntity); aAxis2Placement3dReducer.ProcessEntity(anEntity);
aVectorProcessor.ProcessEntity(anEntity); aVectorReducer.ProcessEntity(anEntity);
aLineProcessor.ProcessEntity(anEntity); aLineReducer.ProcessEntity(anEntity);
aPlaneProcessor.ProcessEntity(anEntity); aPlaneReducer.ProcessEntity(anEntity);
aCircleProcessor.ProcessEntity(anEntity); aCircleReducer.ProcessEntity(anEntity);
} }
// Perform replacement of duplicate entities. // Perform replacement of duplicate entities.
TColStd_MapOfTransient aReplacedEntities; TColStd_MapOfTransient aReplacedEntities;
aCartesianPointProcessor.Perform(aReplacedEntities); aCartesianPointReducer.Perform(aReplacedEntities);
aDirectionProcessor.Perform(aReplacedEntities); aDirectionReducer.Perform(aReplacedEntities);
aAxis2Placement3dProcessor.Perform(aReplacedEntities); aAxis2Placement3dReducer.Perform(aReplacedEntities);
aVectorProcessor.Perform(aReplacedEntities); aVectorReducer.Perform(aReplacedEntities);
aLineProcessor.Perform(aReplacedEntities); aLineReducer.Perform(aReplacedEntities);
aPlaneProcessor.Perform(aReplacedEntities); aPlaneReducer.Perform(aReplacedEntities);
aCircleProcessor.Perform(aReplacedEntities); aCircleReducer.Perform(aReplacedEntities);
// Remove duplicate entities. // Remove duplicate entities.
removeEntities(aReplacedEntities); removeEntities(aReplacedEntities);
@ -79,7 +79,7 @@ void MergeSTEPEntities_Merger::Perform()
//================================================================================================== //==================================================================================================
void MergeSTEPEntities_Merger::removeEntities(const TColStd_MapOfTransient& theToRemove) void StepTidy_DuplicateCleaner::removeEntities(const TColStd_MapOfTransient& theToRemove)
{ {
if (theToRemove.IsEmpty()) if (theToRemove.IsEmpty())
{ {

View File

@ -0,0 +1,62 @@
// Copyright (c) 2025 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepTidy_DuplicateCleaner_HeaderFile
#define _StepTidy_DuplicateCleaner_HeaderFile
#include <TColStd_MapOfTransient.hxx>
class XSControl_WorkSession;
//! A class to merge STEP entities.
//! This class is used to merge equal STEP entities in the work session and remove duplicates.
//! It uses the child classes of StepTidy_EntityReducer class to perform the merging.
//! The child classes of StepTidy_EntityReducer are specialized for different types of entities.
//! StepTidy_EntityReducer implements the basic logic for searching and merging entities
//! while child classes implement the logic for replacing specific type of entities in the specific
//! type of sharing entities.
//! Classes StepTidy_*Hasher are used to hash the entities and compare them. They define which
//! entities are considered equal to each other. The hashers are used in the StepTidy_EntityReducer
//! class to store the entities in a map. The map is used to find the duplicates and replace them.
//! From this perspective of this module, 'equal' or 'duplicate' entities are those that
//! has equal names and very close numerical values, like for example Cartesian points with
//! coordinates that are equal up to 1e-12 or Vectors with equal orientations and magnitudes
//! up to 1e-12.
//! After the merging this class calls its own method to remove the duplicates.
//! How to use:
//! 1. Create an instance of the class by providing a pointer to the work session where the
//! entities to process are stored.
//! 2. Call Perform() method to perform the merging of entities. After this call all entities
//! that are considered equal to each other will be merged, and duplicates will be removed.
class StepTidy_DuplicateCleaner
{
public:
//! Constructor.
//! @param theWS the work session to merge entities in.
Standard_EXPORT StepTidy_DuplicateCleaner(Handle(XSControl_WorkSession) theWS);
//! Perform the merging of entities.
//! All entities in a model stored in the provided work session that are considered equal to
//! each other will be merged, and duplicates will be removed.
Standard_EXPORT void Perform();
private:
//! Remove entities from the work session.
//! @param theToRemove the entities to remove.
void removeEntities(const TColStd_MapOfTransient& theToRemove);
private:
Handle(XSControl_WorkSession) myWS; //!< The work session containing the model with entities.
};
#endif // _StepTidy_DuplicateCleaner_HeaderFile

View File

@ -11,8 +11,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_EntityProcessor_HeaderFile #ifndef _StepTidy_EntityReducer_HeaderFile
#define _MergeSTEPEntities_EntityProcessor_HeaderFile #define _StepTidy_EntityReducer_HeaderFile
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <NCollection_Allocator.hxx> #include <NCollection_Allocator.hxx>
@ -40,7 +40,7 @@
//! @tparam ProcessedType Type of the processed entities. //! @tparam ProcessedType Type of the processed entities.
//! @tparam ProcessedTypeHasher OCCT-Style hasher for the processed entities. //! @tparam ProcessedTypeHasher OCCT-Style hasher for the processed entities.
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
class MergeSTEPEntities_EntityProcessor class StepTidy_EntityReducer
{ {
protected: protected:
// Map of duplicate entities. Key is the first processed entity, value is a list of duplicates. // Map of duplicate entities. Key is the first processed entity, value is a list of duplicates.
@ -62,7 +62,7 @@ protected:
//! Protected to prevent direct instantiation of the base class. Only child classes should be //! Protected to prevent direct instantiation of the base class. Only child classes should be
//! allowed to instantiate. //! allowed to instantiate.
//! @param theWS Work session. //! @param theWS Work session.
MergeSTEPEntities_EntityProcessor(const Handle(XSControl_WorkSession)& theWS); StepTidy_EntityReducer(const Handle(XSControl_WorkSession)& theWS);
public: public:
//! Function to process an entity. If the entity can be merged, it will be stored in the internal //! Function to process an entity. If the entity can be merged, it will be stored in the internal
@ -116,8 +116,8 @@ private:
//================================================================================================== //==================================================================================================
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>:: StepTidy_EntityReducer<ProcessedType, ProcessedTypeHasher>::StepTidy_EntityReducer(
MergeSTEPEntities_EntityProcessor(const Handle(XSControl_WorkSession)& theWS) const Handle(XSControl_WorkSession)& theWS)
: myWS(theWS), : myWS(theWS),
myReplacerMap(), myReplacerMap(),
myDuplicateMap() myDuplicateMap()
@ -127,7 +127,7 @@ MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::
//================================================================================================== //==================================================================================================
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
bool MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::ProcessEntity( bool StepTidy_EntityReducer<ProcessedType, ProcessedTypeHasher>::ProcessEntity(
const Handle(Standard_Transient)& theEntity) const Handle(Standard_Transient)& theEntity)
{ {
const Handle(ProcessedType) anEntity = Handle(ProcessedType)::DownCast(theEntity); const Handle(ProcessedType) anEntity = Handle(ProcessedType)::DownCast(theEntity);
@ -158,7 +158,7 @@ bool MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::Proc
//================================================================================================== //==================================================================================================
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
void MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::Perform( void StepTidy_EntityReducer<ProcessedType, ProcessedTypeHasher>::Perform(
TColStd_MapOfTransient& theReplacedEntities) TColStd_MapOfTransient& theReplacedEntities)
{ {
for (typename DuplicateMap::Iterator anIter(myDuplicateMap); anIter.More(); anIter.Next()) for (typename DuplicateMap::Iterator anIter(myDuplicateMap); anIter.More(); anIter.Next())
@ -190,7 +190,7 @@ void MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::Perf
//================================================================================================== //==================================================================================================
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
void MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::registerReplacer( void StepTidy_EntityReducer<ProcessedType, ProcessedTypeHasher>::registerReplacer(
const Handle(Standard_Type)& theType, const Handle(Standard_Type)& theType,
const ReplacerFunction& theReplacer) const ReplacerFunction& theReplacer)
{ {
@ -200,7 +200,7 @@ void MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::regi
//================================================================================================== //==================================================================================================
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
bool MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::hasAllReplacers( bool StepTidy_EntityReducer<ProcessedType, ProcessedTypeHasher>::hasAllReplacers(
const Handle(TColStd_HSequenceOfTransient)& theSharings) const const Handle(TColStd_HSequenceOfTransient)& theSharings) const
{ {
if (theSharings.IsNull()) if (theSharings.IsNull())
@ -216,7 +216,7 @@ bool MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::hasA
//================================================================================================== //==================================================================================================
template <typename ProcessedType, typename ProcessedTypeHasher> template <typename ProcessedType, typename ProcessedTypeHasher>
bool MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::replaceInSharings( bool StepTidy_EntityReducer<ProcessedType, ProcessedTypeHasher>::replaceInSharings(
const Handle(ProcessedType)& theOldEntity, const Handle(ProcessedType)& theOldEntity,
const Handle(ProcessedType)& theNewEntity, const Handle(ProcessedType)& theNewEntity,
const Handle(TColStd_HSequenceOfTransient)& theSharings) const const Handle(TColStd_HSequenceOfTransient)& theSharings) const
@ -238,4 +238,4 @@ bool MergeSTEPEntities_EntityProcessor<ProcessedType, ProcessedTypeHasher>::repl
return isAllReplaced; return isAllReplaced;
} }
#endif // _MergeSTEPEntities_EntityProcessor_HeaderFile #endif // _StepTidy_EntityReducer_HeaderFile

View File

@ -11,24 +11,24 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_LineHasher_HeaderFile #ifndef _StepTidy_LineHasher_HeaderFile
#define _MergeSTEPEntities_LineHasher_HeaderFile #define _StepTidy_LineHasher_HeaderFile
#include <MergeSTEPEntities_CartesianPointHasher.hxx> #include <StepTidy_CartesianPointHasher.pxx>
#include <MergeSTEPEntities_VectorHasher.hxx> #include <StepTidy_VectorHasher.pxx>
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Line.hxx> #include <StepGeom_Line.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
//! OCCT-style hasher for StepGeom_Line entities. //! OCCT-style hasher for StepGeom_Line entities.
struct MergeSTEPEntities_LineHasher struct StepTidy_LineHasher
{ {
// Hashes the Line by its name and Line ratios. // Hashes the Line by its name and Line ratios.
std::size_t operator()(const Handle(StepGeom_Line)& theLine) const noexcept std::size_t operator()(const Handle(StepGeom_Line)& theLine) const noexcept
{ {
const size_t aHashes[2]{MergeSTEPEntities_CartesianPointHasher{}(theLine->Pnt()), const size_t aHashes[2]{StepTidy_CartesianPointHasher{}(theLine->Pnt()),
MergeSTEPEntities_VectorHasher{}(theLine->Dir())}; StepTidy_VectorHasher{}(theLine->Dir())};
const size_t aCombinedHash = opencascade::hashBytes(aHashes, sizeof(aHashes)); const size_t aCombinedHash = opencascade::hashBytes(aHashes, sizeof(aHashes));
if (theLine->Name().IsNull()) if (theLine->Name().IsNull())
@ -59,13 +59,13 @@ struct MergeSTEPEntities_LineHasher
} }
// Compare points. // Compare points.
if (!MergeSTEPEntities_CartesianPointHasher{}(theLine1->Pnt(), theLine2->Pnt())) if (!StepTidy_CartesianPointHasher{}(theLine1->Pnt(), theLine2->Pnt()))
{ {
return false; return false;
} }
// Compare directions. // Compare directions.
if (!MergeSTEPEntities_VectorHasher{}(theLine1->Dir(), theLine2->Dir())) if (!StepTidy_VectorHasher{}(theLine1->Dir(), theLine2->Dir()))
{ {
return false; return false;
} }
@ -74,4 +74,4 @@ struct MergeSTEPEntities_LineHasher
} }
}; };
#endif // _MergeSTEPEntities_LineHasher_HeaderFile #endif // _StepTidy_LineHasher_HeaderFile

View File

@ -11,20 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
// Copyright (c) 2025 OPEN CASCADE SAS #include <StepTidy_LineReducer.pxx>
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MergeSTEPEntities_LineProcessor.hxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <StepShape_EdgeCurve.hxx> #include <StepShape_EdgeCurve.hxx>
@ -35,9 +22,8 @@
//================================================================================================== //==================================================================================================
MergeSTEPEntities_LineProcessor::MergeSTEPEntities_LineProcessor( StepTidy_LineReducer::StepTidy_LineReducer(const Handle(XSControl_WorkSession)& theWS)
const Handle(XSControl_WorkSession)& theWS) : StepTidy_EntityReducer<StepGeom_Line, StepTidy_LineHasher>(theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_Line, MergeSTEPEntities_LineHasher>(theWS)
{ {
registerReplacer(STANDARD_TYPE(StepShape_EdgeCurve), replaceEdgeCurve); registerReplacer(STANDARD_TYPE(StepShape_EdgeCurve), replaceEdgeCurve);
registerReplacer(STANDARD_TYPE(StepGeom_TrimmedCurve), replaceTrimmedCurve); registerReplacer(STANDARD_TYPE(StepGeom_TrimmedCurve), replaceTrimmedCurve);
@ -49,9 +35,9 @@ MergeSTEPEntities_LineProcessor::MergeSTEPEntities_LineProcessor(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_LineProcessor::replaceEdgeCurve(const Handle(StepGeom_Line)& theOldEntity, bool StepTidy_LineReducer::replaceEdgeCurve(const Handle(StepGeom_Line)& theOldEntity,
const Handle(StepGeom_Line)& theNewEntity, const Handle(StepGeom_Line)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
{ {
Handle(StepShape_EdgeCurve) aSharing = Handle(StepShape_EdgeCurve)::DownCast(theSharing); Handle(StepShape_EdgeCurve) aSharing = Handle(StepShape_EdgeCurve)::DownCast(theSharing);
if (aSharing->EdgeGeometry() == theOldEntity) if (aSharing->EdgeGeometry() == theOldEntity)
@ -64,9 +50,9 @@ bool MergeSTEPEntities_LineProcessor::replaceEdgeCurve(const Handle(StepGeom_Lin
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_LineProcessor::replaceTrimmedCurve(const Handle(StepGeom_Line)& theOldEntity, bool StepTidy_LineReducer::replaceTrimmedCurve(const Handle(StepGeom_Line)& theOldEntity,
const Handle(StepGeom_Line)& theNewEntity, const Handle(StepGeom_Line)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_TrimmedCurve) aSharing = Handle(StepGeom_TrimmedCurve)::DownCast(theSharing); Handle(StepGeom_TrimmedCurve) aSharing = Handle(StepGeom_TrimmedCurve)::DownCast(theSharing);
if (aSharing->BasisCurve() == theOldEntity) if (aSharing->BasisCurve() == theOldEntity)
@ -79,9 +65,9 @@ bool MergeSTEPEntities_LineProcessor::replaceTrimmedCurve(const Handle(StepGeom_
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_LineProcessor::replaceSurfaceCurve(const Handle(StepGeom_Line)& theOldEntity, bool StepTidy_LineReducer::replaceSurfaceCurve(const Handle(StepGeom_Line)& theOldEntity,
const Handle(StepGeom_Line)& theNewEntity, const Handle(StepGeom_Line)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_SurfaceCurve) aSharing = Handle(StepGeom_SurfaceCurve)::DownCast(theSharing); Handle(StepGeom_SurfaceCurve) aSharing = Handle(StepGeom_SurfaceCurve)::DownCast(theSharing);
if (aSharing->Curve3d() == theOldEntity) if (aSharing->Curve3d() == theOldEntity)
@ -94,7 +80,7 @@ bool MergeSTEPEntities_LineProcessor::replaceSurfaceCurve(const Handle(StepGeom_
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_LineProcessor::replaceDefinitionalRepresentation( bool StepTidy_LineReducer::replaceDefinitionalRepresentation(
const Handle(StepGeom_Line)& theOldEntity, const Handle(StepGeom_Line)& theOldEntity,
const Handle(StepGeom_Line)& theNewEntity, const Handle(StepGeom_Line)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
@ -117,9 +103,9 @@ bool MergeSTEPEntities_LineProcessor::replaceDefinitionalRepresentation(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_LineProcessor::replaceSeamCurve(const Handle(StepGeom_Line)& theOldEntity, bool StepTidy_LineReducer::replaceSeamCurve(const Handle(StepGeom_Line)& theOldEntity,
const Handle(StepGeom_Line)& theNewEntity, const Handle(StepGeom_Line)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_SeamCurve) aSharing = Handle(StepGeom_SeamCurve)::DownCast(theSharing); Handle(StepGeom_SeamCurve) aSharing = Handle(StepGeom_SeamCurve)::DownCast(theSharing);
if (aSharing->Curve3d() == theOldEntity) if (aSharing->Curve3d() == theOldEntity)

View File

@ -11,23 +11,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_LineProcessor_HeaderFile #ifndef _StepTidy_LineReducer_HeaderFile
#define _MergeSTEPEntities_LineProcessor_HeaderFile #define _StepTidy_LineReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_LineHasher.hxx> #include <StepTidy_LineHasher.pxx>
#include <StepGeom_Line.hxx> #include <StepGeom_Line.hxx>
//! Processor for merging StepGeom_Line entities. //! Processor for merging StepGeom_Line entities.
//! This processor merges lines with the same point and direction and names. //! This processor merges lines with the same point and direction and names.
class MergeSTEPEntities_LineProcessor class StepTidy_LineReducer : public StepTidy_EntityReducer<StepGeom_Line, StepTidy_LineHasher>
: public MergeSTEPEntities_EntityProcessor<StepGeom_Line, MergeSTEPEntities_LineHasher>
{ {
public: public:
//! Constructor. Stores the work session and registers replacer functions. //! Constructor. Stores the work session and registers replacer functions.
//! @param theWS the work session. //! @param theWS the work session.
Standard_EXPORT MergeSTEPEntities_LineProcessor(const Handle(XSControl_WorkSession)& theWS); Standard_EXPORT StepTidy_LineReducer(const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replacer function for StepShape_EdgeCurve entities. //! Replacer function for StepShape_EdgeCurve entities.
@ -81,4 +80,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_LineProcessor_HeaderFile #endif // _StepTidy_LineReducer_HeaderFile

View File

@ -11,21 +11,21 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_PlaneHasher_HeaderFile #ifndef _StepTidy_PlaneHasher_HeaderFile
#define _MergeSTEPEntities_PlaneHasher_HeaderFile #define _StepTidy_PlaneHasher_HeaderFile
#include <MergeSTEPEntities_Axis2Placement3dHasher.hxx> #include <StepTidy_Axis2Placement3dHasher.pxx>
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Plane.hxx> #include <StepGeom_Plane.hxx>
//! OCCT-style hasher for StepGeom_Plane entities. //! OCCT-style hasher for StepGeom_Plane entities.
struct MergeSTEPEntities_PlaneHasher struct StepTidy_PlaneHasher
{ {
// Hashes the axis Planes. // Hashes the axis Planes.
std::size_t operator()(const Handle(StepGeom_Plane)& thePlane) const noexcept std::size_t operator()(const Handle(StepGeom_Plane)& thePlane) const noexcept
{ {
const size_t aHash = MergeSTEPEntities_Axis2Placement3dHasher{}(thePlane->Position()); const size_t aHash = StepTidy_Axis2Placement3dHasher{}(thePlane->Position());
if (thePlane->Name().IsNull()) if (thePlane->Name().IsNull())
{ {
// If the name is not present, return the hash. // If the name is not present, return the hash.
@ -53,8 +53,8 @@ struct MergeSTEPEntities_PlaneHasher
} }
// Compare axis Planes. // Compare axis Planes.
return MergeSTEPEntities_Axis2Placement3dHasher{}(thePlane1->Position(), thePlane2->Position()); return StepTidy_Axis2Placement3dHasher{}(thePlane1->Position(), thePlane2->Position());
} }
}; };
#endif // _MergeSTEPEntities_PlaneHasher_HeaderFile #endif // _StepTidy_PlaneHasher_HeaderFile

View File

@ -11,16 +11,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <MergeSTEPEntities_PlaneProcessor.hxx> #include <StepTidy_PlaneReducer.pxx>
#include <StepShape_AdvancedFace.hxx> #include <StepShape_AdvancedFace.hxx>
#include <StepGeom_Pcurve.hxx> #include <StepGeom_Pcurve.hxx>
//================================================================================================== //==================================================================================================
MergeSTEPEntities_PlaneProcessor::MergeSTEPEntities_PlaneProcessor( StepTidy_PlaneReducer::StepTidy_PlaneReducer(const Handle(XSControl_WorkSession)& theWS)
const Handle(XSControl_WorkSession)& theWS) : StepTidy_EntityReducer<StepGeom_Plane, StepTidy_PlaneHasher>(theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_Plane, MergeSTEPEntities_PlaneHasher>(theWS)
{ {
registerReplacer(STANDARD_TYPE(StepShape_AdvancedFace), replaceAdvancedFace); registerReplacer(STANDARD_TYPE(StepShape_AdvancedFace), replaceAdvancedFace);
registerReplacer(STANDARD_TYPE(StepGeom_Pcurve), replacePcurve); registerReplacer(STANDARD_TYPE(StepGeom_Pcurve), replacePcurve);
@ -28,10 +27,9 @@ MergeSTEPEntities_PlaneProcessor::MergeSTEPEntities_PlaneProcessor(
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_PlaneProcessor::replaceAdvancedFace( bool StepTidy_PlaneReducer::replaceAdvancedFace(const Handle(StepGeom_Plane)& theOldEntity,
const Handle(StepGeom_Plane)& theOldEntity, const Handle(StepGeom_Plane)& theNewEntity,
const Handle(StepGeom_Plane)& theNewEntity, Handle(Standard_Transient) theSharing)
Handle(Standard_Transient) theSharing)
{ {
Handle(StepShape_AdvancedFace) aSharing = Handle(StepShape_AdvancedFace)::DownCast(theSharing); Handle(StepShape_AdvancedFace) aSharing = Handle(StepShape_AdvancedFace)::DownCast(theSharing);
if (aSharing->FaceGeometry() == theOldEntity) if (aSharing->FaceGeometry() == theOldEntity)
@ -43,9 +41,9 @@ bool MergeSTEPEntities_PlaneProcessor::replaceAdvancedFace(
} }
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_PlaneProcessor::replacePcurve(const Handle(StepGeom_Plane)& theOldEntity, bool StepTidy_PlaneReducer::replacePcurve(const Handle(StepGeom_Plane)& theOldEntity,
const Handle(StepGeom_Plane)& theNewEntity, const Handle(StepGeom_Plane)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_Pcurve) aSharing = Handle(StepGeom_Pcurve)::DownCast(theSharing); Handle(StepGeom_Pcurve) aSharing = Handle(StepGeom_Pcurve)::DownCast(theSharing);
if (aSharing->BasisSurface() == theOldEntity) if (aSharing->BasisSurface() == theOldEntity)

View File

@ -11,23 +11,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_PlaneProcessor_HeaderFile #ifndef _StepTidy_PlaneReducer_HeaderFile
#define _MergeSTEPEntities_PlaneProcessor_HeaderFile #define _StepTidy_PlaneReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_PlaneHasher.hxx> #include <StepTidy_PlaneHasher.pxx>
#include <StepGeom_Plane.hxx> #include <StepGeom_Plane.hxx>
//! Processor for merging StepGeom_Plane entities. //! Processor for merging StepGeom_Plane entities.
//! This processor merges planes with the same names and placements. //! This processor merges planes with the same names and placements.
class MergeSTEPEntities_PlaneProcessor class StepTidy_PlaneReducer : public StepTidy_EntityReducer<StepGeom_Plane, StepTidy_PlaneHasher>
: public MergeSTEPEntities_EntityProcessor<StepGeom_Plane, MergeSTEPEntities_PlaneHasher>
{ {
public: public:
//! Constructor. Stores the work session and registers replacer functions. //! Constructor. Stores the work session and registers replacer functions.
//! @param theWS the work session. //! @param theWS the work session.
Standard_EXPORT MergeSTEPEntities_PlaneProcessor(const Handle(XSControl_WorkSession)& theWS); Standard_EXPORT StepTidy_PlaneReducer(const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replacer function for StepShape_AdvancedFace entities. //! Replacer function for StepShape_AdvancedFace entities.
@ -51,4 +50,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_DirectionProcessor_HeaderFile #endif // _StepTidy_DirectionReducer_HeaderFile

View File

@ -11,22 +11,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_VectorHasher_HeaderFile #ifndef _StepTidy_VectorHasher_HeaderFile
#define _MergeSTEPEntities_VectorHasher_HeaderFile #define _StepTidy_VectorHasher_HeaderFile
#include <MergeSTEPEntities_DirectionHasher.hxx> #include <StepTidy_DirectionHasher.pxx>
#include <Standard_HashUtils.hxx> #include <Standard_HashUtils.hxx>
#include <StepGeom_Vector.hxx> #include <StepGeom_Vector.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
//! OCCT-style hasher for StepGeom_Vector entities. //! OCCT-style hasher for StepGeom_Vector entities.
struct MergeSTEPEntities_VectorHasher struct StepTidy_VectorHasher
{ {
// Hashes the Vector by its name and Vector ratios. // Hashes the Vector by its name and Vector ratios.
std::size_t operator()(const Handle(StepGeom_Vector)& theVector) const noexcept std::size_t operator()(const Handle(StepGeom_Vector)& theVector) const noexcept
{ {
const size_t aHashes[2]{MergeSTEPEntities_DirectionHasher{}(theVector->Orientation()), const size_t aHashes[2]{StepTidy_DirectionHasher{}(theVector->Orientation()),
opencascade::hash(static_cast<int>(theVector->Magnitude()))}; opencascade::hash(static_cast<int>(theVector->Magnitude()))};
const size_t aCombinedHash = opencascade::hashBytes(aHashes, sizeof(aHashes)); const size_t aCombinedHash = opencascade::hashBytes(aHashes, sizeof(aHashes));
if (theVector->Name().IsNull()) if (theVector->Name().IsNull())
@ -63,9 +63,8 @@ struct MergeSTEPEntities_VectorHasher
} }
// Compare orientations. // Compare orientations.
return MergeSTEPEntities_DirectionHasher{}(theVector1->Orientation(), return StepTidy_DirectionHasher{}(theVector1->Orientation(), theVector2->Orientation());
theVector2->Orientation());
} }
}; };
#endif // _MergeSTEPEntities_VectorHasher_HeaderFile #endif // _StepTidy_VectorHasher_HeaderFile

View File

@ -11,20 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
// Copyright (c) 2025 OPEN CASCADE SAS #include <StepTidy_VectorReducer.pxx>
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MergeSTEPEntities_VectorProcessor.hxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <StepGeom_Line.hxx> #include <StepGeom_Line.hxx>
@ -32,18 +19,17 @@
//================================================================================================== //==================================================================================================
MergeSTEPEntities_VectorProcessor::MergeSTEPEntities_VectorProcessor( StepTidy_VectorReducer::StepTidy_VectorReducer(const Handle(XSControl_WorkSession)& theWS)
const Handle(XSControl_WorkSession)& theWS) : StepTidy_EntityReducer<StepGeom_Vector, StepTidy_VectorHasher>(theWS)
: MergeSTEPEntities_EntityProcessor<StepGeom_Vector, MergeSTEPEntities_VectorHasher>(theWS)
{ {
registerReplacer(STANDARD_TYPE(StepGeom_Line), replaceLine); registerReplacer(STANDARD_TYPE(StepGeom_Line), replaceLine);
} }
//================================================================================================== //==================================================================================================
bool MergeSTEPEntities_VectorProcessor::replaceLine(const Handle(StepGeom_Vector)& theOldEntity, bool StepTidy_VectorReducer::replaceLine(const Handle(StepGeom_Vector)& theOldEntity,
const Handle(StepGeom_Vector)& theNewEntity, const Handle(StepGeom_Vector)& theNewEntity,
Handle(Standard_Transient) theSharing) Handle(Standard_Transient) theSharing)
{ {
Handle(StepGeom_Line) aLine = Handle(StepGeom_Line)::DownCast(theSharing); Handle(StepGeom_Line) aLine = Handle(StepGeom_Line)::DownCast(theSharing);
if (aLine->Dir() == theOldEntity) if (aLine->Dir() == theOldEntity)

View File

@ -11,23 +11,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#ifndef _MergeSTEPEntities_VectorProcessor_HeaderFile #ifndef _StepTidy_VectorReducer_HeaderFile
#define _MergeSTEPEntities_VectorProcessor_HeaderFile #define _StepTidy_VectorReducer_HeaderFile
#include <MergeSTEPEntities_EntityProcessor.hxx> #include <StepTidy_EntityReducer.pxx>
#include <MergeSTEPEntities_VectorHasher.hxx> #include <StepTidy_VectorHasher.pxx>
#include <StepGeom_Vector.hxx> #include <StepGeom_Vector.hxx>
//! Processor for merging StepGeom_Vector entities. //! Processor for merging StepGeom_Vector entities.
//! This processor merges vectors with the same orientation and magnitude and names. //! This processor merges vectors with the same orientation and magnitude and names.
class MergeSTEPEntities_VectorProcessor class StepTidy_VectorReducer : public StepTidy_EntityReducer<StepGeom_Vector, StepTidy_VectorHasher>
: public MergeSTEPEntities_EntityProcessor<StepGeom_Vector, MergeSTEPEntities_VectorHasher>
{ {
public: public:
//! Constructor. Stores the work session and registers replacer functions. //! Constructor. Stores the work session and registers replacer functions.
//! @param theWS the work session. //! @param theWS the work session.
Standard_EXPORT MergeSTEPEntities_VectorProcessor(const Handle(XSControl_WorkSession)& theWS); Standard_EXPORT StepTidy_VectorReducer(const Handle(XSControl_WorkSession)& theWS);
private: private:
//! Replaces the old vector with the new one in the StepGeom_Line entity. //! Replaces the old vector with the new one in the StepGeom_Line entity.
@ -40,4 +39,4 @@ private:
Handle(Standard_Transient) theSharing); Handle(Standard_Transient) theSharing);
}; };
#endif // _MergeSTEPEntities_VectorProcessor_HeaderFile #endif // _StepTidy_VectorReducer_HeaderFile

View File

@ -23,7 +23,6 @@
#include <Draw_ProgressIndicator.hxx> #include <Draw_ProgressIndicator.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
#include <Interface_Static.hxx> #include <Interface_Static.hxx>
#include <MergeSTEPEntities_Merger.hxx>
#include <Message.hxx> #include <Message.hxx>
#include <OSD_OpenFile.hxx> #include <OSD_OpenFile.hxx>
#include <OSD_Parallel.hxx> #include <OSD_Parallel.hxx>
@ -1094,39 +1093,6 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI,
//================================================================================================= //=================================================================================================
static Standard_Integer MergeSTEPEntities(Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
if (theNbArgs < 2)
{
theDI << "Incorrect number of arguments\n";
theDI << "Usage: MergeSTEPEntities input_file output_file\n";
return 1;
}
STEPControl_Reader aReader;
if (aReader.ReadFile(theArgVec[1]) != IFSelect_RetDone)
{
theDI << "Error: Cannot read file " << theArgVec[1] << "\n";
return 1;
}
MergeSTEPEntities_Merger aMerger(aReader.WS());
aMerger.Perform();
STEPControl_Writer aWriter(aReader.WS(), Standard_False);
if (aWriter.Write(theArgVec[2]) != IFSelect_RetDone)
{
theDI << "Error: Cannot write file " << theArgVec[2] << "\n";
return 1;
}
return 0;
}
//=================================================================================================
void XSDRAWSTEP::Factory(Draw_Interpretor& theDI) void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
{ {
static Standard_Boolean aIsActivated = Standard_False; static Standard_Boolean aIsActivated = Standard_False;
@ -1179,15 +1145,6 @@ void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
WriteStep, WriteStep,
aGroup); aGroup);
theDI.Add("MergeSTEPEntities",
"MergeSTEPEntities input_file output_file"
"\n\t\t: Merge equal entities in STEP file"
"\n\t\t: input_file - Step file to read"
"\n\t\t: output_file - Step file to write output to",
__FILE__,
MergeSTEPEntities,
aGroup);
// Load XSDRAW session for pilot activation // Load XSDRAW session for pilot activation
XSDRAW::LoadDraw(theDI); XSDRAW::LoadDraw(theDI);
} }