mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-26 17:40:32 +05:00
migrate to new bop - attempt 1
This commit is contained in:
parent
4b3392faf9
commit
71ad3d7eba
@ -518,8 +518,6 @@ AC_OUTPUT([ \
|
||||
src/IGESExport/Makefile \
|
||||
src/IGESImport/Makefile \
|
||||
src/MeasureGUI/Makefile \
|
||||
src/NMTDS/Makefile \
|
||||
src/NMTTools/Makefile \
|
||||
src/OBJECT/Makefile \
|
||||
src/OCC2VTK/Makefile \
|
||||
src/OperationGUI/Makefile \
|
||||
|
@ -1,169 +1,108 @@
|
||||
GEOMAlgo_Builder_0.cxx
|
||||
GEOMAlgo_Builder_1.cxx
|
||||
GEOMAlgo_Builder_2.cxx
|
||||
GEOMAlgo_Builder_3.cxx
|
||||
GEOMAlgo_Builder_4.cxx
|
||||
GEOMAlgo_ShapeInfoFiller_1.cxx
|
||||
GEOMAlgo_Tools_1.cxx
|
||||
|
||||
GEOMAlgo_Gluer2.hxx
|
||||
GEOMAlgo_Gluer2.cxx
|
||||
GEOMAlgo_Gluer2_1.cxx
|
||||
GEOMAlgo_Gluer2_2.cxx
|
||||
GEOMAlgo_Gluer2_3.cxx
|
||||
|
||||
GEOMAlgo_GluerAlgo.hxx
|
||||
GEOMAlgo_GluerAlgo.cxx
|
||||
|
||||
GEOMAlgo_GlueDetector.hxx
|
||||
GEOMAlgo_GlueDetector.cxx
|
||||
|
||||
GEOMAlgo_GetInPlace.hxx
|
||||
GEOMAlgo_GetInPlace.cxx
|
||||
GEOMAlgo_GetInPlace_1.cxx
|
||||
GEOMAlgo_GetInPlace_2.cxx
|
||||
GEOMAlgo_GetInPlace_3.cxx
|
||||
|
||||
GEOMAlgo_FinderShapeOnQuad.hxx
|
||||
GEOMAlgo_FinderShapeOnQuad.cxx
|
||||
|
||||
GEOMAlgo_WireSplitter.hxx
|
||||
GEOMAlgo_WireSplitter.cxx
|
||||
GEOMAlgo_WESScaler.hxx
|
||||
GEOMAlgo_WESScaler.cxx
|
||||
GEOMAlgo_WESCorrector.hxx
|
||||
GEOMAlgo_WESCorrector.cxx
|
||||
GEOMAlgo_WireEdgeSet.hxx
|
||||
GEOMAlgo_WireEdgeSet.cxx
|
||||
GEOMAlgo_GlueAnalyser.hxx
|
||||
GEOMAlgo_GlueAnalyser.cxx
|
||||
GEOMAlgo_Gluer.hxx
|
||||
GEOMAlgo_Gluer.cxx
|
||||
GEOMAlgo_FinderShapeOn2.hxx
|
||||
GEOMAlgo_FinderShapeOn2.cxx
|
||||
GEOMAlgo_FinderShapeOn1.hxx
|
||||
GEOMAlgo_FinderShapeOn1.cxx
|
||||
GEOMAlgo_FinderShapeOn.hxx
|
||||
GEOMAlgo_FinderShapeOn.cxx
|
||||
GEOMAlgo_ShapeAlgo.hxx
|
||||
GEOMAlgo_ShapeAlgo.cxx
|
||||
GEOMAlgo_SolidSolid.hxx
|
||||
GEOMAlgo_SolidSolid.cxx
|
||||
GEOMAlgo_ShellSolid.hxx
|
||||
GEOMAlgo_ShellSolid.cxx
|
||||
GEOMAlgo_VertexSolid.hxx
|
||||
GEOMAlgo_VertexSolid.cxx
|
||||
GEOMAlgo_WireSolid.hxx
|
||||
GEOMAlgo_WireSolid.cxx
|
||||
GEOMAlgo_ShapeSolid.hxx
|
||||
GEOMAlgo_ShapeSolid.cxx
|
||||
GEOMAlgo_Splitter.hxx
|
||||
GEOMAlgo_Splitter.cxx
|
||||
GEOMAlgo_Builder.hxx
|
||||
GEOMAlgo_Builder.cxx
|
||||
GEOMAlgo_BuilderShape.hxx
|
||||
GEOMAlgo_BuilderShape.cxx
|
||||
GEOMAlgo_BuilderArea.hxx
|
||||
GEOMAlgo_BuilderArea.cxx
|
||||
GEOMAlgo_BuilderFace.hxx
|
||||
GEOMAlgo_BuilderFace.cxx
|
||||
GEOMAlgo_BuilderSolid.hxx
|
||||
GEOMAlgo_BuilderSolid.cxx
|
||||
GEOMAlgo_ShapeInfoFiller.hxx
|
||||
GEOMAlgo_ShapeInfoFiller.cxx
|
||||
GEOMAlgo_Algo.hxx
|
||||
GEOMAlgo_Algo.cxx
|
||||
GEOMAlgo_ShapeSet.hxx
|
||||
GEOMAlgo_ShapeSet.cxx
|
||||
GEOMAlgo_SurfaceTools.hxx
|
||||
GEOMAlgo_SurfaceTools.cxx
|
||||
GEOMAlgo_State.hxx
|
||||
GEOMAlgo_KindOfBounds.hxx
|
||||
GEOMAlgo_KindOfClosed.hxx
|
||||
GEOMAlgo_KindOfName.hxx
|
||||
GEOMAlgo_KindOfShape.hxx
|
||||
GEOMAlgo_ShapeInfo.hxx
|
||||
GEOMAlgo_ShapeInfo.cxx
|
||||
GEOMAlgo_CoupleOfShapes.hxx
|
||||
GEOMAlgo_CoupleOfShapes.cxx
|
||||
GEOMAlgo_BuilderTools.hxx
|
||||
GEOMAlgo_BuilderTools.cxx
|
||||
GEOMAlgo_Tools3D.hxx
|
||||
GEOMAlgo_Tools3D.cxx
|
||||
GEOMAlgo_Tools.hxx
|
||||
GEOMAlgo_Tools.cxx
|
||||
GEOMAlgo_PWireEdgeSet.hxx
|
||||
GEOMAlgo_StateCollector.cxx
|
||||
GEOMAlgo_StateCollector.hxx
|
||||
GEOMAlgo_PassKey.hxx
|
||||
GEOMAlgo_PassKey.cxx
|
||||
GEOMAlgo_PassKeyMapHasher.hxx
|
||||
GEOMAlgo_PassKeyMapHasher.cxx
|
||||
GEOMAlgo_PassKeyShape.hxx
|
||||
GEOMAlgo_PassKeyShape.cxx
|
||||
GEOMAlgo_PassKeyShapeMapHasher.hxx
|
||||
GEOMAlgo_PassKeyShapeMapHasher.cxx
|
||||
GEOMAlgo_ClsfBox.hxx
|
||||
GEOMAlgo_ClsfBox.cxx
|
||||
GEOMAlgo_ClsfSolid.hxx
|
||||
GEOMAlgo_ClsfSolid.cxx
|
||||
GEOMAlgo_ClsfSurf.hxx
|
||||
GEOMAlgo_ClsfSurf.cxx
|
||||
GEOMAlgo_Clsf.hxx
|
||||
GEOMAlgo_Clsf.cxx
|
||||
GEOMAlgo_HAlgo.hxx
|
||||
GEOMAlgo_HAlgo.cxx
|
||||
|
||||
GEOMAlgo_ListOfCoupleOfShapes.hxx
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
|
||||
GEOMAlgo_ListOfPnt.hxx
|
||||
GEOMAlgo_ListIteratorOfListOfPnt.hxx
|
||||
GEOMAlgo_DataMapOfShapeShapeSet.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx
|
||||
GEOMAlgo_DataMapOfShapeReal.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx
|
||||
GEOMAlgo_DataMapOfRealListOfShape.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx
|
||||
GEOMAlgo_DataMapOfPassKeyInteger.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx
|
||||
GEOMAlgo_DataMapOfPassKeyShapeShape.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx
|
||||
GEOMAlgo_DataMapOfOrientedShapeShape.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx
|
||||
GEOMAlgo_DataMapOfShapeMapOfShape.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx
|
||||
GEOMAlgo_DataMapOfShapePnt.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeBox.hxx
|
||||
|
||||
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeState.hxx
|
||||
GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
|
||||
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GEOMAlgo_Algo.hxx
|
||||
GEOMAlgo_Algo.cxx
|
||||
GEOMAlgo_ShapeSolid.hxx
|
||||
GEOMAlgo_ShapeSolid.cxx
|
||||
GEOMAlgo_VertexSolid.hxx
|
||||
GEOMAlgo_VertexSolid.cxx
|
||||
GEOMAlgo_WireSolid.hxx
|
||||
GEOMAlgo_WireSolid.cxx
|
||||
GEOMAlgo_ShellSolid.hxx
|
||||
GEOMAlgo_ShellSolid.cxx
|
||||
GEOMAlgo_AlgoTools.hxx
|
||||
GEOMAlgo_AlgoTools.cxx
|
||||
GEOMAlgo_AlgoTools_1.cxx
|
||||
GEOMAlgo_AlgoTools_2.cxx
|
||||
GEOMAlgo_SolidSolid.hxx
|
||||
GEOMAlgo_SolidSolid.cxx
|
||||
GEOMAlgo_ShapeAlgo.hxx
|
||||
GEOMAlgo_ShapeAlgo.cxx
|
||||
GEOMAlgo_FinderShapeOn.hxx
|
||||
GEOMAlgo_FinderShapeOn.cxx
|
||||
GEOMAlgo_FinderShapeOn1.hxx
|
||||
GEOMAlgo_FinderShapeOn1.cxx
|
||||
GEOMAlgo_HAlgo.hxx
|
||||
GEOMAlgo_HAlgo.cxx
|
||||
GEOMAlgo_Clsf.hxx
|
||||
GEOMAlgo_Clsf.cxx
|
||||
GEOMAlgo_ClsfBox.hxx
|
||||
GEOMAlgo_ClsfBox.cxx
|
||||
GEOMAlgo_ClsfSolid.hxx
|
||||
GEOMAlgo_ClsfSolid.cxx
|
||||
GEOMAlgo_ClsfSurf.hxx
|
||||
GEOMAlgo_ClsfSurf.cxx
|
||||
GEOMAlgo_FinderShapeOn2.hxx
|
||||
GEOMAlgo_FinderShapeOn2.cxx
|
||||
GEOMAlgo_FinderShapeOnQuad.hxx
|
||||
GEOMAlgo_FinderShapeOnQuad.cxx
|
||||
GEOMAlgo_Gluer.hxx
|
||||
GEOMAlgo_Gluer.cxx
|
||||
GEOMAlgo_GlueAnalyser.hxx
|
||||
GEOMAlgo_GlueAnalyser.cxx
|
||||
GEOMAlgo_GluerAlgo.hxx
|
||||
GEOMAlgo_GluerAlgo.cxx
|
||||
GEOMAlgo_GlueDetector.hxx
|
||||
GEOMAlgo_GlueDetector.cxx
|
||||
GEOMAlgo_BuilderShape.hxx
|
||||
GEOMAlgo_BuilderShape.cxx
|
||||
GEOMAlgo_Gluer2.hxx
|
||||
GEOMAlgo_Gluer2.cxx
|
||||
GEOMAlgo_Gluer2_1.cxx
|
||||
GEOMAlgo_Gluer2_2.cxx
|
||||
GEOMAlgo_Gluer2_3.cxx
|
||||
GEOMAlgo_GetInPlace.hxx
|
||||
GEOMAlgo_GetInPlace.cxx
|
||||
GEOMAlgo_GetInPlace_1.cxx
|
||||
GEOMAlgo_GetInPlace_2.cxx
|
||||
GEOMAlgo_GetInPlace_3.cxx
|
||||
GEOMAlgo_Splitter.hxx
|
||||
GEOMAlgo_Splitter.cxx
|
||||
GEOMAlgo_ShapeInfoFiller.hxx
|
||||
GEOMAlgo_ShapeInfoFiller.cxx
|
||||
GEOMAlgo_ShapeInfoFiller_1.cxx
|
||||
|
||||
GEOMAlgo_PassKeyShape.hxx
|
||||
GEOMAlgo_PassKeyShape.cxx
|
||||
GEOMAlgo_PassKeyShapeMapHasher.hxx
|
||||
GEOMAlgo_PassKeyShapeMapHasher.cxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeState.hxx
|
||||
GEOMAlgo_State.hxx
|
||||
GEOMAlgo_SurfaceTools.hxx
|
||||
GEOMAlgo_SurfaceTools.cxx
|
||||
GEOMAlgo_ListOfPnt.hxx
|
||||
GEOMAlgo_ListIteratorOfListOfPnt.hxx
|
||||
GEOMAlgo_StateCollector.cxx
|
||||
GEOMAlgo_StateCollector.hxx
|
||||
GEOMAlgo_PassKey.hxx
|
||||
GEOMAlgo_PassKey.cxx
|
||||
GEOMAlgo_PassKeyMapHasher.hxx
|
||||
GEOMAlgo_PassKeyMapHasher.cxx
|
||||
GEOMAlgo_DataMapOfPassKeyInteger.hxx
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx
|
||||
GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
|
||||
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeBox.hxx
|
||||
GEOMAlgo_CoupleOfShapes.hxx
|
||||
GEOMAlgo_CoupleOfShapes.cxx
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
|
||||
GEOMAlgo_ListOfCoupleOfShapes.hxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
|
||||
GEOMAlgo_DataMapOfShapeMapOfShape.hxx
|
||||
GEOMAlgo_DataMapOfShapePnt.hxx
|
||||
GEOMAlgo_BndSphere.hxx
|
||||
GEOMAlgo_BndSphere.cxx
|
||||
GEOMAlgo_BndSphere.lxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
|
||||
GEOMAlgo_BndSphereTree.hxx
|
||||
GEOMAlgo_BndSphereTree.cxx
|
||||
GEOMAlgo_BoxBndTree.hxx
|
||||
GEOMAlgo_BoxBndTree.cxx
|
||||
|
||||
GEOMAlgo_KindOfBounds.hxx
|
||||
GEOMAlgo_KindOfClosed.hxx
|
||||
GEOMAlgo_KindOfName.hxx
|
||||
GEOMAlgo_KindOfShape.hxx
|
||||
GEOMAlgo_ShapeInfo.hxx
|
||||
GEOMAlgo_ShapeInfo.cxx
|
||||
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
|
||||
|
||||
Basics_OCCTVersion.hxx
|
||||
|
@ -27,27 +27,8 @@ package GEOMAlgo
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
TCollection,
|
||||
|
||||
TColgp,
|
||||
Geom,
|
||||
Bnd,
|
||||
gp,
|
||||
GeomAdaptor,
|
||||
TopAbs,
|
||||
TopoDS,
|
||||
TopTools,
|
||||
IntTools,
|
||||
BOPTools,
|
||||
BOP,
|
||||
|
||||
TColStd,
|
||||
BOPTColStd,
|
||||
BRepAlgo,
|
||||
NMTDS,
|
||||
NMTTools
|
||||
|
||||
--uses
|
||||
|
||||
is
|
||||
-- Enumerations
|
||||
imported State from GEOMAlgo;
|
||||
@ -55,72 +36,100 @@ is
|
||||
imported KindOfName from GEOMAlgo;
|
||||
imported KindOfBounds from GEOMAlgo;
|
||||
imported KindOfClosed from GEOMAlgo;
|
||||
--
|
||||
-- Gluer / GetInPlace
|
||||
imported Gluer2 from GEOMAlgo;
|
||||
imported GlueDetector from GEOMAlgo;
|
||||
imported GluerAlgo from GEOMAlgo;
|
||||
imported GetInPlace from GEOMAlgo;
|
||||
-- Algos
|
||||
imported WireSplitter from GEOMAlgo;
|
||||
imported WESScaler from GEOMAlgo;
|
||||
imported WESCorrector from GEOMAlgo;
|
||||
imported WireEdgeSet from GEOMAlgo;
|
||||
imported GlueAnalyser from GEOMAlgo;
|
||||
imported Gluer from GEOMAlgo;
|
||||
imported FinderShapeOn2 from GEOMAlgo;
|
||||
imported FinderShapeOn1 from GEOMAlgo;
|
||||
imported FinderShapeOn from GEOMAlgo;
|
||||
imported ShapeAlgo from GEOMAlgo;
|
||||
imported SolidSolid from GEOMAlgo;
|
||||
imported ShellSolid from GEOMAlgo;
|
||||
imported VertexSolid from GEOMAlgo;
|
||||
imported WireSolid from GEOMAlgo;
|
||||
imported ShapeSolid from GEOMAlgo;
|
||||
imported Splitter from GEOMAlgo;
|
||||
imported Builder from GEOMAlgo;
|
||||
imported BuilderShape from GEOMAlgo;
|
||||
imported BuilderSolid from GEOMAlgo;
|
||||
imported BuilderFace from GEOMAlgo;
|
||||
imported BuilderArea from GEOMAlgo;
|
||||
imported ShapeInfoFiller from GEOMAlgo;
|
||||
--
|
||||
-- Algos
|
||||
--
|
||||
imported Algo from GEOMAlgo;
|
||||
imported ShapeSolid from GEOMAlgo;
|
||||
imported VertexSolid from GEOMAlgo;
|
||||
imported WireSolid from GEOMAlgo;
|
||||
imported ShellSolid from GEOMAlgo;
|
||||
imported SolidSolid from GEOMAlgo;
|
||||
imported FinderShapeOn from GEOMAlgo;
|
||||
imported FinderShapeOn1 from GEOMAlgo;
|
||||
imported HAlgo from GEOMAlgo;
|
||||
imported ShapeAlgo from GEOMAlgo;
|
||||
imported Clsf from GEOMAlgo;
|
||||
imported ClsfBox from GEOMAlgo;
|
||||
imported ClsfSurf from GEOMAlgo;
|
||||
imported ClsfSolid from GEOMAlgo;
|
||||
imported FinderShapeOn2 from GEOMAlgo;
|
||||
imported FinderShapeOnQuad from GEOMAlgo;
|
||||
imported Gluer from GEOMAlgo;
|
||||
imported GlueAnalyser from GEOMAlgo;
|
||||
imported GluerAlgo from GEOMAlgo;
|
||||
imported GlueDetector from GEOMAlgo;
|
||||
imported BuilderShape from GEOMAlgo;
|
||||
imported Gluer2 from GEOMAlgo;
|
||||
imported GetInPlace from GEOMAlgo;
|
||||
imported Splitter from GEOMAlgo;
|
||||
--
|
||||
|
||||
--
|
||||
imported AlgoTools from GEOMAlgo;
|
||||
|
||||
-- Gluer / GetInPlace
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- Algos
|
||||
--imported WireSplitter from GEOMAlgo;
|
||||
--imported WESScaler from GEOMAlgo;
|
||||
--imported WESCorrector from GEOMAlgo;
|
||||
--imported WireEdgeSet from GEOMAlgo;
|
||||
--imported GlueAnalyser from GEOMAlgo;
|
||||
--imported Gluer from GEOMAlgo;
|
||||
|
||||
|
||||
--
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--imported Splitter from GEOMAlgo;
|
||||
--imported Builder from GEOMAlgo;
|
||||
|
||||
--imported BuilderSolid from GEOMAlgo;
|
||||
--imported BuilderFace from GEOMAlgo;
|
||||
--imported BuilderArea from GEOMAlgo;
|
||||
imported ShapeInfoFiller from GEOMAlgo;
|
||||
--
|
||||
-- Data / Tools
|
||||
imported ShapeSet from GEOMAlgo;
|
||||
--imported ShapeSet from GEOMAlgo;
|
||||
imported SurfaceTools from GEOMAlgo;
|
||||
imported ShapeInfo from GEOMAlgo;
|
||||
imported CoupleOfShapes from GEOMAlgo;
|
||||
imported BuilderTools from GEOMAlgo;
|
||||
imported Tools3D from GEOMAlgo;
|
||||
imported Tools from GEOMAlgo;
|
||||
imported PWireEdgeSet from GEOMAlgo;
|
||||
--imported BuilderTools from GEOMAlgo;
|
||||
--imported Tools3D from GEOMAlgo;
|
||||
--imported Tools from GEOMAlgo;
|
||||
--imported PWireEdgeSet from GEOMAlgo;
|
||||
imported BndSphere from GEOMAlgo;
|
||||
imported StateCollector from GEOMAlgo;
|
||||
imported PassKey from GEOMAlgo;
|
||||
imported PassKeyMapHasher from GEOMAlgo;
|
||||
imported PassKeyShape from GEOMAlgo;
|
||||
imported PassKeyShapeMapHasher from GEOMAlgo;
|
||||
imported ClsfBox from GEOMAlgo;
|
||||
imported ClsfSurf from GEOMAlgo;
|
||||
imported ClsfSolid from GEOMAlgo;
|
||||
imported Clsf from GEOMAlgo;
|
||||
imported HAlgo from GEOMAlgo;
|
||||
|
||||
imported ListOfCoupleOfShapes from GEOMAlgo;
|
||||
imported ListIteratorOfListOfCoupleOfShapes from GEOMAlgo;
|
||||
imported ListOfPnt from GEOMAlgo;
|
||||
imported ListIteratorOfListOfPnt from GEOMAlgo;
|
||||
imported DataMapOfShapeShapeSet from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfShapeShapeSet from GEOMAlgo;
|
||||
imported DataMapOfShapeReal from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfShapeReal from GEOMAlgo;
|
||||
imported DataMapOfRealListOfShape from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfRealListOfShape from GEOMAlgo;
|
||||
imported ListIteratorOfListOfPnt from GEOMAlgo;
|
||||
imported IndexedDataMapOfShapeIndexedMapOfShape from GEOMAlgo;
|
||||
|
||||
--imported DataMapOfShapeShapeSet from GEOMAlgo;
|
||||
--imported DataMapIteratorOfDataMapOfShapeShapeSet from GEOMAlgo;
|
||||
--imported DataMapOfShapeReal from GEOMAlgo;
|
||||
--imported DataMapIteratorOfDataMapOfShapeReal from GEOMAlgo;
|
||||
--imported DataMapOfRealListOfShape from GEOMAlgo;
|
||||
--imported DataMapIteratorOfDataMapOfRealListOfShape from GEOMAlgo;
|
||||
imported DataMapOfPassKeyInteger from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfPassKeyInteger from GEOMAlgo;
|
||||
imported DataMapOfPassKeyShapeShape from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfPassKeyShapeShape from GEOMAlgo;
|
||||
imported DataMapOfOrientedShapeShape from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfOrientedShapeShape from GEOMAlgo;
|
||||
--imported DataMapOfPassKeyShapeShape from GEOMAlgo;
|
||||
--imported DataMapIteratorOfDataMapOfPassKeyShapeShape from GEOMAlgo;
|
||||
--imported DataMapOfOrientedShapeShape from GEOMAlgo;
|
||||
--imported DataMapIteratorOfDataMapOfOrientedShapeShape from GEOMAlgo;
|
||||
imported DataMapOfShapeMapOfShape from GEOMAlgo;
|
||||
imported DataMapIteratorOfDataMapOfShapeMapOfShape from GEOMAlgo;
|
||||
imported DataMapOfShapePnt from GEOMAlgo;
|
||||
@ -131,212 +140,4 @@ is
|
||||
imported IndexedDataMapOfIntegerShape from GEOMAlgo;
|
||||
imported IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo;
|
||||
|
||||
|
||||
-- Instantiations
|
||||
|
||||
--class ListOfCoupleOfShapes
|
||||
-- instantiates List from TCollection (CoupleOfShapes from GEOMAlgo);
|
||||
|
||||
--class ListOfPnt
|
||||
-- instantiates List from TCollection (Pnt from gp);
|
||||
--
|
||||
|
||||
--class DataMapOfShapeShapeSet instantiates
|
||||
-- DataMap from TCollection(Shape from TopoDS,
|
||||
-- ShapeSet from GEOMAlgo,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
|
||||
--class DataMapOfShapeReal instantiates
|
||||
-- DataMap from TCollection(Shape from TopoDS,
|
||||
-- Real from Standard,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
|
||||
|
||||
--class DataMapOfRealListOfShape instantiates
|
||||
-- DataMap from TCollection(Real from Standard,
|
||||
-- ListOfShape from TopTools,
|
||||
-- MapRealHasher from TColStd);
|
||||
|
||||
|
||||
--class DataMapOfPassKeyInteger
|
||||
-- instantiates DataMap from TCollection (PassKey from GEOMAlgo,
|
||||
-- Integer from Standard,
|
||||
-- PassKeyMapHasher from GEOMAlgo);
|
||||
|
||||
--class DataMapOfPassKeyShapeShape
|
||||
-- instantiates DataMap from TCollection (PassKeyShape from GEOMAlgo,
|
||||
-- Shape from TopoDS,
|
||||
-- PassKeyShapeMapHasher from GEOMAlgo);
|
||||
|
||||
--class DataMapOfOrientedShapeShape instantiates
|
||||
-- DataMap from TCollection (Shape from TopoDS,
|
||||
-- Shape from TopoDS,
|
||||
-- OrientedShapeMapHasher from TopTools);
|
||||
|
||||
|
||||
--class DataMapOfShapeMapOfShape instantiates
|
||||
-- DataMap from TCollection (Shape from TopoDS,
|
||||
-- MapOfShape from TopTools,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
|
||||
--class DataMapOfShapePnt instantiates
|
||||
-- DataMap from TCollection (Shape from TopoDS,
|
||||
-- Pnt from gp,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
|
||||
--
|
||||
--class IndexedDataMapOfShapeBox
|
||||
-- instantiates IndexedDataMap from TCollection (Shape from TopoDS,
|
||||
-- Box from Bnd,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
|
||||
-- class IndexedDataMapOfShapeShapeInfo
|
||||
-- instantiates IndexedDataMap from TCollection (Shape from TopoDS,
|
||||
-- ShapeInfo from GEOMAlgo,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
-- class IndexedDataMapOfShapeState
|
||||
-- instantiates IndexedDataMap from TCollection (Shape from TopoDS,
|
||||
-- State from TopAbs,
|
||||
-- ShapeMapHasher from TopTools);
|
||||
|
||||
|
||||
--
|
||||
-- class IndexedDataMapOfIntegerShape
|
||||
-- instantiates IndexedDataMap from TCollection (Integer from Standard,
|
||||
-- Shape from TopoDS,
|
||||
-- MapIntegerHasher from TColStd);
|
||||
|
||||
|
||||
-- class IndexedDataMapOfPassKeyShapeListOfShape
|
||||
-- instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo,
|
||||
-- ListOfShape from TopTools,
|
||||
-- PassKeyShapeMapHasher from GEOMAlgo);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end GEOMAlgo;
|
||||
--
|
||||
-- enumerations
|
||||
--
|
||||
--enumeration State is
|
||||
-- ST_UNKNOWN,
|
||||
-- ST_IN,
|
||||
-- ST_OUT,
|
||||
-- ST_ON,
|
||||
-- ST_ONIN,
|
||||
-- ST_ONOUT,
|
||||
-- ST_INOUT
|
||||
-- end State;
|
||||
--
|
||||
-- enumeration KindOfShape is
|
||||
-- KS_UNKNOWN,
|
||||
-- KS_SPHERE,
|
||||
-- KS_CYLINDER,
|
||||
-- KS_BOX,
|
||||
-- KS_TORUS,
|
||||
-- KS_CONE,
|
||||
-- KS_ELLIPSE,
|
||||
-- KS_PLANE,
|
||||
-- KS_CIRCLE,
|
||||
-- KS_LINE,
|
||||
-- KS_DEGENERATED
|
||||
-- end KindOfShape;
|
||||
--
|
||||
-- enumeration KindOfName is
|
||||
-- KN_UNKNOWN,
|
||||
-- KN_SPHERE,
|
||||
-- KN_CYLINDER,
|
||||
-- KN_TORUS,
|
||||
-- KN_CONE,
|
||||
-- KN_ELLIPSE,
|
||||
-- KN_CIRCLE,
|
||||
-- KN_PLANE,
|
||||
-- KN_LINE,
|
||||
-- KN_BOX,
|
||||
-- KN_SEGMENT,
|
||||
-- KN_ARCCIRCLE,
|
||||
-- KN_POLYGON,
|
||||
-- KN_POLYHEDRON,
|
||||
-- KN_DISKCIRCLE,
|
||||
-- KN_DISKELLIPSE,
|
||||
-- KN_RECTANGLE,
|
||||
-- KN_TRIANGLE,
|
||||
-- KN_QUADRANGLE,
|
||||
-- KN_ARCELLIPSE
|
||||
-- end KindOfName;
|
||||
--
|
||||
-- enumeration KindOfBounds is
|
||||
-- KB_UNKNOWN,
|
||||
-- KB_TRIMMED,
|
||||
-- KB_INFINITE
|
||||
-- end KindOfBounds;
|
||||
--
|
||||
-- enumeration KindOfClosed is
|
||||
-- KC_UNKNOWN,
|
||||
-- KC_CLOSED,
|
||||
-- KC_NOTCLOSED
|
||||
-- end KindOfClosed;
|
||||
--
|
||||
|
||||
--deferred class HAlgo;
|
||||
--deferred class Clsf;
|
||||
--class ClsfSurf;
|
||||
--class ClsfBox;
|
||||
--class ClsfSolid;
|
||||
|
||||
--
|
||||
-- classes
|
||||
--
|
||||
--deferred class Algo;
|
||||
--deferred class ShapeAlgo;
|
||||
--
|
||||
--class ShapeInfo;
|
||||
--class ShapeInfoFiller;
|
||||
--class CoupleOfShapes;
|
||||
--class SurfaceTools;
|
||||
--class Tools;
|
||||
--class PassKey;
|
||||
--class PassKeyMapHasher;
|
||||
--class PassKeyShape;
|
||||
--class PassKeyShapeMapHasher;
|
||||
--
|
||||
-- finder on
|
||||
--deferred class ShapeSolid;
|
||||
--class WireSolid;
|
||||
--class ShellSolid;
|
||||
--class VertexSolid;
|
||||
--class SolidSolid;
|
||||
--class StateCollector;
|
||||
|
||||
--
|
||||
--class Gluer;
|
||||
--class GlueAnalyser;
|
||||
--class FinderShapeOn;
|
||||
--class FinderShapeOn1;
|
||||
--class FinderShapeOn2;
|
||||
--
|
||||
-- Builder/Splitter
|
||||
--deferred class BuilderShape;
|
||||
--class Builder;
|
||||
--class Splitter;
|
||||
--class Tools3D;
|
||||
--class BuilderTools;
|
||||
--class ShapeSet;
|
||||
|
||||
--deferred class BuilderArea;
|
||||
--class BuilderFace;
|
||||
--class BuilderSolid;
|
||||
|
||||
--class WireSplitter;
|
||||
--class WireEdgeSet;
|
||||
--class WESCorrector;
|
||||
--class WESScaler;
|
||||
--
|
||||
-- Pointers
|
||||
--
|
||||
--pointer PWireEdgeSet to WireEdgeSet from GEOMAlgo;
|
||||
--
|
||||
--
|
||||
|
@ -31,7 +31,7 @@
|
||||
// function:
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
GEOMAlgo_Algo::GEOMAlgo_Algo()
|
||||
GEOMAlgo_Algo::GEOMAlgo_Algo()
|
||||
:
|
||||
myErrorStatus(1),
|
||||
myWarningStatus(0),
|
||||
@ -41,14 +41,14 @@
|
||||
// function: ~
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
GEOMAlgo_Algo::~GEOMAlgo_Algo()
|
||||
GEOMAlgo_Algo::~GEOMAlgo_Algo()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: CheckData
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Algo::CheckData()
|
||||
void GEOMAlgo_Algo::CheckData()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
}
|
||||
@ -56,7 +56,7 @@
|
||||
// function: CheckResult
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Algo::CheckResult()
|
||||
void GEOMAlgo_Algo::CheckResult()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
}
|
||||
@ -64,7 +64,7 @@
|
||||
// function: ErrorStatus
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Algo::ErrorStatus()const
|
||||
Standard_Integer GEOMAlgo_Algo::ErrorStatus()const
|
||||
{
|
||||
return myErrorStatus;
|
||||
}
|
||||
@ -72,7 +72,7 @@
|
||||
// function: WarningStatus
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Algo::WarningStatus()const
|
||||
Standard_Integer GEOMAlgo_Algo::WarningStatus()const
|
||||
{
|
||||
return myWarningStatus;
|
||||
}
|
||||
@ -84,7 +84,7 @@
|
||||
//function : ComputeInternalShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
|
||||
void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
|
||||
{
|
||||
myComputeInternalShapes = theFlag;
|
||||
}
|
||||
|
1166
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx
Executable file
1166
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx
Executable file
File diff suppressed because it is too large
Load Diff
201
src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx
Executable file
201
src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx
Executable file
@ -0,0 +1,201 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_AlgoTools.hxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#ifndef _GEOMAlgo_AlgoTools_HeaderFile
|
||||
#define _GEOMAlgo_AlgoTools_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Handle_IntTools_Context.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
|
||||
//! Auxiliary tools for Algorithms <br>
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_AlgoTools
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_AlgoTools {
|
||||
public:
|
||||
|
||||
Standard_EXPORT
|
||||
static void FaceNormal (const TopoDS_Face& aF,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Vec& aN);
|
||||
|
||||
//! Computes a point <theP> inside the face <theF>. <br>
|
||||
//! <theP2D> - 2D representation of <theP> <br>
|
||||
//! on the surface of <theF> <br>
|
||||
//! Returns 0 in case of success. <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Integer PntInFace(const TopoDS_Face& theF,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
|
||||
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer RefineSDShapes
|
||||
(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
|
||||
const Standard_Real aTol,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
|
||||
const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
TopTools_ListOfShape& aLESD,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnShape(const TopoDS_Shape& aS,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnEdge(const TopoDS_Edge& aE,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnEdge(const TopoDS_Edge& aE,
|
||||
const Standard_Real aT,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnFace(const TopoDS_Face& aF,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnFace(const TopoDS_Face& aF,
|
||||
const Standard_Real aU,
|
||||
const Standard_Real aV,
|
||||
gp_Pnt& aP3D) ;
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
|
||||
const TopoDS_Shape& aS,
|
||||
gp_Pnt& aP2,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void CorrectTolerances(const TopoDS_Shape& aShape,
|
||||
const Standard_Real aMaxTol=0.0001);
|
||||
|
||||
Standard_EXPORT
|
||||
static void CorrectPointOnCurve(const TopoDS_Shape& S,
|
||||
const Standard_Real aMaxTol=0.0001);
|
||||
|
||||
Standard_EXPORT
|
||||
static void CorrectCurveOnSurface(const TopoDS_Shape& S,
|
||||
const Standard_Real aMaxTol=0.0001);
|
||||
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
|
||||
const TopoDS_Edge& aEF2,
|
||||
const Handle(IntTools_Context)& aContext);
|
||||
Standard_EXPORT
|
||||
static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aUMin,
|
||||
const Standard_Real aUMax);
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
|
||||
|
||||
Standard_EXPORT
|
||||
static void MakeContainer(const TopAbs_ShapeEnum theType,
|
||||
TopoDS_Shape& theC);
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
|
||||
const TopoDS_Edge& theEdge,
|
||||
const Handle(IntTools_Context)& theContext);
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp,
|
||||
const TopoDS_Face& theFSr,
|
||||
const Handle(IntTools_Context)& theContext);
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp,
|
||||
const TopoDS_Shape& theSr,
|
||||
const Handle(IntTools_Context)& theCtx);
|
||||
Standard_EXPORT
|
||||
static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold,
|
||||
const TopoDS_Edge& aEnew,
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& aCtx);
|
||||
|
||||
//
|
||||
Standard_EXPORT
|
||||
static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
|
||||
|
||||
Standard_EXPORT
|
||||
static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
|
||||
|
||||
Standard_EXPORT
|
||||
static void CopyShape(const TopoDS_Shape& aS,
|
||||
TopoDS_Shape& aSC) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void CopyShape(const TopoDS_Shape& aS,
|
||||
TopoDS_Shape& aSC,
|
||||
TopTools_IndexedDataMapOfShapeShape& aMSS) ;
|
||||
};
|
||||
#endif
|
598
src/GEOMAlgo/GEOMAlgo_AlgoTools_1.cxx
Executable file
598
src/GEOMAlgo/GEOMAlgo_AlgoTools_1.cxx
Executable file
@ -0,0 +1,598 @@
|
||||
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_AlgoTools_1.cxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
#include <BRep_TVertex.hxx>
|
||||
#include <BRep_TEdge.hxx>
|
||||
#include <BRep_TFace.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_GCurve.hxx>
|
||||
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
|
||||
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
|
||||
#include <BRep_CurveRepresentation.hxx>
|
||||
#include <BRep_PointRepresentation.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom2dAdaptor.hxx>
|
||||
#include <GeomProjLib.hxx>
|
||||
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
void CheckEdge (const TopoDS_Edge& E,
|
||||
const Standard_Real aMaxTol);
|
||||
static
|
||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||
const TopoDS_Face& S,
|
||||
const Standard_Real aMaxTol);
|
||||
static
|
||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
const Adaptor3d_Curve& Other,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean SameParameter,
|
||||
Standard_Real& aNewTolerance);
|
||||
|
||||
//
|
||||
static
|
||||
void CorrectVertexTolerance(const TopoDS_Edge& aE);
|
||||
//
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectTolerances
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::CorrectTolerances(const TopoDS_Shape& aShape,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
GEOMAlgo_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol);
|
||||
GEOMAlgo_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectPointOnCurve
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::CorrectPointOnCurve(const TopoDS_Shape& S,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
Standard_Integer i, aNb;
|
||||
TopTools_IndexedMapOfShape Edges;
|
||||
TopExp::MapShapes (S, TopAbs_EDGE, Edges);
|
||||
aNb=Edges.Extent();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
|
||||
CheckEdge(E, aMaxTol);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectCurveOnSurface
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::CorrectCurveOnSurface(const TopoDS_Shape& S,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
Standard_Integer i, aNbFaces, j, aNbEdges;
|
||||
TopTools_IndexedMapOfShape Faces;
|
||||
TopExp::MapShapes (S, TopAbs_FACE, Faces);
|
||||
|
||||
aNbFaces=Faces.Extent();
|
||||
for (i=1; i<=aNbFaces; i++) {
|
||||
const TopoDS_Face& F= TopoDS::Face(Faces(i));
|
||||
TopTools_IndexedMapOfShape Edges;
|
||||
TopExp::MapShapes (F, TopAbs_EDGE, Edges);
|
||||
aNbEdges=Edges.Extent();
|
||||
for (j=1; j<=aNbEdges; j++) {
|
||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
|
||||
CorrectEdgeTolerance (E, F, aMaxTol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectEdgeTolerance
|
||||
// purpose : Correct tolerances for Edge
|
||||
//=======================================================================
|
||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||
const TopoDS_Face& S,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
//
|
||||
// 1. Minimum of conditions to Perform
|
||||
Handle (BRep_CurveRepresentation) myCref;
|
||||
Handle (Adaptor3d_HCurve) myHCurve;
|
||||
|
||||
myCref.Nullify();
|
||||
|
||||
Handle(BRep_TEdge)& TEx = *((Handle(BRep_TEdge)*)&myShape.TShape());
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcrx(TEx->Curves());
|
||||
Standard_Boolean Degenerated, SameParameterx, SameRangex;
|
||||
|
||||
Standard_Integer unique = 0;
|
||||
|
||||
Degenerated = TEx->Degenerated();
|
||||
SameParameterx = TEx->SameParameter();
|
||||
SameRangex = TEx->SameRange();
|
||||
|
||||
if (!SameRangex && SameParameterx) {
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) C3d;
|
||||
while (itcrx.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
|
||||
if (cr->IsCurve3D()) {
|
||||
unique++;
|
||||
if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
|
||||
myCref = cr;
|
||||
}
|
||||
}
|
||||
itcrx.Next();
|
||||
}
|
||||
|
||||
if (unique==0) {
|
||||
return;//...No3DCurve
|
||||
}
|
||||
if (unique>1) {
|
||||
return;//...Multiple3DCurve;
|
||||
}
|
||||
|
||||
if (myCref.IsNull() && !Degenerated) {
|
||||
itcrx.Initialize(TEx->Curves());
|
||||
while (itcrx.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
|
||||
if (cr->IsCurveOnSurface()) {
|
||||
myCref = cr;
|
||||
break;
|
||||
}
|
||||
itcrx.Next();
|
||||
}
|
||||
}
|
||||
|
||||
else if (!myCref.IsNull() && Degenerated){
|
||||
return ;//...InvalidDegeneratedFlag;
|
||||
}
|
||||
|
||||
if (!myCref.IsNull()) {
|
||||
const Handle(BRep_GCurve)& GCref = *((Handle(BRep_GCurve)*)&myCref);
|
||||
Standard_Real First,Last;
|
||||
GCref->Range(First,Last);
|
||||
if (Last<=First) {
|
||||
myCref.Nullify();
|
||||
return ;//InvalidRange;
|
||||
}
|
||||
|
||||
else {
|
||||
if (myCref->IsCurve3D()) {
|
||||
Handle(Geom_Curve) C3dx = Handle(Geom_Curve)::DownCast
|
||||
(myCref->Curve3D()->Transformed (myCref->Location().Transformation()));
|
||||
GeomAdaptor_Curve GAC3d(C3dx, First, Last);
|
||||
myHCurve = new GeomAdaptor_HCurve(GAC3d);
|
||||
}
|
||||
else { // curve on surface
|
||||
Handle(Geom_Surface) Sref = myCref->Surface();
|
||||
Sref = Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Transformation()));
|
||||
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
|
||||
Handle(GeomAdaptor_HSurface) GAHSref = new GeomAdaptor_HSurface(Sref);
|
||||
Handle(Geom2dAdaptor_HCurve) GHPCref = new Geom2dAdaptor_HCurve(PCref, First, Last);
|
||||
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
|
||||
myHCurve = new Adaptor3d_HCurveOnSurface(ACSref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===============================================
|
||||
// 2. Tolerances in InContext
|
||||
{
|
||||
if (myCref.IsNull())
|
||||
return;
|
||||
Standard_Boolean ok=Standard_True;;
|
||||
|
||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&myShape.TShape());
|
||||
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
|
||||
Standard_Real aNewTol=Tol;
|
||||
|
||||
Standard_Boolean SameParameter = TE->SameParameter();
|
||||
Standard_Boolean SameRange = TE->SameRange();
|
||||
Standard_Real First = myHCurve->FirstParameter();
|
||||
Standard_Real Last = myHCurve->LastParameter();
|
||||
Standard_Real Delta =1.e-14;
|
||||
|
||||
Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &S.TShape());
|
||||
const TopLoc_Location& Floc = S.Location();
|
||||
const TopLoc_Location& TFloc = TF->Location();
|
||||
const Handle(Geom_Surface)& Su = TF->Surface();
|
||||
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
|
||||
// Standard_Boolean checkclosed = Standard_False;
|
||||
Standard_Boolean pcurvefound = Standard_False;
|
||||
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
||||
while (itcr.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
|
||||
pcurvefound = Standard_True;
|
||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
|
||||
Standard_Real f,l;
|
||||
GC->Range(f,l);
|
||||
if (SameRange && (f != First || l != Last)) {
|
||||
return ;//BRepCheck_InvalidSameRangeFlag);
|
||||
if (SameParameter) {
|
||||
return; //BRepCheck_InvalidSameParameterFlag);
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Geom_Surface) Sb = cr->Surface();
|
||||
Sb = Handle(Geom_Surface)::DownCast (Su->Transformed(L.Transformation()));
|
||||
Handle(Geom2d_Curve) PC = cr->PCurve();
|
||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
|
||||
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
|
||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
||||
ok = Validate(myHCurve->Curve(), ACS, Tol, SameParameter, aNewTol);
|
||||
if (ok) {
|
||||
if (cr->IsCurveOnClosedSurface()) {
|
||||
//return ;// BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
||||
}
|
||||
else {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
||||
}
|
||||
if (SameParameter) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
||||
}
|
||||
//
|
||||
if (aNewTol<aMaxTol) {
|
||||
TE->UpdateTolerance(aNewTol+Delta);
|
||||
//
|
||||
CorrectVertexTolerance(myShape);
|
||||
}
|
||||
}
|
||||
|
||||
if (cr->IsCurveOnClosedSurface()) {
|
||||
// checkclosed = Standard_True;
|
||||
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
|
||||
ACS.Load(GAHS); // sans doute inutile
|
||||
ACS.Load(GHPC); // meme remarque...
|
||||
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
|
||||
if (ok) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
||||
if (SameParameter) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
||||
}
|
||||
if (aNewTol<aMaxTol) {
|
||||
TE->UpdateTolerance(aNewTol+Delta);
|
||||
CorrectVertexTolerance(myShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itcr.Next();
|
||||
}
|
||||
|
||||
if (!pcurvefound) {
|
||||
Handle(Geom_Plane) P;
|
||||
Handle(Standard_Type) styp = Su->DynamicType();
|
||||
if (styp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
P = Handle(Geom_Plane)::DownCast(Handle(Geom_RectangularTrimmedSurface)::
|
||||
DownCast(Su)->BasisSurface());
|
||||
}
|
||||
else {
|
||||
P = Handle(Geom_Plane)::DownCast(Su);
|
||||
}
|
||||
if (P.IsNull()) { // not a plane
|
||||
return;//BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
|
||||
}
|
||||
|
||||
else {// on fait la projection a la volee, comme BRep_Tool
|
||||
P = Handle(Geom_Plane)::DownCast(P->Transformed(L.Transformation()));
|
||||
//on projette Cref sur ce plan
|
||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(P);
|
||||
|
||||
// Dub - Normalement myHCurve est une GeomAdaptor_HCurve
|
||||
GeomAdaptor_Curve& Gac = Handle(GeomAdaptor_HCurve)::DownCast(myHCurve)->ChangeCurve();
|
||||
Handle(Geom_Curve) C3dx = Gac.Curve();
|
||||
Handle(Geom_Curve) ProjOnPlane = GeomProjLib::ProjectOnPlane
|
||||
(new Geom_TrimmedCurve(C3dx,First,Last), P, P->Position().Direction(), Standard_True);
|
||||
|
||||
Handle(GeomAdaptor_HCurve) aHCurve = new GeomAdaptor_HCurve(ProjOnPlane);
|
||||
|
||||
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
|
||||
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
||||
Handle(Geom2dAdaptor_HCurve) GHPC =
|
||||
new Geom2dAdaptor_HCurve(PC, myHCurve->FirstParameter(), myHCurve->LastParameter());
|
||||
|
||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
||||
|
||||
Standard_Boolean okx = Validate(myHCurve->Curve(),ACS,
|
||||
Tol,Standard_True, aNewTol); // voir dub...
|
||||
if (okx) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
||||
if (aNewTol<aMaxTol) {
|
||||
TE->UpdateTolerance(aNewTol+Delta);
|
||||
CorrectVertexTolerance(myShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}//end of if (!pcurvefound) {
|
||||
} // end of 2. Tolerances in InContext
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CorrectVertexTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void CorrectVertexTolerance(const TopoDS_Edge& aE)
|
||||
{
|
||||
Standard_Integer k, aNbV;
|
||||
Standard_Real aTolE, aTolV;
|
||||
TopTools_IndexedMapOfShape aVMap;
|
||||
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
|
||||
TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
|
||||
aNbV=aVMap.Extent();
|
||||
for (k=1; k<=aNbV; ++k) {
|
||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
if (aTolV<aTolE) {
|
||||
Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aV.TShape());
|
||||
aTV->UpdateTolerance(aTolE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define NCONTROL 23
|
||||
//=======================================================================
|
||||
//function : Validate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
const Adaptor3d_Curve& Other,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean SameParameter,
|
||||
Standard_Real& aNewTolerance)
|
||||
{
|
||||
Standard_Real First, Last, MaxDistance, aD, Tol2;
|
||||
|
||||
First = CRef.FirstParameter();
|
||||
Last = CRef.LastParameter();
|
||||
MaxDistance = 0.;
|
||||
Tol2 = Tol*Tol;
|
||||
|
||||
Standard_Integer i, aNC1=NCONTROL-1;
|
||||
|
||||
Standard_Boolean aFlag=Standard_False;
|
||||
Standard_Boolean proj = (!SameParameter ||
|
||||
First != Other.FirstParameter() ||
|
||||
Last != Other.LastParameter());
|
||||
//
|
||||
// 1.
|
||||
if (!proj) {
|
||||
for (i = 0; i < NCONTROL; i++) {
|
||||
Standard_Real prm = ((aNC1-i)*First + i*Last)/aNC1;
|
||||
gp_Pnt pref = CRef.Value(prm);
|
||||
gp_Pnt pother = Other.Value(prm);
|
||||
|
||||
aD=pref.SquareDistance(pother);
|
||||
|
||||
if (aD > Tol2) {
|
||||
if (aD>MaxDistance) {
|
||||
MaxDistance=aD;
|
||||
}
|
||||
aFlag=Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlag) {
|
||||
aNewTolerance=sqrt(MaxDistance);
|
||||
}
|
||||
return aFlag;
|
||||
}
|
||||
|
||||
//
|
||||
// 2.
|
||||
else {
|
||||
Extrema_LocateExtPC refd,otherd;
|
||||
Standard_Real OFirst, OLast;
|
||||
OFirst = Other.FirstParameter();
|
||||
OLast = Other.LastParameter();
|
||||
|
||||
gp_Pnt pd = CRef.Value(First);
|
||||
gp_Pnt pdo = Other.Value(OFirst);
|
||||
|
||||
aD = pd.SquareDistance(pdo);
|
||||
if (aD > Tol2) {
|
||||
if (aD>MaxDistance) {
|
||||
MaxDistance=aD;
|
||||
}
|
||||
aFlag=Standard_True;
|
||||
}
|
||||
|
||||
pd = CRef.Value(Last);
|
||||
pdo = Other.Value(OLast);
|
||||
aD = pd.SquareDistance(pdo);
|
||||
if (aD > Tol2 && aD > MaxDistance) {
|
||||
MaxDistance=aD;
|
||||
aFlag=Standard_True;
|
||||
}
|
||||
|
||||
refd.Initialize(CRef, First, Last, CRef.Resolution(Tol));
|
||||
otherd.Initialize(Other, OFirst, OLast, Other.Resolution(Tol));
|
||||
|
||||
for (i = 2; i< aNC1; i++) {
|
||||
Standard_Real rprm = ((aNC1-i)*First + i*Last)/aNC1;
|
||||
gp_Pnt pref = CRef.Value(rprm);
|
||||
|
||||
Standard_Real oprm = ((aNC1-i)*OFirst + i*OLast)/aNC1;
|
||||
gp_Pnt pother = Other.Value(oprm);
|
||||
|
||||
refd.Perform(pother,rprm);
|
||||
if (!refd.IsDone() || refd.SquareDistance() > Tol2) {
|
||||
if (refd.IsDone()) {
|
||||
aD=refd.SquareDistance();
|
||||
if (aD > Tol2 && aD>MaxDistance) {
|
||||
aFlag=Standard_True;
|
||||
MaxDistance=aD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otherd.Perform(pref,oprm);
|
||||
if (!otherd.IsDone() || otherd.SquareDistance() > Tol2) {
|
||||
|
||||
if (otherd.IsDone()) {
|
||||
aD=otherd.SquareDistance();
|
||||
if (aD > Tol2 && aD>MaxDistance) {
|
||||
aFlag=Standard_True;
|
||||
MaxDistance=aD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aD=sqrt (MaxDistance);
|
||||
aNewTolerance=aD;
|
||||
|
||||
return aFlag;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CheckEdge
|
||||
// purpose : Correct tolerances for Vertices on Edge
|
||||
//=======================================================================
|
||||
void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
|
||||
{
|
||||
TopoDS_Edge E=Ed;
|
||||
E.Orientation(TopAbs_FORWARD);
|
||||
|
||||
gp_Pnt Controlp;
|
||||
|
||||
TopExp_Explorer aVExp;
|
||||
aVExp.Init(E, TopAbs_VERTEX);
|
||||
for (; aVExp.More(); aVExp.Next()) {
|
||||
TopoDS_Vertex aVertex= TopoDS::Vertex(aVExp.Current());
|
||||
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &aVertex.TShape());
|
||||
const gp_Pnt& prep = TV->Pnt();
|
||||
|
||||
Standard_Real Tol, aD2, aNewTolerance, dd;
|
||||
|
||||
Tol =BRep_Tool::Tolerance(aVertex);
|
||||
Tol = Max(Tol, BRep_Tool::Tolerance(E));
|
||||
dd=0.1*Tol;
|
||||
Tol*=Tol;
|
||||
|
||||
const TopLoc_Location& Eloc = E.Location();
|
||||
BRep_ListIteratorOfListOfPointRepresentation itpr;
|
||||
|
||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&E.TShape());
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
||||
while (itcr.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||
const TopLoc_Location& loc = cr->Location();
|
||||
TopLoc_Location L = (Eloc * loc).Predivided(aVertex.Location());
|
||||
|
||||
if (cr->IsCurve3D()) {
|
||||
const Handle(Geom_Curve)& C = cr->Curve3D();
|
||||
if (!C.IsNull()) {
|
||||
itpr.Initialize(TV->Points());
|
||||
while (itpr.More()) {
|
||||
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
||||
if (pr->IsPointOnCurve(C,L)) {
|
||||
Controlp = C->Value(pr->Parameter());
|
||||
Controlp.Transform(L.Transformation());
|
||||
aD2=prep.SquareDistance(Controlp);
|
||||
if (aD2 > Tol) {
|
||||
aNewTolerance=sqrt(aD2)+dd;
|
||||
if (aNewTolerance<aMaxTol)
|
||||
TV->UpdateTolerance(aNewTolerance);
|
||||
}
|
||||
}
|
||||
itpr.Next();
|
||||
}
|
||||
|
||||
TopAbs_Orientation orv = aVertex.Orientation();
|
||||
if (orv == TopAbs_FORWARD || orv == TopAbs_REVERSED) {
|
||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
|
||||
|
||||
if (orv==TopAbs_FORWARD)
|
||||
Controlp = C->Value(GC->First());
|
||||
else
|
||||
Controlp = C->Value(GC->Last());
|
||||
|
||||
Controlp.Transform(L.Transformation());
|
||||
aD2=prep.SquareDistance(Controlp);
|
||||
|
||||
if (aD2 > Tol) {
|
||||
aNewTolerance=sqrt(aD2)+dd;
|
||||
if (aNewTolerance<aMaxTol)
|
||||
TV->UpdateTolerance(aNewTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itcr.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
141
src/GEOMAlgo/GEOMAlgo_AlgoTools_2.cxx
Executable file
141
src/GEOMAlgo/GEOMAlgo_AlgoTools_2.cxx
Executable file
@ -0,0 +1,141 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_AlgoTools_2.cxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
void ProcessBlock(const TopoDS_Shape& aF,
|
||||
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
TopTools_IndexedMapOfShape& aProcessed,
|
||||
TopTools_IndexedMapOfShape& aChain);
|
||||
|
||||
//=======================================================================
|
||||
// function: FindChains
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
|
||||
{
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
|
||||
//
|
||||
aItCS.Initialize(aLCS);
|
||||
for (; aItCS.More(); aItCS.Next()) {
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value();
|
||||
//
|
||||
const TopoDS_Shape& aF1=aCS.Shape1();
|
||||
const TopoDS_Shape& aF2=aCS.Shape2();
|
||||
//
|
||||
//
|
||||
if (aMCV.Contains(aF1)) {
|
||||
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1);
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
aMCV.Add(aF1, aMV);
|
||||
}
|
||||
//
|
||||
if (aMCV.Contains(aF2)) {
|
||||
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2);
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
aMCV.Add(aF2, aMV);
|
||||
}
|
||||
}
|
||||
GEOMAlgo_AlgoTools::FindChains(aMCV, aMapChains);
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FindChains
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
|
||||
{
|
||||
Standard_Integer i, j, aNbCV, aNbV;
|
||||
TopTools_IndexedMapOfShape aProcessed, aChain;
|
||||
//
|
||||
aNbCV=aMCV.Extent();
|
||||
for (i=1; i<=aNbCV; ++i) {
|
||||
const TopoDS_Shape& aF=aMCV.FindKey(i);
|
||||
if (aProcessed.Contains(aF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aProcessed.Add(aF);
|
||||
aChain.Add(aF);
|
||||
//
|
||||
const TopTools_IndexedMapOfShape& aMV=aMCV(i);
|
||||
aNbV=aMV.Extent();
|
||||
for (j=1; j<=aNbV; ++j) {
|
||||
const TopoDS_Shape& aFx=aMV(j);
|
||||
ProcessBlock(aFx, aMCV, aProcessed, aChain);
|
||||
}
|
||||
aMapChains.Add(aF, aChain);
|
||||
aChain.Clear();
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: ProcessBlock
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void ProcessBlock(const TopoDS_Shape& aF,
|
||||
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
TopTools_IndexedMapOfShape& aProcessed,
|
||||
TopTools_IndexedMapOfShape& aChain)
|
||||
{
|
||||
Standard_Integer j, aNbV;
|
||||
//
|
||||
if (aProcessed.Contains(aF)) {
|
||||
return;
|
||||
}
|
||||
aProcessed.Add(aF);
|
||||
aChain.Add(aF);
|
||||
//
|
||||
const TopTools_IndexedMapOfShape& aMV=aMCV.FindFromKey(aF);
|
||||
aNbV=aMV.Extent();
|
||||
for (j=1; j<=aNbV; ++j) {
|
||||
const TopoDS_Shape& aFx=aMV(j);
|
||||
ProcessBlock(aFx, aMCV, aProcessed, aChain);
|
||||
}
|
||||
}
|
||||
|
10
src/NMTDS/NMTDS_BndSphere.cxx → src/GEOMAlgo/GEOMAlgo_BndSphere.cxx
Normal file → Executable file
10
src/NMTDS/NMTDS_BndSphere.cxx → src/GEOMAlgo/GEOMAlgo_BndSphere.cxx
Normal file → Executable file
@ -17,18 +17,18 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BndSphere.cxx
|
||||
// File: GEOMAlgo_BndSphere.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#include <NMTDS_BndSphere.hxx>
|
||||
#include <GEOMAlgo_BndSphere.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_BndSphere::NMTDS_BndSphere()
|
||||
GEOMAlgo_BndSphere::GEOMAlgo_BndSphere()
|
||||
{
|
||||
myCenter.SetCoord(0., 0., 0.);
|
||||
myRadius=0.;
|
||||
@ -38,14 +38,14 @@
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_BndSphere::~NMTDS_BndSphere()
|
||||
GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsOut
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean NMTDS_BndSphere::IsOut(const NMTDS_BndSphere& theOther)const
|
||||
Standard_Boolean GEOMAlgo_BndSphere::IsOut(const GEOMAlgo_BndSphere& theOther)const
|
||||
{
|
||||
Standard_Real aD2, aT2;
|
||||
//
|
20
src/NMTDS/NMTDS_BndSphere.hxx → src/GEOMAlgo/GEOMAlgo_BndSphere.hxx
Normal file → Executable file
20
src/NMTDS/NMTDS_BndSphere.hxx → src/GEOMAlgo/GEOMAlgo_BndSphere.hxx
Normal file → Executable file
@ -17,13 +17,13 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BndSphere.hxx
|
||||
// File: GEOMAlgo_BndSphere.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
#ifndef _NMTDS_BndSphere_HeaderFile
|
||||
#define _NMTDS_BndSphere_HeaderFile
|
||||
#ifndef _GEOMAlgo_BndSphere_HeaderFile
|
||||
#define _GEOMAlgo_BndSphere_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
@ -32,16 +32,16 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : NMTDS_BndSphere
|
||||
//class : GEOMAlgo_BndSphere
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class NMTDS_BndSphere {
|
||||
class GEOMAlgo_BndSphere {
|
||||
public:
|
||||
Standard_EXPORT
|
||||
NMTDS_BndSphere();
|
||||
GEOMAlgo_BndSphere();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~NMTDS_BndSphere();
|
||||
virtual ~GEOMAlgo_BndSphere();
|
||||
|
||||
void SetCenter(const gp_Pnt& theP) ;
|
||||
|
||||
@ -55,10 +55,10 @@ class NMTDS_BndSphere {
|
||||
|
||||
Standard_Real Gap() const;
|
||||
|
||||
void Add(const NMTDS_BndSphere& theOther) ;
|
||||
void Add(const GEOMAlgo_BndSphere& theOther) ;
|
||||
|
||||
Standard_EXPORT
|
||||
Standard_Boolean IsOut(const NMTDS_BndSphere& theOther) const;
|
||||
Standard_Boolean IsOut(const GEOMAlgo_BndSphere& theOther) const;
|
||||
|
||||
Standard_Real SquareExtent() const;
|
||||
|
||||
@ -68,6 +68,6 @@ class NMTDS_BndSphere {
|
||||
Standard_Real myGap;
|
||||
};
|
||||
|
||||
#include <NMTDS_BndSphere.lxx>
|
||||
#include <GEOMAlgo_BndSphere.lxx>
|
||||
|
||||
#endif
|
18
src/NMTDS/NMTDS_BndSphere.lxx → src/GEOMAlgo/GEOMAlgo_BndSphere.lxx
Normal file → Executable file
18
src/NMTDS/NMTDS_BndSphere.lxx → src/GEOMAlgo/GEOMAlgo_BndSphere.lxx
Normal file → Executable file
@ -17,7 +17,7 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BndSphere.lxx
|
||||
// File: GEOMAlgo_BndSphere.lxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
@ -25,7 +25,7 @@
|
||||
//function : SetCenter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void NMTDS_BndSphere::SetCenter(const gp_Pnt& theP)
|
||||
inline void GEOMAlgo_BndSphere::SetCenter(const gp_Pnt& theP)
|
||||
//
|
||||
{
|
||||
myCenter=theP;
|
||||
@ -34,7 +34,7 @@
|
||||
//function : Center
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const gp_Pnt& NMTDS_BndSphere::Center()const
|
||||
inline const gp_Pnt& GEOMAlgo_BndSphere::Center()const
|
||||
{
|
||||
return myCenter;
|
||||
}
|
||||
@ -42,7 +42,7 @@
|
||||
//function : SetRadius
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void NMTDS_BndSphere::SetRadius(const Standard_Real theR)
|
||||
inline void GEOMAlgo_BndSphere::SetRadius(const Standard_Real theR)
|
||||
{
|
||||
myRadius=theR;
|
||||
}
|
||||
@ -50,7 +50,7 @@
|
||||
//function : Radius
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real NMTDS_BndSphere::Radius()const
|
||||
inline Standard_Real GEOMAlgo_BndSphere::Radius()const
|
||||
{
|
||||
return myRadius;
|
||||
}
|
||||
@ -58,7 +58,7 @@
|
||||
//function : SetGap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void NMTDS_BndSphere::SetGap(const Standard_Real theGap)
|
||||
inline void GEOMAlgo_BndSphere::SetGap(const Standard_Real theGap)
|
||||
{
|
||||
myGap=theGap;
|
||||
}
|
||||
@ -66,7 +66,7 @@
|
||||
//function : Gap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real NMTDS_BndSphere::Gap()const
|
||||
inline Standard_Real GEOMAlgo_BndSphere::Gap()const
|
||||
{
|
||||
return myGap;
|
||||
}
|
||||
@ -74,7 +74,7 @@
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void NMTDS_BndSphere::Add(const NMTDS_BndSphere& theOther)
|
||||
inline void GEOMAlgo_BndSphere::Add(const GEOMAlgo_BndSphere& theOther)
|
||||
{
|
||||
Standard_Real aTmax, aR, aT, aTOther;
|
||||
gp_Pnt aPc;
|
||||
@ -96,7 +96,7 @@
|
||||
//function : SquareExtent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real NMTDS_BndSphere::SquareExtent()const
|
||||
inline Standard_Real GEOMAlgo_BndSphere::SquareExtent()const
|
||||
{
|
||||
Standard_Real aD;
|
||||
//
|
18
src/NMTDS/NMTDS_BndSphereTree.cxx → src/GEOMAlgo/GEOMAlgo_BndSphereTree.cxx
Normal file → Executable file
18
src/NMTDS/NMTDS_BndSphereTree.cxx → src/GEOMAlgo/GEOMAlgo_BndSphereTree.cxx
Normal file → Executable file
@ -17,31 +17,31 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BndSphereTree.cxx
|
||||
// File: GEOMAlgo_BndSphereTree.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#include <NMTDS_BndSphereTree.hxx>
|
||||
#include <GEOMAlgo_BndSphereTree.hxx>
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_BndSphereTreeSelector::NMTDS_BndSphereTreeSelector()
|
||||
GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_BndSphereTreeSelector::~NMTDS_BndSphereTreeSelector()
|
||||
GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Reject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean NMTDS_BndSphereTreeSelector::Reject (const NMTDS_BndSphere& aBox) const
|
||||
Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Reject (const GEOMAlgo_BndSphere& aBox) const
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
//
|
||||
@ -52,7 +52,7 @@
|
||||
//function : Accept
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean NMTDS_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
|
||||
Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
|
||||
{
|
||||
Standard_Boolean bRet=Standard_False;
|
||||
//
|
||||
@ -66,7 +66,7 @@
|
||||
//function : SetBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void NMTDS_BndSphereTreeSelector::SetBox(const NMTDS_BndSphere& aBox)
|
||||
void GEOMAlgo_BndSphereTreeSelector::SetBox(const GEOMAlgo_BndSphere& aBox)
|
||||
{
|
||||
myBox=aBox;
|
||||
}
|
||||
@ -74,7 +74,7 @@
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void NMTDS_BndSphereTreeSelector::Clear()
|
||||
void GEOMAlgo_BndSphereTreeSelector::Clear()
|
||||
{
|
||||
myFence.Clear();
|
||||
myIndices.Clear();
|
||||
@ -83,7 +83,7 @@
|
||||
//function : Indices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TColStd_ListOfInteger& NMTDS_BndSphereTreeSelector::Indices() const
|
||||
const TColStd_ListOfInteger& GEOMAlgo_BndSphereTreeSelector::Indices() const
|
||||
{
|
||||
return myIndices;
|
||||
}
|
22
src/NMTDS/NMTDS_BndSphereTree.hxx → src/GEOMAlgo/GEOMAlgo_BndSphereTree.hxx
Normal file → Executable file
22
src/NMTDS/NMTDS_BndSphereTree.hxx → src/GEOMAlgo/GEOMAlgo_BndSphereTree.hxx
Normal file → Executable file
@ -17,34 +17,34 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BndSphereTree.hxx
|
||||
// File: GEOMAlgo_BndSphereTree.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#ifndef NMTDS_BndSphereTree_HeaderFile
|
||||
#define NMTDS_BndSphereTree_HeaderFile
|
||||
#ifndef GEOMAlgo_BndSphereTree_HeaderFile
|
||||
#define GEOMAlgo_BndSphereTree_HeaderFile
|
||||
|
||||
#include <NCollection_UBTree.hxx>
|
||||
#include <NMTDS_BndSphere.hxx>
|
||||
#include <GEOMAlgo_BndSphere.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
typedef NCollection_UBTree <Standard_Integer , NMTDS_BndSphere> NMTDS_BndSphereTree;
|
||||
typedef NCollection_UBTree <Standard_Integer , GEOMAlgo_BndSphere> GEOMAlgo_BndSphereTree;
|
||||
|
||||
class NMTDS_BndSphereTreeSelector : public NMTDS_BndSphereTree::Selector {
|
||||
class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector {
|
||||
public:
|
||||
Standard_EXPORT NMTDS_BndSphereTreeSelector();
|
||||
Standard_EXPORT virtual Standard_Boolean Reject(const NMTDS_BndSphere&) const;
|
||||
Standard_EXPORT GEOMAlgo_BndSphereTreeSelector();
|
||||
Standard_EXPORT virtual Standard_Boolean Reject(const GEOMAlgo_BndSphere&) const;
|
||||
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
|
||||
Standard_EXPORT virtual ~NMTDS_BndSphereTreeSelector();
|
||||
Standard_EXPORT virtual ~GEOMAlgo_BndSphereTreeSelector();
|
||||
|
||||
Standard_EXPORT void Clear();
|
||||
Standard_EXPORT void SetBox(const NMTDS_BndSphere&);
|
||||
Standard_EXPORT void SetBox(const GEOMAlgo_BndSphere&);
|
||||
Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
|
||||
|
||||
protected:
|
||||
NMTDS_BndSphere myBox;
|
||||
GEOMAlgo_BndSphere myBox;
|
||||
TColStd_MapOfInteger myFence;
|
||||
TColStd_ListOfInteger myIndices;
|
||||
|
18
src/NMTDS/NMTDS_BoxBndTree.cxx → src/GEOMAlgo/GEOMAlgo_BoxBndTree.cxx
Normal file → Executable file
18
src/NMTDS/NMTDS_BoxBndTree.cxx → src/GEOMAlgo/GEOMAlgo_BoxBndTree.cxx
Normal file → Executable file
@ -20,31 +20,31 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BoxBndTree.cxx
|
||||
// File: GEOMAlgo_BoxBndTree.cxx
|
||||
// Created: Tue Oct 17 13:04:11 2006
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#include <NMTDS_BoxBndTree.hxx>
|
||||
#include <GEOMAlgo_BoxBndTree.hxx>
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_BoxBndTreeSelector::NMTDS_BoxBndTreeSelector()
|
||||
GEOMAlgo_BoxBndTreeSelector::GEOMAlgo_BoxBndTreeSelector()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_BoxBndTreeSelector::~NMTDS_BoxBndTreeSelector()
|
||||
GEOMAlgo_BoxBndTreeSelector::~GEOMAlgo_BoxBndTreeSelector()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Reject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean NMTDS_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
|
||||
Standard_Boolean GEOMAlgo_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
//
|
||||
@ -55,7 +55,7 @@
|
||||
//function : Accept
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean NMTDS_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
|
||||
Standard_Boolean GEOMAlgo_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
|
||||
{
|
||||
Standard_Boolean bRet=Standard_False;
|
||||
//
|
||||
@ -69,7 +69,7 @@
|
||||
//function : SetBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void NMTDS_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
|
||||
void GEOMAlgo_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
|
||||
{
|
||||
myBox=aBox;
|
||||
}
|
||||
@ -77,7 +77,7 @@
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void NMTDS_BoxBndTreeSelector::Clear()
|
||||
void GEOMAlgo_BoxBndTreeSelector::Clear()
|
||||
{
|
||||
myFence.Clear();
|
||||
myIndices.Clear();
|
||||
@ -86,7 +86,7 @@
|
||||
//function : Indices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TColStd_ListOfInteger& NMTDS_BoxBndTreeSelector::Indices() const
|
||||
const TColStd_ListOfInteger& GEOMAlgo_BoxBndTreeSelector::Indices() const
|
||||
{
|
||||
return myIndices;
|
||||
}
|
@ -20,27 +20,27 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_BoxBndTree.hxx
|
||||
// File: GEOMAlgo_BoxBndTree.hxx
|
||||
// Created: Tue Oct 17 12:50:31 2006
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#ifndef NMTDS_BoxBndTree_HeaderFile
|
||||
#define NMTDS_BoxBndTree_HeaderFile
|
||||
#ifndef GEOMAlgo_BoxBndTree_HeaderFile
|
||||
#define GEOMAlgo_BoxBndTree_HeaderFile
|
||||
|
||||
#include <NCollection_UBTree.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> NMTDS_BoxBndTree;
|
||||
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> GEOMAlgo_BoxBndTree;
|
||||
|
||||
class NMTDS_BoxBndTreeSelector : public NMTDS_BoxBndTree::Selector {
|
||||
class GEOMAlgo_BoxBndTreeSelector : public GEOMAlgo_BoxBndTree::Selector {
|
||||
public:
|
||||
Standard_EXPORT NMTDS_BoxBndTreeSelector();
|
||||
Standard_EXPORT GEOMAlgo_BoxBndTreeSelector();
|
||||
Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box&) const;
|
||||
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
|
||||
Standard_EXPORT virtual ~NMTDS_BoxBndTreeSelector();
|
||||
Standard_EXPORT virtual ~GEOMAlgo_BoxBndTreeSelector();
|
||||
|
||||
Standard_EXPORT void Clear();
|
||||
Standard_EXPORT void SetBox(const Bnd_Box&);
|
@ -1,416 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Builder.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <BOP_CorrectTolerances.hxx>
|
||||
|
||||
#include <BRepLib.hxx>
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_Builder::GEOMAlgo_Builder()
|
||||
:
|
||||
GEOMAlgo_BuilderShape()
|
||||
{
|
||||
myNbTypes=9;
|
||||
myPaveFiller=NULL;
|
||||
myEntryPoint=0; // Entry point through PerformWithFiller ()
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_Builder::~GEOMAlgo_Builder()
|
||||
{
|
||||
if (myEntryPoint==1) {
|
||||
if (myPaveFiller) {
|
||||
delete myPaveFiller;
|
||||
myPaveFiller=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddCompound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::AddCompound(const TopoDS_Shape& theShape)
|
||||
{
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
aIt.Initialize(theShape);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
AddShape(aS);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::AddShape(const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (myMapFence.Add(theShape)) {
|
||||
myShapes.Append(theShape);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Shapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_Builder::Shapes()const
|
||||
{
|
||||
return myShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::Clear()
|
||||
{
|
||||
myShapes.Clear();
|
||||
ClearInternals();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ClearInternals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::ClearInternals()
|
||||
{
|
||||
Standard_Integer i;
|
||||
//
|
||||
for (i=0; i<myNbTypes; ++i){
|
||||
myShapes1[i].Clear();
|
||||
}
|
||||
myImages.Clear();
|
||||
//
|
||||
myInParts.Clear();
|
||||
mySplitFaces.Clear();
|
||||
mySameDomainShapes.Clear();
|
||||
myDraftSolids.Clear();
|
||||
myMapFence.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Prepare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::Prepare()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Integer aNb;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Compound aC;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
aNb=myShapes.Extent();
|
||||
if (aNb<2) {
|
||||
myErrorStatus=10; // No shapes to process
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 1. myShape is empty compound
|
||||
aBB.MakeCompound(aC);
|
||||
myShape=aC;
|
||||
//
|
||||
// 2. myShapes1
|
||||
aIt.Initialize(myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
AddShape1(aS);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddShape1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::AddShape1(const TopoDS_Shape& theShape)
|
||||
{
|
||||
Standard_Integer iType;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopoDS_Iterator aIt;
|
||||
TopTools_MapOfShape aM;
|
||||
//
|
||||
aType=theShape.ShapeType();
|
||||
if (aType==TopAbs_COMPOUND) {
|
||||
aIt.Initialize(theShape);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
AddShape1(aS);
|
||||
}
|
||||
}
|
||||
//
|
||||
iType=(Standard_Integer)aType;
|
||||
if (aM.Add(theShape)) {
|
||||
myShapes1[iType].Append(theShape);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
TopAbs_ShapeEnum aType;
|
||||
BRep_Builder aBB;
|
||||
TopTools_MapOfShape aM;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aItIm;
|
||||
//
|
||||
aIt.Initialize(myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
aType=aS.ShapeType();
|
||||
if (aType==theType) {
|
||||
if (myImages.HasImage(aS)){
|
||||
const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
aBB.Add(myShape, aSIm);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aM.Add(aS)) {
|
||||
aBB.Add(myShape, aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::Perform()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Compound aCS;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
aBB.MakeCompound(aCS);
|
||||
//
|
||||
aIt.Initialize(myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
aBB.Add(aCS, aS);
|
||||
}
|
||||
//
|
||||
NMTTools_PaveFiller* pPF=new NMTTools_PaveFiller;
|
||||
//
|
||||
pPF->SetCompositeShape(aCS);
|
||||
pPF->Perform();
|
||||
//
|
||||
myEntryPoint=1;
|
||||
PerformInternal(*pPF);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformWithFiller
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_PaveFiller& theDSF)
|
||||
{
|
||||
myEntryPoint=0;
|
||||
//
|
||||
PerformInternal(theDSF);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInternal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::PerformInternal(const NMTTools_PaveFiller& pPF)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Boolean bIsDone;
|
||||
//
|
||||
// 0. myPaveFiller
|
||||
myPaveFiller=(NMTTools_PaveFiller *)&pPF;
|
||||
//
|
||||
bIsDone=myPaveFiller->IsDone();
|
||||
if (!bIsDone) {
|
||||
myErrorStatus=2; // PaveFiller is failed
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 1. Clear Internal fields
|
||||
ClearInternals();
|
||||
//
|
||||
// 2. Prepare
|
||||
Prepare();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 3. Fill Images
|
||||
//
|
||||
// 3.1 Vertices
|
||||
FillImagesVertices();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_VERTEX);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.2 Edges
|
||||
FillImagesEdges();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_EDGE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.3 Wires
|
||||
FillImagesContainers(TopAbs_WIRE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_WIRE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 3.4 Faces
|
||||
FillImagesFaces();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_FACE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.5 Shells
|
||||
|
||||
FillImagesContainers(TopAbs_SHELL);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_SHELL);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.6 Solids
|
||||
FillImagesSolids();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_SOLID);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.7 CompSolids
|
||||
FillImagesContainers(TopAbs_COMPSOLID);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_COMPSOLID);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.8 Compounds
|
||||
FillImagesContainers(TopAbs_COMPOUND);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildResult(TopAbs_COMPOUND);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 4.History
|
||||
PrepareHistory();
|
||||
//
|
||||
// 5 Post-treatment
|
||||
PostTreat();
|
||||
}
|
||||
//
|
||||
// static
|
||||
// void CorrectWires(const TopoDS_Shape& aS);
|
||||
//
|
||||
//=======================================================================
|
||||
//function : PostTreat
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::PostTreat()
|
||||
{
|
||||
Standard_Integer aNbS;
|
||||
TopoDS_Iterator aIt;
|
||||
TopTools_ListOfShape aLS;
|
||||
//
|
||||
aIt.Initialize(myShape);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
aLS.Append(aS);
|
||||
}
|
||||
aNbS=aLS.Extent();
|
||||
if (aNbS==1) {
|
||||
myShape=aLS.First();
|
||||
}
|
||||
|
||||
BRepLib::SameParameter(myShape, 1.e-7, Standard_True);
|
||||
//
|
||||
GEOMAlgo_Tools::CorrectWires(myShape);
|
||||
}
|
||||
//
|
||||
// myErrorStatus
|
||||
//
|
||||
// 0 - Ok
|
||||
// 1 - The object is just initialized
|
||||
// 2 - PaveFiller is failed
|
||||
// 10 - No shapes to process
|
||||
// 30 - SolidBuilder failed
|
||||
|
@ -1,224 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Builder.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#ifndef _GEOMAlgo_Builder_HeaderFile
|
||||
#define _GEOMAlgo_Builder_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <NMTTools_PPaveFiller.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <BRepAlgo_Image.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
#include <GEOMAlgo_BuilderShape.hxx>
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <BRepAlgo_Image.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_Builder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_Builder : public GEOMAlgo_BuilderShape
|
||||
{
|
||||
public:
|
||||
//! Empty constructor <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_Builder();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_Builder();
|
||||
|
||||
//! Performs calculations <br>
|
||||
Standard_EXPORT
|
||||
virtual void Perform() ;
|
||||
|
||||
//! Performs calculations using prepared PaveFiller <br>
|
||||
//! object theDSF <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ;
|
||||
|
||||
//! Adds argument theShape of the operation <br>
|
||||
Standard_EXPORT
|
||||
virtual void AddShape(const TopoDS_Shape& theShape) ;
|
||||
|
||||
//! Clears internal fields and arguments <br>
|
||||
Standard_EXPORT
|
||||
virtual void Clear() ;
|
||||
|
||||
//! Returns the arguments of the operation <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& Shapes() const;
|
||||
|
||||
//! Returns the list of shapes generated from the <br>
|
||||
//! shape theS. <br>
|
||||
Standard_EXPORT
|
||||
virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
|
||||
|
||||
//! Returns the list of shapes modified from the shape <br>
|
||||
//! theS. <br>
|
||||
Standard_EXPORT
|
||||
virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
|
||||
|
||||
//! Returns true if the shape theS has been deleted. <br>
|
||||
Standard_EXPORT
|
||||
virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
|
||||
|
||||
//! Adds arguments of the operation as <br>
|
||||
//! shapes of upper level of container shape theShape <br>
|
||||
Standard_EXPORT
|
||||
void AddCompound(const TopoDS_Shape& theShape) ;
|
||||
|
||||
//! Returns list of arguments of type theType <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const;
|
||||
|
||||
//! Returns image shapes <br>
|
||||
Standard_EXPORT
|
||||
const BRepAlgo_Image& Images() const;
|
||||
|
||||
//! Returns split-parts of shapes that have <br>
|
||||
//! state IN for the domain of shape theShape <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const;
|
||||
|
||||
protected:
|
||||
//! Performs calculations using prepared DSFiller <br>
|
||||
//! object theDSF <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformInternal(const NMTTools_PaveFiller& theDSF) ;
|
||||
|
||||
//! Prepare information for history support <br>
|
||||
Standard_EXPORT
|
||||
virtual void PrepareHistory() ;
|
||||
|
||||
//! Clears internal fields <br>
|
||||
Standard_EXPORT
|
||||
virtual void ClearInternals() ;
|
||||
|
||||
//! Provides preparing actions <br>
|
||||
Standard_EXPORT
|
||||
virtual void Prepare() ;
|
||||
|
||||
//! Provides post-tratment actions <br>
|
||||
Standard_EXPORT
|
||||
virtual void PostTreat() ;
|
||||
|
||||
//! Append the argument theShape to <br>
|
||||
//! typified lists of arguments myShapes1 <br>
|
||||
Standard_EXPORT
|
||||
void AddShape1(const TopoDS_Shape& theShape) ;
|
||||
|
||||
//! Build the resulting shapes of type theType <br>
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult(const TopAbs_ShapeEnum theType) ;
|
||||
|
||||
//! Fill Images for vertices <br>
|
||||
Standard_EXPORT
|
||||
void FillImagesVertices() ;
|
||||
|
||||
//! Fill Images for edges <br>
|
||||
Standard_EXPORT
|
||||
void FillImagesEdges() ;
|
||||
|
||||
//! Fill Images for faces <br>
|
||||
Standard_EXPORT
|
||||
void FillImagesFaces() ;
|
||||
|
||||
//! For each interferred face find split edges <br>
|
||||
//! that are in 2-D domain of the face <br>
|
||||
Standard_EXPORT
|
||||
void FillIn2DParts() ;
|
||||
|
||||
//! Build draft faces <br>
|
||||
Standard_EXPORT
|
||||
void BuildSplitFaces() ;
|
||||
|
||||
//! Among draft faces find same domain faces <br>
|
||||
Standard_EXPORT
|
||||
void FillSameDomainFaces() ;
|
||||
|
||||
//! Fill Images for faces <br>
|
||||
//! taking into account same domain faces <br>
|
||||
Standard_EXPORT
|
||||
void FillImagesFaces1() ;
|
||||
|
||||
//! Update Images for faces by <br>
|
||||
//! internal vertices <br>
|
||||
Standard_EXPORT
|
||||
void FillInternalVertices() ;
|
||||
|
||||
//! Fill Images for Wires, Shells, Compsolids, Compounds <br>
|
||||
Standard_EXPORT
|
||||
void FillImagesContainers(const TopAbs_ShapeEnum theType) ;
|
||||
|
||||
//! Fill Images for solids <br>
|
||||
Standard_EXPORT
|
||||
void FillImagesSolids() ;
|
||||
|
||||
//! For each interferred solid find split faces <br>
|
||||
//! that are in 3-D domain of the solid <br>
|
||||
Standard_EXPORT
|
||||
void FillIn3DParts() ;
|
||||
|
||||
//! Build draft solids <br>
|
||||
Standard_EXPORT
|
||||
void BuildSplitSolids() ;
|
||||
|
||||
//! Update draft solids by <br>
|
||||
//! internal shells, edges, vertices <br>
|
||||
Standard_EXPORT
|
||||
void FillInternalShapes() ;
|
||||
|
||||
//! Build solid theDraftSolid that consists of <br>
|
||||
//! non-internal split faces of the solid <br>
|
||||
//! theSolid. <br>
|
||||
//! All splits of internal faces of <br>
|
||||
//! theSolid are in the list: theInternalFaces <br>
|
||||
Standard_EXPORT
|
||||
void BuildDraftSolid(const TopoDS_Shape& theSolid,
|
||||
TopoDS_Shape& theDraftSolid,
|
||||
TopTools_ListOfShape& theInternalFaces) ;
|
||||
|
||||
|
||||
NMTTools_PPaveFiller myPaveFiller;
|
||||
TopTools_ListOfShape myShapes;
|
||||
Standard_Integer myNbTypes;
|
||||
TopTools_MapOfShape myMapFence;
|
||||
TopTools_ListOfShape myShapes1[9];
|
||||
BRepAlgo_Image myImages;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape myInParts;
|
||||
BRepAlgo_Image mySplitFaces;
|
||||
TopTools_IndexedDataMapOfShapeShape mySameDomainShapes;
|
||||
TopTools_IndexedDataMapOfShapeShape myDraftSolids;
|
||||
Standard_Integer myEntryPoint;
|
||||
|
||||
};
|
||||
#endif
|
@ -1,142 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderArea.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_BuilderArea.hxx>
|
||||
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_BuilderArea::GEOMAlgo_BuilderArea()
|
||||
:
|
||||
GEOMAlgo_Algo()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_BuilderArea::~GEOMAlgo_BuilderArea()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::SetContext(const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
myContext=theContext;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(IntTools_Context)& GEOMAlgo_BuilderArea::Context()const
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::Perform()
|
||||
{
|
||||
if (myContext.IsNull()) {
|
||||
myContext=new IntTools_Context;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::SetShapes(const TopTools_ListOfShape& theLF)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myShapes.Clear();
|
||||
aIt.Initialize(theLF);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
myShapes.Append(aF);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Shapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Shapes()const
|
||||
{
|
||||
return myShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Loops
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Loops()const
|
||||
{
|
||||
return myLoops;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Areas
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Areas()const
|
||||
{
|
||||
return myAreas;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :PerformShapesToAvoid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::PerformShapesToAvoid()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformLoops
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::PerformLoops()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformAreas
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::PerformAreas()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInternalShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderArea::PerformInternalShapes()
|
||||
{
|
||||
}
|
||||
|
@ -1,112 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderArea.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
|
||||
#ifndef _GEOMAlgo_BuilderArea_HeaderFile
|
||||
#define _GEOMAlgo_BuilderArea_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
#include <Handle_IntTools_Context.hxx>
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
//! The root class for algorithms to build <br>
|
||||
//! faces/solids from set of edges/faces <br>
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_BuilderArea
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_BuilderArea : public GEOMAlgo_Algo
|
||||
{
|
||||
public:
|
||||
//! Sets cashed geometrical tools <br>
|
||||
Standard_EXPORT
|
||||
void SetContext(const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Returns cashed geometrical tools <br>
|
||||
Standard_EXPORT
|
||||
const Handle_IntTools_Context& Context() const;
|
||||
|
||||
//! Sets edges/faces to process <br>
|
||||
Standard_EXPORT
|
||||
void SetShapes(const TopTools_ListOfShape& theLS) ;
|
||||
|
||||
//! Returns edges/faces to process <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& Shapes() const;
|
||||
|
||||
//! Returns wires/shells that have been built <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& Loops() const;
|
||||
|
||||
//! Returns faces/solids that have been built <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& Areas() const;
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void Perform() ;
|
||||
|
||||
protected:
|
||||
//! Empty constructor <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_BuilderArea();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_BuilderArea();
|
||||
//! Collect the edges/faces that <br>
|
||||
//! a) are internal <br>
|
||||
//! b) are the same and have different orientation <br>
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void PerformShapesToAvoid() ;
|
||||
|
||||
//! Build draft faces/shells <br>
|
||||
//! a)myLoops - draft faces/shells that consist of <br>
|
||||
//! boundary edges/faces <br>
|
||||
//! b)myLoopsInternal - draft faces/shells that contains <br>
|
||||
//! inner edges/faces <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformLoops() ;
|
||||
//! Build draft faces/solids that contains boundary faces <br>
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void PerformAreas() ;
|
||||
|
||||
//! Build finalized faces/solids with internal wires/shells <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformInternalShapes() ;
|
||||
|
||||
TopTools_ListOfShape myShapes;
|
||||
TopTools_ListOfShape myLoops;
|
||||
TopTools_ListOfShape myLoopsInternal;
|
||||
TopTools_MapOfOrientedShape myShapesToAvoid;
|
||||
TopTools_ListOfShape myAreas;
|
||||
Handle_IntTools_Context myContext;
|
||||
};
|
||||
#endif
|
@ -1,711 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderFace.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_BuilderFace.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfOrientedShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <BOP_WireEdgeSet.hxx>
|
||||
#include <BOP_WESCorrector.hxx>
|
||||
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <GEOMAlgo_BuilderTools.hxx>
|
||||
#include <GEOMAlgo_WireEdgeSet.hxx>
|
||||
#include <GEOMAlgo_WESCorrector.hxx>
|
||||
|
||||
//
|
||||
static
|
||||
Standard_Boolean IsGrowthWire(const TopoDS_Shape& ,
|
||||
|
||||
const TopTools_IndexedMapOfShape& );
|
||||
|
||||
static
|
||||
Standard_Boolean IsInside(const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const Handle(IntTools_Context)& );
|
||||
static
|
||||
void MakeInternalWires(const TopTools_MapOfShape& ,
|
||||
TopTools_ListOfShape& );
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_BuilderFace::GEOMAlgo_BuilderFace()
|
||||
:
|
||||
GEOMAlgo_BuilderArea()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_BuilderFace::~GEOMAlgo_BuilderFace()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderFace::SetFace(const TopoDS_Face& theFace)
|
||||
{
|
||||
myFace=theFace;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Face& GEOMAlgo_BuilderFace::Face()const
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderFace::Perform()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
if (myFace.IsNull()) {
|
||||
myErrorStatus=12;// Null face generix
|
||||
return;
|
||||
}
|
||||
// Initialize the context
|
||||
GEOMAlgo_BuilderArea::Perform();
|
||||
//
|
||||
PerformShapesToAvoid();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
PerformLoops();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
PerformAreas();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
PerformInternalShapes();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function :PerformShapesToAvoid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderFace::PerformShapesToAvoid()
|
||||
{
|
||||
Standard_Boolean bFound;
|
||||
Standard_Integer i, iCnt, aNbV, aNbE;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myShapesToAvoid.Clear();
|
||||
//
|
||||
iCnt=0;
|
||||
while (1) {
|
||||
++iCnt;
|
||||
bFound=Standard_False;
|
||||
//
|
||||
// 1. MEF
|
||||
aMVE.Clear();
|
||||
aIt.Initialize (myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if (!myShapesToAvoid.Contains(aE)) {
|
||||
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
}
|
||||
// else {
|
||||
// int a=0;
|
||||
// }
|
||||
}
|
||||
aNbV=aMVE.Extent();
|
||||
//
|
||||
// 2. myEdgesToAvoid
|
||||
for (i=1; i<=aNbV; ++i) {
|
||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aMVE.FindKey(i));
|
||||
//
|
||||
TopTools_ListOfShape& aLE=aMVE.ChangeFromKey(aV);
|
||||
aNbE=aLE.Extent();
|
||||
if (!aNbE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Edge& aE1=TopoDS::Edge(aLE.First());
|
||||
if (aNbE==1) {
|
||||
if (BRep_Tool::Degenerated(aE1)) {
|
||||
continue;
|
||||
}
|
||||
if (aV.Orientation()==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
bFound=Standard_True;
|
||||
myShapesToAvoid.Add(aE1);
|
||||
}
|
||||
else if (aNbE==2) {
|
||||
const TopoDS_Edge& aE2=TopoDS::Edge(aLE.Last());
|
||||
if (aE2.IsSame(aE1)) {
|
||||
TopoDS_Vertex aV1x, aV2x;
|
||||
//
|
||||
TopExp::Vertices(aE1, aV1x, aV2x);
|
||||
if (aV1x.IsSame(aV2x)) {
|
||||
continue;
|
||||
}
|
||||
bFound=Standard_True;
|
||||
myShapesToAvoid.Add(aE1);
|
||||
myShapesToAvoid.Add(aE2);
|
||||
}
|
||||
}
|
||||
}// for (i=1; i<=aNbE; ++i) {
|
||||
//
|
||||
if (!bFound) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
}//while (1)
|
||||
//printf(" EdgesToAvoid=%d, iCnt=%d\n", EdgesToAvoid.Extent(), iCnt);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformLoops
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderFace::PerformLoops()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer aNbEA;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
TopTools_MapIteratorOfMapOfOrientedShape aItM;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
|
||||
TopTools_MapOfOrientedShape aMAdded;
|
||||
TopoDS_Iterator aItW;
|
||||
BRep_Builder aBB;
|
||||
GEOMAlgo_WireEdgeSet aWES;
|
||||
GEOMAlgo_WESCorrector aWESCor;
|
||||
//
|
||||
// 1. Usual Wires
|
||||
myLoops.Clear();
|
||||
aWES.SetFace(myFace);
|
||||
//
|
||||
aIt.Initialize (myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if (!myShapesToAvoid.Contains(aE)) {
|
||||
aWES.AddStartElement(aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
aWESCor.SetWES(aWES);
|
||||
aWESCor.Perform();
|
||||
//
|
||||
GEOMAlgo_WireEdgeSet& aWESN=aWESCor.NewWES();
|
||||
const TopTools_ListOfShape& aLW=aWESN.Shapes();
|
||||
//
|
||||
aIt.Initialize (aLW);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aW=aIt.Value();
|
||||
myLoops.Append(aW);
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Aug 5 15:09:29 2008f
|
||||
// Post Treatment
|
||||
TopTools_MapOfOrientedShape aMEP;
|
||||
//
|
||||
// a. collect all edges that are in loops
|
||||
aIt.Initialize (myLoops);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aW=aIt.Value();
|
||||
aItW.Initialize(aW);
|
||||
for (; aItW.More(); aItW.Next()) {
|
||||
const TopoDS_Shape& aE=aItW.Value();
|
||||
aMEP.Add(aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
// b. collect all edges that are to avoid
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aE=aItM.Key();
|
||||
aMEP.Add(aE);
|
||||
}
|
||||
//
|
||||
// c. add all edges that are not processed to myShapesToAvoid
|
||||
aIt.Initialize (myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if (!aMEP.Contains(aE)) {
|
||||
myShapesToAvoid.Add(aE);
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Aug 5 15:09:35 2008t
|
||||
//
|
||||
// 2. Internal Wires
|
||||
myLoopsInternal.Clear();
|
||||
//
|
||||
aNbEA=myShapesToAvoid.Extent();
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aEE=aItM.Key();
|
||||
TopExp::MapShapesAndAncestors(aEE, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
|
||||
}
|
||||
//
|
||||
bFlag=Standard_True;
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More()&&bFlag; aItM.Next()) {
|
||||
const TopoDS_Shape& aEE=aItM.Key();
|
||||
if (!aMAdded.Add(aEE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make new wire
|
||||
TopoDS_Wire aW;
|
||||
aBB.MakeWire(aW);
|
||||
aBB.Add(aW, aEE);
|
||||
//
|
||||
aItW.Initialize(aW);
|
||||
for (; aItW.More()&&bFlag; aItW.Next()) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value());
|
||||
//
|
||||
TopoDS_Iterator aItE(aE);
|
||||
for (; aItE.More()&&bFlag; aItE.Next()) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(aItE.Value());
|
||||
const TopTools_ListOfShape& aLE=aVEMap.FindFromKey(aV);
|
||||
aIt.Initialize(aLE);
|
||||
for (; aIt.More()&&bFlag; aIt.Next()) {
|
||||
const TopoDS_Shape& aEx=aIt.Value();
|
||||
if (aMAdded.Add(aEx)) {
|
||||
aBB.Add(aW, aEx);
|
||||
if(aMAdded.Extent()==aNbEA) {
|
||||
bFlag=!bFlag;
|
||||
}
|
||||
}
|
||||
}//for (; aIt.More(); aIt.Next()) {
|
||||
}//for (; aItE.More(); aItE.Next()) {
|
||||
}//for (; aItW.More(); aItW.Next()) {
|
||||
myLoopsInternal.Append(aW);
|
||||
}//for (; aItM.More(); aItM.Next()) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformAreas
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderFace::PerformAreas()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Boolean bIsGrowth, bIsHole;
|
||||
Standard_Real aTol;
|
||||
TopTools_ListOfShape aNewFaces, aHoleWires;
|
||||
TopoDS_Shape anInfinitePointShape;
|
||||
TopTools_DataMapOfShapeShape aInOutMap;
|
||||
TopTools_DataMapOfShapeListOfShape aMSH;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
|
||||
TopTools_ListIteratorOfListOfShape aIt1, aIt2;
|
||||
TopTools_IndexedMapOfShape aMHE;
|
||||
BRep_Builder aBB;
|
||||
Handle(Geom_Surface) aS;
|
||||
TopLoc_Location aLoc;
|
||||
//
|
||||
aTol=BRep_Tool::Tolerance(myFace);
|
||||
aS=BRep_Tool::Surface(myFace, aLoc);
|
||||
//
|
||||
myAreas.Clear();
|
||||
//
|
||||
// Draft faces [aNewFaces]
|
||||
aIt1.Initialize(myLoops);
|
||||
for ( ; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aWire=aIt1.Value();
|
||||
//
|
||||
bIsGrowth=IsGrowthWire(aWire, aMHE);
|
||||
if (bIsGrowth) {
|
||||
// make a growth face from a wire
|
||||
TopoDS_Face aFace;
|
||||
aBB.MakeFace(aFace, aS, aLoc, aTol);
|
||||
aBB.Add (aFace, aWire);
|
||||
//
|
||||
aNewFaces.Append (aFace);
|
||||
}
|
||||
else{
|
||||
// check if a wire is a hole
|
||||
//XX
|
||||
//bIsHole=IsHole(aWire, myFace, myContext);
|
||||
bIsHole=GEOMAlgo_BuilderTools::IsHole(aWire, myFace);
|
||||
//XX
|
||||
if (bIsHole) {
|
||||
aHoleWires.Append(aWire);
|
||||
TopExp::MapShapes(aWire, TopAbs_EDGE, aMHE);
|
||||
}
|
||||
else {
|
||||
// make a growth face from a wire
|
||||
TopoDS_Face aFace;
|
||||
aBB.MakeFace(aFace, aS, aLoc, aTol);
|
||||
aBB.Add (aFace, aWire);
|
||||
//
|
||||
aNewFaces.Append (aFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2. Find outer growth shell that is most close to each hole shell
|
||||
aIt2.Initialize(aHoleWires);
|
||||
for (; aIt2.More(); aIt2.Next()) {
|
||||
const TopoDS_Shape& aHole = aIt2.Value();
|
||||
//
|
||||
aIt1.Initialize(aNewFaces);
|
||||
for ( ; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aF=aIt1.Value();
|
||||
//
|
||||
if (!IsInside(aHole, aF, myContext)){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if ( aInOutMap.IsBound (aHole)){
|
||||
const TopoDS_Shape& aF2=aInOutMap(aHole);
|
||||
if (IsInside(aF, aF2, myContext)) {
|
||||
aInOutMap.UnBind(aHole);
|
||||
aInOutMap.Bind (aHole, aF);
|
||||
}
|
||||
}
|
||||
else{
|
||||
aInOutMap.Bind (aHole, aF);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Add aHole to a map Face/ListOfHoles [aMSH]
|
||||
if (aInOutMap.IsBound(aHole)){
|
||||
const TopoDS_Shape& aF=aInOutMap(aHole);
|
||||
if (aMSH.IsBound(aF)) {
|
||||
TopTools_ListOfShape& aLH=aMSH.ChangeFind(aF);
|
||||
aLH.Append(aHole);
|
||||
}
|
||||
else {
|
||||
TopTools_ListOfShape aLH;
|
||||
aLH.Append(aHole);
|
||||
aMSH.Bind(aF, aLH);
|
||||
}
|
||||
}
|
||||
}// for (; aIt2.More(); aIt2.Next())
|
||||
//
|
||||
// 3. Add aHoles to Faces
|
||||
aItMSH.Initialize(aMSH);
|
||||
for (; aItMSH.More(); aItMSH.Next()) {
|
||||
TopoDS_Face aF=TopoDS::Face(aItMSH.Key());
|
||||
//
|
||||
const TopTools_ListOfShape& aLH=aItMSH.Value();
|
||||
aIt2.Initialize(aLH);
|
||||
for (; aIt2.More(); aIt2.Next()) {
|
||||
const TopoDS_Shape& aHole = aIt2.Value();
|
||||
aBB.Add (aF, aHole);
|
||||
}
|
||||
//
|
||||
// update classifier
|
||||
aTol=BRep_Tool::Tolerance(aF);
|
||||
IntTools_FClass2d& aClsf=myContext->FClass2d(aF);
|
||||
aClsf.Init(aF, aTol);
|
||||
}
|
||||
//
|
||||
// These aNewFaces are draft faces that
|
||||
// do not contain any internal shapes
|
||||
//
|
||||
myAreas.Append(aNewFaces);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInternalShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderFace::PerformInternalShapes()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Integer aNbWI=myLoopsInternal.Extent();
|
||||
if (!aNbWI) {// nothing to do
|
||||
return;
|
||||
}
|
||||
//
|
||||
//Standard_Real aTol;
|
||||
BRep_Builder aBB;
|
||||
TopTools_ListIteratorOfListOfShape aIt1, aIt2;
|
||||
TopoDS_Iterator aIt;
|
||||
TopTools_MapOfShape aME, aMEP;
|
||||
TopTools_MapIteratorOfMapOfShape aItME;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
TopTools_ListOfShape aLSI;
|
||||
//
|
||||
// 1. All internal edges
|
||||
aIt1.Initialize(myLoopsInternal);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aWire=aIt1.Value();
|
||||
aIt.Initialize(aWire);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
aME.Add(aE);
|
||||
}
|
||||
}
|
||||
aNbWI=aME.Extent();
|
||||
//
|
||||
// 2 Process faces
|
||||
aIt2.Initialize(myAreas);
|
||||
for ( ; aIt2.More(); aIt2.Next()) {
|
||||
TopoDS_Face& aF=TopoDS::Face(aIt2.Value());
|
||||
//
|
||||
aMVE.Clear();
|
||||
TopExp::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
//
|
||||
// 2.1 Separate faces to process aMEP
|
||||
aMEP.Clear();
|
||||
aItME.Initialize(aME);
|
||||
for (; aItME.More(); aItME.Next()) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(aItME.Key());
|
||||
if (IsInside(aE, aF, myContext)) {
|
||||
aMEP.Add(aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2.2 Make Internal Wires
|
||||
aLSI.Clear();
|
||||
MakeInternalWires(aMEP, aLSI);
|
||||
//
|
||||
// 2.3 Add them to aF
|
||||
aIt1.Initialize(aLSI);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aSI=aIt1.Value();
|
||||
aBB.Add (aF, aSI);
|
||||
}
|
||||
//
|
||||
// 2.4 Remove faces aMFP from aMF
|
||||
aItME.Initialize(aMEP);
|
||||
for (; aItME.More(); aItME.Next()) {
|
||||
const TopoDS_Shape& aE=aItME.Key();
|
||||
aME.Remove(aE);
|
||||
}
|
||||
//
|
||||
aNbWI=aME.Extent();
|
||||
if (!aNbWI) {
|
||||
break;
|
||||
}
|
||||
} //for ( ; aIt2.More(); aIt2.Next()) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeInternalWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void MakeInternalWires(const TopTools_MapOfShape& theME,
|
||||
TopTools_ListOfShape& theWires)
|
||||
{
|
||||
TopTools_MapIteratorOfMapOfShape aItM;
|
||||
TopTools_MapOfShape aAddedMap;
|
||||
TopTools_ListIteratorOfListOfShape aItE;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aItM.Initialize(theME);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aE=aItM.Key();
|
||||
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
}
|
||||
//
|
||||
aItM.Initialize(theME);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
TopoDS_Shape aEE=aItM.Key();
|
||||
if (!aAddedMap.Add(aEE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make a new shell
|
||||
TopoDS_Wire aW;
|
||||
aBB.MakeWire(aW);
|
||||
aEE.Orientation(TopAbs_INTERNAL);
|
||||
aBB.Add(aW, aEE);
|
||||
//
|
||||
TopoDS_Iterator aItAdded (aW);
|
||||
for (; aItAdded.More(); aItAdded.Next()) {
|
||||
const TopoDS_Shape& aE =aItAdded.Value();
|
||||
//
|
||||
TopExp_Explorer aExp(aE, TopAbs_VERTEX);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aV =aExp.Current();
|
||||
const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV);
|
||||
aItE.Initialize(aLE);
|
||||
for (; aItE.More(); aItE.Next()) {
|
||||
TopoDS_Shape aEL=aItE.Value();
|
||||
if (aAddedMap.Add(aEL)){
|
||||
aEL.Orientation(TopAbs_INTERNAL);
|
||||
aBB.Add(aW, aEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
theWires.Append(aW);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsInside
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
||||
const TopoDS_Shape& theF2,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aT, aU, aV;
|
||||
|
||||
TopAbs_State aState;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_IndexedMapOfShape aME2;
|
||||
gp_Pnt2d aP2D;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aState=TopAbs_UNKNOWN;
|
||||
const TopoDS_Face& aF2=TopoDS::Face(theF2);
|
||||
//
|
||||
TopExp::MapShapes(aF2, TopAbs_EDGE, aME2);
|
||||
//
|
||||
aExp.Init(theHole, TopAbs_EDGE);
|
||||
if (aExp.More()) {
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
|
||||
if (aME2.Contains(aE)) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
aT=BOPTools_Tools2D::IntermediatePoint(aE);
|
||||
BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV);
|
||||
aP2D.SetCoord(aU, aV);
|
||||
//
|
||||
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
|
||||
aState=aClsf.Perform(aP2D);
|
||||
bRet=(aState==TopAbs_IN);
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsGrowthWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire,
|
||||
const TopTools_IndexedMapOfShape& theMHE)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
if (theMHE.Extent()) {
|
||||
aIt.Initialize(theWire);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if (theMHE.Contains(aE)) {
|
||||
return !bRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//BRepTools::Write(aFF, "ff");
|
||||
//
|
||||
// ErrorStatus :
|
||||
// 11 - Null Context
|
||||
// 12 - Null face generix
|
||||
|
||||
/*
|
||||
//=======================================================================
|
||||
//function : IsInside
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
||||
const TopoDS_Shape& theF2,
|
||||
IntTools_PContext& theContext)
|
||||
{
|
||||
Standard_Real aT, aU, aV;
|
||||
TopExp_Explorer aExp;
|
||||
TopAbs_State aState=TopAbs_UNKNOWN;
|
||||
gp_Pnt2d aP2D;
|
||||
//
|
||||
const TopoDS_Face& aF2=TopoDS::Face(theF2);
|
||||
//
|
||||
aExp.Init(theHole, TopAbs_EDGE);
|
||||
if (aExp.More()){
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
|
||||
aT=BOPTools_Tools2D::IntermediatePoint(aE);
|
||||
BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV);
|
||||
aP2D.SetCoord(aU, aV);
|
||||
//
|
||||
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
|
||||
aState=aClsf.Perform(aP2D);
|
||||
}
|
||||
return (aState==TopAbs_IN);
|
||||
}
|
||||
*/
|
@ -1,91 +0,0 @@
|
||||
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderFace.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#ifndef _GEOMAlgo_BuilderFace_HeaderFile
|
||||
#define _GEOMAlgo_BuilderFace_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <GEOMAlgo_BuilderArea.hxx>
|
||||
|
||||
//! The algorithm to build faces from set of edges <br>
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_BuilderFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_BuilderFace : public GEOMAlgo_BuilderArea
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_BuilderFace();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_BuilderFace();
|
||||
|
||||
//! Sets the face generatix <br>
|
||||
Standard_EXPORT
|
||||
void SetFace(const TopoDS_Face& theFace) ;
|
||||
|
||||
//! Returns the face generatix <br>
|
||||
Standard_EXPORT
|
||||
const TopoDS_Face& Face() const;
|
||||
|
||||
//! Performs the algorithm <br>
|
||||
Standard_EXPORT
|
||||
virtual void Perform() ;
|
||||
|
||||
protected:
|
||||
//! Collect the edges that <br>
|
||||
//! a) are internal <br>
|
||||
//! b) are the same and have different orientation <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformShapesToAvoid() ;
|
||||
|
||||
//! Build draft wires <br>
|
||||
//! a)myLoops - draft wires that consist of <br>
|
||||
//! boundary edges <br>
|
||||
//! b)myLoopsInternal - draft wires that contains <br>
|
||||
//! inner edges <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformLoops() ;
|
||||
|
||||
//! Build draft faces that contains boundary edges <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformAreas() ;
|
||||
|
||||
//! Build finalized faces with internals <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformInternalShapes() ;
|
||||
|
||||
|
||||
TopoDS_Face myFace;
|
||||
};
|
||||
|
||||
#endif
|
@ -25,6 +25,7 @@
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_BuilderShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@ -117,11 +118,8 @@
|
||||
myHasDeleted=Standard_False;
|
||||
myHasGenerated=Standard_False;
|
||||
myHasModified=Standard_False;
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:14:15 2006
|
||||
myImagesResult.Clear();
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:14:17 2006t
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:57:00 2006f
|
||||
//=======================================================================
|
||||
//function : ImagesResult
|
||||
//purpose :
|
||||
@ -130,4 +128,3 @@
|
||||
{
|
||||
return myImagesResult;
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:57:04 2006t
|
||||
|
@ -29,11 +29,14 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
|
||||
|
||||
|
@ -1,931 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderSolid.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_BuilderSolid.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfOrientedShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <GEOMAlgo_BuilderTools.hxx>
|
||||
|
||||
//
|
||||
static
|
||||
Standard_Boolean IsGrowthShell(const TopoDS_Shape& ,
|
||||
const TopTools_IndexedMapOfShape& );
|
||||
static
|
||||
Standard_Boolean IsHole(const TopoDS_Shape& ,
|
||||
const Handle(IntTools_Context)& );
|
||||
static
|
||||
Standard_Boolean IsInside(const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const Handle(IntTools_Context)& );
|
||||
static
|
||||
void MakeInternalShells(const TopTools_MapOfShape& ,
|
||||
TopTools_ListOfShape& );
|
||||
|
||||
static
|
||||
Standard_Boolean IsClosedShell(const TopoDS_Shell& );
|
||||
|
||||
static
|
||||
Standard_Boolean RefineShell(const TopoDS_Shell& ,
|
||||
TopoDS_Shell& );
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_BuilderSolid::GEOMAlgo_BuilderSolid()
|
||||
:
|
||||
GEOMAlgo_BuilderArea()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_BuilderSolid::~GEOMAlgo_BuilderSolid()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderSolid::Perform()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
// Initialize the context
|
||||
GEOMAlgo_BuilderArea::Perform();
|
||||
//
|
||||
TopoDS_Compound aC;
|
||||
BRep_Builder aBB;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
|
||||
aBB.MakeCompound(aC);
|
||||
aIt.Initialize(myShapes);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
aBB.Add(aC, aF);
|
||||
}
|
||||
//
|
||||
PerformShapesToAvoid();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
PerformLoops();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
PerformAreas();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
if (myComputeInternalShapes) {
|
||||
PerformInternalShapes();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function :PerformShapesToAvoid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderSolid::PerformShapesToAvoid()
|
||||
{
|
||||
Standard_Boolean bFound;
|
||||
Standard_Integer i, iCnt, aNbE, aNbF;
|
||||
TopAbs_Orientation aOrE;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myShapesToAvoid.Clear();
|
||||
//
|
||||
iCnt=0;
|
||||
while (1) {
|
||||
++iCnt;
|
||||
bFound=Standard_False;
|
||||
//
|
||||
// 1. MEF
|
||||
aMEF.Clear();
|
||||
aIt.Initialize (myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
if (!myShapesToAvoid.Contains(aF)) {
|
||||
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
}
|
||||
/*
|
||||
else {
|
||||
int a=0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
aNbE=aMEF.Extent();
|
||||
//
|
||||
// 2. myFacesToAvoid
|
||||
for (i=1; i<=aNbE; ++i) {
|
||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape& aLF=aMEF.ChangeFromKey(aE);
|
||||
//
|
||||
aNbF=aLF.Extent();
|
||||
if (!aNbF) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aOrE=aE.Orientation();
|
||||
//
|
||||
const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
|
||||
if (aNbF==1) {
|
||||
if (aOrE==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
bFound=Standard_True;
|
||||
myShapesToAvoid.Add(aF1);
|
||||
}
|
||||
else if (aNbF==2) {
|
||||
const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
|
||||
if (aF2.IsSame(aF1)) {
|
||||
if (BRep_Tool::IsClosed(aE, aF1)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aOrE==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bFound=Standard_True;
|
||||
myShapesToAvoid.Add(aF1);
|
||||
myShapesToAvoid.Add(aF2);
|
||||
}
|
||||
}
|
||||
/*//DEB
|
||||
else {
|
||||
TopTools_ListIteratorOfListOfShape aItLF;
|
||||
//
|
||||
aItLF.Initialize (aLF);
|
||||
for (; aItLF.More(); aItLF.Next()) {
|
||||
const TopoDS_Shape& aFx=aItLF.Value();
|
||||
int a=0;
|
||||
}
|
||||
}
|
||||
*///DEB
|
||||
}// for (i=1; i<=aNbE; ++i) {
|
||||
//
|
||||
if (!bFound) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
}//while (1)
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformLoops
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderSolid::PerformLoops()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myLoops.Clear();
|
||||
//
|
||||
Standard_Integer aNbLF, aNbOff, aNbFP;
|
||||
TopAbs_Orientation anOr;
|
||||
TopoDS_Edge aEL;
|
||||
BRep_Builder aBB;
|
||||
NMTTools_CoupleOfShape aCSOff;
|
||||
TopTools_MapOfOrientedShape AddedFacesMap;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
|
||||
TopTools_ListIteratorOfListOfShape aItF, aIt;
|
||||
TopTools_MapIteratorOfMapOfOrientedShape aItM;
|
||||
TopoDS_Iterator aItS;
|
||||
//
|
||||
//=================================================
|
||||
//
|
||||
// 1. Shells Usual
|
||||
//
|
||||
aItF.Initialize (myShapes);
|
||||
for (; aItF.More(); aItF.Next()) {
|
||||
const TopoDS_Shape& aFF = aItF.Value();
|
||||
TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
||||
}
|
||||
//
|
||||
aItF.Initialize (myShapes);
|
||||
for (; aItF.More(); aItF.Next()) {
|
||||
const TopoDS_Shape& aFF = aItF.Value();
|
||||
if (myShapesToAvoid.Contains(aFF)) {
|
||||
continue;
|
||||
}
|
||||
if (!AddedFacesMap.Add(aFF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make a new shell
|
||||
TopoDS_Shell aShell;
|
||||
aBB.MakeShell(aShell);
|
||||
aBB.Add(aShell, aFF);
|
||||
//
|
||||
aMEFP.Clear();
|
||||
TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
//
|
||||
// loop on faces added to Shell; add their neighbor faces to Shell and so on
|
||||
TopoDS_Iterator aItAddedF (aShell);
|
||||
for (; aItAddedF.More(); aItAddedF.Next()) {
|
||||
const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
|
||||
//
|
||||
// loop on edges of aF; find a good neighbor face of aF by aE
|
||||
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
|
||||
for (; aEdgeExp.More(); aEdgeExp.Next()) {
|
||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aEdgeExp.Current()));
|
||||
//
|
||||
//1
|
||||
if (aMEFP.Contains(aE)) {
|
||||
const TopTools_ListOfShape& aLFP=aMEFP.FindFromKey(aE);
|
||||
aNbFP=aLFP.Extent();
|
||||
if (aNbFP>1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//2
|
||||
anOr=aE.Orientation();
|
||||
if (anOr==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
//3
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// candidate faces list
|
||||
const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
|
||||
aNbLF=aLF.Extent();
|
||||
if (!aNbLF) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// try to select one of neighbors
|
||||
// check if a face already added to Shell shares E
|
||||
Standard_Boolean bFound;
|
||||
TopTools_ListIteratorOfListOfShape aItLF;
|
||||
NMTTools_ListOfCoupleOfShape aLCSOff;
|
||||
//
|
||||
aItLF.Initialize(aLF);
|
||||
for (; aItLF.More(); aItLF.Next()) {
|
||||
const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItLF.Value()));
|
||||
if (myShapesToAvoid.Contains(aFL)) {
|
||||
continue;
|
||||
}
|
||||
if (aF.IsSame(aFL)) {
|
||||
continue;
|
||||
}
|
||||
if (AddedFacesMap.Contains(aFL)){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bFound=GEOMAlgo_Tools3D::GetEdgeOff(aE, aFL, aEL);
|
||||
if (!bFound) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aCSOff.SetShape1(aEL);
|
||||
aCSOff.SetShape2(aFL);
|
||||
aLCSOff.Append(aCSOff);
|
||||
}//for (; aItLF.More(); aItLF.Next()) {
|
||||
//
|
||||
aNbOff=aLCSOff.Extent();
|
||||
if (!aNbOff){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TopoDS_Face aSelF;
|
||||
if (aNbOff==1) {
|
||||
aSelF=*((TopoDS_Face*)(&aLCSOff.First().Shape2()));
|
||||
}
|
||||
else if (aNbOff>1){
|
||||
GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF);
|
||||
}
|
||||
//
|
||||
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
|
||||
aBB.Add(aShell, aSelF);
|
||||
TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
}
|
||||
} // for (; aEdgeExp.More(); aEdgeExp.Next()) {
|
||||
} //for (; aItAddedF.More(); aItAddedF.Next()) {
|
||||
//
|
||||
if (IsClosedShell(aShell)) {
|
||||
myLoops.Append(aShell);
|
||||
}
|
||||
else {
|
||||
Standard_Boolean bRefine;
|
||||
TopoDS_Shell aShx;
|
||||
//
|
||||
bRefine=RefineShell(aShell, aShx);
|
||||
if (bRefine) {
|
||||
myLoops.Append(aShx);
|
||||
}
|
||||
}
|
||||
} // for (; aItF.More(); aItF.Next()) {
|
||||
//
|
||||
// Post Treatment
|
||||
TopTools_MapOfOrientedShape aMP;
|
||||
//
|
||||
// a. collect all edges that are in loops
|
||||
aIt.Initialize (myLoops);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
aItS.Initialize(aS);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aF=aItS.Value();
|
||||
aMP.Add(aF);
|
||||
}
|
||||
}
|
||||
//
|
||||
// b. collect all faces that are to avoid
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aF=aItM.Key();
|
||||
aMP.Add(aF);
|
||||
}
|
||||
//
|
||||
// c. add all faces that are not processed to myShapesToAvoid
|
||||
aIt.Initialize (myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
if (!aMP.Contains(aF)) {
|
||||
myShapesToAvoid.Add(aF);
|
||||
}
|
||||
}
|
||||
//=================================================
|
||||
//
|
||||
// 2.Internal Shells
|
||||
//
|
||||
myLoopsInternal.Clear();
|
||||
//
|
||||
aEFMap.Clear();
|
||||
AddedFacesMap.Clear();
|
||||
//
|
||||
if (myComputeInternalShapes) {
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aFF=aItM.Key();
|
||||
TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
||||
}
|
||||
//
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aFF=aItM.Key();
|
||||
if (!AddedFacesMap.Add(aFF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make a new shell
|
||||
TopoDS_Shell aShell;
|
||||
aBB.MakeShell(aShell);
|
||||
aBB.Add(aShell, aFF);
|
||||
//
|
||||
TopoDS_Iterator aItAddedF (aShell);
|
||||
for (; aItAddedF.More(); aItAddedF.Next()) {
|
||||
const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
|
||||
//
|
||||
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
|
||||
for (; aEdgeExp.More(); aEdgeExp.Next()) {
|
||||
const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current()));
|
||||
const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
|
||||
aItF.Initialize(aLF);
|
||||
for (; aItF.More(); aItF.Next()) {
|
||||
const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value()));
|
||||
if (AddedFacesMap.Add(aFL)){
|
||||
aBB.Add(aShell, aFL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myLoopsInternal.Append(aShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformAreas
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderSolid::PerformAreas()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Boolean bIsGrowthShell, bIsHole;
|
||||
TopTools_ListOfShape aNewSolids, aHoleShells;
|
||||
TopoDS_Shape anInfinitePointShape;
|
||||
TopTools_DataMapOfShapeShape aInOutMap;
|
||||
TopTools_DataMapOfShapeListOfShape aMSH;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
|
||||
TopTools_ListIteratorOfListOfShape aShellIt, aSolidIt;
|
||||
TopTools_IndexedMapOfShape aMHF;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
myAreas.Clear();
|
||||
//
|
||||
// Draft solids [aNewSolids]
|
||||
aShellIt.Initialize(myLoops);
|
||||
for ( ; aShellIt.More(); aShellIt.Next()) {
|
||||
const TopoDS_Shape& aShell = aShellIt.Value();
|
||||
//
|
||||
bIsGrowthShell=IsGrowthShell(aShell, aMHF);
|
||||
if (bIsGrowthShell) {
|
||||
// make a growth solid from a shell
|
||||
TopoDS_Solid Solid;
|
||||
aBB.MakeSolid(Solid);
|
||||
aBB.Add (Solid, aShell);
|
||||
//
|
||||
aNewSolids.Append (Solid);
|
||||
}
|
||||
else{
|
||||
// check if a shell is a hole
|
||||
bIsHole=IsHole(aShell, myContext);
|
||||
//
|
||||
if (bIsHole) {
|
||||
aHoleShells.Append(aShell);
|
||||
TopExp::MapShapes(aShell, TopAbs_FACE, aMHF);
|
||||
}
|
||||
else {
|
||||
// make a growth solid from a shell
|
||||
TopoDS_Solid Solid;
|
||||
aBB.MakeSolid(Solid);
|
||||
aBB.Add (Solid, aShell);
|
||||
//
|
||||
aNewSolids.Append (Solid);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2. Find outer growth shell that is most close to each hole shell
|
||||
aShellIt.Initialize(aHoleShells);
|
||||
for (; aShellIt.More(); aShellIt.Next()) {
|
||||
const TopoDS_Shape& aHole = aShellIt.Value();
|
||||
//
|
||||
aSolidIt.Initialize(aNewSolids);
|
||||
for ( ; aSolidIt.More(); aSolidIt.Next()) {
|
||||
const TopoDS_Shape& aSolid = aSolidIt.Value();
|
||||
//
|
||||
if (!IsInside(aHole, aSolid, myContext)){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if ( aInOutMap.IsBound (aHole)){
|
||||
const TopoDS_Shape& aSolid2 = aInOutMap(aHole);
|
||||
if (IsInside(aSolid, aSolid2, myContext)) {
|
||||
aInOutMap.UnBind(aHole);
|
||||
aInOutMap.Bind (aHole, aSolid);
|
||||
}
|
||||
}
|
||||
else{
|
||||
aInOutMap.Bind (aHole, aSolid);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Add aHole to a map Solid/ListOfHoles [aMSH]
|
||||
if (aInOutMap.IsBound(aHole)){
|
||||
const TopoDS_Shape& aSolid=aInOutMap(aHole);
|
||||
if (aMSH.IsBound(aSolid)) {
|
||||
TopTools_ListOfShape& aLH=aMSH.ChangeFind(aSolid);
|
||||
aLH.Append(aHole);
|
||||
}
|
||||
else {
|
||||
TopTools_ListOfShape aLH;
|
||||
aLH.Append(aHole);
|
||||
aMSH.Bind(aSolid, aLH);
|
||||
}
|
||||
//aBB.Add (aSolid, aHole);
|
||||
}
|
||||
}// for (; aShellIt.More(); aShellIt.Next()) {
|
||||
//
|
||||
// 3. Add aHoles to Solids
|
||||
aItMSH.Initialize(aMSH);
|
||||
for (; aItMSH.More(); aItMSH.Next()) {
|
||||
TopoDS_Solid aSolid=*((TopoDS_Solid*)(&aItMSH.Key()));
|
||||
//
|
||||
const TopTools_ListOfShape& aLH=aItMSH.Value();
|
||||
aShellIt.Initialize(aLH);
|
||||
for (; aShellIt.More(); aShellIt.Next()) {
|
||||
const TopoDS_Shape& aHole = aShellIt.Value();
|
||||
aBB.Add (aSolid, aHole);
|
||||
}
|
||||
//
|
||||
// update classifier
|
||||
BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aSolid);
|
||||
aSC.Load(aSolid);
|
||||
//
|
||||
}
|
||||
//
|
||||
// These aNewSolids are draft solids that
|
||||
// do not contain any internal shapes
|
||||
//
|
||||
myAreas.Append(aNewSolids);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInternalShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_BuilderSolid::PerformInternalShapes()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Integer aNbFI=myLoopsInternal.Extent();
|
||||
if (!aNbFI) {// nothing to do
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Integer bFlag;
|
||||
BRep_Builder aBB;
|
||||
TopTools_ListIteratorOfListOfShape aShellIt, aSolidIt;
|
||||
TopoDS_Iterator aIt;
|
||||
TopTools_MapOfShape aMF, aMFP, aMFS;
|
||||
TopTools_MapIteratorOfMapOfShape aItMF;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
TopTools_ListOfShape aLSI;
|
||||
//
|
||||
// 1. All internal faces
|
||||
aShellIt.Initialize(myLoopsInternal);
|
||||
for (; aShellIt.More(); aShellIt.Next()) {
|
||||
const TopoDS_Shape& aShell=aShellIt.Value();
|
||||
aIt.Initialize(aShell);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
aMF.Add(aF);
|
||||
}
|
||||
}
|
||||
aNbFI=aMF.Extent();
|
||||
//
|
||||
// 2 Process solids
|
||||
aSolidIt.Initialize(myAreas);
|
||||
for ( ; aSolidIt.More(); aSolidIt.Next()) {
|
||||
TopoDS_Solid& aSolid=*((TopoDS_Solid*)(&aSolidIt.Value()));
|
||||
//
|
||||
//modified by NIZNHY-PKV Wed Mar 07 08:52:18 2012f
|
||||
aMFS.Clear();
|
||||
{
|
||||
TopExp_Explorer aExp(aSolid, TopAbs_FACE);
|
||||
while (aExp.More()) {
|
||||
aMFS.Add(aExp.Current());
|
||||
aExp.Next();
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Mar 07 08:52:20 2012t
|
||||
aMEF.Clear();
|
||||
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
//
|
||||
// 2.1 Separate faces to process aMFP
|
||||
aMFP.Clear();
|
||||
aItMF.Initialize(aMF);
|
||||
for (; aItMF.More(); aItMF.Next()) {
|
||||
const TopoDS_Face& aF=*((TopoDS_Face*)(&aItMF.Key()));
|
||||
//modified by NIZNHY-PKV Wed Mar 07 08:54:56 2012f
|
||||
if (!aMFS.Contains(aF)) {
|
||||
bFlag=GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, myContext);
|
||||
if (bFlag) {
|
||||
aMFP.Add(aF);
|
||||
}
|
||||
}
|
||||
//if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, myContext)) {
|
||||
// aMFP.Add(aF);
|
||||
//}
|
||||
//modified by NIZNHY-PKV Wed Mar 07 08:56:07 2012t
|
||||
}
|
||||
//
|
||||
// 2.2 Make Internal Shells
|
||||
aLSI.Clear();
|
||||
MakeInternalShells(aMFP, aLSI);
|
||||
//
|
||||
// 2.3 Add them to aSolid
|
||||
aShellIt.Initialize(aLSI);
|
||||
for (; aShellIt.More(); aShellIt.Next()) {
|
||||
const TopoDS_Shape& aSI=aShellIt.Value();
|
||||
aBB.Add (aSolid, aSI);
|
||||
}
|
||||
//
|
||||
// 2.4 Remove faces aMFP from aMF
|
||||
aItMF.Initialize(aMFP);
|
||||
for (; aItMF.More(); aItMF.Next()) {
|
||||
const TopoDS_Shape& aF=aItMF.Key();
|
||||
aMF.Remove(aF);
|
||||
}
|
||||
//
|
||||
aNbFI=aMF.Extent();
|
||||
if (!aNbFI) {
|
||||
break;
|
||||
}
|
||||
} //for ( ; aSolidIt.More(); aSolidIt.Next()) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeInternalShells
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void MakeInternalShells(const TopTools_MapOfShape& theMF,
|
||||
TopTools_ListOfShape& theShells)
|
||||
{
|
||||
TopTools_MapIteratorOfMapOfShape aItM;
|
||||
TopTools_MapOfShape aAddedFacesMap;
|
||||
TopTools_ListIteratorOfListOfShape aItF;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aItM.Initialize(theMF);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aF=aItM.Key();
|
||||
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
}
|
||||
//
|
||||
aItM.Initialize(theMF);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
TopoDS_Shape aFF=aItM.Key();
|
||||
if (!aAddedFacesMap.Add(aFF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make a new shell
|
||||
TopoDS_Shell aShell;
|
||||
aBB.MakeShell(aShell);
|
||||
aFF.Orientation(TopAbs_INTERNAL);
|
||||
aBB.Add(aShell, aFF);
|
||||
//
|
||||
TopoDS_Iterator aItAddedF (aShell);
|
||||
for (; aItAddedF.More(); aItAddedF.Next()) {
|
||||
const TopoDS_Shape& aF =aItAddedF.Value();
|
||||
//
|
||||
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
|
||||
for (; aEdgeExp.More(); aEdgeExp.Next()) {
|
||||
const TopoDS_Shape& aE =aEdgeExp.Current();
|
||||
const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE);
|
||||
aItF.Initialize(aLF);
|
||||
for (; aItF.More(); aItF.Next()) {
|
||||
TopoDS_Shape aFL=aItF.Value();
|
||||
if (aAddedFacesMap.Add(aFL)){
|
||||
aFL.Orientation(TopAbs_INTERNAL);
|
||||
aBB.Add(aShell, aFL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
theShells.Append(aShell);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsHole
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsHole(const TopoDS_Shape& theS2,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
TopoDS_Solid *pS2=(TopoDS_Solid *)&theS2;
|
||||
BRepClass3d_SolidClassifier& aClsf=theContext->SolidClassifier(*pS2);
|
||||
//
|
||||
aClsf.PerformInfinitePoint(::RealSmall());
|
||||
//
|
||||
return (aClsf.State()==TopAbs_IN);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsInside
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsInside(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
TopExp_Explorer aExp;
|
||||
TopAbs_State aState;
|
||||
//
|
||||
TopoDS_Solid *pS2=(TopoDS_Solid *)&theS2;
|
||||
//
|
||||
aExp.Init(theS1, TopAbs_FACE);
|
||||
if (!aExp.More()){
|
||||
BRepClass3d_SolidClassifier& aClsf=theContext->SolidClassifier(*pS2);
|
||||
aClsf.PerformInfinitePoint(::RealSmall());
|
||||
aState=aClsf.State();
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aBounds;
|
||||
const TopoDS_Face& aF = TopoDS::Face(aExp.Current());
|
||||
aState=GEOMAlgo_Tools3D::ComputeState(aF, *pS2, 1.e-14, aBounds, theContext);
|
||||
}
|
||||
return (aState==TopAbs_IN);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsGrowthShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell,
|
||||
const TopTools_IndexedMapOfShape& theMHF)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
if (theMHF.Extent()) {
|
||||
aIt.Initialize(theShell);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
if (theMHF.Contains(aF)) {
|
||||
return !bRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsClosedShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell)
|
||||
{
|
||||
Standard_Integer aNbE;
|
||||
Standard_Boolean bRet;
|
||||
TopoDS_Iterator aIt;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_MapOfShape aM;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aIt.Initialize(theShell);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Face& aF=TopoDS::Face(aIt.Value());
|
||||
aExp.Init(aF, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aExp.Current()));
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aE.Orientation()==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (!aM.Add(aE)) {
|
||||
aM.Remove(aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbE=aM.Extent();
|
||||
if (!aNbE) {
|
||||
bRet=!bRet;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : RefineShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean RefineShell(const TopoDS_Shell& aShell,
|
||||
TopoDS_Shell& aShx)
|
||||
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer i, aNbE, aNbF;
|
||||
TopAbs_Orientation aOrE;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
TopTools_MapOfOrientedShape aMFx;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
//
|
||||
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
aNbE=aMEF.Extent();
|
||||
for (i=1; i<=aNbE; ++i) {
|
||||
const TopoDS_Edge &aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
|
||||
//
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aOrE=aE.Orientation();
|
||||
//
|
||||
const TopTools_ListOfShape& aLF=aMEF(i);
|
||||
aNbF=aLF.Extent();
|
||||
if (!aNbF) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
|
||||
if (aNbF==1) {
|
||||
if (aOrE==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
aMFx.Add(aF1);
|
||||
}
|
||||
//
|
||||
else if (aNbF==2) {
|
||||
const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
|
||||
if (aF2.IsSame(aF1)) {
|
||||
if (BRep_Tool::IsClosed(aE, aF1)) {
|
||||
continue;
|
||||
}
|
||||
if (aOrE==TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
aMFx.Add(aF1);
|
||||
aMFx.Add(aF2);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbF=aMFx.Extent();
|
||||
if (!aNbF) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
aNbF=0;
|
||||
aBB.MakeShell(aShx);
|
||||
aIt.Initialize(aShell);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
if (!aMFx.Contains(aF)) {
|
||||
aBB.Add(aShx, aF);
|
||||
++aNbF;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aNbF) {
|
||||
bRet=IsClosedShell(aShx);
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
// ErrorStatus :
|
||||
// 11 - Null Context
|
@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderSolid.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#ifndef _GEOMAlgo_BuilderSolid_HeaderFile
|
||||
#define _GEOMAlgo_BuilderSolid_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <GEOMAlgo_BuilderArea.hxx>
|
||||
|
||||
//! The algorithm to build solids from set of faces <br>
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_BuilderSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_BuilderSolid : public GEOMAlgo_BuilderArea
|
||||
{
|
||||
public:
|
||||
//! Empty constructor <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_BuilderSolid();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_BuilderSolid();
|
||||
|
||||
//! Performs the algorithm <br>
|
||||
Standard_EXPORT
|
||||
virtual void Perform() ;
|
||||
|
||||
protected:
|
||||
//! Collect the faces that <br>
|
||||
//! a) are internal <br>
|
||||
//! b) are the same and have different orientation <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformShapesToAvoid() ;
|
||||
|
||||
//! Build draft shells <br>
|
||||
//! a)myLoops - draft shells that consist of <br>
|
||||
//! boundary faces <br>
|
||||
//! b)myLoopsInternal - draft shells that contains <br>
|
||||
//! inner faces <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformLoops() ;
|
||||
|
||||
//! Build draft solids that contains boundary faces <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformAreas() ;
|
||||
|
||||
//! Build finalized solids with internal shells <br>
|
||||
Standard_EXPORT
|
||||
virtual void PerformInternalShapes() ;
|
||||
|
||||
};
|
||||
#endif
|
@ -1,292 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderTools.cxx
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_BuilderTools.hxx>
|
||||
|
||||
#include <Basics_OCCTVersion.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Poly_Array1OfTriangle.hxx>
|
||||
#include <Poly_Triangle.hxx>
|
||||
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2dInt_Geom2dCurveTool.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#endif
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepMesh_FastDiscret.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
|
||||
static
|
||||
Standard_Integer ComputeProps(const TopoDS_Face& aF,
|
||||
Standard_Real& aA,
|
||||
Standard_Real& aV);
|
||||
static
|
||||
void BuildTriangulation(const TopoDS_Face& aF);
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHole
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_BuilderTools::IsHole(const TopoDS_Shape& aW,
|
||||
const TopoDS_Shape& aFace)
|
||||
{
|
||||
Standard_Boolean bIsHole;
|
||||
Standard_Integer i, aNbS;
|
||||
Standard_Real aT1, aT2, aS;
|
||||
Standard_Real aU1, aU2, aU, dU;
|
||||
Standard_Real aX1, aY1, aX0, aY0;
|
||||
TopAbs_Orientation aOr;
|
||||
|
||||
gp_Pnt2d aP2D0, aP2D1;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
TopoDS_Face aF, aFF;
|
||||
TopoDS_Iterator aItW;
|
||||
//
|
||||
bIsHole=Standard_False;
|
||||
//
|
||||
aF=TopoDS::Face(aFace);
|
||||
aFF=aF;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
//
|
||||
aS=0.;
|
||||
aItW.Initialize(aW);
|
||||
for (; aItW.More(); aItW.Next()) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value());
|
||||
aOr=aE.Orientation();
|
||||
if (!(aOr==TopAbs_FORWARD ||
|
||||
aOr==TopAbs_REVERSED)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aC2D=BRep_Tool::CurveOnSurface(aE, aFF, aT1, aT2);
|
||||
if (aC2D.IsNull()) {
|
||||
break; //xx
|
||||
}
|
||||
//
|
||||
BRepAdaptor_Curve2d aBAC2D(aE, aFF);
|
||||
aNbS=Geom2dInt_Geom2dCurveTool::NbSamples(aBAC2D);
|
||||
if (aNbS>2) {
|
||||
aNbS*=4;
|
||||
}
|
||||
//
|
||||
dU=(aT2-aT1)/(Standard_Real)(aNbS-1);
|
||||
aU =aT1;
|
||||
aU1=aT1;
|
||||
aU2=aT2;
|
||||
if (aOr==TopAbs_REVERSED) {
|
||||
aU =aT2;
|
||||
aU1=aT2;
|
||||
aU2=aT1;
|
||||
dU=-dU;
|
||||
}
|
||||
//
|
||||
aC2D->D0(aU, aP2D0);
|
||||
for(i=2; i<=aNbS; i++) {
|
||||
aU=aU1+(i-1)*dU;
|
||||
aC2D->D0(aU, aP2D1);
|
||||
aP2D0.Coord(aX0, aY0);
|
||||
aP2D1.Coord(aX1, aY1);
|
||||
//
|
||||
aS=aS+(aY0+aY1)*(aX1-aX0);
|
||||
//
|
||||
aP2D0=aP2D1;
|
||||
}
|
||||
}//for (; aItW.More(); aItW.Next()) {
|
||||
bIsHole=(aS>0.);
|
||||
return bIsHole;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsHole
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_BuilderTools::IsHole(const TopoDS_Shape& aShell)
|
||||
{
|
||||
Standard_Boolean bIsHole;
|
||||
Standard_Integer iRet;
|
||||
Standard_Real aAi, aA, aV, aVi;
|
||||
TopExp_Explorer aExp;
|
||||
//
|
||||
aA=0.;
|
||||
aV=0.;
|
||||
aExp.Init(aShell, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Face& aF=TopoDS::Face(aExp.Current());
|
||||
iRet=ComputeProps(aF, aAi, aVi);
|
||||
if (!iRet) {
|
||||
aA+=aAi;
|
||||
aV+=aVi;
|
||||
}
|
||||
}
|
||||
//
|
||||
bIsHole=aV<0.;
|
||||
return bIsHole;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeProps
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer ComputeProps(const TopoDS_Face& aF,
|
||||
Standard_Real& aA,
|
||||
Standard_Real& aV)
|
||||
{
|
||||
Standard_Integer j, i, i1, i2, aNbNodes, aNbTrigs, n[3];
|
||||
Standard_Real aAi, aVi;
|
||||
gp_Pnt aP[3], aGC, aGC1;
|
||||
TopLoc_Location aLoc;
|
||||
TopAbs_Orientation aOr;
|
||||
Handle(Poly_Triangulation) aTri;
|
||||
//
|
||||
aA=0.;
|
||||
aV=0.;
|
||||
//
|
||||
aTri=BRep_Tool::Triangulation(aF, aLoc);
|
||||
if(aTri.IsNull()) {
|
||||
BuildTriangulation(aF);
|
||||
aTri=BRep_Tool::Triangulation(aF, aLoc);
|
||||
if(aTri.IsNull()) {
|
||||
return 1;// a face is without triangulation
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbNodes=aTri->NbNodes();
|
||||
aNbTrigs=aTri->NbTriangles();
|
||||
if (!aNbTrigs){
|
||||
return 2;//no triangles
|
||||
}
|
||||
//
|
||||
aOr=aF.Orientation();
|
||||
//
|
||||
const TColgp_Array1OfPnt& aNodes=aTri->Nodes();
|
||||
const Poly_Array1OfTriangle& aTriangles=aTri->Triangles();
|
||||
//
|
||||
i1=aTriangles.Lower();
|
||||
i2=aTriangles.Upper();
|
||||
//
|
||||
for (i=i1; i<=i2; ++i){
|
||||
const Poly_Triangle& aTriangle=aTriangles.Value(i);
|
||||
aTriangle.Get(n[0], n[1], n[2]);
|
||||
aGC.SetCoord(0.,0.,0.);
|
||||
for (j=0; j<3; ++j) {
|
||||
aP[j]=aNodes.Value(n[j]);
|
||||
aGC.ChangeCoord()+=aP[j].XYZ();
|
||||
}
|
||||
aGC.ChangeCoord()*=0.333333333333;
|
||||
//
|
||||
// Normal
|
||||
gp_Vec aV01(aP[0], aP[1]);
|
||||
gp_Vec aV12(aP[1], aP[2]);
|
||||
gp_Vec aVN=aV01^aV12;
|
||||
aAi=aVN.Magnitude();
|
||||
aA=aA+aAi;
|
||||
//
|
||||
if (aAi>0.0000001) {
|
||||
Standard_Real aSx, aZx;
|
||||
gp_Dir aDN(aVN);
|
||||
if (aOr==TopAbs_REVERSED) {
|
||||
aDN.Reverse();
|
||||
}
|
||||
//
|
||||
aSx=aAi*aDN.Z();
|
||||
aZx=aGC.Z();
|
||||
aVi=aZx*aSx;
|
||||
aV=aV+aVi;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BuildTriangulation(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Boolean bWithShare;
|
||||
Standard_Real aDiscret, aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
Standard_Real dX, dY, dZ, dMax, aCoeff, aAngle;
|
||||
Bnd_Box aBox;
|
||||
//
|
||||
bWithShare=Standard_False;
|
||||
aAngle=0.5;
|
||||
//
|
||||
BRepBndLib::Add(aF, aBox);
|
||||
//
|
||||
// aDiscret
|
||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
dX=aXmax-aXmin;
|
||||
dY=aYmax-aYmin;
|
||||
dZ=aZmax-aZmin;
|
||||
dMax=dX;
|
||||
if (dY>dMax) {
|
||||
dMax=dY;
|
||||
}
|
||||
if (dZ>dMax) {
|
||||
dMax=dZ;
|
||||
}
|
||||
//
|
||||
aCoeff=0.1;
|
||||
aDiscret=aCoeff*dMax;
|
||||
//
|
||||
BRepMesh_FastDiscret aMesher(aDiscret,
|
||||
aAngle,
|
||||
aBox,
|
||||
bWithShare,
|
||||
Standard_True,
|
||||
Standard_False,
|
||||
Standard_True);
|
||||
|
||||
#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
|
||||
TopTools_IndexedDataMapOfShapeListOfShape anAncestors;
|
||||
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, anAncestors);
|
||||
aMesher.Add(aF, anAncestors);
|
||||
#else
|
||||
aMesher.Add(aF);
|
||||
#endif
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_BuilderTools.hxx
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#ifndef _GEOMAlgo_BuilderTools_HeaderFile
|
||||
#define _GEOMAlgo_BuilderTools_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_BuilderTools
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_BuilderTools
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsHole(const TopoDS_Shape& aW,
|
||||
const TopoDS_Shape& aF) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsHole(const TopoDS_Shape& aShell) ;
|
||||
};
|
||||
#endif
|
@ -1,64 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
|
||||
#include <NMTDS_ShapesDataStructure.hxx>
|
||||
//#include <NMTTools_DSFiller.hxx>
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_PaveBlock.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Shapes1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_Builder::Shapes1(const Standard_Integer theType)const
|
||||
{
|
||||
return myShapes1[theType];
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Images
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BRepAlgo_Image& GEOMAlgo_Builder::Images()const
|
||||
{
|
||||
return myImages;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : InParts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_Builder::InParts(const TopoDS_Shape& theS)const
|
||||
{
|
||||
static TopTools_ListOfShape sLS;
|
||||
//
|
||||
if (myInParts.Contains(theS)) {
|
||||
return myInParts.FindFromKey(theS);
|
||||
}
|
||||
return sLS;
|
||||
}
|
@ -1,360 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_Builder_1.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
//
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
//
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
//
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
//
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_PaveBlock.hxx>
|
||||
//
|
||||
#include <NMTDS_ShapesDataStructure.hxx>
|
||||
//
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
#include <NMTTools_CommonBlockPool.hxx>
|
||||
#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
|
||||
#include <NMTTools_CommonBlock.hxx>
|
||||
#include <NMTTools_CommonBlockPool.hxx>
|
||||
#include <NMTTools_ListOfCommonBlock.hxx>
|
||||
#include <NMTTools_CommonBlockAPI.hxx>
|
||||
//
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
void FillImagesCompounds(const TopTools_MapOfShape& ,
|
||||
BRepAlgo_Image& );
|
||||
|
||||
static
|
||||
void FillImagesCompound(const TopoDS_Shape& ,
|
||||
BRepAlgo_Image& ,
|
||||
TopTools_MapOfShape& );
|
||||
|
||||
//=======================================================================
|
||||
//function : FillImagesVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillImagesVertices()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
//
|
||||
Standard_Integer i, aNb, iV;
|
||||
//
|
||||
aNb=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
const TopoDS_Shape& aV=aDS.Shape(i);
|
||||
if (aV.ShapeType()==TopAbs_VERTEX) {
|
||||
iV=pPF->FindSDVertex(i);
|
||||
if (iV) {
|
||||
const TopoDS_Shape& aVSD=aDS.Shape(iV);
|
||||
if (!myImages.HasImage(aV)) {
|
||||
myImages.Bind(aV, aVSD);
|
||||
//
|
||||
mySameDomainShapes.Add(aV, aVSD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FillImagesEdges
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillImagesEdges()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool();
|
||||
const Handle(IntTools_Context)& aCtx=pPF->Context();
|
||||
//
|
||||
Standard_Boolean bToReverse;
|
||||
Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB, aNbLB;
|
||||
TColStd_ListIteratorOfListOfInteger aItLB;
|
||||
TColStd_ListOfInteger aLB;
|
||||
TopoDS_Edge aEE, aESpR;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TopTools_ListOfShape aLSp;
|
||||
TopTools_ListIteratorOfListOfShape aIt1;
|
||||
BOPTools_ListIteratorOfListOfPaveBlock aIt;
|
||||
//
|
||||
aNb=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
const TopoDS_Shape& aE=aDS.Shape(i);
|
||||
if (aE.ShapeType()!=TopAbs_EDGE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (!aMFence.Add(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPTools_ListOfPaveBlock& aLPB=aSSP(aDS.RefEdge(i));
|
||||
aNbSp=aLPB.Extent();
|
||||
if (!aNbSp) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aEE=TopoDS::Edge(aE);
|
||||
aLSp.Clear();
|
||||
//
|
||||
if (aNbSp==1) {
|
||||
const BOPTools_PaveBlock& aPB=aLPB.First();
|
||||
nSp=aPB.Edge();
|
||||
const TopoDS_Shape& aSp=aDS.Shape(nSp);
|
||||
//
|
||||
const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
|
||||
//modified by NIZNHY-PKV Wed Oct 27 11:19:30 2010f
|
||||
aNbLB=aLB.Extent();
|
||||
if (aIsCB && aNbLB<2) {
|
||||
aIsCB=0;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Oct 27 11:19:34 2010t
|
||||
//
|
||||
nSpR=aPBR.Edge();
|
||||
const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
|
||||
if (aSpR.IsSame(aSp) && aSpR.IsSame(aE) && !aIsCB) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aESpR=TopoDS::Edge(aSpR);
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx);
|
||||
if (bToReverse) {
|
||||
aESpR.Reverse();
|
||||
}
|
||||
aLSp.Append(aESpR);
|
||||
//
|
||||
aItLB.Initialize(aLB);
|
||||
for (; aItLB.More(); aItLB.Next()) {
|
||||
nSpx=aItLB.Value();
|
||||
const TopoDS_Shape& aSpx=aDS.Shape(nSpx);
|
||||
mySameDomainShapes.Add(aSpx ,aSpR);
|
||||
}
|
||||
//
|
||||
//
|
||||
}// if (aNbSp==1) {
|
||||
else {
|
||||
aIt.Initialize(aLPB);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const BOPTools_PaveBlock& aPB=aIt.Value();
|
||||
const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB);
|
||||
nSpR=aPBR.Edge();
|
||||
const TopoDS_Shape& aSpR=aDS.Shape(nSpR);
|
||||
//
|
||||
aESpR=TopoDS::Edge(aSpR);
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx);
|
||||
if (bToReverse) {
|
||||
aESpR.Reverse();
|
||||
}
|
||||
aLSp.Append(aESpR);
|
||||
//
|
||||
aItLB.Initialize(aLB);
|
||||
for (; aItLB.More(); aItLB.Next()) {
|
||||
nSpx=aItLB.Value();
|
||||
const TopoDS_Shape& aSpx=aDS.Shape(nSpx);
|
||||
mySameDomainShapes.Add(aSpx ,aSpR);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
myImages.Bind(aE, aLSp);
|
||||
|
||||
}//for (i=1; i<=aNb; ++i)
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FillImagesContainers
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillImagesContainers(const TopAbs_ShapeEnum theType)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Boolean bInterferred, bToReverse;
|
||||
Standard_Integer i, aNbS;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Iterator aIt;
|
||||
TopTools_ListIteratorOfListOfShape aItIm;
|
||||
TopTools_MapOfShape aMS;
|
||||
TopTools_MapIteratorOfMapOfShape aItS;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
aNbS=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNbS; ++i) {
|
||||
const TopoDS_Shape& aC=aDS.Shape(i);
|
||||
aType=aC.ShapeType();
|
||||
if (aType==theType) {
|
||||
aMS.Add(aC);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (theType==TopAbs_COMPOUND) {
|
||||
FillImagesCompounds(aMS, myImages);
|
||||
return;
|
||||
}
|
||||
//
|
||||
aItS.Initialize(aMS);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aC=aItS.Key();
|
||||
// whether the shape has image
|
||||
bInterferred=Standard_False;
|
||||
aIt.Initialize(aC);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
if (myImages.HasImage(aF)) {
|
||||
bInterferred=!bInterferred;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bInterferred){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TopoDS_Shape aCIm;
|
||||
GEOMAlgo_Tools3D::MakeContainer(theType, aCIm);
|
||||
//
|
||||
aIt.Initialize(aC);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
if (myImages.HasImage(aF)) {
|
||||
const TopTools_ListOfShape& aLFIm=myImages.Image(aF);
|
||||
aItIm.Initialize(aLFIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
TopoDS_Shape aFIm=aItIm.Value();
|
||||
//
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFIm, aF, aCtx);
|
||||
if (bToReverse) {
|
||||
aFIm.Reverse();
|
||||
}
|
||||
aBB.Add(aCIm, aFIm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aBB.Add(aCIm, aF);
|
||||
}
|
||||
}
|
||||
myImages.Bind(aC, aCIm);
|
||||
}// for (; aItS.More(); aItS.Next()) {
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FillImagesCompounds
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void FillImagesCompounds(const TopTools_MapOfShape& theMS,
|
||||
BRepAlgo_Image& theImages)
|
||||
{
|
||||
TopTools_MapOfShape aMFP;
|
||||
TopTools_MapIteratorOfMapOfShape aItS;
|
||||
//
|
||||
aItS.Initialize(theMS);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aC=aItS.Key();
|
||||
FillImagesCompound(aC, theImages, aMFP);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FillImagesCompound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void FillImagesCompound(const TopoDS_Shape& theS,
|
||||
BRepAlgo_Image& theImages,
|
||||
TopTools_MapOfShape& theMFP)
|
||||
{
|
||||
Standard_Boolean bInterferred;
|
||||
TopAbs_ShapeEnum aTypeX;
|
||||
TopAbs_Orientation aOrX;
|
||||
TopoDS_Iterator aIt;
|
||||
BRep_Builder aBB;
|
||||
TopTools_ListIteratorOfListOfShape aItIm;
|
||||
//
|
||||
if (!theMFP.Add(theS)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
bInterferred=Standard_False;
|
||||
aIt.Initialize(theS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSX=aIt.Value();
|
||||
aTypeX=aSX.ShapeType();
|
||||
if (aTypeX==TopAbs_COMPOUND) {
|
||||
FillImagesCompound(aSX, theImages, theMFP);
|
||||
}
|
||||
if (theImages.HasImage(aSX)) {
|
||||
bInterferred=Standard_True;
|
||||
}
|
||||
}
|
||||
if (!bInterferred){
|
||||
return;
|
||||
}
|
||||
//
|
||||
TopoDS_Shape aCIm;
|
||||
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCIm);
|
||||
//
|
||||
aIt.Initialize(theS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSX=aIt.Value();
|
||||
aOrX=aSX.Orientation();
|
||||
if (theImages.HasImage(aSX)) {
|
||||
const TopTools_ListOfShape& aLFIm=theImages.Image(aSX);
|
||||
aItIm.Initialize(aLFIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
TopoDS_Shape aSXIm=aItIm.Value();
|
||||
aSXIm.Orientation(aOrX);
|
||||
aBB.Add(aCIm, aSXIm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aBB.Add(aCIm, aSX);
|
||||
}
|
||||
}
|
||||
theImages.Bind(theS, aCIm);
|
||||
}
|
@ -1,991 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Builder_2.cxx
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepAlgo_Image.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
|
||||
#include <BooleanOperations_OnceExplorer.hxx>
|
||||
#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
||||
#include <BOPTools_SSInterference.hxx>
|
||||
#include <BOPTools_SequenceOfCurves.hxx>
|
||||
#include <BOPTools_Curve.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_PaveBlock.hxx>
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
#include <BOPTools_CArray1OfVSInterference.hxx>
|
||||
#include <BOPTools_VSInterference.hxx>
|
||||
#include <BOPTools_ESInterference.hxx>
|
||||
#include <BOPTools_CArray1OfESInterference.hxx>
|
||||
|
||||
#include <NMTDS_ShapesDataStructure.hxx>
|
||||
#include <NMTDS_InterfPool.hxx>
|
||||
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
#include <NMTTools_Tools.hxx>
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
#include <NMTTools_Tools.hxx>
|
||||
#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
|
||||
#include <NMTTools_ListOfCommonBlock.hxx>
|
||||
#include <NMTTools_CommonBlock.hxx>
|
||||
#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
|
||||
//
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <GEOMAlgo_WireEdgeSet.hxx>
|
||||
#include <GEOMAlgo_BuilderFace.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShapeSet.hxx>
|
||||
//
|
||||
#include <NMTDS_BoxBndTree.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <TopTools_DataMapOfIntegerShape.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TopTools_DataMapOfShapeInteger.hxx>
|
||||
|
||||
static
|
||||
void UpdateCandidates(const Standard_Integer ,
|
||||
const Standard_Integer ,
|
||||
NMTTools_IndexedDataMapOfIndexedMapOfInteger& );
|
||||
|
||||
//modified by NIZNHY-PKV Thu Feb 16 12:24:52 2012f
|
||||
static
|
||||
Standard_Boolean IsClosed(const TopoDS_Edge& ,
|
||||
const TopoDS_Face& );
|
||||
//modified by NIZNHY-PKV Thu Feb 16 12:24:56 2012t
|
||||
|
||||
//=======================================================================
|
||||
//function : FillImagesFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillImagesFaces()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
FillIn2DParts();
|
||||
BuildSplitFaces();
|
||||
FillSameDomainFaces();
|
||||
FillImagesFaces1();
|
||||
FillInternalVertices();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: FillIn2DParts
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillIn2DParts()
|
||||
{
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
NMTDS_InterfPool* pIP=pPF->IP();
|
||||
BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences();
|
||||
NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool();
|
||||
//
|
||||
Standard_Integer j, nSpIn, nSpSc, aNbCurves;
|
||||
Standard_Integer aNbS, nF, aNbCBP, n1, n2, aNbFFs, aNbSpIn;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TopTools_ListOfShape aLSpIn;
|
||||
TopoDS_Face aF;
|
||||
NMTTools_ListIteratorOfListOfCommonBlock aItCB;
|
||||
BOPTools_ListIteratorOfListOfPaveBlock aItPB;
|
||||
//
|
||||
myInParts.Clear();
|
||||
//
|
||||
aNbFFs=aFFs.Extent();
|
||||
aNbCBP=aCBP.Extent();
|
||||
//
|
||||
aNbS=aDS.NumberOfShapesOfTheObject();
|
||||
for (nF=1; nF<=aNbS; ++nF) {
|
||||
if (aDS.GetShapeType(nF)!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aF=TopoDS::Face(aDS.Shape(nF));
|
||||
//
|
||||
aMFence.Clear();
|
||||
aLSpIn.Clear();
|
||||
//
|
||||
// 1. In Parts
|
||||
BOPTools_ListOfPaveBlock aLPBIn;
|
||||
//
|
||||
pPF->RealSplitsInFace(nF, aLPBIn);
|
||||
//
|
||||
aItPB.Initialize(aLPBIn);
|
||||
for (; aItPB.More(); aItPB.Next()) {
|
||||
const BOPTools_PaveBlock& aPB1=aItPB.Value();
|
||||
nSpIn=aPB1.Edge();
|
||||
const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn);
|
||||
aLSpIn.Append(aSpIn);
|
||||
}
|
||||
//
|
||||
// 2. Section Parts
|
||||
for (j=1; j<=aNbFFs; ++j) {
|
||||
BOPTools_SSInterference& aFF=aFFs(j);
|
||||
aFF.Indices(n1, n2);
|
||||
if (!(n1==nF || n2==nF)) {
|
||||
continue;
|
||||
}
|
||||
BOPTools_SequenceOfCurves& aSC=aFF.Curves();
|
||||
aNbCurves=aSC.Length();
|
||||
if (!aNbCurves) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPTools_Curve& aBC=aSC(1);
|
||||
const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks();
|
||||
aItPB.Initialize(aLPB);
|
||||
for (; aItPB.More(); aItPB.Next()) {
|
||||
const BOPTools_PaveBlock& aPBSc=aItPB.Value();
|
||||
nSpSc=aPBSc.Edge();
|
||||
const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc);
|
||||
if (aMFence.Add(aSpSc)){
|
||||
aLSpIn.Append(aSpSc);
|
||||
}
|
||||
}
|
||||
}
|
||||
aNbSpIn=aLSpIn.Extent();
|
||||
if (aNbSpIn) {
|
||||
myInParts.Add(aF, aLSpIn);
|
||||
}
|
||||
}//for (nF=1; nF<=aNbS; ++nF) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: BuildSplitFaces
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::BuildSplitFaces()
|
||||
{
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
NMTDS_InterfPool* pIP=pPF->IP();
|
||||
BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences();
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
Standard_Boolean bToReverse, bIsClosed, bIsDegenerated;
|
||||
Standard_Integer i, aNb, aNbF, nF;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TColStd_IndexedMapOfInteger aMFP;
|
||||
TopExp_Explorer anExp;
|
||||
TopoDS_Face aFF;
|
||||
TopoDS_Edge aSp, aEE;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
TopAbs_Orientation anOriF, anOriE;
|
||||
//
|
||||
mySplitFaces.Clear();
|
||||
//
|
||||
// 1. Select Faces to process (MFP)
|
||||
aNb=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
const TopoDS_Shape& aF=aDS.Shape(i);
|
||||
if (aF.ShapeType()!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
if (!aMFence.Add(aF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (myInParts.Contains(aF)) {
|
||||
aMFP.Add(i);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
anExp.Init(aF, TopAbs_EDGE);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Shape& aE=anExp.Current();
|
||||
if (myImages.HasImage(aE)) {
|
||||
aMFP.Add(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
//===
|
||||
{
|
||||
Standard_Integer aNbFFs, aNbSE, j, n1, n2;
|
||||
//
|
||||
aNbFFs=aFFs.Extent();
|
||||
for (j=1; j<=aNbFFs; ++j) {
|
||||
BOPTools_SSInterference& aFFj=aFFs(j);
|
||||
aFFj.Indices(n1, n2);
|
||||
if (!(n1==i || n2==i)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TColStd_ListOfInteger& aLSE=aFFj.SharedEdges();
|
||||
aNbSE=aLSE.Extent();
|
||||
if (aNbSE) {
|
||||
aMFP.Add(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//===
|
||||
//
|
||||
}// for (i=1; i<=aNb; ++i)
|
||||
//
|
||||
// 2. ProcessFaces
|
||||
aNbF=aMFP.Extent();
|
||||
for (i=1; i<=aNbF; ++i) {
|
||||
nF=aMFP(i);
|
||||
const TopoDS_Face& aF=TopoDS::Face(aDS.Shape(nF));
|
||||
anOriF=aF.Orientation();
|
||||
aFF=aF;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
//
|
||||
aMFence.Clear();
|
||||
//
|
||||
// 2.1. Fill WES
|
||||
GEOMAlgo_WireEdgeSet aWES;
|
||||
aWES.SetFace(aFF);
|
||||
//
|
||||
// 2.1.1. Add Split parts
|
||||
anExp.Init(aFF, TopAbs_EDGE);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
|
||||
anOriE=aE.Orientation();
|
||||
//
|
||||
if (!myImages.HasImage(aE)) {
|
||||
if (anOriE==TopAbs_INTERNAL) {
|
||||
aEE=aE;
|
||||
aEE.Orientation(TopAbs_FORWARD);
|
||||
aWES.AddStartElement(aEE);
|
||||
aEE.Orientation(TopAbs_REVERSED);
|
||||
aWES.AddStartElement(aEE);
|
||||
}
|
||||
else {
|
||||
aWES.AddStartElement(aE);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bIsDegenerated=BRep_Tool::Degenerated(aE);
|
||||
//modified by NIZNHY-PKV Wed Mar 07 07:46:09 2012f
|
||||
bIsClosed=IsClosed(aE, aF);
|
||||
//bIsClosed=BRep_Tool::IsClosed(aE, aF);
|
||||
//modified by NIZNHY-PKV Wed Mar 07 07:46:13 2012t
|
||||
//
|
||||
const TopTools_ListOfShape& aLIE=myImages.Image(aE);
|
||||
aIt.Initialize(aLIE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aSp=TopoDS::Edge(aIt.Value());
|
||||
//
|
||||
if (bIsDegenerated) {
|
||||
aSp.Orientation(anOriE);
|
||||
aWES.AddStartElement(aSp);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (anOriE==TopAbs_INTERNAL) {
|
||||
aSp.Orientation(TopAbs_FORWARD);
|
||||
aWES.AddStartElement(aSp);
|
||||
aSp.Orientation(TopAbs_REVERSED);
|
||||
aWES.AddStartElement(aSp);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (bIsClosed){
|
||||
if (aMFence.Add(aSp)) {
|
||||
//
|
||||
if (!BRep_Tool::IsClosed(aSp, aF)){
|
||||
BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF);
|
||||
}
|
||||
//
|
||||
aSp.Orientation(TopAbs_FORWARD);
|
||||
aWES.AddStartElement(aSp);
|
||||
aSp.Orientation(TopAbs_REVERSED);
|
||||
aWES.AddStartElement(aSp);
|
||||
}
|
||||
continue;
|
||||
}// if (aMFence.Add(aSp))
|
||||
//
|
||||
aSp.Orientation(anOriE);
|
||||
bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
aWES.AddStartElement(aSp);
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}// for (; anExp.More(); anExp.Next()) {
|
||||
//
|
||||
// 2.1.2. Add In2D Parts
|
||||
if (myInParts.Contains(aF)) {
|
||||
const TopTools_ListOfShape& aLE=myInParts.FindFromKey(aF);
|
||||
aIt.Initialize(aLE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aSp=TopoDS::Edge(aIt.Value());
|
||||
//
|
||||
aSp.Orientation(TopAbs_FORWARD);
|
||||
aWES.AddStartElement(aSp);
|
||||
//
|
||||
aSp.Orientation(TopAbs_REVERSED);
|
||||
aWES.AddStartElement(aSp);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2.2. Build images Faces
|
||||
TopTools_ListOfShape aLFR;
|
||||
GEOMAlgo_ShapeSet aS1, aS2;
|
||||
//
|
||||
const TopTools_ListOfShape& aSE=aWES.StartElements();
|
||||
aS1.Add(aSE);
|
||||
aS2.Add(aFF, TopAbs_EDGE);
|
||||
if (aS1.IsEqual(aS2)) {
|
||||
aLFR.Append(aF);
|
||||
}
|
||||
else {
|
||||
GEOMAlgo_BuilderFace aBF;
|
||||
//
|
||||
aBF.SetFace(aFF);
|
||||
aBF.SetContext(aCtx);
|
||||
aBF.SetShapes(aSE);
|
||||
// <-DEB
|
||||
aBF.Perform();
|
||||
//
|
||||
const TopTools_ListOfShape& aLF=aBF.Areas();
|
||||
aIt.Initialize(aLF);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape& aFR=aIt.Value();
|
||||
if (anOriF==TopAbs_REVERSED) {
|
||||
aFR.Orientation(TopAbs_REVERSED);
|
||||
}
|
||||
aLFR.Append(aFR);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2.3. Collect draft images Faces
|
||||
mySplitFaces.Bind(aF, aLFR);
|
||||
}//for (i=1; i<=aNbF; ++i)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: FillSameDomainFaces
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillSameDomainFaces()
|
||||
{
|
||||
Standard_Boolean bIsSDF, bHasImage1, bHasImage2, bForward;
|
||||
Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC, aNbSE;
|
||||
Standard_Integer aNbF1, aNbF2, i2s, aNbSD;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TopTools_ListOfShape aLX1, aLX2;
|
||||
TopTools_ListIteratorOfListOfShape aItF1, aItF2;
|
||||
NMTTools_ListOfCoupleOfShape aLCS;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
NMTDS_InterfPool* pIP=pPF->IP();
|
||||
BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences();
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
//
|
||||
//mySameDomainShapes.Clear();
|
||||
//
|
||||
// 1. For each FF find among images of faces
|
||||
// all pairs of same domain faces (SDF) [=> aLCS]
|
||||
aNbFF=aFFs.Extent();
|
||||
for (i=1; i<=aNbFF; ++i) {
|
||||
BOPTools_SSInterference& aFF=aFFs(i);
|
||||
aFF.Indices(nF1, nF2);
|
||||
//
|
||||
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
|
||||
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
|
||||
//
|
||||
// if there are no in/on 2D split parts the faces nF1, nF2
|
||||
// can not be SDF
|
||||
const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
|
||||
aNbPBInOn=aLPBInOn.Extent();
|
||||
//
|
||||
//===
|
||||
const TColStd_ListOfInteger& aLSE=aFF.SharedEdges();
|
||||
aNbSE=aLSE.Extent();
|
||||
if (!aNbPBInOn && !aNbSE) {
|
||||
continue;
|
||||
}
|
||||
//===
|
||||
//
|
||||
// if there is at least one section edge between faces nF1, nF2
|
||||
// they can not be SDF
|
||||
BOPTools_SequenceOfCurves& aSC=aFF.Curves();
|
||||
aNbC=aSC.Length();
|
||||
if (aNbC) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// the faces are suspected to be SDF.
|
||||
// Try to find SDF among images of nF1, nF2
|
||||
aMFence.Clear();
|
||||
//
|
||||
//--------------------------------------------------------
|
||||
bHasImage1=mySplitFaces.HasImage(aF1);
|
||||
bHasImage2=mySplitFaces.HasImage(aF2);
|
||||
//
|
||||
aLX1.Clear();
|
||||
if (!bHasImage1) {
|
||||
aLX1.Append(aF1);
|
||||
}
|
||||
//
|
||||
aLX2.Clear();
|
||||
if (!bHasImage2) {
|
||||
aLX2.Append(aF2);
|
||||
}
|
||||
//
|
||||
const TopTools_ListOfShape& aLF1r=(bHasImage1)? mySplitFaces.Image(aF1) : aLX1;
|
||||
const TopTools_ListOfShape& aLF2r=(bHasImage2)? mySplitFaces.Image(aF2) : aLX2;
|
||||
//
|
||||
TopTools_DataMapOfIntegerShape aMIS;
|
||||
TColStd_ListIteratorOfListOfInteger aItLI;
|
||||
NMTDS_BoxBndTreeSelector aSelector;
|
||||
NMTDS_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
aNbF1=aLF1r.Extent();
|
||||
aNbF2=aLF2r.Extent();
|
||||
bForward=(aNbF1<aNbF2);
|
||||
//
|
||||
const TopTools_ListOfShape& aLF1=bForward ? aLF1r : aLF2r;
|
||||
const TopTools_ListOfShape& aLF2=bForward ? aLF2r : aLF1r;
|
||||
//
|
||||
// 1. aTreeFiller
|
||||
aItF2.Initialize(aLF2);
|
||||
for (i2s=1; aItF2.More(); aItF2.Next(), ++i2s) {
|
||||
Bnd_Box aBoxF2s;
|
||||
//
|
||||
const TopoDS_Face& aF2s=*((TopoDS_Face*)(&aItF2.Value()));
|
||||
//
|
||||
BRepBndLib::Add(aF2s, aBoxF2s);
|
||||
//
|
||||
aMIS.Bind(i2s, aF2s);
|
||||
//
|
||||
aTreeFiller.Add(i2s, aBoxF2s);
|
||||
}//for (i2s=1; aItF2.More(); aItF2.Next(), ++i2s) {
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
// 2.
|
||||
aItF1.Initialize(aLF1);
|
||||
for (j=1; aItF1.More(); aItF1.Next(), ++j) {
|
||||
Bnd_Box aBoxF1x;
|
||||
//
|
||||
const TopoDS_Face& aF1x=*((TopoDS_Face*)(&aItF1.Value()));
|
||||
//
|
||||
BRepBndLib::Add(aF1x, aBoxF1x);
|
||||
//
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBoxF1x);
|
||||
aNbSD=aBBTree.Select(aSelector);
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TColStd_ListOfInteger& aLI=aSelector.Indices();
|
||||
aItLI.Initialize(aLI);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
i2s=aItLI.Value();
|
||||
const TopoDS_Face& aF2y=*((TopoDS_Face*)(&aMIS.Find(i2s)));
|
||||
//
|
||||
bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx);
|
||||
if (bIsSDF) {
|
||||
if (aMFence.Contains(aF1x) || aMFence.Contains(aF2y)) {
|
||||
continue;
|
||||
}
|
||||
aMFence.Add(aF1x);
|
||||
aMFence.Add(aF2y);
|
||||
//
|
||||
NMTTools_CoupleOfShape aCS;
|
||||
//
|
||||
aCS.SetShape1(aF1x);
|
||||
aCS.SetShape2(aF2y);
|
||||
aLCS.Append(aCS);
|
||||
//
|
||||
if (bForward) {
|
||||
if (aF1x==aF1) {
|
||||
if (!mySplitFaces.HasImage(aF1)) {
|
||||
mySplitFaces.Bind(aF1, aF1);
|
||||
}
|
||||
}
|
||||
if (aF2y==aF2) {
|
||||
if (!mySplitFaces.HasImage(aF2)) {
|
||||
mySplitFaces.Bind(aF2, aF2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aF1x==aF2) {
|
||||
if (!mySplitFaces.HasImage(aF2)) {
|
||||
mySplitFaces.Bind(aF2, aF2);
|
||||
}
|
||||
}
|
||||
if (aF2y==aF1) {
|
||||
if (!mySplitFaces.HasImage(aF1)) {
|
||||
mySplitFaces.Bind(aF1, aF1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
break;
|
||||
}//if (bIsSDF) {
|
||||
}//for (; aItLI.More(); aItLI.Next()) {
|
||||
}//for (; aItF1.More(); aItF1.Next()) {
|
||||
}//for (i=1; i<=aNbFF; ++i)
|
||||
//-------------------------------------------------------------
|
||||
aNbC=aLCS.Extent();
|
||||
if (!aNbC) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 2. Find Chains
|
||||
NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC;
|
||||
//
|
||||
NMTTools_Tools::FindChains(aLCS, aMC);
|
||||
//
|
||||
Standard_Boolean bIsImage;
|
||||
Standard_Integer aIx, aIxMin, aNbMSDF, k, aNbMFj;
|
||||
TopoDS_Shape aFOld, aFSDmin;
|
||||
TopTools_IndexedMapOfShape aMFj;
|
||||
TopTools_DataMapOfShapeInteger aDMSI;
|
||||
//
|
||||
aItF1.Initialize(myShapes);
|
||||
for (j=1; aItF1.More(); aItF1.Next(), ++j) {
|
||||
const TopoDS_Shape& aSj=aItF1.Value();
|
||||
aMFj.Clear();
|
||||
TopExp::MapShapes(aSj, TopAbs_FACE, aMFj);
|
||||
aNbMFj=aMFj.Extent();
|
||||
for (k=1; k<=aNbMFj; ++k) {
|
||||
const TopoDS_Shape& aFk=aMFj(k);
|
||||
if (!aDMSI.IsBound(aFk)) {
|
||||
aDMSI.Bind(aFk, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 3. Fill the map of SDF mySameDomainFaces
|
||||
aNbC=aMC.Extent();
|
||||
for (i=1; i<=aNbC; ++i) {
|
||||
// const TopoDS_Shape& aF=aMC.FindKey(i);
|
||||
const TopTools_IndexedMapOfShape& aMSDF=aMC(i);
|
||||
//
|
||||
aNbMSDF=aMSDF.Extent();
|
||||
for (j=1; j<=aNbMSDF; ++j) {
|
||||
const TopoDS_Shape& aFSD=aMSDF(j);
|
||||
bIsImage=mySplitFaces.IsImage(aFSD);
|
||||
aFOld=aFSD;
|
||||
if (bIsImage) {
|
||||
aFOld=mySplitFaces.ImageFrom(aFSD);
|
||||
}
|
||||
//
|
||||
aIx=aDMSI.Find(aFOld);
|
||||
if (j==1) {
|
||||
aIxMin=aIx;
|
||||
aFSDmin=aFSD;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (aIx<aIxMin) {
|
||||
aIxMin=aIx;
|
||||
aFSDmin=aFSD;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
for (j=1; j<=aNbMSDF; ++j) {
|
||||
const TopoDS_Shape& aFSD=aMSDF(j);
|
||||
mySameDomainShapes.Add(aFSD, aFSDmin);
|
||||
}
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: FillImagesFaces1
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillImagesFaces1()
|
||||
{
|
||||
Standard_Integer i, aNb, iSense, aNbLFx;
|
||||
TopoDS_Face aF, aFSp, aFSD;
|
||||
TopTools_ListOfShape aLFx;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
//
|
||||
aNb=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
const TopoDS_Shape& aS=aDS.Shape(i);
|
||||
if (aS.ShapeType()!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (!mySplitFaces.HasImage(aS)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aF=*((TopoDS_Face*)&aS);
|
||||
//
|
||||
aLFx.Clear();
|
||||
const TopTools_ListOfShape& aLF=mySplitFaces.Image(aF);
|
||||
aIt.Initialize(aLF);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aFSp=*((TopoDS_Face*)(&aIt.Value()));
|
||||
if (!mySameDomainShapes.Contains(aFSp)) {
|
||||
aLFx.Append(aFSp);
|
||||
}
|
||||
else {
|
||||
const TopoDS_Shape& aSx=mySameDomainShapes.FindFromKey(aFSp);
|
||||
aFSD=*((TopoDS_Face*)(&aSx));
|
||||
iSense=GEOMAlgo_Tools3D::Sense(aFSp, aFSD);
|
||||
if (iSense<0) {
|
||||
aFSD.Reverse();
|
||||
}
|
||||
aLFx.Append(aFSD);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!myImages.HasImage(aF)) {
|
||||
aNbLFx=aLFx.Extent();
|
||||
if (aNbLFx==1) {
|
||||
const TopoDS_Shape& aFx=aLFx.First();
|
||||
if (aF.IsSame(aFx)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
myImages.Bind(aF, aLFx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: FillInternalVertices
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillInternalVertices()
|
||||
{
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
NMTDS_InterfPool* pIP=pPF->IP();
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
BOPTools_CArray1OfVSInterference& aVFs=pIP->VSInterferences();
|
||||
BOPTools_CArray1OfESInterference& aEFs=pIP->ESInterferences();
|
||||
const NMTTools_IndexedDataMapOfIndexedMapOfInteger& aMAV=pPF->AloneVertices();
|
||||
//
|
||||
Standard_Boolean bHasImage;
|
||||
Standard_Integer i, j, nF, aNbS, nV, nVSD, n1, n2, iFlag;
|
||||
Standard_Integer aNbVFs, aNbAVF, aNbEFs, aNbVC, aNbE, aNbV;
|
||||
Standard_Real aU1, aU2, aTol;
|
||||
NMTTools_IndexedDataMapOfIndexedMapOfInteger aMFMV;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aItV;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
// 1. Collect face-vertex candidates [aMFMV]
|
||||
//
|
||||
// 1.1. VFs
|
||||
aNbVFs=aVFs.Extent();
|
||||
for (i=1; i<=aNbVFs; ++i) {
|
||||
const BOPTools_VSInterference& aVS=aVFs(i);
|
||||
aVS.Indices(n1, n2);
|
||||
nF=n2;
|
||||
nV=n1;
|
||||
if (aDS.Shape(n1).ShapeType()==TopAbs_FACE) {
|
||||
nF=n1;
|
||||
nV=n2;
|
||||
}
|
||||
nVSD=pPF->FindSDVertex(nV);
|
||||
if (nVSD) {
|
||||
nV=nVSD;
|
||||
}
|
||||
//
|
||||
UpdateCandidates(nF, nV, aMFMV);
|
||||
}
|
||||
//
|
||||
// 1.2 EFs
|
||||
aNbEFs=aEFs.Extent();
|
||||
for (i=1; i<=aNbEFs; ++i) {
|
||||
const BOPTools_ESInterference& aEF=aEFs(i);
|
||||
aEF.Indices(n1, n2);
|
||||
nV=aEF.NewShape();
|
||||
if (!nV) {
|
||||
continue;
|
||||
}
|
||||
const TopoDS_Shape& aSnew=aDS.Shape(nV);
|
||||
if (aSnew.ShapeType()!=TopAbs_VERTEX) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
nF=(aDS.Shape(n1).ShapeType()==TopAbs_FACE) ? n1 : n2;
|
||||
nVSD=pPF->FindSDVertex(nV);
|
||||
if (nVSD) {
|
||||
nV=nVSD;
|
||||
}
|
||||
UpdateCandidates(nF, nV, aMFMV);
|
||||
}
|
||||
//
|
||||
aNbS=aDS.NumberOfShapesOfTheObject();
|
||||
for (nF=1; nF<=aNbS; ++nF) {
|
||||
const TopoDS_Shape& aF=aDS.Shape(nF);
|
||||
//
|
||||
if (aF.ShapeType()!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
if (!aMFence.Add(aF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& aFF=TopoDS::Face(aF);
|
||||
aTol=BRep_Tool::Tolerance(aFF);
|
||||
//
|
||||
// 1.3 FFs
|
||||
if (aMAV.Contains(nF)) {
|
||||
const TColStd_IndexedMapOfInteger& aMAVF=aMAV.FindFromKey(nF);
|
||||
aNbAVF=aMAVF.Extent();
|
||||
for (j=1; j<=aNbAVF; ++j) {
|
||||
nV=aMAVF(j);
|
||||
nVSD=pPF->FindSDVertex(nV);
|
||||
if (nVSD) {
|
||||
nV=nVSD;
|
||||
}
|
||||
//
|
||||
UpdateCandidates(nF, nV, aMFMV);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 1.4 Internal vertices of the face nF
|
||||
BooleanOperations_OnceExplorer aExp(aDS);
|
||||
aExp.Init(nF, TopAbs_VERTEX);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
nV=aExp.Current();
|
||||
const TopoDS_Shape& aV=aDS.Shape(nV);
|
||||
if (aV.Orientation()==TopAbs_INTERNAL) {
|
||||
nVSD=pPF->FindSDVertex(nV);
|
||||
if (nVSD) {
|
||||
nV=nVSD;
|
||||
}
|
||||
//
|
||||
UpdateCandidates(nF, nV, aMFMV);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2. Process face nF
|
||||
if (!aMFMV.Contains(nF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TColStd_IndexedMapOfInteger& aMVC=aMFMV.FindFromKey(nF);
|
||||
aNbVC=aMVC.Extent();
|
||||
if (!aNbVC) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// 2.1 Refine candidates
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
TopTools_ListOfShape aLV;
|
||||
//
|
||||
bHasImage=myImages.HasImage(aF);
|
||||
if (bHasImage) {
|
||||
const TopTools_ListOfShape& aLFx=myImages.Image(aF);
|
||||
aIt.Initialize(aLFx);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aFx=aIt.Value();
|
||||
TopExp::MapShapesAndAncestors(aFx, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Boolean bFaceToProcess;
|
||||
//
|
||||
TopExp::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
bFaceToProcess=Standard_False;
|
||||
for (j=1; j<=aNbVC; ++j) {
|
||||
nV=aMVC(j);
|
||||
const TopoDS_Shape& aV=aDS.Shape(nV);
|
||||
if (!aMVE.Contains(aV)) {
|
||||
bFaceToProcess=!bFaceToProcess;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFaceToProcess) {
|
||||
continue;
|
||||
}
|
||||
}// else
|
||||
//
|
||||
for (j=1; j<=aNbVC; ++j) {
|
||||
nV=aMVC(j);
|
||||
const TopoDS_Shape& aV=aDS.Shape(nV);
|
||||
if (aMVE.Contains(aV)) {
|
||||
const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV);
|
||||
aNbE=aLE.Extent();
|
||||
if (aNbE) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
aLV.Append(aV);
|
||||
}
|
||||
//
|
||||
aNbV=aLV.Extent();
|
||||
if (aNbV) {
|
||||
// 3. Try to put vertices into the face(s)
|
||||
aItV.Initialize(aLV);
|
||||
for (; aItV.More(); aItV.Next()) {
|
||||
TopoDS_Vertex aV=TopoDS::Vertex(aItV.Value());
|
||||
aV.Orientation(TopAbs_INTERNAL);
|
||||
//
|
||||
bHasImage=myImages.HasImage(aF);
|
||||
if (bHasImage) {
|
||||
const TopTools_ListOfShape& aLFx=myImages.Image(aF);
|
||||
aIt.Initialize(aLFx);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Face aFx=TopoDS::Face(aIt.Value());
|
||||
// update classifier
|
||||
IntTools_FClass2d& aClsf=aCtx->FClass2d(aFx);
|
||||
aClsf.Init(aFx, aTol);
|
||||
//
|
||||
iFlag=aCtx->ComputeVS (aV, aFx, aU1, aU2);
|
||||
if (!iFlag) {
|
||||
aBB.Add(aFx, aV);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const TopoDS_Face& aFx=TopoDS::Face(aF);
|
||||
// update classifier
|
||||
IntTools_FClass2d& aClsf=aCtx->FClass2d(aFx);
|
||||
aClsf.Init(aFx, aTol);
|
||||
//
|
||||
iFlag=aCtx->ComputeVS (aV, aFx, aU1, aU2);
|
||||
if (!iFlag) {
|
||||
TopoDS_Face aFz;
|
||||
//
|
||||
GEOMAlgo_Tools3D::CopyFace(aFx, aFz);
|
||||
aBB.Add(aFz, aV);
|
||||
myImages.Bind(aF, aFz);
|
||||
}
|
||||
}
|
||||
}// for (; aItV.More(); aItV.Next()) {
|
||||
}// if (aNbV) {
|
||||
}// for (nF=1; nF<=aNb; ++nF) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: UpdateCandidates
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void UpdateCandidates(const Standard_Integer theNF,
|
||||
const Standard_Integer theNV,
|
||||
NMTTools_IndexedDataMapOfIndexedMapOfInteger& theMFMV)
|
||||
{
|
||||
if (theMFMV.Contains(theNF)) {
|
||||
TColStd_IndexedMapOfInteger& aMV=theMFMV.ChangeFromKey(theNF);
|
||||
aMV.Add(theNV);
|
||||
}
|
||||
else {
|
||||
TColStd_IndexedMapOfInteger aMV;
|
||||
aMV.Add(theNV);
|
||||
theMFMV.Add(theNF, aMV);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsClosed(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
//
|
||||
bRet=BRep_Tool::IsClosed(aE, aF);
|
||||
if (bRet) {
|
||||
Standard_Integer iCnt;
|
||||
TopoDS_Shape aE1;
|
||||
//
|
||||
bRet=!bRet;
|
||||
iCnt=0;
|
||||
TopExp_Explorer aExp(aF, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aEx=aExp.Current();
|
||||
//
|
||||
if (aEx.IsSame(aE)) {
|
||||
++iCnt;
|
||||
if (iCnt==1) {
|
||||
aE1=aEx;
|
||||
}
|
||||
else if (iCnt==2){
|
||||
aE1.Reverse();
|
||||
bRet=(aE1==aEx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
TopoDS_Compound aCx;
|
||||
BRep_Builder aBBx;
|
||||
TopTools_ListIteratorOfListOfShape aItx;
|
||||
//
|
||||
aBBx.MakeCompound(aCx);
|
||||
aBBx.Add(aCx, aFF);
|
||||
aItx.Initialize(aSE);
|
||||
for (; aItx.More(); aItx.Next()) {
|
||||
TopoDS_Shape& aEx=aItx.Value();
|
||||
aBBx.Add(aCx, aEx);
|
||||
}
|
||||
int a=0;
|
||||
}
|
||||
*/
|
@ -1,768 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_Builder_3.cxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
|
||||
#include <TopAbs_State.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeInteger.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <NMTDS_ShapesDataStructure.hxx>
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <GEOMAlgo_BuilderSolid.hxx>
|
||||
#include <GEOMAlgo_ShapeSet.hxx>
|
||||
#include <GEOMAlgo_DataMapOfShapeShapeSet.hxx>
|
||||
#include <GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
void OwnInternalShapes(const TopoDS_Shape& ,
|
||||
TopTools_IndexedMapOfShape& );
|
||||
|
||||
//=======================================================================
|
||||
//function : FillImagesSolids
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillImagesSolids()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
FillIn3DParts();
|
||||
BuildSplitSolids();
|
||||
FillInternalShapes();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildDraftSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::BuildDraftSolid (const TopoDS_Shape& theSolid,
|
||||
TopoDS_Shape& theDraftSolid,
|
||||
TopTools_ListOfShape& theLIF)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
Standard_Boolean bToReverse;
|
||||
Standard_Integer iFlag;
|
||||
TopAbs_Orientation aOrF, aOrSh, aOrSd;
|
||||
TopoDS_Iterator aIt1, aIt2;
|
||||
TopTools_ListIteratorOfListOfShape aItS;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Shell aShD;
|
||||
TopoDS_Shape aFSDx, aFx;
|
||||
//
|
||||
aOrSd=theSolid.Orientation();
|
||||
theDraftSolid.Orientation(aOrSd);
|
||||
//
|
||||
aIt1.Initialize(theSolid);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aSh=aIt1.Value();
|
||||
if(aSh.ShapeType()!=TopAbs_SHELL) {
|
||||
continue; // mb internal edges,vertices
|
||||
}
|
||||
//
|
||||
aOrSh=aSh.Orientation();
|
||||
aBB.MakeShell(aShD);
|
||||
aShD.Orientation(aOrSh);
|
||||
iFlag=0;
|
||||
//
|
||||
aIt2.Initialize(aSh);
|
||||
for (; aIt2.More(); aIt2.Next()) {
|
||||
const TopoDS_Shape& aF=aIt2.Value();
|
||||
aOrF=aF.Orientation();
|
||||
//
|
||||
if (myImages.HasImage(aF)) {
|
||||
const TopTools_ListOfShape& aLSp=myImages.Image(aF);
|
||||
aItS.Initialize(aLSp);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
aFx=aItS.Value();
|
||||
//
|
||||
if (mySameDomainShapes.Contains(aFx)) {
|
||||
aFSDx=mySameDomainShapes.FindFromKey(aFx);
|
||||
//
|
||||
if (aOrF==TopAbs_INTERNAL) {
|
||||
aFSDx.Orientation(aOrF);
|
||||
theLIF.Append(aFSDx);
|
||||
}
|
||||
else {
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFSDx, aF, aCtx);
|
||||
if (bToReverse) {
|
||||
aFSDx.Reverse();
|
||||
}
|
||||
//
|
||||
iFlag=1;
|
||||
aBB.Add(aShD, aFSDx);
|
||||
}
|
||||
}// if (mySameDomainShapes.Contains(aFx)) {
|
||||
else {
|
||||
aFx.Orientation(aOrF);
|
||||
if (aOrF==TopAbs_INTERNAL) {
|
||||
theLIF.Append(aFx);
|
||||
}
|
||||
else{
|
||||
iFlag=1;
|
||||
aBB.Add(aShD, aFx);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //if (myImages.HasImage(aF)) {
|
||||
//
|
||||
else {
|
||||
if (aOrF==TopAbs_INTERNAL) {
|
||||
theLIF.Append(aF);
|
||||
}
|
||||
else{
|
||||
iFlag=1;
|
||||
aBB.Add(aShD, aF);
|
||||
}
|
||||
}
|
||||
} //for (; aIt2.More(); aIt2.Next()) {
|
||||
//
|
||||
if (iFlag) {
|
||||
aBB.Add(theDraftSolid, aShD);
|
||||
}
|
||||
} //for (; aIt1.More(); aIt1.Next()) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FillIn3DParts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillIn3DParts()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
Standard_Boolean bIsIN, bHasImage;
|
||||
Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopAbs_State aState;
|
||||
TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN;
|
||||
TopTools_MapOfShape aMFDone;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
TopTools_ListIteratorOfListOfShape aItS;
|
||||
TopoDS_Iterator aIt, aItF;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Solid aSolidSp;
|
||||
TopoDS_Face aFP;
|
||||
//
|
||||
myDraftSolids.Clear();
|
||||
//
|
||||
aNbS=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNbS; ++i) {
|
||||
const TopoDS_Shape& aS=aDS.Shape(i);
|
||||
//
|
||||
aType=aS.ShapeType();
|
||||
if (aType==TopAbs_SOLID) {
|
||||
// all solids from DS
|
||||
aMSolids.Add(aS);
|
||||
}
|
||||
else if (aType==TopAbs_FACE) {
|
||||
// all faces (originals from DS or theirs images)
|
||||
if (myImages.HasImage(aS)) {
|
||||
const TopTools_ListOfShape& aLS=myImages.Image(aS);
|
||||
aItS.Initialize(aLS);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aFx=aItS.Value();
|
||||
//
|
||||
if (mySameDomainShapes.Contains(aFx)) {
|
||||
const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aFx);
|
||||
aMFaces.Add(aFSDx);
|
||||
}
|
||||
else {
|
||||
aMFaces.Add(aFx);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mySameDomainShapes.Contains(aS)) {
|
||||
const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aS);
|
||||
aMFaces.Add(aFSDx);
|
||||
}
|
||||
else {
|
||||
aMFaces.Add(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbFaces=aMFaces.Extent();
|
||||
aNbSolids=aMSolids.Extent();
|
||||
//
|
||||
for (i=1; i<=aNbSolids; ++i) {
|
||||
const TopoDS_Solid& aSolid=TopoDS::Solid(aMSolids(i));
|
||||
aMFDone.Clear();
|
||||
aMFIN.Clear();
|
||||
aMEF.Clear();
|
||||
//
|
||||
aBB.MakeSolid(aSolidSp);
|
||||
//
|
||||
TopTools_ListOfShape aLIF;
|
||||
//
|
||||
BuildDraftSolid(aSolid, aSolidSp, aLIF);
|
||||
aNbLIF=aLIF.Extent();
|
||||
//
|
||||
// 1 all faces/edges from aSolid [ aMS ]
|
||||
bHasImage=Standard_False;
|
||||
aMS.Clear();
|
||||
aIt.Initialize(aSolid);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aShell=aIt.Value();
|
||||
//
|
||||
if (myImages.HasImage(aShell)) {
|
||||
bHasImage=Standard_True;
|
||||
//
|
||||
const TopTools_ListOfShape& aLS=myImages.Image(aShell);
|
||||
aItS.Initialize(aLS);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSx=aItS.Value();
|
||||
aMS.Add(aSx);
|
||||
TopExp::MapShapes(aSx, TopAbs_FACE, aMS);
|
||||
TopExp::MapShapes(aSx, TopAbs_EDGE, aMS);
|
||||
TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//aMS.Add(aShell);
|
||||
TopExp::MapShapes(aShell, TopAbs_FACE, aMS);
|
||||
//modified by NIZNHY-PKV Fri Dec 03 11:18:45 2010f
|
||||
TopExp::MapShapes(aShell, TopAbs_EDGE, aMS);
|
||||
//modified by NIZNHY-PKV Fri Dec 03 11:18:51 2010t
|
||||
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2 all faces that are not from aSolid [ aLFP1 ]
|
||||
Standard_Integer aNbEFP;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEFP;
|
||||
TopTools_ListIteratorOfListOfShape aItFP, aItEx;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TopTools_ListOfShape aLFP1, aLFP2, aLFP, aLCBF, aLFIN, aLEx;//*pLFP,
|
||||
//
|
||||
// for all non-solid faces build EF map [ aMEFP ]
|
||||
for (j=1; j<=aNbFaces; ++j) {
|
||||
const TopoDS_Shape& aFace=aMFaces(j);
|
||||
if (!aMS.Contains(aFace)) {
|
||||
TopExp::MapShapesAndAncestors(aFace, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
}
|
||||
}
|
||||
//
|
||||
// among all faces from aMEFP select these that have same edges
|
||||
// with the solid (i.e aMEF). These faces will be treated first
|
||||
// to prevent the usage of 3D classifier.
|
||||
// The full list of faces to process is aLFP1.
|
||||
aNbEFP=aMEFP.Extent();
|
||||
for (j=1; j<=aNbEFP; ++j) {
|
||||
const TopoDS_Shape& aE=aMEFP.FindKey(j);
|
||||
//
|
||||
if (aMEF.Contains(aE)) { // !!
|
||||
const TopTools_ListOfShape& aLF=aMEFP(j);
|
||||
aItFP.Initialize(aLF);
|
||||
for (; aItFP.More(); aItFP.Next()) {
|
||||
const TopoDS_Shape& aF=aItFP.Value();
|
||||
if (aMFence.Add(aF)) {
|
||||
aLFP1.Append(aF);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
aLEx.Append(aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
aItEx.Initialize(aLEx);
|
||||
for (; aItEx.More(); aItEx.Next()) {
|
||||
const TopoDS_Shape& aE=aItEx.Value();
|
||||
const TopTools_ListOfShape& aLF=aMEFP.FindFromKey(aE);
|
||||
aItFP.Initialize(aLF);
|
||||
for (; aItFP.More(); aItFP.Next()) {
|
||||
const TopoDS_Shape& aF=aItFP.Value();
|
||||
if (aMFence.Add(aF)) {
|
||||
aLFP2.Append(aF);
|
||||
}
|
||||
}
|
||||
}
|
||||
aLFP1.Append(aLFP2);
|
||||
//==========
|
||||
//
|
||||
// 3 Process faces aLFP1
|
||||
aNbFP=aLFP1.Extent();
|
||||
aItFP.Initialize(aLFP1);
|
||||
for (; aItFP.More(); aItFP.Next()) {
|
||||
const TopoDS_Shape& aSP=aItFP.Value();
|
||||
if (!aMFDone.Add(aSP)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// first face to process
|
||||
aFP=TopoDS::Face(aSP);
|
||||
bIsIN= GEOMAlgo_Tools3D::IsInternalFace(aFP, aSolidSp, aMEF, 1.e-14, aCtx);
|
||||
aState=(bIsIN) ? TopAbs_IN : TopAbs_OUT;
|
||||
//
|
||||
// collect faces to process [ aFP is the first ]
|
||||
aLFP.Clear();
|
||||
aLFP.Append(aFP);
|
||||
aItS.Initialize(aLFP1);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSk=aItS.Value();
|
||||
if (!aMFDone.Contains(aSk)) {
|
||||
aLFP.Append(aSk);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Connexity Block that spreads from aFP the Bound
|
||||
// or till the end of the block itself
|
||||
aLCBF.Clear();
|
||||
GEOMAlgo_Tools3D::MakeConnexityBlock(aLFP, aMS, aLCBF);
|
||||
//
|
||||
// fill states for the Connexity Block
|
||||
aItS.Initialize(aLCBF);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSx=aItS.Value();
|
||||
aMFDone.Add(aSx);
|
||||
if (aState==TopAbs_IN) {
|
||||
aMFIN.Add(aSx);
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbFPx=aMFDone.Extent();
|
||||
if (aNbFPx==aNbFP) {
|
||||
break;
|
||||
}
|
||||
}//for (; aItFP.More(); aItFP.Next())
|
||||
//
|
||||
// faces Inside aSolid
|
||||
aLFIN.Clear();
|
||||
aNbFIN=aMFIN.Extent();
|
||||
if (aNbFIN || aNbLIF) {
|
||||
for (j=1; j<=aNbFIN; ++j) {
|
||||
const TopoDS_Shape& aFIN=aMFIN(j);
|
||||
aLFIN.Append(aFIN);
|
||||
}
|
||||
//
|
||||
aItS.Initialize(aLIF);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aFIN=aItS.Value();
|
||||
aLFIN.Append(aFIN);
|
||||
}
|
||||
//
|
||||
myInParts.Add(aSolid, aLFIN);
|
||||
}
|
||||
if (aNbFIN || bHasImage) {
|
||||
myDraftSolids.Add(aSolid, aSolidSp);
|
||||
}
|
||||
}//for (i=1; i<=aNbSolids; ++i) { // next solid
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildSplitSolids
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::BuildSplitSolids()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
Standard_Integer i, aNbS, iErr;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_ListOfShape aSFS, aLSEmpty;
|
||||
TopTools_MapOfShape aMFence;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
GEOMAlgo_BuilderSolid aSB;
|
||||
GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet aItSS;
|
||||
GEOMAlgo_DataMapOfShapeShapeSet aMSS;
|
||||
GEOMAlgo_ShapeSet aSSi;
|
||||
//
|
||||
// 0. Find same domain solids for non-interferred solids
|
||||
aNbS=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNbS; ++i) {
|
||||
const TopoDS_Shape& aS=aDS.Shape(i);
|
||||
if (aS.ShapeType()!=TopAbs_SOLID) {
|
||||
continue;
|
||||
}
|
||||
if (!aMFence.Add(aS)) {
|
||||
continue;
|
||||
}
|
||||
if(myDraftSolids.Contains(aS)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aSSi.Clear();
|
||||
aSSi.Add(aS, TopAbs_FACE);
|
||||
//
|
||||
aMSS.Bind(aS, aSSi);
|
||||
} //for (i=1; i<=aNbS; ++i)
|
||||
//
|
||||
// 1. Build solids for interferred source solids
|
||||
aSB.SetContext(aCtx);
|
||||
aSB.ComputeInternalShapes(myComputeInternalShapes);
|
||||
aNbS=myDraftSolids.Extent();
|
||||
for (i=1; i<=aNbS; ++i) {
|
||||
const TopoDS_Shape& aS =myDraftSolids.FindKey(i);
|
||||
const TopoDS_Shape& aSD=myDraftSolids.FindFromIndex(i);
|
||||
const TopTools_ListOfShape& aLFIN=
|
||||
(myInParts.Contains(aS)) ? myInParts.FindFromKey(aS) : aLSEmpty;
|
||||
//
|
||||
// 1.1 Fill Shell Faces Set
|
||||
aSFS.Clear();
|
||||
|
||||
aExp.Init(aSD, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aF=aExp.Current();
|
||||
aSFS.Append(aF);
|
||||
}
|
||||
//
|
||||
aIt.Initialize(aLFIN);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape aF=aIt.Value();
|
||||
//
|
||||
aF.Orientation(TopAbs_FORWARD);
|
||||
aSFS.Append(aF);
|
||||
aF.Orientation(TopAbs_REVERSED);
|
||||
aSFS.Append(aF);
|
||||
}
|
||||
//
|
||||
Standard_Integer aNbSFS;
|
||||
aNbSFS=aSFS.Extent();
|
||||
//
|
||||
// 1.2
|
||||
// Check whether aSFS contains a subsets of faces
|
||||
// of solids that have been already built.
|
||||
// If yes, shrink aSFS by these subsets.
|
||||
aSSi.Clear();
|
||||
aSSi.Add(aSFS);
|
||||
//
|
||||
aItSS.Initialize(aMSS);
|
||||
for (; aItSS.More(); aItSS.Next()) {
|
||||
const TopoDS_Shape& aSR=aItSS.Key();
|
||||
const GEOMAlgo_ShapeSet& aSSR=aItSS.Value();
|
||||
if (aSSi.Contains(aSSR)) {
|
||||
// the aSR is SD solid for aS
|
||||
aSSi.Subtract(aSSR);
|
||||
// update images
|
||||
if(myImages.HasImage(aS)) {
|
||||
myImages.Add(aS, aSR);
|
||||
}
|
||||
else {
|
||||
myImages.Bind(aS, aSR);
|
||||
}
|
||||
//
|
||||
// update SD Shapes
|
||||
mySameDomainShapes.Add(aSR, aSR);
|
||||
}
|
||||
}
|
||||
const TopTools_ListOfShape& aSFS1=aSSi.GetSet();
|
||||
aNbSFS=aSFS1.Extent();
|
||||
//modified by NIZNHY-PKV Wed Oct 27 09:53:15 2010f
|
||||
if (!aNbSFS) {
|
||||
continue;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Oct 27 09:53:18 2010t
|
||||
//
|
||||
// 1.3 Build new solids
|
||||
aSB.SetContext(aCtx);
|
||||
aSB.SetShapes(aSFS1);
|
||||
aSB.Perform();
|
||||
iErr=aSB.ErrorStatus();
|
||||
if (iErr) {
|
||||
myErrorStatus=30; // SolidBuilder failed
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopTools_ListOfShape& aLSR=aSB.Areas();
|
||||
//
|
||||
// 1.4 Collect resulting solids and theirs set of faces
|
||||
aIt.Initialize(aLSR);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSR=aIt.Value();
|
||||
//
|
||||
aSSi.Clear();
|
||||
aExp.Init(aSR, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aF=aExp.Current();
|
||||
aSSi.Add(aF);
|
||||
}
|
||||
aMSS.Bind(aSR, aSSi);
|
||||
}
|
||||
//
|
||||
// Update images
|
||||
if (myImages.HasImage(aS)) {
|
||||
myImages.Add(aS, aLSR);
|
||||
}
|
||||
else {
|
||||
myImages.Bind(aS, aLSR);
|
||||
}
|
||||
} // for (i=1; i<=aNbS; ++i) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function :FillInternalShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::FillInternalShapes()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx= pPF->Context();
|
||||
//
|
||||
//Standard_Boolean bHasImage;
|
||||
Standard_Integer i, j, jT, aNbS, aNbSI, aNbSx, aNbSd;
|
||||
TopAbs_ShapeEnum aType, aT[]={ TopAbs_VERTEX, TopAbs_EDGE };
|
||||
TopAbs_State aState;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aIt1;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMSx;
|
||||
TopTools_IndexedMapOfShape aMx;
|
||||
TopTools_MapOfShape aMSI, aMFence, aMSOr;
|
||||
TopTools_MapIteratorOfMapOfShape aItM;
|
||||
TopTools_ListOfShape aLSI, aLSd;
|
||||
TopoDS_Iterator aItS;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
// 1. Shapes to process
|
||||
//
|
||||
// 1.1 Shapes from pure arguments aMSI
|
||||
// 1.1.1 vertex, edge
|
||||
for (i=0; i<2; ++i) {
|
||||
jT=(Standard_Integer)aT[i];
|
||||
const TopTools_ListOfShape &aLS=myShapes1[jT];
|
||||
aIt.Initialize(aLS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (aMFence.Add(aS)) {
|
||||
aLSI.Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 1.1.2 wire
|
||||
{
|
||||
jT=(Standard_Integer)TopAbs_WIRE;
|
||||
const TopTools_ListOfShape &aLW=myShapes1[jT];
|
||||
aIt.Initialize(aLW);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aW=aIt.Value();
|
||||
aItS.Initialize(aW);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aE=aItS.Value();
|
||||
if (aMFence.Add(aE)) {
|
||||
aLSI.Append(aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 1.1.3 theirs images/sources
|
||||
aIt1.Initialize(aLSI);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aS=aIt1.Value();
|
||||
if (myImages.HasImage(aS)) {
|
||||
const TopTools_ListOfShape &aLSp=myImages.Image(aS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSI=aIt.Value();
|
||||
aMSI.Add(aSI);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aMSI.Add(aS);
|
||||
}
|
||||
}
|
||||
aLSI.Clear();
|
||||
aNbSI=aMSI.Extent();
|
||||
//
|
||||
// 2. Internal vertices, edges from source solids
|
||||
aMFence.Clear();
|
||||
aLSd.Clear();
|
||||
//
|
||||
aNbS=aDS.NumberOfShapesOfTheObject();
|
||||
for (i=1; i<=aNbS; ++i) {
|
||||
const TopoDS_Shape& aS=aDS.Shape(i);
|
||||
aType=aS.ShapeType();
|
||||
if (aType==TopAbs_SOLID) {
|
||||
//
|
||||
aMx.Clear();
|
||||
OwnInternalShapes(aS, aMx);
|
||||
//
|
||||
aNbSx=aMx.Extent();
|
||||
for (j=1; j<=aNbSx; ++j) {
|
||||
const TopoDS_Shape& aSI=aMx(j);
|
||||
if (myImages.HasImage(aSI)) {
|
||||
const TopTools_ListOfShape &aLSp=myImages.Image(aSI);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
aMSI.Add(aSp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aMSI.Add(aSI);
|
||||
}
|
||||
}
|
||||
//
|
||||
// build aux map from splits of solids
|
||||
if (myImages.HasImage(aS)) {
|
||||
const TopTools_ListOfShape &aLSp=myImages.Image(aS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (aMFence.Add(aSp)) {
|
||||
TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
|
||||
TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_FACE, aMSx);
|
||||
TopExp::MapShapesAndAncestors(aSp, TopAbs_EDGE , TopAbs_FACE, aMSx);
|
||||
aLSd.Append(aSp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aMFence.Add(aS)) {
|
||||
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
|
||||
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aMSx);
|
||||
TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE , TopAbs_FACE, aMSx);
|
||||
aLSd.Append(aS);
|
||||
aMSOr.Add(aS);
|
||||
}
|
||||
}
|
||||
}//if (aType==TopAbs_SOLID)
|
||||
}
|
||||
//
|
||||
aNbSd=aLSd.Extent();
|
||||
//
|
||||
// 3. Some shapes of aMSI can be already tied with faces of
|
||||
// split solids
|
||||
aItM.Initialize(aMSI);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aSI=aItM.Key();
|
||||
if (aMSx.Contains(aSI)) {
|
||||
const TopTools_ListOfShape &aLSx=aMSx.FindFromKey(aSI);
|
||||
aNbSx=aLSx.Extent();
|
||||
if (aNbSx) {
|
||||
aMSI.Remove(aSI);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 4. Just check it
|
||||
aNbSI=aMSI.Extent();
|
||||
if (!aNbSI) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 5 Settle internal vertices and edges into solids
|
||||
aMx.Clear();
|
||||
aIt.Initialize(aLSd);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Solid aSd=TopoDS::Solid(aIt.Value());
|
||||
//
|
||||
aItM.Initialize(aMSI);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
TopoDS_Shape aSI=aItM.Key();
|
||||
aSI.Orientation(TopAbs_INTERNAL);
|
||||
//
|
||||
aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);
|
||||
if (aState==TopAbs_IN) {
|
||||
//
|
||||
if(aMSOr.Contains(aSd)) {
|
||||
//
|
||||
TopoDS_Solid aSdx;
|
||||
//
|
||||
aBB.MakeSolid(aSdx);
|
||||
aItS.Initialize(aSd);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSh=aItS.Value();
|
||||
aBB.Add(aSdx, aSh);
|
||||
}
|
||||
//
|
||||
aBB.Add(aSdx, aSI);
|
||||
//
|
||||
myImages.Bind(aSd, aSdx);
|
||||
aMSOr.Remove(aSd);
|
||||
aSd=aSdx;
|
||||
}
|
||||
else {
|
||||
aBB.Add(aSd, aSI);
|
||||
}
|
||||
//
|
||||
aMSI.Remove(aSI);
|
||||
} //if (aState==TopAbs_IN) {
|
||||
}// for (; aItM.More(); aItM.Next()) {
|
||||
}//for (; aIt1.More(); aIt1.Next()) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function : OwnInternalShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void OwnInternalShapes(const TopoDS_Shape& theS,
|
||||
TopTools_IndexedMapOfShape& theMx)
|
||||
{
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
aIt.Initialize(theS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
if (aSx.ShapeType()!=TopAbs_SHELL) {
|
||||
theMx.Add(aSx);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// ErrorStatus
|
||||
// 30 - SolidBuilder failed
|
@ -1,316 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_Builder_4.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <NMTDS_ShapesDataStructure.hxx>
|
||||
|
||||
#include <NMTTools_PaveFiller.hxx>
|
||||
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
|
||||
static
|
||||
void MapShapes(const TopoDS_Shape& aS,
|
||||
TopTools_MapOfShape& aM);
|
||||
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_Builder::Generated(const TopoDS_Shape& theS)
|
||||
{
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx=pPF->Context();
|
||||
//
|
||||
Standard_Boolean bHasImage, bToReverse;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myHistShapes.Clear();
|
||||
//
|
||||
if (theS.IsNull()) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
bHasImage=myImages.HasImage(theS);
|
||||
if (!bHasImage) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
aType=theS.ShapeType();
|
||||
//
|
||||
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
const TopTools_ListOfShape& aLSp=myImages.Image(theS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (mySameDomainShapes.Contains(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp);
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSpR.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSpR, theS, aCtx);
|
||||
if (bToReverse) {
|
||||
aSpR.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSpR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
return myHistShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Modified
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_Builder::Modified(const TopoDS_Shape& theS)
|
||||
{
|
||||
NMTTools_PaveFiller* pPF=myPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx=pPF->Context();
|
||||
//
|
||||
Standard_Boolean bHasImage, bToReverse;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myHistShapes.Clear();
|
||||
//
|
||||
if (theS.IsNull()) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
bHasImage=myImages.HasImage(theS);
|
||||
if (!bHasImage) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
aType=theS.ShapeType();
|
||||
//
|
||||
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
const TopTools_ListOfShape& aLSp=myImages.Image(theS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape aSp=aIt.Value();
|
||||
if (!mySameDomainShapes.Contains(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSp.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSp, theS, aCtx);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
return myHistShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsDeleted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Builder::IsDeleted(const TopoDS_Shape& theS)
|
||||
{
|
||||
Standard_Boolean bRet, bHasImage, bContains;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
//
|
||||
if (theS.IsNull()) {
|
||||
return !bRet; //true
|
||||
}
|
||||
//
|
||||
bContains=myMapShape.Contains(theS);
|
||||
if (bContains) {
|
||||
return bRet; //false
|
||||
}
|
||||
//
|
||||
bHasImage=myImages.HasImage(theS);
|
||||
if (!bHasImage) {
|
||||
return !bRet; //true
|
||||
}
|
||||
//
|
||||
aType=theS.ShapeType();
|
||||
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
const TopTools_ListOfShape& aLSp=myImages.Image(theS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape aSp=aIt.Value();
|
||||
//
|
||||
if (!mySameDomainShapes.Contains(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
return bRet; //false
|
||||
}
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp);
|
||||
if (myMapShape.Contains(aSpR)) {
|
||||
return bRet; //false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return !bRet; // true
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PrepareHistory
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Builder::PrepareHistory()
|
||||
{
|
||||
if(myShape.IsNull()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasImage, bContainsSD;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopTools_MapOfShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
TopTools_MapIteratorOfMapOfShape aItM;
|
||||
//
|
||||
// 1. Clearing
|
||||
GEOMAlgo_BuilderShape::PrepareHistory();
|
||||
//
|
||||
// 2. myMapShape - all shapes of result with theirs sub-shapes
|
||||
MapShapes(myShape, myMapShape);
|
||||
//
|
||||
// 3. MS - all argument shapes with theirs sub-shapes
|
||||
aIt.Initialize(myShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
MapShapes(aSx, aMS);
|
||||
}
|
||||
//
|
||||
// 4. Treatment
|
||||
aItM.Initialize(aMS);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aSx=aItM.Key();
|
||||
aType=aSx.ShapeType();
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:34:05 2006f
|
||||
//
|
||||
// 4.1 .myImagesResult
|
||||
TopTools_ListOfShape aLSx;
|
||||
//
|
||||
bHasImage=myImages.HasImage(aSx);
|
||||
if (!bHasImage) {
|
||||
if (myMapShape.Contains(aSx)) {
|
||||
aLSx.Append(aSx);
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const TopTools_ListOfShape& aLSp=myImages.Image(aSx);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
aLSx.Append(aSp);
|
||||
}
|
||||
}
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:34:10 2006t
|
||||
//
|
||||
// 4.2 As it was
|
||||
if (!myHasDeleted) {
|
||||
myHasDeleted=IsDeleted(aSx);//xx
|
||||
}
|
||||
//
|
||||
if (!myHasGenerated || !myHasModified) {
|
||||
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:53:01 2006f
|
||||
//bHasImage=myImages.HasImage(aSx);
|
||||
//modified by NIZNHY-PKV Thu Dec 7 11:53:04 2006t
|
||||
if (bHasImage) {
|
||||
const TopTools_ListOfShape& aLSp=myImages.Image(aSx);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
//
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
bContainsSD=mySameDomainShapes.Contains(aSp);
|
||||
//
|
||||
if (!myHasGenerated) {
|
||||
if (bContainsSD) {
|
||||
myHasGenerated=Standard_True;
|
||||
}
|
||||
}
|
||||
if (!myHasModified) {
|
||||
if (!bContainsSD) {
|
||||
myHasModified=Standard_True;
|
||||
}
|
||||
}
|
||||
} // if (myMapShape.Contains(aSp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MapShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void MapShapes(const TopoDS_Shape& theS,
|
||||
TopTools_MapOfShape& theM)
|
||||
{
|
||||
theM.Add(theS);
|
||||
TopoDS_Iterator anIt;
|
||||
anIt.Initialize(theS);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
const TopoDS_Shape& aSx=anIt.Value();
|
||||
MapShapes(aSx, theM);
|
||||
}
|
||||
}
|
@ -1,72 +1,97 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_PassKeyBoolean.cxx
|
||||
// Created: Mon May 15 14:31:05 2006
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#include <NMTDS_PassKeyBoolean.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_PassKeyBoolean::NMTDS_PassKeyBoolean()
|
||||
:
|
||||
myFlag(Standard_False),
|
||||
NMTDS_PassKey()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_PassKeyBoolean::~NMTDS_PassKeyBoolean()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function :operator =
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
NMTDS_PassKeyBoolean& NMTDS_PassKeyBoolean::operator =(const NMTDS_PassKeyBoolean& anOther)
|
||||
{
|
||||
myFlag=anOther.myFlag;
|
||||
NMTDS_PassKey::operator =(anOther);
|
||||
return *this;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :SetFlag
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void NMTDS_PassKeyBoolean::SetFlag(const Standard_Boolean aFlag)
|
||||
{
|
||||
myFlag=aFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :Flag
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean NMTDS_PassKeyBoolean::Flag()const
|
||||
{
|
||||
return myFlag;
|
||||
}
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_CheckerSI.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_CheckerSI.hxx>
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <GEOMAlgo_IteratorCheckerSI.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_CheckerSI::GEOMAlgo_CheckerSI()
|
||||
:
|
||||
BOPAlgo_PaveFiller()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_CheckerSI::GEOMAlgo_CheckerSI(const BOPCol_BaseAllocator& theAllocator)
|
||||
:
|
||||
BOPAlgo_PaveFiller(theAllocator)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_CheckerSI::~GEOMAlgo_CheckerSI()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_CheckerSI::Init()
|
||||
{
|
||||
Standard_Integer aNb;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
aNb=myArguments.Extent();
|
||||
if (!aNb) {
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
if (aNb>1) {
|
||||
myErrorStatus=11;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 0 Clear
|
||||
Clear();
|
||||
//
|
||||
// 1.myDS
|
||||
myDS=new BOPDS_DS(myAllocator);
|
||||
myDS->SetArguments(myArguments);
|
||||
myDS->Init();
|
||||
//
|
||||
// 2.myIterator
|
||||
myIterator=new GEOMAlgo_IteratorCheckerSI(myAllocator);
|
||||
myIterator->SetDS(myDS);
|
||||
myIterator->Prepare();
|
||||
//
|
||||
// 3 myContext
|
||||
myContext=new BOPInt_Context;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
}
|
124
src/NMTTools/NMTTools_CoupleOfShape.hxx → src/GEOMAlgo/GEOMAlgo_CheckerSI.hxx
Normal file → Executable file
124
src/NMTTools/NMTTools_CoupleOfShape.hxx → src/GEOMAlgo/GEOMAlgo_CheckerSI.hxx
Normal file → Executable file
@ -1,61 +1,63 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTTools_CoupleOfShape.hxx
|
||||
// Created: Wed Jan 28 15:06:11 2004
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#ifndef _NMTTools_CoupleOfShape_HeaderFile
|
||||
#define _NMTTools_CoupleOfShape_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : NMTTools_CoupleOfShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class NMTTools_CoupleOfShape
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT
|
||||
NMTTools_CoupleOfShape();
|
||||
|
||||
Standard_EXPORT
|
||||
void SetShape1(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT
|
||||
void SetShape2(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT
|
||||
const TopoDS_Shape& Shape1() const;
|
||||
|
||||
Standard_EXPORT
|
||||
const TopoDS_Shape& Shape2() const;
|
||||
|
||||
protected:
|
||||
TopoDS_Shape myShape1;
|
||||
TopoDS_Shape myShape2;
|
||||
};
|
||||
#endif
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_CheckerSI.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#ifndef _GEOMAlgo_CheckerSI_HeaderFile
|
||||
#define _GEOMAlgo_CheckerSI_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_CheckerSI : public BOPAlgo_PaveFiller {
|
||||
public:
|
||||
|
||||
//! Empty contructor <br>
|
||||
//! <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_CheckerSI();
|
||||
|
||||
//! Contructor <br>
|
||||
//! theAllocator - the allocator to manage the memory <br>
|
||||
//! <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_CheckerSI(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_CheckerSI();
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void Init() ;
|
||||
|
||||
};
|
||||
#endif
|
@ -27,21 +27,25 @@
|
||||
//
|
||||
#include <GEOMAlgo_ClsfBox.hxx>
|
||||
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf)
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
//#include <Handle_GEOMAlgo_ClsfBox.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GEOMAlgo_Clsf.hxx>
|
||||
|
@ -25,8 +25,10 @@
|
||||
#include <GEOMAlgo_ClsfSolid.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
//#include <Handle_GEOMAlgo_ClsfSolid.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <GEOMAlgo_Clsf.hxx>
|
||||
|
@ -26,10 +26,12 @@
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#include <GEOMAlgo_ClsfSurf.hxx>
|
||||
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf);
|
||||
IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf);
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
//#include <Handle_GEOMAlgo_ClsfSurf.hxx>
|
||||
#include <Handle_Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GEOMAlgo_Clsf.hxx>
|
||||
|
@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx
|
||||
// Created: Wed Feb 22 11:05:01 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfOrientedShapeShape_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfOrientedShapeShape.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx
|
||||
// Created: Wed Feb 22 11:01:34 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfPassKeyShapeShape.hxx>
|
||||
#endif
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx
|
||||
// Created: Wed Feb 22 10:53:47 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfRealListOfShape_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfRealListOfShape.hxx>
|
||||
#endif
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx
|
||||
// Created: Wed Feb 22 11:08:26 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfShapeMapOfShape_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfShapeMapOfShape.hxx>
|
||||
#endif
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx
|
||||
// Created: Wed Feb 22 11:11:09 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfShapePnt_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfShapePnt.hxx>
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx
|
||||
// Created: Wed Feb 22 10:49:11 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfShapeReal_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfShapeReal.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx
|
||||
// Created: Wed Feb 22 08:39:02 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile
|
||||
#define GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile
|
||||
#include <GEOMAlgo_DataMapOfShapeShapeSet.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapOfOrientedShapeShape.hxx
|
||||
// Created: Wed Feb 22 11:03:36 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfOrientedShapeShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapOfOrientedShapeShape_HeaderFile
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_OrientedShapeMapHasher.hxx>
|
||||
|
||||
#define _NCollection_MapHasher
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_OrientedShapeMapHasher> GEOMAlgo_DataMapOfOrientedShapeShape;
|
||||
typedef GEOMAlgo_DataMapOfOrientedShapeShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape;
|
||||
|
||||
#undef _NCollection_MapHasher
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapOfPassKeyShapeShape.hxx
|
||||
// Created: Wed Feb 22 11:00:16 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile
|
||||
|
||||
#include <GEOMAlgo_PassKey.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GEOMAlgo_PassKeyMapHasher.hxx>
|
||||
|
||||
#define _NCollection_MapHasher
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
|
||||
typedef NCollection_DataMap<GEOMAlgo_PassKey, TopoDS_Shape, GEOMAlgo_PassKeyMapHasher> GEOMAlgo_DataMapOfPassKeyShapeShape;
|
||||
typedef GEOMAlgo_DataMapOfPassKeyShapeShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape;
|
||||
|
||||
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapOfRealListOfShape.hxx
|
||||
// Created: Wed Feb 22 10:51:48 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfRealListOfShape_HeaderFile
|
||||
#define GEOMAlgo_DataMapOfRealListOfShape_HeaderFile
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TColStd_MapRealHasher.hxx>
|
||||
|
||||
|
||||
#define _NCollection_MapHasher
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<Standard_Real, TopTools_ListOfShape, TColStd_MapRealHasher> GEOMAlgo_DataMapOfRealListOfShape;
|
||||
typedef GEOMAlgo_DataMapOfRealListOfShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape;
|
||||
|
||||
#undef _NCollection_MapHasher
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,41 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapOfShapeReal.hxx
|
||||
// Created: Wed Feb 22 10:47:23 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfShapeReal_HeaderFile
|
||||
#define GEOMAlgo_DataMapOfShapeReal_HeaderFile
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
#define _NCollection_MapHasher
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> GEOMAlgo_DataMapOfShapeReal;
|
||||
typedef GEOMAlgo_DataMapOfShapeReal::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal;
|
||||
|
||||
#undef _NCollection_MapHasher
|
||||
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_DataMapOfShapeShapeSet.hxx
|
||||
// Created: Wed Feb 22 08:36:15 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile
|
||||
#define GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GEOMAlgo_ShapeSet.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
#define _NCollection_MapHasher
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, GEOMAlgo_ShapeSet, TopTools_ShapeMapHasher> GEOMAlgo_DataMapOfShapeShapeSet;
|
||||
typedef GEOMAlgo_DataMapOfShapeShapeSet::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet;
|
||||
|
||||
#undef _NCollection_MapHasher
|
||||
|
||||
|
||||
#endif
|
@ -64,7 +64,7 @@
|
||||
#include <BRepLib_MakeFace.hxx>
|
||||
#include <BRepLib_FaceError.hxx>
|
||||
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
//#include <BOPTools_DSFiller.hxx>
|
||||
|
||||
#include <GEOMAlgo_WireSolid.hxx>
|
||||
#include <GEOMAlgo_ShellSolid.hxx>
|
||||
@ -72,7 +72,10 @@
|
||||
#include <GEOMAlgo_ShapeSolid.hxx>
|
||||
#include <GEOMAlgo_SolidSolid.hxx>
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_FinderShapeOn
|
||||
@ -267,7 +270,7 @@ void GEOMAlgo_FinderShapeOn::Find()
|
||||
return;
|
||||
}
|
||||
//
|
||||
bICS=GEOMAlgo_Tools::IsCompositeShape(myArg2);
|
||||
bICS=GEOMAlgo_AlgoTools::IsCompositeShape(myArg2);
|
||||
if (!bICS || myIsAnalytic) {
|
||||
TopoDS_Compound aCmp;
|
||||
BRep_Builder aBB;
|
||||
@ -303,19 +306,18 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
|
||||
Standard_Integer i, iErr;
|
||||
TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
BOPTools_DSFiller aDF;
|
||||
BOPCol_ListOfShape aLS;
|
||||
BOPAlgo_PaveFiller aPF;
|
||||
//
|
||||
// 1. Prepare DSFiller
|
||||
aDF.SetShapes (myArg1, aS);
|
||||
bIsDone=aDF.IsDone();
|
||||
if (!bIsDone) {
|
||||
myErrorStatus=30; // wrong args are used for DSFiller
|
||||
return;
|
||||
}
|
||||
aDF.Perform();
|
||||
bIsDone=aDF.IsDone();
|
||||
if (!bIsDone) {
|
||||
myErrorStatus=31; // DSFiller failed
|
||||
aLS.Append(myArg1);
|
||||
aLS.Append(aS);
|
||||
aPF.SetArguments(aLS);
|
||||
//
|
||||
aPF.Perform();
|
||||
iErr=aPF.ErrorStatus();
|
||||
if (iErr) {
|
||||
myErrorStatus=31; // PaveFiller is failed
|
||||
return;
|
||||
}
|
||||
//
|
||||
@ -347,7 +349,7 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
|
||||
return;
|
||||
}
|
||||
//
|
||||
pSS->SetFiller(aDF);
|
||||
pSS->SetFiller(aPF);
|
||||
pSS->Perform();
|
||||
iErr=pSS->ErrorStatus();
|
||||
if (iErr) {
|
||||
@ -396,6 +398,7 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1()
|
||||
#else
|
||||
aMF.Init(mySurface, Standard_True);
|
||||
#endif
|
||||
|
||||
aFErr=aMF.Error();
|
||||
if (aFErr!=BRepLib_FaceDone) {
|
||||
myErrorStatus=20; // can not build the face
|
||||
@ -409,6 +412,7 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1()
|
||||
aM.Add(aF);
|
||||
TopExp::MapShapes(aF, TopAbs_VERTEX, aM);
|
||||
TopExp::MapShapes(aF, TopAbs_EDGE, aM);
|
||||
|
||||
aNb=aM.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
const TopoDS_Shape& aS=aM(i);
|
||||
|
@ -30,17 +30,22 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
#include <Handle_Geom_Surface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <GEOMAlgo_State.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
|
||||
#include <GEOMAlgo_State.hxx>
|
||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_FinderShapeOn
|
||||
|
@ -69,15 +69,14 @@
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
|
||||
#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
|
||||
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
#include <GEOMAlgo_StateCollector.hxx>
|
||||
#include <GEOMAlgo_FinderShapeOn.hxx>
|
||||
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
#include <GEOMAlgo_PassKey.hxx>
|
||||
#include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
|
||||
#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_FinderShapeOn1
|
||||
//purpose :
|
||||
@ -548,7 +547,7 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
|
||||
//
|
||||
aTRF=BRep_Tool::Triangulation(aF, aLoc);
|
||||
if (aTRF.IsNull()) {
|
||||
if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aF)) {
|
||||
if (!GEOMAlgo_AlgoTools::BuildTriangulation(aF)) {
|
||||
myWarningStatus=20; // no triangulation found
|
||||
return;
|
||||
}
|
||||
@ -793,63 +792,3 @@ TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP)
|
||||
// 20- no triangulation found
|
||||
// 30- can not obtain the line from the link
|
||||
|
||||
//modified by NIZNHY-PKV Thu Jan 26 10:01:14 2012f
|
||||
/*
|
||||
//=======================================================================
|
||||
//function : InnerPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
|
||||
GEOMAlgo_ListOfPnt& aLP)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Integer j, aNbNodes, aIndex, aNb;
|
||||
Handle(Poly_PolygonOnTriangulation) aPTE;
|
||||
Handle(Poly_Triangulation) aTRE;
|
||||
TopLoc_Location aLoc;
|
||||
gp_Pnt aP;
|
||||
//
|
||||
aLP.Clear();
|
||||
BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc);
|
||||
if (aTRE.IsNull() || aPTE.IsNull()) {
|
||||
Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc);
|
||||
if (aPE.IsNull()) {
|
||||
if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aE)) {
|
||||
myErrorStatus=20; // no triangulation found
|
||||
return;
|
||||
}
|
||||
aPE = BRep_Tool::Polygon3D(aE, aLoc);
|
||||
}
|
||||
const gp_Trsf& aTrsf=aLoc.Transformation();
|
||||
const TColgp_Array1OfPnt& aNodes=aPE->Nodes();
|
||||
//
|
||||
aNbNodes=aPE->NbNodes();
|
||||
Standard_Integer low = aNodes.Lower(), up = aNodes.Upper();
|
||||
for (j=low+1; j<up; ++j) {
|
||||
aP=aNodes(j).Transformed(aTrsf);
|
||||
aLP.Append(aP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const gp_Trsf& aTrsf=aLoc.Transformation();
|
||||
const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
|
||||
//
|
||||
aNbNodes=aPTE->NbNodes();
|
||||
const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
|
||||
for (j=2; j<aNbNodes; ++j) {
|
||||
aIndex=aInds(j);
|
||||
aP=aNodes(aIndex).Transformed(aTrsf);
|
||||
aLP.Append(aP);
|
||||
}
|
||||
}
|
||||
//
|
||||
aNb=aLP.Extent();
|
||||
if (!aNb && myNbPntsMin) {
|
||||
// try to fill it yourself
|
||||
InnerPoints(aE, myNbPntsMin, aLP);
|
||||
aNb=aLP.Extent();
|
||||
}
|
||||
}
|
||||
*/
|
||||
//modified by NIZNHY-PKV Thu Jan 26 10:01:17 2012t
|
||||
|
@ -70,7 +70,6 @@
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
|
||||
#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
|
||||
|
||||
#include <GEOMAlgo_SurfaceTools.hxx>
|
||||
#include <GEOMAlgo_StateCollector.hxx>
|
||||
#include <GEOMAlgo_FinderShapeOn.hxx>
|
||||
@ -80,7 +79,7 @@
|
||||
#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_FinderShapeOn1
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_FinderShapeOn2::GEOMAlgo_FinderShapeOn2()
|
||||
|
@ -29,18 +29,21 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <GEOMAlgo_State.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
//#include <Handle_GEOMAlgo_Clsf.hxx>
|
||||
#include <GEOMAlgo_Clsf.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
|
||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||
#include <GEOMAlgo_Clsf.hxx>
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
|
||||
#include <GEOMAlgo_State.hxx>
|
||||
#include <GEOMAlgo_ListOfPnt.hxx>
|
||||
#include <GEOMAlgo_Clsf.hxx>
|
||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_FinderShapeOn2
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <GEOMAlgo_GetInPlace.hxx>
|
||||
|
||||
#include <NMTDS_BoxBndTree.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
@ -58,9 +58,8 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
|
||||
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
#include <GEOMAlgo_BoxBndTree.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
|
||||
|
||||
static
|
||||
@ -301,10 +300,10 @@ void GEOMAlgo_GetInPlace::Intersect()
|
||||
TopTools_DataMapOfShapeListOfShape aDMSLS;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||
TopTools_ListIteratorOfListOfShape aItLS;
|
||||
NMTTools_CoupleOfShape aCS;
|
||||
GEOMAlgo_CoupleOfShapes aCS;
|
||||
//
|
||||
NMTDS_BoxBndTreeSelector aSelector;
|
||||
NMTDS_BoxBndTree aBBTree;
|
||||
GEOMAlgo_BoxBndTreeSelector aSelector;
|
||||
GEOMAlgo_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
myErrorStatus=0;
|
||||
@ -391,7 +390,7 @@ void GEOMAlgo_GetInPlace::PerformVV()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aV1=aCS.Shape1();
|
||||
const TopoDS_Shape& aV2=aCS.Shape2();
|
||||
//
|
||||
@ -446,7 +445,7 @@ void GEOMAlgo_GetInPlace::PerformVE()
|
||||
// 2. Fill Shapes In
|
||||
myIterator.Initialize(TopAbs_EDGE, TopAbs_VERTEX);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aE1=aCS.Shape1();
|
||||
const TopoDS_Shape& aV2=aCS.Shape2();
|
||||
//
|
||||
@ -481,7 +480,7 @@ void GEOMAlgo_GetInPlace::PerformEE()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_EDGE, TopAbs_EDGE);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aE1=aCS.Shape1();
|
||||
const TopoDS_Shape& aE2=aCS.Shape2();
|
||||
//
|
||||
@ -528,7 +527,7 @@ void GEOMAlgo_GetInPlace::PerformVF()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_FACE, TopAbs_VERTEX);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aF1=aCS.Shape1();
|
||||
const TopoDS_Shape& aV2=aCS.Shape2();
|
||||
//
|
||||
@ -626,7 +625,7 @@ void GEOMAlgo_GetInPlace::PerformEF()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_FACE, TopAbs_EDGE);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aF1=aCS.Shape1();
|
||||
const TopoDS_Shape& aE2=aCS.Shape2();
|
||||
//
|
||||
@ -679,7 +678,7 @@ void GEOMAlgo_GetInPlace::PerformFF()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_FACE, TopAbs_FACE);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aF1=aCS.Shape1();
|
||||
const TopoDS_Shape& aF2=aCS.Shape2();
|
||||
//
|
||||
@ -773,7 +772,7 @@ void GEOMAlgo_GetInPlace::PerformZF()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_SOLID, TopAbs_FACE);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aSo1=aCS.Shape1();
|
||||
const TopoDS_Shape& aF2=aCS.Shape2();
|
||||
//
|
||||
@ -809,7 +808,7 @@ void GEOMAlgo_GetInPlace::PerformZZ()
|
||||
//
|
||||
myIterator.Initialize(TopAbs_SOLID, TopAbs_SOLID);
|
||||
for (; myIterator.More(); myIterator.Next()) {
|
||||
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
|
||||
const TopoDS_Shape& aSo1=aCS.Shape1();
|
||||
const TopoDS_Shape& aSo2=aCS.Shape2();
|
||||
//
|
||||
|
@ -35,9 +35,9 @@
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
|
||||
|
||||
#include <GEOMAlgo_DataMapOfShapeMapOfShape.hxx>
|
||||
#include <GEOMAlgo_GluerAlgo.hxx>
|
||||
@ -81,7 +81,7 @@ class GEOMAlgo_GetInPlaceIterator {
|
||||
* The pair of intersected shapes.
|
||||
*/
|
||||
//Standard_EXPORT
|
||||
void AppendPair(const NMTTools_CoupleOfShape& theCS) ;
|
||||
void AppendPair(const GEOMAlgo_CoupleOfShapes& theCS) ;
|
||||
|
||||
/**
|
||||
* Initialize the iterator.
|
||||
@ -113,13 +113,13 @@ class GEOMAlgo_GetInPlaceIterator {
|
||||
* The pair of intersected shapes.
|
||||
*/
|
||||
//Standard_EXPORT
|
||||
const NMTTools_CoupleOfShape& Value() const;
|
||||
const GEOMAlgo_CoupleOfShapes& Value() const;
|
||||
|
||||
protected:
|
||||
Standard_Integer myDim;
|
||||
NMTTools_ListOfCoupleOfShape myLists[10];
|
||||
NMTTools_ListOfCoupleOfShape myEmptyList;
|
||||
NMTTools_ListIteratorOfListOfCoupleOfShape myIterator;
|
||||
GEOMAlgo_ListOfCoupleOfShapes myLists[10];
|
||||
GEOMAlgo_ListOfCoupleOfShapes myEmptyList;
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes myIterator;
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -59,8 +59,7 @@
|
||||
|
||||
#include <IntTools_Tools.hxx>
|
||||
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
|
||||
|
||||
@ -259,7 +258,7 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
|
||||
}
|
||||
//
|
||||
aP2Dx.Coord(aUx, aVx);
|
||||
BOPTools_Tools2D::FaceNormal(aF, aUx, aVx, aDNx);
|
||||
GEOMAlgo_AlgoTools::FaceNormal(aF, aUx, aVx, aDNx);
|
||||
aDNx.Reverse();
|
||||
//
|
||||
aP.SetXYZ(aPx.XYZ()+aCoef*aTol*aDNx.XYZ());
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <GEOMAlgo_GetInPlace.hxx>
|
||||
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
|
||||
static
|
||||
Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
|
||||
@ -62,7 +62,7 @@ void GEOMAlgo_GetInPlaceIterator::Clear()
|
||||
//function : AppendPair
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_GetInPlaceIterator::AppendPair(const NMTTools_CoupleOfShape& theCS)
|
||||
void GEOMAlgo_GetInPlaceIterator::AppendPair(const GEOMAlgo_CoupleOfShapes& theCS)
|
||||
{
|
||||
Standard_Integer iX;
|
||||
TopAbs_ShapeEnum aType1, aType2;
|
||||
@ -114,7 +114,7 @@ void GEOMAlgo_GetInPlaceIterator::Next()
|
||||
// function: Value
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const NMTTools_CoupleOfShape& GEOMAlgo_GetInPlaceIterator::Value()const
|
||||
const GEOMAlgo_CoupleOfShapes& GEOMAlgo_GetInPlaceIterator::Value()const
|
||||
{
|
||||
return myIterator.Value();
|
||||
}
|
||||
|
@ -26,11 +26,20 @@
|
||||
|
||||
#include <GEOMAlgo_GlueAnalyser.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_HArray1OfBox.hxx>
|
||||
#include <Bnd_BoundSortBox.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
@ -41,24 +50,16 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
|
||||
#include <GEOMAlgo_Gluer.hxx>
|
||||
#include <Bnd_HArray1OfBox.hxx>
|
||||
#include <Bnd_BoundSortBox.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_Gluer.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@ -302,7 +303,7 @@
|
||||
}
|
||||
// check geometric coincidence
|
||||
if (myCheckGeometry) {
|
||||
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
|
||||
iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
|
||||
if (iErr) {
|
||||
myErrorStatus=200;
|
||||
return;
|
||||
|
@ -52,21 +52,21 @@
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
#include <NMTDS_BndSphereTree.hxx>
|
||||
#include <NMTDS_BndSphere.hxx>
|
||||
#include <NMTDS_IndexedDataMapOfShapeBndSphere.hxx>
|
||||
|
||||
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
//
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
//modified by NIZNHY-PKV Tue Mar 13 10:25:47 2012f
|
||||
#include <GEOMAlgo_BndSphereTree.hxx>
|
||||
#include <GEOMAlgo_BndSphere.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx>
|
||||
|
||||
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
//
|
||||
static
|
||||
Standard_Integer CheckAncesstors
|
||||
(const TopoDS_Shape& aVSD,
|
||||
@ -74,7 +74,6 @@ static
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ);
|
||||
//modified by NIZNHY-PKV Tue Mar 13 10:25:50 2012t
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@ -159,10 +158,10 @@ void GEOMAlgo_GlueDetector::DetectVertices()
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
|
||||
TopTools_DataMapOfShapeListOfShape aMVV;
|
||||
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
|
||||
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
|
||||
NMTDS_BndSphereTreeSelector aSelector;
|
||||
NMTDS_BndSphereTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
|
||||
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
|
||||
GEOMAlgo_BndSphereTreeSelector aSelector;
|
||||
GEOMAlgo_BndSphereTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, GEOMAlgo_BndSphere> aTreeFiller(aBBTree);
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@ -174,7 +173,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
|
||||
}
|
||||
//
|
||||
for (i=1; i<=aNbV; ++i) {
|
||||
NMTDS_BndSphere aBox;
|
||||
GEOMAlgo_BndSphere aBox;
|
||||
//
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
|
||||
aPV=BRep_Tool::Pnt(aV);
|
||||
@ -217,7 +216,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
|
||||
const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
|
||||
const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
|
||||
//
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBoxVP);
|
||||
@ -357,7 +356,7 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
|
||||
}
|
||||
// check geometric coincidence
|
||||
if (myCheckGeometry) {
|
||||
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTolerance, myContext);
|
||||
iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTolerance, myContext);
|
||||
if (iErr) {
|
||||
myErrorStatus=200;
|
||||
return;
|
||||
|
@ -55,11 +55,9 @@ public:
|
||||
Standard_EXPORT virtual
|
||||
void Perform() ;
|
||||
|
||||
//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f
|
||||
Standard_EXPORT
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes();
|
||||
//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t
|
||||
//------------------------------------------------
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
void DetectVertices() ;
|
||||
@ -81,7 +79,6 @@ protected:
|
||||
void FacePassKey(const TopoDS_Face& aF,
|
||||
GEOMAlgo_PassKeyShape& aPK) ;
|
||||
|
||||
//modified by NIZNHY-PKV Tue Mar 13 09:53:03 2012f
|
||||
Standard_EXPORT
|
||||
void CheckDetected();
|
||||
//
|
||||
@ -94,7 +91,6 @@ protected:
|
||||
|
||||
protected:
|
||||
TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes;
|
||||
//modified by NIZNHY-PKV Tue Mar 13 09:53:08 2012t
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
#include <GEOMAlgo_Gluer.hxx>
|
||||
|
||||
#include <NMTDS_BoxBndTree.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
|
||||
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
|
||||
@ -75,23 +75,22 @@
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
//
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <BOPTools_Tools.hxx>
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <BOP_CorrectTolerances.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
|
||||
#include <GEOMAlgo_BoxBndTree.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
//
|
||||
|
||||
#include <NMTDS_BndSphereTree.hxx>
|
||||
#include <NMTDS_BndSphere.hxx>
|
||||
#include <NMTDS_IndexedDataMapOfShapeBndSphere.hxx>
|
||||
#include <GEOMAlgo_BndSphereTree.hxx>
|
||||
#include <GEOMAlgo_BndSphere.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx>
|
||||
|
||||
//
|
||||
static
|
||||
@ -226,12 +225,12 @@ void GEOMAlgo_Gluer::MakeVertices()
|
||||
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
|
||||
//modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f
|
||||
//GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
|
||||
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
|
||||
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
|
||||
//modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t
|
||||
//
|
||||
NMTDS_BndSphereTreeSelector aSelector;
|
||||
NMTDS_BndSphereTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
|
||||
GEOMAlgo_BndSphereTreeSelector aSelector;
|
||||
GEOMAlgo_BndSphereTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, GEOMAlgo_BndSphere> aTreeFiller(aBBTree);
|
||||
//
|
||||
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
|
||||
aNbV=aMV.Extent();
|
||||
@ -241,7 +240,7 @@ void GEOMAlgo_Gluer::MakeVertices()
|
||||
}
|
||||
//
|
||||
for (i=1; i<=aNbV; ++i) {
|
||||
NMTDS_BndSphere aBox;
|
||||
GEOMAlgo_BndSphere aBox;
|
||||
//
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
|
||||
aPV=BRep_Tool::Pnt(aV);
|
||||
@ -285,7 +284,7 @@ void GEOMAlgo_Gluer::MakeVertices()
|
||||
//
|
||||
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
|
||||
//modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
|
||||
const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
|
||||
const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
|
||||
//const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
|
||||
//modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
|
||||
//
|
||||
@ -463,14 +462,8 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
|
||||
//
|
||||
aER.Orientation(TopAbs_FORWARD);
|
||||
if (!BRep_Tool::Degenerated(aER)) {
|
||||
// build p-curve
|
||||
//if (bIsUPeriodic) {
|
||||
// GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
|
||||
//}
|
||||
//BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
|
||||
//
|
||||
// orient image
|
||||
Standard_Boolean bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
|
||||
Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse1(aER, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aER.Reverse();
|
||||
}
|
||||
@ -522,7 +515,7 @@ void GEOMAlgo_Gluer::MakeSolids()
|
||||
myResult=aCmp;
|
||||
//
|
||||
if (aMS.Extent()) {
|
||||
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
|
||||
GEOMAlgo_AlgoTools::CorrectCurveOnSurface(myResult);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@ -637,7 +630,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
|
||||
}
|
||||
// check geometric coincidence
|
||||
if (myCheckGeometry) {
|
||||
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext);
|
||||
iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTol, myContext);
|
||||
if (iErr) {
|
||||
myErrorStatus=200;
|
||||
return;
|
||||
@ -933,7 +926,7 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
|
||||
}
|
||||
//
|
||||
else {
|
||||
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||
BOPTools_AlgoTools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@ -960,7 +953,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
|
||||
aFFWD.Orientation(TopAbs_FORWARD);
|
||||
//
|
||||
aS=BRep_Tool::Surface(aFFWD, aLoc);
|
||||
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
|
||||
bIsUPeriodic=GEOMAlgo_AlgoTools::IsUPeriodic(aS);
|
||||
aTol=BRep_Tool::Tolerance(aFFWD);
|
||||
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
@ -979,12 +972,12 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
|
||||
if (!BRep_Tool::Degenerated(aER)) {
|
||||
// build p-curve
|
||||
if (bIsUPeriodic) {
|
||||
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
|
||||
GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
|
||||
}
|
||||
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
|
||||
|
||||
// orient image
|
||||
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
|
||||
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse1(aER, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aER.Reverse();
|
||||
}
|
||||
@ -1033,16 +1026,16 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
|
||||
const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
|
||||
//
|
||||
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
||||
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
|
||||
aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
|
||||
aC3D->D0(aT, aP);
|
||||
myContext->ProjectPointOnEdge(aP, aER, aTR);
|
||||
//
|
||||
BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
|
||||
if (aF.Orientation()==TopAbs_REVERSED) {
|
||||
aDNF.Reverse();
|
||||
}
|
||||
//
|
||||
BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
|
||||
if (aFR.Orientation()==TopAbs_REVERSED) {
|
||||
aDNFR.Reverse();
|
||||
}
|
||||
|
@ -31,22 +31,27 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_Gluer
|
||||
//purpose :
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_GlueDetector.hxx>
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_Gluer2
|
||||
@ -441,7 +441,7 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
|
||||
continue;
|
||||
}
|
||||
//
|
||||
GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
|
||||
GEOMAlgo_AlgoTools::MakeContainer(aType, aWnew);
|
||||
aWnew.Orientation(aW.Orientation());
|
||||
//
|
||||
aItS.Initialize(aW);
|
||||
@ -450,7 +450,7 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
|
||||
if (myOrigins.IsBound(aE)) {
|
||||
aEnew=myOrigins.Find(aE);
|
||||
//
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aEnew, aE, myContext);
|
||||
bToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aEnew, aE, myContext);
|
||||
if (bToReverse) {
|
||||
aEnew.Reverse();
|
||||
}
|
||||
@ -509,7 +509,7 @@ void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC)
|
||||
return;
|
||||
}
|
||||
//
|
||||
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
|
||||
GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew);
|
||||
//
|
||||
aItC.Initialize(aC);
|
||||
for (; aItC.More(); aItC.Next()) {
|
||||
@ -599,7 +599,7 @@ void GEOMAlgo_Gluer2::BuildResult()
|
||||
return;
|
||||
}
|
||||
//
|
||||
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
|
||||
GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew);
|
||||
//
|
||||
aItC.Initialize(myArgument);
|
||||
for (; aItC.More(); aItC.Next()) {
|
||||
@ -619,7 +619,7 @@ void GEOMAlgo_Gluer2::BuildResult()
|
||||
TopoDS_Shape aCnew1;
|
||||
TopTools_IndexedMapOfShape aM;
|
||||
//
|
||||
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew1);
|
||||
GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew1);
|
||||
//
|
||||
TopExp::MapShapes(aCnew, TopAbs_SOLID, aM);
|
||||
|
||||
|
@ -35,12 +35,11 @@
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
|
||||
#include <GEOMAlgo_GluerAlgo.hxx>
|
||||
#include <GEOMAlgo_BuilderShape.hxx>
|
||||
#include <GEOMAlgo_GlueDetector.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_Gluer2
|
||||
@ -170,8 +169,8 @@ protected:
|
||||
TopoDS_Face& theFnew) ;
|
||||
|
||||
Standard_EXPORT
|
||||
void TreatPair(const NMTTools_CoupleOfShape& theCS,
|
||||
NMTTools_ListOfCoupleOfShape& theLCS) ;
|
||||
void TreatPair(const GEOMAlgo_CoupleOfShapes& theCS,
|
||||
GEOMAlgo_ListOfCoupleOfShapes& theLCS) ;
|
||||
|
||||
protected:
|
||||
TopTools_DataMapOfShapeListOfShape myShapesToGlue;
|
||||
@ -180,9 +179,8 @@ protected:
|
||||
TopTools_DataMapOfShapeListOfShape myImagesToWork;
|
||||
TopTools_DataMapOfShapeShape myOriginsToWork;
|
||||
Standard_Boolean myKeepNonSolids;
|
||||
//modified by NIZNHY-PKV Tue Mar 13 13:30:40 2012f
|
||||
GEOMAlgo_GlueDetector myDetector;
|
||||
//modified by NIZNHY-PKV Tue Mar 13 13:30:43 2012t
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
|
@ -51,11 +51,9 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <BOPTools_Tools.hxx>
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeBRepShapes
|
||||
@ -118,7 +116,7 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
//
|
||||
aTol=BRep_Tool::Tolerance(aFF);
|
||||
aS=BRep_Tool::Surface(aFF, aLoc);
|
||||
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
|
||||
bIsUPeriodic=GEOMAlgo_AlgoTools::IsUPeriodic(aS);
|
||||
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
aBB.MakeFace (aFnew, aS, aLoc, aTol);
|
||||
@ -161,18 +159,17 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
if (!BRep_Tool::Degenerated(aEx)) {
|
||||
aEx.Orientation(TopAbs_FORWARD);
|
||||
if (bIsUPeriodic) {
|
||||
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
|
||||
GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:18:17 2012f
|
||||
iRet=GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(aE, aEx, aFF, myContext);
|
||||
iRet=GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace(aE, aEx, aFF, myContext);
|
||||
if (iRet) {
|
||||
continue;
|
||||
}
|
||||
//BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF);
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t
|
||||
//
|
||||
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext);
|
||||
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse1(aEx, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aEx.Reverse();
|
||||
}
|
||||
@ -224,7 +221,7 @@ void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
|
||||
aVR2.Orientation(TopAbs_REVERSED);
|
||||
//
|
||||
if (!bIsDE) {
|
||||
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||
BOPTools_AlgoTools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||
}
|
||||
else {
|
||||
Standard_Real aTol;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <GEOMAlgo_BuilderShape.hxx>
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : PrepareHistory
|
||||
@ -98,7 +98,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
|
||||
aSim.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext);
|
||||
bToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSim.Reverse();
|
||||
}
|
||||
|
@ -44,13 +44,13 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <NMTTools_CoupleOfShape.hxx>
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
|
||||
#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
#include <NMTTools_Tools.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
|
||||
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
#include <GEOMAlgo_GlueDetector.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
|
||||
|
||||
static
|
||||
@ -130,9 +130,9 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
|
||||
Standard_Integer aNbSG, i, j, k, aNbC, aNb, aNbSD;
|
||||
TopTools_ListIteratorOfListOfShape aItLS1, aItLS2;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||
NMTTools_CoupleOfShape aCS;
|
||||
NMTTools_ListOfCoupleOfShape aLCS;
|
||||
NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
|
||||
GEOMAlgo_CoupleOfShapes aCS;
|
||||
GEOMAlgo_ListOfCoupleOfShapes aLCS;
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
myWarningStatus=0;
|
||||
@ -186,9 +186,9 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
|
||||
//
|
||||
// 2. Find Chains
|
||||
TopTools_ListOfShape aLSX;
|
||||
NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC;
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMC;
|
||||
//
|
||||
NMTTools_Tools::FindChains(aLCS, aMC);
|
||||
GEOMAlgo_AlgoTools::FindChains(aLCS, aMC);
|
||||
//
|
||||
// 3. myImagesToWork, myOriginsToWork
|
||||
aNbC=aMC.Extent();
|
||||
@ -209,8 +209,8 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
|
||||
//function : TreatPair
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
|
||||
NMTTools_ListOfCoupleOfShape& aLCS)
|
||||
void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS,
|
||||
GEOMAlgo_ListOfCoupleOfShapes& aLCS)
|
||||
{
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
@ -222,7 +222,7 @@ void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
|
||||
TopTools_IndexedMapOfShape aMS1, aMS2;
|
||||
TopTools_DataMapOfShapeListOfShape aDMSLS;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||
NMTTools_CoupleOfShape aCSS;
|
||||
GEOMAlgo_CoupleOfShapes aCSS;
|
||||
//
|
||||
// 1. Checking the pair on whether it can be glued at all
|
||||
// 1.1
|
||||
|
@ -31,10 +31,10 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <GEOMAlgo_BuilderShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_GluerAlgo
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
//#include <Handle_GEOMAlgo_HAlgo.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
|
||||
|
10
src/NMTDS/NMTDS_IndexedDataMapOfShapeBndSphere.hxx → src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
Normal file → Executable file
10
src/NMTDS/NMTDS_IndexedDataMapOfShapeBndSphere.hxx → src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
Normal file → Executable file
@ -17,25 +17,25 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_IndexedDataMapOfShapeBndSphere.hxx
|
||||
// File: GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
|
||||
// Created: Mon Feb 20 09:17:01 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef NMTDS_IndexedDataMapOfShapeBndSphere_HeaderFile
|
||||
#define NMTDS_IndexedDataMapOfShapeBndSphere_HeaderFile
|
||||
#ifndef GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
|
||||
#define GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#include <NMTDS_BndSphere.hxx>
|
||||
#include <GEOMAlgo_BndSphere.hxx>
|
||||
|
||||
#define _NCollection_MapHasher
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
|
||||
|
||||
|
||||
typedef NCollection_IndexedDataMap<TopoDS_Shape, NMTDS_BndSphere, TopTools_ShapeMapHasher> NMTDS_IndexedDataMapOfShapeBndSphere;
|
||||
typedef NCollection_IndexedDataMap<TopoDS_Shape, GEOMAlgo_BndSphere, TopTools_ShapeMapHasher> GEOMAlgo_IndexedDataMapOfShapeBndSphere;
|
||||
|
||||
#undef _NCollection_MapHasher
|
||||
|
10
src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx → src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
Normal file → Executable file
10
src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx → src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
Normal file → Executable file
@ -16,18 +16,18 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx
|
||||
// File: GEOMAlgo_IndexedDataMapOfIndexedMapOfInteger.hxx
|
||||
// Created: Mon Feb 20 09:20:07 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
// File: NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx
|
||||
// File: GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
|
||||
// Created: Mon Feb 20 11:59:23 2012
|
||||
// Author:
|
||||
// <pkv@BDEURI37616>
|
||||
|
||||
|
||||
#ifndef NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
|
||||
#define NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
|
||||
#ifndef GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
|
||||
#define GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
|
||||
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@ -38,7 +38,7 @@
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
|
||||
|
||||
typedef NCollection_IndexedDataMap <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> NMTTools_IndexedDataMapOfShapeIndexedMapOfShape;
|
||||
typedef NCollection_IndexedDataMap <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape;
|
||||
|
||||
#undef _NCollection_MapHasher
|
||||
|
190
src/GEOMAlgo/GEOMAlgo_IteratorCheckerSI.cxx
Executable file
190
src/GEOMAlgo/GEOMAlgo_IteratorCheckerSI.cxx
Executable file
@ -0,0 +1,190 @@
|
||||
// File: GEOMAlgo_IteratorChecker.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_IteratorCheckerSI.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
//
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <BOPDS_BoxBndTree.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_PassKeyBoolean.hxx>
|
||||
#include <BOPDS_MapOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
|
||||
#include <BOPCol_IndexedMapOfInteger.hxx>
|
||||
#include <BOPDS_ShapeInfo.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPCol_IndexedMapOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_IteratorCheckerSI::GEOMAlgo_IteratorCheckerSI()
|
||||
:
|
||||
BOPDS_Iterator()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_IteratorCheckerSI::GEOMAlgo_IteratorCheckerSI
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
BOPDS_Iterator(theAllocator)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_IteratorCheckerSI::~GEOMAlgo_IteratorCheckerSI()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Intersect
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_IteratorCheckerSI::Intersect()
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer aNbS, i, aNbB;
|
||||
Standard_Integer aNbSD, iX, j, iDS, jB, k;;
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt;
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
|
||||
//
|
||||
//-----------------------------------------------------scope_1 f
|
||||
aAllocator=new NCollection_IncAllocator();
|
||||
//
|
||||
BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPA(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
|
||||
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
|
||||
BOPDS_PassKeyBoolean aPKXB;
|
||||
//
|
||||
BOPDS_BoxBndTreeSelector aSelector;
|
||||
BOPDS_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
// myPairsAvoid, aMSI, aMSB
|
||||
aNbS=myDS->NbSourceShapes();
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
//
|
||||
if (aSI.HasBRep()) {
|
||||
const TopoDS_Shape& aSi=aSI.Shape();
|
||||
aTi=aSI.ShapeType();
|
||||
if (aTi!=TopAbs_VERTEX) {
|
||||
//--
|
||||
const BOPCol_ListOfInteger& aLA=aSI.SubShapes();
|
||||
aIt.Initialize(aLA);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
iX=aIt.Value();
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, iX);
|
||||
aMPA.Add(aPKXB);
|
||||
}
|
||||
//--t
|
||||
}
|
||||
else {
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, i);
|
||||
aMPA.Add(aPKXB);
|
||||
}
|
||||
//
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
//
|
||||
aMSI.Bind(aSi, i);
|
||||
aMSB.Add(aSi, aBoxEx);
|
||||
}
|
||||
} // for (i=0; i<aNbS; ++i) {
|
||||
//
|
||||
// aMII
|
||||
aNbB=aMSB.Extent();
|
||||
for (i=1; i<=aNbB; ++i) {
|
||||
const TopoDS_Shape& aS=aMSB.FindKey(i);
|
||||
const Bnd_Box& aBoxEx=aMSB(i);
|
||||
//
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
//
|
||||
iDS=aMSI.Find(aS);
|
||||
aMII.Bind(i, iDS);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
aTi=aSI.ShapeType();
|
||||
if (!aSI.HasBRep()){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSi=myDS->Shape(i);
|
||||
aTi=aSi.ShapeType();
|
||||
const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBoxEx);
|
||||
//
|
||||
aNbSD=aBBTree.Select(aSelector);
|
||||
if (!aNbSD){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
|
||||
//
|
||||
k=0;
|
||||
//
|
||||
aIt.Initialize(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
jB=aIt.Value(); // box index in MII
|
||||
j=aMII.Find(jB); // DS index
|
||||
//
|
||||
aPKXB.SetIds(i, j);
|
||||
if (aMPA.Contains(aPKXB)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aMPKXB.Add(aPKXB)) {
|
||||
bFlag=Standard_False;// Bounding boxes are intersected
|
||||
const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
|
||||
const Bnd_Box& aBoxj=myDS->ShapeInfo(j).Box();
|
||||
if (aBoxi.IsOut(aBoxj)) {
|
||||
bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
|
||||
}
|
||||
aTj=myDS->ShapeInfo(j).ShapeType();//
|
||||
iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
aPKXB.SetFlag(bFlag);
|
||||
myLists(iX).Append(aPKXB);
|
||||
}// if (aMPKXB.Add(aPKXB)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}//for (i=1; i<=aNbS; ++i) {
|
||||
//
|
||||
aMSI.Clear();
|
||||
aMII.Clear();
|
||||
aMPA.Clear();
|
||||
aMPKXB.Clear();
|
||||
aMSB.Clear();
|
||||
//
|
||||
aAllocator.Nullify();
|
||||
//-----------------------------------------------------scope_1 t
|
||||
}
|
||||
|
117
src/NMTDS/NMTDS_PassKeyBoolean.hxx → src/GEOMAlgo/GEOMAlgo_IteratorCheckerSI.hxx
Normal file → Executable file
117
src/NMTDS/NMTDS_PassKeyBoolean.hxx → src/GEOMAlgo/GEOMAlgo_IteratorCheckerSI.hxx
Normal file → Executable file
@ -1,60 +1,57 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTDS_PassKeyBoolean.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#ifndef _NMTDS_PassKeyBoolean_HeaderFile
|
||||
#define _NMTDS_PassKeyBoolean_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <NMTDS_PassKey.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : NMTDS_PassKeyBoolean
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class NMTDS_PassKeyBoolean : public NMTDS_PassKey {
|
||||
public:
|
||||
Standard_EXPORT
|
||||
NMTDS_PassKeyBoolean();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~NMTDS_PassKeyBoolean();
|
||||
|
||||
Standard_EXPORT
|
||||
void SetFlag(const Standard_Boolean aFlag) ;
|
||||
|
||||
Standard_EXPORT
|
||||
NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other);
|
||||
|
||||
Standard_EXPORT
|
||||
Standard_Boolean Flag() const;
|
||||
|
||||
protected:
|
||||
Standard_Boolean myFlag;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_CheckerSI.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#ifndef GEOMAlgo_IteratorCheckerSI_HeaderFile
|
||||
#define GEOMAlgo_IteratorCheckerSI_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <BOPDS_Iterator.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_IteratorCheckerSI : public BOPDS_Iterator {
|
||||
public:
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_IteratorCheckerSI();
|
||||
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_IteratorCheckerSI(const Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
|
||||
Standard_EXPORT
|
||||
~GEOMAlgo_IteratorCheckerSI();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void Intersect();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,35 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_PWireEdgeSet.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <peter@PREFEX>
|
||||
//
|
||||
#ifndef _GEOMAlgo_PWireEdgeSet_HeaderFile
|
||||
#define _GEOMAlgo_PWireEdgeSet_HeaderFile
|
||||
|
||||
class GEOMAlgo_WireEdgeSet;
|
||||
|
||||
typedef GEOMAlgo_WireEdgeSet* GEOMAlgo_PWireEdgeSet;
|
||||
|
||||
#endif
|
@ -31,9 +31,10 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_PassKey
|
||||
|
@ -25,16 +25,18 @@
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <GEOMAlgo_KindOfShape.hxx>
|
||||
#include <GEOMAlgo_KindOfName.hxx>
|
||||
#include <GEOMAlgo_KindOfBounds.hxx>
|
||||
#include <GEOMAlgo_KindOfClosed.hxx>
|
||||
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
|
||||
#include <GEOMAlgo_KindOfShape.hxx>
|
||||
#include <GEOMAlgo_KindOfName.hxx>
|
||||
#include <GEOMAlgo_KindOfBounds.hxx>
|
||||
#include <GEOMAlgo_KindOfClosed.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
|
@ -1,177 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_ShapeSet.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#include <GEOMAlgo_ShapeSet.hxx>
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfOrientedShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_ShapeSet::GEOMAlgo_ShapeSet()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeSet::Clear()
|
||||
{
|
||||
myMap.Clear();
|
||||
myList.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (myMap.Add(theShape)) {
|
||||
myList.Append(theShape);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape,
|
||||
const TopAbs_ShapeEnum theType)
|
||||
{
|
||||
TopExp_Explorer aExp;
|
||||
//
|
||||
aExp.Init(theShape, theType);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aS=aExp.Current();
|
||||
if (myMap.Add(aS)) {
|
||||
myList.Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeSet::Add(const TopTools_ListOfShape& theLS)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
aIt.Initialize(theLS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (myMap.Add(aS)) {
|
||||
myList.Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function :GetSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const
|
||||
{
|
||||
return myList;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Contains
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_ShapeSet::Contains(const GEOMAlgo_ShapeSet& theOther)const
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
TopAbs_Orientation aOr;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
bRet=Standard_True;
|
||||
const TopTools_ListOfShape& aLS=theOther.GetSet();
|
||||
aIt.Initialize(aLS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
aOr=aF.Orientation();
|
||||
if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
|
||||
bRet=myMap.Contains(aF);
|
||||
if (!bRet) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Subtract
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
TopTools_ListOfShape aLS;
|
||||
//
|
||||
myMap.Clear();
|
||||
aIt.Initialize(myList);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (!theOther.myMap.Contains(aS)) {
|
||||
if(myMap.Add(aS)){
|
||||
aLS.Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
myList=aLS;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Oct 28 13:51:36 2010f
|
||||
//=======================================================================
|
||||
//function : IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_ShapeSet::IsEqual(const GEOMAlgo_ShapeSet& theOther)const
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer aNb1, aNb2;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
bRet=Standard_True;
|
||||
aNb1=myList.Extent();
|
||||
const TopTools_ListOfShape& aLS2=theOther.GetSet();
|
||||
aNb2=aLS2.Extent();
|
||||
if (aNb1!=aNb2) {
|
||||
return !bRet;
|
||||
}
|
||||
//
|
||||
aIt.Initialize(myList);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if(!theOther.myMap.Contains(aS)) {
|
||||
bRet=!bRet;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Oct 28 13:51:38 2010t
|
@ -1,92 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_ShapeSet.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#ifndef _GEOMAlgo_ShapeSet_HeaderFile
|
||||
#define _GEOMAlgo_ShapeSet_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//! Implementation some formal <br>
|
||||
//! opereations with Set of shapes <br>
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_ShapeSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_ShapeSet
|
||||
{
|
||||
public:
|
||||
//! Empty constructor <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_ShapeSet();
|
||||
|
||||
//! Adds shapes from the list theLS to the Set <br>
|
||||
Standard_EXPORT
|
||||
void Add(const TopTools_ListOfShape& theLS) ;
|
||||
|
||||
//! Adds shape theShape to the Set <br>
|
||||
Standard_EXPORT
|
||||
void Add(const TopoDS_Shape& theShape) ;
|
||||
|
||||
//! Adds sub-shapes of shape theShape, <br>
|
||||
//! that have type theType to the Set <br>
|
||||
Standard_EXPORT
|
||||
void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ;
|
||||
|
||||
//! Removes shapes of theSet from the Set <br>
|
||||
Standard_EXPORT
|
||||
void Subtract(const GEOMAlgo_ShapeSet& theSet) ;
|
||||
|
||||
//! Clears internal fields <br>
|
||||
Standard_EXPORT void Clear() ;
|
||||
|
||||
//! Returns True if the Set contains <br>
|
||||
//! all shapes of theSet <br>
|
||||
Standard_EXPORT
|
||||
Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const;
|
||||
|
||||
//! Returns the Set <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& GetSet() const;
|
||||
|
||||
//! Returns True if the Set==theSet <br>
|
||||
Standard_EXPORT
|
||||
Standard_Boolean IsEqual(const GEOMAlgo_ShapeSet& theOther) const;
|
||||
|
||||
Standard_Boolean operator ==(const GEOMAlgo_ShapeSet& theOther) const {
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
||||
protected:
|
||||
TopTools_MapOfOrientedShape myMap;
|
||||
TopTools_ListOfShape myList;
|
||||
};
|
||||
#endif
|
@ -52,9 +52,9 @@ GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid()
|
||||
//function : SetFiller
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller)
|
||||
void GEOMAlgo_ShapeSolid::SetFiller(const BOPAlgo_PaveFiller& aDSFiller)
|
||||
{
|
||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
||||
myDSFiller=(BOPAlgo_PaveFiller*) &aDSFiller;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Shapes
|
||||
|
@ -30,12 +30,15 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <BOPTools_PDSFiller.hxx>
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_PPaveFiller.hxx>
|
||||
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_ShapeSolid
|
||||
@ -45,7 +48,7 @@ class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT
|
||||
void SetFiller(const BOPTools_DSFiller& aDSF) ;
|
||||
void SetFiller(const BOPAlgo_PaveFiller& aDSF) ;
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_ShapeSolid();
|
||||
@ -58,16 +61,13 @@ protected:
|
||||
GEOMAlgo_ShapeSolid();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult() = 0;
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void Prepare() = 0;
|
||||
virtual void BuildResult()=0;
|
||||
|
||||
|
||||
TopTools_ListOfShape myLSIN;
|
||||
TopTools_ListOfShape myLSOUT;
|
||||
TopTools_ListOfShape myLSON;
|
||||
Standard_Integer myRank;
|
||||
BOPTools_PDSFiller myDSFiller;
|
||||
BOPAlgo_PPaveFiller myDSFiller;
|
||||
};
|
||||
#endif
|
||||
|
@ -46,33 +46,118 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <BOPTColStd_Dump.hxx>
|
||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
||||
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPAlgo_Builder.hxx>
|
||||
|
||||
#include <BOPTools_PaveFiller.hxx>
|
||||
#include <BOPTools_SolidStateFiller.hxx>
|
||||
#include <BOPTools_PCurveMaker.hxx>
|
||||
#include <BOPTools_DEProcessor.hxx>
|
||||
#include <BOPTools_InterferencePool.hxx>
|
||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools_PaveBlock.hxx>
|
||||
#include <BOPTools_SSInterference.hxx>
|
||||
#include <BOPTools_SequenceOfCurves.hxx>
|
||||
#include <BOPTools_Curve.hxx>
|
||||
#include <BOPTools_PaveFiller.hxx>
|
||||
#include <BOPTools_SplitShapesPool.hxx>
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_ShellSolidBuilder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_ShellSolidBuilder : public BOPAlgo_Builder {
|
||||
public:
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_ShellSolidBuilder();
|
||||
|
||||
#include <BOP_WireEdgeSet.hxx>
|
||||
#include <BOP_SDFWESFiller.hxx>
|
||||
#include <BOP_FaceBuilder.hxx>
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_ShellSolidBuilder();
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void PerformInternal(const BOPAlgo_PaveFiller& theFiller);
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_ShellSolidBuilder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_ShellSolidBuilder::GEOMAlgo_ShellSolidBuilder()
|
||||
:
|
||||
BOPAlgo_Builder()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~GEOMAlgo_ShellSolidBuilder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_ShellSolidBuilder::~GEOMAlgo_ShellSolidBuilder()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInternal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShellSolidBuilder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
|
||||
myDS=myPaveFiller->PDS();
|
||||
myContext=myPaveFiller->Context();
|
||||
//
|
||||
// 1. CheckData
|
||||
CheckData();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 2. Prepare
|
||||
Prepare();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 3. Fill Images
|
||||
// 3.1 Vertice
|
||||
FillImagesVertices();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_VERTEX);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 3.2 Edges
|
||||
FillImagesEdges();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_EDGE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 3.3 Wires
|
||||
FillImagesContainers(TopAbs_WIRE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_WIRE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 3.4 Faces
|
||||
FillImagesFaces();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_FACE);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_ShellSolid
|
||||
//purpose :
|
||||
@ -98,274 +183,126 @@ void GEOMAlgo_ShellSolid::Perform()
|
||||
myErrorStatus=0;
|
||||
//
|
||||
try {
|
||||
Standard_Integer aNbArgs, iRank, iErr, iBeg, iEnd, i, aNbSp;
|
||||
Standard_Real aTol;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopAbs_State aState;
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2D;
|
||||
TopoDS_Face aF;
|
||||
//
|
||||
myLSIN.Clear();
|
||||
myLSOUT.Clear();
|
||||
myLSON.Clear();
|
||||
//
|
||||
aTol=1.e-7;
|
||||
//
|
||||
if (myDSFiller==NULL) {
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
if(!myDSFiller->IsDone()) {
|
||||
if(myDSFiller->ErrorStatus()) {
|
||||
myErrorStatus=11;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bIsNewFiller;
|
||||
const BOPDS_DS& aDS=myDSFiller->DS();
|
||||
BOPDS_DS* pDS=(BOPDS_DS*)&aDS;
|
||||
const BOPCol_ListOfShape& aLS=pDS->Arguments();
|
||||
//
|
||||
bIsNewFiller=myDSFiller->IsNewFiller();
|
||||
if (bIsNewFiller) {
|
||||
Prepare();
|
||||
myDSFiller->SetNewFiller(!bIsNewFiller);
|
||||
aNbArgs=aLS.Extent();
|
||||
if (aNbArgs!=2) {
|
||||
myErrorStatus=13;
|
||||
return;
|
||||
}
|
||||
//
|
||||
myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2;
|
||||
BuildResult();
|
||||
}
|
||||
iRank=-1;
|
||||
const TopoDS_Shape& aObj=aLS.First();
|
||||
if (aObj.ShapeType()==TopAbs_SHELL) {
|
||||
iRank=0;
|
||||
}
|
||||
const TopoDS_Shape& aTool=aLS.Last();
|
||||
if (aTool.ShapeType()==TopAbs_SHELL) {
|
||||
iRank=1;
|
||||
}
|
||||
//
|
||||
if (iRank==-1) {
|
||||
myErrorStatus=14;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Handle(BOPInt_Context) aCtx=myDSFiller->Context();
|
||||
const BOPDS_IndexRange& aRange=pDS->Range(iRank);
|
||||
aRange.Indices(iBeg, iEnd);
|
||||
const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);
|
||||
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
|
||||
//
|
||||
//------------------------------ShellSolidBuilder
|
||||
GEOMAlgo_ShellSolidBuilder aSSB;
|
||||
//
|
||||
aSSB.PerformWithFiller(*myDSFiller);
|
||||
iErr=aSSB.ErrorStatus();
|
||||
if (iErr) {
|
||||
myErrorStatus=15;
|
||||
return;
|
||||
}
|
||||
//
|
||||
const BOPCol_DataMapOfShapeListOfShape& aImages=aSSB.Images();
|
||||
//
|
||||
//-------------------------------
|
||||
for (i=iBeg; i<=iEnd; ++i) {
|
||||
const TopoDS_Shape& aS=pDS->Shape(i);
|
||||
aType=aS.ShapeType();
|
||||
if (aType!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aState=TopAbs_UNKNOWN;
|
||||
aF=*((TopoDS_Face*)&aS);
|
||||
//
|
||||
if (!aImages.IsBound(aS)) {
|
||||
iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
|
||||
if (iErr) {
|
||||
myErrorStatus=16;
|
||||
return;
|
||||
}
|
||||
//
|
||||
aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
|
||||
}
|
||||
else {
|
||||
const BOPCol_ListOfShape& aLSp=aImages.Find(aS);
|
||||
aNbSp=aLSp.Extent();
|
||||
if (aNbSp>0) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aNbSp==1) {
|
||||
aF=*((TopoDS_Face*)&aLSp.First());
|
||||
}
|
||||
//
|
||||
iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
|
||||
if (iErr) {
|
||||
myErrorStatus=16;
|
||||
return;
|
||||
}
|
||||
//
|
||||
aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
|
||||
}
|
||||
//----------
|
||||
if (aState==TopAbs_ON) {
|
||||
myLSON.Append(aF);
|
||||
}
|
||||
else if (aState==TopAbs_OUT) {
|
||||
myLSOUT.Append(aF);
|
||||
}
|
||||
else if (aState==TopAbs_IN) {
|
||||
myLSIN.Append(aF);
|
||||
}
|
||||
//----------
|
||||
}//for (i=iBeg; i<=iEnd; ++i) {
|
||||
|
||||
}// try
|
||||
catch (Standard_Failure) {
|
||||
myErrorStatus=12;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Prepare
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShellSolid::Prepare()
|
||||
{
|
||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
||||
//
|
||||
// 1 States
|
||||
BOPTools_SolidStateFiller aStateFiller(aPaveFiller);
|
||||
aStateFiller.Do();
|
||||
//
|
||||
// 2 Project section edges on corresp. faces -> P-Curves on edges.
|
||||
BOPTools_PCurveMaker aPCurveMaker(aPaveFiller);
|
||||
aPCurveMaker.Do();
|
||||
//
|
||||
// 3. Degenerated Edges Processing
|
||||
BOPTools_DEProcessor aDEProcessor(aPaveFiller);
|
||||
aDEProcessor.Do();
|
||||
//
|
||||
// 4. Detect Same Domain Faces
|
||||
DetectSDFaces();
|
||||
}
|
||||
//=================================================================================
|
||||
// function: BuildResult
|
||||
// purpose:
|
||||
//=================================================================================
|
||||
void GEOMAlgo_ShellSolid::BuildResult()
|
||||
{
|
||||
Standard_Boolean bIsTouchCase;
|
||||
Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSp, iRank1;
|
||||
Standard_Integer nE, nF, aNbPB, iBeg, iEnd;
|
||||
BooleanOperations_StateOfShape aState;
|
||||
TopExp_Explorer anExp;
|
||||
TopAbs_ShapeEnum aType;
|
||||
gp_Pnt2d aP2D;
|
||||
gp_Pnt aP3D;
|
||||
//
|
||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool();
|
||||
BOPTools_InterferencePool* pInterfPool=(BOPTools_InterferencePool*) &anInterfPool;
|
||||
BOPTools_CArray1OfSSInterference& aFFs=pInterfPool->SSInterferences();
|
||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
||||
const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
|
||||
//
|
||||
// 1. process pf non-interferring faces
|
||||
iBeg=1;
|
||||
iEnd=aDS.NumberOfShapesOfTheObject();
|
||||
if (myRank==2) {
|
||||
iBeg=iEnd+1;
|
||||
iEnd=aDS.NumberOfSourceShapes();
|
||||
}
|
||||
//
|
||||
for (i=iBeg; i<=iEnd; ++i) {
|
||||
aType=aDS.GetShapeType(i);
|
||||
if (aType!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i));
|
||||
aState=aDS.GetState(i);
|
||||
if (aState==BooleanOperations_IN) {
|
||||
myLSIN.Append(aF1);
|
||||
}
|
||||
else if (aState==BooleanOperations_OUT) {
|
||||
myLSOUT.Append(aF1);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2. process pf interferred faces
|
||||
aNbFFs=aFFs.Extent();
|
||||
for (i=1; i<=aNbFFs; ++i) {
|
||||
BOPTools_SSInterference& aFFi=aFFs(i);
|
||||
//
|
||||
nF1=aFFi.Index1();
|
||||
nF2=aFFi.Index2();
|
||||
iRank1=aDS.Rank(nF1);
|
||||
nF=(iRank1==myRank) ? nF1 : nF2;
|
||||
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF));
|
||||
//
|
||||
bIsTouchCase=aFFi.IsTangentFaces();
|
||||
//
|
||||
if (bIsTouchCase) {
|
||||
myLSON.Append(aF1);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Has section edges ?
|
||||
aNbS=0;
|
||||
BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves();
|
||||
aNbCurves=aBCurves.Length();
|
||||
for (j=1; j<=aNbCurves; j++) {
|
||||
BOPTools_Curve& aBC=aBCurves(j);
|
||||
const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks();
|
||||
aNbS=aSectEdges.Extent();
|
||||
if (aNbS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aNbS) { // it has
|
||||
continue;
|
||||
}
|
||||
//
|
||||
anExp.Init(aF1, TopAbs_EDGE);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
nE=aDS.ShapeIndex(aE, myRank);
|
||||
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE));
|
||||
aNbPB=aLPB.Extent();
|
||||
//
|
||||
if (aNbPB<2) {
|
||||
nSp=nE;
|
||||
if (aNbPB) {
|
||||
const BOPTools_PaveBlock& aPB=aLPB.First();
|
||||
nSp=aPB.Edge();
|
||||
}
|
||||
/*const TopoDS_Shape& aSp=*/aDS.Shape(nSp);
|
||||
//
|
||||
aState=aDS.GetState(nSp);
|
||||
if (aState==BooleanOperations_IN) {
|
||||
myLSIN.Append(aF1);
|
||||
}
|
||||
else if (aState==BooleanOperations_OUT) {
|
||||
myLSOUT.Append(aF1);
|
||||
}
|
||||
else if (aState==BooleanOperations_ON) {
|
||||
Standard_Real aTol;
|
||||
TopAbs_State aSt;
|
||||
//
|
||||
//const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1));
|
||||
//aTol=BRep_Tool::Tolerance(aF2);
|
||||
aTol=1.e-7;
|
||||
//
|
||||
BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D);
|
||||
const TopoDS_Solid& aRefSolid=(myRank==1) ?
|
||||
TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object());
|
||||
//
|
||||
BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller;
|
||||
const Handle(IntTools_Context)& aCtx=pPF->Context();
|
||||
//
|
||||
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aRefSolid);
|
||||
aSC.Perform(aP3D, aTol);
|
||||
aSt=aSC.State();
|
||||
if (aSt==TopAbs_IN) {
|
||||
myLSIN.Append(aF1);
|
||||
}
|
||||
else if (aSt==TopAbs_OUT) {
|
||||
myLSOUT.Append(aF1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // if (aNbPB<2) {
|
||||
} //for (; anExp.More(); anExp.Next())
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: DetectSDFaces
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShellSolid::DetectSDFaces()
|
||||
{
|
||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
||||
//
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer i, aNb, nF1, nF2, iZone, aNbSps, iSenseFlag;
|
||||
gp_Dir aDNF1, aDNF2;
|
||||
|
||||
aNb=aFFs.Extent();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
bFlag=Standard_False;
|
||||
|
||||
BOPTools_SSInterference& aFF=aFFs(i);
|
||||
|
||||
nF1=aFF.Index1();
|
||||
nF2=aFF.Index2();
|
||||
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
|
||||
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
|
||||
//
|
||||
// iSenseFlag;
|
||||
const BOPTools_ListOfPaveBlock& aLPB=aFF.PaveBlocks();
|
||||
aNbSps=aLPB.Extent();
|
||||
|
||||
if (!aNbSps) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const BOPTools_PaveBlock& aPB=aLPB.First();
|
||||
const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge()));
|
||||
|
||||
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1);
|
||||
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2);
|
||||
iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2);
|
||||
//
|
||||
if (iSenseFlag==1 || iSenseFlag==-1) {
|
||||
//
|
||||
//
|
||||
TopoDS_Face aF1FWD=aF1;
|
||||
aF1FWD.Orientation (TopAbs_FORWARD);
|
||||
|
||||
BOP_WireEdgeSet aWES (aF1FWD);
|
||||
BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller);
|
||||
aWESFiller.SetSenseFlag(iSenseFlag);
|
||||
aWESFiller.SetOperation(BOP_COMMON);
|
||||
aWESFiller.Do(aWES);
|
||||
|
||||
BOP_FaceBuilder aFB;
|
||||
aFB.Do(aWES);
|
||||
const TopTools_ListOfShape& aLF=aFB.NewFaces();
|
||||
|
||||
iZone=0;
|
||||
TopTools_ListIteratorOfListOfShape anIt(aLF);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
const TopoDS_Shape& aFR=anIt.Value();
|
||||
|
||||
if (aFR.ShapeType()==TopAbs_FACE) {
|
||||
const TopoDS_Face& aFaceResult=TopoDS::Face(aFR);
|
||||
//
|
||||
Standard_Boolean bIsValidIn2D, bNegativeFlag;
|
||||
bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag);
|
||||
if (bIsValidIn2D) {
|
||||
//if(CheckSameDomainFaceInside(aFaceResult, aF2)) {
|
||||
iZone=1;
|
||||
break;
|
||||
//}
|
||||
}
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
if (iZone) {
|
||||
bFlag=Standard_True;
|
||||
aFF.SetStatesMap(aWESFiller.StatesMap());
|
||||
}
|
||||
|
||||
}// if (iSenseFlag)
|
||||
|
||||
aFF.SetTangentFacesFlag(bFlag);
|
||||
aFF.SetSenseFlag (iSenseFlag);
|
||||
}// end of for (i=1; i<=aNb; i++)
|
||||
}
|
||||
|
@ -50,12 +50,9 @@ class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void Prepare() ;
|
||||
virtual void BuildResult() {
|
||||
};
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult() ;
|
||||
|
||||
Standard_EXPORT
|
||||
void DetectSDFaces() ;
|
||||
};
|
||||
#endif
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
|
||||
|
||||
@ -86,19 +84,11 @@ void GEOMAlgo_SolidSolid::Perform()
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
if(!myDSFiller->IsDone()) {
|
||||
if(myDSFiller->ErrorStatus()) {
|
||||
myErrorStatus=11;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bIsNewFiller;
|
||||
//
|
||||
bIsNewFiller=myDSFiller->IsNewFiller();
|
||||
if (bIsNewFiller) {
|
||||
Prepare();
|
||||
myDSFiller->SetNewFiller(!bIsNewFiller);
|
||||
}
|
||||
//
|
||||
myRank=2;
|
||||
BuildResult();
|
||||
}
|
||||
@ -122,7 +112,7 @@ void GEOMAlgo_SolidSolid::BuildResult()
|
||||
GEOMAlgo_IndexedDataMapOfShapeState aMFS;
|
||||
//
|
||||
// 1. classify the faces
|
||||
GEOMAlgo_ShellSolid::BuildResult();
|
||||
GEOMAlgo_ShellSolid::Perform();
|
||||
//
|
||||
// 2. fill Shape-State map
|
||||
aIt.Initialize(myLSIN);
|
||||
@ -140,6 +130,7 @@ void GEOMAlgo_SolidSolid::BuildResult()
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
aMFS.Add(aF, TopAbs_ON);
|
||||
}
|
||||
//
|
||||
myLSIN.Clear();
|
||||
myLSON.Clear();
|
||||
myLSOUT.Clear();
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShellSolid.hxx>
|
||||
|
||||
//=======================================================================
|
||||
@ -47,7 +48,7 @@ class GEOMAlgo_SolidSolid : public GEOMAlgo_ShellSolid
|
||||
virtual ~GEOMAlgo_SolidSolid();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void Perform() ;
|
||||
virtual void Perform() ;
|
||||
|
||||
Standard_EXPORT
|
||||
void SetShape2(const TopoDS_Shape& aS) ;
|
||||
@ -57,8 +58,7 @@ class GEOMAlgo_SolidSolid : public GEOMAlgo_ShellSolid
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult() ;
|
||||
|
||||
virtual void BuildResult() ;
|
||||
|
||||
TopoDS_Shape myS2;
|
||||
};
|
||||
|
@ -20,9 +20,12 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_Splitter.cxx
|
||||
// Author: Peter KURNEV
|
||||
// File: GEOMAlgo_Splitter.cxx
|
||||
// Created: Thu Sep 06 10:54:04 2012
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_Splitter.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
@ -31,269 +34,250 @@
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
|
||||
#include <BOP_CorrectTolerances.hxx>
|
||||
#include <BOPTools.hxx>
|
||||
|
||||
|
||||
static
|
||||
void TreatCompound(const TopoDS_Shape& aC,
|
||||
TopTools_ListOfShape& aLSX);
|
||||
static
|
||||
void TreatCompound(const TopoDS_Shape& aC,
|
||||
BOPCol_ListOfShape& aLSX);
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_Splitter::GEOMAlgo_Splitter()
|
||||
GEOMAlgo_Splitter::GEOMAlgo_Splitter()
|
||||
:
|
||||
GEOMAlgo_Builder()
|
||||
BOPAlgo_Builder(),
|
||||
myTools(myAllocator),
|
||||
myMapTools(100, myAllocator)
|
||||
{
|
||||
myLimit=TopAbs_SHAPE;
|
||||
myLimitMode=0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_Splitter::GEOMAlgo_Splitter
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
BOPAlgo_Builder(theAllocator),
|
||||
myTools(myAllocator),
|
||||
myMapTools(100, myAllocator)
|
||||
{
|
||||
myLimit=TopAbs_SHAPE;
|
||||
myLimitMode=0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
|
||||
GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddToolCompound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::AddToolCompound(const TopoDS_Shape& theShape)
|
||||
{
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
aIt.Initialize(theShape);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
AddTool(aS);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddTool
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
|
||||
void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (myMapTools.Add(theShape)) {
|
||||
myTools.Append(theShape);
|
||||
//
|
||||
AddShape(theShape);
|
||||
AddArgument(theShape);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Tools
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_Splitter::Tools()const
|
||||
const BOPCol_ListOfShape& GEOMAlgo_Splitter::Tools()const
|
||||
{
|
||||
return myTools;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetLimit
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit)
|
||||
void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit)
|
||||
{
|
||||
myLimit=aLimit;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Limit
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const
|
||||
TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const
|
||||
{
|
||||
return myLimit;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetLimitMode
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode)
|
||||
void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode)
|
||||
{
|
||||
myLimitMode=aMode;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : LimitMode
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Splitter::LimitMode()const
|
||||
Standard_Integer GEOMAlgo_Splitter::LimitMode()const
|
||||
{
|
||||
return myLimitMode;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::Clear()
|
||||
void GEOMAlgo_Splitter::Clear()
|
||||
{
|
||||
myTools.Clear();
|
||||
myMapTools.Clear();
|
||||
myLimit=TopAbs_SHAPE;
|
||||
GEOMAlgo_Builder::Clear();
|
||||
BOPAlgo_Builder::Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildResult
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType)
|
||||
void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
TopAbs_ShapeEnum aType;
|
||||
BRep_Builder aBB;
|
||||
TopTools_MapOfShape aM;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aItIm;
|
||||
BOPCol_MapOfShape aM;
|
||||
BOPCol_ListIteratorOfListOfShape aIt, aItIm;
|
||||
//
|
||||
aIt.Initialize(myShapes);
|
||||
aIt.Initialize(myArguments);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
aType=aS.ShapeType();
|
||||
if (aType==theType && !myMapTools.Contains(aS)) {
|
||||
if (myImages.HasImage(aS)) {
|
||||
const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
aBB.Add(myShape, aSIm);
|
||||
}
|
||||
}
|
||||
if (myImages.IsBound(aS)) {
|
||||
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
aBB.Add(myShape, aSIm);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aM.Add(aS)) {
|
||||
aBB.Add(myShape, aS);
|
||||
}
|
||||
if (aM.Add(aS)) {
|
||||
aBB.Add(myShape, aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PostTreat
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Splitter::PostTreat()
|
||||
void GEOMAlgo_Splitter::PostTreat()
|
||||
{
|
||||
if (myLimit!=TopAbs_SHAPE) {
|
||||
Standard_Integer i, aNbS;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Compound aC;
|
||||
TopTools_IndexedMapOfShape aMx;
|
||||
BOPCol_IndexedMapOfShape aMx;
|
||||
//
|
||||
aBB.MakeCompound(aC);
|
||||
//
|
||||
TopExp::MapShapes(myShape, myLimit, aMx);
|
||||
BOPTools::MapShapes(myShape, myLimit, aMx);
|
||||
aNbS=aMx.Extent();
|
||||
for (i=1; i<=aNbS; ++i) {
|
||||
const TopoDS_Shape& aS=aMx(i);
|
||||
aBB.Add(aC, aS);
|
||||
}
|
||||
//
|
||||
if (myLimitMode) {
|
||||
Standard_Integer iType, iLimit, iTypeX;
|
||||
TopAbs_ShapeEnum aType, aTypeX;
|
||||
TopTools_ListOfShape aLSP, aLSX;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aItX, aItIm;
|
||||
TopTools_MapOfShape aM;
|
||||
BOPCol_ListOfShape aLSP, aLSX;
|
||||
BOPCol_ListIteratorOfListOfShape aIt, aItX, aItIm;
|
||||
BOPCol_MapOfShape aM;
|
||||
//
|
||||
iLimit=(Standard_Integer)myLimit;
|
||||
iLimit=(Standard_Integer)myLimit;
|
||||
//
|
||||
// 1. Collect the shapes to process aLSP
|
||||
aIt.Initialize(myShapes);
|
||||
aIt.Initialize(myArguments);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (myMapTools.Contains(aS)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aType=aS.ShapeType();
|
||||
iType=(Standard_Integer)aType;
|
||||
//
|
||||
if (iType>iLimit) {
|
||||
aLSP.Append(aS);
|
||||
}
|
||||
//
|
||||
else if (aType==TopAbs_COMPOUND) {
|
||||
aLSX.Clear();
|
||||
//
|
||||
TreatCompound(aS, aLSX);
|
||||
//
|
||||
aItX.Initialize(aLSX);
|
||||
for (; aItX.More(); aItX.Next()) {
|
||||
const TopoDS_Shape& aSX=aItX.Value();
|
||||
aTypeX=aSX.ShapeType();
|
||||
iTypeX=(Standard_Integer)aTypeX;
|
||||
//
|
||||
if (iTypeX>iLimit) {
|
||||
aLSP.Append(aSX);
|
||||
}
|
||||
}
|
||||
}
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (myMapTools.Contains(aS)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aType=aS.ShapeType();
|
||||
iType=(Standard_Integer)aType;
|
||||
//
|
||||
if (iType>iLimit) {
|
||||
aLSP.Append(aS);
|
||||
}
|
||||
//
|
||||
else if (aType==TopAbs_COMPOUND) {
|
||||
aLSX.Clear();
|
||||
//
|
||||
TreatCompound(aS, aLSX);
|
||||
//
|
||||
aItX.Initialize(aLSX);
|
||||
for (; aItX.More(); aItX.Next()) {
|
||||
const TopoDS_Shape& aSX=aItX.Value();
|
||||
aTypeX=aSX.ShapeType();
|
||||
iTypeX=(Standard_Integer)aTypeX;
|
||||
//
|
||||
if (iTypeX>iLimit) {
|
||||
aLSP.Append(aSX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
//
|
||||
//modified by NIZNHY-PKV Fri Oct 30 11:07:08 2009 f
|
||||
aMx.Clear();
|
||||
TopExp::MapShapes(aC, aMx);
|
||||
//modified by NIZNHY-PKV Fri Oct 30 11:12:30 2009t
|
||||
//
|
||||
// 2. Add them to aC
|
||||
aIt.Initialize(aLSP);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (myImages.HasImage(aS)) {
|
||||
const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
//modified by NIZNHY-PKV Fri Oct 30 11:09:57 2009f
|
||||
if (!aMx.Contains(aSIm)) {
|
||||
aBB.Add(aC, aSIm);
|
||||
}
|
||||
//aBB.Add(aC, aSIm);
|
||||
//modified by NIZNHY-PKV Fri Oct 30 11:10:02 2009
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aM.Add(aS)) {
|
||||
//modified by NIZNHY-PKV Fri Oct 30 11:10:46 2009f
|
||||
if (!aMx.Contains(aS)) {
|
||||
aBB.Add(aC, aS);
|
||||
}
|
||||
//aBB.Add(aC, aS);
|
||||
//modified by NIZNHY-PKV Fri Oct 30 11:11:00 2009t
|
||||
}
|
||||
}
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (myImages.IsBound(aS)) {
|
||||
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
aBB.Add(aC, aSIm);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aM.Add(aS)) {
|
||||
aBB.Add(aC, aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}// if (myLimitMode) {
|
||||
myShape=aC;
|
||||
}//if (myLimit!=TopAbs_SHAPE) {
|
||||
//
|
||||
GEOMAlgo_Builder::PostTreat();
|
||||
BOPAlgo_Builder::PostTreat();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TreatCompound
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TreatCompound(const TopoDS_Shape& aC1,
|
||||
TopTools_ListOfShape& aLSX)
|
||||
void TreatCompound(const TopoDS_Shape& aC1,
|
||||
BOPCol_ListOfShape& aLSX)
|
||||
{
|
||||
Standard_Integer aNbC1;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopTools_ListOfShape aLC, aLC1;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aIt1;
|
||||
BOPCol_ListOfShape aLC, aLC1;
|
||||
BOPCol_ListIteratorOfListOfShape aIt, aIt1;
|
||||
TopoDS_Iterator aItC;
|
||||
//
|
||||
aLC.Append (aC1);
|
||||
@ -305,14 +289,14 @@ void TreatCompound(const TopoDS_Shape& aC1,
|
||||
//
|
||||
aItC.Initialize(aC);
|
||||
for (; aItC.More(); aItC.Next()) {
|
||||
const TopoDS_Shape& aS=aItC.Value();
|
||||
aType=aS.ShapeType();
|
||||
if (aType==TopAbs_COMPOUND) {
|
||||
aLC1.Append(aS);
|
||||
}
|
||||
else {
|
||||
aLSX.Append(aS);
|
||||
}
|
||||
const TopoDS_Shape& aS=aItC.Value();
|
||||
aType=aS.ShapeType();
|
||||
if (aType==TopAbs_COMPOUND) {
|
||||
aLC1.Append(aS);
|
||||
}
|
||||
else {
|
||||
aLSX.Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -331,7 +315,7 @@ void TreatCompound(const TopoDS_Shape& aC1,
|
||||
}
|
||||
//
|
||||
// myErrorStatus
|
||||
//
|
||||
//
|
||||
// 0 - Ok
|
||||
// 1 - The object is just initialized
|
||||
// 2 - PaveFiller is failed
|
||||
|
@ -1,97 +1,99 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Splitter.hxx
|
||||
//
|
||||
// Author: Peter KURNEV
|
||||
//
|
||||
#ifndef _GEOMAlgo_Splitter_HeaderFile
|
||||
#define _GEOMAlgo_Splitter_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <GEOMAlgo_Builder.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//! Implementation of Gluing Operation Algorithm (GA) <br>
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_Splitter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_Splitter : public GEOMAlgo_Builder
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_Splitter();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_Splitter();
|
||||
|
||||
//! Clears internal fields and arguments <br>
|
||||
Standard_EXPORT
|
||||
virtual void Clear() ;
|
||||
|
||||
//! Adds Tool argument theShape of the operation <br>
|
||||
Standard_EXPORT
|
||||
virtual void AddTool(const TopoDS_Shape& theShape) ;
|
||||
|
||||
//! Returns the arguments of the operation <br>
|
||||
Standard_EXPORT
|
||||
const TopTools_ListOfShape& Tools() const;
|
||||
|
||||
Standard_EXPORT
|
||||
void SetLimit(const TopAbs_ShapeEnum aLimit) ;
|
||||
|
||||
Standard_EXPORT
|
||||
TopAbs_ShapeEnum Limit() const;
|
||||
|
||||
Standard_EXPORT
|
||||
void SetLimitMode(const Standard_Integer aLimitMode) ;
|
||||
|
||||
Standard_EXPORT
|
||||
Standard_Integer LimitMode() const;
|
||||
//! Adds Tool arguments of the operation as <br>
|
||||
//! shapes of upper level of container shape theShape <br>
|
||||
//! ===================================================== <br>
|
||||
Standard_EXPORT
|
||||
void AddToolCompound(const TopoDS_Shape& theShape) ;
|
||||
|
||||
protected:
|
||||
//! Build the resulting shapes of type theType <br>
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult(const TopAbs_ShapeEnum theType) ;
|
||||
//! Provides post-tratment actions <br>
|
||||
Standard_EXPORT
|
||||
virtual void PostTreat() ;
|
||||
|
||||
|
||||
TopTools_ListOfShape myTools;
|
||||
TopTools_MapOfShape myMapTools;
|
||||
TopAbs_ShapeEnum myLimit;
|
||||
Standard_Integer myLimitMode;
|
||||
};
|
||||
#endif
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Splitter.hxx
|
||||
// Created: Thu Sep 06 10:54:04 2012
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#ifndef GEOMAlgo_Splitter_HeaderFile
|
||||
#define GEOMAlgo_Splitter_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
|
||||
#include <BOPAlgo_Builder.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_Splitter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_Splitter : public BOPAlgo_Builder
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_Splitter();
|
||||
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_Splitter();
|
||||
|
||||
Standard_EXPORT
|
||||
void AddTool(const TopoDS_Shape& theShape);
|
||||
|
||||
Standard_EXPORT
|
||||
const BOPCol_ListOfShape& Tools()const;
|
||||
|
||||
Standard_EXPORT
|
||||
void SetLimit(const TopAbs_ShapeEnum aLimit);
|
||||
|
||||
Standard_EXPORT
|
||||
TopAbs_ShapeEnum Limit()const;
|
||||
|
||||
Standard_EXPORT
|
||||
void SetLimitMode(const Standard_Integer aMode);
|
||||
|
||||
Standard_EXPORT
|
||||
Standard_Integer LimitMode()const;
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void Clear();
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult(const TopAbs_ShapeEnum theType);
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void PostTreat();
|
||||
|
||||
protected:
|
||||
BOPCol_ListOfShape myTools;
|
||||
BOPCol_MapOfShape myMapTools;
|
||||
TopAbs_ShapeEnum myLimit;
|
||||
Standard_Integer myLimitMode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,613 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_Tools.cxx
|
||||
// Created: Mon Dec 6 11:35:29 2004
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
#include <BOPTools_Tools2D.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
|
||||
static
|
||||
void GetCount(const TopoDS_Shape& aS,
|
||||
Standard_Integer& iCnt);
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCompositeShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::IsCompositeShape(const TopoDS_Shape& aS)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer iCnt;
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
iCnt=0;
|
||||
GetCount(aS, iCnt);
|
||||
bRet=(iCnt>1);
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCount
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GetCount(const TopoDS_Shape& aS,
|
||||
Standard_Integer& iCnt)
|
||||
{
|
||||
TopoDS_Iterator aIt;
|
||||
TopAbs_ShapeEnum aTS;
|
||||
//
|
||||
aTS=aS.ShapeType();
|
||||
//
|
||||
if (aTS==TopAbs_SHAPE) {
|
||||
return;
|
||||
}
|
||||
if (aTS!=TopAbs_COMPOUND) {
|
||||
++iCnt;
|
||||
return;
|
||||
}
|
||||
//
|
||||
aIt.Initialize(aS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
GetCount(aSx, iCnt);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RefineSDShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE,
|
||||
const Standard_Real aTol,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd;
|
||||
//
|
||||
iErr=1;
|
||||
//
|
||||
aNbE=aMPKLE.Extent();
|
||||
for (i=1; i<=aNbE; ++i) {
|
||||
TopTools_ListOfShape& aLSDE=aMPKLE.ChangeFromIndex(i);
|
||||
//
|
||||
aMEE.Clear();
|
||||
iErr=GEOMAlgo_Tools::FindSDShapes(aLSDE, aTol, aMEE, aCtx);
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
aNbEE=aMEE.Extent();
|
||||
if (aNbEE==1) {
|
||||
continue; // nothing to do
|
||||
}
|
||||
//
|
||||
for (j=1; j<=aNbEE; ++j) {
|
||||
TopTools_ListOfShape& aLEE=aMEE.ChangeFromIndex(j);
|
||||
//
|
||||
if (j==1) {
|
||||
aLSDE.Clear();
|
||||
aLSDE.Append(aLEE);
|
||||
}
|
||||
else {
|
||||
const TopoDS_Shape& aE1=aLEE.First();
|
||||
aMEToAdd.Add(aE1, aLEE);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbToAdd=aMEToAdd.Extent();
|
||||
if (!aNbToAdd) {
|
||||
return aNbToAdd;
|
||||
}
|
||||
//
|
||||
for (i=1; i<=aNbToAdd; ++i) {
|
||||
GEOMAlgo_PassKeyShape aPKE1;
|
||||
//
|
||||
const TopoDS_Shape& aE1=aMEToAdd.FindKey(i);
|
||||
const TopTools_ListOfShape& aLE=aMEToAdd(i);
|
||||
//
|
||||
//qf
|
||||
//aPKE1.SetIds(aE1);
|
||||
aPKE1.SetShapes(aE1);
|
||||
//qt
|
||||
aMPKLE.Add(aPKE1, aLE);
|
||||
}
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FindSDShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr;
|
||||
TopTools_ListOfShape aLESD;
|
||||
TopTools_ListIteratorOfListOfShape aIt, aIt1;
|
||||
TopTools_IndexedMapOfShape aMProcessed;
|
||||
TopAbs_ShapeEnum aType;
|
||||
//
|
||||
aNbE=aLE.Extent();
|
||||
if (!aNbE) {
|
||||
return 3; // Err
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 30 10:56:52 2004 f
|
||||
if (aNbE==1) {
|
||||
return 0; // Nothing to do
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 30 10:56:56 2004 t
|
||||
//
|
||||
while(1) {
|
||||
aNbEProcessed=aMProcessed.Extent();
|
||||
if (aNbEProcessed==aNbE) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
aIt.Initialize(aLE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
//
|
||||
if (aMProcessed.Contains(aS)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Thu Dec 30 10:57:01 2004 f
|
||||
aType=aS.ShapeType();
|
||||
if (aType==TopAbs_EDGE) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(aS);
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
aMProcessed.Add(aE);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Dec 30 10:57:03 2004 t
|
||||
//
|
||||
aLESD.Clear();
|
||||
iErr=GEOMAlgo_Tools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx);
|
||||
if (iErr) {
|
||||
return 2; // Err
|
||||
}
|
||||
//
|
||||
aNbESD=aLESD.Extent();
|
||||
if (!aNbESD) {
|
||||
return 1; // Err
|
||||
}
|
||||
//
|
||||
aMEE.Add(aS, aLESD);
|
||||
//
|
||||
aIt1.Initialize(aLESD);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
const TopoDS_Shape& aE1=aIt1.Value();
|
||||
aMProcessed.Add(aE1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FindSDShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1,
|
||||
const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
TopTools_ListOfShape& aLESD,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
Standard_Boolean bIsDone;
|
||||
Standard_Real aTol2, aD2;
|
||||
gp_Pnt aP1, aP2;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
aTol2=aTol*aTol;
|
||||
GEOMAlgo_Tools::PointOnShape(aE1, aP1);
|
||||
//
|
||||
aIt.Initialize(aLE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE2=aIt.Value();
|
||||
if (aE2.IsSame(aE1)) {
|
||||
aLESD.Append(aE2);
|
||||
}
|
||||
else {
|
||||
bIsDone=GEOMAlgo_Tools::ProjectPointOnShape(aP1, aE2, aP2, aCtx);
|
||||
if (!bIsDone) {
|
||||
//return 1;
|
||||
continue; // jfa BUG 20361
|
||||
}
|
||||
aD2=aP1.SquareDistance(aP2);
|
||||
if(aD2<aTol2) {
|
||||
aLESD.Append(aE2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ProjectPointOnShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::ProjectPointOnShape(const gp_Pnt& aP1,
|
||||
const TopoDS_Shape& aS,
|
||||
gp_Pnt& aP2,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
Standard_Boolean bIsDone = Standard_False;
|
||||
Standard_Real aT2;
|
||||
TopAbs_ShapeEnum aType;
|
||||
//
|
||||
aType = aS.ShapeType();
|
||||
switch (aType)
|
||||
{
|
||||
case TopAbs_EDGE:
|
||||
{
|
||||
const TopoDS_Edge& aE2 = TopoDS::Edge(aS);
|
||||
//
|
||||
if (BRep_Tool::Degenerated(aE2)) { // jfa
|
||||
return Standard_True;
|
||||
}
|
||||
else {
|
||||
Standard_Real f, l;
|
||||
Handle(Geom_Curve) aC3D = BRep_Tool::Curve (aE2, f, l);
|
||||
if (aC3D.IsNull()) {
|
||||
return Standard_True;
|
||||
}
|
||||
bIsDone = aCtx->ProjectPointOnEdge(aP1, aE2, aT2);
|
||||
}
|
||||
if (!bIsDone) {
|
||||
return bIsDone;
|
||||
}
|
||||
//
|
||||
GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2);
|
||||
}
|
||||
break;
|
||||
//
|
||||
case TopAbs_FACE:
|
||||
{
|
||||
const TopoDS_Face& aF2 = TopoDS::Face(aS);
|
||||
GeomAPI_ProjectPointOnSurf& aProj = aCtx->ProjPS(aF2);
|
||||
//
|
||||
aProj.Perform(aP1);
|
||||
bIsDone = aProj.IsDone();
|
||||
if (!bIsDone) {
|
||||
return bIsDone;
|
||||
}
|
||||
//
|
||||
aP2 = aProj.NearestPoint();
|
||||
}
|
||||
break;
|
||||
//
|
||||
default:
|
||||
break; // Err
|
||||
}
|
||||
return bIsDone;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnShape(const TopoDS_Shape& aS,
|
||||
gp_Pnt& aP3D)
|
||||
{
|
||||
TopAbs_ShapeEnum aType;
|
||||
//
|
||||
aP3D.SetCoord(99.,99.,99.);
|
||||
aType=aS.ShapeType();
|
||||
switch(aType) {
|
||||
case TopAbs_EDGE: {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(aS);
|
||||
GEOMAlgo_Tools::PointOnEdge(aE, aP3D);
|
||||
}
|
||||
break;
|
||||
//
|
||||
case TopAbs_FACE: {
|
||||
const TopoDS_Face& aF=TopoDS::Face(aS);
|
||||
GEOMAlgo_Tools::PointOnFace(aF, aP3D);
|
||||
}
|
||||
break;
|
||||
//
|
||||
default:
|
||||
break; // Err
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF,
|
||||
gp_Pnt& aP3D)
|
||||
{
|
||||
Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
|
||||
//
|
||||
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
aU=BOPTools_Tools2D::IntermediatePoint(aUMin, aUMax);
|
||||
aV=BOPTools_Tools2D::IntermediatePoint(aVMin, aVMax);
|
||||
//
|
||||
GEOMAlgo_Tools::PointOnFace(aF, aU, aV, aP3D);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF,
|
||||
const Standard_Real aU,
|
||||
const Standard_Real aV,
|
||||
gp_Pnt& aP3D)
|
||||
{
|
||||
Handle(Geom_Surface) aS;
|
||||
//
|
||||
aS=BRep_Tool::Surface(aF);
|
||||
aS->D0(aU, aV, aP3D);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
|
||||
gp_Pnt& aP3D)
|
||||
{
|
||||
Standard_Real aTx, aT1, aT2;
|
||||
//
|
||||
BRep_Tool::Curve(aE, aT1, aT2);
|
||||
aTx=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
|
||||
GEOMAlgo_Tools::PointOnEdge(aE, aTx, aP3D);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
|
||||
const Standard_Real aT,
|
||||
gp_Pnt& aP3D)
|
||||
{
|
||||
Standard_Real aT1, aT2;
|
||||
Handle(Geom_Curve) aC3D;
|
||||
//
|
||||
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
||||
aC3D->D0(aT, aP3D);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : RefinePCurveForEdgeOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aUMin,
|
||||
const Standard_Real aUMax)
|
||||
{
|
||||
Standard_Real aT1, aT2, aTx, aUx, aTol;
|
||||
gp_Pnt2d aP2D;
|
||||
Handle(Geom_Surface) aS;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
|
||||
if (!aC2D.IsNull()) {
|
||||
if (BRep_Tool::IsClosed(aE, aF)) {
|
||||
return;
|
||||
}
|
||||
aTx=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
|
||||
aC2D->D0(aTx, aP2D);
|
||||
aUx=aP2D.X();
|
||||
if (aUx < aUMin || aUx > aUMax) {
|
||||
// need to rebuild
|
||||
Handle(Geom2d_Curve) aC2Dx;
|
||||
//
|
||||
aTol=BRep_Tool::Tolerance(aE);
|
||||
aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsUPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
GeomAbs_SurfaceType aType;
|
||||
GeomAdaptor_Surface aGAS;
|
||||
//
|
||||
aGAS.Load(aS);
|
||||
aType=aGAS.GetType();
|
||||
bRet=(aType==GeomAbs_Cylinder||
|
||||
aType==GeomAbs_Cone ||
|
||||
aType==GeomAbs_Sphere);
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:16:35 2012f
|
||||
//=======================================================================
|
||||
//function : BuildPCurveForEdgeOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer
|
||||
GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(const TopoDS_Edge& aEold,
|
||||
const TopoDS_Edge& aEnew,
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& aCtx)
|
||||
{
|
||||
Standard_Boolean bIsClosed, bUClosed, bHasOld;
|
||||
Standard_Integer iRet, aNbPoints;
|
||||
Standard_Real aTS, aTS1, aTS2, aT, aT1, aT2, aScPr, aTol;
|
||||
Standard_Real aU, aV, aUS1, aVS1, aUS2, aVS2;
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2DS1, aP2DS2, aP2D;
|
||||
gp_Vec2d aV2DS1, aV2DS2;
|
||||
Handle(Geom2d_Curve) aC2D, aC2DS1, aC2DS2;
|
||||
Handle(Geom_Surface) aS;
|
||||
TopoDS_Edge aES;
|
||||
//
|
||||
iRet=0;
|
||||
//
|
||||
bHasOld=BOPTools_Tools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol);
|
||||
if (bHasOld) {
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEnew, aF);
|
||||
aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2);
|
||||
if (aC2D.IsNull()){
|
||||
iRet=1;
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
bIsClosed=BRep_Tool::IsClosed(aEold, aF);
|
||||
if (!bIsClosed) {
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
aTol=1.e-7;
|
||||
//
|
||||
// 1. bUClosed - direction of closeness
|
||||
//
|
||||
aES=aEold;
|
||||
aES.Orientation(TopAbs_FORWARD);
|
||||
aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
|
||||
//
|
||||
aES.Orientation(TopAbs_REVERSED);
|
||||
aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
|
||||
//
|
||||
aTS=BOPTools_Tools2D::IntermediatePoint(aTS1, aTS2);
|
||||
//
|
||||
aC2DS1->D1(aTS, aP2DS1, aV2DS1);
|
||||
aC2DS2->D1(aTS, aP2DS2, aV2DS2);
|
||||
//
|
||||
gp_Vec2d aV2DS12(aP2DS1, aP2DS2);
|
||||
gp_Dir2d aD2DS12(aV2DS12);
|
||||
const gp_Dir2d& aD2DX=gp::DX2d();
|
||||
//
|
||||
aScPr=aD2DS12*aD2DX;
|
||||
bUClosed=Standard_True;
|
||||
if (fabs(aScPr) < aTol) {
|
||||
bUClosed=!bUClosed;
|
||||
}
|
||||
//
|
||||
// 2. aP2D - point on curve aC2D, that corresponds to aP2DS1
|
||||
aP2DS1.Coord(aUS1, aVS1);
|
||||
aP2DS2.Coord(aUS2, aVS2);
|
||||
//
|
||||
aS=BRep_Tool::Surface(aF);
|
||||
aS->D0(aUS1, aVS1, aP);
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjPC=aCtx->ProjPC(aEnew);
|
||||
//
|
||||
aProjPC.Perform(aP);
|
||||
aNbPoints=aProjPC.NbPoints();
|
||||
if (!aNbPoints) {
|
||||
iRet=2;
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
aT=aProjPC.LowerDistanceParameter();
|
||||
|
||||
//
|
||||
// 3. Build the second 2D curve
|
||||
Standard_Boolean bRevOrder;
|
||||
gp_Vec2d aV2DT, aV2D;
|
||||
Handle(Geom2d_Curve) aC2Dnew;
|
||||
Handle(Geom2d_TrimmedCurve) aC2DTnew;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aC2D->D1(aT, aP2D, aV2D);
|
||||
aP2D.Coord(aU, aV);
|
||||
//
|
||||
aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy());
|
||||
aC2DTnew = new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2);
|
||||
//
|
||||
aV2DT=aV2DS12;
|
||||
if (!bUClosed) { // V Closed
|
||||
if (fabs(aV-aVS2)<aTol) {
|
||||
aV2DT.Reverse();
|
||||
}
|
||||
}
|
||||
else { // U Closed
|
||||
if (fabs(aU-aUS2)<aTol) {
|
||||
aV2DT.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
aC2DTnew->Translate(aV2DT);
|
||||
//
|
||||
// 4 Order the 2D curves
|
||||
bRevOrder=Standard_False;
|
||||
aScPr=aV2D*aV2DS1;
|
||||
if(aScPr<0.) {
|
||||
bRevOrder=!bRevOrder;
|
||||
}
|
||||
//
|
||||
// 5. Update the edge
|
||||
aTol=BRep_Tool::Tolerance(aEnew);
|
||||
if (!bRevOrder) {
|
||||
aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol);
|
||||
}
|
||||
else {
|
||||
aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol);
|
||||
}
|
||||
//
|
||||
return iRet;
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: GEOMAlgo_Tools.hxx
|
||||
// Created: Mon Dec 6 11:35:29 2004
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#ifndef _GEOMAlgo_Tools_HeaderFile
|
||||
#define _GEOMAlgo_Tools_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Handle_IntTools_Context.hxx>
|
||||
#include <Handle_Geom_Surface.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_Tools
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_Tools
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
|
||||
const Standard_Real aTol,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
|
||||
const TopTools_ListOfShape& aLE,
|
||||
const Standard_Real aTol,
|
||||
TopTools_ListOfShape& aLESD,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
|
||||
const TopoDS_Shape& aS,gp_Pnt& aP2,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnShape(const TopoDS_Shape& aS,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnEdge(const TopoDS_Edge& aE,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnEdge(const TopoDS_Edge& aE,
|
||||
const Standard_Real aT,gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnFace(const TopoDS_Face& aF,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void PointOnFace(const TopoDS_Face& aF,
|
||||
const Standard_Real aU,
|
||||
const Standard_Real aV,
|
||||
gp_Pnt& aP3D) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aU1,
|
||||
const Standard_Real aU2) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean CorrectWires(const TopoDS_Shape& aS) ;
|
||||
|
||||
Standard_EXPORT
|
||||
static Standard_Integer BuildPCurveForEdgeOnFace(const TopoDS_Edge& aE,
|
||||
const TopoDS_Edge& aEold,
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& aCtx) ;
|
||||
|
||||
};
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,240 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_Tools3D.hxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#ifndef _GEOMAlgo_Tools3D_HeaderFile
|
||||
#define _GEOMAlgo_Tools3D_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Handle_IntTools_Context.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
|
||||
//! Auxiliary tools for Algorithms <br>
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_Tools3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_Tools3D {
|
||||
public:
|
||||
//! Returns True if the shape theSplit has opposite <br>
|
||||
//! direction than theShape <br>
|
||||
//! theContext - cashed geometrical tools <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Returns True if normal direction of the face <br>
|
||||
//! theShape is not the same as for the face <br>
|
||||
//! theSplit <br>
|
||||
//! theContext - cashed geometrical tools <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit,
|
||||
const TopoDS_Face& theShape,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Returns True if tangent direction of the edge <br>
|
||||
//! theEdge is not the same as for the edge <br>
|
||||
//! theSplit <br>
|
||||
//! theContext - cashed geometrical tools <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Edge& theSplit,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! For the couple of faces theF1, theF2 <br>
|
||||
//! computes sense value <br>
|
||||
//! Returns 0 if the faces are not sensible <br>
|
||||
//! Returns 1 if the faces have same sense <br>
|
||||
//! Returns 2 if the faces have opposite sense <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Integer Sense(const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2) ;
|
||||
|
||||
//! Makes new face theF2 from surface and wires <br>
|
||||
//! of the face theF1 <br>
|
||||
Standard_EXPORT
|
||||
static void CopyFace(const TopoDS_Face& theF1,
|
||||
TopoDS_Face& theF2) ;
|
||||
|
||||
//! Makes empty shape theShape of the type theType <br>
|
||||
Standard_EXPORT
|
||||
static void MakeContainer(const TopAbs_ShapeEnum theType,
|
||||
TopoDS_Shape& theShape) ;
|
||||
|
||||
//! For the list of faces theLS build block <br>
|
||||
//! theLSCB in terms of connexity by edges <br>
|
||||
//! theMapAvoid - set of edges to avoid for <br>
|
||||
//! the treatment <br>
|
||||
Standard_EXPORT
|
||||
static void MakeConnexityBlock(const TopTools_ListOfShape& theLS,
|
||||
const TopTools_IndexedMapOfShape& theMapAvoid,
|
||||
TopTools_ListOfShape& theLSCB) ;
|
||||
|
||||
//! Computes the 3-D state of the shape theShape <br>
|
||||
//! toward solid theSolid. <br>
|
||||
//! theTol - value of precision of computation <br>
|
||||
//! theContext- cahed geometrical tools <br>
|
||||
//! Returns 3-D state. <br>
|
||||
Standard_EXPORT
|
||||
static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape,
|
||||
const TopoDS_Solid& theSolid,
|
||||
const Standard_Real theTol,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Computes the 3-D state of the point thePoint <br>
|
||||
//! toward solid theSolid. <br>
|
||||
//! theTol - value of precision of computation <br>
|
||||
//! theContext- cahed geometrical tools <br>
|
||||
//! Returns 3-D state. <br>
|
||||
Standard_EXPORT
|
||||
static TopAbs_State ComputeState(const gp_Pnt& thePoint,
|
||||
const TopoDS_Solid& theSolid,
|
||||
const Standard_Real theTol,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Computes the 3-D state of the vertex theVertex <br>
|
||||
//! toward solid theSolid. <br>
|
||||
//! theTol - value of precision of computation <br>
|
||||
//! theContext- cahed geometrical tools <br>
|
||||
//! Returns 3-D state. <br>
|
||||
Standard_EXPORT
|
||||
static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,
|
||||
const TopoDS_Solid& theSolid,
|
||||
const Standard_Real theTol,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Computes the 3-D state of the edge theEdge <br>
|
||||
//! toward solid theSolid. <br>
|
||||
//! theTol - value of precision of computation <br>
|
||||
//! theContext- cahed geometrical tools <br>
|
||||
//! Returns 3-D state. <br>
|
||||
Standard_EXPORT
|
||||
static TopAbs_State ComputeState(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Solid& theSolid,
|
||||
const Standard_Real theTol,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Computes the 3-D state of the face theFace <br>
|
||||
//! toward solid theSolid. <br>
|
||||
//! theTol - value of precision of computation <br>
|
||||
//! theBounds - set of edges of theFace to avoid <br>
|
||||
//! theContext- cahed geometrical tools <br>
|
||||
//! Returns 3-D state. <br>
|
||||
Standard_EXPORT
|
||||
static TopAbs_State ComputeState(const TopoDS_Face& theFace,
|
||||
const TopoDS_Solid& theSolid,
|
||||
const Standard_Real theTol,
|
||||
const TopTools_IndexedMapOfShape& theBounds,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Returns True if the face theFace is inside of the <br>
|
||||
//! couple of faces theFace1, theFace2. <br>
|
||||
//! The faces theFace, theFace1, theFace2 must <br>
|
||||
//! share the edge theEdge <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Returns True if the face theFace is inside of the <br>
|
||||
//! appropriate couple of faces (from the set theLF) . <br>
|
||||
//! The faces of the set theLF and theFace must <br>
|
||||
//! share the edge theEdge <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopTools_ListOfShape& theLF,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! Returns True if the face theFace is inside the <br>
|
||||
//! solid theSolid. <br>
|
||||
//! theMEF - Map Edge/Faces for theSolid <br>
|
||||
//! theTol - value of precision of computation <br>
|
||||
//! theContext- cahed geometrical tools <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
|
||||
const TopoDS_Solid& theSolid,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
|
||||
const Standard_Real theTol,
|
||||
const Handle(IntTools_Context)& theContext) ;
|
||||
|
||||
//! For the face theFace and its edge theEdge <br>
|
||||
//! finds the face suitable to produce shell. <br>
|
||||
//! theLCEF - set of faces to search. All faces <br>
|
||||
//! from theLCEF must share edge theEdge <br>
|
||||
Standard_EXPORT
|
||||
static void GetFaceOff(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const NMTTools_ListOfCoupleOfShape& theLCEF,
|
||||
TopoDS_Face& theFaceOff) ;
|
||||
|
||||
//! For the face theFace gets the edge theEdgeOnF <br>
|
||||
//! that is the same as theEdge <br>
|
||||
//! Returns True if such edge exists <br>
|
||||
//! Returns False if there is no such edge <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
TopoDS_Edge& theEdgeOnF) ;
|
||||
|
||||
//! Returns True if the face theFace contains <br>
|
||||
//! the edge theEdge but with opposite orientation. <br>
|
||||
//! If the method returns True theEdgeOff is the <br>
|
||||
//! edge founded <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
TopoDS_Edge& theEdgeOff) ;
|
||||
|
||||
//! Computes a point <theP> inside the face <theF>. <br>
|
||||
//! <theP2D> - 2D representation of <theP> <br>
|
||||
//! on the surface of <theF> <br>
|
||||
//! Returns 0 in case of success. <br>
|
||||
Standard_EXPORT
|
||||
static Standard_Integer PntInFace(const TopoDS_Face& theF,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D) ;
|
||||
};
|
||||
#endif
|
@ -1,352 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_Tools_1.cxx
|
||||
// Created: Thu May 6 10:46:21 2010
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_Tools.hxx>
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
#include <IntRes2d_Domain.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
#include <IntRes2d_Transition.hxx>
|
||||
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
static
|
||||
inline Standard_Boolean IsEqual(const TopoDS_Shape& aS1,
|
||||
const TopoDS_Shape& aS2) {
|
||||
return TopTools_ShapeMapHasher::IsEqual(aS1, aS2);
|
||||
}
|
||||
//
|
||||
static
|
||||
Standard_Boolean CorrectWire(const TopoDS_Wire& aW,
|
||||
const TopoDS_Face& aF);
|
||||
|
||||
//=======================================================================
|
||||
//function : CorrectWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GEOMAlgo_Tools::CorrectWires(const TopoDS_Shape& aShape)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
TopoDS_Iterator aItF;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_MapOfShape aMF;
|
||||
GeomAdaptor_Surface aGAS;
|
||||
GeomAbs_SurfaceType aTS;
|
||||
TopLoc_Location aLoc;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
//
|
||||
aExp.Init(aShape, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Face& aF=*((TopoDS_Face*)&aExp.Current());
|
||||
if (aMF.Add(aF)) {
|
||||
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF, aLoc);
|
||||
aGAS.Load(aS);
|
||||
aTS=aGAS.GetType();
|
||||
//modified by NIZNHY-PKV Mon Jul 02 13:58:30 2012f
|
||||
if (aTS==GeomAbs_Cylinder || aTS==GeomAbs_Plane || aTS==GeomAbs_BSplineSurface) {
|
||||
//if (aTS==GeomAbs_Cylinder || aTS==GeomAbs_Plane) {
|
||||
//modified by NIZNHY-PKV Mon Jul 02 13:58:33 2012t
|
||||
aItF.Initialize(aF);
|
||||
for (; aItF.More(); aItF.Next()) {
|
||||
const TopoDS_Wire& aW=*((TopoDS_Wire*)&aItF.Value());
|
||||
if (CorrectWire(aW, aF)) {
|
||||
bRet=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class: GEOMAlgo_InfoEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_InfoEdge {
|
||||
public:
|
||||
//
|
||||
GEOMAlgo_InfoEdge() {
|
||||
myErrorStatus=0;
|
||||
myTolInt=1.0e-10;
|
||||
};
|
||||
//
|
||||
~GEOMAlgo_InfoEdge(){
|
||||
};
|
||||
//
|
||||
void Init(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF);
|
||||
//
|
||||
void SetTolInt(const Standard_Real aTolInt) {
|
||||
myTolInt=aTolInt;
|
||||
};
|
||||
//
|
||||
const Standard_Real TolInt() const {
|
||||
return myTolInt;
|
||||
}
|
||||
//
|
||||
const Geom2dAdaptor_Curve& Adaptor() const {
|
||||
return myGAC2D;
|
||||
}
|
||||
//
|
||||
const IntRes2d_Domain& Domain()const {
|
||||
return myDomain;
|
||||
}
|
||||
//
|
||||
const Handle(Geom2d_Curve)& CurveOnSurface()const {
|
||||
return myC2D;
|
||||
}
|
||||
//
|
||||
const Handle(Geom_Curve)& Curve()const {
|
||||
return myC3D;
|
||||
}
|
||||
//
|
||||
Standard_Integer ErrorStatus()const {
|
||||
return myErrorStatus;
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myErrorStatus;
|
||||
Standard_Real myTolInt;
|
||||
Geom2dAdaptor_Curve myGAC2D;
|
||||
IntRes2d_Domain myDomain;
|
||||
Handle(Geom2d_Curve) myC2D;
|
||||
Handle(Geom_Curve) myC3D;
|
||||
};
|
||||
//
|
||||
typedef NCollection_DataMap<TopoDS_Shape, GEOMAlgo_InfoEdge> GEOMAlgo_DataMapOfShapeInfoEdge;
|
||||
typedef GEOMAlgo_DataMapOfShapeInfoEdge::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeInfoEdge;
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_InfoEdge::Init(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Real aT1, aT2, aT1x, aT2x;
|
||||
gp_Pnt2d aP2D1, aP2D2;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
||||
myC2D=BRep_Tool::CurveOnSurface(aE ,aF, aT1, aT2);
|
||||
if (!myC2D.IsNull() && aT2>aT1) {
|
||||
myGAC2D.Load(myC2D);
|
||||
if(!myGAC2D.IsPeriodic()) {
|
||||
aT1x=myGAC2D.FirstParameter();
|
||||
aT2x=myGAC2D.LastParameter();
|
||||
if(aT1x > aT1) {
|
||||
aT1=aT1x;
|
||||
}
|
||||
if(aT2x < aT2) {
|
||||
aT2=aT2x;
|
||||
}
|
||||
}
|
||||
//
|
||||
BRep_Tool::UVPoints(aE, aF, aP2D1, aP2D2);
|
||||
myDomain.SetValues(aP2D1, aT1, myTolInt, aP2D2, aT2, myTolInt);
|
||||
}
|
||||
else {
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CorrectWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean CorrectWire(const TopoDS_Wire& aW,
|
||||
const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aTolInt;
|
||||
Standard_Integer iErr, aNbV, aNbE;
|
||||
TopoDS_Iterator aItW, aItE;
|
||||
Geom2dInt_GInter aInter;
|
||||
GEOMAlgo_DataMapOfShapeInfoEdge aDMEIE;
|
||||
TopTools_DataMapOfShapeListOfShape aDMVLE;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLE;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aTolInt=1.0e-10;
|
||||
//
|
||||
aItW.Initialize(aW);
|
||||
for (; aItW.More(); aItW.Next()) {
|
||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value());
|
||||
|
||||
aItE.Initialize(aE);
|
||||
for (aNbV=0; aItE.More(); aItE.Next(), ++aNbV) {
|
||||
}
|
||||
if (aNbV<2) {
|
||||
return bRet; //
|
||||
}
|
||||
//
|
||||
if (!aDMEIE.IsBound(aE)) {
|
||||
GEOMAlgo_InfoEdge aInfoEdge;
|
||||
//
|
||||
aInfoEdge.Init (aE, aF);
|
||||
iErr=aInfoEdge.ErrorStatus();
|
||||
if (iErr) {
|
||||
return bRet; //
|
||||
}
|
||||
//
|
||||
aDMEIE.Bind(aE, aInfoEdge);
|
||||
}
|
||||
//
|
||||
aItE.Initialize(aE);
|
||||
for (; aItE.More(); aItE.Next()) {
|
||||
const TopoDS_Shape& aV=aItE.Value();
|
||||
if (aDMVLE.IsBound(aV)) {
|
||||
TopTools_ListOfShape& aLE=aDMVLE.ChangeFind(aV);
|
||||
aLE.Append(aE);
|
||||
}
|
||||
else {
|
||||
TopTools_ListOfShape aLE;
|
||||
aLE.Append(aE);
|
||||
aDMVLE.Bind(aV, aLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2
|
||||
Standard_Real aTolV, aD1, aD2, aDmax, aCoeff;
|
||||
gp_Pnt aPV;
|
||||
Handle(Geom_Surface) aS;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aCoeff=1.1;
|
||||
aS=BRep_Tool::Surface(aF);
|
||||
//
|
||||
aItDMVLE.Initialize(aDMVLE);
|
||||
for(; aItDMVLE.More(); aItDMVLE.Next()) {
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aItDMVLE.Key());
|
||||
const TopTools_ListOfShape& aLE=aItDMVLE.Value();
|
||||
aNbE=aLE.Extent();
|
||||
if (aNbE!=2) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aPV=BRep_Tool::Pnt(aV);
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aLE.First());
|
||||
const GEOMAlgo_InfoEdge& aIE1=aDMEIE.Find(aE1);
|
||||
const Geom2dAdaptor_Curve& aGAC1=aIE1.Adaptor();
|
||||
const IntRes2d_Domain& aDomain1=aIE1.Domain();
|
||||
//
|
||||
const TopoDS_Edge& aE2=*((TopoDS_Edge*)&aLE.Last());
|
||||
const GEOMAlgo_InfoEdge& aIE2=aDMEIE.Find(aE2);
|
||||
const Geom2dAdaptor_Curve& aGAC2=aIE2.Adaptor();
|
||||
const IntRes2d_Domain& aDomain2=aIE2.Domain();
|
||||
//
|
||||
aInter.Perform(aGAC1, aDomain1,aGAC2, aDomain2, aTolInt, aTolInt);
|
||||
if(!aInter.IsDone()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Integer i, aNbP;
|
||||
Standard_Real aIP_ParamOnFirst, aIP_ParamOnSecond, aDTresh, aDT;
|
||||
gp_Pnt aP3D1, aP3D2;
|
||||
gp_Pnt2d aP2D1, aP2D2;
|
||||
IntRes2d_Transition aTr1, aTr2;
|
||||
//
|
||||
aDTresh=0.001;
|
||||
//
|
||||
aNbP=aInter.NbPoints();
|
||||
for (i=1; i<=aNbP; ++i) {
|
||||
const IntRes2d_IntersectionPoint& aIP = aInter.Point(i);
|
||||
aIP_ParamOnFirst = aIP.ParamOnFirst();
|
||||
aIP_ParamOnSecond = aIP.ParamOnSecond();
|
||||
aTr1 =aIP.TransitionOfFirst();
|
||||
aTr2 =aIP.TransitionOfSecond();
|
||||
if(aTr1.PositionOnCurve()==IntRes2d_Middle ||
|
||||
aTr2.PositionOnCurve()==IntRes2d_Middle) {
|
||||
//
|
||||
const Handle(Geom_Curve)& aC3D1=aIE1.Curve();
|
||||
if (!aC3D1.IsNull()) {
|
||||
aP3D1=aC3D1->Value(aIP_ParamOnFirst);
|
||||
}
|
||||
else {
|
||||
aP2D1=aGAC1.Value(aIP_ParamOnFirst);
|
||||
aS->D0(aP2D1.X(), aP2D1.Y(), aP3D1);
|
||||
}
|
||||
//
|
||||
const Handle(Geom_Curve)& aC3D2=aIE2.Curve();
|
||||
if (!aC3D2.IsNull()) {
|
||||
aP3D2=aC3D2->Value(aIP_ParamOnSecond);
|
||||
}
|
||||
else {
|
||||
aP2D2=aGAC2.Value(aIP_ParamOnSecond);
|
||||
aS->D0(aP2D2.X(), aP2D2.Y(), aP3D2);
|
||||
}
|
||||
//
|
||||
aD1=aPV.Distance(aP3D1);
|
||||
aD2=aPV.Distance(aP3D2);
|
||||
aDmax=(aD1>aD2)? aD1 : aD2;
|
||||
if (aDmax>aCoeff*aTolV) {
|
||||
//modified by NIZNHY-PKV Mon Jul 02 13:56:35 2012f
|
||||
aDT=10.*aTolV;
|
||||
if (aDT<aDTresh) {
|
||||
aDT=aDTresh;
|
||||
}
|
||||
if (aDmax<aDT){
|
||||
//if (aDmax<10.*aTolV){
|
||||
//modified by NIZNHY-PKV Mon Jul 02 13:56:40 2012t
|
||||
aBB.UpdateVertex(aV, aDmax);
|
||||
bRet=Standard_True;
|
||||
}
|
||||
}
|
||||
}//
|
||||
}//for (i=1; i<=aNbP; ++i) {
|
||||
}//for(; aItDMVLE.More(); aItDMVLE.Next()) {
|
||||
return bRet;
|
||||
}
|
@ -44,19 +44,16 @@
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
|
||||
#include <BOPTColStd_Dump.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <BooleanOperations_StateOfShape.hxx>
|
||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
||||
|
||||
#include <BOPTools_InterferencePool.hxx>
|
||||
#include <BOPTools_CArray1OfVVInterference.hxx>
|
||||
#include <BOPTools_VVInterference.hxx>
|
||||
#include <BOPTools_PaveFiller.hxx>
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
//
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
//
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_VectorOfInterfVV.hxx>
|
||||
#include <BOPDS_VectorOfInterfVE.hxx>
|
||||
#include <BOPDS_VectorOfInterfVF.hxx>
|
||||
#include <BOPDS_Interf.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_VertexSolid
|
||||
@ -87,28 +84,28 @@ void GEOMAlgo_VertexSolid::Perform()
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
if(!myDSFiller->IsDone()) {
|
||||
if(myDSFiller->ErrorStatus()) {
|
||||
myErrorStatus=11;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bIsNewFiller;
|
||||
Standard_Integer aNbF;
|
||||
Standard_Integer aNbF, aNbArgs;
|
||||
TopTools_IndexedMapOfShape aM;
|
||||
//
|
||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
const TopoDS_Shape& aObj=aDS.Object();
|
||||
const BOPDS_DS& aDS=myDSFiller->DS();
|
||||
const BOPCol_ListOfShape& aLS=aDS.Arguments();
|
||||
aNbArgs=aLS.Extent();
|
||||
if (aNbArgs!=2) {
|
||||
myErrorStatus=14;
|
||||
return;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& aObj=aLS.First();
|
||||
//
|
||||
TopExp::MapShapes(aObj, TopAbs_FACE, aM);
|
||||
aNbF=aM.Extent();
|
||||
myRank=(aNbF) ? 2 : 1;
|
||||
myRank=(aNbF) ? 1 : 0;
|
||||
//
|
||||
bIsNewFiller=myDSFiller->IsNewFiller();
|
||||
|
||||
if (bIsNewFiller) {
|
||||
Prepare();
|
||||
myDSFiller->SetNewFiller(!bIsNewFiller);
|
||||
}
|
||||
BuildResult();
|
||||
}
|
||||
//
|
||||
@ -117,123 +114,102 @@ void GEOMAlgo_VertexSolid::Perform()
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Prepare
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_VertexSolid::Prepare()
|
||||
{
|
||||
Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound;
|
||||
Standard_Real aTol;
|
||||
TopAbs_State aSt;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BooleanOperations_StateOfShape aState;
|
||||
gp_Pnt aP3D;
|
||||
//
|
||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
BooleanOperations_ShapesDataStructure* pDS=(BooleanOperations_ShapesDataStructure*)&aDS;
|
||||
const BOPTools_InterferencePool& aIP=myDSFiller->InterfPool();
|
||||
BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP;
|
||||
BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences();
|
||||
const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller();
|
||||
BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF;
|
||||
const Handle(IntTools_Context)& aCtx=pPF->Context();
|
||||
//
|
||||
const TopoDS_Shape& aObj=aDS.Object();
|
||||
const TopoDS_Shape& aTool=aDS.Tool();
|
||||
//
|
||||
const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
|
||||
//
|
||||
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
|
||||
//
|
||||
iBeg=1;
|
||||
iEnd=aDS.NumberOfShapesOfTheObject();
|
||||
if (myRank==2) {
|
||||
iBeg=iEnd+1;
|
||||
iEnd=aDS.NumberOfSourceShapes();
|
||||
}
|
||||
//
|
||||
for (i=iBeg; i<=iEnd; ++i) {
|
||||
aType=aDS.GetShapeType(i);
|
||||
if (aType!=TopAbs_VERTEX) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aDS.Shape(i));
|
||||
//
|
||||
aState=aDS.GetState(i);
|
||||
if (aState==BooleanOperations_ON ||
|
||||
aState==BooleanOperations_IN ||
|
||||
aState==BooleanOperations_OUT) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
iFound=0;
|
||||
aNbVV=aVVs.Extent();
|
||||
for (j=1; j<=aNbVV; ++j) {
|
||||
BOPTools_VVInterference& aVV=aVVs(j);
|
||||
aVV.Indices(n1, n2);
|
||||
if (n1==i || n2==i) {
|
||||
pDS->SetState (n1, BooleanOperations_ON);
|
||||
pDS->SetState (n2, BooleanOperations_ON);
|
||||
iFound=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iFound) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aP3D=BRep_Tool::Pnt(aV);
|
||||
aTol=1.E-7;
|
||||
aSC.Perform(aP3D, aTol);
|
||||
aSt=aSC.State();
|
||||
if (aSt==TopAbs_IN) {
|
||||
pDS->SetState (i, BooleanOperations_IN);
|
||||
}
|
||||
else if (aSt==TopAbs_OUT) {
|
||||
pDS->SetState (i, BooleanOperations_OUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: BuildResult
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_VertexSolid::BuildResult()
|
||||
{
|
||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
//
|
||||
Standard_Integer i, iBeg, iEnd;
|
||||
Standard_Integer i, iBeg, iEnd, aNbVV, aNbVE, aNbVF, j, iFound, aNbRanges;
|
||||
Standard_Real aTol;
|
||||
TopAbs_State aSt;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BooleanOperations_StateOfShape aState;
|
||||
gp_Pnt aP3D;
|
||||
//
|
||||
myLSIN.Clear();
|
||||
myLSOUT.Clear();
|
||||
myLSON.Clear();
|
||||
//
|
||||
iBeg=1;
|
||||
iEnd=aDS.NumberOfShapesOfTheObject();
|
||||
if (myRank==2) {
|
||||
iBeg=iEnd+1;
|
||||
iEnd=aDS.NumberOfSourceShapes();
|
||||
}
|
||||
const BOPDS_DS& aDS=myDSFiller->DS();
|
||||
BOPDS_DS* pDS=(BOPDS_DS*)&aDS;
|
||||
//
|
||||
BOPDS_VectorOfInterfVV& aVVs=pDS->InterfVV();
|
||||
BOPDS_VectorOfInterfVE& aVEs=pDS->InterfVE();
|
||||
BOPDS_VectorOfInterfVF& aVFs=pDS->InterfVF();
|
||||
//
|
||||
const BOPCol_ListOfShape& aLS=aDS.Arguments();
|
||||
const TopoDS_Shape& aObj=aLS.First();
|
||||
//
|
||||
const TopoDS_Shape& aTool=aLS.Last();
|
||||
const TopoDS_Solid& aSolid=(myRank==0) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
|
||||
//
|
||||
Handle(BOPInt_Context) aCtx=myDSFiller->Context();
|
||||
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
|
||||
//
|
||||
aNbRanges=aDS.NbRanges();
|
||||
const BOPDS_IndexRange& aRange=aDS.Range(myRank);
|
||||
aRange.Indices(iBeg, iEnd);
|
||||
//
|
||||
for (i=iBeg; i<=iEnd; ++i) {
|
||||
aType=aDS.GetShapeType(i);
|
||||
const TopoDS_Shape& aS=aDS.Shape(i);
|
||||
aType=aS.ShapeType();
|
||||
if (aType!=TopAbs_VERTEX) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
const TopoDS_Shape& aV=aDS.Shape(i);
|
||||
aState=aDS.GetState(i);
|
||||
//
|
||||
if (aState==BooleanOperations_IN) {
|
||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aS);
|
||||
//
|
||||
iFound=0;
|
||||
//
|
||||
// 1
|
||||
aNbVV=aVVs.Extent();
|
||||
for (j=0; j<aNbVV; ++j) {
|
||||
BOPDS_InterfVV& aVV=aVVs(j);
|
||||
if (aVV.Contains(i)) {
|
||||
myLSON.Append(aV);
|
||||
iFound=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iFound) {
|
||||
continue;
|
||||
}
|
||||
// 2
|
||||
aNbVE=aVEs.Extent();
|
||||
for (j=0; j<aNbVE; ++j) {
|
||||
BOPDS_InterfVE& aVE=aVEs(j);
|
||||
if (aVE.Contains(i)) {
|
||||
myLSON.Append(aV);
|
||||
iFound=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iFound) {
|
||||
continue;
|
||||
}
|
||||
// 3
|
||||
aNbVF=aVFs.Extent();
|
||||
for (j=0; j<aNbVF; ++j) {
|
||||
BOPDS_InterfVF& aVF=aVFs(j);
|
||||
if (aVF.Contains(i)) {
|
||||
myLSON.Append(aV);
|
||||
iFound=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iFound) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// 4
|
||||
aP3D=BRep_Tool::Pnt(aV);
|
||||
aTol=1.e-7;
|
||||
aSC.Perform(aP3D, aTol);
|
||||
aSt=aSC.State();
|
||||
if (aSt==TopAbs_IN) {
|
||||
myLSIN.Append(aV);
|
||||
}
|
||||
else if (aState==BooleanOperations_OUT) {
|
||||
else if (aSt==TopAbs_OUT) {
|
||||
myLSOUT.Append(aV);
|
||||
}
|
||||
else if (aState==BooleanOperations_ON) {
|
||||
myLSON.Append(aV);
|
||||
}
|
||||
}
|
||||
}//for (i=iBeg; i<iEnd; ++i) {
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShapeSolid.hxx>
|
||||
|
||||
//=======================================================================
|
||||
@ -49,9 +50,6 @@ class GEOMAlgo_VertexSolid : public GEOMAlgo_ShapeSolid
|
||||
virtual void Perform() ;
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void Prepare() ;
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void BuildResult() ;
|
||||
};
|
||||
|
@ -1,429 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: NMTAlgo_WESCorrector.cxx
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_WESCorrector.hxx>
|
||||
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
|
||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <BOP_ConnexityBlock.hxx>
|
||||
#include <BOP_ListIteratorOfListOfConnexityBlock.hxx>
|
||||
|
||||
#include <BOPTColStd_ListOfListOfShape.hxx>
|
||||
#include <BOPTColStd_ListIteratorOfListOfListOfShape.hxx>
|
||||
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <GEOMAlgo_WireSplitter.hxx>
|
||||
#include <GEOMAlgo_WESScaler.hxx>
|
||||
|
||||
static
|
||||
void MakeWire(const TopTools_ListOfShape& aLE,
|
||||
TopoDS_Wire& newWire);
|
||||
|
||||
|
||||
static
|
||||
Standard_Boolean IsToScale(const TopoDS_Face& aF,
|
||||
Standard_Real& aScale);
|
||||
|
||||
//=======================================================================
|
||||
// function:
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
GEOMAlgo_WESCorrector::GEOMAlgo_WESCorrector()
|
||||
:
|
||||
GEOMAlgo_Algo()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: ~
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
GEOMAlgo_WESCorrector::~GEOMAlgo_WESCorrector()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: SetWES
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESCorrector::SetWES (const GEOMAlgo_WireEdgeSet& aWES)
|
||||
{
|
||||
GEOMAlgo_WireEdgeSet* pWES=(GEOMAlgo_WireEdgeSet*) &aWES;
|
||||
myWES=pWES;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: WES
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
GEOMAlgo_WireEdgeSet& GEOMAlgo_WESCorrector::WES ()
|
||||
{
|
||||
return *myWES;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: NewWES
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
GEOMAlgo_WireEdgeSet& GEOMAlgo_WESCorrector::NewWES ()
|
||||
{
|
||||
return myNewWES;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Perform
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESCorrector::Perform()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
DoConnexityBlocks();
|
||||
DoCorrections();
|
||||
}
|
||||
//=======================================================================
|
||||
// function: DoConnexityBlocks
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESCorrector::DoConnexityBlocks()
|
||||
{
|
||||
Standard_Boolean bRegular, bClosed;
|
||||
Standard_Integer i, aNbV, j, aNbC, aNbVP, aNbVS;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
TopoDS_Iterator aItE;
|
||||
TopoDS_Shape aER;
|
||||
TopTools_IndexedMapOfShape aMER, aMEP, aMEC, aMVP;
|
||||
TopTools_IndexedMapOfShape aMVS, aMVAdd;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
//
|
||||
// 1. aMVE;
|
||||
const TopTools_ListOfShape& aLSE=myWES->StartElements();
|
||||
aIt.Initialize(aLSE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if (!aMEP.Contains(aE)) {
|
||||
aMEP.Add(aE);
|
||||
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
}
|
||||
else {
|
||||
aMER.Add(aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2.
|
||||
aNbV=aMVE.Extent();
|
||||
for (i=1; i<=aNbV; ++i) {
|
||||
const TopoDS_Shape& aV=aMVE.FindKey(i);
|
||||
//
|
||||
aNbVS=aMVS.Extent();
|
||||
if (aNbVS==aNbV) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
if (aMVS.Contains(aV)) {
|
||||
continue;
|
||||
}
|
||||
aMVS.Add(aV); // aMVS - globally processed vertices
|
||||
//
|
||||
//------------------------------------- goal: aMEC
|
||||
aMEC.Clear(); // aMEC - edges of CB
|
||||
aMVP.Clear(); // aMVP - vertices to process right now
|
||||
aMVAdd.Clear(); // aMVAdd vertices to process on next step of while(1)
|
||||
//
|
||||
aMVP.Add(aV);
|
||||
//
|
||||
while(1) {
|
||||
aNbVP=aMVP.Extent();
|
||||
for (j=1; j<=aNbVP; ++j) {
|
||||
const TopoDS_Shape& aVP=aMVP(j);
|
||||
const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aVP);
|
||||
aIt.Initialize(aLE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if (aMEC.Contains(aE)) {
|
||||
continue;
|
||||
}
|
||||
aMEC.Add(aE);
|
||||
//
|
||||
aItE.Initialize(aE);
|
||||
for (; aItE.More(); aItE.Next()) {
|
||||
const TopoDS_Shape& aVE=aItE.Value();
|
||||
if (!aMVS.Contains(aVE)) {
|
||||
aMVS.Add(aVE);
|
||||
aMVAdd.Add(aVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}//for (j=1; j<=aNbVP; ++j)
|
||||
//
|
||||
aNbVP=aMVAdd.Extent();
|
||||
if (!aNbVP) {
|
||||
break; // from while(1)
|
||||
}
|
||||
//
|
||||
aMVP.Clear();
|
||||
for (j=1; j<=aNbVP; ++j) {
|
||||
const TopoDS_Shape& aVE=aMVAdd(j);
|
||||
aMVP.Add(aVE);
|
||||
}
|
||||
aMVAdd.Clear();
|
||||
}// while(1) {
|
||||
//-------------------------------------
|
||||
BOP_ConnexityBlock aCB;
|
||||
TopTools_ListOfShape aLEC;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMVER;
|
||||
//
|
||||
bRegular=Standard_True;
|
||||
//
|
||||
aNbC=aMEC.Extent();
|
||||
for (j=1; j<=aNbC; ++j) {
|
||||
aER=aMEC(j);
|
||||
//
|
||||
if (aMER.Contains(aER)) {
|
||||
aER.Orientation(TopAbs_FORWARD);
|
||||
aLEC.Append(aER);
|
||||
aER.Orientation(TopAbs_REVERSED);
|
||||
aLEC.Append(aER);
|
||||
//
|
||||
bRegular=Standard_False;
|
||||
}
|
||||
else {
|
||||
aLEC.Append(aER);
|
||||
}
|
||||
//
|
||||
if (bRegular) {
|
||||
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aER);
|
||||
if (!BRep_Tool::Degenerated(aEx)) {
|
||||
TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER);
|
||||
}
|
||||
}
|
||||
}//for (j=1; j<=aNbC; ++j) {
|
||||
//
|
||||
if (bRegular) {
|
||||
Standard_Integer k, aNbVR, aNbER;
|
||||
//
|
||||
aNbVR=aMVER.Extent();
|
||||
for (k=1; k<=aNbVR; ++k) {
|
||||
const TopTools_ListOfShape& aLER=aMVER(k);
|
||||
aNbER=aLER.Extent();
|
||||
if (aNbER==1) {
|
||||
const TopoDS_Edge& aEx=TopoDS::Edge(aER);
|
||||
bClosed=BRep_Tool::IsClosed(aEx, myWES->Face());
|
||||
if (!bClosed) {
|
||||
bRegular=!bRegular;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aNbER>2) {
|
||||
bRegular=!bRegular;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aCB.SetShapes(aLEC);
|
||||
aCB.SetRegularity(bRegular);
|
||||
myConnexityBlocks.Append(aCB);
|
||||
aMEC.Clear();
|
||||
}//for (i=1; i<=aNbV; ++i) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: DoCorrections
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESCorrector::DoCorrections()
|
||||
{
|
||||
Standard_Boolean bIsRegular, bIsNothingToDo, bToScale;
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aScale;
|
||||
TopoDS_Wire aW;
|
||||
BOP_ListIteratorOfListOfConnexityBlock aCBIt;
|
||||
GEOMAlgo_WESScaler aWSC;
|
||||
//
|
||||
const TopoDS_Face& aF=myWES->Face();
|
||||
//
|
||||
bToScale=IsToScale(aF, aScale);
|
||||
//
|
||||
myNewWES.SetFace(aF);
|
||||
aCBIt.Initialize(myConnexityBlocks);
|
||||
for (; aCBIt.More(); aCBIt.Next()) {
|
||||
const BOP_ConnexityBlock& aCB=aCBIt.Value();
|
||||
const TopTools_ListOfShape& aLE=aCB.Shapes();
|
||||
//
|
||||
bIsRegular=aCB.IsRegular();
|
||||
if (bIsRegular) {
|
||||
MakeWire(aLE, aW);
|
||||
myNewWES.AddShape (aW);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
GEOMAlgo_WireSplitter aWS;
|
||||
//
|
||||
if(bToScale) {
|
||||
TopoDS_Shape aE;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
BOPTColStd_ListIteratorOfListOfListOfShape aItLLSS;
|
||||
//
|
||||
aWSC.SetScale(aScale);
|
||||
aWSC.SetFace(aF);
|
||||
aWSC.SetEdges(aLE);
|
||||
//
|
||||
aWSC.Perform();
|
||||
iErr=aWSC.ErrorStatus();
|
||||
if (iErr) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& aFS=aWSC.FaceScaled();
|
||||
const TopTools_ListOfShape& aLES=aWSC.EdgesScaled();
|
||||
//
|
||||
aWS.SetFace(aFS);
|
||||
aWS.SetEdges(aLES);
|
||||
//
|
||||
aWS.Perform();
|
||||
iErr=aWS.ErrorStatus();
|
||||
if (iErr) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bIsNothingToDo=aWS.IsNothingToDo();
|
||||
if (bIsNothingToDo) {
|
||||
MakeWire(aLE, aW);
|
||||
myNewWES.AddShape (aW);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPTColStd_ListOfListOfShape& aLLSS=aWS.Shapes();
|
||||
aItLLSS.Initialize(aLLSS);
|
||||
for (; aItLLSS.More(); aItLLSS.Next()) {
|
||||
TopTools_ListOfShape aLS;
|
||||
//
|
||||
const TopTools_ListOfShape& aLSS=aItLLSS.Value();
|
||||
aIt.Initialize(aLSS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aES=aIt.Value();
|
||||
aE=aWSC.Origin(aES);
|
||||
aLS.Append(aE);
|
||||
}
|
||||
//
|
||||
MakeWire(aLS, aW);
|
||||
myNewWES.AddShape (aW);
|
||||
}
|
||||
}//if(bToScale)
|
||||
//
|
||||
else {
|
||||
aWS.SetFace(aF);
|
||||
aWS.SetEdges(aLE);
|
||||
//
|
||||
aWS.Perform();
|
||||
iErr=aWS.ErrorStatus();
|
||||
if (iErr) {
|
||||
continue;
|
||||
}
|
||||
bIsNothingToDo=aWS.IsNothingToDo();
|
||||
if (bIsNothingToDo) {
|
||||
MakeWire(aLE, aW);
|
||||
myNewWES.AddShape (aW);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPTColStd_ListOfListOfShape& aSSS=aWS.Shapes();
|
||||
//
|
||||
BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS);
|
||||
for (; aWireIt.More(); aWireIt.Next()) {
|
||||
const TopTools_ListOfShape& aLEx=aWireIt.Value();
|
||||
//
|
||||
MakeWire(aLEx, aW);
|
||||
myNewWES.AddShape (aW);
|
||||
}
|
||||
}// else
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: MakeWire
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void MakeWire(const TopTools_ListOfShape& aLE,
|
||||
TopoDS_Wire& newWire)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
aBB.MakeWire(newWire);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape anIt(aLE);
|
||||
for (; anIt.More(); anIt.Next()){
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
|
||||
aBB.Add(newWire, aE);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsToScale
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsToScale(const TopoDS_Face& aF,
|
||||
Standard_Real& aScale)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aV1, aV2, dV, aTr;
|
||||
GeomAbs_SurfaceType aType;
|
||||
BRepAdaptor_Surface aBAS;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aScale=1.;
|
||||
//
|
||||
aBAS.Initialize(aF);
|
||||
aType=aBAS.GetType();
|
||||
if (aType==GeomAbs_Cylinder) {
|
||||
aTr=1.e5;
|
||||
aV1=aBAS.FirstVParameter();
|
||||
aV2=aBAS.LastVParameter();
|
||||
dV=aV2-aV1;
|
||||
//
|
||||
if (dV>aTr) {
|
||||
bRet=!bRet;
|
||||
aScale=1./aTr;
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: NMTAlgo_WESCorrector.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
#ifndef _GEOMAlgo_WESCorrector_HeaderFile
|
||||
#define _GEOMAlgo_WESCorrector_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <GEOMAlgo_PWireEdgeSet.hxx>
|
||||
#include <GEOMAlgo_WireEdgeSet.hxx>
|
||||
#include <BOP_ListOfConnexityBlock.hxx>
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
|
||||
|
||||
//! The algorithm to change the Wire Edges Set (WES) contents. <br>
|
||||
//! The NewWES will contain only wires instead of wires and edges. <br>
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_WESCorrector
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_WESCorrector : public GEOMAlgo_Algo
|
||||
{
|
||||
public:
|
||||
//! Empty constructor; <br>
|
||||
//! <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_WESCorrector();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_WESCorrector();
|
||||
|
||||
//! Modifier <br>
|
||||
Standard_EXPORT
|
||||
void SetWES(const GEOMAlgo_WireEdgeSet& aWES) ;
|
||||
|
||||
//! Performs the algorithm that consists of two steps <br>
|
||||
//! 1. Make conexity blocks ( DoConnexityBlocks() ) <br>
|
||||
//! 2. Make corrections ( DoCorrections() ) <br>
|
||||
Standard_EXPORT
|
||||
virtual void Perform() ;
|
||||
|
||||
//! Selector <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_WireEdgeSet& WES() ;
|
||||
|
||||
//! Selector <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_WireEdgeSet& NewWES() ;
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
void DoConnexityBlocks() ;
|
||||
|
||||
Standard_EXPORT
|
||||
void DoCorrections() ;
|
||||
|
||||
|
||||
GEOMAlgo_PWireEdgeSet myWES;
|
||||
GEOMAlgo_WireEdgeSet myNewWES;
|
||||
BOP_ListOfConnexityBlock myConnexityBlocks;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,267 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_WESScaler.cxx
|
||||
// Created:
|
||||
// Author:
|
||||
// <pkv@VORTEX>
|
||||
|
||||
|
||||
#include <GEOMAlgo_WESScaler.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_WESScaler::GEOMAlgo_WESScaler()
|
||||
:
|
||||
GEOMAlgo_Algo()
|
||||
{
|
||||
myScale=1.;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_WESScaler::~GEOMAlgo_WESScaler()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: SetScale
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESScaler::SetScale (const Standard_Real aScale)
|
||||
{
|
||||
myScale=aScale;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Scale
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
Standard_Real GEOMAlgo_WESScaler::Scale()const
|
||||
{
|
||||
return myScale;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: SetFace
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESScaler::SetFace(const TopoDS_Face& aF)
|
||||
{
|
||||
myFace=aF;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Face
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const TopoDS_Face& GEOMAlgo_WESScaler::Face()const
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: SetEdges
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESScaler::SetEdges(const TopTools_ListOfShape& aLE)
|
||||
{
|
||||
myEdges=aLE;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Edges
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_WESScaler::Edges()const
|
||||
{
|
||||
return myEdges;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FaceScaled
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const TopoDS_Face& GEOMAlgo_WESScaler::FaceScaled()const
|
||||
{
|
||||
return myFaceScaled;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: EdgesScaled
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& GEOMAlgo_WESScaler::EdgesScaled()const
|
||||
{
|
||||
return myEdgesScaled;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Image
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& GEOMAlgo_WESScaler::Image (const TopoDS_Shape& aS) const
|
||||
{
|
||||
if (myImages.IsBound(aS)) {
|
||||
return myImages.Find(aS);
|
||||
}
|
||||
return myShapeTmp;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Origin
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& GEOMAlgo_WESScaler::Origin (const TopoDS_Shape& aS) const
|
||||
{
|
||||
if (myOrigins.IsBound(aS)) {
|
||||
return myOrigins.Find(aS);
|
||||
}
|
||||
return myShapeTmp;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Images
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const GEOMAlgo_DataMapOfOrientedShapeShape& GEOMAlgo_WESScaler::Images () const
|
||||
{
|
||||
return myImages;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Origins
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const GEOMAlgo_DataMapOfOrientedShapeShape& GEOMAlgo_WESScaler::Origins () const
|
||||
{
|
||||
return myOrigins;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: CheckData
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESScaler::CheckData()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
if(myFace.IsNull()) {
|
||||
myErrorStatus=2;
|
||||
return;
|
||||
}
|
||||
if(!myEdges.Extent()) {
|
||||
myErrorStatus=3;
|
||||
return;
|
||||
}
|
||||
if (myScale<=0.){
|
||||
myErrorStatus=4;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Perform
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_WESScaler::Perform()
|
||||
{
|
||||
Standard_Boolean bIsDone;
|
||||
Standard_Integer i;
|
||||
gp_Pnt aP;
|
||||
gp_Trsf aTrsf;
|
||||
TopAbs_Orientation aOr;
|
||||
TopoDS_Shape aFC, aFR, aER;
|
||||
TopoDS_Wire aWE;
|
||||
TopoDS_Iterator aItS;
|
||||
BRep_Builder aBB;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
// 0. CheckData
|
||||
CheckData();
|
||||
if(myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
myImages.Clear();
|
||||
myOrigins.Clear();
|
||||
myEdgesScaled.Clear();
|
||||
//
|
||||
// 1. aFC
|
||||
aFC=myFace.EmptyCopied();
|
||||
//
|
||||
aBB.MakeWire(aWE);
|
||||
aIt.Initialize(myEdges);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
aBB.Add(aWE, aE);
|
||||
}
|
||||
aBB.Add(aFC, aWE);
|
||||
//
|
||||
aItS.Initialize(myFace);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aW=aItS.Value();
|
||||
aBB.Add(aFC, aW);
|
||||
}
|
||||
//
|
||||
// 2. Scale aFC
|
||||
aP.SetCoord(0.,0.,0.);
|
||||
aTrsf.SetScale(aP, myScale);
|
||||
//
|
||||
BRepBuilderAPI_Transform aBT(aTrsf);
|
||||
aBT.Perform(aFC);
|
||||
bIsDone=aBT.IsDone();
|
||||
if (!bIsDone) {
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSR=aBT.Shape();
|
||||
//
|
||||
// Refined image face FR
|
||||
aFR=aSR.EmptyCopied();
|
||||
aItS.Initialize(aSR);
|
||||
for (i=0; aItS.More(); aItS.Next(),++i) {
|
||||
const TopoDS_Shape& aWR=aItS.Value();
|
||||
if (i) {
|
||||
aBB.Add(aFR, aWR);
|
||||
}
|
||||
}
|
||||
myFaceScaled=*((TopoDS_Face*)&aFR);
|
||||
//
|
||||
// 3. Fill Images, Origins, EdgesScaled
|
||||
aIt.Initialize(myEdges);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
aOr=aE.Orientation();
|
||||
//
|
||||
aER=aBT.ModifiedShape(aE);
|
||||
if(aER.IsNull()) {
|
||||
myErrorStatus=11;
|
||||
return;
|
||||
}
|
||||
//
|
||||
aER.Orientation(aOr);
|
||||
myImages.Bind(aE, aER);
|
||||
myOrigins.Bind(aER, aE);
|
||||
//
|
||||
myEdgesScaled.Append(aER);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user