# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
GEOMArchimede BREPExport BREPImport BlockFix GEOMbasic GEOMAlgo GEOMClient GEOMImpl
- GEOMUtils GEOMEngine GEOM_SupervEngine IGESExport IGESImport NMTDS NMTTools GEOMSketcher
+ GEOMUtils GEOMEngine GEOM_SupervEngine IGESExport IGESImport GEOMSketcher
SalomeIDLGEOM STEPExport STEPImport STLExport ShHealOper
)
IF(SALOME_BUILD_GUI)
FIND_LIBRARY(IGESExport IGESExport ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(IGESImport IGESImport ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(MeasureGUI MeasureGUI ${GEOM_ROOT_DIR}/lib/salome)
-FIND_LIBRARY(NMTDS NMTDS ${GEOM_ROOT_DIR}/lib/salome)
-FIND_LIBRARY(NMTTools NMTTools ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(OCC2VTK OCC2VTK ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(OperationGUI OperationGUI ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(PrimitiveGUI PrimitiveGUI ${GEOM_ROOT_DIR}/lib/salome)
SET(GEOM_GEOM_SupervEngine GEOM_SupervEngine)
SET(GEOM_IGESExport IGESExport)
SET(GEOM_IGESImport IGESImport)
-SET(GEOM_NMTDS NMTDS)
-SET(GEOM_NMTTools NMTTools)
SET(GEOM_GEOMSketcher GEOMSketcher)
SET(GEOM_SalomeIDLGeom SalomeIDLGeom)
SET(GEOM_STEPExport STEPExport)
${PROJECT_SOURCE_DIR}/src/GEOM
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
${PROJECT_SOURCE_DIR}/src/GEOM_I
- ${PROJECT_SOURCE_DIR}/src/NMTTools
- ${PROJECT_SOURCE_DIR}/src/NMTDS
${PROJECT_SOURCE_DIR}/src/GEOMUtils
${PROJECT_BINARY_DIR}/idl
${CMAKE_CURRENT_SOURCE_DIR}
#include "GEOMImpl_IPipeTShape.hxx"
#include "GEOMImpl_DividedDiskDriver.hxx"
#include "GEOMImpl_IDividedDisk.hxx"
-// #include "GEOMImpl_DividedCylinderDriver.hxx"
-// #include "GEOMImpl_IDividedCylinder.hxx"
#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
#include <GEOMImpl_ISmoothingSurface.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
#include <GC_MakeConicalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
+#include <ShapeAnalysis_Edge.hxx>
+
#include <cmath>
#include "AdvancedEngine_Types.hxx"
// Build tools for partition operation:
// 1 face and 2 planes
// Face
- Handle(GEOM_Object) arete_intersect_int;
+ Handle(GEOM_Object) arete_intersect_int, arete_intersect_ext;
Handle(GEOM_Object) wire_t, wire_t2, face_t, face_t2;
Handle(GEOM_Object) chan_racc;
Handle(GEOM_Object) vi1, vi2;
return false;
}
+ double d1min = theR2+theW2, d2min=theR2+theW2;
for (int i = 1; i <= vertices_i->Length(); i++) {
Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_i->Value(i));
v->GetLastFunction()->SetDescription("");
TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
gp_Pnt aP = BRep_Tool::Pnt(aVertex);
-// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl;
if (Abs(aP.X()) <= Precision::Confusion()) {
- if (Abs(aP.Y()) - theR1 <= Precision::Confusion()) {
+ if (Abs(aP.Y()) < d1min) {
vi1 = v;
- }
+ d1min = Abs(aP.Y());
+ }
} else if (Abs(aP.Y()) <= Precision::Confusion()) {
- if (Abs(aP.X()) - theR1 <= Precision::Confusion()) {
- vi2 = v;
+ if (Abs(aP.X()) < d2min) {
+ vi2 = v;
+ d2min = Abs(aP.X());
}
}
}
+ if (vi1.IsNull() || vi2.IsNull()) {
+ SetErrorCode("Cannot find internal intersection vertices");
+ return false;
+ }
std::list<Handle(GEOM_Object)> theShapes;
if (isNormal) {
Handle(GEOM_Object) ve1, ve2;
+ TopoDS_Vertex vertex1, vertex2;
Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ(aR2Ext, aR2Ext, aR1Ext);
box_e->GetLastFunction()->SetDescription("");
box_e = myTransformOperations->TranslateDXDYDZ(box_e, -aR2Ext, -aR2Ext, 0);
box_e->GetLastFunction()->SetDescription("");
- // Common edges on external cylinder
- aFunction = theShape->GetLastFunction();
- theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) edges_e =
- myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- SetErrorCode("External edges not found");
- return false;
- }
- for (int i=1; i<=edges_e->Length();i++) {
- Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
- anObj->GetLastFunction()->SetDescription("");
- }
// search for vertices located on both external pipes
aFunction = theShape->GetLastFunction();
return false;
}
+ double d1max = 0, d2max = 0;
for (int i = 1; i <= vertices_e->Length(); i++) {
Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_e->Value(i));
v->GetLastFunction()->SetDescription("");
TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
gp_Pnt aP = BRep_Tool::Pnt(aVertex);
-// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl;
if (Abs(aP.X()) <= Precision::Confusion()) {
- if (Abs(aP.Y()) - theR2 > Precision::Confusion()) {
+ if (Abs(aP.Y()) > d1max) {
ve1 = v;
+ vertex1 = aVertex;
+ d1max = Abs(aP.Y());
}
} else if (Abs(aP.Y()) <= Precision::Confusion()) {
- if (Abs(aP.X()) - theR2 > Precision::Confusion()) {
+ if (Abs(aP.X()) > d2max) {
ve2 = v;
+ vertex2 = aVertex;
+ d2max = Abs(aP.X());
}
}
- if ( !ve1.IsNull() && !ve2.IsNull())
- break;
+ }
+ if (ve1.IsNull() || ve2.IsNull()) {
+ SetErrorCode("Cannot find external intersection vertices");
+ return false;
}
Handle(GEOM_Object) edge_e1, edge_e2;
+ // Common edges on external cylinder
+ aFunction = theShape->GetLastFunction();
+ theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) edges_e =
+ myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ SetErrorCode("External edges not found");
+ return false;
+ }
+ ShapeAnalysis_Edge sae;
+ for (int i=1; i<=edges_e->Length();i++) {
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+ anObj->GetLastFunction()->SetDescription("");
+ TopoDS_Edge anEdge = TopoDS::Edge(anObj->GetValue());
+ if ( !anEdge.IsNull() &&
+ (sae.FirstVertex(anEdge).IsSame(vertex1) || sae.LastVertex(anEdge).IsSame(vertex1)) &&
+ (sae.FirstVertex(anEdge).IsSame(vertex2) || sae.LastVertex(anEdge).IsSame(vertex2))) {
+ arete_intersect_ext = anObj;
+ }
+ }
+
edge_e1 = myBasicOperations->MakeLineTwoPnt(ve1, vi1);
if (edge_e1.IsNull()) {
SetErrorCode("Edge 1 could not be built");
std::list<Handle(GEOM_Object)> edge_e_elist;
edge_e_elist.push_back(arete_intersect_int);
edge_e_elist.push_back(edge_e1);
- edge_e_elist.push_back(Handle(GEOM_Object)::DownCast(edges_e->Value(1)));
+ edge_e_elist.push_back(arete_intersect_ext);
edge_e_elist.push_back(edge_e2);
wire_t = myShapesOperations->MakeWire(edge_e_elist, 1e-7);
if (wire_t.IsNull()) {
TopoDS_Shape aTool2 = BRepBuilderAPI_MakeFace(aPln2, -aSize, +aSize, -aSize, +aSize).Shape();
GEOMAlgo_Splitter PS;
- PS.AddShape(aReduction);
+ PS.AddArgument(aReduction);
if (isThinPart)
- PS.AddShape(aThinPart);
+ PS.AddArgument(aThinPart);
PS.AddTool(aTool1);
PS.AddTool(aTool2);
PS.SetLimit(TopAbs_SOLID);
# Common packages
##
SET(SUBDIRS_COMMON
- ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER GEOM BREPExport
+ ARCHIMEDE BlockFix GEOMAlgo SKETCHER GEOM BREPExport
BREPImport IGESExport IGESImport STEPExport STEPImport STLExport
ShHealOper GEOMUtils GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY
)
INCLUDE_DIRECTORIES(
${CAS_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
- ${PROJECT_SOURCE_DIR}/src/NMTTools
- ${PROJECT_SOURCE_DIR}/src/NMTDS
${CMAKE_CURRENT_SOURCE_DIR}
)
SET(_link_LIBRARIES
${CAS_KERNEL} ${CAS_TKBool} ${CAS_BO} ${CAS_TKMesh}
${KERNEL_SALOMELocalTrace}
- NMTTools NMTDS
)
# --- headers ---
SET(GEOMAlgo_HEADERS
GEOMAlgo_Algo.hxx
- GEOMAlgo_BuilderArea.hxx
- GEOMAlgo_BuilderFace.hxx
- GEOMAlgo_Builder.hxx
+ GEOMAlgo_AlgoTools.hxx
+ GEOMAlgo_BndSphere.hxx
+ GEOMAlgo_BndSphereTree.hxx
+ GEOMAlgo_BoxBndTree.hxx
GEOMAlgo_BuilderShape.hxx
- GEOMAlgo_BuilderSolid.hxx
- GEOMAlgo_BuilderTools.hxx
- GEOMAlgo_ClsfBox.hxx
GEOMAlgo_Clsf.hxx
+ GEOMAlgo_ClsfBox.hxx
GEOMAlgo_ClsfSolid.hxx
GEOMAlgo_ClsfSurf.hxx
GEOMAlgo_CoupleOfShapes.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx
- GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx
- GEOMAlgo_DataMapOfOrientedShapeShape.hxx
GEOMAlgo_DataMapOfPassKeyInteger.hxx
- GEOMAlgo_DataMapOfPassKeyShapeShape.hxx
- GEOMAlgo_DataMapOfRealListOfShape.hxx
GEOMAlgo_DataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapOfShapePnt.hxx
- GEOMAlgo_DataMapOfShapeReal.hxx
- GEOMAlgo_DataMapOfShapeShapeSet.hxx
+ GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOn1.hxx
GEOMAlgo_FinderShapeOn2.hxx
- GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_GetInPlace.hxx
GEOMAlgo_GlueAnalyser.hxx
GEOMAlgo_GlueDetector.hxx
+ GEOMAlgo_Gluer.hxx
GEOMAlgo_Gluer2.hxx
GEOMAlgo_GluerAlgo.hxx
- GEOMAlgo_Gluer.hxx
GEOMAlgo_HAlgo.hxx
GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
+ GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
GEOMAlgo_IndexedDataMapOfShapeBox.hxx
+ GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_PassKeyMapHasher.hxx
GEOMAlgo_PassKeyShape.hxx
GEOMAlgo_PassKeyShapeMapHasher.hxx
- GEOMAlgo_PWireEdgeSet.hxx
GEOMAlgo_RemoverWebs.hxx
GEOMAlgo_ShapeAlgo.hxx
GEOMAlgo_ShapeInfo.hxx
GEOMAlgo_ShapeInfoFiller.hxx
- GEOMAlgo_ShapeSet.hxx
GEOMAlgo_ShapeSolid.hxx
GEOMAlgo_ShellSolid.hxx
GEOMAlgo_SolidSolid.hxx
GEOMAlgo_Splitter.hxx
- GEOMAlgo_StateCollector.hxx
GEOMAlgo_State.hxx
+ GEOMAlgo_StateCollector.hxx
GEOMAlgo_SurfaceTools.hxx
- GEOMAlgo_Tools3D.hxx
- GEOMAlgo_Tools.hxx
GEOMAlgo_VertexSolid.hxx
- GEOMAlgo_WESCorrector.hxx
- GEOMAlgo_WESScaler.hxx
- GEOMAlgo_WireEdgeSet.hxx
GEOMAlgo_WireSolid.hxx
- GEOMAlgo_WireSplitter.hxx
)
# --- sources ---
SET(GEOMAlgo_SOURCES
GEOMAlgo_Algo.cxx
- GEOMAlgo_Builder_0.cxx
- GEOMAlgo_Builder_1.cxx
- GEOMAlgo_Builder_2.cxx
- GEOMAlgo_Builder_3.cxx
- GEOMAlgo_Builder_4.cxx
- GEOMAlgo_BuilderArea.cxx
- GEOMAlgo_Builder.cxx
- GEOMAlgo_BuilderFace.cxx
+ GEOMAlgo_AlgoTools.cxx
+ GEOMAlgo_AlgoTools_1.cxx
+ GEOMAlgo_BndSphere.cxx
+ GEOMAlgo_BndSphereTree.cxx
+ GEOMAlgo_BoxBndTree.cxx
GEOMAlgo_BuilderShape.cxx
- GEOMAlgo_BuilderSolid.cxx
- GEOMAlgo_BuilderTools.cxx
- GEOMAlgo_ClsfBox.cxx
GEOMAlgo_Clsf.cxx
+ GEOMAlgo_ClsfBox.cxx
GEOMAlgo_ClsfSolid.cxx
GEOMAlgo_ClsfSurf.cxx
GEOMAlgo_CoupleOfShapes.cxx
+ GEOMAlgo_FinderShapeOn.cxx
GEOMAlgo_FinderShapeOn1.cxx
GEOMAlgo_FinderShapeOn2.cxx
- GEOMAlgo_FinderShapeOn.cxx
GEOMAlgo_FinderShapeOnQuad.cxx
+ GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GetInPlace_1.cxx
GEOMAlgo_GetInPlace_2.cxx
GEOMAlgo_GetInPlace_3.cxx
- GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GlueAnalyser.cxx
GEOMAlgo_GlueDetector.cxx
+ GEOMAlgo_Gluer.cxx
+ GEOMAlgo_Gluer2.cxx
GEOMAlgo_Gluer2_1.cxx
GEOMAlgo_Gluer2_2.cxx
GEOMAlgo_Gluer2_3.cxx
- GEOMAlgo_Gluer2.cxx
GEOMAlgo_GluerAlgo.cxx
- GEOMAlgo_Gluer.cxx
GEOMAlgo_HAlgo.cxx
GEOMAlgo_PassKey.cxx
GEOMAlgo_PassKeyMapHasher.cxx
GEOMAlgo_RemoverWebs.cxx
GEOMAlgo_ShapeAlgo.cxx
GEOMAlgo_ShapeInfo.cxx
- GEOMAlgo_ShapeInfoFiller_1.cxx
GEOMAlgo_ShapeInfoFiller.cxx
- GEOMAlgo_ShapeSet.cxx
+ GEOMAlgo_ShapeInfoFiller_1.cxx
GEOMAlgo_ShapeSolid.cxx
- GEOMAlgo_ShellSolid.cxx
+ GEOMAlgo_ShellSolid.cxx
GEOMAlgo_SolidSolid.cxx
GEOMAlgo_Splitter.cxx
GEOMAlgo_StateCollector.cxx
GEOMAlgo_SurfaceTools.cxx
- GEOMAlgo_Tools_1.cxx
- GEOMAlgo_Tools3D.cxx
- GEOMAlgo_Tools.cxx
GEOMAlgo_VertexSolid.cxx
- GEOMAlgo_WESCorrector.cxx
- GEOMAlgo_WESScaler.cxx
- GEOMAlgo_WireEdgeSet.cxx
GEOMAlgo_WireSolid.cxx
- GEOMAlgo_WireSplitter.cxx
)
# --- rules ---
-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_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_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_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_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_ListOfPnt.hxx
+GEOMAlgo_ListIteratorOfListOfPnt.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_RemoverWebs.hxx
GEOMAlgo_RemoverWebs.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_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_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapOfShapePnt.hxx
-GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx
-GEOMAlgo_IndexedDataMapOfShapeBox.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
-GEOMAlgo_IndexedDataMapOfShapeState.hxx
-GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
-GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
+
+Basics_OCCTVersion.hxx
---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;
imported KindOfName from GEOMAlgo;
imported KindOfBounds from GEOMAlgo;
imported KindOfClosed 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
- imported Gluer2 from GEOMAlgo;
- imported GlueDetector from GEOMAlgo;
- imported GluerAlgo from GEOMAlgo;
- imported GetInPlace from GEOMAlgo;
+ --
+
+
+ --
-- Algos
imported RemoverWebs from GEOMAlgo;
- 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 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;
- imported Algo 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;
imported IndexedDataMapOfShapeState from GEOMAlgo;
imported IndexedDataMapOfIntegerShape from GEOMAlgo;
imported IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo;
-
+
end GEOMAlgo;
// function:
// purpose:
//=======================================================================
- GEOMAlgo_Algo::GEOMAlgo_Algo()
+GEOMAlgo_Algo::GEOMAlgo_Algo()
:
myErrorStatus(1),
myWarningStatus(0),
// function: ~
// purpose:
//=======================================================================
- GEOMAlgo_Algo::~GEOMAlgo_Algo()
+GEOMAlgo_Algo::~GEOMAlgo_Algo()
{
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
- void GEOMAlgo_Algo::CheckData()
+void GEOMAlgo_Algo::CheckData()
{
myErrorStatus=0;
}
// function: CheckResult
// purpose:
//=======================================================================
- void GEOMAlgo_Algo::CheckResult()
+void GEOMAlgo_Algo::CheckResult()
{
myErrorStatus=0;
}
// function: ErrorStatus
// purpose:
//=======================================================================
- Standard_Integer GEOMAlgo_Algo::ErrorStatus()const
+Standard_Integer GEOMAlgo_Algo::ErrorStatus()const
{
return myErrorStatus;
}
// function: WarningStatus
// purpose:
//=======================================================================
- Standard_Integer GEOMAlgo_Algo::WarningStatus()const
+Standard_Integer GEOMAlgo_Algo::WarningStatus()const
{
return myWarningStatus;
}
//function : ComputeInternalShapes
//purpose :
//=======================================================================
- void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
+void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
{
myComputeInternalShapes = theFlag;
}
--- /dev/null
+// 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.cxx
+// Created :
+// Author : Peter KURNEV
+
+#include <GEOMAlgo_AlgoTools.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Dir2d.hxx>
+#include <Bnd_Box.hxx>
+
+#include <Geom2d_Curve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+
+#include <Geom2dHatch_Intersector.hxx>
+#include <Geom2dHatch_Hatcher.hxx>
+
+#include <Geom2dAdaptor_Curve.hxx>
+#include <HatchGen_Domain.hxx>
+
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+
+#include <GeomAdaptor_Surface.hxx>
+
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+
+#include <Poly_Triangulation.hxx>
+
+#include <TopAbs_Orientation.hxx>
+
+#include <TopLoc_Location.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <TopExp_Explorer.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+
+#include <BRepTools.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+
+#include <IntTools_Tools.hxx>
+
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <IntTools_Tools.hxx>
+
+#include <BOPTools_AlgoTools3D.hxx>
+#include <BOPTools_AlgoTools2D.hxx>
+
+#include <GEOMAlgo_PassKeyShape.hxx>
+
+
+static
+ void GetCount(const TopoDS_Shape& aS,
+ Standard_Integer& iCnt);
+static
+ void CopySource(const TopoDS_Shape& aS,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
+ TopoDS_Shape& aSC);
+
+//=======================================================================
+//function : CopyShape
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
+ TopoDS_Shape& aSC)
+{
+ TopTools_IndexedDataMapOfShapeShape aMapSS;
+ //
+ CopySource(aS, aMapSS, aSC);
+}
+//=======================================================================
+//function : CopyShape
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
+ TopoDS_Shape& aSC,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS)
+{
+ CopySource(aS, aMapSS, aSC);
+}
+//=======================================================================
+//function : CopySource
+//purpose :
+//=======================================================================
+void CopySource(const TopoDS_Shape& aS,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
+ TopoDS_Shape& aSC)
+{
+ Standard_Boolean bFree;
+ TopAbs_ShapeEnum aT;
+ TopoDS_Iterator aIt;
+ TopoDS_Shape aSF;
+ BRep_Builder BB;
+ //
+ aT=aS.ShapeType();
+ //
+ if (aMapSS.Contains(aS)) {
+ aSC=aMapSS.ChangeFromKey(aS);
+ aSC.Orientation(aS.Orientation());
+ return;
+ }
+ else {
+ aSC=aS.EmptyCopied();
+ aMapSS.Add(aS, aSC);
+ }
+ //
+ bFree=aSC.Free();
+ aSC.Free(Standard_True);
+ aSF=aS;
+ if (aT==TopAbs_EDGE){
+ TopAbs_Orientation aOr;
+ //
+ aOr=aS.Orientation();
+ if(aOr==TopAbs_INTERNAL) {
+ aSF.Orientation(TopAbs_FORWARD);
+ }
+ }
+ aIt.Initialize(aSF);
+ for (; aIt.More(); aIt.Next()) {
+ TopoDS_Shape aSCx;
+ //
+ const TopoDS_Shape& aSx=aIt.Value();
+ //
+ CopySource (aSx, aMapSS, aSCx);
+ //
+ aSCx.Orientation(aSx.Orientation());
+ BB.Add(aSC, aSCx);
+ }
+ aSC.Free(bFree);
+}
+//=======================================================================
+//function : FaceNormal
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF,
+ const Standard_Real U,
+ const Standard_Real V,
+ gp_Vec& aN)
+{
+ gp_Pnt aPnt ;
+ gp_Vec aD1U, aD1V;
+ Handle(Geom_Surface) aSurface;
+
+ aSurface=BRep_Tool::Surface(aF);
+ aSurface->D1 (U, V, aPnt, aD1U, aD1V);
+ aN=aD1U.Crossed(aD1V);
+ aN.Normalize();
+ if (aF.Orientation() == TopAbs_REVERSED){
+ aN.Reverse();
+ }
+ return;
+}
+//=======================================================================
+//function : BuildPCurveForEdgeOnFace
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace
+ (const TopoDS_Edge& aEold,
+ const TopoDS_Edge& aEnew,
+ const TopoDS_Face& aF,
+ const Handle(BOPInt_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_AlgoTools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol);
+ if (bHasOld) {
+ return iRet;
+ }
+ //
+ BOPTools_AlgoTools2D::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=IntTools_Tools::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;
+}
+//////////////////////////////////////////////////////////////////////////
+//=======================================================================
+// function: MakeContainer
+// purpose:
+//=======================================================================
+void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType,
+ TopoDS_Shape& theC)
+{
+ BRep_Builder aBB;
+ //
+ switch(theType) {
+ case TopAbs_COMPOUND:{
+ TopoDS_Compound aC;
+ aBB.MakeCompound(aC);
+ theC=aC;
+ }
+ break;
+ //
+ case TopAbs_COMPSOLID:{
+ TopoDS_CompSolid aCS;
+ aBB.MakeCompSolid(aCS);
+ theC=aCS;
+ }
+ break;
+ //
+ case TopAbs_SOLID:{
+ TopoDS_Solid aSolid;
+ aBB.MakeSolid(aSolid);
+ theC=aSolid;
+ }
+ break;
+ //
+ //
+ case TopAbs_SHELL:{
+ TopoDS_Shell aShell;
+ aBB.MakeShell(aShell);
+ theC=aShell;
+ }
+ break;
+ //
+ case TopAbs_WIRE: {
+ TopoDS_Wire aWire;
+ aBB.MakeWire(aWire);
+ theC=aWire;
+ }
+ break;
+ //
+ default:
+ break;
+ }
+}
+//=======================================================================
+//function : IsUPeriodic
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::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;
+}
+
+//=======================================================================
+//function : RefinePCurveForEdgeOnFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::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=IntTools_Tools::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 :IsSplitToReverse
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
+ (const TopoDS_Edge& aEF1,
+ const TopoDS_Edge& aEF2,
+ const Handle(BOPInt_Context)& aContext)
+{
+ Standard_Boolean aFlag;
+ Standard_Real aT1, aT2, aScPr, a, b;
+ gp_Vec aV1, aV2;
+ gp_Pnt aP;
+
+
+ Handle(Geom_Curve)aC1=BRep_Tool::Curve(aEF1, a, b);
+ aT1=IntTools_Tools::IntermediatePoint(a, b);
+ aC1->D0(aT1, aP);
+ aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF1, aT1, aV1);
+
+ if(!aFlag) {
+ return Standard_False;
+ }
+
+ gp_Dir aDT1(aV1);
+ //
+ aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2);
+ if(!aFlag) {
+ return Standard_False;
+ }
+ //
+ aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF2, aT2, aV2);
+ if(!aFlag) {
+ return Standard_False;
+ }
+
+ gp_Dir aDT2(aV2);
+
+ aScPr=aDT1*aDT2;
+
+ return (aScPr<0.);
+}
+
+
+//=======================================================================
+//function : ProjectPointOnShape
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape
+ (const gp_Pnt& aP1,
+ const TopoDS_Shape& aS,
+ gp_Pnt& aP2,
+ const Handle(BOPInt_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_AlgoTools::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 : PointOnEdge
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
+ gp_Pnt& aP3D)
+{
+ Standard_Real aTx, aT1, aT2;
+ //
+ BRep_Tool::Curve(aE, aT1, aT2);
+ aTx=IntTools_Tools::IntermediatePoint(aT1, aT2);
+ GEOMAlgo_AlgoTools::PointOnEdge(aE, aTx, aP3D);
+}
+//=======================================================================
+//function : PointOnEdge
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::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 : PointOnFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::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 : PointOnFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
+ gp_Pnt& aP3D)
+{
+ Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
+ //
+ BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
+ //
+ aU=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
+ aV=IntTools_Tools::IntermediatePoint(aVMin, aVMax);
+ //
+ GEOMAlgo_AlgoTools::PointOnFace(aF, aU, aV, aP3D);
+}
+//=======================================================================
+//function : PointOnShape
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::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_AlgoTools::PointOnEdge(aE, aP3D);
+ }
+ break;
+ //
+ case TopAbs_FACE: {
+ const TopoDS_Face& aF=TopoDS::Face(aS);
+ GEOMAlgo_AlgoTools::PointOnFace(aF, aP3D);
+ }
+ break;
+ //
+ default:
+ break; // Err
+ }
+}
+//=======================================================================
+//function : FindSDShapes
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
+ (const TopoDS_Shape& aE1,
+ const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_ListOfShape& aLESD,
+ const Handle(BOPInt_Context)& aCtx)
+{
+ Standard_Boolean bIsDone;
+ Standard_Real aTol2, aD2;
+ gp_Pnt aP1, aP2;
+ TopTools_ListIteratorOfListOfShape aIt;
+ //
+ aTol2=aTol*aTol;
+ GEOMAlgo_AlgoTools::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_AlgoTools::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 : FindSDShapes
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
+ (const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
+ const Handle(BOPInt_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
+ }
+ if (aNbE==1) {
+ return 0; // Nothing to do
+ }
+ //
+ 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;
+ }
+ //
+ aType=aS.ShapeType();
+ if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE=TopoDS::Edge(aS);
+ if (BRep_Tool::Degenerated(aE)) {
+ aMProcessed.Add(aE);
+ continue;
+ }
+ }
+ //
+ aLESD.Clear();
+ iErr=GEOMAlgo_AlgoTools::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 : RefineSDShapes
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes
+ (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE,
+ const Standard_Real aTol,
+ const Handle(BOPInt_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_AlgoTools::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);
+ //
+ aPKE1.SetShapes(aE1);
+ aMPKLE.Add(aPKE1, aLE);
+ }
+ //
+ return 0;
+}
+//=======================================================================
+//function : BuildTriangulation
+//purpose :
+//=======================================================================
+Standard_Boolean
+ GEOMAlgo_AlgoTools::BuildTriangulation (const TopoDS_Shape& theShape)
+{
+ // calculate deflection
+ Standard_Real aDeviationCoefficient = 0.001;
+
+ Bnd_Box B;
+ BRepBndLib::Add(theShape, B);
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+
+ Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
+ Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
+ Standard_Real aHLRAngle = 0.349066;
+
+ // build triangulation
+ BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
+
+ // check triangulation
+ bool isTriangulation = true;
+
+ TopExp_Explorer exp (theShape, TopAbs_FACE);
+ if (exp.More())
+ {
+ TopLoc_Location aTopLoc;
+ Handle(Poly_Triangulation) aTRF;
+ aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
+ if (aTRF.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ else // no faces, try edges
+ {
+ TopExp_Explorer expe (theShape, TopAbs_EDGE);
+ if (!expe.More()) {
+ isTriangulation = false;
+ }
+ else {
+ TopLoc_Location aLoc;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
+ if (aPE.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ }
+ return isTriangulation;
+}
+
+//=======================================================================
+//function : IsCompositeShape
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::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 : PntInFace
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
+ gp_Pnt& theP,
+ gp_Pnt2d& theP2D)
+{
+ Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
+ Standard_Integer iErr, aIx, aNbDomains, i;
+ Standard_Real aUMin, aUMax, aVMin, aVMax;
+ Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
+ Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
+ gp_Dir2d aD2D (0., 1.);
+ gp_Pnt2d aP2D;
+ gp_Pnt aPx;
+ Handle(Geom2d_Curve) aC2D;
+ Handle(Geom2d_TrimmedCurve) aCT2D;
+ Handle(Geom2d_Line) aL2D;
+ Handle(Geom_Surface) aS;
+ TopAbs_Orientation aOrE;
+ TopoDS_Face aFF;
+ TopExp_Explorer aExp;
+ //
+ aTolHatch2D=1.e-8;
+ aTolHatch3D=1.e-8;
+ aTotArcIntr=1.e-10;
+ aTolTangfIntr=1.e-10;
+ //
+ Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
+ Geom2dHatch_Hatcher aHatcher(aIntr,
+ aTolHatch2D, aTolHatch3D,
+ Standard_True, Standard_False);
+ //
+ iErr=0;
+ aEpsT=1.e-12;
+ //
+ aFF=aF;
+ aFF.Orientation (TopAbs_FORWARD);
+ //
+ aS=BRep_Tool::Surface(aFF);
+ BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ //
+ // 1
+ aExp.Init (aFF, TopAbs_EDGE);
+ for (; aExp.More() ; aExp.Next()) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
+ aOrE=aE.Orientation();
+ //
+ aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
+ if (aC2D.IsNull() ) {
+ iErr=1;
+ return iErr;
+ }
+ if (fabs(aU1-aU2) < aEpsT) {
+ iErr=2;
+ return iErr;
+ }
+ //
+ aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
+ aHatcher.AddElement(aCT2D, aOrE);
+ }// for (; aExp.More() ; aExp.Next()) {
+ //
+ // 2
+ aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
+ aP2D.SetCoord(aUx, 0.);
+ aL2D=new Geom2d_Line (aP2D, aD2D);
+ Geom2dAdaptor_Curve aHCur(aL2D);
+ //
+ aIx=aHatcher.AddHatching(aHCur) ;
+ //
+ // 3.
+ aHatcher.Trim();
+ bIsDone=aHatcher.TrimDone(aIx);
+ if (!bIsDone) {
+ iErr=3;
+ return iErr;
+ }
+ //
+ aHatcher.ComputeDomains(aIx);
+ bIsDone=aHatcher.IsDone(aIx);
+ if (!bIsDone) {
+ iErr=4;
+ return iErr;
+ }
+ //
+ // 4.
+ aNbDomains=aHatcher.NbDomains(aIx);
+ for (i=1; i<=aNbDomains; ++i) {
+ const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+ bHasFirstPoint=aDomain.HasFirstPoint();
+ if (!bHasFirstPoint) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ aV1=aDomain.FirstPoint().Parameter();
+ //
+ bHasSecondPoint=aDomain.HasSecondPoint();
+ if (!bHasSecondPoint) {
+ iErr=6;
+ return iErr;
+ }
+ //
+ aV2=aDomain.SecondPoint().Parameter();
+ //
+ aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+ //
+ break;
+ }
+ //
+ aS->D0(aUx, aVx, aPx);
+ //
+ theP2D.SetCoord(aUx, aVx);
+ theP=aPx;
+ //
+ return iErr;
+}
--- /dev/null
+// 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_BOPInt_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 <BOPInt_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(BOPInt_Context)& aCtx) ;
+
+ Standard_EXPORT
+ static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
+ const Handle(BOPInt_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(BOPInt_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(BOPInt_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(BOPInt_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(BOPInt_Context)& theContext);
+
+ Standard_EXPORT
+ static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp,
+ const TopoDS_Face& theFSr,
+ const Handle(BOPInt_Context)& theContext);
+
+ Standard_EXPORT
+ static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp,
+ const TopoDS_Shape& theSr,
+ const Handle(BOPInt_Context)& theCtx);
+ Standard_EXPORT
+ static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold,
+ const TopoDS_Edge& aEnew,
+ const TopoDS_Face& aF,
+ const Handle(BOPInt_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
--- /dev/null
+// 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);
+ }
+}
+
--- /dev/null
+// 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_BndSphere.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_BndSphere.hxx>
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphere::GEOMAlgo_BndSphere()
+{
+ myCenter.SetCoord(0., 0., 0.);
+ myRadius=0.;
+ myGap=0.;
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere()
+{
+}
+//=======================================================================
+//function : IsOut
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BndSphere::IsOut(const GEOMAlgo_BndSphere& theOther)const
+{
+ Standard_Real aD2, aT2;
+ //
+ aD2=myCenter.SquareDistance(theOther.myCenter);
+ aT2=myRadius+myGap+theOther.myRadius+theOther.myGap;
+ aT2=aT2*aT2;
+ //
+ return aD2>aT2;
+}
--- /dev/null
+// 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_BndSphere.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+
+#ifndef _GEOMAlgo_BndSphere_HeaderFile
+#define _GEOMAlgo_BndSphere_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <gp_Pnt.hxx>
+#include <Standard_Real.hxx>
+#include <Standard_Boolean.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_BndSphere
+//purpose :
+//=======================================================================
+class GEOMAlgo_BndSphere {
+ public:
+ Standard_EXPORT
+ GEOMAlgo_BndSphere();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_BndSphere();
+
+ void SetCenter(const gp_Pnt& theP) ;
+
+ const gp_Pnt& Center() const;
+
+ void SetRadius(const Standard_Real theR) ;
+
+ Standard_Real Radius() const;
+
+ void SetGap(const Standard_Real theGap) ;
+
+ Standard_Real Gap() const;
+
+ void Add(const GEOMAlgo_BndSphere& theOther) ;
+
+ Standard_EXPORT
+ Standard_Boolean IsOut(const GEOMAlgo_BndSphere& theOther) const;
+
+ Standard_Real SquareExtent() const;
+
+ protected:
+ gp_Pnt myCenter;
+ Standard_Real myRadius;
+ Standard_Real myGap;
+};
+
+#include <GEOMAlgo_BndSphere.lxx>
+
+#endif
--- /dev/null
+// 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_BndSphere.lxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//=======================================================================
+//function : SetCenter
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::SetCenter(const gp_Pnt& theP)
+//
+{
+ myCenter=theP;
+}
+//=======================================================================
+//function : Center
+//purpose :
+//=======================================================================
+ inline const gp_Pnt& GEOMAlgo_BndSphere::Center()const
+{
+ return myCenter;
+}
+//=======================================================================
+//function : SetRadius
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::SetRadius(const Standard_Real theR)
+{
+ myRadius=theR;
+}
+//=======================================================================
+//function : Radius
+//purpose :
+//=======================================================================
+ inline Standard_Real GEOMAlgo_BndSphere::Radius()const
+{
+ return myRadius;
+}
+//=======================================================================
+//function : SetGap
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::SetGap(const Standard_Real theGap)
+{
+ myGap=theGap;
+}
+//=======================================================================
+//function : Gap
+//purpose :
+//=======================================================================
+ inline Standard_Real GEOMAlgo_BndSphere::Gap()const
+{
+ return myGap;
+}
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::Add(const GEOMAlgo_BndSphere& theOther)
+{
+ Standard_Real aTmax, aR, aT, aTOther;
+ gp_Pnt aPc;
+ //
+ aPc.SetXYZ(0.5*(myCenter.XYZ()+theOther.myCenter.XYZ()));
+ //
+ aR=aPc.Distance(myCenter);
+ //
+ aT=myRadius+myGap;
+ aTOther=theOther.myRadius+theOther.myGap;
+ aTmax=(aT>aTOther) ? aT: aTOther;
+ //
+ aR=aR+aTmax;
+ //
+ myCenter=aPc;
+ myRadius=aR;
+}
+//=======================================================================
+//function : SquareExtent
+//purpose :
+//=======================================================================
+ inline Standard_Real GEOMAlgo_BndSphere::SquareExtent()const
+{
+ Standard_Real aD;
+ //
+ aD=myRadius+myGap;
+ aD=aD+aD;
+ aD=aD*aD;
+ //
+ return aD;
+}
--- /dev/null
+// 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_BndSphereTree.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_BndSphereTree.hxx>
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector()
+{
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector()
+{
+}
+//=======================================================================
+//function : Reject
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Reject (const GEOMAlgo_BndSphere& aBox) const
+{
+ Standard_Boolean bRet;
+ //
+ bRet=myBox.IsOut(aBox);
+ return bRet;
+}
+//=======================================================================
+//function : Accept
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
+{
+ Standard_Boolean bRet=Standard_False;
+ //
+ if (myFence.Add(aIndex)) {
+ myIndices.Append(aIndex);
+ bRet=!bRet;
+ }
+ return bRet;
+}
+//=======================================================================
+//function : SetBox
+//purpose :
+//=======================================================================
+ void GEOMAlgo_BndSphereTreeSelector::SetBox(const GEOMAlgo_BndSphere& aBox)
+{
+ myBox=aBox;
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+ void GEOMAlgo_BndSphereTreeSelector::Clear()
+{
+ myFence.Clear();
+ myIndices.Clear();
+}
+//=======================================================================
+//function : Indices
+//purpose :
+//=======================================================================
+ const TColStd_ListOfInteger& GEOMAlgo_BndSphereTreeSelector::Indices() const
+{
+ return myIndices;
+}
--- /dev/null
+// 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_BndSphereTree.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#ifndef GEOMAlgo_BndSphereTree_HeaderFile
+#define GEOMAlgo_BndSphereTree_HeaderFile
+
+#include <NCollection_UBTree.hxx>
+#include <GEOMAlgo_BndSphere.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
+
+typedef NCollection_UBTree <Standard_Integer , GEOMAlgo_BndSphere> GEOMAlgo_BndSphereTree;
+
+ class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector {
+ public:
+ 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 ~GEOMAlgo_BndSphereTreeSelector();
+
+ Standard_EXPORT void Clear();
+ Standard_EXPORT void SetBox(const GEOMAlgo_BndSphere&);
+ Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
+
+ protected:
+ GEOMAlgo_BndSphere myBox;
+ TColStd_MapOfInteger myFence;
+ TColStd_ListOfInteger myIndices;
+
+ };
+
+#endif
--- /dev/null
+// 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_BoxBndTree.cxx
+// Created: Tue Oct 17 13:04:11 2006
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_BoxBndTree.hxx>
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_BoxBndTreeSelector::GEOMAlgo_BoxBndTreeSelector()
+{
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+ GEOMAlgo_BoxBndTreeSelector::~GEOMAlgo_BoxBndTreeSelector()
+{
+}
+//=======================================================================
+//function : Reject
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
+{
+ Standard_Boolean bRet;
+ //
+ bRet=myBox.IsOut(aBox);
+ return bRet;
+}
+//=======================================================================
+//function : Accept
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
+{
+ Standard_Boolean bRet=Standard_False;
+ //
+ if (myFence.Add(aIndex)) {
+ myIndices.Append(aIndex);
+ bRet=!bRet;
+ }
+ return bRet;
+}
+//=======================================================================
+//function : SetBox
+//purpose :
+//=======================================================================
+ void GEOMAlgo_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
+{
+ myBox=aBox;
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+ void GEOMAlgo_BoxBndTreeSelector::Clear()
+{
+ myFence.Clear();
+ myIndices.Clear();
+}
+//=======================================================================
+//function : Indices
+//purpose :
+//=======================================================================
+ const TColStd_ListOfInteger& GEOMAlgo_BoxBndTreeSelector::Indices() const
+{
+ return myIndices;
+}
--- /dev/null
+// 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_BoxBndTree.hxx
+// Created: Tue Oct 17 12:50:31 2006
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#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> GEOMAlgo_BoxBndTree;
+
+ class GEOMAlgo_BoxBndTreeSelector : public GEOMAlgo_BoxBndTree::Selector {
+ public:
+ 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 ~GEOMAlgo_BoxBndTreeSelector();
+
+ Standard_EXPORT void Clear();
+ Standard_EXPORT void SetBox(const Bnd_Box&);
+ Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
+
+ protected:
+ Bnd_Box myBox;
+ TColStd_MapOfInteger myFence;
+ TColStd_ListOfInteger myIndices;
+
+ };
+
+#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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
-
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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()
-{
-}
-
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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);
-}
-*/
+++ /dev/null
-
-// Copyright (C) 2007-2013 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
// Author: Peter KURNEV
//
#include <GEOMAlgo_BuilderShape.hxx>
+
//=======================================================================
//function :
//purpose :
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 :
{
return myImagesResult;
}
-//modified by NIZNHY-PKV Thu Dec 7 11:57:04 2006t
#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>
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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);
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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& );
-
-static
- Standard_Boolean IsClosed(const TopoDS_Edge& ,
- const TopoDS_Face&,
- Standard_Boolean& );
-
-//=======================================================================
-//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_Boolean bFlagClosed;
- 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);
- bIsClosed=IsClosed(aE, aF, bFlagClosed);
- //
- 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 (bIsClosed){
- //
- //modified by NIZNHY-PKV Wed Nov 28 13:50:34 2012f
- if (!bIsClosed && bFlagClosed) {
- if (!BRep_Tool::IsClosed(aSp, aF)){
- BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF);
- }
- }
- //modified by NIZNHY-PKV Wed Nov 28 13:50:36 2012t
- //
- //
- 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& bFlag)
-{
- Standard_Boolean bRet;
- //
- bRet=BRep_Tool::IsClosed(aE, aF);
- bFlag=bRet;
- 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;
- }
- */
+++ /dev/null
-// Copyright (C) 2007-2013 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);
- TopExp::MapShapes(aShell, TopAbs_EDGE, aMS);
- 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();
- if (!aNbSFS) {
- continue;
- }
- //
- // 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) {
- //modified by NIZNHY-PKV Wed Mar 27 11:39:15 2013f
- //aMSI.Remove(aSI);
- if (aMSI.Remove(aSI)) {
- aItM.Initialize(aMSI);
- }
- //modified by NIZNHY-PKV Wed Mar 27 11:39:18 2013t
- }
- }
- }
- //
- // 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();
- aItM.Next(); // to safely call aMSI.Remove(aSI)
- 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
+++ /dev/null
-// Copyright (C) 2007-2013 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);
- }
-}
//
#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_Ax3.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)
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
-//#include <Handle_GEOMAlgo_ClsfBox.hxx>
+
#include <TopoDS_Shape.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GEOMAlgo_Clsf.hxx>
#include <GEOMAlgo_ClsfSolid.hxx>
#include <TopAbs_ShapeEnum.hxx>
+
#include <TopoDS.hxx>
#include <TopoDS_Solid.hxx>
+
#include <BRep_Builder.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
-//#include <Handle_GEOMAlgo_ClsfSolid.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Address.hxx>
#include <GEOMAlgo_Clsf.hxx>
// <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);
#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>
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
-#include <BOPTools_DSFiller.hxx>
+//#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
#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
return;
}
//
- bICS=GEOMAlgo_Tools::IsCompositeShape(myArg2);
+ bICS=GEOMAlgo_AlgoTools::IsCompositeShape(myArg2);
if (!bICS || myIsAnalytic) {
TopoDS_Compound aCmp;
BRep_Builder aBB;
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;
}
//
return;
}
//
- pSS->SetFiller(aDF);
+ pSS->SetFiller(aPF);
pSS->Perform();
iErr=pSS->ErrorStatus();
if (iErr) {
#else
aMF.Init(mySurface, Standard_True);
#endif
+
aFErr=aMF.Error();
if (aFErr!=BRepLib_FaceDone) {
myErrorStatus=20; // can not build the face
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);
#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
#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 :
//
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;
}
// 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
#include <BRepLib_MakeEdge.hxx>
#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
-
#include <GEOMAlgo_SurfaceTools.hxx>
#include <GEOMAlgo_StateCollector.hxx>
#include <GEOMAlgo_FinderShapeOn.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <HatchGen_Domain.hxx>
#include <Geom2dHatch_Hatcher.hxx>
-#include <IntTools_Context.hxx>
+#include <BOPInt_Context.hxx>
#include <BRepTools.hxx>
#include <IntTools_Tools.hxx>
//=======================================================================
-//function : GEOMAlgo_FinderShapeOn1
+//function :
//purpose :
//=======================================================================
GEOMAlgo_FinderShapeOn2::GEOMAlgo_FinderShapeOn2()
#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
#include <GEOMAlgo_GetInPlace.hxx>
-#include <NMTDS_BoxBndTree.hxx>
+
#include <NCollection_UBTreeFiller.hxx>
#include <Bnd_Box.hxx>
#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
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;
//
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();
//
// 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();
//
//
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();
//
//
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();
//
//
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();
//
//
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();
//
//
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();
//
//
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();
//
#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>
* The pair of intersected shapes.
*/
//Standard_EXPORT
- void AppendPair(const NMTTools_CoupleOfShape& theCS) ;
+ void AppendPair(const GEOMAlgo_CoupleOfShapes& theCS) ;
/**
* Initialize the iterator.
* 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:
};
#include <IntTools_Tools.hxx>
-#include <BOPTools_Tools3D.hxx>
-#include <BOPTools_Tools2D.hxx>
+#include <GEOMAlgo_AlgoTools.hxx>
}
//
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());
#include <GEOMAlgo_GetInPlace.hxx>
-#include <NMTTools_CoupleOfShape.hxx>
+#include <GEOMAlgo_CoupleOfShapes.hxx>
static
Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
//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;
// function: Value
// purpose:
//=======================================================================
-const NMTTools_CoupleOfShape& GEOMAlgo_GetInPlaceIterator::Value()const
+const GEOMAlgo_CoupleOfShapes& GEOMAlgo_GetInPlaceIterator::Value()const
{
return myIterator.Value();
}
#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>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
+#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
-#include <GEOMAlgo_Tools.hxx>
+#include <GEOMAlgo_AlgoTools.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>
//=======================================================================
//function :
}
// 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;
#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,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ);
-//modified by NIZNHY-PKV Tue Mar 13 10:25:50 2012t
//=======================================================================
//function :
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;
//
}
//
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);
}
//
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);
}
// check geometric coincidence
if (myCheckGeometry) {
- iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTolerance, myContext);
+ iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTolerance, myContext);
if (iErr) {
myErrorStatus=200;
return;
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() ;
void FacePassKey(const TopoDS_Face& aF,
GEOMAlgo_PassKeyShape& aPK) ;
- //modified by NIZNHY-PKV Tue Mar 13 09:53:03 2012f
Standard_EXPORT
void CheckDetected();
//
protected:
TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes;
- //modified by NIZNHY-PKV Tue Mar 13 09:53:08 2012t
};
#endif
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File: GEOMAlgo_Gluer.cxx
-// Created: Sat Dec 04 12:45:53 2004
-// Author: Peter KURNEV
-// <peter@PREFEX>
+// File: GEOMAlgo_Gluer.cxx
+// Created: Sat Dec 04 12:45:53 2004
+// Author: Peter KURNEV
+// <peter@PREFEX>
//
#include <GEOMAlgo_Gluer.hxx>
-#include <NMTDS_BoxBndTree.hxx>
+
#include <NCollection_UBTreeFiller.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <BRepLib.hxx>
#include <BRepTools.hxx>
#include <BRepBndLib.hxx>
+//
+#include <IntTools_Tools.hxx>
+#include <BOPInt_Context.hxx>
+#include <BOPTools_AlgoTools.hxx>
+#include <BOPTools_AlgoTools3D.hxx>
+#include <BOPTools_AlgoTools2D.hxx>
-#include <IntTools_Context.hxx>
-#include <BOPTools_Tools.hxx>
-#include <BOPTools_Tools3D.hxx>
-#include <BOPTools_Tools2D.hxx>
-#include <BOP_CorrectTolerances.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
void GetSubShapes(const TopoDS_Shape& aS,
- TopTools_IndexedMapOfShape& aMSS);
+ TopTools_IndexedMapOfShape& aMSS);
//=======================================================================
//function : GEOMAlgo_Gluer
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();
}
//
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);
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- if (aMIPC.Contains(aIP)) {
- continue;
- }
- //
- 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 Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
- //modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
- //
- aSelector.Clear();
- aSelector.SetBox(aBoxVP);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it must not be
- }
- //
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- //
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- aIP1=aIt.Value();
- if (aMIP.Contains(aIP1)) {
- continue;
- }
- aMIP1.Add(aIP1);
- } //for (; aIt.More(); aIt.Next()) {
+ aIP=aIt1.Key();
+ if (aMIPC.Contains(aIP)) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ //modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
+ 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
+ //
+ aSelector.Clear();
+ aSelector.SetBox(aBoxVP);
+ //
+ aNbVSD=aBBTree.Select(aSelector);
+ if (!aNbVSD) {
+ continue; // it must not be
+ }
+ //
+ const TColStd_ListOfInteger& aLI=aSelector.Indices();
+ //
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aIP1=aIt.Value();
+ if (aMIP.Contains(aIP1)) {
+ continue;
+ }
+ aMIP1.Add(aIP1);
+ } //for (; aIt.More(); aIt.Next()) {
}//for(; aIt1.More(); aIt1.Next()) {
//
aNbIP1=aMIP1.Extent();
if (!aNbIP1) {
- break;
+ break;
}
//
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIPC.Add(aIP);
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
}
//
aMIP.Clear();
aIt1.Initialize(aMIP1);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIP.Add(aIP);
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
}
aMIP1.Clear();
}// while(1)
else { // SD vertices founded [ aMIPC ]
aIt1.Initialize(aMIPC);
for(j=0; aIt1.More(); aIt1.Next(), ++j) {
- aIP=aIt1.Key();
- const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
- if (!j) {
- aVF=aVP;
- }
- aLVSD.Append(aVP);
- aMVProcessed.Add(aVP);
+ aIP=aIt1.Key();
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ if (!j) {
+ aVF=aVP;
+ }
+ aLVSD.Append(aVP);
+ aMVProcessed.Add(aVP);
}
}
myImages.Bind(aVF, aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
- myOrigins.Bind(aVSD, aV);
+ myOrigins.Bind(aVSD, aV);
}
}
}
//
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::IsSplitToReverse(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
}
myResult=aCmp;
//
if (aMS.Extent()) {
- BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
+ BOPTools_AlgoTools::CorrectCurveOnSurface(myResult, 0.0001);
}
}
//=======================================================================
const TopoDS_Face& aF=TopoDS::Face(aExp.Current());
aFR=TopoDS::Face(myOrigins.Find(aF));
if (aFR.IsSame(aF)) {
- aBB.Add(aNewShell, aF);
- continue;
+ aBB.Add(aNewShell, aF);
+ continue;
}
bIsToReverse=IsToReverse(aFR, aF);
if (bIsToReverse) {
- aFR.Reverse();
+ aFR.Reverse();
}
aBB.Add(aNewShell, aFR);
}
}
// check geometric coincidence
if (myCheckGeometry) {
- iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext);
+ iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTol, myContext);
if (iErr) {
myErrorStatus=200;
return;
if (aNbSDF==1) {
bHasNewSubShape=HasNewSubShape(aS1);
if (!bHasNewSubShape) {
- aNewShape=aS1;
- aNewShape.Orientation(TopAbs_FORWARD);
+ aNewShape=aS1;
+ aNewShape.Orientation(TopAbs_FORWARD);
}
}
//
if (bHasNewSubShape) {
if (aType==TopAbs_FACE) {
- TopoDS_Face aNewFace;
- //
- const TopoDS_Face& aF1=TopoDS::Face(aS1);
- MakeFace(aF1, aNewFace);
- aNewShape=aNewFace;
+ TopoDS_Face aNewFace;
+ //
+ const TopoDS_Face& aF1=TopoDS::Face(aS1);
+ MakeFace(aF1, aNewFace);
+ aNewShape=aNewFace;
}
else if (aType==TopAbs_EDGE) {
- TopoDS_Edge aNewEdge;
- //
- const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
- MakeEdge(aE1, aNewEdge);
- aNewShape=aNewEdge;
+ TopoDS_Edge aNewEdge;
+ //
+ const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
+ MakeEdge(aE1, aNewEdge);
+ aNewShape=aNewEdge;
}
}
//
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFSD=aItS.Value();
if (!myOrigins.IsBound(aFSD)) {
- myOrigins.Bind(aFSD, aNewShape);
+ myOrigins.Bind(aFSD, aNewShape);
}
}
}
for (j=1; j<=aNbFS; ++j) {
const TopoDS_Shape& aFS=aMFS(j);
if (aMFR.Contains(aFS)) {
- const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
- aNbSx=aLSx.Extent();
- if (aNbSx==2) {
- bFound=!bFound;
- break;
- }
+ const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
+ aNbSx=aLSx.Extent();
+ if (aNbSx==2) {
+ bFound=!bFound;
+ break;
+ }
}
}
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
- GEOMAlgo_PassKeyShape& aPK)
+ GEOMAlgo_PassKeyShape& aPK)
{
Standard_Integer i, aNbE;
TopTools_ListOfShape aLE;
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
- GEOMAlgo_PassKeyShape& aPK)
+ GEOMAlgo_PassKeyShape& aPK)
{
TopoDS_Vertex aV1, aV2;
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
- TopoDS_Vertex& aNewVertex)
+ TopoDS_Vertex& aNewVertex)
{
Standard_Integer aNbV;
Standard_Real aTolV, aD, aDmax;
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
- TopoDS_Edge& aNewEdge)
+ TopoDS_Edge& aNewEdge)
{
myErrorStatus=0;
//
}
//
else {
- BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
+ BOPTools_AlgoTools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
}
}
//=======================================================================
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
- TopoDS_Face& aNewFace)
+ TopoDS_Face& aNewFace)
{
myErrorStatus=0;
//
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);
//
//
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);
+ // build p-curve
+ if (bIsUPeriodic) {
+ GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
+ }
+ BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
- // orient image
- bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
- if (bIsToReverse) {
- aER.Reverse();
- }
+ // orient image
+ bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
+ if (bIsToReverse) {
+ aER.Reverse();
+ }
}
else {
- aER.Orientation(aE.Orientation());
+ aER.Orientation(aE.Orientation());
}
//
aBB.Add(newWire, aER);
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
- const TopoDS_Face& aF)
+ const TopoDS_Face& aF)
{
Standard_Boolean bRet;
Standard_Real aT, aT1, aT2, aTR, aScPr;
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();
}
//purpose :
//=======================================================================
void GetSubShapes(const TopoDS_Shape& aS,
- TopTools_IndexedMapOfShape& aMSS)
+ TopTools_IndexedMapOfShape& aMSS)
{
Standard_Integer aR;
TopAbs_ShapeEnum aType;
if(myOrigins.IsBound(aS)) {
const TopoDS_Shape& aSnew=myOrigins.Find(aS);
if (!aSnew.IsSame(aS)) {
- myGenerated.Append(aSnew);
+ myGenerated.Append(aSnew);
}
}
}
#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 :
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include <BOPTools_AlgoTools.hxx>
+
#include <GEOMAlgo_GlueDetector.hxx>
-#include <GEOMAlgo_Tools3D.hxx>
+#include <GEOMAlgo_AlgoTools.hxx>
//=======================================================================
//function : GEOMAlgo_Gluer2
continue;
}
//
- GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
+ GEOMAlgo_AlgoTools::MakeContainer(aType, aWnew);
aWnew.Orientation(aW.Orientation());
//
aItS.Initialize(aW);
if (myOrigins.IsBound(aE)) {
aEnew=myOrigins.Find(aE);
//
- bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aEnew, aE, myContext);
+ bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aEnew, aE, myContext);
if (bToReverse) {
aEnew.Reverse();
}
return;
}
//
- GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
+ GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew);
//
aItC.Initialize(aC);
for (; aItC.More(); aItC.Next()) {
return;
}
//
- GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
+ GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew);
//
aItC.Initialize(myArgument);
for (; aItC.More(); aItC.Next()) {
TopoDS_Shape aCnew1;
TopTools_IndexedMapOfShape aM;
//
- GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew1);
+ GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew1);
//
TopExp::MapShapes(aCnew, TopAbs_SOLID, aM);
#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
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;
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
#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
//
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);
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::IsSplitToReverse(aEx, aE, myContext);
if (bIsToReverse) {
aEx.Reverse();
}
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;
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
+#include <BOPTools_AlgoTools.hxx>
+
#include <GEOMAlgo_BuilderShape.hxx>
-#include <GEOMAlgo_Tools3D.hxx>
//=======================================================================
//function : PrepareHistory
aSim.Orientation(theS.Orientation());
}
else {
- bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext);
+ bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
if (bToReverse) {
aSim.Reverse();
}
#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
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;
//
// 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();
//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;
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
// <peter@PREFEX>
//
#include <GEOMAlgo_GluerAlgo.hxx>
-#include <IntTools_Context.hxx>
+#include <BOPInt_Context.hxx>
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
-void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext)
+void GEOMAlgo_GluerAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
{
myContext=theContext;
}
//function : Context
//purpose :
//=======================================================================
-const Handle(IntTools_Context)& GEOMAlgo_GluerAlgo::Context()
+const Handle(BOPInt_Context)& GEOMAlgo_GluerAlgo::Context()
{
return myContext;
}
void GEOMAlgo_GluerAlgo::Perform()
{
if (myContext.IsNull()) {
- myContext=new IntTools_Context;
+ myContext=new BOPInt_Context;
}
}
#include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
-#include <IntTools_Context.hxx>
+
+#include <BOPInt_Context.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
-#include <GEOMAlgo_BuilderShape.hxx>
//=======================================================================
//class : GEOMAlgo_GluerAlgo
virtual void Clear() ;
Standard_EXPORT
- void SetContext(const Handle(IntTools_Context)&) ;
+ void SetContext(const Handle(BOPInt_Context)&) ;
Standard_EXPORT
- const Handle(IntTools_Context)& Context() ;
+ const Handle(BOPInt_Context)& Context() ;
Standard_EXPORT
const TopTools_DataMapOfShapeListOfShape& Images() const;
TopoDS_Shape myArgument;
Standard_Real myTolerance;
Standard_Boolean myCheckGeometry;
- Handle(IntTools_Context) myContext;
+ Handle(BOPInt_Context) myContext;
TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins;
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
-//#include <Handle_GEOMAlgo_HAlgo.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
--- /dev/null
+// 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_IndexedDataMapOfShapeBndSphere.hxx
+// Created: Mon Feb 20 09:17:01 2012
+// Author:
+// <pkv@BDEURI37616>
+
+
+#ifndef GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
+#define GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
+
+#include <TopoDS_Shape.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+#include <GEOMAlgo_BndSphere.hxx>
+
+#define _NCollection_MapHasher
+#include <NCollection_IndexedDataMap.hxx>
+
+
+
+typedef NCollection_IndexedDataMap<TopoDS_Shape, GEOMAlgo_BndSphere, TopTools_ShapeMapHasher> GEOMAlgo_IndexedDataMapOfShapeBndSphere;
+
+#undef _NCollection_MapHasher
+
+
+
+
+#endif
--- /dev/null
+// 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_IndexedDataMapOfIndexedMapOfInteger.hxx
+// Created: Mon Feb 20 09:20:07 2012
+// Author:
+// <pkv@BDEURI37616>
+// File: GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
+// Created: Mon Feb 20 11:59:23 2012
+// Author:
+// <pkv@BDEURI37616>
+
+
+#ifndef GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
+#define GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
+
+
+#include <TopoDS_Shape.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#define _NCollection_MapHasher
+#include <NCollection_IndexedDataMap.hxx>
+
+
+typedef NCollection_IndexedDataMap <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape;
+
+#undef _NCollection_MapHasher
+
+
+#endif
+
+++ /dev/null
-// Copyright (C) 2007-2013 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
#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
-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
// Author: Peter KURNEV
#include <GEOMAlgo_RemoverWebs.hxx>
+#include <GEOMAlgo_ShapeAlgo.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_Builder.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
-
#include <TopExp.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
-#include <IntTools_Context.hxx>
+#include <BOPInt_Context.hxx>
-#include <GEOMAlgo_ShapeAlgo.hxx>
-#include <GEOMAlgo_BuilderSolid.hxx>
-#include <GEOMAlgo_Tools3D.hxx>
+#include <BOPAlgo_BuilderSolid.hxx>
+
+#include <BOPTools.hxx>
+#include <BOPTools_AlgoTools.hxx>
+#include <BOPCol_MapOfShape.hxx>
//=======================================================================
-//function :
+//function :
//purpose :
//=======================================================================
GEOMAlgo_RemoverWebs::GEOMAlgo_RemoverWebs()
if (!myContext.IsNull()) {
myContext.Nullify();
}
- myContext=new IntTools_Context;
+ myContext=new BOPInt_Context;
//
BuildSolid();
//
//=======================================================================
void GEOMAlgo_RemoverWebs::BuildSolid()
{
- Standard_Integer i, aNbF, aNbSx, iErr, aNbSI, aNbF2, aNbS, aNbR;
+ Standard_Integer i, aNbF, aNbSx, iErr, aNbSI, aNbF2, aNbS, aNbR;
TopAbs_Orientation aOr;
TopoDS_Iterator aIt1, aIt2;
TopoDS_Shape aShape;
BRep_Builder aBB;
- TopTools_MapOfShape aMFence;
- TopTools_IndexedMapOfShape aMSI;
- TopTools_IndexedDataMapOfShapeListOfShape aMFS;
- TopTools_ListOfShape aSFS;
- TopTools_ListIteratorOfListOfShape aItLS;
- GEOMAlgo_BuilderSolid aSB;
+ BOPCol_MapOfShape aMFence;
+ BOPCol_IndexedMapOfShape aMSI;
+ BOPCol_IndexedDataMapOfShapeListOfShape aMFS;
+ BOPCol_ListOfShape aSFS;
+ BOPCol_ListIteratorOfListOfShape aItLS;
+ BOPAlgo_BuilderSolid aSB;
//
- //modified by NIZNHY-PKV Fri Jul 12 07:22:58 2013f
+ //modified by NIZNHY-PKV Thu Jul 11 06:54:51 2013f
//
- // 0.
- // The compound myShape may contain equal solids
- // (itz.brep for e.g.). The block is to refine
- // such data if it is necessary. The shape to treat
+ // 0.
+ // The compound myShape may contain equal solids
+ // (itz.brep for e.g.). The block is to refine
+ // such data if it is necessary. The shape to treat
// will be aShape (not myShape).
//
aShape=myShape;
//
aNbR=aMFence.Extent();
if (aNbS!=aNbR) {
- TopTools_MapIteratorOfMapOfShape aItMS;
+ BOPCol_MapIteratorOfMapOfShape aItMS;
//
- GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aShape);
+ BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aShape);
//
aItMS.Initialize(aMFence);
for (; aItMS.More(); aItMS.Next()) {
aBB.Add(aShape, aS);
}
}
- //modified by NIZNHY-PKV Fri Jul 12 07:23:02 2013t
+ //modified by NIZNHY-PKV Thu Jul 11 06:54:54 2013t
//
aNbF2=0;
//
- // 1. aSFS: Faces
- TopExp::MapShapesAndAncestors(aShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
+ // 1. aSFS: Faces
+ BOPTools::MapShapesAndAncestors(aShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
//
aNbF=aMFS.Extent();
for (i=1; i<=aNbF; ++i) {
aSFS.Append(aFi);
}
else {
- const TopTools_ListOfShape& aLSx=aMFS(i);
+ const BOPCol_ListOfShape& aLSx=aMFS(i);
aNbSx=aLSx.Extent();
if (aNbSx==1) {
aSFS.Append(aFx);
// 2 Internal shapes: edges, vertices
aIt1.Initialize(aShape);
for (; aIt1.More(); aIt1.Next()) {
- const TopoDS_Shape& aSD=aIt1.Value();
+ const TopoDS_Shape& aSD=aIt1.Value();
//
aIt2.Initialize(aSD);
for (; aIt2.More(); aIt2.Next()) {
- const TopoDS_Shape& aSi=aIt2.Value();
+ const TopoDS_Shape& aSi=aIt2.Value();
if (aSi.ShapeType()!=TopAbs_SHELL) {
aOr=aSi.Orientation();
if (aOr==TopAbs_INTERNAL) {
aNbSI=aMSI.Extent();
//
// 3 Solids without internals
- GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, myResult);
+ BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, myResult);
//
aSB.SetContext(myContext);
aSB.SetShapes(aSFS);
return;
}
//
- const TopTools_ListOfShape& aLSR=aSB.Areas();
- //
+ const BOPCol_ListOfShape& aLSR=aSB.Areas();
+ //
// 4 Add the internals
if (aNbSI) {
AddInternalShapes(aLSR, aMSI);
//=======================================================================
//function : AddInternalShapes
-//purpose :
+//purpose :
//=======================================================================
-void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR,
- const TopTools_IndexedMapOfShape& aMSI)
+void GEOMAlgo_RemoverWebs::AddInternalShapes(const BOPCol_ListOfShape& aLSR,
+ const BOPCol_IndexedMapOfShape& aMSI)
{
Standard_Integer i, aNbSI;
- TopAbs_State aState;
+ TopAbs_State aState;
TopoDS_Solid aSd;
BRep_Builder aBB;
- TopTools_ListIteratorOfListOfShape aItLS;
- Handle(IntTools_Context) aCtx;
+ BOPCol_ListIteratorOfListOfShape aItLS;
+ Handle(BOPInt_Context) aCtx;
//
- aCtx=new IntTools_Context;
+ aCtx=new BOPInt_Context;
//
aNbSI=aMSI.Extent();
for (i=1; i<=aNbSI; ++i) {
for (; aItLS.More(); aItLS.Next()) {
aSd=*((TopoDS_Solid*)&aItLS.Value());
//
- aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);
+ aState=BOPTools_AlgoTools::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);
if (aState==TopAbs_IN) {
aBB.Add(aSd, aSI);
//
-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
// File: GEOMAlgo_RemoverWebs.hxx
// Created: Thu Mar 28 08:02:59 2013
// Author: Peter KURNEV
-// <pkv@petrex>
-//
+
// The algorithm is intended to build result [solid(s)]
// from given set of solids [argument].
// The result cosists of:
#include <Standard_Macro.hxx>
//
#include <GEOMAlgo_ShapeAlgo.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
//=======================================================================
//function : GEOMAlgo_RemoverWebs
void BuildSolid() ;
Standard_EXPORT
- static void AddInternalShapes(const TopTools_ListOfShape& ,
- const TopTools_IndexedMapOfShape& );
+ static void AddInternalShapes(const BOPCol_ListOfShape& ,
+ const BOPCol_IndexedMapOfShape& );
//
};
// <pkv@irinox>
//
#include <GEOMAlgo_ShapeAlgo.hxx>
-#include <IntTools_Context.hxx>
+#include <BOPInt_Context.hxx>
//=======================================================================
//function : GEOMAlgo_ShapeAlgo
//function : SetContext
//purpose :
//=======================================================================
-void GEOMAlgo_ShapeAlgo::SetContext(const Handle(IntTools_Context)& theContext)
+void GEOMAlgo_ShapeAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
{
myContext=theContext;
}
//function : Context
//purpose :
//=======================================================================
-const Handle(IntTools_Context)& GEOMAlgo_ShapeAlgo::Context()const
+const Handle(BOPInt_Context)& GEOMAlgo_ShapeAlgo::Context()const
{
return myContext;
}
void GEOMAlgo_ShapeAlgo::Perform()
{
if (myContext.IsNull()) {
- myContext=new IntTools_Context;
+ myContext=new BOPInt_Context;
}
}
#include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx>
-#include <Handle_IntTools_Context.hxx>
+#include <Handle_BOPInt_Context.hxx>
#include <GEOMAlgo_Algo.hxx>
//=======================================================================
//! Sets cashed geometrical tools <br>
Standard_EXPORT
- void SetContext(const Handle(IntTools_Context)& theContext) ;
+ void SetContext(const Handle(BOPInt_Context)& theContext) ;
//! Returns cashed geometrical tools <br>
Standard_EXPORT
- const Handle_IntTools_Context& Context() const;
+ const Handle_BOPInt_Context& Context() const;
Standard_EXPORT
void SetShape(const TopoDS_Shape& aS) ;
TopoDS_Shape myShape;
Standard_Real myTolerance;
TopoDS_Shape myResult;
- Handle_IntTools_Context myContext;
+ Handle_BOPInt_Context myContext;
};
#endif
#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>
//=======================================================================
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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
//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
#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
{
public:
Standard_EXPORT
- void SetFiller(const BOPTools_DSFiller& aDSF) ;
+ void SetFiller(const BOPAlgo_PaveFiller& aDSF) ;
Standard_EXPORT
virtual ~GEOMAlgo_ShapeSolid();
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
#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 :
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);
- }
- //
- myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2;
- BuildResult();
- }
- 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;
+ aNbArgs=aLS.Extent();
+ if (aNbArgs!=2) {
+ myErrorStatus=13;
+ return;
}
//
- const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i));
- aState=aDS.GetState(i);
- if (aState==BooleanOperations_IN) {
- myLSIN.Append(aF1);
+ iRank=-1;
+ const TopoDS_Shape& aObj=aLS.First();
+ if (aObj.ShapeType()==TopAbs_SHELL) {
+ iRank=0;
}
- else if (aState==BooleanOperations_OUT) {
- myLSOUT.Append(aF1);
+ const TopoDS_Shape& aTool=aLS.Last();
+ if (aTool.ShapeType()==TopAbs_SHELL) {
+ iRank=1;
}
- }
- //
- // 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));
+ if (iRank==-1) {
+ myErrorStatus=14;
+ return;
+ }
//
- bIsTouchCase=aFFi.IsTangentFaces();
+ 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);
//
- if (bIsTouchCase) {
- myLSON.Append(aF1);
- continue;
- }
+ //------------------------------ShellSolidBuilder
+ GEOMAlgo_ShellSolidBuilder aSSB;
//
- // 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;
- }
+ aSSB.PerformWithFiller(*myDSFiller);
+ iErr=aSSB.ErrorStatus();
+ if (iErr) {
+ myErrorStatus=15;
+ return;
}
//
- if (aNbS) { // it has
- continue;
- }
+ const BOPCol_DataMapOfShapeListOfShape& aImages=aSSB.Images();
//
- anExp.Init(aF1, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
- if (BRep_Tool::Degenerated(aE)) {
- continue;
+ //-------------------------------
+ for (i=iBeg; i<=iEnd; ++i) {
+ const TopoDS_Shape& aS=pDS->Shape(i);
+ aType=aS.ShapeType();
+ if (aType!=TopAbs_FACE) {
+ continue;
}
//
- nE=aDS.ShapeIndex(aE, myRank);
- const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE));
- aNbPB=aLPB.Extent();
+ aState=TopAbs_UNKNOWN;
+ aF=*((TopoDS_Face*)&aS);
//
- 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 (!aImages.IsBound(aS)) {
+ iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
+ if (iErr) {
+ myErrorStatus=16;
+ return;
+ }
+ //
+ aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
}
-
- if (iZone) {
- bFlag=Standard_True;
- aFF.SetStatesMap(aWESFiller.StatesMap());
+ 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 (iSenseFlag)
-
- aFF.SetTangentFacesFlag(bFlag);
- aFF.SetSenseFlag (iSenseFlag);
- }// end of for (i=1; i<=aNb; i++)
+ //----------
+ 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;
+ }
}
protected:
Standard_EXPORT
- virtual void Prepare() ;
+ virtual void BuildResult() {
+ };
- Standard_EXPORT
- virtual void BuildResult() ;
- Standard_EXPORT
- void DetectSDFaces() ;
};
#endif
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
-#include <BooleanOperations_ShapesDataStructure.hxx>
-#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
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();
}
GEOMAlgo_IndexedDataMapOfShapeState aMFS;
//
// 1. classify the faces
- GEOMAlgo_ShellSolid::BuildResult();
+ GEOMAlgo_ShellSolid::Perform();
//
// 2. fill Shape-State map
aIt.Initialize(myLSIN);
const TopoDS_Shape& aF=aIt.Value();
aMFS.Add(aF, TopAbs_ON);
}
+ //
myLSIN.Clear();
myLSON.Clear();
myLSOUT.Clear();
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx>
+
#include <GEOMAlgo_ShellSolid.hxx>
//=======================================================================
virtual ~GEOMAlgo_SolidSolid();
Standard_EXPORT
- virtual void Perform() ;
+ virtual void Perform() ;
Standard_EXPORT
void SetShape2(const TopoDS_Shape& aS) ;
protected:
Standard_EXPORT
- virtual void BuildResult() ;
-
+ virtual void BuildResult() ;
TopoDS_Shape myS2;
};
// 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>
#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 :
+//function :
+//purpose :
//=======================================================================
- GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
+GEOMAlgo_Splitter::GEOMAlgo_Splitter
+ (const Handle(NCollection_BaseAllocator)& theAllocator)
+:
+ BOPAlgo_Builder(theAllocator),
+ myTools(myAllocator),
+ myMapTools(100, myAllocator)
{
+ myLimit=TopAbs_SHAPE;
+ myLimitMode=0;
}
//=======================================================================
-//function : AddToolCompound
-//purpose :
+//function : ~
+//purpose :
//=======================================================================
- void GEOMAlgo_Splitter::AddToolCompound(const TopoDS_Shape& theShape)
+GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
{
- 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);
+ 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();
}
//=======================================================================
//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)) {
}
}// 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
+ BOPTools::MapShapes(aC, aMx);
+ // 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);
+ 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)) {
- //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
}
}
}
myShape=aC;
}//if (myLimit!=TopAbs_SHAPE) {
//
- GEOMAlgo_Builder::PostTreat();
+ Standard_Integer aNbS;
+ TopoDS_Iterator aIt;
+ BOPCol_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();
+ }
+ //
+ 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);
}
//
// myErrorStatus
-//
+//
// 0 - Ok
// 1 - The object is just initialized
// 2 - PaveFiller is failed
// File: GEOMAlgo_Splitter.hxx
//
// Author: Peter KURNEV
-//
-#ifndef _GEOMAlgo_Splitter_HeaderFile
-#define _GEOMAlgo_Splitter_HeaderFile
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+
+#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_Boolean.hxx>
#include <Standard_Integer.hxx>
-#include <GEOMAlgo_Builder.hxx>
+
+#include <NCollection_BaseAllocator.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
#include <TopoDS_Shape.hxx>
-//! Implementation of Gluing Operation Algorithm (GA) <br>
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPCol_MapOfShape.hxx>
+
+#include <BOPAlgo_Builder.hxx>
+
//=======================================================================
-//function : GEOMAlgo_Splitter
+//class : GEOMAlgo_Splitter
//purpose :
//=======================================================================
-class GEOMAlgo_Splitter : public GEOMAlgo_Builder
+class GEOMAlgo_Splitter : public BOPAlgo_Builder
{
public:
-
- //! Empty constructor <br>
+
Standard_EXPORT
GEOMAlgo_Splitter();
+ Standard_EXPORT
+ GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator);
+
Standard_EXPORT
virtual ~GEOMAlgo_Splitter();
- //! Clears internal fields and arguments <br>
Standard_EXPORT
- virtual void Clear() ;
+ void AddTool(const TopoDS_Shape& theShape);
- //! Adds Tool argument theShape of the operation <br>
Standard_EXPORT
- virtual void AddTool(const TopoDS_Shape& theShape) ;
+ const BOPCol_ListOfShape& Tools()const;
- //! Returns the arguments of the operation <br>
Standard_EXPORT
- const TopTools_ListOfShape& Tools() const;
+ void SetLimit(const TopAbs_ShapeEnum aLimit);
Standard_EXPORT
- void SetLimit(const TopAbs_ShapeEnum aLimit) ;
+ TopAbs_ShapeEnum Limit()const;
Standard_EXPORT
- TopAbs_ShapeEnum Limit() const;
+ void SetLimitMode(const Standard_Integer aMode);
Standard_EXPORT
- void SetLimitMode(const Standard_Integer aLimitMode) ;
+ Standard_Integer LimitMode()const;
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) ;
+ virtual void Clear();
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() ;
+ virtual void BuildResult(const TopAbs_ShapeEnum theType);
-
- TopTools_ListOfShape myTools;
- TopTools_MapOfShape myMapTools;
- TopAbs_ShapeEnum myLimit;
- Standard_Integer myLimitMode;
+ Standard_EXPORT
+ virtual void PostTreat();
+
+ protected:
+ BOPCol_ListOfShape myTools;
+ BOPCol_MapOfShape myMapTools;
+ TopAbs_ShapeEnum myLimit;
+ Standard_Integer myLimitMode;
};
+
#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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.cxx
-// Created :
-// Author : Peter KURNEV
-
-#include <GEOMAlgo_Tools3D.hxx>
-
-#include <Precision.hxx>
-
-#include <gp_Vec.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp_Pln.hxx>
-#include <gp_XYZ.hxx>
-#include <gp_Dir2d.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom_Surface.hxx>
-
-#include <Geom2d_Curve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <Geom2d_Line.hxx>
-
-#include <Geom2dHatch_Intersector.hxx>
-#include <Geom2dHatch_Hatcher.hxx>
-#include <HatchGen_Domain.hxx>
-
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopAbs_State.hxx>
-
-#include <TopLoc_Location.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_CompSolid.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Iterator.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-//
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-
-#include <BRepClass3d_SolidClassifier.hxx>
-#include <BRepTools.hxx>
-
-#include <IntTools_Context.hxx>
-#include <IntTools_Tools.hxx>
-
-#include <BOPTools_Tools3D.hxx>
-#include <BOPTools_Tools2D.hxx>
-#include <BOPTools_Tools.hxx>
-
-#include <NMTTools_ListOfCoupleOfShape.hxx>
-#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
-#include <NMTTools_CoupleOfShape.hxx>
-#include <TopTools_DataMapOfShapeListOfShape.hxx>
-#include <TopTools_DataMapOfShapeListOfShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
-//
-#include <GeomAdaptor_Surface.hxx>
-
-
-//
-static
- Standard_Boolean FindFacePairs (const TopoDS_Edge& ,
- const TopTools_ListOfShape& ,
- NMTTools_ListOfCoupleOfShape& );
-
-
-static
- Standard_Real AngleWithRef(const gp_Dir& ,
- const gp_Dir& ,
- const gp_Dir& );
-
-static
- void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- Standard_Real aT,
- gp_Pnt& aPF,
- gp_Dir& aDNF,
- const Handle(IntTools_Context)& aCtx);
-
-//=======================================================================
-//function : IsInternalFace
-//purpose :
-//=======================================================================
-Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
- const TopoDS_Solid& theSolid,
- const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
- const Standard_Real theTol,
- const Handle(IntTools_Context)& theContext)
-{
- Standard_Boolean bRet;
- Standard_Integer aNbF;
- TopoDS_Edge aEL;
- TopExp_Explorer aExp;
- TopTools_ListIteratorOfListOfShape aItF;
- //
- bRet=Standard_False;
- //
- // 1 Try to find an edge from theFace in theMEF
- aExp.Init(theFace, TopAbs_EDGE);
- for(; aExp.More(); aExp.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
- if (!theMEF.Contains(aE)) {
- continue;
- }
- //
- const TopTools_ListOfShape& aLF=theMEF.FindFromKey(aE);
- aNbF=aLF.Extent();
- if (!aNbF) {
- return bRet; // it can not be so
- }
- else if (aNbF==1) {
- // aE is internal edge on aLF.First()
- const TopoDS_Face& aF1=TopoDS::Face(aLF.First());
- bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF1, theContext);
- return bRet;
- }
- else if (aNbF==2) {
- const TopoDS_Face& aF1=TopoDS::Face(aLF.First());
- const TopoDS_Face& aF2=TopoDS::Face(aLF.Last());
- //
- if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) {
- // treat as it was for 1 face
- bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF2, theContext);
- return bRet;
- }
- }
- if (aNbF%2) {
- return bRet; // it can not be so
- }
- else { // aNbF=2,4,6,8,...
- bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF, theContext);
- return bRet;
- }
- }//for(; aExp.More(); aExp.Next()) {
- //
- //========================================
- // 2. Classify face using classifier
- //
- TopAbs_State aState;
- TopTools_IndexedMapOfShape aBounds;
- //
- aState=GEOMAlgo_Tools3D::ComputeState(theFace, theSolid, theTol, aBounds, theContext);
- bRet=(aState==TopAbs_IN);
- //
- return bRet;
-}
-//=======================================================================
-//function : IsInternalFace
-//purpose :
-//=======================================================================
- Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
- const TopoDS_Edge& theEdge,
- const TopTools_ListOfShape& theLF,
- const Handle(IntTools_Context)& theContext)
-{
- Standard_Boolean bRet;
- Standard_Boolean aNbF;
- //
- bRet=Standard_False;
- //
- aNbF=theLF.Extent();
- if (aNbF==2) {
- const TopoDS_Face& aF1=TopoDS::Face(theLF.First());
- const TopoDS_Face& aF2=TopoDS::Face(theLF.Last());
- bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2, theContext);
- return bRet;
- }
- //
- else {
- NMTTools_ListOfCoupleOfShape aLCFF;
- NMTTools_ListIteratorOfListOfCoupleOfShape aIt;
- //
- FindFacePairs(theEdge, theLF, aLCFF);
- //
- aIt.Initialize(aLCFF);
- for (; aIt.More(); aIt.Next()) {
- const NMTTools_CoupleOfShape& aCSFF=aIt.Value();
- //
- const TopoDS_Face& aF1=TopoDS::Face(aCSFF.Shape1());
- const TopoDS_Face& aF2=TopoDS::Face(aCSFF.Shape2());
- bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2, theContext);
- if (bRet) {
- return bRet;
- }
- }
- }
- return bRet;
-}
-//=======================================================================
-//function : IsInternalFace
-//purpose :
-//=======================================================================
- Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
- const TopoDS_Edge& theEdge,
- const TopoDS_Face& theFace1,
- const TopoDS_Face& theFace2,
- const Handle(IntTools_Context)& theContext)
-{
- Standard_Boolean bRet;
- Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx;
- Standard_Real aA12, aA1x, aTwoPI;
- gp_Pnt aPx, aPF, aPF1, aPF2;
- gp_Pnt2d aP2D, aPF2D;
- gp_Dir aDNF1, aDNF2;
- TopoDS_Edge aE1, aE2;
- Handle(Geom_Curve)aC3D;
- //
- aC3D =BRep_Tool::Curve(theEdge, aT1, aT2);
- aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
- aC3D->D0(aT, aPx);
- //
- // 1. PF
- aDt2D=BOPTools_Tools3D::MinStepIn2d();
- aDt2Dx=10.*aDt2D;
- BOPTools_Tools3D::PointNearEdge (theEdge, theFace, aT, aDt2Dx, aPF2D, aPF);
- //
- // 2. E1, E2
- GEOMAlgo_Tools3D::GetEdgeOnFace(theEdge, theFace1, aE1);
- if (aE1.Orientation()==TopAbs_INTERNAL) {
- aE2=aE1;
- aE1.Orientation(TopAbs_FORWARD);
- aE2.Orientation(TopAbs_REVERSED);
- }
- else if (theFace1==theFace2) {
- aE2=aE1;
- aE1.Orientation(TopAbs_FORWARD);
- aE2.Orientation(TopAbs_REVERSED);
- }
- else {
- GEOMAlgo_Tools3D::GetEdgeOnFace(theEdge, theFace2, aE2);
- }
- //
- // 3
- bRet=Standard_False;
- //
- GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1, theContext);
- GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2, theContext);
- //
- aTwoPI = 2.*M_PI;
- gp_Vec aVBF (aPx, aPF );
- gp_Vec aVBF1(aPx, aPF1);
- gp_Vec aVBF2(aPx, aPF2);
- //
- gp_Dir aDTF1;
- gp_Dir aDBF (aVBF);
- gp_Dir aDBF1(aVBF1);
- gp_Dir aDBF2(aVBF2);
- //
- aDTF1=aDNF1^aDBF1;
- aA12=AngleWithRef(aDBF1, aDBF2, aDTF1);
- if (aA12<0.) {
- aA12=aA12+aTwoPI;
- }
-
- aA1x=AngleWithRef(aDBF1, aDBF , aDTF1);
- if (aA1x<0.) {
- aA1x=aA1x+aTwoPI;
- }
- //
- if (aA1x<aA12) {
- bRet=!bRet; //TopAbs_IN;
- }
- //
- return bRet;
-}
-//=======================================================================
-//function : GetFaceOff
-//purpose :
-//=======================================================================
- void GEOMAlgo_Tools3D::GetFaceOff(const TopoDS_Edge& theE1,
- const TopoDS_Face& theF1,
- const NMTTools_ListOfCoupleOfShape& theLCSOff,
- TopoDS_Face& theFOff)
-{
- Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin;
- gp_Pnt aPn1, aPn2;
- gp_Vec aVTgt;
- gp_Dir aDN1, aDN2;
- NMTTools_ListIteratorOfListOfCoupleOfShape aIt;
- //
- aAngleMin=100.;
- aTwoPI = M_PI+M_PI;
- BRep_Tool::Range(theE1, aT1, aT2);
- aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
- // Ref
- BOPTools_Tools2D::EdgeTangent(theE1, aT, aVTgt);
- gp_Dir aDTtgt(aVTgt);
- aDTtgt.Reverse();
- // N1
- BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(theE1, theF1, aT, aPn1, aDN1);
- //
- aIt.Initialize(theLCSOff);
- for (; aIt.More(); aIt.Next()) {
- const NMTTools_CoupleOfShape& aCS=aIt.Value();
- const TopoDS_Edge& aE2=TopoDS::Edge(aCS.Shape1());
- const TopoDS_Face& aF2=TopoDS::Face(aCS.Shape2());
- //
- if (aF2==theF1) {
- aAngle=M_PI;
- }
- else if (aF2.IsSame(theF1)) {
- aAngle=aTwoPI;
- }
- else {
- BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, aF2, aT, aPn2, aDN2);
- aDN2.Reverse();
- // Angle
- aAngle=AngleWithRef(aDN1, aDN2, aDTtgt);
- if(aAngle<0.) {
- aAngle=aTwoPI+aAngle;
- }
- }
- //
- if (aAngle<aAngleMin){
- aAngleMin=aAngle;
- theFOff=aF2;
- }
- }
-}
-//=======================================================================
-//function : GetEdgeOnFace
-//purpose :
-//=======================================================================
- Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOnFace(const TopoDS_Edge& theE1,
- const TopoDS_Face& theF2,
- TopoDS_Edge& theE2)
-{
- Standard_Boolean bFound;
- TopoDS_Iterator aItF, aItW;
- //
- bFound=Standard_False;
- //
- aItF.Initialize(theF2);
- for (; aItF.More(); aItF.Next()) {
- const TopoDS_Shape& aW=aItF.Value();
- aItW.Initialize(aW);
- for (; aItW.More(); aItW.Next()) {
- const TopoDS_Shape& aE=aItW.Value();
- if (aE.IsSame(theE1)) {
- theE2=TopoDS::Edge(aE);
- bFound=!bFound;
- return bFound;
- }
- }
- }
- return bFound;
-}
-//=======================================================================
-//function : GetEdgeOff
-//purpose :
-//=======================================================================
-Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
- const TopoDS_Face& theF2,
- TopoDS_Edge& theE2)
-
-{
- Standard_Boolean bFound;
- TopAbs_Orientation aOr1, aOr1C, aOr2;
- TopExp_Explorer anExp;
- //
- bFound=Standard_False;
- aOr1=theE1.Orientation();
- aOr1C=TopAbs::Reverse(aOr1);
- //
- anExp.Init(theF2, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- const TopoDS_Edge& aEF2=TopoDS::Edge(anExp.Current());
- if (aEF2.IsSame(theE1)) {
- aOr2=aEF2.Orientation();
- if (aOr2==aOr1C) {
- theE2=aEF2;
- bFound=!bFound;
- return bFound;
- }
- }
- }
- return bFound;
-}
-//=======================================================================
-// function: ComputeState
-// purpose:
-//=======================================================================
- TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Face& theF,
- const TopoDS_Solid& theRef,
- const Standard_Real theTol,
- const TopTools_IndexedMapOfShape& theBounds,
- const Handle(IntTools_Context)& theCtx)
-{
- TopAbs_State aState;
- TopExp_Explorer aExp;
- TopoDS_Edge aE1;
- gp_Pnt2d aP2D;
- gp_Pnt aP3D;
- //
- aState=TopAbs_UNKNOWN;
- //
- aExp.Init(theF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Edge& aSE=TopoDS::Edge(aExp.Current());
- if (BRep_Tool::Degenerated(aSE)) {
- continue;
- }
- //
- if (!theBounds.Contains(aSE)) {
- const TopoDS_Edge& aE=TopoDS::Edge(aSE);
- aState= GEOMAlgo_Tools3D::ComputeState(aE, theRef, theTol, theCtx);
- return aState;
- }
- if (aE1.IsNull()) {
- aE1=TopoDS::Edge(aSE);
- }
- }
- // !!<- process edges that are all on theRef
- if (!aE1.IsNull()) {
- BOPTools_Tools3D::PointNearEdge(aE1, theF, aP2D, aP3D);
- aState=GEOMAlgo_Tools3D::ComputeState(aP3D, theRef, theTol, theCtx);
- }
- //
- return aState;
-}
-//=======================================================================
-// function: ComputeStateByOnePoint
-// purpose:
-//=======================================================================
- TopAbs_State GEOMAlgo_Tools3D::ComputeStateByOnePoint(const TopoDS_Shape& theS,
- const TopoDS_Solid& theRef,
- const Standard_Real theTol,
- const Handle(IntTools_Context)& theCtx)
-{
- TopAbs_State aState;
- TopAbs_ShapeEnum aType;
- //
- aState=TopAbs_UNKNOWN;
- aType=theS.ShapeType();
- if (aType==TopAbs_VERTEX) {
- const TopoDS_Vertex& aV=TopoDS::Vertex(theS);
- aState=GEOMAlgo_Tools3D::ComputeState(aV, theRef, theTol, theCtx);
- }
- else if (aType==TopAbs_EDGE) {
- const TopoDS_Edge& aE=TopoDS::Edge(theS);
- aState=GEOMAlgo_Tools3D::ComputeState(aE, theRef, theTol, theCtx);
- }
- return aState;
-}
-//=======================================================================
-// function: ComputeState
-// purpose:
-//=======================================================================
- TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Vertex& theV,
- const TopoDS_Solid& theRef,
- const Standard_Real theTol,
- const Handle(IntTools_Context)& theCtx)
-{
- TopAbs_State aState;
- gp_Pnt aP3D;
- //
- aP3D=BRep_Tool::Pnt(theV);
- aState=GEOMAlgo_Tools3D::ComputeState(aP3D, theRef, theTol, theCtx);
- return aState;
-}
-//=======================================================================
-// function: ComputeState
-// purpose:
-//=======================================================================
- TopAbs_State GEOMAlgo_Tools3D::ComputeState(const TopoDS_Edge& theE,
- const TopoDS_Solid& theRef,
- const Standard_Real theTol,
- const Handle(IntTools_Context)& theCtx)
-{
- Standard_Real aT1, aT2, aT = 0.;
- TopAbs_State aState;
- Handle(Geom_Curve) aC3D;
- gp_Pnt aP3D;
- //
- aC3D = BRep_Tool::Curve(theE, aT1, aT2);
- //
- if(aC3D.IsNull()) {
- //it means that we are in degenerated edge
- const TopoDS_Vertex& aV = TopExp::FirstVertex(theE);
- if(aV.IsNull()){
- return TopAbs_UNKNOWN;
- }
- aP3D=BRep_Tool::Pnt(aV);
- }
- else {//usual case
- Standard_Boolean bF2Inf, bL2Inf;
- Standard_Real dT=10.;
- //
- bF2Inf = Precision::IsNegativeInfinite(aT1);
- bL2Inf = Precision::IsPositiveInfinite(aT2);
- //
- if (bF2Inf && !bL2Inf) {
- aT=aT2-dT;
- }
- else if (!bF2Inf && bL2Inf) {
- aT=aT1+dT;
- }
- else if (bF2Inf && bL2Inf) {
- aT=0.;
- }
- else {
- aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
- }
- aC3D->D0(aT, aP3D);
- }
- //
- aState=GEOMAlgo_Tools3D::ComputeState(aP3D, theRef, theTol, theCtx);
- //
- return aState;
-}
-//=======================================================================
-// function: ComputeState
-// purpose:
-//=======================================================================
- TopAbs_State GEOMAlgo_Tools3D::ComputeState(const gp_Pnt& theP,
- const TopoDS_Solid& theRef,
- const Standard_Real theTol,
- const Handle(IntTools_Context)& theCtx)
-{
- TopAbs_State aState;
- //
- BRepClass3d_SolidClassifier& aSC=theCtx->SolidClassifier(theRef);
- aSC.Perform(theP, theTol);
- //
- aState=aSC.State();
- //
- return aState;
-}
-//=======================================================================
-// function: IsSplitToReverse
-// purpose:
-//=======================================================================
- Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Shape& theSp,
- const TopoDS_Shape& theSr,
- const Handle(IntTools_Context)& theCtx)
-{
- Standard_Boolean bRet;
- TopAbs_ShapeEnum aType;
- //
- bRet=Standard_False;
- //
- aType=theSp.ShapeType();
- switch (aType) {
- case TopAbs_EDGE: {
- const TopoDS_Edge& aESp=TopoDS::Edge(theSp);
- const TopoDS_Edge& aESr=TopoDS::Edge(theSr);
- bRet=GEOMAlgo_Tools3D::IsSplitToReverse(aESp, aESr, theCtx);
- }
- break;
- //
- case TopAbs_FACE: {
- const TopoDS_Face& aFSp=TopoDS::Face(theSp);
- const TopoDS_Face& aFSr=TopoDS::Face(theSr);
- bRet=GEOMAlgo_Tools3D::IsSplitToReverse(aFSp, aFSr, theCtx);
- }
- break;
- //
- default:
- break;
- }
- return bRet;
-}
-//=======================================================================
-//function :IsSplitToReverse
-//purpose :
-//=======================================================================
- Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Face& theFSp,
- const TopoDS_Face& theFSr,
- const Handle(IntTools_Context)& theContext)
-{
- Standard_Boolean bRet, bFound, bInFace;
- Standard_Real aT1, aT2, aT, aU, aV, aScPr;
- gp_Pnt aPFSp, aPFSr;
- gp_Dir aDNFSp;
- gp_Vec aD1U, aD1V;
- Handle(Geom_Surface) aSr, aSp;
- TopAbs_Orientation aOrSr, aOrSp;
- TopExp_Explorer anExp;
- TopoDS_Edge aESp;
- //
- bRet=Standard_False;
- //
- aSr=BRep_Tool::Surface(theFSr);
- aSp=BRep_Tool::Surface(theFSp);
- if (aSr==aSp) {
- aOrSr=theFSr.Orientation();
- aOrSp=theFSp.Orientation();
- bRet=(aOrSr!=aOrSp);
- return bRet;
- }
- //
- bFound=Standard_False;
- anExp.Init(theFSp, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- aESp=TopoDS::Edge(anExp.Current());
- if (!BRep_Tool::Degenerated(aESp)) {
- if (!BRep_Tool::IsClosed(aESp, theFSp)) {
- bFound=!bFound;
- break;
- }
- }
- }
- //
- //modified by NIZNHY-PKV Tue Nov 22 10:50:30 2011f
- if (!bFound) {
- Standard_Boolean bFlag;
- Standard_Integer iErr;
- gp_Pnt2d aP2DFSp;
- //
- iErr=GEOMAlgo_Tools3D::PntInFace(theFSp, aPFSp, aP2DFSp);
- if (iErr) {
- return bRet;
- }
- //
- aP2DFSp.Coord(aU, aV);
- bFlag=BOPTools_Tools3D::GetNormalToSurface(aSp, aU, aV, aDNFSp);
- if (!bFlag) {
- return bRet;
- }
- }
- else {
- BRep_Tool::Range(aESp, aT1, aT2);
- aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
- BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp);
- }
- //
- /*
- if (!bFound) {
- return bRet;
- }
- BRep_Tool::Range(aESp, aT1, aT2);
- aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
- BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp);
- */
- //modified by NIZNHY-PKV Tue Nov 22 10:50:37 2011t
- //
- // Parts of theContext.ComputeVS(..)
- GeomAPI_ProjectPointOnSurf& aProjector=theContext->ProjPS(theFSr);
- aProjector.Perform(aPFSp);
- if (!aProjector.IsDone()) {
- return bRet;
- }
- //
- aProjector.LowerDistanceParameters(aU, aV);
- gp_Pnt2d aP2D(aU, aV);
- bInFace=theContext->IsPointInFace (theFSr, aP2D);
- if (!bInFace) {
- return bRet;
- }
- //
- aSr->D1(aU, aV, aPFSr, aD1U, aD1V);
- gp_Dir aDD1U(aD1U);
- gp_Dir aDD1V(aD1V);
- gp_Dir aDNFSr=aDD1U^aDD1V;
- if (theFSr.Orientation()==TopAbs_REVERSED){
- aDNFSr.Reverse();
- }
- //
- aScPr=aDNFSp*aDNFSr;
- bRet=(aScPr<0.);
- //
- return bRet;
-}
-//=======================================================================
-//function :IsSplitToReverse
-//purpose :
-//=======================================================================
- Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Edge& theSplit,
- const TopoDS_Edge& theEdge,
- const Handle(IntTools_Context)& theContext)
-{
- Standard_Boolean bRet, aFlag, bIsDegenerated;
- Standard_Real aTE, aTS, aScPr, aTa, aTb, aT1, aT2;
- TopAbs_Orientation aOrSr, aOrSp;
- Handle(Geom_Curve) aCEdge, aCSplit;
- gp_Vec aVE, aVS;
- gp_Pnt aP;
- //
- bRet=Standard_False;
- //
- bIsDegenerated=(BRep_Tool::Degenerated(theSplit) ||
- BRep_Tool::Degenerated(theEdge));
- if (bIsDegenerated) {
- return bRet;
- }
- //
- aCEdge =BRep_Tool::Curve(theEdge , aT1, aT2);
- aCSplit=BRep_Tool::Curve(theSplit, aTa, aTb);
- //
- if (aCEdge==aCSplit) {
- aOrSr=theEdge.Orientation();
- aOrSp=theSplit.Orientation();
- bRet=(aOrSr!=aOrSp);
- return bRet;
- }
- //
- aTS=BOPTools_Tools2D::IntermediatePoint(aTa, aTb);
- aCSplit->D0(aTS, aP);
- aFlag=BOPTools_Tools2D::EdgeTangent(theSplit, aTS, aVS);
- gp_Dir aDTS(aVS);
- //
- aFlag=theContext->ProjectPointOnEdge(aP, theEdge, aTE);
- aFlag=BOPTools_Tools2D::EdgeTangent(theEdge, aTE, aVE);
- gp_Dir aDTE(aVE);
- //
- aScPr=aDTS*aDTE;
- bRet=(aScPr<0.);
- //
- return bRet;
-}
-
-//=======================================================================
-// function: Sense
-// purpose:
-//=======================================================================
- Standard_Integer GEOMAlgo_Tools3D::Sense (const TopoDS_Face& theF1,
- const TopoDS_Face& theF2)
-{
- Standard_Integer iSense=0;
- gp_Dir aDNF1, aDNF2;
- TopoDS_Edge aE1, aE2;
- TopExp_Explorer anExp;
- //
- anExp.Init(theF1, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- aE1=TopoDS::Edge(anExp.Current());
- if (!BRep_Tool::Degenerated(aE1)) {
- if (!BRep_Tool::IsClosed(aE1, theF1)) {
- break;
- }
- }
- }
- //
- anExp.Init(theF2, TopAbs_EDGE);
- for (; anExp.More(); anExp.Next()) {
- aE2=TopoDS::Edge(anExp.Current());
- if (!BRep_Tool::Degenerated(aE2)) {
- if (!BRep_Tool::IsClosed(aE2, theF2)) {
- if (aE2.IsSame(aE1)) {
- iSense=1;
- break;
- }
- }
- }
- }
- //
- if (!iSense) {
- return iSense;
- }
- //
- BOPTools_Tools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1);
- BOPTools_Tools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2);
- //
- iSense=BOPTools_Tools3D::SenseFlag(aDNF1, aDNF2);
- //
- return iSense;
-}
-//=======================================================================
-// function: CopyFace
-// purpose:
-//=======================================================================
- void GEOMAlgo_Tools3D::CopyFace (const TopoDS_Face& theF1,
- TopoDS_Face& theF2)
-{
- Standard_Real aTol;
- TopLoc_Location aLoc;
- TopAbs_Orientation aOr;
- TopoDS_Iterator aIt;
- BRep_Builder aBB;
- //
- Handle(Geom_Surface) aSurface=BRep_Tool::Surface(theF1, aLoc);
- aTol=BRep_Tool::Tolerance(theF1);
- aOr=theF1.Orientation();
- //
- aBB.MakeFace (theF2, aSurface, aLoc, aTol);
- theF2.Orientation(aOr);
- //
- aIt.Initialize(theF1);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aW=aIt.Value();
- aBB.Add(theF2, aW);
- }
-}
-//=======================================================================
-// function: MakeContainer
-// purpose:
-//=======================================================================
- void GEOMAlgo_Tools3D::MakeContainer(const TopAbs_ShapeEnum theType,
- TopoDS_Shape& theC)
-{
- BRep_Builder aBB;
- //
- switch(theType) {
- case TopAbs_COMPOUND:{
- TopoDS_Compound aC;
- aBB.MakeCompound(aC);
- theC=aC;
- }
- break;
- //
- case TopAbs_COMPSOLID:{
- TopoDS_CompSolid aCS;
- aBB.MakeCompSolid(aCS);
- theC=aCS;
- }
- break;
- //
- case TopAbs_SOLID:{
- TopoDS_Solid aSolid;
- aBB.MakeSolid(aSolid);
- theC=aSolid;
- }
- break;
- //
- //
- case TopAbs_SHELL:{
- TopoDS_Shell aShell;
- aBB.MakeShell(aShell);
- theC=aShell;
- }
- break;
- //
- case TopAbs_WIRE: {
- TopoDS_Wire aWire;
- aBB.MakeWire(aWire);
- theC=aWire;
- }
- break;
- //
- default:
- break;
- }
-}
-//=======================================================================
-// function: MakeConnexityBlock.
-// purpose:
-//=======================================================================
- void GEOMAlgo_Tools3D::MakeConnexityBlock (const TopTools_ListOfShape& theLFIn,
- const TopTools_IndexedMapOfShape& theMEAvoid,
- TopTools_ListOfShape& theLCB)
-{
- Standard_Integer aNbF, aNbAdd1;
- TopExp_Explorer aExp;
- TopTools_IndexedDataMapOfShapeListOfShape aMEF;
- TopTools_MapIteratorOfMapOfShape aItM, aItM1;
- TopTools_MapOfShape aMCB, aMAdd, aMAdd1;
- TopTools_ListIteratorOfListOfShape aIt;
- //
- // 1. aMEF
- aNbF=theLFIn.Extent();
- aIt.Initialize(theLFIn);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aF=aIt.Value();
- TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
- }
- //
- // 2. aMCB
- const TopoDS_Shape& aF1=theLFIn.First();
- aMAdd.Add(aF1);
- //
- while(1) {
- aMAdd1.Clear();
- aItM.Initialize(aMAdd);
- for (; aItM.More(); aItM.Next()) {
- const TopoDS_Shape& aF=aItM.Key();
- //
- //aMAdd1.Clear();
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape& aE=aExp.Current();
- if (theMEAvoid.Contains(aE)){
- continue;
- }
- //
- const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE);
- aIt.Initialize(aLF);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aFx=aIt.Value();
- if (aFx.IsSame(aF)) {
- continue;
- }
- if (aMCB.Contains(aFx)) {
- continue;
- }
- aMAdd1.Add(aFx);
- }
- }//for (; aExp.More(); aExp.Next()){
- aMCB.Add(aF);
- }// for (; aItM.More(); aItM.Next()) {
- //
- aNbAdd1=aMAdd1.Extent();
- if (!aNbAdd1) {
- break;
- }
- //
- aMAdd.Clear();
- aItM1.Initialize(aMAdd1);
- for (; aItM1.More(); aItM1.Next()) {
- const TopoDS_Shape& aFAdd=aItM1.Key();
- aMAdd.Add(aFAdd);
- }
- //
- }//while(1) {
-
- //
- aNbF=aMCB.Extent();
- aItM.Initialize(aMCB);
- for (; aItM.More(); aItM.Next()) {
- const TopoDS_Shape& aF=aItM.Key();
- theLCB.Append(aF);
- }
-}
-//=======================================================================
-//function : FindFacePairs
-//purpose :
-//=======================================================================
-Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
- const TopTools_ListOfShape& thLF,
- NMTTools_ListOfCoupleOfShape& theLCFF)
-{
- Standard_Boolean bFound;
- Standard_Integer i, aNbCEF;
- TopAbs_Orientation aOr, aOrC;
- TopTools_MapOfShape aMFP;
- TopoDS_Face aF1, aF2;
- TopoDS_Edge aEL, aE1;
- TopTools_ListIteratorOfListOfShape aItLF;
- NMTTools_CoupleOfShape aCEF, aCFF;
- NMTTools_ListOfCoupleOfShape aLCEF, aLCEFx;
- NMTTools_ListIteratorOfListOfCoupleOfShape aIt;
- //
- bFound=Standard_True;
- //
- // Preface aLCEF
- aItLF.Initialize(thLF);
- for (; aItLF.More(); aItLF.Next()) {
- const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value());
- //
- bFound=GEOMAlgo_Tools3D::GetEdgeOnFace(theE, aFL, aEL);
- if (!bFound) {
- return bFound; // it can not be so
- }
- //
- aCEF.SetShape1(aEL);
- aCEF.SetShape2(aFL);
- aLCEF.Append(aCEF);
- }
- //
- aNbCEF=aLCEF.Extent();
- while(aNbCEF) {
- //
- // aLCEFx
- aLCEFx.Clear();
- aIt.Initialize(aLCEF);
- for (i=0; aIt.More(); aIt.Next(), ++i) {
- const NMTTools_CoupleOfShape& aCSx=aIt.Value();
- const TopoDS_Shape& aEx=aCSx.Shape1();
- const TopoDS_Shape& aFx=aCSx.Shape2();
- //
- aOr=aEx.Orientation();
- //
- if (!i) {
- aOrC=TopAbs::Reverse(aOr);
- aE1=TopoDS::Edge(aEx);
- aF1=TopoDS::Face(aFx);
- aMFP.Add(aFx);
- continue;
- }
- //
- if (aOr==aOrC) {
- aLCEFx.Append(aCSx);
- aMFP.Add(aFx);
- }
- }
- //
- // F2
- GEOMAlgo_Tools3D::GetFaceOff(aE1, aF1, aLCEFx, aF2);
- //
- aCFF.SetShape1(aF1);
- aCFF.SetShape2(aF2);
- theLCFF.Append(aCFF);
- //
- aMFP.Add(aF1);
- aMFP.Add(aF2);
- //
- // refine aLCEF
- aLCEFx.Clear();
- aLCEFx=aLCEF;
- aLCEF.Clear();
- aIt.Initialize(aLCEFx);
- for (; aIt.More(); aIt.Next()) {
- const NMTTools_CoupleOfShape& aCSx=aIt.Value();
- const TopoDS_Shape& aFx=aCSx.Shape2();
- if (!aMFP.Contains(aFx)) {
- aLCEF.Append(aCSx);
- }
- }
- //
- aNbCEF=aLCEF.Extent();
- }//while(aNbCEF) {
- //
- return bFound;
-}
-//
-//=======================================================================
-//function : AngleWithRef
-//purpose :
-//=======================================================================
-Standard_Real AngleWithRef(const gp_Dir& theD1,
- const gp_Dir& theD2,
- const gp_Dir& theDRef)
-{
- Standard_Real aCosinus, aSinus, aBeta, aHalfPI, aScPr;
- gp_XYZ aXYZ;
- //
- aHalfPI=0.5*M_PI;
- //
- const gp_XYZ& aXYZ1=theD1.XYZ();
- const gp_XYZ& aXYZ2=theD2.XYZ();
- aXYZ=aXYZ1.Crossed(aXYZ2);
- aSinus=aXYZ.Modulus();
- aCosinus=theD1*theD2;
- //
- aBeta=0.;
- if (aSinus>=0.) {
- aBeta=aHalfPI*(1.-aCosinus);
- }
- else {
- aBeta=2.*M_PI-aHalfPI*(3.+aCosinus);
- }
- //
- aScPr=aXYZ.Dot(theDRef.XYZ());
- if (aScPr<0.) {
- aBeta=-aBeta;
- }
- return aBeta;
-}
-//=======================================================================
-//function : GetApproxNormalToFaceOnEdge
-//purpose :
-//=======================================================================
-void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
- const TopoDS_Face& aFx,
- Standard_Real aT,
- gp_Pnt& aPF,
- gp_Dir& aDNF,
- const Handle(IntTools_Context)& aCtx)
-{
- Standard_Boolean bReverse;
- Standard_Real aT1, aT2, dT, aU, aV;
- gp_Dir aDTT, aDNFT, aDBT;
- gp_Pnt aPFT, aPFx;
- Handle(Geom_Curve) aC3D;
- Handle(Geom_Surface) aS;
- GeomAdaptor_Surface aGAS;
- GeomAbs_SurfaceType aTS;
- TopoDS_Face aF;
- TopoDS_Edge aE;
- //
- bReverse=Standard_False;
- aF=aFx;
- aE=aEx;
- if (aF.Orientation()==TopAbs_REVERSED){
- bReverse=!bReverse;
- aE.Reverse();
- //
- aF.Orientation(TopAbs_FORWARD);
- }
- //
- // Point at aT
- aC3D =BRep_Tool::Curve(aE, aT1, aT2);
- aC3D->D0(aT, aPFT);
- //
- // Normal at aT
- BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNFT);
-
- // Tangent at aT
- BOPTools_Tools3D::GetTangentToEdge(aE, aT, aDTT);
- //
- // Binormal at aT
- aDBT=aDNFT^aDTT;
- //
- dT=BOPTools_Tools3D::MinStepIn2d();//~1.e-5;
- dT=10.*dT;
- //----------------------------------------------
- {
- aS=BRep_Tool::Surface(aF);
- aGAS.Load(aS);
- aTS=aGAS.GetType();
- if (aTS==GeomAbs_BSplineSurface ||
- aTS==GeomAbs_BezierSurface ||
- aTS==GeomAbs_Plane){
- Standard_Real aTolEx, aTolFx, aTol, dUR, dVR, dR;
- //
- aTolEx=BRep_Tool::Tolerance(aEx);
- aTolFx=BRep_Tool::Tolerance(aFx);
- aTol=2.*aTolEx+aTolFx;
- dUR=aGAS.UResolution(aTol);
- dVR=aGAS.VResolution(aTol);
- dR=(dUR>dVR)? dUR : dVR;
- if (dR>dT) {
- dT=dR;
- }
- }
- else if (GeomAbs_Torus ||
- aTS==GeomAbs_Cylinder){
- Standard_Real aTolEx, aTolFx, aTol;
- //
- aTolEx=BRep_Tool::Tolerance(aEx);
- aTolFx=BRep_Tool::Tolerance(aFx);
- aTol=2.*aTolEx+aTolFx;
- if (aTol>dT) {
- dT=aTol;
- }
- }
- }
- //----------------------------------------------
- //
- aPFx.SetXYZ(aPFT.XYZ()+dT*aDBT.XYZ());
- //
- aPF=aPFx;
- aDNF=aDNFT;
- if (bReverse) {
- aDNF.Reverse();
- }
- //
- GeomAPI_ProjectPointOnSurf& aProjector=aCtx->ProjPS(aF);
- //
- aProjector.Perform(aPFx);
- if(aProjector.IsDone()) {
- aProjector.LowerDistanceParameters (aU, aV);
- aS->D0(aU, aV, aPF);
- BOPTools_Tools3D::GetNormalToSurface (aS, aU, aV, aDNF);
- if (bReverse){
- aDNF.Reverse();
- }
- }
-}
-
-//modified by NIZNHY-PKV Tue Nov 22 10:36:59 2011f
-//=======================================================================
-//function : PntInFace
-//purpose :
-//=======================================================================
-Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF,
- gp_Pnt& theP,
- gp_Pnt2d& theP2D)
-{
- Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
- Standard_Integer iErr, aIx, aNbDomains, i;
- Standard_Real aUMin, aUMax, aVMin, aVMax;
- Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
- Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
- gp_Dir2d aD2D (0., 1.);
- gp_Pnt2d aP2D;
- gp_Pnt aPx;
- Handle(Geom2d_Curve) aC2D;
- Handle(Geom2d_TrimmedCurve) aCT2D;
- Handle(Geom2d_Line) aL2D;
- Handle(Geom_Surface) aS;
- TopAbs_Orientation aOrE;
- TopoDS_Face aFF;
- TopExp_Explorer aExp;
- //
- aTolHatch2D=1.e-8;
- aTolHatch3D=1.e-8;
- aTotArcIntr=1.e-10;
- aTolTangfIntr=1.e-10;
- //
- Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
- Geom2dHatch_Hatcher aHatcher(aIntr,
- aTolHatch2D, aTolHatch3D,
- Standard_True, Standard_False);
- //
- iErr=0;
- aEpsT=1.e-12;
- //
- aFF=aF;
- aFF.Orientation (TopAbs_FORWARD);
- //
- aS=BRep_Tool::Surface(aFF);
- BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
- //
- // 1
- aExp.Init (aFF, TopAbs_EDGE);
- for (; aExp.More() ; aExp.Next()) {
- const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
- aOrE=aE.Orientation();
- //
- aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
- if (aC2D.IsNull() ) {
- iErr=1;
- return iErr;
- }
- if (fabs(aU1-aU2) < aEpsT) {
- iErr=2;
- return iErr;
- }
- //
- aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
- aHatcher.AddElement(aCT2D, aOrE);
- }// for (; aExp.More() ; aExp.Next()) {
- //
- // 2
- aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
- aP2D.SetCoord(aUx, 0.);
- aL2D=new Geom2d_Line (aP2D, aD2D);
- Geom2dAdaptor_Curve aHCur(aL2D);
- //
- aIx=aHatcher.AddHatching(aHCur) ;
- //
- // 3.
- aHatcher.Trim();
- bIsDone=aHatcher.TrimDone(aIx);
- if (!bIsDone) {
- iErr=3;
- return iErr;
- }
- //
- aHatcher.ComputeDomains(aIx);
- bIsDone=aHatcher.IsDone(aIx);
- if (!bIsDone) {
- iErr=4;
- return iErr;
- }
- //
- // 4.
- aNbDomains=aHatcher.NbDomains(aIx);
- for (i=1; i<=aNbDomains; ++i) {
- const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
- bHasFirstPoint=aDomain.HasFirstPoint();
- if (!bHasFirstPoint) {
- iErr=5;
- return iErr;
- }
- //
- aV1=aDomain.FirstPoint().Parameter();
- //
- bHasSecondPoint=aDomain.HasSecondPoint();
- if (!bHasSecondPoint) {
- iErr=6;
- return iErr;
- }
- //
- aV2=aDomain.SecondPoint().Parameter();
- //
- aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
- //
- break;
- }
- //
- aS->D0(aUx, aVx, aPx);
- //
- theP2D.SetCoord(aUx, aVx);
- theP=aPx;
- //
- return iErr;
-}
-//modified by NIZNHY-PKV Tue Nov 22 10:37:01 2011t
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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;
-}
#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
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();
}
//
}
}
//=======================================================================
-// function: Prepare
+// function: BuildResult
// purpose:
//=======================================================================
-void GEOMAlgo_VertexSolid::Prepare()
+void GEOMAlgo_VertexSolid::BuildResult()
{
- Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound;
+ 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;
//
- 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();
+ myLSIN.Clear();
+ myLSOUT.Clear();
+ myLSON.Clear();
+ //
+ const BOPDS_DS& aDS=myDSFiller->DS();
+ BOPDS_DS* pDS=(BOPDS_DS*)&aDS;
//
- const TopoDS_Shape& aObj=aDS.Object();
- const TopoDS_Shape& aTool=aDS.Tool();
+ BOPDS_VectorOfInterfVV& aVVs=pDS->InterfVV();
+ BOPDS_VectorOfInterfVE& aVEs=pDS->InterfVE();
+ BOPDS_VectorOfInterfVF& aVFs=pDS->InterfVF();
//
- const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
+ 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);
//
- iBeg=1;
- iEnd=aDS.NumberOfShapesOfTheObject();
- if (myRank==2) {
- iBeg=iEnd+1;
- iEnd=aDS.NumberOfSourceShapes();
- }
+ 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_Vertex& aV=TopoDS::Vertex(aDS.Shape(i));
- //
- aState=aDS.GetState(i);
- if (aState==BooleanOperations_ON ||
- aState==BooleanOperations_IN ||
- aState==BooleanOperations_OUT) {
- continue;
- }
+ const TopoDS_Vertex& aV=TopoDS::Vertex(aS);
//
iFound=0;
+ //
+ // 1
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;
+ 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;
+ continue;
}
//
+ // 4
aP3D=BRep_Tool::Pnt(aV);
- aTol=1.E-7;
+ 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;
- TopAbs_ShapeEnum aType;
- BooleanOperations_StateOfShape aState;
- //
- myLSIN.Clear();
- myLSOUT.Clear();
- myLSON.Clear();
- //
- 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_Shape& aV=aDS.Shape(i);
- aState=aDS.GetState(i);
- //
- if (aState==BooleanOperations_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) {
}
#include <Standard.hxx>
#include <Standard_Macro.hxx>
+
#include <GEOMAlgo_ShapeSolid.hxx>
//=======================================================================
virtual void Perform() ;
protected:
- Standard_EXPORT
- virtual void Prepare() ;
-
Standard_EXPORT
virtual void BuildResult() ;
};
+++ /dev/null
-// Copyright (C) 2007-2013 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;
-}
+++ /dev/null
-
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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);
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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.hxx
-// Created:
-// Author:
-// <pkv@VORTEX>
-
-#ifndef _GEOMAlgo_WESScaler_HeaderFile
-#define _GEOMAlgo_WESScaler_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Real.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <GEOMAlgo_DataMapOfOrientedShapeShape.hxx>
-#include <TopoDS_Shape.hxx>
-#include <GEOMAlgo_Algo.hxx>
-
-//=======================================================================
-//function : GEOMAlgo_WESScaler
-//purpose :
-//=======================================================================
-class GEOMAlgo_WESScaler : public GEOMAlgo_Algo
-{
-public:
- //! Empty constructor <br>
- Standard_EXPORT
- GEOMAlgo_WESScaler();
-
- Standard_EXPORT
- virtual ~GEOMAlgo_WESScaler();
-
- //! Modifier <br>
- Standard_EXPORT
- void SetScale(const Standard_Real aWES) ;
-
- //! Selector <br>
- Standard_EXPORT
- Standard_Real Scale() const;
-
- Standard_EXPORT
- void SetFace(const TopoDS_Face& aF) ;
-
- Standard_EXPORT
- const TopoDS_Face& Face() const;
-
- Standard_EXPORT
- void SetEdges(const TopTools_ListOfShape& aLE) ;
-
- Standard_EXPORT
- const TopTools_ListOfShape& Edges() const;
-
- //! Performs the algorithm <br>
- Standard_EXPORT
- virtual void Perform() ;
-
- Standard_EXPORT
- const TopoDS_Face& FaceScaled() const;
-
- Standard_EXPORT
- const TopTools_ListOfShape& EdgesScaled() const;
-
- Standard_EXPORT
- const TopoDS_Shape& Image(const TopoDS_Shape& aS) const;
-
- Standard_EXPORT
- const TopoDS_Shape& Origin(const TopoDS_Shape& aS) const;
-
- //! Selector <br>
- Standard_EXPORT
- const GEOMAlgo_DataMapOfOrientedShapeShape& Images() const;
-
- //! Selector <br>
- Standard_EXPORT
- const GEOMAlgo_DataMapOfOrientedShapeShape& Origins() const;
-
- protected:
-
- //! Performs the algorithm <br>
- Standard_EXPORT virtual void CheckData() ;
-
-
- Standard_Real myScale;
- TopoDS_Face myFace;
- TopTools_ListOfShape myEdges;
- TopoDS_Face myFaceScaled;
- TopTools_ListOfShape myEdgesScaled;
- GEOMAlgo_DataMapOfOrientedShapeShape myImages;
- GEOMAlgo_DataMapOfOrientedShapeShape myOrigins;
- TopoDS_Shape myShapeTmp;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_WireEdgeSet.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <GEOMAlgo_WireEdgeSet.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- GEOMAlgo_WireEdgeSet::GEOMAlgo_WireEdgeSet()
-{
- Clear();
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
- void GEOMAlgo_WireEdgeSet::Clear()
-{
- myStartShapes.Clear();
- myShapes.Clear();
-}
-//=======================================================================
-//function : SetFace
-//purpose :
-//=======================================================================
- void GEOMAlgo_WireEdgeSet::SetFace(const TopoDS_Face& aF)
-{
- myFace=aF;
-}
-//=======================================================================
-//function : Face
-//purpose :
-//=======================================================================
- const TopoDS_Face& GEOMAlgo_WireEdgeSet::Face()const
-{
- return myFace;
-}
-//=======================================================================
-//function : AddStartElement
-//purpose :
-//=======================================================================
- void GEOMAlgo_WireEdgeSet::AddStartElement(const TopoDS_Shape& aE)
-{
- myStartShapes.Append(aE);
-}
-//=======================================================================
-//function : StartElements
-//purpose :
-//=======================================================================
- const TopTools_ListOfShape& GEOMAlgo_WireEdgeSet::StartElements()const
-{
- return myStartShapes;
-}
-//=======================================================================
-//function : AddShape
-//purpose :
-//=======================================================================
- void GEOMAlgo_WireEdgeSet::AddShape(const TopoDS_Shape& aW)
-{
- myShapes.Append(aW);
-}
-//=======================================================================
-//function : Shapes
-//purpose :
-//=======================================================================
- const TopTools_ListOfShape& GEOMAlgo_WireEdgeSet::Shapes()const
-{
- return myShapes;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_WireEdgeSet.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-
-#ifndef _GEOMAlgo_WireEdgeSet_HeaderFile
-#define _GEOMAlgo_WireEdgeSet_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopoDS_Shape.hxx>
-
-//=======================================================================
-//function : GEOMAlgo_WireEdgeSet
-//purpose :
-//=======================================================================
-class GEOMAlgo_WireEdgeSet {
- public:
- Standard_EXPORT
- GEOMAlgo_WireEdgeSet();
-
- Standard_EXPORT
- void Clear() ;
-
- Standard_EXPORT
- void SetFace(const TopoDS_Face& aF) ;
-
- Standard_EXPORT
- const TopoDS_Face& Face() const;
-
- Standard_EXPORT
- void AddStartElement(const TopoDS_Shape& sS) ;
-
- Standard_EXPORT
- const TopTools_ListOfShape& StartElements() const;
-
- Standard_EXPORT
- void AddShape(const TopoDS_Shape& sS) ;
-
- Standard_EXPORT
- const TopTools_ListOfShape& Shapes() const;
-
-protected:
- TopoDS_Face myFace;
- TopTools_ListOfShape myStartShapes;
- TopTools_ListOfShape myShapes;
-};
-#endif
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <BOPTColStd_Dump.hxx>
+#include <BOPDS_DS.hxx>
+#include <BOPDS_IndexRange.hxx>
+#include <BOPDS_ListOfPaveBlock.hxx>
+#include <BOPDS_PaveBlock.hxx>
+#include <TopoDS_Solid.hxx>
+#include <BOPInt_Context.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
+#include <BRep_Tool.hxx>
+#include <BOPTools_AlgoTools.hxx>
-#include <BooleanOperations_ShapesDataStructure.hxx>
-#include <BooleanOperations_StateOfShape.hxx>
-
-#include <BOPTools_PaveFiller.hxx>
-#include <BOPTools_SplitShapesPool.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_DSFiller.hxx>
-#include <BOPTools_WireStateFiller.hxx>
+#include <Basics_OCCTVersion.hxx>
//=======================================================================
//function : GEOMAlgo_WireSolid
myErrorStatus=10;
return;
}
- if(!myDSFiller->IsDone()) {
+ if(myDSFiller->ErrorStatus()) {
myErrorStatus=11;
return;
}
//
- Standard_Boolean bIsNewFiller;
+ Standard_Integer aNbArgs;
//
- bIsNewFiller=myDSFiller->IsNewFiller();
-
- if (bIsNewFiller) {
- Prepare();
- myDSFiller->SetNewFiller(!bIsNewFiller);
+ const BOPDS_DS& aDS=myDSFiller->DS();
+ const BOPCol_ListOfShape& aLS=aDS.Arguments();
+ aNbArgs=aLS.Extent();
+ if (!aNbArgs) {
+ myErrorStatus=13;
+ return;
}
+ //
BuildResult();
}
//
}
}
//=======================================================================
-// function: Prepare
-// purpose:
-//=======================================================================
-void GEOMAlgo_WireSolid::Prepare()
-{
- const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
- //
- BOPTools_WireStateFiller aStateFiller(aPaveFiller);
- aStateFiller.Do();
- //
-}
-//=======================================================================
// function: BuildResult
// purpose:
//=======================================================================
void GEOMAlgo_WireSolid::BuildResult()
{
- const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
- const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
- const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
- //
- Standard_Integer i, aNbPB, nSp, iBeg, iEnd;
+ Standard_Boolean bHasPaveBlocks;
+ Standard_Integer i, iRank, aNbPB, iBeg, iEnd, aNbArgs, nE;// nSp
+ Standard_Real aTol;
TopAbs_ShapeEnum aType;
- BooleanOperations_StateOfShape aState;
+ TopAbs_State aState;
+ TopoDS_Edge aE;
//
+ myErrorStatus=0;
myLSIN.Clear();
myLSOUT.Clear();
myLSON.Clear();
//
- iBeg=1;
- iEnd=aDS.NumberOfShapesOfTheObject();
- if (aDS.Tool().ShapeType()==TopAbs_WIRE) {
- iBeg=iEnd+1;
- iEnd=aDS.NumberOfSourceShapes();
+ const BOPDS_DS& aDS=myDSFiller->DS();
+ BOPDS_DS* pDS=(BOPDS_DS*)&aDS;
+ //
+ const BOPCol_ListOfShape& aLS=pDS->Arguments();
+ aNbArgs=aLS.Extent();
+ if (aNbArgs!=2) {
+ myErrorStatus=14;
+ return;
+ }
+ //
+ iRank=-1;
+ const TopoDS_Shape& aObj=aLS.First();
+ if (aObj.ShapeType()==TopAbs_WIRE) {
+ iRank=0;
+ }
+ const TopoDS_Shape& aTool=aLS.Last();
+ if (aTool.ShapeType()==TopAbs_WIRE) {
+ iRank=1;
+ }
+ //
+ if (iRank==-1) {
+ myErrorStatus=15;
+ return;
}
//
+ aTol=1.e-7;
+ //
+ const TopoDS_Solid& aSolid=(iRank==0) ? *((TopoDS_Solid*)&aTool) :
+ *((TopoDS_Solid*)&aObj);
+ //
+ Handle(BOPInt_Context) aCtx=myDSFiller->Context();
+ //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
+ //
+ const BOPDS_IndexRange& aRange=pDS->Range(iRank);
+ aRange.Indices(iBeg, iEnd);
+ //
for (i=iBeg; i<=iEnd; ++i) {
- aType=aDS.GetShapeType(i);
- if (aType==TopAbs_EDGE) {
- const TopoDS_Shape& aE=aDS.Shape(i);
- const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
- aNbPB=aLPB.Extent();
- //
- if (!aNbPB) {
- aState=aDS.GetState(i);
- //
- if (aState==BooleanOperations_IN) {
- myLSIN.Append(aE);
- }
- else if (aState==BooleanOperations_OUT) {
- myLSOUT.Append(aE);
- }
- else if (aState==BooleanOperations_ON) {
- myLSON.Append(aE);
- }
+ const TopoDS_Shape& aS=pDS->Shape(i);
+ aType=aS.ShapeType();
+ if (aType!=TopAbs_EDGE) {
+ continue;
+ }
+ //
+ aE=*((TopoDS_Edge*)&pDS->Shape(i));
+ if (BRep_Tool::Degenerated(aE)) {
+ continue;
+ }
+ //
+ bHasPaveBlocks=pDS->HasPaveBlocks(i);
+ if (!bHasPaveBlocks) {
+ continue;
+ }
+ //
+ aState=TopAbs_UNKNOWN;
+ //
+ const BOPDS_ListOfPaveBlock& aLPB=pDS->PaveBlocks(i);
+ aNbPB=aLPB.Extent();
+ if (!aNbPB) {
+ aState=BOPTools_AlgoTools::ComputeStateByOnePoint(aE, aSolid, aTol, aCtx);
+ }
+ else if (aNbPB==1) {
+ const Handle(BOPDS_PaveBlock)& aPB=aLPB.First();
+#if OCC_VERSION_LARGE > 0x06060000 // Porting to OCCT higher 6.6.0 version
+ if (pDS->IsCommonBlock(aPB)) {
+#else
+ if (aPB->IsCommonBlock()) {
+#endif
+ aState=TopAbs_ON;
+ }
+ else{
+ nE=aPB->Edge();
+ aE=*((TopoDS_Edge*)&pDS->Shape(nE));
+ aState=BOPTools_AlgoTools::ComputeStateByOnePoint(aE, aSolid, aTol, aCtx);
+ }
+ //----------
+ if (aState==TopAbs_ON) {
+ myLSON.Append(aE);
+ }
+ else if (aState==TopAbs_OUT) {
+ myLSOUT.Append(aE);
}
- //
- else if (aNbPB==1) {
- 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(aE);
- }
- else if (aState==BooleanOperations_OUT) {
- myLSOUT.Append(aE);
- }
- else if (aState==BooleanOperations_ON) {
- myLSON.Append(aE);
- }
+ else if (aState==TopAbs_IN) {
+ myLSIN.Append(aE);
}
}
}
virtual void Perform() ;
protected:
- Standard_EXPORT
- virtual void Prepare() ;
-
Standard_EXPORT
virtual void BuildResult() ;
};
+++ /dev/null
-// Copyright (C) 2007-2013 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_WireSplitter.cxx
-// Author: Peter KURNEV
-
-#include <GEOMAlgo_WireSplitter.hxx>
-
-#include <TColStd_SequenceOfReal.hxx>
-#include <Precision.hxx>
-
-#include <gp_Pnt2d.hxx>
-#include <gp_Vec2d.hxx>
-#include <TColgp_SequenceOfPnt2d.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom2d_Curve.hxx>
-#include <GeomAdaptor_Surface.hxx>
-
-#include <TopAbs_Orientation.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRepAdaptor_Surface.hxx>
-#include <BRepAdaptor_Curve2d.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopTools_SequenceOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-
-#include <BOPTColStd_ListOfListOfShape.hxx>
-#include <BOPTColStd_ListIteratorOfListOfListOfShape.hxx>
-
-#include <BOPTools_Tools2D.hxx>
-
-#include <BOP_EdgeInfo.hxx>
-#include <BOP_ListOfEdgeInfo.hxx>
-#include <BOP_ListIteratorOfListOfEdgeInfo.hxx>
-#include <BOP_IndexedDataMapOfVertexListEdgeInfo.hxx>
-
-static
- void Path (const GeomAdaptor_Surface& aGAS,
- const TopoDS_Face& myFace,
- const TopoDS_Vertex& aVa,
- const TopoDS_Edge& aEOuta,
- BOP_EdgeInfo& anEdgeInfo,
- TopTools_SequenceOfShape& aLS,
- TopTools_SequenceOfShape& aVertVa,
- TColgp_SequenceOfPnt2d& aCoordVa,
- BOPTColStd_ListOfListOfShape& myShapes,
- BOP_IndexedDataMapOfVertexListEdgeInfo& mySmartMap);
-
-
-static
- Standard_Real Angle (const gp_Dir2d& aDir2D);
-
-
-static
- void GetNextVertex(const TopoDS_Vertex& aV,
- const TopoDS_Edge& aE,
- TopoDS_Vertex& aV1);
-static
- Standard_Real ClockWiseAngle(const Standard_Real aAngleIn,
- const Standard_Real aAngleOut);
-
-static
- Standard_Real AngleIn(const TopoDS_Edge& aEIn,
- const BOP_ListOfEdgeInfo& aLEInfo);
-
-static
- Standard_Real Angle2D (const TopoDS_Vertex& aV,
- const TopoDS_Edge& anEdge,
- const TopoDS_Face& myFace,
- const GeomAdaptor_Surface& aGAS,
- const Standard_Boolean aFlag);
-static
- gp_Pnt2d Coord2d (const TopoDS_Vertex& aV1,
- const TopoDS_Edge& aE1,
- const TopoDS_Face& aF);
-static
- gp_Pnt2d Coord2dVf (const TopoDS_Edge& aE,
- const TopoDS_Face& aF);
-static
- Standard_Real Tolerance2D (const TopoDS_Vertex& aV,
- const GeomAdaptor_Surface& aGAS);
-
-
-//modified by NIZNHY-PKV Thu Apr 19 09:04:59 2012f
-static
- Standard_Integer NbWaysOut(const TopoDS_Edge& aEOuta,
- const BOP_ListOfEdgeInfo& aLEInfo);
-//static
-// Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& );
-//modified by NIZNHY-PKV Thu Apr 19 09:04:53 2012t
-
-//=======================================================================
-// function:
-// purpose:
-//=======================================================================
- GEOMAlgo_WireSplitter::GEOMAlgo_WireSplitter()
-:
- GEOMAlgo_Algo(),
- myNothingToDo(Standard_False)
-{
-}
-//=======================================================================
-// function: ~
-// purpose:
-//=======================================================================
- GEOMAlgo_WireSplitter::~GEOMAlgo_WireSplitter()
-{
-}
-//=======================================================================
-// function: SetFace
-// purpose:
-//=======================================================================
- void GEOMAlgo_WireSplitter::SetFace(const TopoDS_Face& aFace)
-{
- myFace=aFace;
-}
-//=======================================================================
-// function: Face
-// purpose:
-//=======================================================================
- const TopoDS_Face& GEOMAlgo_WireSplitter::Face()const
-{
- return myFace;
-}
-//=======================================================================
-// function: SetEdges
-// purpose:
-//=======================================================================
- void GEOMAlgo_WireSplitter::SetEdges(const TopTools_ListOfShape& aLE)
-{
- TopTools_ListIteratorOfListOfShape anIt;
- //
- myEdges.Clear();
- anIt.Initialize(aLE);
- for (; anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aE =anIt.Value();
- //
- if (aE.Orientation()==TopAbs_INTERNAL){
- continue;
- }
- //
- myEdges.Append(aE);
- }
-}
-//=======================================================================
-// function: Edges
-// purpose:
-//=======================================================================
- const TopTools_ListOfShape& GEOMAlgo_WireSplitter::Edges()const
-{
- return myEdges;
-}
-//=======================================================================
-// function: IsNothingToDo
-// purpose:
-//=======================================================================
- Standard_Boolean GEOMAlgo_WireSplitter::IsNothingToDo()const
-{
- return myNothingToDo;
-}
-//=======================================================================
-// function: Shapes
-// purpose:
-//=======================================================================
- const BOPTColStd_ListOfListOfShape& GEOMAlgo_WireSplitter::Shapes()const
-{
- return myShapes;
-}
-//=======================================================================
-// function: Perform
-// purpose:
-//=======================================================================
- void GEOMAlgo_WireSplitter::Perform()
-{
- myErrorStatus=2;
- myNothingToDo=Standard_True;
-
- Standard_Integer index, i, aNb, aCntIn, aCntOut;
- Standard_Boolean anIsIn;
- Standard_Real anAngle;
-
- BOP_ListOfEdgeInfo emptyInfo;
- TopTools_ListIteratorOfListOfShape anItList;
- //
- // 1.Filling mySmartMap
- mySmartMap.Clear();
-
- anItList.Initialize(myEdges);
- for (; anItList.More(); anItList.Next()) {
- const TopoDS_Edge& anEdge = TopoDS::Edge(anItList.Value());
- //
- if (!BOPTools_Tools2D::HasCurveOnSurface (anEdge, myFace)) {
- continue;
- }
- //
- TopExp_Explorer anExpVerts (anEdge, TopAbs_VERTEX);
- for (; anExpVerts.More(); anExpVerts.Next()) {
- const TopoDS_Shape& aVertex= anExpVerts.Current();
-
- index = mySmartMap.FindIndex(aVertex);
- if (!index) {
- index=mySmartMap.Add(aVertex, emptyInfo);
- }
-
- BOP_ListOfEdgeInfo& aListOfEInfo=mySmartMap(index);
-
- BOP_EdgeInfo aEInfo;
- aEInfo.SetEdge(anEdge);
-
- TopAbs_Orientation anOr=aVertex.Orientation();
-
- if (anOr==TopAbs_FORWARD) {
- aEInfo.SetInFlag(Standard_False);
- }
-
- else if (anOr==TopAbs_REVERSED) {
- aEInfo.SetInFlag(Standard_True);
- }
-
- aListOfEInfo.Append(aEInfo);
- }
- }
- //
- aNb=mySmartMap.Extent();
- //
- // 2. myNothingToDo
- myNothingToDo=Standard_True;
-
- for (i=1; i<=aNb; i++) {
- aCntIn=0;
- aCntOut=0;
- const BOP_ListOfEdgeInfo& aLEInfo= mySmartMap(i);
- BOP_ListIteratorOfListOfEdgeInfo anIt(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- const BOP_EdgeInfo& anEdgeInfo=anIt.Value();
- anIsIn=anEdgeInfo.IsIn();
- if (anIsIn) {
- aCntIn++;
- }
- else {
- aCntOut++;
- }
- }
- if (aCntIn!=1 || aCntOut!=1) {
- myNothingToDo=Standard_False;
- break;
- }
- }
- //
- // Each vertex has one edge In and one - Out. Good. But it is not enought
- // to consider that nothing to do with this. We must check edges on TShape
- // coinsidence. If there are such edges there is something to do with.
- //
- if (myNothingToDo) {
- Standard_Integer aNbE, aNbMapEE;
- TopTools_IndexedDataMapOfShapeListOfShape aMapEE;
- aNbE=myEdges.Extent();
-
- anItList.Initialize(myEdges);
- for (; anItList.More(); anItList.Next()) {
- const TopoDS_Shape& aE = anItList.Value();
-
- if (!aMapEE.Contains(aE)) {
- TopTools_ListOfShape aLEx;
- aLEx.Append(aE);
- aMapEE.Add(aE, aLEx);
- }
- else {
- TopTools_ListOfShape& aLEx=aMapEE.ChangeFromKey(aE);
- aLEx.Append(aE);
- }
- }
-
- Standard_Boolean bFlag;
- bFlag=Standard_True;
- aNbMapEE=aMapEE.Extent();
- for (i=1; i<=aNbMapEE; i++) {
- const TopTools_ListOfShape& aLEx=aMapEE(i);
- aNbE=aLEx.Extent();
- if (aNbE==1) {
- // usual case
- continue;
- }
- else if (aNbE==2){
- const TopoDS_Shape& aE1=aLEx.First();
- const TopoDS_Shape& aE2=aLEx.Last();
- if (aE1.IsSame(aE2)) {
- bFlag=Standard_False;
- break;
- }
- }
- else {
- bFlag=Standard_False;
- break;
- }
- }
- myNothingToDo=myNothingToDo && bFlag;
- }
- //
- //
- if (myNothingToDo) {
- myErrorStatus=0;
- return;
- }
- //
- // 3. Angles in mySmartMap
- BRepAdaptor_Surface aBAS(myFace);
- const GeomAdaptor_Surface& aGAS=aBAS.Surface();
- for (i=1; i<=aNb; i++) {
- const TopoDS_Vertex& aV=TopoDS::Vertex (mySmartMap.FindKey(i));
- const BOP_ListOfEdgeInfo& aLEInfo= mySmartMap(i);
-
- BOP_ListIteratorOfListOfEdgeInfo anIt(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- BOP_EdgeInfo& anEdgeInfo=anIt.Value();
- const TopoDS_Edge& aE=anEdgeInfo.Edge();
- //
- TopoDS_Vertex aVV=aV;
- //
- anIsIn=anEdgeInfo.IsIn();
- if (anIsIn) {
- //
- aVV.Orientation(TopAbs_REVERSED);
- anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_True);
- }
- //
- else { // OUT
- //
- aVV.Orientation(TopAbs_FORWARD);
- anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_False);
- }
- anEdgeInfo.SetAngle(anAngle);
-
- }
- }
- //
- // 4. Do
- //
- Standard_Boolean anIsOut, anIsNotPassed;
-
- TopTools_SequenceOfShape aLS, aVertVa;
- TColgp_SequenceOfPnt2d aCoordVa;
-
- BOP_ListIteratorOfListOfEdgeInfo anIt;
-
- for (i=1; i<=aNb; i++) {
- const TopoDS_Vertex aVa=TopoDS::Vertex (mySmartMap.FindKey(i));
- const BOP_ListOfEdgeInfo& aLEInfo=mySmartMap(i);
-
- anIt.Initialize(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- BOP_EdgeInfo& anEdgeInfo=anIt.Value();
- const TopoDS_Edge& aEOuta=anEdgeInfo.Edge();
-
- anIsOut=!anEdgeInfo.IsIn();
- anIsNotPassed=!anEdgeInfo.Passed();
-
- if (anIsOut && anIsNotPassed) {
- //
- aLS.Clear();
- aVertVa.Clear();
- aCoordVa.Clear();
- //
- Path(aGAS, myFace, aVa, aEOuta, anEdgeInfo, aLS,
- aVertVa, aCoordVa, myShapes, mySmartMap);
- }
- }
- }
- //
- {
- Standard_Integer aNbV, aNbE;
- TopoDS_Vertex aV1, aV2;
- BOPTColStd_ListOfListOfShape aShapes;
- BOPTColStd_ListIteratorOfListOfListOfShape anItW(myShapes);
-
- for (; anItW.More(); anItW.Next()) {
- TopTools_IndexedMapOfShape aMV, aME;
- const TopTools_ListOfShape& aLE=anItW.Value();
- TopTools_ListIteratorOfListOfShape anItE(aLE);
- for (; anItE.More(); anItE.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(anItE.Value());
- aME.Add(aE);
- TopExp::Vertices(aE, aV1, aV2);
- aMV.Add(aV1);
- aMV.Add(aV2);
- }
- aNbV=aMV.Extent();
- aNbE=aME.Extent();
- if (aNbV<=aNbE) {
- aShapes.Append(aLE);
- }
- }
- //
- myShapes.Clear();
- anItW.Initialize(aShapes);
- for (; anItW.More(); anItW.Next()) {
- const TopTools_ListOfShape& aLE=anItW.Value();
- myShapes.Append(aLE);
- }
- }
- //
- myErrorStatus=0;
-}
-//=======================================================================
-// function: Path
-// purpose:
-//=======================================================================
- void Path (const GeomAdaptor_Surface& aGAS,
- const TopoDS_Face& myFace,
- const TopoDS_Vertex& aVa,
- const TopoDS_Edge& aEOuta,
- BOP_EdgeInfo& anEdgeInfo,
- TopTools_SequenceOfShape& aLS,
- TopTools_SequenceOfShape& aVertVa,
- TColgp_SequenceOfPnt2d& aCoordVa,
- BOPTColStd_ListOfListOfShape& myShapes,
- BOP_IndexedDataMapOfVertexListEdgeInfo& mySmartMap)
-{
- Standard_Integer i,j, aNb, aNbj, iCnt;
- Standard_Real aTol, anAngleIn, anAngleOut, anAngle, aMinAngle;
- Standard_Real aTol2D, aTol2D2;
- Standard_Real aTol2, aD2;
- Standard_Boolean anIsSameV2d, anIsSameV, anIsFound, anIsOut, anIsNotPassed;
- BOP_ListIteratorOfListOfEdgeInfo anIt;
- TopoDS_Vertex aVb;
- TopoDS_Edge aEOutb;
- //
- aTol=1.e-7;
- //
- // append block
- //
- // Do not escape through edge from which you enter
- aNb=aLS.Length();
- if (aNb==1) {
- const TopoDS_Shape& anEPrev=aLS(aNb);
- if (anEPrev.IsSame(aEOuta)) {
- return;
- }
- }
- //
- //
- anEdgeInfo.SetPassed(Standard_True);
- aLS.Append(aEOuta);
- aVertVa.Append(aVa);
-
- TopoDS_Vertex pVa=aVa;
- pVa.Orientation(TopAbs_FORWARD);
- gp_Pnt2d aPa=Coord2d(pVa, aEOuta, myFace);
- aCoordVa.Append(aPa);
-
- GetNextVertex (pVa, aEOuta, aVb);
-
- gp_Pnt2d aPb=Coord2d(aVb, aEOuta, myFace);
- //
- aTol=2.*Tolerance2D(aVb, aGAS);
- aTol2=10.*aTol*aTol;
- //
- aNb=aLS.Length();
- if (aNb>0) {
- //
- TopTools_ListOfShape aBuf;
- //
- for (i=aNb; i>0; i--) {
- const TopoDS_Shape& aVPrev=aVertVa(i);
- const gp_Pnt2d& aPaPrev=aCoordVa(i);
- const TopoDS_Shape& aEPrev=aLS(i);
-
- aBuf.Append(aEPrev);
-
- anIsSameV=aVPrev.IsSame(aVb);
- anIsSameV2d=Standard_False;
-
- if (anIsSameV) {
- anIsSameV2d = Standard_True;
- //
- aD2=aPaPrev.SquareDistance(aPb);
- anIsSameV2d =aD2<aTol2;
- }//if (anIsSameV) {
- //
- if (anIsSameV && anIsSameV2d) {
- myShapes.Append(aBuf);
- //
- TopTools_SequenceOfShape aLSt, aVertVat;
- TColgp_SequenceOfPnt2d aCoordVat;
- //
- aNbj=i-1;
- if (aNbj<1) {
- //
- aLS.Clear();
- aVertVa.Clear();
- aCoordVa.Clear();
- //
- return;
- }
-
- aVb=TopoDS::Vertex(aVertVa(i));
-
- for (j=1; j<=aNbj; j++) {
- aLSt.Append(aLS(j));
- aVertVat.Append(aVertVa(j));
- aCoordVat.Append(aCoordVa(j));
- }
- //
- aLS.Clear();
- aVertVa.Clear();
- aCoordVa.Clear();
-
- aLS=aLSt;
- aVertVa=aVertVat;
- aCoordVa=aCoordVat;
- //
- break;
- }
- }
- }
- //
- aTol2D=2.*Tolerance2D(aVb, aGAS);
- aTol2D2=100.*aTol2D*aTol2D;
- //
- // anAngleIn in Vb from edge aEOuta
- const BOP_ListOfEdgeInfo& aLEInfo=mySmartMap.FindFromKey(aVb);
- //
- anAngleIn=AngleIn(aEOuta, aLEInfo);
- //
- // aEOutb
- BOP_EdgeInfo *pEdgeInfo=NULL;
-
- aMinAngle=100.;
- anIsFound=Standard_False;
- //
- //modified by NIZNHY-PKV Thu Apr 19 09:05:09 2012f
- iCnt=NbWaysOut (aEOuta, aLEInfo);
- //iCnt=NbWaysOut (aLEInfo);
- //modified by NIZNHY-PKV Thu Apr 19 09:05:12 2012t
- if (!iCnt) { // no way to go . (Error)
- return ;
- }
- //
- anIt.Initialize(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- BOP_EdgeInfo& anEI=anIt.Value();
- const TopoDS_Edge& aE=anEI.Edge();
- anIsOut=!anEI.IsIn();
- anIsNotPassed=!anEI.Passed();
- //
- if (anIsOut && anIsNotPassed) {
- if (aE.IsSame(aEOuta)) {
- continue;
- }
- //
- if (iCnt==1) {
- // the one and only way to go out .
- pEdgeInfo=&anEI;
- anIsFound=Standard_True;
- break;
- }
- //
- // Look for minimal angle and make the choice.
- gp_Pnt2d aP2Dx;
- //
- aP2Dx=Coord2dVf(aE, myFace);
- //
- aD2=aP2Dx.SquareDistance(aPb);
- if (aD2 > aTol2D2){
- continue;
- }
- //
- anAngleOut=anEI.Angle();
- //
- anAngle=ClockWiseAngle(anAngleIn, anAngleOut);
- if (anAngle < aMinAngle) {
- aMinAngle=anAngle;
- pEdgeInfo=&anEI;
- anIsFound=Standard_True;
- }
- }
- } // for (; anIt.More(); anIt.Next())
- //
- if (!anIsFound) {
- // no way to go . (Error)
- return;
- }
- //
- aEOutb=pEdgeInfo->Edge();
- //
- Path (aGAS, myFace, aVb, aEOutb, *pEdgeInfo, aLS,
- aVertVa, aCoordVa, myShapes, mySmartMap);
-}
-//=======================================================================
-// function: Coord2dVf
-// purpose:
-//=======================================================================
- gp_Pnt2d Coord2dVf (const TopoDS_Edge& aE,
- const TopoDS_Face& aF)
-{
- Standard_Real aCoord=99.;
- gp_Pnt2d aP2D1(aCoord, aCoord);
- TopoDS_Iterator aIt;
- //
- aIt.Initialize(aE);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aVx=aIt.Value();
- if (aVx.Orientation()==TopAbs_FORWARD) {
- const TopoDS_Vertex& aVxx=TopoDS::Vertex(aVx);
- aP2D1=Coord2d(aVxx, aE, aF);
- return aP2D1;
- }
- }
- return aP2D1;
-}
-//=======================================================================
-// function: Tolerance2D
-// purpose:
-//=======================================================================
- Standard_Real Tolerance2D (const TopoDS_Vertex& aV,
- const GeomAdaptor_Surface& aGAS)
-{
- Standard_Real aTol2D, anUr, aVr, aTolV3D;
- GeomAbs_SurfaceType aType;
- //
- aType=aGAS.GetType();
- aTolV3D=BRep_Tool::Tolerance(aV);
-
- anUr=aGAS.UResolution(aTolV3D);
- aVr =aGAS.VResolution(aTolV3D);
- aTol2D=(aVr>anUr) ? aVr : anUr;
- //
- if (aType==GeomAbs_BSplineSurface||
- aType==GeomAbs_Sphere||
- GeomAbs_SurfaceOfRevolution) {
- if (aTol2D < aTolV3D) {
- aTol2D=aTolV3D;
- }
- }
- if (aType==GeomAbs_BSplineSurface) {
- aTol2D=1.1*aTol2D;
- }
- //
- return aTol2D;
-}
-
-//=======================================================================
-// function: Coord2d
-// purpose:
-//=======================================================================
- gp_Pnt2d Coord2d (const TopoDS_Vertex& aV1,
- const TopoDS_Edge& aE1,
- const TopoDS_Face& aF)
-{
- Standard_Real aT, aFirst, aLast;
- Handle(Geom2d_Curve) aC2D;
- gp_Pnt2d aP2D1;
- //
- aT=BRep_Tool::Parameter (aV1, aE1, aF);
- aC2D=BRep_Tool::CurveOnSurface(aE1, aF, aFirst, aLast);
- aC2D->D0 (aT, aP2D1);
- //
- return aP2D1;
-}
-//=======================================================================
-// function: AngleIn
-// purpose:
-//=======================================================================
- Standard_Real AngleIn(const TopoDS_Edge& aEIn,
- const BOP_ListOfEdgeInfo& aLEInfo)
-{
- Standard_Real anAngleIn;
- Standard_Boolean anIsIn;
- BOP_ListIteratorOfListOfEdgeInfo anIt;
-
- anIt.Initialize(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- BOP_EdgeInfo& anEdgeInfo=anIt.Value();
- const TopoDS_Edge& aE=anEdgeInfo.Edge();
- anIsIn=anEdgeInfo.IsIn();
- //
- if (anIsIn && aE==aEIn) {
- anAngleIn=anEdgeInfo.Angle();
- return anAngleIn;
- }
- }
- anAngleIn=0.;
- return anAngleIn;
-}
-//=======================================================================
-// function: ClockWiseAngle
-// purpose:
-//=======================================================================
- Standard_Real ClockWiseAngle(const Standard_Real aAngleIn,
- const Standard_Real aAngleOut)
-{
- Standard_Real aTwoPi = M_PI+M_PI;
- Standard_Real dA, A1, A2, AIn, AOut ;
-
- AIn=aAngleIn;
- AOut=aAngleOut;
- if (AIn >= aTwoPi) {
- AIn=AIn-aTwoPi;
- }
-
- if (AOut >= aTwoPi) {
- AOut=AOut-aTwoPi;
- }
-
- A1 = AIn + M_PI;
-
- if (A1 >= aTwoPi) {
- A1=A1-aTwoPi;
- }
-
- A2=AOut;
-
- dA=A1-A2;
- if (dA <= 0.) {
- dA=aTwoPi+dA;
- if (dA <= 1.e-14) {
- dA=aTwoPi;
- }
- }
- //xx
- else if (dA <= 1.e-14) {
- dA=aTwoPi;
- }
- return dA;
-}
-//=======================================================================
-// function: GetNextVertex
-// purpose:
-//=======================================================================
- void GetNextVertex(const TopoDS_Vertex& aV,
- const TopoDS_Edge& aE,
- TopoDS_Vertex& aV1)
-{
- TopoDS_Iterator aIt;
- //
- aIt.Initialize(aE);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aVx=aIt.Value();
- if (!aVx.IsEqual(aV)) {
- aV1=TopoDS::Vertex(aVx);
- return ;
- }
- }
- aV1=aV;
-}
-//=======================================================================
-// function: Angle2D
-// purpose:
-//=======================================================================
- Standard_Real Angle2D (const TopoDS_Vertex& aV,
- const TopoDS_Edge& anEdge,
- const TopoDS_Face& myFace,
- const GeomAdaptor_Surface& aGAS,
- const Standard_Boolean aFlag)
-{
- Standard_Real aFirst, aLast, aToler, dt, aTV, aTV1, anAngle, aTX;
- gp_Pnt2d aPV, aPV1;
- gp_Vec2d aV2D;
- Handle(Geom2d_Curve) aC2D;
- //
- aTV=BRep_Tool::Parameter (aV, anEdge, myFace);
- if (Precision::IsInfinite(aTV)) {
- return 0.;
- }
- //
- BOPTools_Tools2D::CurveOnSurface (anEdge, myFace, aC2D,
- aFirst, aLast, aToler, Standard_True);
- //dt=1.e-7;
- dt=2.*Tolerance2D(aV, aGAS);
- //
- aTX=0.25*(aLast - aFirst);
- if(dt > aTX) {
- // to save direction of the curve as much as it possible
- // in the case of big tolerances
- dt = aTX;
- }
- //
- if (fabs (aTV-aFirst) < fabs(aTV - aLast)) {
- aTV1=aTV + dt;
- }
- else {
- aTV1=aTV - dt;
- }
- //
- aC2D->D0 (aTV, aPV);
- aC2D->D0 (aTV1, aPV1);
- //
- if (aFlag) {//IN
- gp_Vec2d aV2DIn(aPV1, aPV);
- aV2D=aV2DIn;
- }
- else {
- gp_Vec2d aV2DOut(aPV, aPV1);
- aV2D=aV2DOut;
- }
- //
- gp_Dir2d aDir2D(aV2D);
- anAngle=Angle(aDir2D);
- //
- return anAngle;
-}
-//=======================================================================
-// function: Angle
-// purpose:
-//=======================================================================
-Standard_Real Angle (const gp_Dir2d& aDir2D)
-{
- gp_Dir2d aRefDir(1., 0.);
- Standard_Real anAngle = aRefDir.Angle(aDir2D);
-
- if (anAngle < 0.)
- anAngle += M_PI + M_PI;
-
- return anAngle;
-}
-//modified by NIZNHY-PKV Thu Apr 19 09:02:04 2012f
-//=======================================================================
-// function: NbWaysOut
-// purpose:
-//=======================================================================
-Standard_Integer NbWaysOut(const TopoDS_Edge& aEOuta,
- const BOP_ListOfEdgeInfo& aLEInfo)
-{
- Standard_Boolean bIsOut, bIsNotPassed;
- Standard_Integer iCnt=0;
- BOP_ListIteratorOfListOfEdgeInfo anIt;
- //
- anIt.Initialize(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- BOP_EdgeInfo& aEI=anIt.Value();
- const TopoDS_Edge& aE=aEI.Edge();
- bIsOut=!aEI.IsIn();
- bIsNotPassed=!aEI.Passed();
- if (bIsOut && bIsNotPassed) {
- if (!aE.IsSame(aEOuta)) {
- iCnt++;
- }
- }
- }
- return iCnt;
-}
-/*
-//=======================================================================
-// function: NbWaysOut
-// purpose:
-//=======================================================================
-Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& aLEInfo)
-{
- Standard_Boolean bIsOut, bIsNotPassed;
- Standard_Integer iCnt=0;
- BOP_ListIteratorOfListOfEdgeInfo anIt;
- //
- anIt.Initialize(aLEInfo);
- for (; anIt.More(); anIt.Next()) {
- BOP_EdgeInfo& anEI=anIt.Value();
- //
- bIsOut=!anEI.IsIn();
- bIsNotPassed=!anEI.Passed();
- if (bIsOut && bIsNotPassed) {
- iCnt++;
- }
- }
- return iCnt;
-}
-*/
-//modified by NIZNHY-PKV Thu Apr 19 09:01:57 2012t
+++ /dev/null
-// Copyright (C) 2007-2013 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_WireSplitter.hxx
-// Author: Peter KURNEV
-
-#ifndef _GEOMAlgo_WireSplitter_HeaderFile
-#define _GEOMAlgo_WireSplitter_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <TopoDS_Face.hxx>
-#include <Standard_Boolean.hxx>
-#include <BOPTColStd_ListOfListOfShape.hxx>
-#include <BOP_IndexedDataMapOfVertexListEdgeInfo.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <GEOMAlgo_Algo.hxx>
-
-//! the algorithm to split multiconnexed set of edges <br>
-//! wires on a face onto simple connexed wires <br>
-//! . <br>
-//=======================================================================
-//class : GEOMAlgo_WireSplitter
-//purpose :
-//=======================================================================
-class GEOMAlgo_WireSplitter : public GEOMAlgo_Algo
-{
-public:
- Standard_EXPORT
- GEOMAlgo_WireSplitter();
-
- Standard_EXPORT
- virtual ~GEOMAlgo_WireSplitter();
-
- Standard_EXPORT
- void SetFace(const TopoDS_Face& aF) ;
-
- Standard_EXPORT
- void SetEdges(const TopTools_ListOfShape& aLE) ;
-
- Standard_EXPORT
- const TopTools_ListOfShape& Edges() const;
-
- Standard_EXPORT
- virtual void Perform() ;
-
- Standard_EXPORT
- Standard_Boolean IsNothingToDo() const;
-
- Standard_EXPORT
- const TopoDS_Face& Face() const;
-
- Standard_EXPORT
- const BOPTColStd_ListOfListOfShape& Shapes() const;
-
-protected:
- TopoDS_Face myFace;
- Standard_Boolean myIsDone;
- Standard_Boolean myNothingToDo;
- BOPTColStd_ListOfListOfShape myShapes;
- BOP_IndexedDataMapOfVertexListEdgeInfo mySmartMap;
- TopTools_ListOfShape myEdges;
-};
-
-#endif
#endif
GeometryGUI::getTexture( study, textureId, aWidth, aHeight );
if ( !aTexture.IsNull() ) {
- static int TextureId = 0;
+#if OCC_VERSION_LARGE > 0x06060000 // Porting to OCCT higher 6.6.0 version
Handle(Prs3d_PointAspect) aTextureAspect =
new Prs3d_PointAspect( HasColor() ?
- // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
- (Quantity_NameOfColor)GetColor() :
- // color from properties
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
- ++TextureId,
aWidth, aHeight,
aTexture );
+#else
+ int TextureId = 0;
+ Handle(Prs3d_PointAspect) aTextureAspect =
+ new Prs3d_PointAspect( HasColor() ?
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
+ ++TextureId,
+ aWidth, aHeight,
+ aTexture );
+#endif
AISShape->Attributes()->SetPointAspect( aTextureAspect );
}
}
${KERNEL_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/ShHealOper
- ${PROJECT_SOURCE_DIR}/src/NMTDS
- ${PROJECT_SOURCE_DIR}/src/NMTTools
${PROJECT_SOURCE_DIR}/src/GEOM
${PROJECT_SOURCE_DIR}/src/BlockFix
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
SET(_link_LIBRARIES
${CAS_TKFeat}
${PYTHON_LIBRARIES}
- ShHealOper NMTTools GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede
+ ShHealOper GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede
${KERNEL_SALOMELocalTrace}
)
for (; It.More(); It.Next()) {
Scurrent = It.Value();
if (Scurrent.ShapeType() != TopAbs_EDGE) {
- Handle(Geom_BSplineCurve) newC;
- if (Scurrent.ShapeType() == TopAbs_WIRE) {
- TColgp_SequenceOfPnt PntSeq;
- // collect points
- for (Ex.Init(Scurrent, TopAbs_EDGE); Ex.More(); Ex.Next()) {
- TopoDS_Edge E = TopoDS::Edge(Ex.Current());
- if (BRep_Tool::Degenerated(E)) continue;
- C = BRep_Tool::Curve(E, First, Last);
- if( E.Orientation() == TopAbs_REVERSED ) {
- C->Reverse();
- }
- Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C);
- while( !tc.IsNull() ) {
- C = tc->BasisCurve();
- tc = Handle(Geom_TrimmedCurve)::DownCast(C);
- }
- int nbp = 10;
- if( C->IsKind(STANDARD_TYPE(Geom_Line)) ) {
- nbp = 4;
- }
- else if( C->IsKind(STANDARD_TYPE(Geom_Circle)) ||
- C->IsKind(STANDARD_TYPE(Geom_Ellipse)) ) {
- nbp = (int)25*fabs(Last-First)/(2.*M_PI);
- }
- else if( C->IsKind(STANDARD_TYPE(Geom_BezierCurve)) ) {
- Handle(Geom_BezierCurve) C3d = Handle(Geom_BezierCurve)::DownCast(C);
- nbp = C3d->NbPoles();
- }
- else if( C->IsKind(STANDARD_TYPE(Geom_BSplineCurve)) ) {
- Handle(Geom_BSplineCurve) C3d = Handle(Geom_BSplineCurve)::DownCast(C);
- nbp = C3d->NbPoles();
- }
- else {
- }
- if( nbp<4 ) nbp = 4;
- double dp = (Last-First)/(nbp-1);
- for(int i=1; i<nbp; i++) {
- gp_Pnt P;
- C->D0(First+dp*(i-1),P);
- PntSeq.Append(P);
- }
- }
- // add last point
- gp_Pnt P;
- C->D0(Last,P);
- PntSeq.Append(P);
- // create BSpline
- if(PntSeq.Length()>1) {
- TColgp_Array1OfPnt Pnts(1,PntSeq.Length());
- // check orientation of wire
- if( Scurrent.Orientation() == TopAbs_REVERSED ) {
- for(int i=1; i<=PntSeq.Length(); i++) {
- Pnts.SetValue(PntSeq.Length()-i+1,PntSeq.Value(i));
- }
- }
- else {
- for(int i=1; i<=PntSeq.Length(); i++) {
- Pnts.SetValue(i,PntSeq.Value(i));
- }
- }
- GeomAPI_PointsToBSpline PTB (Pnts);
- newC = Handle(Geom_BSplineCurve)::DownCast(PTB.Curve());
- // set periodic flag if curve is closed
- //if( newC->IsClosed() ) {
- // newC->SetPeriodic();
- //}
- // create edge
- double fp = newC->FirstParameter();
- double lp = newC->FirstParameter();
- gp_Pnt PF,PL;
- newC->D0(fp,PF);
- newC->D0(lp,PL);
- TopoDS_Vertex VF,VL;
- B.MakeVertex(VF,PF,1.e-7);
- B.MakeVertex(VL,PL,1.e-7);
- TopoDS_Edge newE;
- B.MakeEdge(newE,newC,1.e-7);
- B.Add(newE,VF);
- B.Add(newE,VL.Reversed());
- Scurrent = newE;
- }
+ TopoDS_Edge NewEdge;
+ if (Scurrent.ShapeType() == TopAbs_WIRE)
+ {
+ const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent);
+ NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
}
- if (newC.IsNull()) {
+ if (NewEdge.IsNull()) {
Standard_ConstructionError::Raise("The argument compound must contain only edges");
}
+ Scurrent = NewEdge;
}
B.Add(aComp,Scurrent);
}
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
-#include <NMTTools_CheckerSI.hxx>
-
-#include <NMTDS_Tools.hxx>
-#include <NMTDS_InterfPool.hxx>
-#include <NMTDS_PInterfPool.hxx>
-#include <NMTDS_PairBoolean.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
-
#include <Basics_OCCTVersion.hxx>
#include <utilities.h>
#include <gp_Pln.hxx>
#include <gp_Lin.hxx>
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPDS_DS.hxx>
+#include <BOPDS_MapOfPassKey.hxx>
+#include <BOPDS_PassKey.hxx>
+#include <GEOMAlgo_AlgoTools.hxx>
+#include <BOPAlgo_CheckerSI.hxx>
+
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
BRep_Builder aBB;
TopoDS_Compound aCS;
TopoDS_Shape aScopy;
- NMTDS_Tools::CopyShape(aShape, aScopy);
-
+ //
+ GEOMAlgo_AlgoTools::CopyShape(aShape, aScopy);
+ //
// Map sub-shapes and their indices
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aScopy, anIndices);
aBB.MakeCompound(aCS);
aBB.Add(aCS, aScopy);
- NMTTools_CheckerSI aCSI; // checker of self-interferences
- aCSI.SetCompositeShape(aCS);
+ BOPCol_ListOfShape aLCS;
+ aLCS.Append(aScopy);
+ //
+ BOPAlgo_CheckerSI aCSI; // checker of self-interferences
+ aCSI.SetArguments(aLCS);
// 1. Launch the checker
aCSI.Perform();
- Standard_Integer iErr = aCSI.StopStatus();
+ Standard_Integer iErr = aCSI.ErrorStatus();
if (iErr) {
return false; // Error
}
isGood = true;
-
+ //
+ Standard_Integer aNbS, n1, n2;
+ BOPDS_MapIteratorMapOfPassKey aItMPK;
+ //
// 2. Take the shapes from DS
- const NMTDS_ShapesDataStructure& aDS = *(aCSI.DS());
- Standard_Integer aNbS = aDS.NumberOfShapesOfTheObject();
-
+ const BOPDS_DS& aDS = aCSI.DS();
+ aNbS=aDS.NbShapes();
+ //
// 3. Get the pairs of interfered shapes
- NMTDS_PInterfPool pIP = aCSI.IP();
- //const NMTDS_ListOfPassKeyBoolean& aLPKB = pIP->Get();
- const NMTDS_ListOfPairBoolean& aLPKB = pIP->Get();
-
- Standard_Integer n1, n2;
- //NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
- NMTDS_ListIteratorOfListOfPairBoolean aIt;
-
- aIt.Initialize(aLPKB);
- for (; aIt.More(); aIt.Next()) {
- //const NMTDS_PassKeyBoolean& aPKB = aIt.Value();
- const NMTDS_PairBoolean& aPKB = aIt.Value();
- aPKB.Ids(n1, n2);
-
- if (n1 > aNbS || n2 > aNbS)
+ const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
+ aItMPK.Initialize(aMPK);
+ for (; aItMPK.More(); aItMPK.Next()) {
+ const BOPDS_PassKey& aPK=aItMPK.Value();
+ aPK.Ids(n1, n2);
+ //
+ if (n1 > aNbS || n2 > aNbS){
return false; // Error
-
+ }
const TopoDS_Shape& aS1 = aDS.Shape(n1);
const TopoDS_Shape& aS2 = aDS.Shape(n2);
#include <Standard_NullObject.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
+#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
+#include <BOPCol_ListOfShape.hxx>
//=======================================================================
//function : GetID
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
- //sklNMTAlgo_Splitter1 PS;
GEOMAlgo_Splitter PS;
TopTools_DataMapOfShapeShape aCopyMap;
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (ShapesMap.Add(aSimpleSh)) {
- PS.AddShape(aSimpleSh);
+ PS.AddArgument(aSimpleSh);
//skl if (DoRemoveWebs) {
//skl if (aMaterials->Length() >= ind)
//skl PS.SetMaterial(aSimpleSh, aMaterials->Value(ind));
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (!ToolsMap.Contains(aSimpleSh) && ShapesMap.Add(aSimpleSh))
- PS.AddShape(aSimpleSh);
+ PS.AddArgument(aSimpleSh);
}
}
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (!ToolsMap.Contains(aSimpleSh) && ShapesMap.Add(aSimpleSh))
- PS.AddShape(aSimpleSh);
+ PS.AddArgument(aSimpleSh);
}
}
}
// add object shapes that are in ListShapes;
- PS.AddShape(aShapeArg_copy);
+ PS.AddArgument(aShapeArg_copy);
//PS.AddShape(aShapeArg);
// add tool shapes that are in ListTools and not in ListShapes;
aShape = PS.Shape();
if (aShape.IsNull()) {
// Mantis issue 22009
- if (PS.ErrorStatus() == 10 && PS.Tools().Extent() == 0 && PS.Shapes().Extent() == 1)
- aShape = PS.Shapes().First();
+ if (PS.ErrorStatus() == 100 && PS.Tools().Extent() == 0 && PS.Arguments().Extent() == 1)
+ aShape = PS.Arguments().First();
else
return 0;
}
TopExp::MapShapes(aShape, aResIndices);
// Map: source_shape/images of source_shape in Result
- const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
+ const BOPCol_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
+ //const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
// history for all argument shapes
// be sure to use aCopyMap
//
if (!aMR.Contains(anEntity)) continue;
- const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
+ const BOPCol_ListOfShape& aModified = aMR.FindFromKey(anEntity);
+ //const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
Standard_Integer nbModified = aModified.Extent();
if (nbModified > 0) { // Mantis issue 0021182
int ih = 1;
- TopTools_ListIteratorOfListOfShape itM (aModified);
+ BOPCol_ListIteratorOfListOfShape itM (aModified);
for (; itM.More() && nbModified > 0; itM.Next(), ++ih) {
if (!aResIndices.Contains(itM.Value())) {
nbModified = 0;
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
int ih = 1;
- TopTools_ListIteratorOfListOfShape itM (aModified);
+ BOPCol_ListIteratorOfListOfShape itM (aModified);
+ //TopTools_ListIteratorOfListOfShape itM (aModified);
for (; itM.More(); itM.Next(), ++ih) {
int id = aResIndices.FindIndex(itM.Value());
anAttr->SetValue(ih, id);
#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepGProp.hxx>
+#include <GeomFill_Trihedron.hxx>
+#include <GeomFill_CorrectedFrenet.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <Geom_Conic.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BSplineSurface.hxx>
+#include <GeomAdaptor_HCurve.hxx>
#include <GeomFill_BSplineCurves.hxx>
#include <GeomConvert_ApproxCurve.hxx>
#include <GeomConvert.hxx>
{
}
+//=======================================================================
+//function : EvaluateBestSweepMode
+//purpose : auxilary for right call of MakePipe and MakePipeShell
+//=======================================================================
+static GeomFill_Trihedron EvaluateBestSweepMode(const TopoDS_Shape& Spine)
+{
+ GeomFill_Trihedron theMode = GeomFill_IsFrenet;
+
+ TopExp_Explorer Explo(Spine, TopAbs_EDGE);
+ for (; Explo.More(); Explo.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(Explo.Current());
+ Standard_Real fpar, lpar;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
+ GeomAdaptor_Curve GAcurve(aCurve, fpar, lpar);
+ Handle(GeomAdaptor_HCurve) GAHcurve = new GeomAdaptor_HCurve(GAcurve);
+
+ Handle(GeomFill_CorrectedFrenet) aCorrFrenet = new GeomFill_CorrectedFrenet(Standard_True); //for evaluation
+ aCorrFrenet->SetCurve(GAHcurve);
+ GeomFill_Trihedron aMode = aCorrFrenet->EvaluateBestMode();
+ if (aMode == GeomFill_IsDiscreteTrihedron)
+ {
+ theMode = aMode;
+ break;
+ }
+ if (aMode == GeomFill_IsCorrectedFrenet)
+ theMode = aMode;
+ }
+
+ return theMode;
+}
+
+
//=======================================================================
//function : FillForOtherEdges
//purpose : auxilary for CreatePipeForShellSections()
TopExp_Explorer expw2(FS2,TopAbs_WIRE);
TopoDS_Wire aWire2 = TopoDS::Wire(expw2.Current());
BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath);
+ if (theBestMode == GeomFill_IsDiscreteTrihedron)
+ aBuilder.SetDiscreteMode();
aBuilder.Add(aWire1, aLoc1);
aBuilder.Add(aWire2, aLoc2);
if (!aBuilder.IsReady()) {
num2 = SplitLocNums.Value(nn);
// make pipe
BRepOffsetAPI_MakePipeShell aBuilder(tmpW);
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(tmpW);
+ if (theBestMode == GeomFill_IsDiscreteTrihedron)
+ aBuilder.SetDiscreteMode();
Standard_Integer nbShapes = aTmpSeqBases.Length();
for (i=1; i<=nbShapes; i++) {
TopoDS_Shape aShapeLoc = aTmpSeqLocs.Value(i);
}
// make pipe for last part
BRepOffsetAPI_MakePipeShell aBuilder(tmpW);
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(tmpW);
+ if (theBestMode == GeomFill_IsDiscreteTrihedron)
+ aBuilder.SetDiscreteMode();
Standard_Integer nbShapes = aTmpSeqBases.Length();
for (i=1; i<=nbShapes; i++) {
TopoDS_Shape aShapeLoc = aTmpSeqLocs.Value(i);
else {
// old implementation without splitting
BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath);
+ if (theBestMode == GeomFill_IsDiscreteTrihedron)
+ aBuilder.SetDiscreteMode();
Standard_Integer nbShapes = aSeqBases.Length();
Standard_Integer step = nbShapes/nbBases;
if (!aWire1.IsNull() && !aWire2.IsNull()) {
//BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
BRepOffsetAPI_MakePipeShell aBuilder(WPath);
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(WPath);
+ if (theBestMode == GeomFill_IsDiscreteTrihedron)
+ aBuilder.SetDiscreteMode();
aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)),
aWithContact, aWithCorrect);
aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)),
// make pipe using aWire1 and aWire2
if (!aWire1.IsNull() && !aWire2.IsNull()) {
BRepOffsetAPI_MakePipeShell aBuilder(WPath);
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(WPath);
+ if (theBestMode == GeomFill_IsDiscreteTrihedron)
+ aBuilder.SetDiscreteMode();
aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)),
aWithContact, aWithCorrect);
aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)),
}
else
- aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase);
+ {
+ GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath);
+ aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase, theBestMode);
+ }
}
//building pipe with different sections
#include <GEOMImpl_IPoint.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
-#include <GEOMAlgo_Tools3D.hxx>
+#include <GEOMAlgo_AlgoTools.hxx>
#include <ShapeAnalysis.hxx>
}
TopoDS_Face F = TopoDS::Face(aRefShape);
gp_Pnt2d aP2d;
- GEOMAlgo_Tools3D::PntInFace(F, aPnt, aP2d);
+ GEOMAlgo_AlgoTools::PntInFace(F, aPnt, aP2d);
}
else if (aType == POINT_LINES_INTERSECTION) {
Handle(GEOM_Function) aRef1 = aPI.GetLine1();
anObj = self.HealOp.SewAllowNonManifold(theObject, theTolerance)
else:
anObj = self.HealOp.Sew(theObject, theTolerance)
+ # To avoid script failure in case of good argument shape
+ if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
+ return theObject
RaiseIfFailed("Sew", self.HealOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "sewed")
+++ /dev/null
-# Copyright (C) 2012-2013 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
-#
-
-# --- options ---
-
-# additional include directories
-INCLUDE_DIRECTORIES(
- ${CAS_INCLUDE_DIRS}
- ${KERNEL_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
-# additional preprocessor / compiler flags
-ADD_DEFINITIONS(
- ${CAS_DEFINITIONS}
- )
-
-# libraries to link to
-SET(_link_LIBRARIES
- ${CAS_KERNEL}
- #${CAS_MODELER}
- #${CAS_TKMesh}
- ${CAS_TKBool} ${CAS_BO}
- )
-
-# --- headers ---
-
-SET(NMTDS_HEADERS
- NMTDS_Tools.hxx
-)
-
-# --- sources ---
-
-SET(NMTDS_SOURCES
- NMTDS_BndSphere.cxx
- NMTDS_BndSphereTree.cxx
- NMTDS_BoxBndTree.cxx
- NMTDS_CArray1OfIndexRange.cxx
- NMTDS_IndexRange.cxx
- NMTDS_InterfPool.cxx
- NMTDS_IteratorCheckerSI.cxx
- NMTDS_Iterator.cxx
- NMTDS_PairBoolean.cxx
- NMTDS_Pair.cxx
- NMTDS_PairMapHasher.cxx
- NMTDS_PassKeyBoolean.cxx
- NMTDS_PassKey.cxx
- NMTDS_PassKeyMapHasher.cxx
- NMTDS_PassKeyShape.cxx
- NMTDS_PassKeyShapeMapHasher.cxx
- NMTDS_ShapesDataStructure.cxx
- NMTDS_Tools.cxx
- )
-
-# --- rules ---
-
-ADD_LIBRARY(NMTDS ${NMTDS_SOURCES})
-TARGET_LINK_LIBRARIES(NMTDS ${_link_LIBRARIES})
-INSTALL(TARGETS NMTDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
-
-INSTALL(FILES ${NMTDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+++ /dev/null
-Basics_OCCTVersion.hxx
-
-NMTDS_BoxBndTree.cxx
-NMTDS_BoxBndTree.hxx
-NMTDS_BndSphereTree.cxx
-NMTDS_BndSphereTree.hxx
-NMTDS_BndSphere.hxx
-NMTDS_BndSphere.cxx
-NMTDS_BndSphere.lxx
-NMTDS_IndexRange.hxx
-NMTDS_IndexRange.cxx
-NMTDS_InterfPool.hxx
-NMTDS_InterfPool.cxx
-NMTDS_Iterator.hxx
-NMTDS_Iterator.cxx
-NMTDS_IteratorCheckerSI.hxx
-NMTDS_IteratorCheckerSI.cxx
-NMTDS_Pair.hxx
-NMTDS_Pair.cxx
-NMTDS_PairBoolean.hxx
-NMTDS_PairBoolean.cxx
-NMTDS_PairMapHasher.hxx
-NMTDS_PairMapHasher.cxx
-NMTDS_PassKey.hxx
-NMTDS_PassKey.cxx
-NMTDS_PassKeyBoolean.hxx
-NMTDS_PassKeyBoolean.cxx
-NMTDS_PassKeyMapHasher.hxx
-NMTDS_PassKeyMapHasher.cxx
-NMTDS_PassKeyShape.hxx
-NMTDS_PassKeyShape.cxx
-NMTDS_PassKeyShapeMapHasher.hxx
-NMTDS_PassKeyShapeMapHasher.cxx
-NMTDS_Tools.hxx
-NMTDS_Tools.cxx
-NMTDS_ShapesDataStructure.hxx
-NMTDS_ShapesDataStructure.cxx
-NMTDS_InterfType.hxx
-NMTDS_PInterfPool.hxx
-NMTDS_PIterator.hxx
-NMTDS_PShapesDataStructure.hxx
-
-NMTDS_ListOfPassKey.hxx
-NMTDS_ListIteratorOfListOfPassKey.hxx
-NMTDS_ListOfPassKeyBoolean.hxx
-NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx
-NMTDS_ListOfPair.hxx
-NMTDS_ListIteratorOfListOfPair.hxx
-NMTDS_ListOfPairBoolean.hxx
-NMTDS_ListIteratorOfListOfPairBoolean.hxx
-NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx
-NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx
-NMTDS_MapOfPassKey.hxx
-NMTDS_MapIteratorOfMapOfPassKey.hxx
-NMTDS_MapOfPassKeyBoolean.hxx
-NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx
-NMTDS_MapOfPairBoolean.hxx
-NMTDS_MapIteratorOfMapOfPairBoolean.hxx
-NMTDS_IndexedDataMapOfShapeBox.hxx
-NMTDS_IndexedDataMapOfIntegerShape.hxx
-NMTDS_IndexedDataMapOfShapeBndSphere.hxx
-NMTDS_DataMapOfIntegerMapOfInteger.hxx
-NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx
-
-NMTDS_CArray1OfIndexRange.hxx
-NMTDS_CArray1OfIndexRange.cxx
+++ /dev/null
--- Copyright (C) 2007-2013 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.cdl
--- Created: Fri Nov 28 10:13:19 2003
--- Author: Peter KURNEV
---
-package NMTDS
-
- ---Purpose:
-
---uses
- --TCollection,
- --TColStd,
- --gp,
- --Bnd,
- --TopoDS,
- --TopAbs,
- --TopTools,
- --BooleanOperations,
- --BOPTools,
- --BOPTColStd
-
-is
- imported InterfType from NMTDS;
- imported BndSphere from NMTDS;
- imported IndexRange from NMTDS;
- imported InterfPool from NMTDS;
- imported Iterator from NMTDS;
- imported IteratorCheckerSI from NMTDS;
- imported Pair from NMTDS;
- imported PairBoolean from NMTDS;
- imported PairMapHasher from NMTDS;
- imported PassKey from NMTDS;
- imported PassKeyBoolean from NMTDS;
- imported PassKeyMapHasher from NMTDS;
- imported PassKeyShape from NMTDS;
- imported PassKeyShapeMapHasher from NMTDS;
- imported Tools from NMTDS;
- imported ShapesDataStructure from NMTDS;
- imported PShapesDataStructure from NMTDS;
- imported PIterator from NMTDS;
- imported PInterfPool from NMTDS;
- --
- imported ListOfPassKey from NMTDS;
- imported ListIteratorOfListOfPassKey from NMTDS;
-
- imported ListOfPassKeyBoolean from NMTDS;
- imported ListIteratorOfListOfPassKeyBoolean from NMTDS;
-
- imported ListOfPair from NMTDS;
- imported ListIteratorOfListOfPair from NMTDS;
-
- imported ListOfPairBoolean from NMTDS;
- imported ListIteratorOfListOfPairBoolean from NMTDS;
-
- imported ListOfIndexedDataMapOfShapeAncestorsSuccessors from NMTDS;
- imported ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors from NMTDS;
-
- imported MapOfPassKey from NMTDS;
- imported MapIteratorOfMapOfPassKey from NMTDS;
-
- imported MapOfPairBoolean from NMTDS;
- imported MapIteratorOfMapOfPairBoolean from NMTDS;
-
- imported IndexedDataMapOfShapeBox from NMTDS;
- imported IndexedDataMapOfIntegerShape from NMTDS;
- imported IndexedDataMapOfShapeBndSphere from NMTDS;
-
- imported DataMapOfIntegerMapOfInteger from NMTDS;
- imported DataMapIteratorOfDataMapOfIntegerMapOfInteger from NMTDS;
-
- imported CArray1OfIndexRange from NMTDS;
-
-end NMTDS;
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_BndSphere.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_BndSphere.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_BndSphere::NMTDS_BndSphere()
-{
- myCenter.SetCoord(0., 0., 0.);
- myRadius=0.;
- myGap=0.;
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- NMTDS_BndSphere::~NMTDS_BndSphere()
-{
-}
-//=======================================================================
-//function : IsOut
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_BndSphere::IsOut(const NMTDS_BndSphere& theOther)const
-{
- Standard_Real aD2, aT2;
- //
- aD2=myCenter.SquareDistance(theOther.myCenter);
- aT2=myRadius+myGap+theOther.myRadius+theOther.myGap;
- aT2=aT2*aT2;
- //
- return aD2>aT2;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_BndSphere.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-
-#ifndef _NMTDS_BndSphere_HeaderFile
-#define _NMTDS_BndSphere_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <gp_Pnt.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Boolean.hxx>
-
-//=======================================================================
-//class : NMTDS_BndSphere
-//purpose :
-//=======================================================================
-class NMTDS_BndSphere {
- public:
- Standard_EXPORT
- NMTDS_BndSphere();
-
- Standard_EXPORT
- virtual ~NMTDS_BndSphere();
-
- void SetCenter(const gp_Pnt& theP) ;
-
- const gp_Pnt& Center() const;
-
- void SetRadius(const Standard_Real theR) ;
-
- Standard_Real Radius() const;
-
- void SetGap(const Standard_Real theGap) ;
-
- Standard_Real Gap() const;
-
- void Add(const NMTDS_BndSphere& theOther) ;
-
- Standard_EXPORT
- Standard_Boolean IsOut(const NMTDS_BndSphere& theOther) const;
-
- Standard_Real SquareExtent() const;
-
- protected:
- gp_Pnt myCenter;
- Standard_Real myRadius;
- Standard_Real myGap;
-};
-
-#include <NMTDS_BndSphere.lxx>
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_BndSphere.lxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//=======================================================================
-//function : SetCenter
-//purpose :
-//=======================================================================
- inline void NMTDS_BndSphere::SetCenter(const gp_Pnt& theP)
-//
-{
- myCenter=theP;
-}
-//=======================================================================
-//function : Center
-//purpose :
-//=======================================================================
- inline const gp_Pnt& NMTDS_BndSphere::Center()const
-{
- return myCenter;
-}
-//=======================================================================
-//function : SetRadius
-//purpose :
-//=======================================================================
- inline void NMTDS_BndSphere::SetRadius(const Standard_Real theR)
-{
- myRadius=theR;
-}
-//=======================================================================
-//function : Radius
-//purpose :
-//=======================================================================
- inline Standard_Real NMTDS_BndSphere::Radius()const
-{
- return myRadius;
-}
-//=======================================================================
-//function : SetGap
-//purpose :
-//=======================================================================
- inline void NMTDS_BndSphere::SetGap(const Standard_Real theGap)
-{
- myGap=theGap;
-}
-//=======================================================================
-//function : Gap
-//purpose :
-//=======================================================================
- inline Standard_Real NMTDS_BndSphere::Gap()const
-{
- return myGap;
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
- inline void NMTDS_BndSphere::Add(const NMTDS_BndSphere& theOther)
-{
- Standard_Real aTmax, aR, aT, aTOther;
- gp_Pnt aPc;
- //
- aPc.SetXYZ(0.5*(myCenter.XYZ()+theOther.myCenter.XYZ()));
- //
- aR=aPc.Distance(myCenter);
- //
- aT=myRadius+myGap;
- aTOther=theOther.myRadius+theOther.myGap;
- aTmax=(aT>aTOther) ? aT: aTOther;
- //
- aR=aR+aTmax;
- //
- myCenter=aPc;
- myRadius=aR;
-}
-//=======================================================================
-//function : SquareExtent
-//purpose :
-//=======================================================================
- inline Standard_Real NMTDS_BndSphere::SquareExtent()const
-{
- Standard_Real aD;
- //
- aD=myRadius+myGap;
- aD=aD+aD;
- aD=aD*aD;
- //
- return aD;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_BndSphereTree.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_BndSphereTree.hxx>
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_BndSphereTreeSelector::NMTDS_BndSphereTreeSelector()
-{
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- NMTDS_BndSphereTreeSelector::~NMTDS_BndSphereTreeSelector()
-{
-}
-//=======================================================================
-//function : Reject
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_BndSphereTreeSelector::Reject (const NMTDS_BndSphere& aBox) const
-{
- Standard_Boolean bRet;
- //
- bRet=myBox.IsOut(aBox);
- return bRet;
-}
-//=======================================================================
-//function : Accept
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
-{
- Standard_Boolean bRet=Standard_False;
- //
- if (myFence.Add(aIndex)) {
- myIndices.Append(aIndex);
- bRet=!bRet;
- }
- return bRet;
-}
-//=======================================================================
-//function : SetBox
-//purpose :
-//=======================================================================
- void NMTDS_BndSphereTreeSelector::SetBox(const NMTDS_BndSphere& aBox)
-{
- myBox=aBox;
-}
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
- void NMTDS_BndSphereTreeSelector::Clear()
-{
- myFence.Clear();
- myIndices.Clear();
-}
-//=======================================================================
-//function : Indices
-//purpose :
-//=======================================================================
- const TColStd_ListOfInteger& NMTDS_BndSphereTreeSelector::Indices() const
-{
- return myIndices;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_BndSphereTree.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef NMTDS_BndSphereTree_HeaderFile
-#define NMTDS_BndSphereTree_HeaderFile
-
-#include <NCollection_UBTree.hxx>
-#include <NMTDS_BndSphere.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-
-typedef NCollection_UBTree <Standard_Integer , NMTDS_BndSphere> NMTDS_BndSphereTree;
-
- class NMTDS_BndSphereTreeSelector : public NMTDS_BndSphereTree::Selector {
- public:
- Standard_EXPORT NMTDS_BndSphereTreeSelector();
- Standard_EXPORT virtual Standard_Boolean Reject(const NMTDS_BndSphere&) const;
- Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
- Standard_EXPORT virtual ~NMTDS_BndSphereTreeSelector();
-
- Standard_EXPORT void Clear();
- Standard_EXPORT void SetBox(const NMTDS_BndSphere&);
- Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
-
- protected:
- NMTDS_BndSphere myBox;
- TColStd_MapOfInteger myFence;
- TColStd_ListOfInteger myIndices;
-
- };
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_BoxBndTree.cxx
-// Created: Tue Oct 17 13:04:11 2006
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_BoxBndTree.hxx>
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_BoxBndTreeSelector::NMTDS_BoxBndTreeSelector()
-{
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- NMTDS_BoxBndTreeSelector::~NMTDS_BoxBndTreeSelector()
-{
-}
-//=======================================================================
-//function : Reject
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
-{
- Standard_Boolean bRet;
- //
- bRet=myBox.IsOut(aBox);
- return bRet;
-}
-//=======================================================================
-//function : Accept
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
-{
- Standard_Boolean bRet=Standard_False;
- //
- if (myFence.Add(aIndex)) {
- myIndices.Append(aIndex);
- bRet=!bRet;
- }
- return bRet;
-}
-//=======================================================================
-//function : SetBox
-//purpose :
-//=======================================================================
- void NMTDS_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
-{
- myBox=aBox;
-}
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
- void NMTDS_BoxBndTreeSelector::Clear()
-{
- myFence.Clear();
- myIndices.Clear();
-}
-//=======================================================================
-//function : Indices
-//purpose :
-//=======================================================================
- const TColStd_ListOfInteger& NMTDS_BoxBndTreeSelector::Indices() const
-{
- return myIndices;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_BoxBndTree.hxx
-// Created: Tue Oct 17 12:50:31 2006
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef NMTDS_BoxBndTree_HeaderFile
-#define NMTDS_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;
-
- class NMTDS_BoxBndTreeSelector : public NMTDS_BoxBndTree::Selector {
- public:
- Standard_EXPORT NMTDS_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 void Clear();
- Standard_EXPORT void SetBox(const Bnd_Box&);
- Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
-
- protected:
- Bnd_Box myBox;
- TColStd_MapOfInteger myFence;
- TColStd_ListOfInteger myIndices;
-
- };
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_CArray1OfIndexRange.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-
-#include <NMTDS_CArray1OfIndexRange.hxx>
-
-#ifndef _Standard_OutOfRange_HeaderFile
-#include <Standard_OutOfRange.hxx>
-#endif
-#ifndef _Standard_OutOfMemory_HeaderFile
-#include <Standard_OutOfMemory.hxx>
-#endif
-
-
-#define Array1Item NMTDS_IndexRange
-#define Array1Item_hxx <NMTDS_IndexRange.hxx>
-#define BOPTColStd_CArray1 NMTDS_CArray1OfIndexRange
-#define BOPTColStd_CArray1_hxx <NMTDS_CArray1OfIndexRange.hxx>
-#include <BOPTColStd_CArray1.gxx>
-
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_BndSphere.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-
-#ifndef _NMTDS_CArray1OfIndexRange_HeaderFile
-#define _NMTDS_CArray1OfIndexRange_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Address.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <NMTDS_IndexRange.hxx>
-
-class Standard_OutOfRange;
-class Standard_OutOfMemory;
-
-
-
-//=======================================================================
-//function : NMTDS_CArray1OfIndexRange
-//purpose :
-//=======================================================================
-class NMTDS_CArray1OfIndexRange {
- public:
-
- Standard_EXPORT
- NMTDS_CArray1OfIndexRange(const Standard_Integer Length = 0,
- const Standard_Integer BlockLength = 5);
-
- Standard_EXPORT
- void Resize(const Standard_Integer theNewLength) ;
-
- Standard_EXPORT
- void Destroy() ;
-
- ~NMTDS_CArray1OfIndexRange() {
- Destroy();
- }
-
- Standard_EXPORT
- Standard_Integer Length() const;
-
- Standard_EXPORT
- Standard_Integer Extent() const;
-
- Standard_EXPORT
- Standard_Integer FactLength() const;
-
- Standard_EXPORT
- Standard_Integer Append(const NMTDS_IndexRange& Value) ;
-
- Standard_EXPORT
- void Remove(const Standard_Integer Index) ;
-
- Standard_EXPORT
- const NMTDS_IndexRange& Value(const Standard_Integer Index) const;
-
- const NMTDS_IndexRange& operator ()(const Standard_Integer Index) const {
- return Value(Index);
- }
-
- Standard_EXPORT
- NMTDS_IndexRange& ChangeValue(const Standard_Integer Index) ;
-
- NMTDS_IndexRange& operator ()(const Standard_Integer Index) {
- return ChangeValue(Index);
- }
-
- Standard_EXPORT
- void SetBlockLength(const Standard_Integer aBL) ;
-
- Standard_EXPORT
- Standard_Integer BlockLength() const;
-
- Standard_EXPORT
- void Purge() ;
-
- private:
- Standard_EXPORT
- NMTDS_CArray1OfIndexRange(const NMTDS_CArray1OfIndexRange& AnArray);
-
- Standard_EXPORT
- NMTDS_CArray1OfIndexRange& Assign(const NMTDS_CArray1OfIndexRange& Other) ;
-
- NMTDS_CArray1OfIndexRange& operator =(const NMTDS_CArray1OfIndexRange& Other) {
- return Assign(Other);
- }
-
- Standard_EXPORT
- Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const;
-
-
- Standard_Address myStart;
- Standard_Integer myLength;
- Standard_Integer myFactLength;
- Standard_Integer myBlockLength;
- Standard_Boolean myIsAllocated;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx
-// Created: Mon Feb 20 09:31:43 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile
-#define NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile
-
-#ifndef NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile
-#include <NMTDS_DataMapOfIntegerMapOfInteger.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_DataMapOfIntegerMapOfInteger.hxx
-// Created: Mon Feb 20 09:27:40 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile
-#define NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile
-
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIntegerHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<Standard_Integer, TColStd_MapOfInteger, TColStd_MapIntegerHasher> NMTDS_DataMapOfIntegerMapOfInteger;
-typedef NMTDS_DataMapOfIntegerMapOfInteger::Iterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger;
-
-#undef _NCollection_MapHasher
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_IndexRange.cxx
-// Created: Fri Nov 28 10:34:59 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_IndexRange.hxx>
-
-//=======================================================================
-//function :NMTDS_IndexRange::NMTDS_IndexRange
-//purpose :
-//=======================================================================
- NMTDS_IndexRange::NMTDS_IndexRange()
-:
- myFirst(0),
- myLast(0)
-{
-}
-//=======================================================================
-//function :SetFirst
-//purpose :
-//=======================================================================
- void NMTDS_IndexRange::SetFirst(const Standard_Integer aFirst)
-{
- myFirst=aFirst;
-}
-//=======================================================================
-//function :First
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_IndexRange::First()const
-{
- return myFirst;
-}
-//=======================================================================
-//function :SetLast
-//purpose :
-//=======================================================================
- void NMTDS_IndexRange::SetLast(const Standard_Integer aLast)
-{
- myLast=aLast;
-}
-//=======================================================================
-//function :Last
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_IndexRange::Last()const
-{
- return myLast;
-}
-//=======================================================================
-//function :IsInRange
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_IndexRange::IsInRange(const Standard_Integer aIndex)const
-{
- return (Standard_Boolean)(aIndex>=myFirst && aIndex<=myLast);
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_IndexRange.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-
-#ifndef _NMTDS_IndexRange_HeaderFile
-#define _NMTDS_IndexRange_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-
-//=======================================================================
-//class : NMTDS_IndexRange
-//purpose :
-//=======================================================================
-class NMTDS_IndexRange {
- public:
-
- Standard_EXPORT
- NMTDS_IndexRange();
-
- Standard_EXPORT void SetFirst(const Standard_Integer aFirst) ;
-
- Standard_EXPORT void SetLast(const Standard_Integer aLast) ;
-
- Standard_EXPORT Standard_Integer First() const;
-
- Standard_EXPORT Standard_Integer Last() const;
-
- Standard_EXPORT Standard_Boolean IsInRange(const Standard_Integer aIndex) const;
-
-protected:
- Standard_Integer myFirst;
- Standard_Integer myLast;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_IndexedDataMapOfIntegerShape.hxx
-// Created: Mon Feb 20 09:20:07 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_IndexedDataMapOfIntegerShape_HeaderFile
-#define NMTDS_IndexedDataMapOfIntegerShape_HeaderFile
-
-#include <TopoDS_Shape.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_MapIntegerHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_IndexedDataMap.hxx>
-
-
-typedef NCollection_IndexedDataMap<Standard_Integer, TopoDS_Shape, TColStd_MapIntegerHasher> NMTDS_IndexedDataMapOfIntegerShape;
-
-#undef _NCollection_MapHasher
-
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_IndexedDataMapOfShapeBndSphere.hxx
-// Created: Mon Feb 20 09:17:01 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_IndexedDataMapOfShapeBndSphere_HeaderFile
-#define NMTDS_IndexedDataMapOfShapeBndSphere_HeaderFile
-
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
-#include <NMTDS_BndSphere.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_IndexedDataMap.hxx>
-
-
-
-typedef NCollection_IndexedDataMap<TopoDS_Shape, NMTDS_BndSphere, TopTools_ShapeMapHasher> NMTDS_IndexedDataMapOfShapeBndSphere;
-
-#undef _NCollection_MapHasher
-
-
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_IndexedDataMapOfShapeBox.hxx
-// Created: Mon Feb 20 09:17:01 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_IndexedDataMapOfShapeBox_HeaderFile
-#define NMTDS_IndexedDataMapOfShapeBox_HeaderFile
-
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
-#include <Bnd_Box.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_IndexedDataMap.hxx>
-
-
-typedef NCollection_IndexedDataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher> NMTDS_IndexedDataMapOfShapeBox;
-
-#undef _NCollection_MapHasher
-
-
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_InterfPool.cxx
-// Author: Peter KURNEV
-
-#include <NMTDS_InterfPool.hxx>
-
-#include <NMTDS_PairBoolean.hxx>
-#include <NMTDS_ListOfPairBoolean.hxx>
-#include <NMTDS_MapIteratorOfMapOfPairBoolean.hxx>
-#include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
-
-#include <Basics_OCCTVersion.hxx>
-
-static
- Standard_Integer TypeToInteger(const NMTDS_InterfType aType);
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-NMTDS_InterfPool::NMTDS_InterfPool()
-{
- myMaxInd=6;
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- NMTDS_InterfPool::~NMTDS_InterfPool()
-{
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PairBoolean& aPKB,
- const NMTDS_InterfType aType)
-{
- Standard_Boolean bRet;
- Standard_Integer iType;
- //
- bRet=Standard_False;
- //
- iType=TypeToInteger(aType);
- if (iType>-1 && iType<myMaxInd) {
- bRet=myTable[iType].Add(aPKB);
- }
- return bRet;
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
- const Standard_Integer aInd2,
- const NMTDS_InterfType aType)
-{
- NMTDS_PairBoolean aPKB;
- //
- aPKB.SetIds(aInd1, aInd2);
- return Add(aPKB, aType);
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
- const Standard_Integer aInd2,
- const Standard_Boolean bFlag,
- const NMTDS_InterfType aType)
-{
- NMTDS_PairBoolean aPKB;
- //
- aPKB.SetIds(aInd1, aInd2);
- aPKB.SetFlag(bFlag);
- return Add(aPKB, aType);
-}
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PairBoolean& aPKB)const
-{
- Standard_Boolean bRet;
- Standard_Integer i;
- //
- for (i=0; i<myMaxInd; ++i) {
- bRet=myTable[i].Contains(aPKB);
- if (bRet) {
- break;
- }
- }
- return bRet;
-}
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1,
- const Standard_Integer aInd2)const
-{
- NMTDS_PairBoolean aPKB;
- //
- aPKB.SetIds(aInd1, aInd2);
- return Contains(aPKB);
-}
-//=======================================================================
-//function : Get
-//purpose :
-//=======================================================================
-const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get()const
-{
- Standard_Integer i;
- NMTDS_ListOfPairBoolean* pL;
- //
- pL=(NMTDS_ListOfPairBoolean*)&myList;
- pL->Clear();
- //
- for (i=0; i<myMaxInd; ++i) {
- NMTDS_MapIteratorOfMapOfPairBoolean aIt;
- //
- aIt.Initialize(myTable[i]);
- for(; aIt.More(); aIt.Next()) {
- const NMTDS_PairBoolean& aPKB=aIt.Key();
- pL->Append(aPKB);
- }
- }
- return myList;
-}
-//=======================================================================
-//function : Get
-//purpose :
-//=======================================================================
-const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
- (const Standard_Integer aInd)const
-{
- Standard_Integer i, n1, n2;
- NMTDS_ListOfPairBoolean* pL;
- //
- pL=(NMTDS_ListOfPairBoolean*)&myList;
- pL->Clear();
- //
- for (i=0; i<myMaxInd; ++i) {
- NMTDS_MapIteratorOfMapOfPairBoolean aIt;
- //
- aIt.Initialize(myTable[i]);
- for(; aIt.More(); aIt.Next()) {
- const NMTDS_PairBoolean& aPKB=aIt.Key();
- aPKB.Ids(n1, n2);
- if(n1==aInd || n2==aInd) {
- pL->Append(aPKB);
- }
- }
- }
- return myList;
-}
-//=======================================================================
-//function : Get
-//purpose :
-//=======================================================================
-const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
- (const NMTDS_InterfType aType)const
-{
- Standard_Integer iType;
- NMTDS_ListOfPairBoolean* pL;
- //
- pL=(NMTDS_ListOfPairBoolean*)&myList;
- pL->Clear();
- //
- iType=TypeToInteger(aType);
- if (iType>-1 && iType<myMaxInd) {
- NMTDS_MapIteratorOfMapOfPairBoolean aIt;
- //
- aIt.Initialize(myTable[iType]);
- for(; aIt.More(); aIt.Next()) {
- const NMTDS_PairBoolean& aPKB=aIt.Key();
- pL->Append(aPKB);
- }
- }
- return myList;
-}
-//=======================================================================
-//function : Get
-//purpose :
-//=======================================================================
-const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get
- (const Standard_Integer aInd,
- const NMTDS_InterfType aType)const
-{
- Standard_Integer n1, n2;
- NMTDS_ListOfPairBoolean *pL, aLPKB;
- NMTDS_ListIteratorOfListOfPairBoolean aIt;
- //
- aLPKB=Get(aType);
- //
- pL=(NMTDS_ListOfPairBoolean*)&myList;
- pL->Clear();
- //
- aIt.Initialize (aLPKB);
- for (; aIt.More(); aIt.Next()) {
- const NMTDS_PairBoolean& aPKB=aIt.Value();
- aPKB.Ids(n1, n2);
- if(n1==aInd || n2==aInd) {
- pL->Append(aPKB);
- }
- }
- return myList;
-}
-////////////////////
-//===========================================================================
-//function : SSInterferences
-//purpose :
-//===========================================================================
-BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences()
-{
- return mySSInterferences;
-}
-//===========================================================================
-//function : ESInterferences
-//purpose :
-//===========================================================================
-BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences()
-{
- return myESInterferences;
-}
-//===========================================================================
-//function : VSInterferences
-//purpose :
-//===========================================================================
-BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences()
-{
- return myVSInterferences;
-}
-//===========================================================================
-//function : EEInterferences
-//purpose :
-//===========================================================================
-BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences()
-{
- return myEEInterferences;
-}
-//===========================================================================
-//function : VEInterferences
-//purpose :
-//===========================================================================
-BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences()
-{
- return myVEInterferences;
-}
-//===========================================================================
-//function : VVInterferences
-//purpose :
-//===========================================================================
-BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences()
-{
- return myVVInterferences;
-}
-
-//modified by NIZNHY-PKV Mon Dec 12 09:07:54 2011f
-//=======================================================================
-//function : Purge
-//purpose :
-//=======================================================================
-void NMTDS_InterfPool::Purge()
-{
-#if OCC_VERSION_LARGE > 0x06050200
- myVVInterferences.Purge();
- myVEInterferences.Purge();
- myEEInterferences.Purge();
- myVSInterferences.Purge();
- myESInterferences.Purge();
- mySSInterferences.Purge();
-#endif
-}
-//modified by NIZNHY-PKV Mon Dec 12 09:07:58 2011t
-
-//=======================================================================
-//function : TypeToInteger
-//purpose :
-//=======================================================================
-Standard_Integer TypeToInteger(const NMTDS_InterfType aType)
-{
- return (Standard_Integer)aType;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_InterfPool.hxx
-//
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_InterfPool_HeaderFile
-#define _NMTDS_InterfPool_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-#include <Standard_Integer.hxx>
-#include <BOPTools_CArray1OfSSInterference.hxx>
-#include <BOPTools_CArray1OfESInterference.hxx>
-#include <BOPTools_CArray1OfVSInterference.hxx>
-#include <BOPTools_CArray1OfEEInterference.hxx>
-#include <BOPTools_CArray1OfVEInterference.hxx>
-#include <BOPTools_CArray1OfVVInterference.hxx>
-#include <Standard_Boolean.hxx>
-#include <NMTDS_InterfType.hxx>
-#include <NMTDS_PairBoolean.hxx>
-#include <NMTDS_MapOfPairBoolean.hxx>
-#include <NMTDS_ListOfPairBoolean.hxx>
-
-//=======================================================================
-//class : NMTDS_InterfPool
-//purpose :
-//=======================================================================
-class NMTDS_InterfPool {
- public:
- Standard_EXPORT
- NMTDS_InterfPool();
- Standard_EXPORT
- virtual ~NMTDS_InterfPool();
-
- Standard_EXPORT
- Standard_Boolean Add(const NMTDS_PairBoolean& aPKB,
- const NMTDS_InterfType aType) ;
-
- Standard_EXPORT
- Standard_Boolean Add(const Standard_Integer aInd1,
- const Standard_Integer aInd2,
- const NMTDS_InterfType aType) ;
-
- Standard_EXPORT
- Standard_Boolean Add(const Standard_Integer aInd1,
- const Standard_Integer aInd2,
- const Standard_Boolean bFlag,
- const NMTDS_InterfType aType) ;
-
- Standard_EXPORT
- Standard_Boolean Contains(const NMTDS_PairBoolean& aPKB) const;
-
- Standard_EXPORT
- Standard_Boolean Contains(const Standard_Integer aInd1,
- const Standard_Integer aInd2) const;
-
- Standard_EXPORT
- const NMTDS_ListOfPairBoolean& Get() const;
-
- Standard_EXPORT
- const NMTDS_ListOfPairBoolean& Get(const NMTDS_InterfType aType) const;
-
- Standard_EXPORT
- const NMTDS_ListOfPairBoolean& Get(const Standard_Integer aInd) const;
-
- Standard_EXPORT
- const NMTDS_ListOfPairBoolean& Get(const Standard_Integer aInd,
- const NMTDS_InterfType aType) const;
-
- //! Returns the reference to array Of F/F interferences <br>
- Standard_EXPORT BOPTools_CArray1OfSSInterference& SSInterferences() ;
-
- //! Returns the reference to array Of E/F interferences <br>
- Standard_EXPORT BOPTools_CArray1OfESInterference& ESInterferences() ;
-
- //! Returns the reference to array Of V/F interferences <br>
- Standard_EXPORT BOPTools_CArray1OfVSInterference& VSInterferences() ;
-
- //! Returns the reference to arrray Of E/E interferences <br>
- Standard_EXPORT BOPTools_CArray1OfEEInterference& EEInterferences() ;
-
- //! Returns the reference to arrray Of V/E interferences <br>
- Standard_EXPORT BOPTools_CArray1OfVEInterference& VEInterferences() ;
-
- //! Returns the reference to arrray Of V/V interferences <br>
- Standard_EXPORT BOPTools_CArray1OfVVInterference& VVInterferences() ;
-
- Standard_EXPORT void Purge() ;
-
-protected:
- NMTDS_MapOfPairBoolean myTable[6];
- NMTDS_ListOfPairBoolean myList;
- Standard_Integer myMaxInd;
- BOPTools_CArray1OfSSInterference mySSInterferences;
- BOPTools_CArray1OfESInterference myESInterferences;
- BOPTools_CArray1OfVSInterference myVSInterferences;
- BOPTools_CArray1OfEEInterference myEEInterferences;
- BOPTools_CArray1OfVEInterference myVEInterferences;
- BOPTools_CArray1OfVVInterference myVVInterferences;
-
-private:
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_InterfType.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-
-
-#ifndef _NMTDS_InterfType_HeaderFile
-#define _NMTDS_InterfType_HeaderFile
-
-
-enum NMTDS_InterfType {
-NMTDS_TI_VV,
-NMTDS_TI_VE,
-NMTDS_TI_VF,
-NMTDS_TI_EE,
-NMTDS_TI_EF,
-NMTDS_TI_FF,
-NMTDS_TI_UNKNOWN
-};
-
-#ifndef _Standard_PrimitiveTypes_HeaderFile
-#include <Standard_PrimitiveTypes.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_Iterator.cxx
-// Author: Peter KURNEV
-
-#include <NMTDS_Iterator.hxx>
-//
-#include <Bnd_Box.hxx>
-//
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-//
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-//
-#include <TopTools_DataMapOfShapeInteger.hxx>
-//
-#include <NMTDS_BoxBndTree.hxx>
-#include <NCollection_UBTreeFiller.hxx>
-#include <NMTDS_CArray1OfIndexRange.hxx>
-#include <NMTDS_IndexRange.hxx>
-#include <NMTDS_PairBoolean.hxx>
-#include <NMTDS_MapOfPairBoolean.hxx>
-#include <NMTDS_IndexedDataMapOfShapeBox.hxx>
-#include <NMTDS_IndexedDataMapOfIntegerShape.hxx>
-#include <NMTDS_Tools.hxx>
-#include <NMTDS_DataMapOfIntegerMapOfInteger.hxx>
-#include <NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-
-//=======================================================================
-//function : NMTDS_Iterator
-//purpose :
-//=======================================================================
-NMTDS_Iterator::NMTDS_Iterator()
-{
- myDS=NULL;
- myLength=0;
-}
-//=======================================================================
-//function : ~NMTDS_Iterator
-//purpose :
-//=======================================================================
-NMTDS_Iterator::~NMTDS_Iterator()
-{
-}
-//=======================================================================
-// function: SetDS
-// purpose:
-//=======================================================================
-void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS)
-{
- myDS=aDS;
-}
-//=======================================================================
-// function: DS
-// purpose:
-//=======================================================================
-const NMTDS_ShapesDataStructure& NMTDS_Iterator::DS()const
-{
- return *myDS;
-}
-//=======================================================================
-// function: ExpectedLength
-// purpose:
-//=======================================================================
-Standard_Integer NMTDS_Iterator::ExpectedLength() const
-{
- return myLength;
-}
-//=======================================================================
-// function: BlockLength
-// purpose:
-//=======================================================================
-Standard_Integer NMTDS_Iterator::BlockLength() const
-{
- Standard_Integer aNbIIs, iTresh;
- Standard_Real aCfPredict=.5;
-
- aNbIIs=ExpectedLength();
-
- if (aNbIIs<=1) {
- return 1;
- }
- //modified by NIZNHY-PKV Mon Dec 12 08:50:50 2011f
- iTresh=1000;
- if (aNbIIs>iTresh) {
- aNbIIs=iTresh;
- return aNbIIs;
- }
- //modified by NIZNHY-PKV Mon Dec 12 08:50:54 2011t
- //
- aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
- return aNbIIs;
-}
-//=======================================================================
-// function: Initialize
-// purpose:
-//=======================================================================
-void NMTDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2)
-{
- Standard_Integer iX;
- //
- iX=NMTDS_Tools::TypeToInteger(aType1, aType2);
- if (iX>=0) {
- myIterator.Initialize(myLists[iX]);
- myLength=myLists[iX].Extent();
- }
- else {
- myIterator.Initialize(myEmptyList);
- myLength=0;
- }
-}
-//=======================================================================
-// function: More
-// purpose:
-//=======================================================================
-Standard_Boolean NMTDS_Iterator::More()const
-{
- return myIterator.More();
-}
-//=======================================================================
-// function: Next
-// purpose:
-//=======================================================================
-void NMTDS_Iterator::Next()
-{
- myIterator.Next();
-}
-//=======================================================================
-// function: Current
-// purpose:
-//=======================================================================
-void NMTDS_Iterator::Current(Standard_Integer& aIndex1,
- Standard_Integer& aIndex2,
- Standard_Boolean& aWithSubShape) const
-{
- const NMTDS_PairBoolean& aPKB=myIterator.Value();
- aPKB.Ids(aIndex1, aIndex2);
- aWithSubShape=aPKB.Flag();
-}
-//=======================================================================
-// function: SDVertices
-// purpose:
-//=======================================================================
-const TColStd_DataMapOfIntegerListOfInteger& NMTDS_Iterator::SDVertices()const
-{
- return myMVSD;
-}
-//=======================================================================
-// function: Prepare
-// purpose:
-//=======================================================================
-void NMTDS_Iterator::Prepare()
-{
- Standard_Integer i;
- //
- myLength=0;
- for (i=0; i<6; ++i) {
- myLists[i].Clear();
- }
- myMVSD.Clear();
- //
- if (myDS==NULL){
- return;
- }
- Intersect();
-}
-//=======================================================================
-// function: Intersect
-// purpose:
-//=======================================================================
-void NMTDS_Iterator::Intersect()
-{
- Standard_Boolean bFlag;
- Standard_Integer aNb, i, aNbB, aNbR, iFlag;
- Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV, aNbLV1;
- TColStd_ListIteratorOfListOfInteger aIt;
- TColStd_DataMapOfIntegerInteger aMII;
- TColStd_DataMapOfIntegerListOfInteger aMVSD;
- TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
- TopTools_DataMapOfShapeInteger aMSI;
- TopAbs_ShapeEnum aTi, aTj;
- NMTDS_PairBoolean aPKXB;
- NMTDS_MapOfPairBoolean aMPKXB;
- NMTDS_IndexedDataMapOfShapeBox aMSB;
- //
- NMTDS_BoxBndTreeSelector aSelector;
- NMTDS_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
- //
- const NMTDS_CArray1OfIndexRange& aRanges=myDS->Ranges();
- aNbR=aRanges.Extent();
- //
- aNb=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=aNb; ++i) {
- const TopoDS_Shape& aS=myDS->Shape(i);
- aTi=aS.ShapeType();
- if (NMTDS_Tools::HasBRep(aTi)) {
- Bnd_Box aBoxEx;
- //
- myDS->ComputeBoxEx(i, aBoxEx);
- aMSI.Bind(aS, i);
- aMSB.Add(aS, aBoxEx);
- }
- }
- //
- 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 (iR=1; iR<aNbR; ++iR) {
- const NMTDS_IndexRange& aR=aRanges(iR);
- i1=aR.First();
- i2=aR.Last();
- for (i=i1; i<=i2; ++i) {
- const TopoDS_Shape& aSi=myDS->Shape(i);
- aTi=aSi.ShapeType();
- if (!NMTDS_Tools::HasBRep(aTi)){
- continue;
- }
- const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
- aSelector.Clear();
- aSelector.SetBox(aBoxEx);
- //
- aNbSD=aBBTree.Select(aSelector);
- //
- if (!aNbSD){
- continue;
- }
- //
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- //
- k=0;
- TColStd_ListOfInteger aLV;
- //
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- jB=aIt.Value(); // box index in MII
- j=aMII.Find(jB); // DS index
- if (j>=i1 && j<=i2) {
- continue;// same range
- }
- //
- aPKXB.SetIds(i, j);
- //
- if (aMPKXB.Add(aPKXB)) {
- bFlag=Standard_False;// Bounding boxes are intersected
- const Bnd_Box& aBoxi=myDS->GetBoundingBox(i);
- const Bnd_Box& aBoxj=myDS->GetBoundingBox(j);
- if (aBoxi.IsOut(aBoxj)) {
- bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
- }
- const TopoDS_Shape& aSj=myDS->Shape(j);
- aTj=aSj.ShapeType();
- iX=NMTDS_Tools::TypeToInteger(aTi, aTj);
- //bFlag=(iStatus==2);
- aPKXB.SetFlag(bFlag);
- myLists[iX].Append(aPKXB);
- //
- // VSD prepare
- if (iX==5) { //VV
- aLV.Append(j);
- }
- }// if (aMPKXB.Add(aPKXB)) {
- }// for (; aIt.More(); aIt.Next()) {
- //
- // VSD treatment
- aNbLV=aLV.Extent();
- if (aNbLV) {
- TColStd_ListOfInteger aLV1;
- //
- const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi);
- aIt.Initialize(aLV);
- for (; aIt.More(); aIt.Next()) {
- j=aIt.Value();
- const TopoDS_Shape& aSj=myDS->Shape(j);
- const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj);
- iFlag=NMTDS_Tools::ComputeVV(aVi, aVj);
- if (!iFlag) {
- aLV1.Append(j);
- }
- else {
- aPKXB.SetIds(i, j);
- aMPKXB.Remove(aPKXB);
- }
- }
- //
- aNbLV1=aLV1.Extent();
- if (aNbLV1) {
- aMVSD.Bind(i, aLV1);
- }
- }
- }//for (i=i1; i<=i2; ++i) {
- }//for (iR=1; iR<aNbR; ++iR) {
- //
- //
- // Chains
- //=================
- myMVSD.Clear();
- NMTDS_Iterator::FillMVSD(aMVSD, myMVSD);
-
- //modified by NIZNHY-PKV Mon Dec 12 09:51:29 2011f
- aMPKXB.Clear();
- Standard::Purge();
- //modified by NIZNHY-PKV Mon Dec 12 09:51:33 2011t
-}
-//=======================================================================
-//function : FillMVSD
-//purpose :
-//=======================================================================
-void NMTDS_Iterator::FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD,
- TColStd_DataMapOfIntegerListOfInteger& bMVSD)
-{
- Standard_Boolean bFound;
- Standard_Integer aNbVSD, iCnt, i, j, k;
- TColStd_ListOfInteger aLV;
- TColStd_ListIteratorOfListOfInteger aIt;
- TColStd_MapOfInteger aMF;
- TColStd_MapIteratorOfMapOfInteger aItMI;
- TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
- NMTDS_DataMapOfIntegerMapOfInteger aDMIMI;
- NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger aIti, aItj;
- //
- aNbVSD=aMVSD.Extent();
- if (!aNbVSD) {
- return;
- }
- //
- aItVSD.Initialize(aMVSD);
- for (; aItVSD.More(); aItVSD.Next()) {
- TColStd_MapOfInteger aMI;
- //
- i=aItVSD.Key();
- aMI.Add(i);
- const TColStd_ListOfInteger& aLVSD=aItVSD.Value();
- aIt.Initialize(aLVSD);
- for (; aIt.More(); aIt.Next()) {
- j=aIt.Value();
- aMI.Add(j);
- }
- aDMIMI.Bind(i, aMI);
- }
- // i
- aIti.Initialize(aDMIMI);
- for (; aIti.More(); aIti.Next()) {
- i=aIti.Key();
- if (aMF.Contains(i)) {
- continue;
- }
- aMF.Add(i);
- //
- //TColStd_MapOfInteger& aMIi=aDMIMI.ChangeFind(i);
- TColStd_MapOfInteger *pMIi=(TColStd_MapOfInteger *)&aIti.Value();
- TColStd_MapOfInteger& aMIi=*pMIi;
- // j
- while (1) {
- iCnt=0;
- aItj.Initialize(aDMIMI);
- for (; aItj.More(); aItj.Next()) {
- j=aItj.Key();
- if (aMF.Contains(j)) {
- continue;
- }
- //
- //TColStd_MapOfInteger& aMIj=aDMIMI.ChangeFind(j);
- TColStd_MapOfInteger *pMj=(TColStd_MapOfInteger *)&aItj.Value();
- TColStd_MapOfInteger& aMIj=*pMj;
- //
- aItMI.Initialize(aMIj);
- for (; aItMI.More(); aItMI.Next()) {
- k=aItMI.Key();
- bFound=aMIi.Contains(k);
- if (bFound) {
- break;
- }
- }
- if (!bFound) {
- continue;
- }
- //
- aItMI.Initialize(aMIj);
- for (; aItMI.More(); aItMI.Next()) {
- k=aItMI.Key();
- aMIi.Add(k);
- }
- //
- if (aMF.Add(j)) {
- ++iCnt;
- }
- } //for (; aItj.More(); aItj.Next()) {
- if (!iCnt) {
- break;
- }
- } // while (1) {
- //
- aLV.Clear();
- aItMI.Initialize(aMIi);
- for (; aItMI.More(); aItMI.Next()) {
- k=aItMI.Key();
- if (k!=i) {
- aLV.Append(k);
- }
- }
- bMVSD.Bind(i, aLV);
- }// for (; aIti.More(); aIti.Next()) {
-}
-
- /*
- {
- // check
- TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItX;
- //
- printf(" \n");
- printf(" myMVSD.Extent()=%d\n", myMVSD.Extent());
- aItX.Initialize(myMVSD);
- for (; aItX.More(); aItX.Next()) {
- i=aItX.Key();
- printf(" i=%d (", i);
- const TColStd_ListOfInteger& aLV=aItX.Value();
- aIt.Initialize(aLV);
- for (; aIt.More(); aIt.Next()) {
- j=aIt.Value();
- printf(" %d", j);
- }
- printf(")\n");
- }
- }
-*/
-
+++ /dev/null
-// Copyright (C) 2007-2013 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_Iterator.hxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_Iterator_HeaderFile
-#define _NMTDS_Iterator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <Standard_Boolean.hxx>
-#include <NMTDS_PShapesDataStructure.hxx>
-#include <NMTDS_ListOfPairBoolean.hxx>
-#include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-
-//=======================================================================
-//class : NMTDS_Iterator
-//purpose :
-//=======================================================================
-class NMTDS_Iterator {
- public:
- Standard_EXPORT
- NMTDS_Iterator();
-
- Standard_EXPORT
- virtual ~NMTDS_Iterator();
-
- Standard_EXPORT
- void SetDS(const NMTDS_PShapesDataStructure& pDS) ;
-
- Standard_EXPORT
- const NMTDS_ShapesDataStructure& DS() const;
-
- Standard_EXPORT
- void Initialize(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2) ;
-
- Standard_EXPORT
- Standard_Boolean More() const;
-
- Standard_EXPORT
- void Next() ;
-
- Standard_EXPORT
- void Current(Standard_Integer& aIndex1,
- Standard_Integer& aIndex2,
- Standard_Boolean& aWithSubShape) const;
-
- Standard_EXPORT
- virtual void Prepare() ;
-
- Standard_EXPORT
- Standard_Integer ExpectedLength() const;
-
- Standard_EXPORT
- Standard_Integer BlockLength() const;
-
- Standard_EXPORT
- const TColStd_DataMapOfIntegerListOfInteger& SDVertices() const;
-
- Standard_EXPORT
- static void FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD1,
- TColStd_DataMapOfIntegerListOfInteger& aMVSD2) ;
-
-protected:
- Standard_EXPORT
- virtual void Intersect() ;
- //
-
- NMTDS_PShapesDataStructure myDS;
- NMTDS_ListOfPairBoolean myLists[6];
- NMTDS_ListIteratorOfListOfPairBoolean myIterator;
- NMTDS_ListOfPairBoolean myEmptyList;
- Standard_Integer myLength;
- TColStd_DataMapOfIntegerListOfInteger myMVSD;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_IteratorChecker.hxx
-// Author: Peter KURNEV
-
-#include <NMTDS_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 <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
-//
-#include <TopTools_DataMapOfShapeInteger.hxx>
-//
-#include <NCollection_UBTreeFiller.hxx>
-#include <NMTDS_BoxBndTree.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_CArray1OfIndexRange.hxx>
-#include <NMTDS_IndexRange.hxx>
-#include <NMTDS_PairBoolean.hxx>
-#include <NMTDS_MapOfPairBoolean.hxx>
-#include <NMTDS_IndexedDataMapOfShapeBox.hxx>
-#include <NMTDS_Tools.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-NMTDS_IteratorCheckerSI::NMTDS_IteratorCheckerSI()
-:
- NMTDS_Iterator()
-{
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
-NMTDS_IteratorCheckerSI::~NMTDS_IteratorCheckerSI()
-{
-}
-//=======================================================================
-// function: Intersect
-// purpose:
-//=======================================================================
-void NMTDS_IteratorCheckerSI::Intersect()
-{
- Standard_Boolean bFlag;
- Standard_Integer aNbS, i, aNbA, aNbB, iFlag;
- Standard_Integer aNbSD, iX, j, iDS, jB, k, aNbLV;
- TColStd_ListIteratorOfListOfInteger aIt;
- TColStd_DataMapOfIntegerInteger aMII;
- TColStd_DataMapOfIntegerListOfInteger aMVSD;
- TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
- TopTools_DataMapOfShapeInteger aMSI;
- TopAbs_ShapeEnum aTi, aTj;
- NMTDS_PairBoolean aPKXB;
- NMTDS_MapOfPairBoolean aMPKXB;
- NMTDS_IndexedDataMapOfShapeBox aMSB;
- NMTDS_MapOfPairBoolean aMPA;//myPairsAvoid
- //
- NMTDS_BoxBndTreeSelector aSelector;
- NMTDS_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
- //
- aNbS=myDS->NumberOfShapesOfTheObject();
- //
- // myPairsAvoid, aMSI, aMSB
- for (i=1; i<=aNbS; ++i) {
- const TopoDS_Shape& aSi=myDS->Shape(i);
- aTi=aSi.ShapeType();
- if (NMTDS_Tools::HasBRep(aTi)) {
- if (aTi!=TopAbs_VERTEX) {
- TColStd_IndexedMapOfInteger aMA;
- //
- myDS->GetAllSuccessors(i, aMA);
- //
- aNbA=aMA.Extent();
- for (j=1; j<=aNbA; ++j) {
- iX=aMA(j);
- aPKXB.Clear();
- aPKXB.SetIds(i, iX);
- aMPA.Add(aPKXB);
- }
- }
- else {
- aPKXB.Clear();
- aPKXB.SetIds(i, i);
- aMPA.Add(aPKXB);
- }
- //
- Bnd_Box aBoxEx;
- //
- myDS->ComputeBoxEx(i, aBoxEx);
- aMSI.Bind(aSi, i);
- aMSB.Add(aSi, aBoxEx);
- }
- }
- //
- // 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=1; i<=aNbS; ++i) {
- const TopoDS_Shape& aSi=myDS->Shape(i);
- aTi=aSi.ShapeType();
- if (!NMTDS_Tools::HasBRep(aTi)){
- continue;
- }
- const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
- aSelector.Clear();
- aSelector.SetBox(aBoxEx);
- //
- aNbSD=aBBTree.Select(aSelector);
- if (!aNbSD){
- continue;
- }
- //
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- //
- k=0;
- TColStd_ListOfInteger aLV;
- //
- 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->GetBoundingBox(i);
- const Bnd_Box& aBoxj=myDS->GetBoundingBox(j);
- if (aBoxi.IsOut(aBoxj)) {
- bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
- }
- const TopoDS_Shape& aSj=myDS->Shape(j);
- aTj=aSj.ShapeType();
- iX=NMTDS_Tools::TypeToInteger(aTi, aTj);
- //bFlag=(iStatus==2);
- aPKXB.SetFlag(bFlag);
- myLists[iX].Append(aPKXB);
- //
- // VSD prepare
- if (iX==5) { //VV
- aLV.Append(j);
- }
- }// if (aMPKXB.Add(aPKXB)) {
- }// for (; aIt.More(); aIt.Next()) {
- //
- // VSD treatment
- aNbLV=aLV.Extent();
- if (aNbLV) {
- TColStd_ListOfInteger aLV1;
- //
- const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi);
- aIt.Initialize(aLV);
- for (; aIt.More(); aIt.Next()) {
- j=aIt.Value();
- const TopoDS_Shape& aSj=myDS->Shape(j);
- const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj);
- iFlag=NMTDS_Tools::ComputeVV(aVi, aVj);
- if (!iFlag) {
- aLV1.Append(j);
- }
- else {
- aPKXB.SetIds(i, j);
- aMPKXB.Remove(aPKXB);
- }
- }
- aMVSD.Bind(i, aLV1);
- }
- }//for (i=1; i<=aNbS; ++i) {
- //
- //
- // 2. Chains
- //=================
- myMVSD.Clear();
- NMTDS_Iterator::FillMVSD(aMVSD, myMVSD);
-}
-
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_IteratorChecker.cxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_IteratorCheckerSI_HeaderFile
-#define _NMTDS_IteratorCheckerSI_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <NMTDS_Iterator.hxx>
-
-//=======================================================================
-//class : NMTDS_IteratorCheckerSI
-//purpose :
-//=======================================================================
-class NMTDS_IteratorCheckerSI : public NMTDS_Iterator {
- public:
-
- Standard_EXPORT
- NMTDS_IteratorCheckerSI();
- Standard_EXPORT
- virtual ~NMTDS_IteratorCheckerSI();
-
-protected:
- Standard_EXPORT
- virtual void Intersect() ;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile
-#define NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile
-
-#ifndef NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile
-#include <NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfPair.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListIteratorOfListOfPair_HeaderFile
-#define NMTDS_ListIteratorOfListOfPair_HeaderFile
-
-#ifndef NMTDS_ListOfPair_HeaderFile
-#include <NMTDS_ListOfPair.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfPairBoolean.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListIteratorOfListOfPairBoolean_HeaderFile
-#define NMTDS_ListIteratorOfListOfPairBoolean_HeaderFile
-
-#ifndef NMTDS_ListOfPairBoolean_HeaderFile
-#include <NMTDS_ListOfPairBoolean.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfPassKey.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListIteratorOfListOfPassKey_HeaderFile
-#define NMTDS_ListIteratorOfListOfPassKey_HeaderFile
-
-#ifndef NMTDS_ListOfPassKey_HeaderFile
-#include <NMTDS_ListOfPassKey.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile
-#define NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile
-
-#ifndef NMTDS_ListOfPassKeyBoolean_HeaderFile
-#include <NMTDS_ListOfPassKeyBoolean.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile
-#define NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
-
-typedef NCollection_List<BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors> NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors;
-typedef NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors::Iterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListOfPair.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListOfPair_HeaderFile
-#define NMTDS_ListOfPair_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <NMTDS_Pair.hxx>
-
-typedef NCollection_List<NMTDS_Pair> NMTDS_ListOfPair;
-typedef NMTDS_ListOfPair::Iterator NMTDS_ListIteratorOfListOfPair;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListOfPairBoolean.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListOfPairBoolean_HeaderFile
-#define NMTDS_ListOfPairBoolean_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <NMTDS_PairBoolean.hxx>
-
-typedef NCollection_List<NMTDS_PairBoolean> NMTDS_ListOfPairBoolean;
-typedef NMTDS_ListOfPairBoolean::Iterator NMTDS_ListIteratorOfListOfPairBoolean;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListOfPassKey.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListOfPassKey_HeaderFile
-#define NMTDS_ListOfPassKey_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <NMTDS_PassKey.hxx>
-
-typedef NCollection_List<NMTDS_PassKey> NMTDS_ListOfPassKey;
-typedef NMTDS_ListOfPassKey::Iterator NMTDS_ListIteratorOfListOfPassKey;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListOfPassKeyBoolean.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_ListOfPassKeyBoolean_HeaderFile
-#define NMTDS_ListOfPassKeyBoolean_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <NMTDS_PassKeyBoolean.hxx>
-
-typedef NCollection_List<NMTDS_PassKeyBoolean> NMTDS_ListOfPassKeyBoolean;
-typedef NMTDS_ListOfPassKeyBoolean::Iterator NMTDS_ListIteratorOfListOfPassKeyBoolean;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_MapIteratorOfMapOfPairBoolean.hxx
-// Created: Mon Feb 20 08:22:39 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_MapIteratorOfMapOfPairBoolean_HeaderFile
-#define NMTDS_MapIteratorOfMapOfPairBoolean_HeaderFile
-
-#ifndef NMTDS_MapOfPairBoolean_HeaderFile
-#include <NMTDS_MapOfPairBoolean.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMRCol_MapIteratorOfMapOfPassKey.hxx
-// Created: Mon Feb 20 08:22:39 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMRCol_MapIteratorOfMapOfPassKey_HeaderFile
-#define NMRCol_MapIteratorOfMapOfPassKey_HeaderFile
-
-#ifndef NMTDS_MapOfPassKey_HeaderFile
-#include <NMTDS_MapOfPassKey.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMRCol_MapIteratorOfMapOfPassKeyBoolean.hxx
-// Created: Mon Feb 20 08:22:39 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMRCol_MapIteratorOfMapOfPassKeyBoolean_HeaderFile
-#define NMRCol_MapIteratorOfMapOfPassKeyBoolean_HeaderFile
-
-#ifndef NMTDS_MapOfPassKeyBoolean_HeaderFile
-#include <NMTDS_MapOfPassKeyBoolean.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_MapOfPairBoolean.hxx
-// Created: Mon Feb 20 08:19:07 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_MapOfPairBoolean_HeaderFile
-#define NMTDS_MapOfPairBoolean_HeaderFile
-
-#include <NMTDS_PairBoolean.hxx>
-#include <NMTDS_PairMapHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_Map.hxx>
-
-typedef NCollection_Map<NMTDS_PairBoolean, NMTDS_PairMapHasher> NMTDS_MapOfPairBoolean;
-typedef NMTDS_MapOfPairBoolean::Iterator NMTDS_MapIteratorOfMapOfPairBoolean;
-
-#undef _NCollection_MapHasher
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_MapOfPassKey.hxx
-// Created: Mon Feb 20 08:19:07 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_MapOfPassKey_HeaderFile
-#define NMTDS_MapOfPassKey_HeaderFile
-
-#include <NMTDS_PassKey.hxx>
-#include <NMTDS_PassKeyMapHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_Map.hxx>
-
-typedef NCollection_Map<NMTDS_PassKey, NMTDS_PassKeyMapHasher> NMTDS_MapOfPassKey;
-typedef NMTDS_MapOfPassKey::Iterator NMTDS_MapIteratorOfMapOfPassKey;
-
-#undef _NCollection_MapHasher
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_MapOfPassKeyBoolean.hxx
-// Created: Mon Feb 20 08:19:07 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTDS_MapOfPassKeyBoolean_HeaderFile
-#define NMTDS_MapOfPassKeyBoolean_HeaderFile
-
-#include <NMTDS_PassKeyBoolean.hxx>
-#include <NMTDS_PassKeyMapHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_Map.hxx>
-
-typedef NCollection_Map<NMTDS_PassKeyBoolean, NMTDS_PassKeyMapHasher> NMTDS_MapOfPassKeyBoolean;
-typedef NMTDS_MapOfPassKeyBoolean::Iterator NMTDS_MapIteratorOfMapOfPassKeyBoolean;
-
-#undef _NCollection_MapHasher
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PInterfPool.hxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_PInterfPool_HeaderFile
-#define _NMTDS_PInterfPool_HeaderFile
-
-class NMTDS_InterfPool;
-
-typedef NMTDS_InterfPool* NMTDS_PInterfPool;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PIterator.hxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_PIterator_HeaderFile
-#define _NMTDS_PIterator_HeaderFile
-
-class NMTDS_Iterator;
-
-typedef NMTDS_Iterator* NMTDS_PIterator;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PShapesDataStructure.hxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_PShapesDataStructure_HeaderFile
-#define _NMTDS_PShapesDataStructure_HeaderFile
-
-class NMTDS_ShapesDataStructure;
-
-typedef NMTDS_ShapesDataStructure* NMTDS_PShapesDataStructure;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_Pair.cxx
-// Author: Peter KURNEV
-
-#include <NMTDS_Pair.hxx>
-
-#include <stdio.h>
-#include <string.h>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-
-#ifdef WNT
-#pragma warning( disable : 4101)
-#endif
-
-static
- Standard_Integer NormalizedId(const Standard_Integer aId,
- const Standard_Integer aDiv);
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-NMTDS_Pair::NMTDS_Pair()
-{
- Clear();
-}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-NMTDS_Pair::NMTDS_Pair(const NMTDS_Pair& aOther)
-{
- myId1=aOther.myId1;
- myId2=aOther.myId2;
-}
-//=======================================================================
-//function :operator =
-//purpose :
-//=======================================================================
- NMTDS_Pair& NMTDS_Pair::operator =(const NMTDS_Pair& aOther)
-{
- myId1=aOther.myId1;
- myId2=aOther.myId2;
- return *this;
-}
-//=======================================================================
-//function :~
-//purpose :
-//=======================================================================
- NMTDS_Pair::~NMTDS_Pair()
-{
-}
-//=======================================================================
-//function :Clear
-//purpose :
-//=======================================================================
- void NMTDS_Pair::Clear()
-{
- myId1=0;
- myId2=0;
-}
-//=======================================================================
-//function :SetIds
-//purpose :
-//=======================================================================
- void NMTDS_Pair::SetIds(const Standard_Integer aId1,
- const Standard_Integer aId2)
-{
- Clear();
- myId1=aId1;
- myId2=aId2;
- if (aId1>aId2) {
- myId1=aId2;
- myId2=aId1;
- }
-}
-//=======================================================================
-//function :Ids
-//purpose :
-//=======================================================================
- void NMTDS_Pair::Ids(Standard_Integer& aId1,
- Standard_Integer& aId2) const
-{
- aId1=myId1;
- aId2=myId2;
-}
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_Pair::IsEqual(const NMTDS_Pair& aOther) const
-{
-
- Standard_Boolean bRet;
- //
- bRet=(myId1==aOther.myId1 && myId2==aOther.myId2);//ZZ
- return bRet;
-}
-//=======================================================================
-//function : HashCode
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_Pair::HashCode(const Standard_Integer aUpper) const
-{
- Standard_Integer aSum;
- //
- aSum=0;
- aSum+=NormalizedId(myId1, 2);
- aSum+=NormalizedId(myId2, 2);
- return ::HashCode(aSum, aUpper);
-}
-//=======================================================================
-// function: NormalizedId
-// purpose :
-//=======================================================================
-Standard_Integer NormalizedId(const Standard_Integer aId,
- const Standard_Integer aDiv)
-{
- Standard_Integer aMax, aTresh, aIdRet;
- //
- aIdRet=aId;
- aMax=::IntegerLast();
- aTresh=aMax/aDiv;
- if (aId>aTresh) {
- aIdRet=aId%aTresh;
- }
- return aIdRet;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_Pair.hxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_Pair_HeaderFile
-#define _NMTDS_Pair_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-
-//=======================================================================
-//function : NMTDS_Pair
-//purpose :
-//=======================================================================
-class NMTDS_Pair {
- public:
- Standard_EXPORT
- NMTDS_Pair();
-
- Standard_EXPORT
- virtual ~NMTDS_Pair();
-
- Standard_EXPORT
- NMTDS_Pair(const NMTDS_Pair& Other);
-
- Standard_EXPORT
- NMTDS_Pair& operator =(const NMTDS_Pair& Other);
-
- Standard_EXPORT
- void Clear() ;
-
- Standard_EXPORT
- void SetIds(const Standard_Integer aI1,
- const Standard_Integer aI2) ;
-
- Standard_EXPORT
- void Ids(Standard_Integer& aI1,
- Standard_Integer& aI2) const;
-
- Standard_EXPORT
- Standard_Boolean IsEqual(const NMTDS_Pair& aOther) const;
-
- Standard_EXPORT
- Standard_Integer HashCode(const Standard_Integer Upper) const;
-
-protected:
-Standard_Integer myId1;
-Standard_Integer myId2;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PairBoolean.cxx
-// Author: Peter KURNEV
-
-#include <NMTDS_PairBoolean.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_PairBoolean::NMTDS_PairBoolean()
-:
- myFlag(Standard_False),
- NMTDS_Pair()
-{
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- NMTDS_PairBoolean::~NMTDS_PairBoolean()
-{
-}
-//=======================================================================
-//function :operator =
-//purpose :
-//=======================================================================
- NMTDS_PairBoolean& NMTDS_PairBoolean::operator =(const NMTDS_PairBoolean& anOther)
-{
- myFlag=anOther.myFlag;
- NMTDS_Pair::operator =(anOther);
- return *this;
-}
-//=======================================================================
-//function :SetFlag
-//purpose :
-//=======================================================================
- void NMTDS_PairBoolean::SetFlag(const Standard_Boolean aFlag)
-{
- myFlag=aFlag;
-}
-//=======================================================================
-//function :Flag
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PairBoolean::Flag()const
-{
- return myFlag;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_PairBoolean.hxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_PairBoolean_HeaderFile
-#define _NMTDS_PairBoolean_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Boolean.hxx>
-#include <NMTDS_Pair.hxx>
-
-//=======================================================================
-//class : NMTDS_PairBoolean
-//purpose :
-//=======================================================================
-class NMTDS_PairBoolean : public NMTDS_Pair {
- public:
- Standard_EXPORT
- NMTDS_PairBoolean();
-
- Standard_EXPORT
- virtual ~NMTDS_PairBoolean();
-
- Standard_EXPORT
- void SetFlag(const Standard_Boolean aFlag) ;
-
- Standard_EXPORT
- NMTDS_PairBoolean& operator =(const NMTDS_PairBoolean& Other);
-
- Standard_EXPORT
- Standard_Boolean Flag() const;
-
-protected:
- Standard_Boolean myFlag;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PairMapHasher.cxx
-// Author: Peter KURNEV
-
-#include <NMTDS_PairMapHasher.hxx>
-
-//=======================================================================
-//function : HashCode
-//purpose :
-//=======================================================================
-Standard_Integer NMTDS_PairMapHasher::HashCode(const NMTDS_Pair& aPK,
- const Standard_Integer Upper)
-{
- return aPK.HashCode(Upper);
-}
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
-Standard_Boolean NMTDS_PairMapHasher::IsEqual(const NMTDS_Pair& aPK1,
- const NMTDS_Pair& aPK2)
-{
- return aPK1.IsEqual(aPK2);
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_PairMapHasher.cxx
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_PairMapHasher_HeaderFile
-#define _NMTDS_PairMapHasher_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <NMTDS_Pair.hxx>
-#include <Standard_Boolean.hxx>
-
-//=======================================================================
-//class : NMTDS_PairMapHasher
-//purpose :
-//=======================================================================
-class NMTDS_PairMapHasher {
- public:
- Standard_EXPORT
- static Standard_Integer HashCode(const NMTDS_Pair& aPKey,
- const Standard_Integer Upper) ;
-
- Standard_EXPORT
- static Standard_Boolean IsEqual(const NMTDS_Pair& aPKey1,
- const NMTDS_Pair& aPKey2) ;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PassKey.cxx
-// Created:
-// Author: Peter KURNEV
-// <peter@PREFEX>
-//
-#include <NMTDS_PassKey.hxx>
-
-#include <stdio.h>
-#include <string.h>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-
-#ifdef WNT
-#pragma warning( disable : 4101)
-#endif
-
-static
- Standard_Integer NormalizedId(const Standard_Integer aId,
- const Standard_Integer aDiv);
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_PassKey::NMTDS_PassKey()
-{
- Clear();
-}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_PassKey::NMTDS_PassKey(const NMTDS_PassKey& aOther)
-{
- myNbIds=aOther.myNbIds;
- mySum=aOther.mySum;
- myMap=aOther.myMap;
-}
-//=======================================================================
-//function :operator =
-//purpose :
-//=======================================================================
- NMTDS_PassKey& NMTDS_PassKey::operator =(const NMTDS_PassKey& aOther)
-{
- myNbIds=aOther.myNbIds;
- mySum=aOther.mySum;
- myMap=aOther.myMap;
- return *this;
-}
-//=======================================================================
-//function :~
-//purpose :
-//=======================================================================
- NMTDS_PassKey::~NMTDS_PassKey()
-{
-}
-//=======================================================================
-//function :Clear
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::Clear()
-{
- myNbIds=0;
- mySum=0;
- myMap.Clear();
-}
-//=======================================================================
-//function :SetIds
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::SetIds(const Standard_Integer aId1)
-
-{
- Clear();
- myNbIds=1;
- myMap.Add(aId1);
- mySum=NormalizedId(aId1, myNbIds);
-}
-//=======================================================================
-//function :SetIds
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::SetIds(const Standard_Integer aId1,
- const Standard_Integer aId2)
-{
- TColStd_ListOfInteger aLI;
- //
- aLI.Append(aId1);
- aLI.Append(aId2);
- SetIds(aLI);
-}
-//=======================================================================
-//function :SetIds
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::SetIds(const Standard_Integer aId1,
- const Standard_Integer aId2,
- const Standard_Integer aId3)
-{
- TColStd_ListOfInteger aLI;
- //
- aLI.Append(aId1);
- aLI.Append(aId2);
- aLI.Append(aId3);
- SetIds(aLI);
-}
-//=======================================================================
-//function :SetIds
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::SetIds(const Standard_Integer aId1,
- const Standard_Integer aId2,
- const Standard_Integer aId3,
- const Standard_Integer aId4)
-{
- TColStd_ListOfInteger aLI;
- //
- aLI.Append(aId1);
- aLI.Append(aId2);
- aLI.Append(aId3);
- aLI.Append(aId4);
- SetIds(aLI);
-}
-//=======================================================================
-//function :SetIds
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::SetIds(const TColStd_ListOfInteger& aLI)
-{
- Standard_Integer i, aId, aIdN;
- TColStd_ListIteratorOfListOfInteger aIt;
- //
- Clear();
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- aId=aIt.Value();
- myMap.Add(aId);
- }
- myNbIds=myMap.Extent();
- for(i=1; i<=myNbIds; ++i) {
- aId=myMap(i);
- aIdN=NormalizedId(aId, myNbIds);
- mySum+=aIdN;
- }
-}
-
-//=======================================================================
-//function :NbIds
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKey::NbIds()const
-{
- return myNbIds;
-}
-//=======================================================================
-//function :Id
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKey::Id(const Standard_Integer aIndex) const
-{
- if (aIndex<1 || aIndex>myNbIds) {
- return -1;
- }
- return myMap(aIndex);
-}
-//=======================================================================
-//function :Ids
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::Ids(Standard_Integer& aId1,
- Standard_Integer& aId2) const
-{
- aId1=0;
- aId2=0;
- if (myNbIds>1) {
- aId1=myMap(1);
- aId2=myMap(2);
- }
-}
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKey::IsEqual(const NMTDS_PassKey& aOther) const
-{
- Standard_Boolean bRet;
- Standard_Integer i, aId;
- //
- bRet=Standard_False;
- //
- if (myNbIds!=aOther.myNbIds) {
- return bRet;
- }
- for (i=1; i<=myNbIds; ++i) {
- aId=myMap(i);
- if (!aOther.myMap.Contains(aId)) {
- return bRet;
- }
- }
- return !bRet;
-}
-//=======================================================================
-//function : HashCode
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKey::HashCode(const Standard_Integer aUpper) const
-{
- return ::HashCode(mySum, aUpper);
-}
-//=======================================================================
-//function : Dump
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::Dump(const Standard_Integer )const
-{
-}
-
-//=======================================================================
-// function: NormalizedId
-// purpose :
-//=======================================================================
-Standard_Integer NormalizedId(const Standard_Integer aId,
- const Standard_Integer aDiv)
-{
- Standard_Integer aMax, aTresh, aIdRet;
- //
- aIdRet=aId;
- aMax=::IntegerLast();
- aTresh=aMax/aDiv;
- if (aId>aTresh) {
- aIdRet=aId%aTresh;
- }
- return aIdRet;
-}
-/*
-//=========
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKey::Contains(const Standard_Integer aId) const
-{
- return myMap.Contains(aId);
-}
-//=======================================================================
-//function :Contains
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKey::Contains(const NMTDS_PassKey& aOther) const
-{
- Standard_Boolean bRet;
- Standard_Integer i, aId;
- //
- bRet=Standard_False;
- //
- if (myNbIds<aOther.myNbIds) {
- return bRet;
- }
- for (i=1; i<=aOther.myNbIds; ++i) {
- aId=aOther.myMap(i);
- if (!myMap.Contains(aId)) {
- return bRet;
- }
- }
- return !bRet;
-}
-//=======================================================================
-//function :Intersected
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKey::Intersected(const NMTDS_PassKey& aOther) const
-{
- Standard_Boolean bRet;
- Standard_Integer i, aId;
- //
- bRet=Standard_False;
- //
- for (i=1; i<=myNbIds; ++i) {
- aId=myMap(i);
- if (aOther.Contains(aId)) {
- return !bRet;
- }
- }
- return bRet;
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::Add(const Standard_Integer aId)
-{
- TColStd_ListOfInteger aLI;
- aLI.Append(aId);
- //
- Add(aLI);
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::Add(const NMTDS_PassKey& aOther)
-{
- Standard_Integer i, aId;
- TColStd_ListOfInteger aLS;
- //
- for(i=1; i<=myNbIds; ++i) {
- aId=myMap(i);
- aLS.Append(aId);
- }
- for(i=1; i<=aOther.myNbIds; ++i) {
- aId=aOther.myMap(i);
- aLS.Append(aId);
- }
- //
- Add(aLS);
-}
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
- void NMTDS_PassKey::Add(const TColStd_ListOfInteger& aLI)
-{
- Standard_Integer i, aId;
- TColStd_ListOfInteger aLS;
- TColStd_ListIteratorOfListOfInteger aIt;
- //
- for(i=1; i<=myNbIds; ++i) {
- aId=myMap(i);
- aLS.Append(aId);
- }
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- aId=aIt.Value();
- aLS.Append(aId);
- }
- //
- SetIds(aLS);
-}
-//=========
-*/
+++ /dev/null
-// Copyright (C) 2007-2013 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_PassKey.hxx
-// Created:
-// Author: Peter KURNEV
-// <peter@PREFEX>
-//
-#ifndef _NMTDS_PassKey_HeaderFile
-#define _NMTDS_PassKey_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_ListOfInteger.hxx>
-
-//=======================================================================
-//function : NMTDS_PassKey
-//purpose :
-//=======================================================================
-class NMTDS_PassKey {
- public:
- Standard_EXPORT
- NMTDS_PassKey();
-
- Standard_EXPORT
- virtual ~NMTDS_PassKey();
-
- Standard_EXPORT
- NMTDS_PassKey(const NMTDS_PassKey& Other);
-
- Standard_EXPORT
- NMTDS_PassKey& operator =(const NMTDS_PassKey& Other);
-
- Standard_EXPORT
- void Clear() ;
-
- Standard_EXPORT
- void SetIds(const Standard_Integer aI1) ;
-
- Standard_EXPORT
- void SetIds(const Standard_Integer aI1,
- const Standard_Integer aI2) ;
-
- Standard_EXPORT
- void SetIds(const Standard_Integer aI1,
- const Standard_Integer aI2,
- const Standard_Integer aI3) ;
-
- Standard_EXPORT
- void SetIds(const Standard_Integer aI1,
- const Standard_Integer aI2,
- const Standard_Integer aI3,
- const Standard_Integer aI4) ;
-
- Standard_EXPORT
- void SetIds(const TColStd_ListOfInteger& aLS) ;
-
- Standard_EXPORT
- Standard_Integer NbIds() const;
-
- Standard_EXPORT
- Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const;
-
- Standard_EXPORT
- Standard_Integer HashCode(const Standard_Integer Upper) const;
-
- Standard_EXPORT
- Standard_Integer Id(const Standard_Integer aIndex) const;
-
- Standard_EXPORT
- void Ids(Standard_Integer& aI1,Standard_Integer& aI2) const;
-
- Standard_EXPORT
- void Dump(const Standard_Integer aHex = 0) const;
-
-protected:
- Standard_Integer myNbIds;
- Standard_Integer mySum;
- TColStd_IndexedMapOfInteger myMap;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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_PassKeyMapHasher.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_PassKeyMapHasher.hxx>
-
-//=======================================================================
-//function : HashCode
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKeyMapHasher::HashCode(const NMTDS_PassKey& aPK,
- const Standard_Integer Upper)
-{
- return aPK.HashCode(Upper);
-}
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKeyMapHasher::IsEqual(const NMTDS_PassKey& aPK1,
- const NMTDS_PassKey& aPK2)
-{
- return aPK1.IsEqual(aPK2);
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_PassKeyMapHasher.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTDS_PassKeyMapHasher_HeaderFile
-#define _NMTDS_PassKeyMapHasher_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <NMTDS_PassKey.hxx>
-#include <Standard_Boolean.hxx>
-
-
-//=======================================================================
-//function : NMTDS_PassKeyMapHasher
-//purpose :
-//=======================================================================
-class NMTDS_PassKeyMapHasher {
- public:
- Standard_EXPORT
- static Standard_Integer HashCode(const NMTDS_PassKey& aPKey,
- const Standard_Integer Upper) ;
-
- Standard_EXPORT
- static Standard_Boolean IsEqual(const NMTDS_PassKey& aPKey1,
- const NMTDS_PassKey& aPKey2) ;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_PassKeyShape.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_PassKeyShape.hxx>
-
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopoDS_Shape.hxx>
-
-
-static
- Standard_Integer NormalizedId(const Standard_Integer aId,
- const Standard_Integer aDiv);
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_PassKeyShape::NMTDS_PassKeyShape()
-{
- myUpper=432123;
-}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTDS_PassKeyShape::NMTDS_PassKeyShape(const NMTDS_PassKeyShape& aOther)
-{
- myUpper=432123;
- myNbIds=aOther.myNbIds;
- mySum=aOther.mySum;
- myMap=aOther.myMap;
-}
-//=======================================================================
-//function :~
-//purpose :
-//=======================================================================
- NMTDS_PassKeyShape::~NMTDS_PassKeyShape()
-{
-}
-//=======================================================================
-//function :Assign
-//purpose :
-//=======================================================================
- NMTDS_PassKeyShape& NMTDS_PassKeyShape::Assign(const NMTDS_PassKeyShape& aOther)
-{
- myUpper=432123;
- myNbIds=aOther.myNbIds;
- mySum=aOther.mySum;
- myMap=aOther.myMap;
- return *this;
-}
-//=======================================================================
-//function :Clear
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::Clear()
-{
- myNbIds=0;
- mySum=0;
- myMap.Clear();
-}
-//=======================================================================
-//function :SetShapes
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1)
-
-{
- Standard_Integer aHC;
- //
- Clear();
- myNbIds=1;
- myMap.Add(aS1);
- aHC=aS1.HashCode(myUpper);
- mySum=NormalizedId(aHC, myNbIds);
-}
-//=======================================================================
-//function :SetShapes
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2)
-{
- TopTools_ListOfShape aLS;
- //
- aLS.Append(aS1);
- aLS.Append(aS2);
- SetShapes(aLS);
-}
-//=======================================================================
-//function :SetShapes
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2,
- const TopoDS_Shape& aS3)
-{
- TopTools_ListOfShape aLS;
- //
- aLS.Append(aS1);
- aLS.Append(aS2);
- aLS.Append(aS3);
- SetShapes(aLS);
-}
-//=======================================================================
-//function :SetShapes
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2,
- const TopoDS_Shape& aS3,
- const TopoDS_Shape& aS4)
-{
- TopTools_ListOfShape aLS;
- //
- aLS.Append(aS1);
- aLS.Append(aS2);
- aLS.Append(aS3);
- aLS.Append(aS4);
- SetShapes(aLS);
-}
-//=======================================================================
-//function :SetShapes
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS)
-{
- Standard_Integer i, aId, aIdN;
- TopTools_ListIteratorOfListOfShape aIt;
- //
- Clear();
- aIt.Initialize(aLS);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aS=aIt.Value();
- myMap.Add(aS);
- }
- myNbIds=myMap.Extent();
- for(i=1; i<=myNbIds; ++i) {
- const TopoDS_Shape& aS=myMap(i);
- aId=aS.HashCode(myUpper);
- aIdN=NormalizedId(aId, myNbIds);
- mySum+=aIdN;
- }
-}
-//=======================================================================
-//function :NbIds
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKeyShape::NbIds()const
-{
- return myNbIds;
-}
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKeyShape::IsEqual(const NMTDS_PassKeyShape& aOther) const
-{
- Standard_Boolean bRet;
- Standard_Integer i;
- //
- bRet=Standard_False;
- //
- if (myNbIds!=aOther.myNbIds) {
- return bRet;
- }
- for (i=1; i<=myNbIds; ++i) {
- const TopoDS_Shape& aS=myMap(i);
- if (!aOther.myMap.Contains(aS)) {
- return bRet;
- }
- }
- return !bRet;
-}
-//=======================================================================
-//function : HashCode
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKeyShape::HashCode(const Standard_Integer aUpper) const
-{
- return ::HashCode(mySum, aUpper);
-}
-//=======================================================================
-//function : Dump
-//purpose :
-//=======================================================================
- void NMTDS_PassKeyShape::Dump(const Standard_Integer)const
-{
-}
-//=======================================================================
-// function: NormalizedId
-// purpose :
-//=======================================================================
-Standard_Integer NormalizedId(const Standard_Integer aId,
- const Standard_Integer aDiv)
-{
- Standard_Integer aMax, aTresh, aIdRet;
- //
- aIdRet=aId;
- aMax=::IntegerLast();
- aTresh=aMax/aDiv;
- if (aId>aTresh) {
- aIdRet=aId%aTresh;
- }
- return aIdRet;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_PassKeyShape.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTDS_PassKeyShape_HeaderFile
-#define _NMTDS_PassKeyShape_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <Standard_Boolean.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ListOfShape.hxx>
-
-//=======================================================================
-//function : NMTDS_PassKeyShape
-//purpose :
-//=======================================================================
-class NMTDS_PassKeyShape {
- public:
- Standard_EXPORT
- NMTDS_PassKeyShape();
-
- Standard_EXPORT
- virtual ~NMTDS_PassKeyShape();
-
- Standard_EXPORT
- NMTDS_PassKeyShape(const NMTDS_PassKeyShape& Other);
-
- Standard_EXPORT
- NMTDS_PassKeyShape& Assign(const NMTDS_PassKeyShape& Other) ;
-
- NMTDS_PassKeyShape& operator =(const NMTDS_PassKeyShape& Other) {
- return Assign(Other);
- }
-
- Standard_EXPORT
- void SetShapes(const TopoDS_Shape& aS) ;
-
- Standard_EXPORT
- void SetShapes(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2) ;
-
- Standard_EXPORT
- void SetShapes(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2,
- const TopoDS_Shape& aS3) ;
-
- Standard_EXPORT
- void SetShapes(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2,
- const TopoDS_Shape& aS3,
- const TopoDS_Shape& aS4) ;
-
- Standard_EXPORT
- void SetShapes(const TopTools_ListOfShape& aLS) ;
-
- Standard_EXPORT
- void Clear() ;
-
- Standard_EXPORT
- Standard_Integer NbIds() const;
-
- Standard_EXPORT
- Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aOther) const;
-
- Standard_EXPORT
- Standard_Integer HashCode(const Standard_Integer Upper) const;
-
- Standard_EXPORT
- void Dump(const Standard_Integer aHex = 0) const;
-
- protected:
- Standard_Integer myNbIds;
- Standard_Integer mySum;
- Standard_Integer myUpper;
- TopTools_IndexedMapOfShape myMap;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_PassKeyMapHasher.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_PassKeyShapeMapHasher.hxx>
-
-//=======================================================================
-//function : HashCode
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_PassKeyShapeMapHasher::HashCode(const NMTDS_PassKeyShape& aPK,
- const Standard_Integer Upper)
-{
- return aPK.HashCode(Upper);
-}
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean NMTDS_PassKeyShapeMapHasher::IsEqual(const NMTDS_PassKeyShape& aPK1,
- const NMTDS_PassKeyShape& aPK2)
-{
- return aPK1.IsEqual(aPK2);
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_PassKeyMapHasher.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTDS_PassKeyShapeMapHasher_HeaderFile
-#define _NMTDS_PassKeyShapeMapHasher_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <NMTDS_PassKeyShape.hxx>
-#include <Standard_Boolean.hxx>
-
-//=======================================================================
-//function : NMTDS_PassKeyShapeMapHasher
-//purpose :
-//=======================================================================
-class NMTDS_PassKeyShapeMapHasher {
- public:
- Standard_EXPORT
- static Standard_Integer HashCode(const NMTDS_PassKeyShape& aPKey,
- const Standard_Integer Upper) ;
-
- Standard_EXPORT
- static Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aPKey1,
- const NMTDS_PassKeyShape& aPKey2) ;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_ShapesDataStructure.cxx
-// Author: Peter KURNEV
-
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Shape.hxx>
-#include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
-#include <NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx>
-#include <NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx>
-#include <BooleanOperations_ShapeAndInterferences.hxx>
-#include <NMTDS_IndexRange.hxx>
-//
-#include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <NMTDS_Tools.hxx>
-
-
-static
- void ComputeBoxExS(const Standard_Integer aIx,
- const NMTDS_ShapesDataStructure* pDS,
- Bnd_Box& aBoxEx);
-static
- void GetAllSuccessorsS(const Standard_Integer nS,
- const NMTDS_ShapesDataStructure* myDS,
- TColStd_IndexedMapOfInteger& aMA);
-
-//===========================================================================
-//function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure
-//purpose :
-//===========================================================================
-NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure()
-:
- BooleanOperations_ShapesDataStructure()
-{}
-//===========================================================================
-//function : SetCompositeShape
-//purpose :
-//===========================================================================
-void NMTDS_ShapesDataStructure::SetCompositeShape(const TopoDS_Shape& aS)
-{
- myCompositeShape=aS;
-}
-//===========================================================================
-//function : CompositeShape
-//purpose :
-//===========================================================================
-const TopoDS_Shape& NMTDS_ShapesDataStructure::CompositeShape()const
-{
- return myCompositeShape;
-}
-//===========================================================================
-//function : Ranges
-//purpose :
-//===========================================================================
-const NMTDS_CArray1OfIndexRange& NMTDS_ShapesDataStructure::Ranges()const
-{
- return myRanges;
-}
-//===========================================================================
-//function : FillMap
-//purpose :
-//===========================================================================
-void NMTDS_ShapesDataStructure::FillMap
- (const TopoDS_Shape& aS,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const
-{
- Standard_Integer iX, i, j, aIndex, aNbSc, aNbS;
- BooleanOperations_AncestorsSeqAndSuccessorsSeq aAS;
- //
- aMSA.Add(aS, aAS);
- aMS.Add(aS, aAS);
- FillSubshapes(aS, aMSA, aMS);
- //
- aNbS=aMS.Extent();
- for(i=1; i<=aNbS; ++i) {
- TColStd_MapOfInteger aMFence;
- //
- const TopoDS_Shape& aSX=aMS.FindKey(i);
- iX=aMSA.FindIndex(aSX);
- const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS1=aMSA(iX);
- //
- aNbSc=aAS1.NumberOfSuccessors();
- for(j=1; j<=aNbSc; ++j) {
- aIndex=aAS1.GetSuccessor(j);
- if(aMFence.Add(aIndex)) {
- BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS2=aMSA.ChangeFromIndex(aIndex);
- aAS2.SetNewAncestor(iX);
- }
- }
- }
-}
-//===========================================================================
-//function : FillSubshapes
-//purpose :
-//===========================================================================
-void NMTDS_ShapesDataStructure::FillSubshapes
- (const TopoDS_Shape& aS,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const
-{
- Standard_Boolean bIsNewSubShape;
- Standard_Integer aIndexSubShape, aIndex;
- BooleanOperations_AncestorsSeqAndSuccessorsSeq aASx;
- //
- aIndex=aMSA.FindIndex(aS);
- BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS=aMSA.ChangeFromIndex(aIndex);
- //
- TopoDS_Iterator anIt(aS, Standard_True);
- for(; anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aSubShape = anIt.Value();
- bIsNewSubShape = Standard_False;
- if(!aMSA.Contains(aSubShape)) {
- bIsNewSubShape=!bIsNewSubShape;
- aIndexSubShape=aMSA.Add(aSubShape, aASx);
- aMS.Add(aSubShape, aASx);
- }
- else {
- aIndexSubShape=aMSA.FindIndex(aSubShape);
- }
- aAS.SetNewSuccessor(aIndexSubShape);
- aAS.SetNewOrientation(aSubShape.Orientation());
- //
- if(bIsNewSubShape && (aSubShape.ShapeType() != TopAbs_VERTEX)) {
- FillSubshapes(aSubShape, aMSA, aMS);
- }
- }
-}
-//===========================================================================
-//function : Init
-//purpose :
-//===========================================================================
-void NMTDS_ShapesDataStructure::Init()
-{
- Standard_Integer i, j, aNbSx, aNbS, aShift, aNbRanges;
- Standard_Integer iFirst, iLast;
- NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors aLx;
- NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors aLit;
- TopoDS_Iterator anIt;
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMSA;
- //
- anIt.Initialize(myCompositeShape);
- for (; anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aSx=anIt.Value();
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMS;
- //
- if (!aMSA.Contains(aSx)) {
- FillMap(aSx, aMSA, aMS);
- aLx.Append(aMS);
- }
- }
- aNbS=aMSA.Extent();
- //
- // Fill myRanges
- i=aLx.Extent();
- myRanges.Resize(i);
- aLit.Initialize(aLx);
- for (i=1; aLit.More(); aLit.Next(), ++i) {
- const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSx=aLit.Value();
- aNbSx=aMSx.Extent();
- if (i==1) {
- iFirst=1;
- iLast=aNbSx;
- myRanges(i).SetFirst(iFirst);
- myRanges(i).SetLast(iLast);
- continue;
- }
- iFirst=myRanges(i-1).Last()+1;
- iLast=iFirst+aNbSx-1;
- myRanges(i).SetFirst(iFirst);
- myRanges(i).SetLast(iLast);
- }
- //
- myNumberOfShapesOfTheObject=aNbS;
- myNumberOfShapesOfTheTool=0;
- myLength=2*aNbS;
- //
- // Allocate the whole Table
- myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
- Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences));
- //
- // Fill the table
-
- aShift=0;
- for (j=1; j<=aNbS; ++j) {
- const TopoDS_Shape& aSx=aMSA.FindKey(j);
- const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=aMSA.FindFromIndex(j);
- InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift);
- }
- // myShapeIndexMap
- myShapeIndexMap.Clear();
- //
- //modified by NIZNHY-PKV Mon Dec 12 09:01:53 2011f
- aNbRanges=myRanges.Extent();
- for (i=1; i<=aNbRanges; ++i){
- const NMTDS_IndexRange& aR=myRanges(i);
- iFirst=aR.First();
- iLast =aR.Last();
- for (j=iFirst; j<=iLast; ++j) {
- const TopoDS_Shape& aS=Shape(j);
- myShapeIndexMap.Bind(aS, j);
- }
- }
- //modified by NIZNHY-PKV Mon Dec 12 09:02:00 2011t
- //
- // myRefEdges
- iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
- myRefEdges.Resize(iLast);
-
- for (i=1; i<=iLast; ++i) {
- const TopoDS_Shape& aS=Shape(i);
- myRefEdges(i)=0;
- if (aS.ShapeType()==TopAbs_EDGE) {
- myNbEdges++;
- myRefEdges(i)=myNbEdges;
- }
- }
-}
-//===========================================================================
-//function : ShapeRangeIndex
-//purpose :
-//===========================================================================
-Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex
- (const Standard_Integer aId)const
-{
- Standard_Boolean bFound;
- Standard_Integer i, aNbR, aIdx, aNbS, aZero=0;
- //
- aNbS=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
-
- aIdx=aId;
- if (aIdx > aNbS || aIdx < 1){
- return aZero;
- }
- //
- if (aIdx > myNumberOfShapesOfTheObject) {
- aIdx-=myNumberOfShapesOfTheObject;
- }
- //
- aNbR=myRanges.Extent();
- for (i=1; i<=aNbR; ++i) {
- const NMTDS_IndexRange& aRange=myRanges(i);
- bFound=aRange.IsInRange(aIdx);
- if (bFound) {
- return i;
- }
- }
- return aZero;
-}
-//===========================================================================
-//function : Rank
-//purpose :
-//===========================================================================
-Standard_Integer NMTDS_ShapesDataStructure::Rank
- (const Standard_Integer aId)const
-{
- Standard_Boolean bFound;
- Standard_Integer i, aNbR, aNbS, aZero=0;
- //
- aNbS=myNumberOfShapesOfTheObject;
-
- if (aId > aNbS || aId < 1){
- return aZero;
- }
- //
- aNbR=myRanges.Extent();
- for (i=1; i<=aNbR; ++i) {
- const NMTDS_IndexRange& aRange=myRanges(i);
- bFound=aRange.IsInRange(aId);
- if (bFound) {
- return i;
- }
- }
- return aZero;
-}
-//===========================================================================
-//function : ShapeIndex
-//purpose :
-//===========================================================================
-Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex
- (const TopoDS_Shape& aS,
- const Standard_Integer aRank)const
-{
- Standard_Address pIndex;
- Standard_Integer aIndex;
- //
- aIndex=0;
- //
- //modified by NIZNHY-PKV Mon Dec 12 09:02:48 2011f
- pIndex=myShapeIndexMap.Find1(aS);
- if (pIndex) {
- aIndex=*((Standard_Integer*)pIndex);
- }
- //modified by NIZNHY-PKV Mon Dec 12 09:02:54 2011t
- return aIndex;
-}
-
-//=======================================================================
-//function : ComputeBoxEx
-//purpose :
-//=======================================================================
-void NMTDS_ShapesDataStructure::ComputeBoxEx
- (const Standard_Integer aIx,
- Bnd_Box& aBoxEx)const
-{
- ComputeBoxExS(aIx, this, aBoxEx);
-}
-//=======================================================================
-//function : GetAllSuccessors
-//purpose :
-//=======================================================================
-void NMTDS_ShapesDataStructure::GetAllSuccessors
- (const Standard_Integer nS,
- TColStd_IndexedMapOfInteger& aMA)const
-{
- GetAllSuccessorsS(nS, this, aMA);
-}
-//=======================================================================
-//function : GetAllSuccessorsS
-//purpose :
-//=======================================================================
-void GetAllSuccessorsS(const Standard_Integer nS,
- const NMTDS_ShapesDataStructure* myDS,
- TColStd_IndexedMapOfInteger& aMA)
-{
- TopAbs_ShapeEnum aT;
- Standard_Integer i, nSx, aNbSuccessors, *pSuccessors;
- Standard_Address xSuccessors;
- //
- const TopoDS_Shape& aS=myDS->Shape(nS);
- aT=aS.ShapeType();
- if(NMTDS_Tools::HasBRep(aT)) {
- aMA.Add(nS);
- //
- if (aT==TopAbs_VERTEX) {
- return;
- }
- }
- //
- myDS->GetSuccessors(nS, xSuccessors, aNbSuccessors);
- pSuccessors=(Standard_Integer*)xSuccessors;
- for (i=0; i<aNbSuccessors; ++i) {
- nSx=pSuccessors[i];
- GetAllSuccessorsS(nSx, myDS, aMA);
- }
-}
-//=======================================================================
-// function: ComputeBoxExS
-// purpose:
-//=======================================================================
-void ComputeBoxExS(const Standard_Integer aIx,
- const NMTDS_ShapesDataStructure* pDS,
- Bnd_Box& aBoxEx)
-{
- Standard_Integer i, aNbS, iS;
- //
- const Bnd_Box& aBox=pDS->GetBoundingBox(aIx);
- aBoxEx.Add(aBox);
- //
- aNbS=pDS->NumberOfSuccessors(aIx);
- for (i=1; i<=aNbS; ++i) {
- Bnd_Box aBoxS;
- iS=pDS->GetSuccessor(aIx, i);
- ComputeBoxExS(iS, pDS, aBoxS);
- aBoxEx.Add(aBoxS);
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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
-//
-
-
-#ifndef _NMTDS_ShapesDataStructure_HeaderFile
-#define _NMTDS_ShapesDataStructure_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <TopoDS_Shape.hxx>
-#include <NMTDS_CArray1OfIndexRange.hxx>
-#include <TopTools_DataMapOfShapeInteger.hxx>
-#include <BooleanOperations_ShapesDataStructure.hxx>
-#include <Standard_Integer.hxx>
-#include <TopoDS_Shape.hxx>
-#include <NMTDS_CArray1OfIndexRange.hxx>
-#include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <Bnd_Box.hxx>
-
-//=======================================================================
-//class : NMTDS_ShapesDataStructure
-//purpose :
-//=======================================================================
-class NMTDS_ShapesDataStructure : public BooleanOperations_ShapesDataStructure
-{
- public:
- Standard_EXPORT
- NMTDS_ShapesDataStructure();
-
- Standard_EXPORT
- void SetCompositeShape(const TopoDS_Shape& aS) ;
-
- Standard_EXPORT
- void Init() ;
-
- Standard_EXPORT
- const NMTDS_CArray1OfIndexRange& Ranges() const;
-
- Standard_EXPORT
- const TopoDS_Shape& CompositeShape() const;
-
- Standard_EXPORT
- Standard_Integer ShapeRangeIndex(const Standard_Integer aId) const;
-
- Standard_EXPORT
- virtual Standard_Integer Rank(const Standard_Integer anIndex) const;
-
- Standard_EXPORT
- virtual Standard_Integer ShapeIndex(const TopoDS_Shape& aS,
- const Standard_Integer iRank) const;
-
- Standard_EXPORT
- void FillMap(const TopoDS_Shape& aS,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const;
-
- Standard_EXPORT
- void FillSubshapes(const TopoDS_Shape& aS,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,
- BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const;
-
- Standard_EXPORT
- void GetAllSuccessors(const Standard_Integer anIndex,
- TColStd_IndexedMapOfInteger& aScrs) const;
-
- Standard_EXPORT
- void ComputeBoxEx(const Standard_Integer anIndex,
- Bnd_Box& aBox) const;
-
-
- protected:
- TopoDS_Shape myCompositeShape;
- NMTDS_CArray1OfIndexRange myRanges;
- TopTools_DataMapOfShapeInteger myShapeIndexMap;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_Tools.cxx
-// Created: Tue Feb 20 14:57:28 2007
-// Author: Peter KURNEV
-
-#include <NMTDS_Tools.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <gp_Pnt.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_IndexedDataMapOfShapeShape.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <BRep_Builder.hxx>
-
-void CopySource(const TopoDS_Shape& aS,
- TopTools_IndexedDataMapOfShapeShape& aMapSS,
- TopoDS_Shape& aSC);
-
-//=======================================================================
-//function : CopyShape
-//purpose :
-//=======================================================================
- void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
- TopoDS_Shape& aSC)
-{
- TopTools_IndexedDataMapOfShapeShape aMapSS;
- //
- CopySource(aS, aMapSS, aSC);
-}
-//=======================================================================
-//function : CopyShape
-//purpose :
-//=======================================================================
- void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
- TopoDS_Shape& aSC,
- TopTools_IndexedDataMapOfShapeShape& aMapSS)
-{
- CopySource(aS, aMapSS, aSC);
-}
-//=======================================================================
-//function : CopySource
-//purpose :
-//=======================================================================
-void CopySource(const TopoDS_Shape& aS,
- TopTools_IndexedDataMapOfShapeShape& aMapSS,
- TopoDS_Shape& aSC)
-{
- Standard_Boolean bFree;
- TopAbs_ShapeEnum aT;
- TopoDS_Iterator aIt;
- TopoDS_Shape aSF;
- BRep_Builder BB;
- //
- aT=aS.ShapeType();
- //
- if (aMapSS.Contains(aS)) {
- aSC=aMapSS.ChangeFromKey(aS);
- aSC.Orientation(aS.Orientation());
- return;
- }
- else {
- aSC=aS.EmptyCopied();
- aMapSS.Add(aS, aSC);
- }
- //
- bFree=aSC.Free();
- aSC.Free(Standard_True);
- aSF=aS;
- if (aT==TopAbs_EDGE){
- TopAbs_Orientation aOr;
- //
- aOr=aS.Orientation();
- if(aOr==TopAbs_INTERNAL) {
- aSF.Orientation(TopAbs_FORWARD);
- }
- }
- aIt.Initialize(aSF);
- for (; aIt.More(); aIt.Next()) {
- TopoDS_Shape aSCx;
- //
- const TopoDS_Shape& aSx=aIt.Value();
- //
- CopySource (aSx, aMapSS, aSCx);
- //
- aSCx.Orientation(aSx.Orientation());
- BB.Add(aSC, aSCx);
- }
- aSC.Free(bFree);
-}
-//=======================================================================
-// function: ComputeVV
-// purpose:
-//=======================================================================
- Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1,
- const TopoDS_Vertex& aV2)
-{
- Standard_Real aTolV1, aTolV2, aTolSum, aTolSum2, aD2;
- gp_Pnt aP1, aP2;
- //
- aTolV1=BRep_Tool::Tolerance(aV1);
- aTolV2=BRep_Tool::Tolerance(aV2);
- aTolSum=aTolV1+aTolV2;
- aTolSum2=aTolSum*aTolSum;
- //
- aP1=BRep_Tool::Pnt(aV1);
- aP2=BRep_Tool::Pnt(aV2);
- //
- aD2=aP1.SquareDistance(aP2);
- if (aD2>aTolSum2) {
- return -1;
- }
- return 0;
-}
-//=======================================================================
-// function: HasBRep
-// purpose:
-//=======================================================================
- Standard_Boolean NMTDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi)
-{
- return (aTi==TopAbs_VERTEX || aTi==TopAbs_EDGE || aTi==TopAbs_FACE);
-}
-//=======================================================================
-//function : TypeToInteger
-//purpose :
-//=======================================================================
- Standard_Integer NMTDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2)
-{
- Standard_Integer iRet, iT1, iT2, iX;
- //
- iRet=-1;
- iT1=(Standard_Integer)aType1;
- iT2=(Standard_Integer)aType2;
- //
- iX=iT2*10+iT1;
- switch (iX) {
- case 77:
- iRet=5; // VV
- break;
- case 76:
- case 67:
- iRet=4; // VE
- break;
- case 74:
- case 47:
- iRet=2; // VF
- break;
- case 66:
- iRet=3; // EE
- break;
- case 64:
- case 46:
- iRet=1; // EF
- break;
- case 44:
- iRet=0; // FF
- break;
- default:
- break;
- }
- return iRet;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_Tools.hxx
-// Created:
-// Author: Peter KURNEV
-
-#ifndef _NMTDS_Tools_HeaderFile
-#define _NMTDS_Tools_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <Standard_Boolean.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_IndexedDataMapOfShapeShape.hxx>
-
-//=======================================================================
-//function : NMTDS_Tools
-//purpose :
-//=======================================================================
-class NMTDS_Tools
-{
- public:
- Standard_EXPORT
- static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aT1,
- const TopAbs_ShapeEnum aT2) ;
-
- Standard_EXPORT
- static Standard_Boolean HasBRep(const TopAbs_ShapeEnum aT) ;
-
- Standard_EXPORT
- static Standard_Integer ComputeVV(const TopoDS_Vertex& aV1,
- const TopoDS_Vertex& aV2) ;
-
- 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
+++ /dev/null
-# Copyright (C) 2012-2013 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
-#
-
-# --- options ---
-
-# additional include directories
-INCLUDE_DIRECTORIES(
- ${CAS_INCLUDE_DIRS}
- ${KERNEL_INCLUDE_DIRS}
- ${PROJECT_SOURCE_DIR}/src/NMTDS
- ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
-# additional preprocessor / compiler flags
-ADD_DEFINITIONS(
- ${CAS_DEFINITIONS}
- )
-
-# libraries to link to
-SET(_link_LIBRARIES
- ${CAS_KERNEL}
- ${CAS_TKBool} ${CAS_BO}
- NMTDS
- )
-
-# --- headers ---
-
-SET(NMTTools_HEADERS
- NMTTools_CheckerSI.hxx
- NMTTools_CommonBlock.hxx
- NMTTools_CommonBlockAPI.hxx
- NMTTools_CommonBlockPool.hxx
- NMTTools_CommonBlockPool.hxx
- NMTTools_CoupleOfShape.hxx
- NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx
- NMTTools_ListIteratorOfListOfCommonBlock.hxx
- NMTTools_ListIteratorOfListOfCoupleOfShape.hxx
- NMTTools_ListIteratorOfListOfCoupleOfShape.hxx
- NMTTools_ListOfCommonBlock.hxx
- NMTTools_ListOfCoupleOfShape.hxx
- NMTTools_PPaveFiller.hxx
- NMTTools_PaveFiller.hxx
- NMTTools_Tools.hxx
- )
-
-# --- sources ---
-
-SET(NMTTools_SOURCES
- NMTTools_CheckerSI.cxx
- NMTTools_CheckerSI_1.cxx
- NMTTools_CommonBlockAPI.cxx
- NMTTools_CommonBlock.cxx
- NMTTools_CommonBlockPool.cxx
- NMTTools_CoupleOfShape.cxx
- NMTTools_DEProcessor.cxx
- NMTTools_FaceInfo.cxx
- NMTTools_PaveFiller_0.cxx
- NMTTools_PaveFiller_1.cxx
- NMTTools_PaveFiller_2.cxx
- NMTTools_PaveFiller_3.cxx
- NMTTools_PaveFiller_4.cxx
- NMTTools_PaveFiller_5.cxx
- NMTTools_PaveFiller_6.cxx
- NMTTools_PaveFiller_7.cxx
- NMTTools_PaveFiller_8.cxx
- NMTTools_PaveFiller_9.cxx
- NMTTools_PaveFiller.cxx
- NMTTools_Tools.cxx
- )
-
-# --- rules ---
-
-ADD_LIBRARY(NMTTools ${NMTTools_SOURCES})
-TARGET_LINK_LIBRARIES(NMTTools ${_link_LIBRARIES})
-INSTALL(TARGETS NMTTools EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
-
-INSTALL(FILES ${NMTTools_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+++ /dev/null
-NMTTools_PaveFiller_0.cxx
-NMTTools_PaveFiller_1.cxx
-NMTTools_PaveFiller_2.cxx
-NMTTools_PaveFiller_3.cxx
-NMTTools_PaveFiller_4.cxx
-NMTTools_PaveFiller_5.cxx
-NMTTools_PaveFiller_6.cxx
-NMTTools_PaveFiller_7.cxx
-NMTTools_PaveFiller_8.cxx
-NMTTools_PaveFiller_9.cxx
-
-
-NMTTools_CoupleOfShape.hxx
-NMTTools_CoupleOfShape.cxx
-NMTTools_CommonBlock.hxx
-NMTTools_CommonBlock.cxx
-NMTTools_CommonBlockAPI.hxx
-NMTTools_CommonBlockAPI.cxx
-NMTTools_FaceInfo.hxx
-NMTTools_FaceInfo.cxx
-NMTTools_FaceInfo.lxx
-NMTTools_Tools.hxx
-NMTTools_Tools.cxx
-NMTTools_PaveFiller.hxx
-NMTTools_PaveFiller.cxx
-NMTTools_PPaveFiller.hxx
-NMTTools_DEProcessor.hxx
-NMTTools_DEProcessor.cxx
-NMTTools_CheckerSI.hxx
-NMTTools_CheckerSI.cxx
-NMTTools_CheckerSI_1.cxx
-
-NMTTools_ListOfCommonBlock.hxx
-NMTTools_ListIteratorOfListOfCommonBlock.hxx
-NMTTools_ListOfCoupleOfShape.hxx
-NMTTools_ListIteratorOfListOfCoupleOfShape.hxx
-
-NMTTools_MapOfPaveBlock.hxx
-NMTTools_MapIteratorOfMapOfPaveBlock.hxx
-
-NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx
-NMTTools_IndexedDataMapOfShapePaveBlock.hxx
-NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx
-
-NMTTools_DataMapOfIntegerListOfPaveBlock.hxx
-NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx
-
-NMTTools_DataMapOfIntegerFaceInfo.hxx
-NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx
-
-NMTTools_CommonBlockPool.hxx
-NMTTools_CommonBlockPool.cxx
+++ /dev/null
--- Copyright (C) 2007-2013 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.cdl
--- Created: Thu Dec 4 16:55:49 2003
--- Author: Peter KURNEV
--- <pkv@irinox>
---
-package NMTTools
-
- ---Purpose:
-
-uses
-
- TCollection,
- TColStd,
- gp,
- TopAbs,
- TopoDS,
- TopTools,
- Geom2d,
- BooleanOperations,
- BOPTColStd,
- IntTools,
- BOPTools,
- NMTDS
-
-is
- imported CoupleOfShape from NMTTools;
- imported CommonBlock from NMTTools;
- imported CommonBlockAPI from NMTTools;
- imported FaceInfo from NMTTools;
- imported Tools from NMTTools;
- imported PaveFiller from NMTTools;
- imported PPaveFiller from NMTTools;
- imported DEProcessor from NMTTools;
- imported CheckerSI from NMTTools;
- --
- imported ListOfCommonBlock from NMTTools;
- imported ListIteratorOfListOfCommonBlock from NMTTools;
-
- imported ListOfCoupleOfShape from NMTTools;
- imported ListIteratorOfListOfCoupleOfShape from NMTTools;
-
- imported MapOfPaveBlock from NMTTools;
- imported MapIteratorOfMapOfPaveBlock from NMTTools;
-
- imported IndexedDataMapOfIndexedMapOfInteger from NMTTools;
- imported IndexedDataMapOfShapePaveBlock from NMTTools;
- imported IndexedDataMapOfShapeIndexedMapOfShape from NMTTools;
-
- imported DataMapOfIntegerListOfPaveBlock from NMTTools;
- imported DataMapIteratorOfDataMapOfIntegerListOfPaveBlock from NMTTools;
-
- imported DataMapOfIntegerFaceInfo from NMTTools;
- imported DataMapIteratorOfDataMapOfIntegerFaceInfo from NMTTools;
-
- imported CommonBlockPool from NMTTools;
-
- --
- --class PaveFiller;
- --class Tools;
- --class CommonBlock;
- --class CommonBlockAPI;
- --class FaceInfo;
- --class CoupleOfShape;
- --class CheckerSI;
- --class DEProcessor;
- --pointer PPaveFiller to PaveFiller from NMTTools;
- --
- --class ListOfCommonBlock instantiates
- -- List from TCollection(CommonBlock from NMTTools);
-
- --class ListOfCoupleOfShape instantiates
- -- List from TCollection(CoupleOfShape from NMTTools);
---
- --class MapOfPaveBlock instantiates
- -- Map from TCollection (PaveBlock from BOPTools,
- -- PaveBlockMapHasher from BOPTools);
---
- --class IndexedDataMapOfIndexedMapOfInteger instantiates
- -- IndexedDataMap from TCollection (Integer from Standard,
- -- IndexedMapOfInteger from TColStd,
- -- MapIntegerHasher from TColStd);
-
- --class IndexedDataMapOfShapePaveBlock instantiates
- -- IndexedDataMap from TCollection (Shape from TopoDS,
- -- PaveBlock from BOPTools,
- -- ShapeMapHasher from TopTools);
-
- --class IndexedDataMapOfShapeIndexedMapOfShape instantiates
- -- IndexedDataMap from TCollection (Shape from TopoDS,
- -- IndexedMapOfShape from TopTools,
- -- ShapeMapHasher from TopTools);
-
---
- --class DataMapOfIntegerListOfPaveBlock instantiates
- -- DataMap from TCollection(Integer from Standard,
- -- ListOfPaveBlock from BOPTools,
- -- MapIntegerHasher from TColStd);
-
- --class DataMapOfIntegerFaceInfo instantiates
- -- DataMap from TCollection(Integer from Standard,
- -- FaceInfo from NMTTools,
- -- MapIntegerHasher from TColStd);
---
- --class CommonBlockPool instantiates
- -- CArray1 from BOPTColStd (ListOfCommonBlock from NMTTools);
---
-end NMTTools;
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_CheckerSI.cxx
-// Created: Mon Feb 19 11:32:08 2007
-// Author: Peter KURNEV
-//
-#include <NMTTools_CheckerSI.hxx>
-
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_IteratorCheckerSI.hxx>
-#include <NMTDS_InterfPool.hxx>
-#include <NMTTools_DEProcessor.hxx>
-#include <IntTools_Context.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
- NMTTools_CheckerSI::NMTTools_CheckerSI()
-:
- NMTTools_PaveFiller()
-{
- myStopStatus=0;
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
- NMTTools_CheckerSI::~NMTTools_CheckerSI()
-{
-}
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
- void NMTTools_CheckerSI::Clear()
-{
- NMTTools_PaveFiller::Clear();
-}
-//=======================================================================
-//function : StopStatus
-//purpose :
-//=======================================================================
- Standard_Integer NMTTools_CheckerSI::StopStatus()const
-{
- return myStopStatus;
-}
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
- void NMTTools_CheckerSI::Init()
-{
- myIsDone=Standard_False;
- if (myCompositeShape.IsNull()) {
- return;
- }
- //
- Clear();
- // 1.
- myDS=new NMTDS_ShapesDataStructure;
- myDS->SetCompositeShape(myCompositeShape);
- myDS->Init();
- //
- // 2.
- myDSIt=new NMTDS_IteratorCheckerSI;
- myDSIt->SetDS(myDS);
- myDSIt->Prepare();
- //
- // 3.
- myNbSources=myDS->NumberOfShapesOfTheObject()+
- myDS->NumberOfShapesOfTheTool();
- myNbEdges=myDS->NbEdges();
- // 4
- myIP=new NMTDS_InterfPool;
- //
- // 5
- myContext=new IntTools_Context;
-}
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
- void NMTTools_CheckerSI::Perform()
-{
- myIsDone=Standard_False;
- myStopStatus=0;
- //
- Init();
- //1.VV
- //
- PerformVV();
- //
- // 2.VE
- myPavePool.Resize (myNbEdges);
-
- PrepareEdges();
- //
- PerformVE();
- //
- // 3.VF
- PerformVF();
- //
- // 4.EE
- myCommonBlockPool.Resize (myNbEdges);
- mySplitShapesPool.Resize (myNbEdges);
- myPavePoolNew .Resize (myNbEdges);
- //
- PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
- if (myStopStatus) {
- return;
- }
- PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
- if (myStopStatus) {
- return;
- }
- //
- PerformEE();
- //
- RefinePavePool ();
- if (myStopStatus) {
- return;
- }
- //
- myPavePoolNew.Destroy();
- myPavePoolNew.Resize (myNbEdges);
- //
- // 5.EF
- PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
- if (myStopStatus) {
- return;
- }
- //
- PerformEF();
- //
- RefinePavePool();
- if (myStopStatus) {
- return;
- }
- //
- myPavePoolNew.Destroy();
- //
- MakeSplitEdges();
- //
- UpdateCommonBlocks();
- //
- // 6. FF
- PerformFF ();
- //
- MakeBlocks();
- //
- MakePCurves();
- //
- // 7. Postprocessing
- UpdatePaveBlocks();
- //
- NMTTools_DEProcessor aDEP(*this);
- aDEP.Do();
- //
- MakeAloneVertices();
- //
- myIsDone=Standard_True;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_CheckerSI.hxx
-// Created: Mon Feb 19 11:32:08 2007
-// Author: Peter KURNEV
-//
-#ifndef _NMTTools_CheckerSI_HeaderFile
-#define _NMTTools_CheckerSI_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <NMTTools_PaveFiller.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-
-//=======================================================================
-//class : NMTTools_CheckerSI
-//purpose :
-//=======================================================================
-class NMTTools_CheckerSI : public NMTTools_PaveFiller
-{
- public:
- Standard_EXPORT
- NMTTools_CheckerSI();
-
- Standard_EXPORT
- virtual ~NMTTools_CheckerSI();
-
- Standard_EXPORT
- virtual void Perform() ;
-
- Standard_EXPORT
- Standard_Integer StopStatus() const;
-
- protected:
- Standard_EXPORT
- virtual void Init() ;
-
- Standard_EXPORT
- virtual void Clear() ;
-
- Standard_EXPORT
- virtual void PreparePaveBlocks(const Standard_Integer nE) ;
-
- Standard_EXPORT
- virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2) ;
-
-
- Standard_Integer myStopStatus;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_CheckerSI.cxx
-// Created: Mon Feb 19 11:32:08 2007
-// Author: Peter KURNEV
-//
-#include <NMTTools_CheckerSI.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_IteratorCheckerSI.hxx>
-
-#include <NMTDS_InterfPool.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_PaveBlockIterator.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <IntTools_Range.hxx>
-#include <BOPTools_Pave.hxx>
-#include <IntTools_ShrunkRange.hxx>
-#include <BOPTColStd_Failure.hxx>
-#include <BOPTColStd_Dump.hxx>
-#include <Geom_Curve.hxx>
-#include <gp_Pnt.hxx>
-
-//=======================================================================
-// function: PreparePaveBlocks
-// purpose:
-//=======================================================================
- void NMTTools_CheckerSI::PreparePaveBlocks(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2)
-{
- NMTTools_PaveFiller::PreparePaveBlocks(aType1, aType2);
-}
-//=======================================================================
-// function: PreparePaveBlocks
-// purpose:
-//=======================================================================
- void NMTTools_CheckerSI::PreparePaveBlocks(const Standard_Integer nE)
-{
- //Standard_Boolean bIsValid;
- Standard_Integer nV1, nV2, iErr;
- Standard_Real aT1, aT2;
- TopoDS_Edge aE;
- TopoDS_Vertex aV1, aV2;
- //
- myIsDone=Standard_False;
- //
- BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
- // Edge
- aE=TopoDS::Edge(myDS->Shape(nE));
- if (BRep_Tool::Degenerated(aE)) {
- myIsDone=Standard_True;
- return;
- }
- //
- BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE));
-
- BOPTools_PaveBlockIterator aPBIt(nE, aPS);
- for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPB=aPBIt.Value();
- const IntTools_Range& aRange=aPB.Range();
- //
- const BOPTools_Pave& aPave1=aPB.Pave1();
- nV1=aPave1.Index();
- aV1=TopoDS::Vertex(myDS->Shape(nV1));
- aT1=aPave1.Param();
- //
- const BOPTools_Pave& aPave2=aPB.Pave2();
- nV2=aPave2.Index();
- aV2=TopoDS::Vertex(myDS->Shape(nV2));
- aT2=aPave2.Param();
- //
- //modified by NIZNHY-PKV Thu Nov 01 13:46:00 2012f
- //w/a: http://salome.mantis.opencascade.com/view.php?id=21835
- /*
- bIsValid=Standard_True;
- if (nV1==nV2) {
- bIsValid=IsValid(aE, aV1, aT1, aT2);
- if (!bIsValid) {
- myStopStatus=1;
- }
- }
- */
- //modified by NIZNHY-PKV Thu Nov 01 13:46:09 2012t
- //
- IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext);
- iErr=aSR.ErrorStatus();
- if (!aSR.IsDone()) {
- aSR.SetShrunkRange(aRange);
- }
- else if (iErr!=6) {
- CorrectShrunkRanges (0, aPave1, aSR);
- CorrectShrunkRanges (1, aPave2, aSR);
- }
- aPB.SetShrunkRange(aSR);
- aLPB.Append(aPB);
- } //for (; aPBIt.More(); aPBIt.Next())
- myIsDone=Standard_True;
-}
-//modified by NIZNHY-PKV Thu Nov 01 13:46:55 2012f
-//w/a: http://salome.mantis.opencascade.com/view.php?id=21835
-/*
-//=======================================================================
-//function : IsValid
-//purpose :
-//=======================================================================
-Standard_Boolean IsValid(const TopoDS_Edge& aE,
- const TopoDS_Vertex& aV,
- const Standard_Real aTV1,
- const Standard_Real aTV2)
-{
- Standard_Boolean bRet;
- Standard_Integer i, aNbP, aNbP1;
- Standard_Real aTolV2, aTC1, aTC2, dT, aTC, aD2;
- Handle(Geom_Curve) aC;
- gp_Pnt aPV, aPC;
- //
- bRet=Standard_False;
- aTolV2=BRep_Tool::Tolerance(aV);
- aTolV2=aTolV2*aTolV2;
- aPV=BRep_Tool::Pnt(aV);
- aC=BRep_Tool::Curve(aE, aTC1, aTC2);
- aNbP=7;
- aNbP1=aNbP-1;
- dT=(aTV2-aTV1)/aNbP1;
- //
- for (i=1; i<aNbP-1 && !bRet ; ++i) {
- aTC=aTV1+dT*i;
- aC->D0(aTC, aPC);
- aD2=aPV.SquareDistance(aPC);
- bRet=aD2>aTolV2;
- }
- return bRet;
-}
-*/
-//modified by NIZNHY-PKV Thu Nov 01 13:47:07 2012t
+++ /dev/null
-// Copyright (C) 2007-2013 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_CommonBlock.cxx
-// Created: Tue Dec 9 12:23:29 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_CommonBlock.hxx>
-
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-//=======================================================================
-// function: NMTTools_CommonBlock::NMTTools_CommonBlock()
-// purpose:
-//=======================================================================
- NMTTools_CommonBlock::NMTTools_CommonBlock()
-{
-}
-//=======================================================================
-// function: AddPaveBlock
-// purpose:
-//=======================================================================
- void NMTTools_CommonBlock::AddPaveBlock(const BOPTools_PaveBlock& aPB)
-{
- myPaveBlocks.Append(aPB);
-}
-//=======================================================================
-// function: AddFace
-// purpose:
-//=======================================================================
- void NMTTools_CommonBlock::AddFace(const Standard_Integer aF)
-{
- myFaces.Append(aF);
-}
-//=======================================================================
-// function: AddFaces
-// purpose:
-//=======================================================================
- void NMTTools_CommonBlock::AddFaces(const TColStd_ListOfInteger& aLF)
-{
- TColStd_ListIteratorOfListOfInteger aIt(aLF);
- //
- for (; aIt.More(); aIt.Next()) {
- myFaces.Append(aIt.Value());
- }
-}
-//=======================================================================
-// function: PaveBlocks
-// purpose:
-//=======================================================================
- const BOPTools_ListOfPaveBlock& NMTTools_CommonBlock::PaveBlocks()const
-{
- return myPaveBlocks;
-}
-//=======================================================================
-// function: Faces
-// purpose:
-//=======================================================================
- const TColStd_ListOfInteger& NMTTools_CommonBlock::Faces()const
-{
- return myFaces;
-}
-//=======================================================================
-// function: PaveBlock1
-// purpose:
-//=======================================================================
- const BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1()const
-{
- return myPaveBlocks.First();
-}
-//=======================================================================
-// function: PaveBlock1
-// purpose:
-//=======================================================================
- BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1(const Standard_Integer aIx)
-{
- return PaveBlockOnEdge(aIx);
-}
-//=======================================================================
-// function: PaveBlockOnEdge
-// purpose:
-//=======================================================================
- BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx)
-{
- static BOPTools_PaveBlock aPBs;
- Standard_Integer aIOr;
- BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
- //
- for (; anIt.More(); anIt.Next()) {
- BOPTools_PaveBlock& aPB=anIt.Value();
- aIOr=aPB.OriginalEdge();
- if (aIOr==aIx){
- return aPB;
- }
- }
- return aPBs;
-}
-//=======================================================================
-// function: IsPaveBlockOnFace
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const
-{
- Standard_Boolean bFound=Standard_False;
- Standard_Integer nF;
- TColStd_ListIteratorOfListOfInteger anIt(myFaces);
- //
- for (; anIt.More(); anIt.Next()) {
- nF=anIt.Value();
- if (nF==aIx){
- return !bFound;
- }
- }
- return bFound;
-}
-//=======================================================================
-// function: IsPaveBlockOnEdge
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const
-{
- Standard_Boolean bFound=Standard_False;
- Standard_Integer aIOr;
- BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks);
- //
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB=anIt.Value();
- aIOr=aPB.OriginalEdge();
- if (aIOr==aIx){
- return !bFound;
- }
- }
- return bFound;
-}
-//=======================================================================
-// function: IsEqual
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_CommonBlock::IsEqual(const NMTTools_CommonBlock& aOther)const
-{
- Standard_Boolean bFound=Standard_True;
- Standard_Integer aNb1, aNb2;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- aNb1=myPaveBlocks.Extent();
- aNb2=aOther.myPaveBlocks.Extent();
- //
- if (!aNb1 && !aNb2) {
- return bFound;
- }
- if (!aNb1) {
- return !bFound;
- }
- if (!aNb2) {
- return !bFound;
- }
- //
- const BOPTools_PaveBlock& aPB=PaveBlock1();
- //
- anIt.Initialize(aOther.myPaveBlocks);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPBOther=anIt.Value();
- if (aPB.IsEqual(aPBOther)){
- return bFound;
- }
- }
- return !bFound;
-}
-//=======================================================================
-// function: Contains
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_CommonBlock::Contains(const BOPTools_PaveBlock& aPBx)const
-{
- Standard_Boolean bFound=Standard_False;
- Standard_Integer aNb1;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- aNb1=myPaveBlocks.Extent();
- //
- if (!aNb1) {
- return bFound;
- }
- //
- anIt.Initialize(myPaveBlocks);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB=anIt.Value();
- if (aPB.IsEqual(aPBx)) {
- return !bFound;
- }
- }
- return bFound;
-}
-/*
-//=======================================================================
-// function: SetEdge
-// purpose:
-//=======================================================================
- void NMTTools_CommonBlock::SetEdge(const Standard_Integer anEdge)
-{
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- anIt.Initialize(myPaveBlocks);
- for (; anIt.More(); anIt.Next()) {
- BOPTools_PaveBlock& aPB=anIt.Value();
- aPB.SetEdge(anEdge);
- }
-}
-//=======================================================================
-// function: Edge
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_CommonBlock::Edge()const
-{
- Standard_Integer aNb;
- //
- aNb=myPaveBlocks.Extent();
- //
- if (!aNb) {
- return aNb;
- }
- //
- const BOPTools_PaveBlock& aPB=PaveBlock1();
- aNb=aPB.Edge();
- return aNb;
-}
-*/
+++ /dev/null
-// Copyright (C) 2007-2013 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_CommonBlock.hxx
-// Created: Tue Dec 9 12:23:29 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-
-#ifndef _NMTTools_CommonBlock_HeaderFile
-#define _NMTTools_CommonBlock_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <BOPTools_PaveBlock.hxx>
-
-
-//=======================================================================
-//function : NMTTools_CommonBlock
-//purpose :
-//=======================================================================
-class NMTTools_CommonBlock {
- public:
- Standard_EXPORT
- NMTTools_CommonBlock();
-
- Standard_EXPORT
- void AddPaveBlock(const BOPTools_PaveBlock& aPB) ;
-
- Standard_EXPORT
- void AddFace(const Standard_Integer aF) ;
-
- Standard_EXPORT
- void AddFaces(const TColStd_ListOfInteger& aLF) ;
-
- Standard_EXPORT
- const BOPTools_ListOfPaveBlock& PaveBlocks() const;
-
- Standard_EXPORT
- const TColStd_ListOfInteger& Faces() const;
-
- Standard_EXPORT
- const BOPTools_PaveBlock& PaveBlock1() const;
-
- Standard_EXPORT
- BOPTools_PaveBlock& PaveBlock1(const Standard_Integer anIx) ;
-
- Standard_EXPORT
- BOPTools_PaveBlock& PaveBlockOnEdge(const Standard_Integer anIndex) ;
-
- Standard_EXPORT
- Standard_Boolean IsPaveBlockOnFace(const Standard_Integer anIndex) const;
-
- Standard_EXPORT
- Standard_Boolean IsPaveBlockOnEdge(const Standard_Integer anIndex) const;
-
- Standard_EXPORT
- Standard_Boolean IsEqual(const NMTTools_CommonBlock& aCB) const;
-
- Standard_EXPORT
- Standard_Boolean Contains(const BOPTools_PaveBlock& aPB) const;
-
- protected:
- BOPTools_ListOfPaveBlock myPaveBlocks;
- TColStd_ListOfInteger myFaces;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_CommonBlockAPI.cxx
-// Created: Mon Dec 15 11:38:04 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_CommonBlockAPI.hxx>
-
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-
-#include <NMTTools_CommonBlock.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
-
-//=======================================================================
-// function: NMTTools_CommonBlockAPI::NMTTools_CommonBlockAPI
-// purpose:
-//=======================================================================
- NMTTools_CommonBlockAPI::NMTTools_CommonBlockAPI (const NMTTools_ListOfCommonBlock& aLCB)
-{
- myListOfCommonBlock=(void *)&aLCB;
-}
-//=======================================================================
-// function: List
-// purpose:
-//=======================================================================
- const NMTTools_ListOfCommonBlock& NMTTools_CommonBlockAPI::List () const
-{
- NMTTools_ListOfCommonBlock* pListOfCommonBlock=(NMTTools_ListOfCommonBlock*)myListOfCommonBlock;
- return *pListOfCommonBlock;
-}
-//=======================================================================
-// function: CommonPaveBlocks
-// purpose: get all CommonPaveBlocks
-//=======================================================================
- const BOPTools_ListOfPaveBlock& NMTTools_CommonBlockAPI::CommonPaveBlocks(const Standard_Integer anE) const
-{
- Standard_Integer anECurrent;
- BOPTools_ListIteratorOfListOfPaveBlock anItPB;
- //
- BOPTools_ListOfPaveBlock* pmyListOfPaveBlock=(BOPTools_ListOfPaveBlock*) &myListOfPaveBlock;
- pmyListOfPaveBlock->Clear();
-
- NMTTools_ListOfCommonBlock* pListOfCommonBlock=(NMTTools_ListOfCommonBlock*)myListOfCommonBlock;
-
- NMTTools_ListIteratorOfListOfCommonBlock anIt(*pListOfCommonBlock);
- for (; anIt.More(); anIt.Next()) {
- const NMTTools_CommonBlock& aCB=anIt.Value();
- //
- const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
- anItPB.Initialize(aLPB);
- for (; anItPB.More(); anItPB.Next()) {
- const BOPTools_PaveBlock& aPB=anItPB.Value();
- anECurrent=aPB.OriginalEdge();
- if (anECurrent==anE) {
- pmyListOfPaveBlock->Append(aPB);
- break;
- }
- }
- }
- return myListOfPaveBlock;
-}
-//=======================================================================
-// function: IsCommonBlock
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_CommonBlockAPI::IsCommonBlock(const BOPTools_PaveBlock& aPB) const
-{
- Standard_Integer anE;
- //
- anE=aPB.OriginalEdge();
- //
- CommonPaveBlocks(anE);
- //
- BOPTools_ListIteratorOfListOfPaveBlock anIt(myListOfPaveBlock);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB1=anIt.Value();
- if (aPB1.IsEqual(aPB)) {
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
-//=======================================================================
-// function: CommonBlock
-// purpose:
-//=======================================================================
- NMTTools_CommonBlock& NMTTools_CommonBlockAPI::CommonBlock(const BOPTools_PaveBlock& aPB)const
-{
- static NMTTools_CommonBlock aCBTMP;
- //
- NMTTools_ListIteratorOfListOfCommonBlock anItCB;
- BOPTools_ListIteratorOfListOfPaveBlock anItPB;
- //
- NMTTools_ListOfCommonBlock* pLCB=(NMTTools_ListOfCommonBlock*)myListOfCommonBlock;
- //
- anItCB.Initialize(*pLCB);
- for (; anItCB.More(); anItCB.Next()) {
- NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
- //
- const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
- anItPB.Initialize(aLPB);
- for (; anItPB.More(); anItPB.Next()) {
- const BOPTools_PaveBlock& aPBx=anItPB.Value();
- if (aPBx.IsEqual(aPB)) {
- return aCB;
- }
- }
- }
- return aCBTMP;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_CommonBlockAPI.hxx
-// Created: Mon Dec 15 11:38:04 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTTools_CommonBlockAPI_HeaderFile
-#define _NMTTools_CommonBlockAPI_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Address.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <NMTTools_CommonBlock.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_PaveBlock.hxx>
-
-//=======================================================================
-//class : NMTTools_CommonBlockAPI
-//purpose :
-//=======================================================================
-class NMTTools_CommonBlockAPI
-{
- public:
- Standard_EXPORT
- NMTTools_CommonBlockAPI(const NMTTools_ListOfCommonBlock& aList);
-
-//! Selector <br>
- Standard_EXPORT
- const NMTTools_ListOfCommonBlock& List() const;
-
-//! Returns all PaveBlock-s (from the list) that are <br>
-//! common for the given edge with DS-index <anE> <br>
- Standard_EXPORT
- const BOPTools_ListOfPaveBlock& CommonPaveBlocks(const Standard_Integer anE) const;
-
-//! Returns TRUE if given PaveBlock <aPB> is <br>
-//! common for the Blocks from the list <br>
- Standard_EXPORT
- Standard_Boolean IsCommonBlock(const BOPTools_PaveBlock& aPB) const;
-
- Standard_EXPORT
- NMTTools_CommonBlock& CommonBlock(const BOPTools_PaveBlock& aPB) const;
-protected:
-//private:
-
-Standard_Address myListOfCommonBlock;
-BOPTools_ListOfPaveBlock myListOfPaveBlock;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_CommonBlockPool.cxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-
-
-#include <NMTTools_CommonBlockPool.hxx>
-
-#ifndef _Standard_OutOfRange_HeaderFile
-#include <Standard_OutOfRange.hxx>
-#endif
-#ifndef _Standard_OutOfMemory_HeaderFile
-#include <Standard_OutOfMemory.hxx>
-#endif
-
-
-#define Array1Item NMTTools_ListOfCommonBlock
-#define Array1Item_hxx <NMTTools_ListOfCommonBlock.hxx>
-#define BOPTColStd_CArray1 NMTTools_CommonBlockPool
-#define BOPTColStd_CArray1_hxx <NMTTools_CommonBlockPool.hxx>
-#include <BOPTColStd_CArray1.gxx>
-
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_CommonBlockPool.hxx
-// Created:
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-
-#ifndef _NMTTools_CommonBlockPool_HeaderFile
-#define _NMTTools_CommonBlockPool_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Address.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-
-class Standard_OutOfRange;
-class Standard_OutOfMemory;
-
-
-
-//=======================================================================
-//class : NMTTools_CommonBlockPool
-//purpose :
-//=======================================================================
-class NMTTools_CommonBlockPool
-{
- public:
- Standard_EXPORT
- NMTTools_CommonBlockPool(const Standard_Integer Length = 0,const Standard_Integer BlockLength = 5);
-
- Standard_EXPORT
- void Resize(const Standard_Integer theNewLength) ;
-
- Standard_EXPORT
- void Destroy() ;
-
- ~NMTTools_CommonBlockPool() {
- Destroy();
- }
-
- Standard_EXPORT
- Standard_Integer Length() const;
-
- Standard_EXPORT
- Standard_Integer Extent() const;
-
- Standard_EXPORT
- Standard_Integer FactLength() const;
-
- Standard_EXPORT
- Standard_Integer Append(const NMTTools_ListOfCommonBlock& Value) ;
-
- Standard_EXPORT
- void Remove(const Standard_Integer Index) ;
-
- Standard_EXPORT
- const NMTTools_ListOfCommonBlock& Value(const Standard_Integer Index) const;
-
- const NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) const {
- return Value(Index);
- }
-
- Standard_EXPORT
- NMTTools_ListOfCommonBlock& ChangeValue(const Standard_Integer Index) ;
-
- NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) {
- return ChangeValue(Index);
- }
-
- Standard_EXPORT
- void SetBlockLength(const Standard_Integer aBL) ;
-
- Standard_EXPORT
- Standard_Integer BlockLength() const;
-
- Standard_EXPORT
- void Purge() ;
-
-protected:
-
-private:
- Standard_EXPORT
- NMTTools_CommonBlockPool(const NMTTools_CommonBlockPool& AnArray);
-
- Standard_EXPORT
- NMTTools_CommonBlockPool& Assign(const NMTTools_CommonBlockPool& Other) ;
-
- NMTTools_CommonBlockPool& operator =(const NMTTools_CommonBlockPool& Other) {
- return Assign(Other);
- }
-
- Standard_EXPORT
- Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const;
-
-
- Standard_Address myStart;
- Standard_Integer myLength;
- Standard_Integer myFactLength;
- Standard_Integer myBlockLength;
- Standard_Boolean myIsAllocated;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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.cxx
-// Created: Wed Jan 28 15:06:11 2004
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_CoupleOfShape.hxx>
-
-//=======================================================================
-// function: NMTTools_CoupleOfShape::NMTTools_CoupleOfShape
-// purpose:
-//=======================================================================
- NMTTools_CoupleOfShape::NMTTools_CoupleOfShape()
-{}
-//=======================================================================
-// function: SetShape1
-// purpose:
-//=======================================================================
- void NMTTools_CoupleOfShape::SetShape1(const TopoDS_Shape& aS)
-{
- myShape1=aS;
-}
-//=======================================================================
-// function: SetShape2
-// purpose:
-//=======================================================================
- void NMTTools_CoupleOfShape::SetShape2(const TopoDS_Shape& aS)
-{
- myShape2=aS;
-}
-//=======================================================================
-// function: Shape1
-// purpose:
-//=======================================================================
- const TopoDS_Shape& NMTTools_CoupleOfShape::Shape1()const
-{
- return myShape1;
-}
-//=======================================================================
-// function: Shape2
-// purpose:
-//=======================================================================
- const TopoDS_Shape& NMTTools_CoupleOfShape::Shape2()const
-{
- return myShape2;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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
+++ /dev/null
-// Copyright (C) 2007-2013 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_DEProcessor.cxx
-// Created: Wed Sep 12 12:10:52 2001
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_DEProcessor.hxx>
-
-#include <Precision.hxx>
-
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-
-#include <gp_Pnt2d.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Lin2d.hxx>
-
-#include <ElCLib.hxx>
-
-#include <Geom2d_Curve.hxx>
-#include <Geom2d_Line.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
-#include <Geom2dInt_GInter.hxx>
-
-#include <IntRes2d_IntersectionPoint.hxx>
-
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Solid.hxx>
-
-#include <TopExp.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-
-#include <BRepAdaptor_Surface.hxx>
-
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-
-#include <IntTools_Tools.hxx>
-#include <IntTools_Context.hxx>
-
-#include <BOPTools_DEInfo.hxx>
-#include <BOPTools_Pave.hxx>
-#include <BOPTools_ListOfPave.hxx>
-#include <BOPTools_ListIteratorOfListOfPave.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_PaveBlockIterator.hxx>
-#include <BOPTools_SSInterference.hxx>
-#include <BOPTools_PavePool.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_Tools3D.hxx>
-#include <BOPTools_SequenceOfCurves.hxx>
-#include <BOPTools_Curve.hxx>
-#include <BOPTools_CArray1OfSSInterference.hxx>
-#include <BOPTools_SplitShapesPool.hxx>
-
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-#include <NMTTools_PaveFiller.hxx>
-
-//=======================================================================
-// function:
-// purpose:
-//=======================================================================
- NMTTools_DEProcessor::NMTTools_DEProcessor(NMTTools_PaveFiller& aPaveFiller)
-:
- myIsDone(Standard_False)
-{
- myFiller=(NMTTools_PaveFiller*) &aPaveFiller;
- myDS=myFiller->DS();
-}
-//=======================================================================
-// function: IsDone
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_DEProcessor::IsDone() const
-{
- return myIsDone;
-}
-//=======================================================================
-// function: Do
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::Do()
-{
- Standard_Integer aNbE;
- //
- myIsDone=Standard_False;
- //
- FindDegeneratedEdges();
- //
- aNbE=myDEMap.Extent();
- if (!aNbE) {
- myIsDone=!myIsDone;
- return;
- }
- //
- DoPaves();
-}
-//=======================================================================
-// function: FindDegeneratedEdges
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::FindDegeneratedEdges()
-{
- Standard_Integer i, aNb, nV, nF, nVx, ip, iRankE;
- TopoDS_Vertex aV;
- TopTools_IndexedDataMapOfShapeListOfShape aMEF;
- //
- aNb=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=aNb; ++i) {
- const TopoDS_Shape aF=myDS->Shape(i);
- if (aF.ShapeType()==TopAbs_FACE) {
- TopExp::MapShapesAndAncestors (aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
- }
- }
- //
- for (i=1; i<=aNb; ++i) {
- const TopoDS_Shape aS=myDS->Shape(i);
- if (aS.ShapeType()==TopAbs_EDGE) {
- const TopoDS_Edge& aE=TopoDS::Edge(aS);
-
- if (BRep_Tool::Degenerated(aE)) {
- iRankE=myDS->Rank(i);
- aV=TopExp::FirstVertex(aE);
- nVx=myDS->ShapeIndex(aV, iRankE);
- //
- nV=nVx;
- ip=myFiller->FindSDVertex(nV);
- if (ip) {
- nV=ip;
- }
- //
- TColStd_ListOfInteger aLFn;
- const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE);
- TopTools_ListIteratorOfListOfShape anIt(aLF);
- for (; anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aF=anIt.Value();
- nF=myDS->ShapeIndex(aF, iRankE);
- aLFn.Append(nF);
- }
- BOPTools_DEInfo aDEInfo;
- aDEInfo.SetVertex(nV);
- aDEInfo.SetFaces(aLFn);
-
- myDEMap.Add (i, aDEInfo);
- }
- }
- }
-}
-//=======================================================================
-// function: DoPaves
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::DoPaves()
-{
-
- Standard_Integer i, aNbE, nED, nVD, aNbLPB, nFD;
- //
- nFD=0;
- aNbE=myDEMap.Extent();
- for (i=1; i<=aNbE; ++i) {
- nED=myDEMap.FindKey(i);
- //
- const BOPTools_DEInfo& aDEInfo=myDEMap(i);
- nVD=aDEInfo.Vertex();
- //
- // Fill PaveSet for the edge nED
- const TColStd_ListOfInteger& nLF=aDEInfo.Faces();
- TColStd_ListIteratorOfListOfInteger anIt(nLF);
- for (; anIt.More(); anIt.Next()) {
- nFD=anIt.Value();
-
- BOPTools_ListOfPaveBlock aLPB;
- FindPaveBlocks(nED, nVD, nFD, aLPB);
- //
- aNbLPB=aLPB.Extent();
- if (!aNbLPB) {
- continue;
- }
- //
- FillPaveSet (nED, nVD, nFD, aLPB);
- }
- //
- // Fill aSplitEdges for the edge nED
- FillSplitEdgesPool(nED);
- //
- // MakeSplitEdges
- MakeSplitEdges(nED, nFD);
- //
- }// next nED
-}
-//=======================================================================
-// function: FindPaveBlocks
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::FindPaveBlocks(const Standard_Integer ,
- const Standard_Integer nVD,
- const Standard_Integer nFD,
- BOPTools_ListOfPaveBlock& aLPBOut)
-{
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- Standard_Integer i, aNb, nF2, nV;
- //
- BOPTools_CArray1OfSSInterference& aFFs=(myFiller->IP())->SSInterferences();
- //
- aNb=aFFs.Extent();
- for (i=1; i<=aNb; ++i) {
- BOPTools_SSInterference& aFF=aFFs(i);
- //
- nF2=aFF.OppositeIndex(nFD);
- if (!nF2) {
- continue;
- }
- //
- // Split Parts
- const BOPTools_ListOfPaveBlock& aLPBSplits=aFF.PaveBlocks();
- anIt.Initialize(aLPBSplits);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPBSp=anIt.Value();
- //
- const BOPTools_Pave& aPave1=aPBSp.Pave1();
- nV=aPave1.Index();
- if (nV==nVD) {
- aLPBOut.Append(aPBSp);
- continue;
- }
- //
- const BOPTools_Pave& aPave2=aPBSp.Pave2();
- nV=aPave2.Index();
- if (nV==nVD) {
- aLPBOut.Append(aPBSp);
- continue;
- }
- }
- //
- // Section Parts
- Standard_Integer j, aNbCurves;
- //
- BOPTools_SequenceOfCurves& aSC=aFF.Curves();
- aNbCurves=aSC.Length();
- for (j=1; j<=aNbCurves; ++j) {
- const BOPTools_Curve& aBC=aSC(j);
- const BOPTools_ListOfPaveBlock& aLPBSe=aBC.NewPaveBlocks();
- //
- anIt.Initialize(aLPBSe);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPBSe=anIt.Value();
- //
- const BOPTools_Pave& aPv1=aPBSe.Pave1();
- nV=aPv1.Index();
- if (nV==nVD) {
- aLPBOut.Append(aPBSe);
- continue;
- }
- //
- const BOPTools_Pave& aPv2=aPBSe.Pave2();
- nV=aPv2.Index();
- if (nV==nVD) {
- aLPBOut.Append(aPBSe);
- continue;
- }
- }
- }
- }
-}
-//=======================================================================
-// function: FillPaveSet
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::FillPaveSet (const Standard_Integer nED,
- const Standard_Integer nVD,
- const Standard_Integer nFD,
- const BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Boolean bIsDone, bXDir, bRejectFlag;
- Standard_Integer nE, aNbPoints, j;
- Standard_Real aTD1, aTD2, aT1, aT2, aTolInter, aX, aDT, aXx;
- gp_Pnt2d aP2d1, aP2d2, aP2D;
- gp_Lin2d aLDE;
- //
- aDT=Precision::PConfusion();
- //
- BOPTools_PaveSet& aPaveSet=
- (myFiller->ChangePavePool()).ChangeValue(myDS->RefEdge(nED));
- //
- // Clear aPaveSet, aSplitEdges
- aPaveSet.ChangeSet().Clear();
- //
- const TopoDS_Edge aDE=TopoDS::Edge(myDS->Shape(nED));
- const TopoDS_Face aDF=TopoDS::Face(myDS->Shape(nFD));
- //
- // 2D Curve of degenerated edge on the face aDF
- Handle(Geom2d_Curve) aC2DDE1=BRep_Tool::CurveOnSurface(aDE, aDF, aTD1, aTD2);
- Handle(Geom2d_TrimmedCurve)aC2DDE=new Geom2d_TrimmedCurve(aC2DDE1, aTD1, aTD2);
- //
- // Choose direction for degenerated edge
- aC2DDE->D0(aTD1, aP2d1);
- aC2DDE->D0(aTD2, aP2d2);
-
- bXDir=Standard_False;
- if (fabs(aP2d1.Y()-aP2d2.Y()) < aDT){
- bXDir=!bXDir;
- }
- //
- // Prepare bounding Paves
- BOPTools_Pave aPave1 (nVD, aTD1, BooleanOperations_UnknownInterference);
- aPaveSet.Append(aPave1);
- BOPTools_Pave aPave2 (nVD, aTD2, BooleanOperations_UnknownInterference);
- aPaveSet.Append(aPave2);
- //
- // Fill other paves
- BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB=anIt.Value();
- nE=aPB.Edge();
- const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
-
- Handle(Geom2d_Curve) aC2D=BRep_Tool::CurveOnSurface(aE, aDF, aT1, aT2);
- //
- // Intersection
- Geom2dAdaptor_Curve aGAC1, aGAC2;
- //
- aGAC1.Load(aC2DDE, aTD1, aTD2);
- Handle(Geom2d_Line) aL2D= Handle(Geom2d_Line)::DownCast(aC2D);
- if (!aL2D.IsNull()) {
- aGAC2.Load(aC2D);
- }
- else {
- aGAC2.Load(aC2D, aT1, aT2);
- }
- //
- aTolInter=0.001;
- Geom2dInt_GInter aGInter(aGAC1, aGAC2, aTolInter, aTolInter);
- bIsDone=aGInter.IsDone();
- if(bIsDone) {
- aNbPoints=aGInter.NbPoints();
- if (aNbPoints) {
- for (j=1; j<=aNbPoints; ++j) {
- aP2D=aGInter.Point(j).Value();
- Handle(Geom2d_Line) aCLDE;
- //
- //modified by NIZNHY-PKV Thu Mar 20 17:37:32 2008f
- Handle(Geom2d_TrimmedCurve) aCLDET1=
- Handle(Geom2d_TrimmedCurve)::DownCast(aC2DDE1);
- if (aCLDET1.IsNull()) {
- aCLDE=Handle(Geom2d_Line)::DownCast(aC2DDE1);
- }
- else {
- Handle(Geom2d_Curve) aBasisCurve=aCLDET1->BasisCurve();
- aCLDE=Handle(Geom2d_Line)::DownCast(aBasisCurve);
- }
- //aCLDE=Handle(Geom2d_Line)::DownCast(aC2DDE1);
- //modified by NIZNHY-PKV Thu Mar 20 17:37:37 2008t
-
- if (aCLDE.IsNull()) {
- continue;
- }
-
- aLDE=aCLDE->Lin2d();
- aX=ElCLib::Parameter(aLDE, aP2D);
- //
- if (fabs (aX-aTD1) < aDT || fabs (aX-aTD2) < aDT) {
- continue;
- }
- if (aX < aTD1 || aX > aTD2) {
- continue;
- }
- //
- bRejectFlag=Standard_False;
- const BOPTools_ListOfPave& aListOfPave=aPaveSet.Set();
- BOPTools_ListIteratorOfListOfPave aPaveIt(aListOfPave);
- for (; aPaveIt.More(); aPaveIt.Next()) {
- const BOPTools_Pave& aPavex=aPaveIt.Value();
- aXx=aPavex.Param();
- if (fabs (aX-aXx) < aDT) {
- bRejectFlag=Standard_True;
- break;
- }
- }
- if (bRejectFlag) {
- continue;
- }
- //
- BOPTools_Pave aPave(nVD, aX, BooleanOperations_UnknownInterference);
- aPaveSet.Append(aPave);
- }
- }
- }
- }
-}
-//=======================================================================
-// function: FillSplitEdgesPool
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::FillSplitEdgesPool (const Standard_Integer nED)
-{
- BOPTools_SplitShapesPool& aSplitShapesPool=
- myFiller->ChangeSplitShapesPool();
- BOPTools_ListOfPaveBlock& aSplitEdges=
- aSplitShapesPool.ChangeValue(myDS->RefEdge(nED));
- //
- aSplitEdges.Clear();
- //
- const BOPTools_PavePool& aPavePool=myFiller->PavePool();
- BOPTools_PavePool* pPavePool=(BOPTools_PavePool*) &aPavePool;
- BOPTools_PaveSet& aPaveSet= pPavePool->ChangeValue(myDS->RefEdge(nED));
-
- BOPTools_PaveBlockIterator aPBIt(nED, aPaveSet);
- for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPB=aPBIt.Value();
- aSplitEdges.Append(aPB);
- }
-}
-//=======================================================================
-// function: MakeSplitEdges
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::MakeSplitEdges (const Standard_Integer nED,
- const Standard_Integer nFD)
-{
- const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool();
- const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nED));
-
- Standard_Integer nV1, nV2, aNbPB, aNewShapeIndex;
- Standard_Real t1, t2;
- TopoDS_Edge aE, aESplit;
- TopoDS_Vertex aV1, aV2;
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
- //
- const TopoDS_Edge aDE=TopoDS::Edge(myDS->Shape(nED));
- const TopoDS_Face aDF=TopoDS::Face(myDS->Shape(nFD));
- //
- //modified by NIZNHY-PKV Wed Oct 20 13:20:37 2010f
- aNbPB=aSplitEdges.Extent();
- if (aNbPB==1) {
- Standard_Real aT1, aT2, dT1, dT2, aDT;
- Handle(Geom2d_Curve) aC2D;
- //
- BOPTools_PaveBlock& aPB=aSplitEdges.First();
- //
- const BOPTools_Pave& aPave1=aPB.Pave1();
- t1=aPave1.Param();
- const BOPTools_Pave& aPave2=aPB.Pave2();
- t2=aPave2.Param();
- ////
- nV1=aPave1.Index();
- aV1=*((TopoDS_Vertex*)&myDS->GetShape(nV1));
- //
- aV2=TopExp::FirstVertex(aDE);
- if (aV2.IsSame(aV1)) {
- aC2D=BRep_Tool::CurveOnSurface(aDE, aDF, aT1, aT2);
- dT1=aT1-t1;
- if (dT1<0.) {
- dT1=-dT1;
- }
- //
- dT2=aT2-t2;
- if (dT2<0.) {
- dT2=-dT2;
- }
- aDT=Precision::PConfusion();
- if(dT1<aDT && dT2<aDT) {
- BOPTools_ListOfPaveBlock* pLPB=(BOPTools_ListOfPaveBlock*)&aSplitEdges;
- pLPB->Clear();
- return;
- }
- }
- }
- //modified by NIZNHY-PKV Wed Oct 20 13:20:39 2010t
- //
- aPBIt.Initialize(aSplitEdges);
- for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPB=aPBIt.Value();
-
- const BOPTools_Pave& aPave1=aPB.Pave1();
- nV1=aPave1.Index();
- t1=aPave1.Param();
- aV1=TopoDS::Vertex(myDS->GetShape(nV1));
- aV1.Orientation(TopAbs_FORWARD);
-
- const BOPTools_Pave& aPave2=aPB.Pave2();
- nV2=aPave2.Index();
- t2=aPave2.Param();
- aV2=TopoDS::Vertex(myDS->GetShape(nV2));
- aV2.Orientation(TopAbs_REVERSED);
-
- MakeSplitEdge(aDE, aDF, aV1, t1, aV2, t2, aESplit);
- //
- // Add Split Part of the Original Edge to the DS
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
-
- anASSeq.SetNewSuccessor(nV1);
- anASSeq.SetNewOrientation(aV1.Orientation());
-
- anASSeq.SetNewSuccessor(nV2);
- anASSeq.SetNewOrientation(aV2.Orientation());
-
- myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
- aNewShapeIndex=myDS->NumberOfInsertedShapes();
- myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
- //
- // Fill Split Set for the Original Edge
- aPB.SetEdge(aNewShapeIndex);
- //
- }
-}
-//=======================================================================
-// function: MakeSplitEdge
-// purpose:
-//=======================================================================
- void NMTTools_DEProcessor::MakeSplitEdge (const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const TopoDS_Vertex& aV1,
- const Standard_Real aP1,
- const TopoDS_Vertex& aV2,
- const Standard_Real aP2,
- TopoDS_Edge& aNewEdge)
-{
- Standard_Real aTol=1.e-7;
-
- TopoDS_Edge E=aE;
-
- E.EmptyCopy();
- BRep_Builder BB;
- BB.Add (E, aV1);
- BB.Add (E, aV2);
-
- BB.Range(E, aF, aP1, aP2);
-
- BB.Degenerated(E, Standard_True);
-
- BB.UpdateEdge(E, aTol);
- aNewEdge=E;
-}
-
+++ /dev/null
-// Copyright (C) 2007-2013 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_DEProcessor.hxx
-// Created: Wed Sep 12 12:10:52 2001
-// Author: Peter KURNEV
-// <pkv@irinox>
-
-#ifndef _NMTTools_DEProcessor_HeaderFile
-#define _NMTTools_DEProcessor_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <NMTTools_PPaveFiller.hxx>
-#include <NMTDS_PShapesDataStructure.hxx>
-#include <Standard_Boolean.hxx>
-#include <BOPTools_IndexedDataMapOfIntegerDEInfo.hxx>
-#include <NMTTools_PaveFiller.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Real.hxx>
-
-
-//! <br>
-//! The Algorithm to compute and store in interferences' pool <br>
-//! and in the Data Structure the following values <br>
-//! for degenerated edges <br>
-//! 1. Paves/Pave set(s) <br>
-//! 2. Split parts <br>
-//! 3. States (3D) for split parts <br>
-//! <br>
-//=======================================================================
-//class : NMTTools_DEProcessor
-//purpose :
-//=======================================================================
-class NMTTools_DEProcessor {
-public:
-
-
-
-//! Constructor <br>
-//! <br>
-//! Constructor <br>
-//! <br>
- Standard_EXPORT
- NMTTools_DEProcessor(NMTTools_PaveFiller& aFiller);
-
-//! Launches the processor <br>
- Standard_EXPORT
- void Do() ;
-
-//! Returns TRUE if it is Ok <br>
- Standard_EXPORT
- Standard_Boolean IsDone() const;
-
-
-
-protected:
- Standard_EXPORT
- void FindDegeneratedEdges() ;
-
- Standard_EXPORT
- void DoPaves() ;
-
- Standard_EXPORT
- void FindPaveBlocks(const Standard_Integer nED,
- const Standard_Integer nVD,
- const Standard_Integer nFD,
- BOPTools_ListOfPaveBlock& aLPB) ;
-
- Standard_EXPORT
- void FillPaveSet(const Standard_Integer nED,
- const Standard_Integer nVD,
- const Standard_Integer nFD,
- const BOPTools_ListOfPaveBlock& aLPB) ;
-
- Standard_EXPORT
- void FillSplitEdgesPool(const Standard_Integer nED) ;
-
- Standard_EXPORT
- void MakeSplitEdges(const Standard_Integer nED,
- const Standard_Integer nFD) ;
-
- Standard_EXPORT
- void MakeSplitEdge(const TopoDS_Edge& aS1,
- const TopoDS_Face& aF,
- const TopoDS_Vertex& aV1,
- const Standard_Real aP1,
- const TopoDS_Vertex& aV2,
- const Standard_Real aP2,
- TopoDS_Edge& aNewEdge) ;
-
-
- NMTTools_PPaveFiller myFiller;
- NMTDS_PShapesDataStructure myDS;
- Standard_Boolean myIsDone;
- BOPTools_IndexedDataMapOfIntegerDEInfo myDEMap;
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx
-// Created: Mon Feb 20 12:24:47 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo_HeaderFile
-#define NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo_HeaderFile
-
-#ifndef NMTTools_DataMapOfIntegerFaceInfo_HeaderFile
-#include <NMTTools_DataMapOfIntegerFaceInfo.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx
-// Created: Mon Feb 20 12:04:52 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile
-#define NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile
-
-#ifndef NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile
-#include <NMTTools_DataMapOfIntegerListOfPaveBlock.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_DataMapOfIntegerFaceInfo.hxx
-// Created: Mon Feb 20 12:21:55 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_DataMapOfIntegerFaceInfo_HeaderFile
-#define NMTTools_DataMapOfIntegerFaceInfo_HeaderFile
-
-#include <NMTTools_FaceInfo.hxx>
-#include <TColStd_MapIntegerHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<Standard_Integer, NMTTools_FaceInfo, TColStd_MapIntegerHasher> NMTTools_DataMapOfIntegerFaceInfo;
-typedef NMTTools_DataMapOfIntegerFaceInfo::Iterator NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo;
-
-#undef _NCollection_MapHasher
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_DataMapOfIntegerListOfPaveBlock.hxx
-// Created: Mon Feb 20 09:27:40 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile
-#define NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile
-
-
-#include <TColStd_MapIntegerHasher.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<Standard_Integer, BOPTools_ListOfPaveBlock, TColStd_MapIntegerHasher> NMTTools_DataMapOfIntegerListOfPaveBlock;
-typedef NMTTools_DataMapOfIntegerListOfPaveBlock::Iterator NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock;
-
-#undef _NCollection_MapHasher
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_FaceInfo.cxx
-// Created: Tue Dec 9 12:23:29 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_FaceInfo.hxx>
+++ /dev/null
-// Copyright (C) 2007-2013 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_FaceInfo.hxx
-// Created: Tue Dec 9 12:23:29 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTTools_FaceInfo_HeaderFile
-#define _NMTTools_FaceInfo_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Integer.hxx>
-#include <NMTTools_MapOfPaveBlock.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <NMTTools_MapOfPaveBlock.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-//=======================================================================
-//class : NMTTools_FaceInfo
-//purpose :
-//=======================================================================
-class NMTTools_FaceInfo {
- public:
-
- //! Empty contructor <br>
- //! <br>
- NMTTools_FaceInfo();
-
- virtual ~NMTTools_FaceInfo();
-
- //! Clears the contents <br>
- Standard_EXPORT void Clear() ;
-
- //! Modifier <br>
- //! Sets the index of the face <theI> <br>
- void SetIndex(const Standard_Integer theI) ;
-
- //! Selector <br>
- //! Returns the index of the face <br>
- //! <br>
- //! In <br>
- //! <br>
- Standard_Integer Index() const;
-
- //! Selector <br>
- //! Returns the pave blocks of the face <br>
- //! that have state In <br>
- const NMTTools_MapOfPaveBlock& PaveBlocksIn() const;
-
-//! Selector/Modifier <br>
- //! Returns the pave blocks <br>
- //! of the face <br>
- //! that have state In <br>
- NMTTools_MapOfPaveBlock& ChangePaveBlocksIn() ;
-
- //! Selector <br>
- //! Returns the list of indices for vertices <br>
- //! of the face <br>
- //! that have state In <br>
- const TColStd_MapOfInteger& VerticesIn() const;
-
- //! Selector/Modifier <br>
- //! Returns the list of indices for vertices <br>
- //! of the face <br>
- //! that have state In <br>
- //! <br>
- //! On <br>
- //! <br>
- TColStd_MapOfInteger& ChangeVerticesIn() ;
-
- //! Selector <br>
- //! Returns the pave blocks of the face <br>
- //! that have state On <br>
- const NMTTools_MapOfPaveBlock& PaveBlocksOn() const;
-
- //! Selector/Modifier <br>
- //! Returns the pave blocks <br>
- //! of the face <br>
- //! that have state On <br>
- NMTTools_MapOfPaveBlock& ChangePaveBlocksOn() ;
-
- //! Selector <br>
- //! Returns the list of indices for vertices <br>
- //! of the face <br>
- //! that have state On <br>
- const TColStd_MapOfInteger& VerticesOn() const;
-
- //! Selector/Modifier <br>
- //! Returns the list of indices for vertices <br>
- //! of the face <br>
- //! that have state On <br>
- TColStd_MapOfInteger& ChangeVerticesOn() ;
-
- protected:
- Standard_Integer myIndex;
- NMTTools_MapOfPaveBlock myPaveBlocksIn;
- TColStd_MapOfInteger myVerticesIn;
- NMTTools_MapOfPaveBlock myPaveBlocksOn;
- TColStd_MapOfInteger myVerticesOn;
-};
-
-#include <NMTTools_FaceInfo.lxx>
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_FaceInfo.lxx
-// Created: Tue Dec 9 12:23:29 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-inline NMTTools_FaceInfo::NMTTools_FaceInfo()
-:
- myIndex(-1)
-{
-}
-//=======================================================================
-//function : ~
-//purpose :
-//=======================================================================
-inline NMTTools_FaceInfo::~NMTTools_FaceInfo()
-{
- Clear();
-}
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-inline void NMTTools_FaceInfo::Clear()
-{
- myIndex=-1;
- myPaveBlocksIn.Clear();
- myVerticesIn.Clear();
- myPaveBlocksOn.Clear();
- myVerticesOn.Clear();
-}
-//=======================================================================
-//function : SetIndex
-//purpose :
-//=======================================================================
- inline void NMTTools_FaceInfo::SetIndex(const Standard_Integer theI)
-{
- myIndex=theI;
-}
-//=======================================================================
-//function : Index
-//purpose :
-//=======================================================================
- inline Standard_Integer NMTTools_FaceInfo::Index()const
-{
- return myIndex;
-}
-//=======================================================================
-//function : PaveBlockIn
-//purpose :
-//=======================================================================
- inline const NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::PaveBlocksIn()const
-{
- return myPaveBlocksIn;
-}
-//=======================================================================
-//function : ChangePaveBlocksIn
-//purpose :
-//=======================================================================
- inline NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::ChangePaveBlocksIn()
-{
- return myPaveBlocksIn;
-}
-//=======================================================================
-//function : VerticesIn
-//purpose :
-//=======================================================================
- inline const TColStd_MapOfInteger& NMTTools_FaceInfo::VerticesIn()const
-{
- return myVerticesIn;
-}
-//=======================================================================
-//function : ChangeVerticesIn
-//purpose :
-//=======================================================================
- inline TColStd_MapOfInteger& NMTTools_FaceInfo::ChangeVerticesIn()
-{
- return myVerticesIn;
-}
-//=======================================================================
-//function : PaveBlockOn
-//purpose :
-//=======================================================================
- inline const NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::PaveBlocksOn()const
-{
- return myPaveBlocksOn;
-}
-//=======================================================================
-//function : ChangePaveBlocksOn
-//purpose :
-//=======================================================================
- inline NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::ChangePaveBlocksOn()
-{
- return myPaveBlocksOn;
-}
-//=======================================================================
-//function : VerticesOn
-//purpose :
-//=======================================================================
- inline const TColStd_MapOfInteger& NMTTools_FaceInfo::VerticesOn()const
-{
- return myVerticesOn;
-}
-//=======================================================================
-//function : ChangeVerticesOn
-//purpose :
-//=======================================================================
- inline TColStd_MapOfInteger& NMTTools_FaceInfo::ChangeVerticesOn()
-{
- return myVerticesOn;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx
-// Created: Mon Feb 20 09:20:07 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile
-#define NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile
-
-
-#include <Standard_Integer.hxx>
-#include <TColStd_MapIntegerHasher.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_IndexedDataMap.hxx>
-
-typedef NCollection_IndexedDataMap <Standard_Integer, TColStd_IndexedMapOfInteger, TColStd_MapIntegerHasher> NMTTools_IndexedDataMapOfIndexedMapOfInteger;
-
-#undef _NCollection_MapHasher
-
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx
-// Created: Mon Feb 20 09:20:07 2012
-// Author:
-// <pkv@BDEURI37616>
-// File: NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx
-// Created: Mon Feb 20 11:59:23 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
-#define NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
-
-
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_IndexedDataMap.hxx>
-
-
-typedef NCollection_IndexedDataMap <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> NMTTools_IndexedDataMapOfShapeIndexedMapOfShape;
-
-#undef _NCollection_MapHasher
-
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_IndexedDataMapOfShapePaveBlock.hxx
-// Created: Mon Feb 20 11:55:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile
-#define NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile
-
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
-#include <BOPTools_PaveBlock.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_IndexedDataMap.hxx>
-
-typedef NCollection_IndexedDataMap <TopoDS_Shape, BOPTools_PaveBlock, TopTools_ShapeMapHasher> NMTTools_IndexedDataMapOfShapePaveBlock;
-
-#undef _NCollection_MapHasher
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfCommonBlock.hxx
-// Created: Mon Feb 20 11:25:23 2012
-// Author:
-// <pkv@BDEURI37616>
-
-#ifndef NMTDS_ListIteratorOfListOfCommonBlock_HeaderFile
-#define NMTDS_ListIteratorOfListOfCommonBlock_HeaderFile
-
-#ifndef NMTTools_ListOfCommonBlock_HeaderFile
-#include <NMTTools_ListOfCommonBlock.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTDS_ListIteratorOfListOfCoupleOfShape.hxx
-// Created: Mon Feb 20 11:25:23 2012
-// Author:
-// <pkv@BDEURI37616>
-
-#ifndef NMTDS_ListIteratorOfListOfCoupleOfShape_HeaderFile
-#define NMTDS_ListIteratorOfListOfCoupleOfShape_HeaderFile
-
-#ifndef NMTTools_ListOfCoupleOfShape_HeaderFile
-#include <NMTTools_ListOfCoupleOfShape.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_ListOfCommonBlock.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-#ifndef NMTTools_ListOfCommonBlock_HeaderFile
-#define NMTTools_ListOfCommonBlock_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <NMTTools_CommonBlock.hxx>
-
-typedef NCollection_List <NMTTools_CommonBlock> NMTTools_ListOfCommonBlock;
-typedef NMTTools_ListOfCommonBlock::Iterator NMTTools_ListIteratorOfListOfCommonBlock;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_ListOfCoupleOfShape.hxx
-// Created: Mon Feb 20 07:27:34 2012
-// Author:
-// <pkv@BDEURI37616>
-
-#ifndef NMTTools_ListOfCoupleOfShape_HeaderFile
-#define NMTTools_ListOfCoupleOfShape_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <NMTTools_CoupleOfShape.hxx>
-
-typedef NCollection_List <NMTTools_CoupleOfShape> NMTTools_ListOfCoupleOfShape;
-typedef NMTTools_ListOfCoupleOfShape::Iterator NMTTools_ListIteratorOfListOfCoupleOfShape;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_MapIteratorOfMapOfPaveBlock.hxx
-// Created: Mon Feb 20 11:47:30 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile
-#define NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile
-
-#ifndef NMTTools_MapOfPaveBlock_HeaderFile
-#include <NMTTools_MapOfPaveBlock.hxx>
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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: NMTTools_MapOfPaveBlock.hxx
-// Created: Mon Feb 20 08:19:07 2012
-// Author:
-// <pkv@BDEURI37616>
-
-
-#ifndef NMTTools_MapOfPaveBlock_HeaderFile
-#define NMTTools_MapOfPaveBlock_HeaderFile
-
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_PaveBlockMapHasher.hxx>
-
-#define _NCollection_MapHasher
-#include <NCollection_Map.hxx>
-
-typedef NCollection_Map<BOPTools_PaveBlock, BOPTools_PaveBlockMapHasher> NMTTools_MapOfPaveBlock;
-typedef NMTTools_MapOfPaveBlock::Iterator NMTTools_MapIteratorOfMapOfPaveBlock;
-
-#undef _NCollection_MapHasher
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PPaveFiller.hxx
-// Created: Tue Dec 9 12:23:29 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTTools_PPaveFiller_HeaderFile
-#define _NMTTools_PPaveFiller_HeaderFile
-
-class NMTTools_PaveFiller;
-
-typedef NMTTools_PaveFiller* NMTTools_PPaveFiller;
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller.cxx
-// Created: Fri Dec 5 14:58:54 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-//
-#include <BOPTColStd_Failure.hxx>
-#include <IntTools_Context.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTTools_DEProcessor.hxx>
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-//=======================================================================
-// function: NMTTools_PaveFiller::NMTTools_PaveFiller
-// purpose:
-//=======================================================================
- NMTTools_PaveFiller::NMTTools_PaveFiller()
-{
- myDS=NULL;
- myDSIt=NULL;
- myIsDone=Standard_False;
- myNbSources=0;
- myNbEdges=0;
- myIP=NULL;
-}
-//=======================================================================
-// function: ~
-// purpose:
-//=======================================================================
- NMTTools_PaveFiller::~NMTTools_PaveFiller()
-{
- Clear();
-}
-//=======================================================================
-// function: Clear
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::Clear()
-{
- if (myDSIt) {
- delete myDSIt;
- }
- if (myDS) {
- delete myDS;
- }
- myDSIt=NULL;
- myDS=NULL;
-
- if (myIP) {
- delete myIP;
- }
- myIP=NULL;
-}
-//=======================================================================
-// function: SetCompositeShape
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::SetCompositeShape(const TopoDS_Shape& aS)
-{
- myCompositeShape=aS;
-}
-//=======================================================================
-// function: CompositeShape
-// purpose:
-//=======================================================================
- const TopoDS_Shape& NMTTools_PaveFiller::CompositeShape()const
-{
- return myCompositeShape;
-}
-//=======================================================================
-// function: DS
-// purpose:
-//=======================================================================
- NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS()
-{
- return myDS;
-}
-//=======================================================================
-// function: DSIt
-// purpose:
-//=======================================================================
- NMTDS_PIterator NMTTools_PaveFiller::DSIt()
-{
- return myDSIt;
-}
-//=======================================================================
-// function: IP
-// purpose:
-//=======================================================================
- NMTDS_PInterfPool NMTTools_PaveFiller::IP()
-{
- return myIP;
-}
-//=======================================================================
-// function:IsDone
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_PaveFiller::IsDone() const
-{
- return myIsDone;
-}
-//=======================================================================
-// function: Context
-// purpose:
-//=======================================================================
- const Handle(IntTools_Context)& NMTTools_PaveFiller::Context() const
-{
- return myContext;
-}
-//=======================================================================
-// function: PavePool
-// purpose:
-//=======================================================================
- const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const
-{
- return myPavePool;
-}
-//=======================================================================
-// function: ChangePavePool
-// purpose:
-//=======================================================================
- BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool()
-{
- return myPavePool;
-}
-//=======================================================================
-// function: ChangePavePoolNew
-// purpose:
-//=======================================================================
- BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePoolNew()
-{
- return myPavePoolNew;
-}
-//=======================================================================
-// function: CommonBlockPool
-// purpose:
-//=======================================================================
- const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const
-{
- return myCommonBlockPool;
-}
-//=======================================================================
-// function: ChangeCommonBlockPool
-// purpose:
-//=======================================================================
- NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool()
-{
- return myCommonBlockPool;
-}
-//=======================================================================
-// function: SplitShapesPool
-// purpose:
-//=======================================================================
- const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const
-{
- return mySplitShapesPool;
-}
-//=======================================================================
-// function: ChangeSplitShapesPool
-// purpose:
-//=======================================================================
- BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool()
-{
- return mySplitShapesPool;
-}
-//=======================================================================
-// function: Init
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::Init()
-{
- myIsDone=Standard_False;
- if (myCompositeShape.IsNull()) {
- return;
- }
- //
- Clear();
- // 1.
- myDS=new NMTDS_ShapesDataStructure;
- myDS->SetCompositeShape(myCompositeShape);
- myDS->Init();
- //
- // 2.
- myDSIt=new NMTDS_Iterator;
- myDSIt->SetDS(myDS);
- myDSIt->Prepare();
- //
- // 3.
- myNbSources=myDS->NumberOfShapesOfTheObject()+
- myDS->NumberOfShapesOfTheTool();
- myNbEdges=myDS->NbEdges();
- //
- // 4
- myIP=new NMTDS_InterfPool;
- //
- // 5
- myContext=new IntTools_Context;
-}
-
-//=======================================================================
-// function: Perform
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::Perform()
-{
- myIsDone=Standard_False;
- //
- //----------------
- try {
- // 0.
- Init();
- //1.VV
- //
- PerformVV();
- //
- // 2.VE
- myPavePool.Resize (myNbEdges);
-
- PrepareEdges();
-
- PerformVE();
- //
- // 3.VF
- PerformVF();
- //
- // 4.EE
- myCommonBlockPool.Resize (myNbEdges);
- mySplitShapesPool.Resize (myNbEdges);
- myPavePoolNew .Resize (myNbEdges);
-
- PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
- PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
- //
- PerformEE();
- //
- RefinePavePool ();
- //
- myPavePoolNew.Destroy();
- myPavePoolNew.Resize (myNbEdges);
- //
- //modified by NIZNHY-PKV Mon Dec 12 09:13:53 2011f
- UpdateCommonBlocks(0);
- //modified by NIZNHY-PKV Mon Dec 12 09:13:56 2011t
- //
- // 5.EF
- PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
- PerformEF();
- //
- RefinePavePool();
- //
- myPavePoolNew.Destroy();
-
- MakeSplitEdges();
-
- UpdateCommonBlocks();
- //
- // 6. FF
- PerformFF ();
- //
- MakeBlocks();
- //
- MakePCurves();
- //
- // 7.Postprocessing
- UpdatePaveBlocks();
- //
- NMTTools_DEProcessor aDEP(*this);
- aDEP.Do();
- //
- MakeAloneVertices();
- //
- //modified by NIZNHY-PKV Mon Dec 12 09:14:23 2011f
- myIP->Purge();
- //modified by NIZNHY-PKV Mon Dec 12 09:14:27 2011t
- myIsDone=Standard_True;
- }
- catch (BOPTColStd_Failure& ) {
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller.hxx
-// Created: Fri Dec 5 14:58:54 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#ifndef _NMTTools_PaveFiller_HeaderFile
-#define _NMTTools_PaveFiller_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <NMTDS_PShapesDataStructure.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <BOPTools_PavePool.hxx>
-#include <NMTTools_CommonBlockPool.hxx>
-#include <BOPTools_SplitShapesPool.hxx>
-#include <Handle_IntTools_Context.hxx>
-#include <BOPTools_SSIntersectionAttribute.hxx>
-#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <NMTDS_PIterator.hxx>
-#include <TopoDS_Shape.hxx>
-#include <NMTDS_PInterfPool.hxx>
-#include <NMTTools_DataMapOfIntegerFaceInfo.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <NMTTools_CommonBlock.hxx>
-#include <Standard_Real.hxx>
-
-#include <TopoDS_Shape.hxx>
-#include <BOPTools_Pave.hxx>
-#include <IntTools_ShrunkRange.hxx>
-#include <BOPTools_PavePool.hxx>
-#include <NMTTools_CommonBlockPool.hxx>
-#include <BOPTools_SplitShapesPool.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <BOPTools_IDMapOfPaveBlockIMapOfPaveBlock.hxx>
-#include <BOPTools_IDMapOfPaveBlockIMapOfInteger.hxx>
-#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <TopoDS_Face.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_Curve.hxx>
-#include <BOPTools_SSInterference.hxx>
-#include <gp_Pnt.hxx>
-#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-
-
-/*
-class TopoDS_Shape;
-class BOPTools_Pave;
-class IntTools_ShrunkRange;
-class BOPTools_PavePool;
-class NMTTools_CommonBlockPool;
-class BOPTools_SplitShapesPool;
-class BOPTools_PaveBlock;
-class TopoDS_Vertex;
-class NMTTools_ListOfCommonBlock;
-class BOPTools_IDMapOfPaveBlockIMapOfPaveBlock;
-class BOPTools_IDMapOfPaveBlockIMapOfInteger;
-class BooleanOperations_IndexedDataMapOfShapeInteger;
-class TColStd_ListOfInteger;
-class BOPTools_ListOfPaveBlock;
-class TopoDS_Face;
-class BOPTools_PaveSet;
-class BOPTools_Curve;
-class BOPTools_SSInterference;
-class gp_Pnt;
-class NMTTools_IndexedDataMapOfIndexedMapOfInteger;
-class TopTools_ListOfShape;
-class TopoDS_Edge;
-class TopTools_DataMapOfShapeShape;
-class TCoLSTD_MapOfInteger;
-*/
-
-
-//=======================================================================
-//function : NMTTools_PaveFiller
-//purpose :
-//=======================================================================
-class NMTTools_PaveFiller {
- public:
- Standard_EXPORT
- NMTTools_PaveFiller();
-
- Standard_EXPORT
- virtual ~NMTTools_PaveFiller();
-
- Standard_EXPORT
- void SetCompositeShape(const TopoDS_Shape& aS) ;
-
- Standard_EXPORT
- const TopoDS_Shape& CompositeShape() const;
-
- Standard_EXPORT
- NMTDS_PShapesDataStructure DS() ;
-
- Standard_EXPORT
- NMTDS_PIterator DSIt() ;
-
- Standard_EXPORT
- NMTDS_PInterfPool IP() ;
-
- Standard_EXPORT
- virtual void Perform() ;
-
- Standard_EXPORT
- Standard_Boolean IsDone() const;
-
- Standard_EXPORT
- const Handle_IntTools_Context& Context() const;
-
- Standard_EXPORT
- const BOPTools_PavePool& PavePool() const;
-
- Standard_EXPORT
- BOPTools_PavePool& ChangePavePool() ;
-
- Standard_EXPORT
- const NMTTools_CommonBlockPool& CommonBlockPool() const;
-
- Standard_EXPORT
- NMTTools_CommonBlockPool& ChangeCommonBlockPool() ;
-
- Standard_EXPORT
- const BOPTools_SplitShapesPool& SplitShapesPool() const;
-
- Standard_EXPORT
- BOPTools_SplitShapesPool& ChangeSplitShapesPool() ;
-
- Standard_EXPORT
- Standard_Integer FindSDVertex(const Standard_Integer nV) const;
-
- Standard_EXPORT
- Standard_Integer SplitsInFace(const Standard_Integer aBid,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsInFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsOnEdge(const Standard_Integer nE1,
- const Standard_Integer nE2,
- TColStd_ListOfInteger& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsOnFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsOnFace(const Standard_Integer aBid,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsInFace(const Standard_Integer aBid,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsInFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsOnEdge(const Standard_Integer nE1,
- const Standard_Integer nE2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsOnFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsOnFace(const Standard_Integer aBid,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsFace(const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Integer SplitsFace(const Standard_Integer nF2,
- TColStd_ListOfInteger& aLs) ;
-
- Standard_EXPORT
- Standard_Integer CommonBlocksFace(const Standard_Integer nF,
- NMTTools_ListOfCommonBlock& aLCB) ;
-
- Standard_EXPORT
- void PrepareFace(const Standard_Integer nF,
- TopoDS_Face& aF) ;
-
- Standard_EXPORT
- const BOPTools_PaveBlock& RealPaveBlock(const BOPTools_PaveBlock& aPB) ;
-
- Standard_EXPORT
- const BOPTools_PaveBlock& RealPaveBlock(const BOPTools_PaveBlock& aPB,
- TColStd_ListOfInteger& aLB,
- Standard_Integer& aIsCommonBlock) ;
-
- Standard_EXPORT
- void RealSplitsFace(const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- Standard_Boolean HasRealSplitsInOnFace(const Standard_Integer nF1,
- const Standard_Integer nF2) ;
-
- Standard_EXPORT
- void RealSplitsInFace(const Standard_Integer aBid,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- void RealSplitsInFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- void RealSplitsInFace(const Standard_Integer nF1,
- BOPTools_ListOfPaveBlock& aLPB) ;
-
- Standard_EXPORT
- void RealSplitsOnEdge(const Standard_Integer nE1,
- const Standard_Integer nE2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- void RealSplitsOnFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- void RealSplitsOnFace(const Standard_Integer aBid,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLs) ;
-
- Standard_EXPORT
- void PrepareSetForFace(const Standard_Integer nF1,
- const Standard_Integer nF2,
- const BOPTools_ListOfPaveBlock& aLPB,
- BOPTools_PaveSet& aPSF) ;
-
- Standard_EXPORT
- void PutPaveOnCurve(const BOPTools_PaveSet& aPSF,
- const Standard_Real aTol,
- BOPTools_Curve& aBC) ;
-
- Standard_EXPORT
- void PutBoundPaveOnCurve(BOPTools_Curve& aBC,
- BOPTools_SSInterference& aFF) ;
-
- Standard_EXPORT
- void PutBoundPaveOnCurve(const gp_Pnt& aP,
- const Standard_Real aT,
- BOPTools_Curve& aBC,
- BOPTools_SSInterference& aFF) ;
-
- Standard_EXPORT
- Standard_Boolean FindPave(const gp_Pnt& aP,
- const Standard_Real aTpV,
- const BOPTools_PaveSet& aPS,
- BOPTools_Pave& aPV) ;
-
- Standard_EXPORT
- Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,
- const BOPTools_PaveBlock& aPBR,
- const Standard_Real aTol) ;
-
- Standard_EXPORT
- Standard_Boolean IsExistingPaveBlock(const BOPTools_PaveBlock& aPB,
- const BOPTools_ListOfPaveBlock& aLPB,
- const Standard_Real aTol) ;
-
- Standard_EXPORT
- void MakePCurves() ;
-
- Standard_EXPORT
- const NMTTools_IndexedDataMapOfIndexedMapOfInteger& AloneVertices() const;
-
- Standard_EXPORT
- Standard_Boolean IsExistingPaveBlock(const BOPTools_PaveBlock& aPB,
- const TopTools_ListOfShape& aLPB,
- const Standard_Real aTol) ;
-
- Standard_EXPORT
- Standard_Boolean CheckCoincidence(const BOPTools_PaveBlock& aPB,
- const BOPTools_ListOfPaveBlock& aLPB) ;
-
- Standard_EXPORT
- Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,
- const TopoDS_Edge& aE,
- const Standard_Real aTol) ;
-
- Standard_EXPORT
- void SharedEdges(const Standard_Integer nF1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aLNE,
- TopTools_ListOfShape& aLSE) ;
-
- Standard_EXPORT
- void FuseVertices(const TopoDS_Shape& aC,
- TopTools_DataMapOfShapeShape& aDMVV) const;
-
- Standard_EXPORT
- void TreatPaveBlocks(NMTTools_ListOfCommonBlock& theLCB) ;
-
- Standard_EXPORT
- BOPTools_PavePool& ChangePavePoolNew() ;
-
- Standard_EXPORT
- Standard_Boolean CheckCoincidence(const BOPTools_PaveBlock& aPB1,
- const BOPTools_PaveBlock& aPB2) ;
-
- Standard_EXPORT
- void PutClosingPaveOnCurve(BOPTools_Curve& aBC,
- BOPTools_SSInterference& aFF) ;
-
- protected:
- Standard_EXPORT
- virtual void Init() ;
-
- Standard_EXPORT
- virtual void Clear() ;
-
- Standard_EXPORT
- virtual void PerformVV() ;
-
- Standard_EXPORT
- virtual void PerformVE() ;
-
- Standard_EXPORT
- virtual void PerformVF() ;
-
- Standard_EXPORT
- virtual void PerformEE() ;
-
- Standard_EXPORT
- virtual void PerformEF() ;
-
- Standard_EXPORT
- virtual void PerformFF() ;
-
- Standard_EXPORT
- void MakeSplitEdges() ;
-
- Standard_EXPORT
- virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2) ;
-
- Standard_EXPORT
- void CorrectShrunkRanges(const Standard_Integer aSide,
- const BOPTools_Pave& aPave,
- IntTools_ShrunkRange& aSR) ;
-
- Standard_EXPORT
- virtual void PreparePaveBlocks(const Standard_Integer anE) ;
-
- Standard_EXPORT
- virtual void PrepareEdges() ;
-
- Standard_EXPORT
- Standard_Boolean IsSuccessorsComputed(const Standard_Integer iF1,
- const Standard_Integer iF2) const;
-
- Standard_EXPORT
- Standard_Boolean IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,
- const BOPTools_PaveBlock& aPB2) const;
-
- Standard_EXPORT
- void RefinePavePool() ;
-
- Standard_EXPORT
- Standard_Integer CheckFacePaves(const TopoDS_Vertex& aV,
- const Standard_Integer nF) ;
-
- Standard_EXPORT
- void ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ;
-
- Standard_EXPORT
- void RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ;
-
- Standard_EXPORT
- void SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ;
-
- Standard_EXPORT
- void SplitCommonBlock(const NMTTools_CommonBlock& aCB,NMTTools_ListOfCommonBlock& aLCB) ;
-
- Standard_EXPORT
- void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aM) ;
-
- Standard_EXPORT
- void EFCommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB) ;
-
- Standard_EXPORT
- void EENewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ;
-
- Standard_EXPORT
- void EENewVertices(const TopoDS_Vertex& aV,
- const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ;
-
- Standard_EXPORT
- void EFNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ;
-
- Standard_EXPORT
- void EFNewVertices(const TopoDS_Vertex& aV,
- const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ;
-
- Standard_EXPORT
- void UpdateCommonBlocks() ;
-
- Standard_EXPORT
- void UpdateCommonBlocks(const Standard_Integer aI) ;
-
- Standard_EXPORT
- void UpdatePaveBlocks() ;
-
- Standard_EXPORT
- Standard_Integer SplitIndex(const BOPTools_PaveBlock& aPB) const;
-
- Standard_EXPORT
- void MakeBlocks() ;
-
- Standard_EXPORT
- void PerformVF1() ;
-
- Standard_EXPORT
- void MakeAloneVertices() ;
-
- Standard_EXPORT
- void FillFaceInfo() ;
-
- Standard_EXPORT
- void CorrectTolR3D(const BOPTools_SSInterference& aFF,
- const TColStd_MapOfInteger& aMVStick,
- Standard_Real& aTolR3D) ;
-
-
- NMTDS_PShapesDataStructure myDS;
- Standard_Boolean myIsDone;
- Standard_Integer myNbSources;
- Standard_Integer myNbEdges;
- BOPTools_PavePool myPavePool;
- BOPTools_PavePool myPavePoolNew;
- NMTTools_CommonBlockPool myCommonBlockPool;
- BOPTools_SplitShapesPool mySplitShapesPool;
- Handle_IntTools_Context myContext;
- BOPTools_SSIntersectionAttribute mySectionAttribute;
- NMTTools_IndexedDataMapOfIndexedMapOfInteger myAloneVertices;
- TColStd_DataMapOfIntegerInteger myVSD;
- NMTDS_PIterator myDSIt;
- TopoDS_Shape myCompositeShape;
- NMTDS_PInterfPool myIP;
- NMTTools_DataMapOfIntegerFaceInfo myFaceInfo;
-
-
- // private:
-
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_0.cxx
-// Created: Mon Dec 8 11:45:51 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <NMTDS_InterfPool.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_Iterator.hxx>
-
-//=======================================================================
-// function:IsSuccesstorsComputed
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_PaveFiller::IsSuccessorsComputed(const Standard_Integer aN1,
- const Standard_Integer aN2)const
-{
- Standard_Boolean bComputed;
- Standard_Integer i, nSuc, n1, n2, ntmp, aNbS;
- TopAbs_ShapeEnum aType;
- TColStd_IndexedMapOfInteger aMSuc;
- //
- n1=aN1;
- n2=aN2;
- aType=myDS->GetShapeType(aN1);
- if (aType!=TopAbs_VERTEX) {
- ntmp=n1;
- n1=n2;
- n2=ntmp;
- }
- //
- myDS->GetAllSuccessors(n2, aMSuc);
- aNbS=aMSuc.Extent();
- for (i=1; i<=aNbS; ++i) {
- nSuc=aMSuc(i);
- bComputed=myIP->Contains(n1, nSuc);
- if (bComputed) {
- break;
- }
- }
- return bComputed;
-}
-/*
-//=======================================================================
-// function: ExpectedPoolLength
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::ExpectedPoolLength()const
-{
- Standard_Integer aNbIIs;
- Standard_Real aCfPredict=.5;
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- //const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple();
- //aNbIIs=aLC.Extent();
- aNbIIs=myDSIt->ExpectedLength();
- // Contribution of Samtech www.samcef.com END
- //
- if (aNbIIs==1) {
- return aNbIIs;
- }
- //
- aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
-
- return aNbIIs;
-}
-*/
-/*
-//=======================================================================
-//function : SortTypes
-//purpose :
-//=======================================================================
- void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat,
- Standard_Integer& theWith)const
-{
- Standard_Integer aWhat, aWith;
- Standard_Boolean aReverseFlag;
- TopAbs_ShapeEnum aType1, aType2;
- //
- aType1= myDS->GetShapeType(theWhat),
- aType2= myDS->GetShapeType(theWith);
- //
- if (aType1==aType2) {
- return;
- }
- //
- aReverseFlag=Standard_True;
- if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE) {
- aReverseFlag=Standard_False;
- }
- if (aType1==TopAbs_VERTEX &&
- (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) {
- aReverseFlag=Standard_False;
- }
- //
- aWhat=(aReverseFlag) ? theWith : theWhat;
- aWith=(aReverseFlag) ? theWhat : theWith;
- //
- theWhat=aWhat;
- theWith=aWith;
-}
-*/
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_1.cxx
-// Created: Mon Dec 8 11:47:55 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-
-#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-
-#include <TopTools_ListOfShape.hxx>
-
-#include <IntTools_Tools.hxx>
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-#include <BOPTools_VVInterference.hxx>
-#include <BOPTools_CArray1OfVVInterference.hxx>
-
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_InterfPool.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-
-#include <NMTTools_Tools.hxx>
-
-//=======================================================================
-// function: PerformVV
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PerformVV()
-{
- myIsDone=Standard_False;
- //
- Standard_Integer aNbVVs, aBL, aNbVSD, nVnew, i, j, n1, n2;
- TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1;
- TColStd_ListIteratorOfListOfInteger aItX, aItY;
- TColStd_ListOfInteger aLIX;
- TopTools_ListOfShape aLV;
- TopoDS_Vertex aVnew;
- //
- myVSD.Clear();
- //
- const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt->SDVertices();
- aNbVSD=aMVSD.Extent();
- if (!aNbVSD) {
- return;
- }
- //
- BOPTools_CArray1OfVVInterference& aVVs=myIP->VVInterferences();
- //
- // BlockLength correction
- myDSIt->Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
- aNbVVs=myDSIt->BlockLength();
- aBL=aVVs.BlockLength();
- if (aNbVVs > aBL) {
- aVVs.SetBlockLength(aNbVVs);
- }
- //
- aIt1.Initialize(aMVSD);
- for (; aIt1.More(); aIt1.Next()) {
- aLV.Clear();
- //
- n1=aIt1.Key();
- const TColStd_ListOfInteger& aLIV=aIt1.Value();
- //
- // new vertex
- const TopoDS_Shape& aS1=myDS->Shape(n1);
- aLV.Append(aS1);
- aItX.Initialize(aLIV);
- for (; aItX.More(); aItX.Next()) {
- n2=aItX.Value();
- const TopoDS_Shape& aS2=myDS->Shape(n2);
- aLV.Append(aS2);
- }
- //
- NMTTools_Tools::MakeNewVertex(aLV, aVnew);
- //
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- //
- myDS->InsertShapeAndAncestorsSuccessors(aVnew, anASSeq);
- nVnew=myDS->NumberOfInsertedShapes();
- myDS->SetState (nVnew, BooleanOperations_ON);
- //
- // myVSD, aLIX
- aLIX.Clear();
- aLIX.Append(n1);
- myVSD.Bind(n1, nVnew);
- //
- aItX.Initialize(aLIV);
- for (; aItX.More(); aItX.Next()) {
- n2=aItX.Value();
- aLIX.Append(n2);
- myVSD.Bind(n2, nVnew);
- }
- //
- // interferences
- aItX.Initialize(aLIX);
- for (i=0; aItX.More(); aItX.Next(), ++i) {
- aItY.Initialize(aLIX);
- for (j=0; aItY.More(); aItY.Next(), ++j) {
- if (j>i) {
- n1=aItX.Value();
- n2=aItY.Value();
- myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV);
- //
- BOPTools_VVInterference aVV(n1, n2);
- aVV.SetNewShape(nVnew);
- aVVs.Append(aVV);
- }
- }
- }
- }//for (; aIt1.More(); aIt1.Next()) {
- myIsDone=Standard_True;
-}
-//=======================================================================
-// function: FindSDVertex
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::FindSDVertex(const Standard_Integer nV)const
-{
- Standard_Integer nVSD;
- //
- nVSD=0;
- if (myVSD.IsBound(nV)) {
- nVSD=myVSD.Find(nV);
- }
- return nVSD;
-}
-/*
-//=======================================================================
-// function: PerformNewVertices
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PerformNewVertices()
-{
-}
-*/
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_2.cxx
-// Created: Mon Dec 8 12:02:56 2003
-// Author: Peter KURNEV
-
-#include <Standard_Version.hxx>
-
-#include <NMTTools_PaveFiller.hxx>
-#include <NMTTools_Tools.hxx>
-
-#include <Basics_OCCTVersion.hxx>
-
-#include <Precision.hxx>
-
-#include <gp_Pnt.hxx>
-
-#include <Geom_Curve.hxx>
-
-#include <TopAbs_Orientation.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Iterator.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-
-#include <BOPTools_Pave.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_CArray1OfVEInterference.hxx>
-#include <BOPTools_VEInterference.hxx>
-
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-
-#include <BOPTools_IndexedMapOfCoupleOfInteger.hxx>
-#include <BOPTools_CoupleOfInteger.hxx>
-#include <BooleanOperations_OnceExplorer.hxx>
-
-#include <IntTools_Context.hxx>
-
-static
- Standard_Boolean Contains(const TopoDS_Edge& aE,
- const TopoDS_Vertex& aV);
-
-//=======================================================================
-// function: PerformVE
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PerformVE()
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean bJustAdd;
- Standard_Integer n1, n2, anIndexIn, aFlag, aWhat;
- Standard_Integer aWith, aNbVEs, aBlockLength, iSDV, nV1;
- Standard_Real aT;
-#if OCC_VERSION_LARGE > 0x06030008
- // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method
- Standard_Boolean bToUpdateVertex;
- Standard_Real aDist;
-#endif
- TopoDS_Vertex aV1;
- TopoDS_Edge aE2;
- BOPTools_IndexedMapOfCoupleOfInteger aSnareMap;
- BOPTools_CoupleOfInteger aCouple;
- //
- BOPTools_CArray1OfVEInterference& aVEs=myIP->VEInterferences();
- //
- myDSIt->Initialize (TopAbs_VERTEX, TopAbs_EDGE);
- //
- // BlockLength correction
- aNbVEs=myDSIt->BlockLength();
- aBlockLength=aVEs.BlockLength();
- if (aNbVEs > aBlockLength) {
- aVEs.SetBlockLength(aNbVEs);
- }
- //
- for (; myDSIt->More(); myDSIt->Next()) {
- myDSIt->Current(n1, n2, bJustAdd);
- if (!IsSuccessorsComputed(n1, n2)) {
- anIndexIn=0;
- aWhat=n1; // Vertex
- aWith=n2; // Edge
- if (myDS->GetShapeType(n1)==TopAbs_EDGE) {
- aWhat=n2;
- aWith=n1;
- }
- //
- if(bJustAdd) {
- continue;
- }
- // Edge
- aE2=TopoDS::Edge(myDS->Shape(aWith));
- if (NMTTools_Tools::IsDegenerated(aE2)){
- continue;
- }
- // Vertex
- nV1=aWhat;
- aV1=TopoDS::Vertex(myDS->Shape(aWhat));
- //
- iSDV=FindSDVertex(aWhat);
- if (iSDV) {
- nV1=iSDV;
- aV1=TopoDS::Vertex(myDS->Shape(nV1));
- // Modified to find same domain vertex Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- Standard_Integer nVE, iSDVE, iRet;
- //
- BooleanOperations_OnceExplorer aExp(*myDS);
- iRet=0;
- aExp.Init(aWith, TopAbs_VERTEX);
- for (; aExp.More(); aExp.Next()) {
- nVE=aExp.Current();
- iSDVE=FindSDVertex(nVE);
- if (iSDVE==iSDV) {
- iRet=1;
- break;
- }
- }
- if (iRet) {
- continue;
- }
- }
- else {
- if (Contains(aE2, aV1)) {
- continue;
- }
- // Contribution of Samtech www.samcef.com END
- }
- //
- //modified by NIZNHY-PKV Mon Dec 28 08:58:05 2009f
-#if OCC_VERSION_LARGE > 0x06030008
- // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method
- aFlag = myContext->ComputeVE (aV1, aE2, aT, bToUpdateVertex, aDist);
-#else
- aFlag = myContext->ComputeVE (aV1, aE2, aT);
-#endif
- //modified by NIZNHY-PKV Mon Dec 28 08:58:13 2009t
- //
- if (!aFlag) {
- // Add Interference to the Pool
- BOPTools_VEInterference anInterf (aWhat, aWith, aT);
- anIndexIn=aVEs.Append(anInterf);
- //
- // Add Pave to the Edge's myPavePool
- aCouple.SetCouple(nV1, aWith);
- if (!aSnareMap.Contains(aCouple)){
- aSnareMap.Add(aCouple);
- //
- BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge);
- aPave.SetInterference(anIndexIn);
- BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith));
- aPaveSet.Append(aPave);
- }
- //
- // State for the Vertex in DS;
- myDS->SetState (aWhat, BooleanOperations_ON);
- // Insert Vertex in Interference Object
- BOPTools_VEInterference& aVE=aVEs(anIndexIn);
- aVE.SetNewShape(aWhat);
- //
- myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VE);
- //
- //modified by NIZNHY-PKV Mon Dec 28 09:00:54 2009f
-#if OCC_VERSION_LARGE > 0x06030008
- // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method
- if (bToUpdateVertex) {
- BRep_Builder aBB;
- //
- aBB.UpdateVertex(aV1, aDist);
- }
-#endif
- //modified by NIZNHY-PKV Mon Dec 28 09:00:57 2009t
- //
- } //if (!aFlag) {
- }
- }
- myIsDone=Standard_True;
-}
-
-//=======================================================================
-// function: PrepareEdges
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PrepareEdges()
-{
- Standard_Integer i, nV, ii, aNBSuc, ip, aNbShapesObject;
- Standard_Real aT;
- TopAbs_Orientation anOr;
- TopoDS_Edge aE;
- TopoDS_Vertex aV;
- //
- aNbShapesObject=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=myNbSources; ++i) {
- if (myDS->GetShapeType(i)==TopAbs_EDGE) {
- aE=TopoDS::Edge(myDS->Shape(i));
- //
- if (NMTTools_Tools::IsDegenerated(aE)){
- continue;
- }
- //
- BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(i));
- //
- // A <-
- aNBSuc=myDS->NumberOfSuccessors(i);
- for (ii=1; ii <=aNBSuc; ii++) {
- nV=myDS->GetSuccessor(i, ii);
- anOr=myDS->GetOrientation(i, ii);
- aV=TopoDS::Vertex(myDS->Shape(nV));
- aV.Orientation(anOr);
- aT=BRep_Tool::Parameter(aV, aE);
- //
- ip=FindSDVertex(nV);
- if (ip) {
- aV=TopoDS::Vertex(myDS->Shape(ip));
- aV.Orientation(anOr);// XX ? if the edge is closed it'll be amazing result
- nV=ip;
- }
- //
- BOPTools_Pave aPave(nV, aT);
- aPaveSet.Append (aPave);
- }
- }
- }
-}
-
-// Modified Thu Sep 14 14:35:18 2006
-// Contribution of Samtech www.samcef.com BEGIN
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-Standard_Boolean Contains(const TopoDS_Edge& aE,
- const TopoDS_Vertex& aV)
-{
- Standard_Boolean bRet;
- TopoDS_Iterator aIt;
- //
- bRet=Standard_False;
- aIt.Initialize(aE);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aVE=aIt.Value();
- if (aVE.IsSame(aV)) {
- bRet=!bRet;
- break;
- }
- }
- return bRet;
-}
-// Contribution of Samtech www.samcef.com END
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_3.cxx
-// Created: Mon Dec 8 16:06:56 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Face.hxx>
-
-#include <TopExp_Explorer.hxx>
-
-#include <BOPTools_VSInterference.hxx>
-#include <BOPTools_CArray1OfVSInterference.hxx>
-
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_InterfPool.hxx>
-#include <IntTools_Context.hxx>
-
-
-static
- Standard_Boolean Contains(const TopoDS_Face& aF,
- const TopoDS_Vertex& aV);
-
-//=======================================================================
-// function: PerformVF
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PerformVF()
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean aJustAdd;
- Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV;
- Standard_Real aU, aV;
- TopoDS_Vertex aV1;
- TopoDS_Face aF2;
- //
- BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences();
- //
- // V/E Interferences
- myDSIt->Initialize(TopAbs_VERTEX, TopAbs_FACE);
- //
- // BlockLength correction
- aNbVSs=myDSIt->BlockLength();
- aBlockLength=aVSs.BlockLength();
- if (aNbVSs > aBlockLength) {
- aVSs.SetBlockLength(aNbVSs);
- }
- //
- for (; myDSIt->More(); myDSIt->Next()) {
- myDSIt->Current(n1, n2, aJustAdd);
- if (! IsSuccessorsComputed(n1, n2)) {
- anIndexIn=0;
- aWhat=n1; // Vertex
- aWith=n2; // Face
- if (myDS->GetShapeType(n1)==TopAbs_FACE) {
- aWhat=n2;
- aWith=n1;
- }
- //
- iSDV=FindSDVertex(aWhat);
- //
- if(aJustAdd) {
- //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
- continue;
- }
- //
- aV1=TopoDS::Vertex(myDS->Shape(aWhat));
- if (iSDV) {
- aV1=TopoDS::Vertex(myDS->Shape(iSDV));
- }
- //
- aF2=TopoDS::Face(myDS->Shape(aWith));
- //
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- if (Contains(aF2, aV1)) {
- continue;
- }
- // Contribution of Samtech www.samcef.com END
- //
- aFlag=myContext->ComputeVS (aV1, aF2, aU, aV);
- //
- if (!aFlag) {
- //
- // Add Interference to the Pool
- BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV);
- anIndexIn=aVSs.Append(anInterf);
- //
- // SetState for Vertex in DS;
- myDS->SetState (aWhat, BooleanOperations_ON);
- // Insert Vertex in Interference Object
- BOPTools_VSInterference& aVS=aVSs(anIndexIn);
- aVS.SetNewShape(aWhat);
- // qqf
- {
- myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF);
- }
- // qqt
- }
- //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
- }
- }
- myIsDone=Standard_True;
-}
-// Modified Thu Sep 14 14:35:18 2006
-// Contribution of Samtech www.samcef.com BEGIN
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-Standard_Boolean Contains(const TopoDS_Face& aF,
- const TopoDS_Vertex& aV)
-{
- Standard_Boolean bRet;
- TopExp_Explorer aExp;
- //
- bRet=Standard_False;
- aExp.Init(aF, TopAbs_VERTEX);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape& aVF=aExp.Current();
- if (aVF.IsSame(aV)) {
- bRet=!bRet;
- break;
- }
- }
- return bRet;
-}
-// Contribution of Samtech www.samcef.com END
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_4.cxx
-// Created: Mon Dec 8 17:08:58 2003
-// Author: Peter KURNEV
-
-#include <NMTTools_PaveFiller.hxx>
-#include <NMTTools_Tools.hxx>
-
-#include <stdio.h>
-#include <Precision.hxx>
-
-#include <gp_XYZ.hxx>
-#include <gp_Pnt.hxx>
-#include <Bnd_Box.hxx>
-
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Compound.hxx>
-
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
-#include <TopTools_DataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBndLib.hxx>
-
-#include <BOPTColStd_Dump.hxx>
-#include <BOPTColStd_Failure.hxx>
-
-#include <IntTools_ShrunkRange.hxx>
-#include <IntTools_Range.hxx>
-#include <IntTools_CommonPrt.hxx>
-#include <IntTools_SequenceOfRanges.hxx>
-#include <IntTools_EdgeEdge.hxx>
-#include <IntTools_SequenceOfCommonPrts.hxx>
-#include <IntTools_Tools.hxx>
-#include <IntTools_Context.hxx>
-
-#include <BOPTools_Pave.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_PaveBlockIterator.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_CArray1OfEEInterference.hxx>
-#include <BOPTools_EEInterference.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_CArray1OfVVInterference.hxx>
-#include <BOPTools_VVInterference.hxx>
-#include <BOPTools_CArray1OfEEInterference.hxx>
-#include <BOPTools_Tools.hxx>
-#include <BOPTools_IDMapOfPaveBlockIMapOfPaveBlock.hxx>
-#include <BOPTools_IMapOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPave.hxx>
-#include <BOPTools_SequenceOfPaveBlock.hxx>
-
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
-#include <BooleanOperations_KindOfInterference.hxx>
-
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_IndexedDataMapOfIntegerShape.hxx>
-#include <NMTDS_IndexedDataMapOfShapeBox.hxx>
-#include <NMTDS_BoxBndTree.hxx>
-#include <NCollection_UBTreeFiller.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_CommonBlock.hxx>
-#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
-
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <BRepBndLib.hxx>
-#include <BOPTools_CArray1OfVSInterference.hxx>
-#include <BOPTools_VSInterference.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-
-static
- void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI,
- TopTools_DataMapOfShapeListOfShape& myImages,
- TopTools_DataMapOfShapeShape& myOrigins);
-
-static
- void MakeNewVertex(const TopTools_ListOfShape& aLV,
- TopoDS_Vertex& aNewVertex);
-
-static
- void VertexParameters(const IntTools_CommonPrt& aCPart,
- Standard_Real& aT1,
- Standard_Real& aT2);
-
-static
- Standard_Boolean IsOnPave(const Standard_Real& aT1,
- const IntTools_Range& aRange,
- const Standard_Real& aTolerance);
-
-// static
-// void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB);
-
-static
- void ProcessBlock(const BOPTools_PaveBlock& aPB,
- const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
- BOPTools_IMapOfPaveBlock& aProcessedBlocks,
- BOPTools_IMapOfPaveBlock& aChain);
-
-static
- void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
- NMTTools_ListOfCommonBlock& aLCB);
-
-//=======================================================================
-// function: PerformEE
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PerformEE()
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean bJustAdd;
- Standard_Integer n1, n2, anIndexIn, nE1, nE2, aNbVEs, aBlockLength;
- Standard_Integer aTmp, aWhat, aWith, i, aNbCPrts, aDiscretize=30;
- Standard_Integer aNbLPB1, aNbLPB2;
- Standard_Real aTolE1, aTolE2, aDeflection=0.01;
- BOPTools_ListIteratorOfListOfPaveBlock anIt1, anIt2;
- TopoDS_Edge aEWhat, aEWith;
- TopoDS_Vertex aNewVertex;
- BooleanOperations_IndexedDataMapOfShapeInteger aMapVI;
- BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB;
- //
- BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
- //
- myDSIt->Initialize(TopAbs_EDGE, TopAbs_EDGE);
- //
- // BlockLength correction
- aNbVEs=myDSIt->BlockLength();
- aBlockLength=aEEs.BlockLength();
- if (aNbVEs > aBlockLength) {
- aEEs.SetBlockLength(aNbVEs);
- }
- //
- for (; myDSIt->More(); myDSIt->Next()) {
- myDSIt->Current(n1, n2, bJustAdd);
- anIndexIn = 0;
- nE1=n1;
- nE2=n2;
- //
- if(bJustAdd) {
- continue;
- }
- //
- const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv
- const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv
- //
- if (NMTTools_Tools::IsDegenerated(aE1) ||
- NMTTools_Tools::IsDegenerated(aE2)){
- continue;
- }
- //
- aTolE1=BRep_Tool::Tolerance(aE1);
- aTolE2=BRep_Tool::Tolerance(aE2);
- //
- BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1));
- BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2));
- //
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- aNbLPB1=aLPB1.Extent();
- aNbLPB2=aLPB2.Extent();
- //
- //if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) {
- // continue;
- //}
- // Contribution of Samtech www.samcef.com END
- //
- for (anIt1.Initialize(aLPB1); anIt1.More(); anIt1.Next()) {
- BOPTools_PaveBlock& aPB1=anIt1.Value();
- const IntTools_ShrunkRange& aShrunkRange1=aPB1.ShrunkRange();
- //
- const IntTools_Range& aSR1=aShrunkRange1.ShrunkRange();
- const Bnd_Box& aBB1=aShrunkRange1.BndBox();
- //
- for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) {
- BOPTools_PaveBlock& aPB2=anIt2.Value();
- const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange();
- //
- const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange();
- const Bnd_Box& aBB2=aShrunkRange2.BndBox();
- //
- if (aBB1.IsOut (aBB2)) {
- continue;
- }
- //
- // EE
- IntTools_EdgeEdge aEE;
- aEE.SetEdge1 (aE1);
- aEE.SetEdge2 (aE2);
- aEE.SetTolerance1 (aTolE1);
- aEE.SetTolerance2 (aTolE2);
- aEE.SetDiscretize (aDiscretize);
- aEE.SetDeflection (aDeflection);
- //
- IntTools_Range anewSR1 = aSR1;
- IntTools_Range anewSR2 = aSR2;
- //
- BOPTools_Tools::CorrectRange (aE1, aE2, aSR1, anewSR1);
- BOPTools_Tools::CorrectRange (aE2, aE1, aSR2, anewSR2);
- //
- aEE.SetRange1(anewSR1);
- aEE.SetRange2(anewSR2);
- //
- aEE.Perform();
- //
- anIndexIn=0;
- //
- if (aEE.IsDone()) {
- // reverse order if it is necessary
- aEWhat=aE1;
- aEWith=aE2;
- aWhat=nE1;
- aWith=nE2;
- if (aEE.Order()) {
- aTmp=aWhat;
- aWhat=aWith;
- aWith=aTmp;
- aEWhat=aE2;
- aEWith=aE1;
- }
- //
- const IntTools_SequenceOfCommonPrts& aCPrts=aEE.CommonParts();
- aNbCPrts=aCPrts.Length();
- for (i=1; i<=aNbCPrts; i++) {
- const IntTools_CommonPrt& aCPart=aCPrts(i);
- const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2();
- //
- anIndexIn=0;
- //
- TopAbs_ShapeEnum aType=aCPart.Type();
- switch (aType) {
- case TopAbs_VERTEX: {
- Standard_Real aT1, aT2, aTol=Precision::PConfusion();
- Standard_Boolean bIsOnPave1, bIsOnPave2;
- IntTools_Range aR1, aR2;
- //
- VertexParameters(aCPart, aT1, aT2);
- //
- //decide to keep the pave or not
- aR1 = (aEE.Order()) ? anewSR2 : anewSR1;
- aR2 = (aEE.Order()) ? anewSR1 : anewSR2;
- //
- aTol=0.8*aTol;
- bIsOnPave1=IsOnPave(aT1, aR1, aTol);
- bIsOnPave2=IsOnPave(aT2, aR2, aTol);
- //
- if(bIsOnPave1 || bIsOnPave2) {
- continue;
- }
- //
- BOPTools_Tools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aNewVertex);
- //
- {
- Standard_Integer nV11, nV12, nV21, nV22, nVS[2], k, j, iFound;
- Standard_Real aTolVx, aTolVnew, aD2, aDT2;
- TColStd_MapOfInteger aMV;
- gp_Pnt aPnew, aPx;
- //
- iFound=0;
- j=-1;
- nV11=aPB1.Pave1().Index();
- nV12=aPB1.Pave2().Index();
- nV21=aPB2.Pave1().Index();
- nV22=aPB2.Pave2().Index();
- aMV.Add(nV11);
- aMV.Add(nV12);
- //
- if (aMV.Contains(nV21)) {
- ++j;
- nVS[j]=nV21;
- }
- if (aMV.Contains(nV22)) {
- ++j;
- nVS[j]=nV22;
- }
- //
- aTolVnew=BRep_Tool::Tolerance(aNewVertex);
- aPnew=BRep_Tool::Pnt(aNewVertex);
- //
- for (k=0; k<=j; ++k) {
- const TopoDS_Vertex& aVx=TopoDS::Vertex(myDS->Shape(nVS[k]));
- aTolVx=BRep_Tool::Tolerance(aVx);
- aPx=BRep_Tool::Pnt(aVx);
- aD2=aPnew.SquareDistance(aPx);
- //
- aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
- //
- if (aD2<aDT2) {
- iFound=1;
- break;
- }
- }
- //
- if (iFound) {
- continue;
- }
- }
- //
- // Add Interference to the Pool
- BOPTools_EEInterference anInterf (aWhat, aWith, aCPart);
- //
- anIndexIn=aEEs.Append(anInterf);
- // qqf
- {
- myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE);
- }
- // qqt
- //
- // Collect
- aMapVI.Add(aNewVertex, anIndexIn);
- }
- break;
-
- case TopAbs_EDGE: {
- Standard_Integer aNbComPrt2;
- Standard_Boolean aCoinsideFlag;
- //
- aNbComPrt2=aRanges2.Length();
- aCoinsideFlag=IsBlocksCoinside(aPB1, aPB2);
- //
- if (aNbComPrt2>1 || !aCoinsideFlag) {
- break;
- }
- //
- // Fill aMapCB
- if (aMapCB.Contains(aPB1)) {
- BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB1);
- aMapPB.Add(aPB1);
- aMapPB.Add(aPB2);
- }
- else {
- BOPTools_IMapOfPaveBlock aMapPB;
- aMapPB.Add(aPB1);
- aMapPB.Add(aPB2);
- aMapCB.Add(aPB1, aMapPB);
- }
- //
- if (aMapCB.Contains(aPB2)) {
- BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB2);
- aMapPB.Add(aPB1);
- aMapPB.Add(aPB2);
- }
- else {
- BOPTools_IMapOfPaveBlock aMapPB;
- aMapPB.Add(aPB1);
- aMapPB.Add(aPB2);
- aMapCB.Add(aPB2, aMapPB);
- }
- // qqf
- {
- myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE);
- }
- // qqt
- }
- break;
- default:
- break;
- } // switch (aType)
- } // for (i=1; i<=aNbCPrts; i++)
- }// if (aEE.IsDone())
- } // for (; anIt2.More(); anIt2.Next())
- } // for (; anIt1.More(); anIt1.Next())
- }// for (; myDSIt.More(); myDSIt.Next())
- //
- {
- NMTTools_ListOfCommonBlock aLCB;
- //
- FindChains(aMapCB, aLCB);
- EENewVertices (aMapVI);
- //TreatPaveBlocks(*this, aLCB);
- TreatPaveBlocks(aLCB);
- ReplaceCommonBlocks(aLCB);
- }
- //
- PerformVF1();
- //
- myIsDone=Standard_True;
-}
-
-//=======================================================================
-// function:TreatPaveBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::TreatPaveBlocks (NMTTools_ListOfCommonBlock& theLCB)
-{
- Standard_Boolean bFound;
- Standard_Integer nE, nV, nVp, iFlag;
- Standard_Real aT;
- TColStd_MapOfInteger aMI;
- TColStd_MapIteratorOfMapOfInteger aItMI;
- NMTTools_ListIteratorOfListOfCommonBlock aItLCB;
- BOPTools_ListIteratorOfListOfPaveBlock aItLPB;
- BOPTools_ListIteratorOfListOfPave aItLP;
- //
- aItLCB.Initialize(theLCB);
- for (; aItLCB.More(); aItLCB.Next()) {
- const NMTTools_CommonBlock& aCB=aItLCB.Value();
- //
- aMI.Clear();
- const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
- //
- // 1 -> aMI
- aItLPB.Initialize(aLPB);
- for (; aItLPB.More(); aItLPB.Next()) {
- const BOPTools_PaveBlock& aPB=aItLPB.Value();
- nE=aPB.OriginalEdge();
- BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE));
- BOPTools_ListOfPave& aLP=aPaveSet.ChangeSet();
- //
- aItLP.Initialize(aLP);
- for (; aItLP.More(); aItLP.Next()) {
- const BOPTools_Pave& aPave=aItLP.Value();
- nV=aPave.Index();
- aMI.Add(nV);
- }
- }//for (; anItLPB.More(); anItLPB.Next()) {
- //
- // 2
- aItLPB.Initialize(aLPB);
- for (; aItLPB.More(); aItLPB.Next()) {
- const BOPTools_PaveBlock& aPB=aItLPB.Value();
- nE=aPB.OriginalEdge();
- BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE));
- BOPTools_ListOfPave& aLP=aPaveSet.ChangeSet();
- //
- aItMI.Initialize(aMI);
- for (; aItMI.More(); aItMI.Next()) {
- nV=aItMI.Key();
- bFound=Standard_False;
- aItLP.Initialize(aLP);
- for (; aItLP.More(); aItLP.Next()) {
- const BOPTools_Pave& aPave=aItLP.Value();
- nVp=aPave.Index();
- if (nVp==nV) {
- bFound=!bFound;
- break;
- }
- }
- //
- if (!bFound) {
- // Append Pave of nV to rhe edge nE
- const TopoDS_Edge& aE=*(TopoDS_Edge*)(&myDS->Shape(nE));
- const TopoDS_Vertex& aV= *(TopoDS_Vertex*)(&myDS->Shape(nV));
- iFlag=myContext->ComputeVE (aV, aE, aT);
- if (!iFlag) {
- BOPTools_Pave aPave;
- //
- aPave.SetInterference(-1);
- aPave.SetType (BooleanOperations_EdgeEdge);
- aPave.SetIndex(nV);
- aPave.SetParam(aT);
- aPaveSet.Append(aPave);
- }
- }
- }//for (; aItMI.More(); aItMI.Next()) {
- }//for (; anItLPB.More(); anItLPB.Next()) {
- }
-}
-
-//=======================================================================
-// function:EECommonBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB)
-{
- NMTTools_ListOfCommonBlock aLCB;
- //
- FindChains(aMapCB, aLCB);
- ReplaceCommonBlocks(aLCB);
-}
-
-//=======================================================================
-// function:EENewVertices
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
-{
- Standard_Integer aNb, aNbVSD, nVnew, nIEE, nE[2], j, iFlag;
- Standard_Real aT;
- TopoDS_Edge aE;
- TopTools_DataMapOfShapeListOfShape myImages;
- TopTools_DataMapOfShapeShape myOrigins;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
- TopTools_ListIteratorOfListOfShape aIt;
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- TColStd_MapOfInteger aMFence;
- BOPTools_Pave aPave;
- //
- BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
- //
- aNb=aMapVI.Extent();
- if (!aNb) { // no new vertices, no new problems
- return;
- }
- //
- // 0.
- if (aNb==1) {
- TopoDS_Vertex aV1=TopoDS::Vertex(aMapVI.FindKey(1));
- EENewVertices(aV1, aMapVI);
- return;
- }
- //
- // 1.
- TreatNewVertices(aMapVI, myImages, myOrigins);
- //
- aItIm.Initialize(myImages);
- for (; aItIm.More(); aItIm.Next()) {
- const TopoDS_Vertex& aVnew=TopoDS::Vertex(aItIm.Key());
- const TopTools_ListOfShape& aLVSD=aItIm.Value();
- //
- aNbVSD=aLVSD.Extent();
- if (aNbVSD==1) {// simple case aVnew=aVold
- EENewVertices(aVnew, aMapVI);
- continue;
- }
- //
- // aNbVSD>1
- myDS->InsertShapeAndAncestorsSuccessors(aVnew, anASSeq);
- nVnew=myDS->NumberOfInsertedShapes();
- myDS->SetState(nVnew, BooleanOperations_ON);
- //
- aMFence.Clear();
- aIt.Initialize(aLVSD);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Vertex& aVold=TopoDS::Vertex(aIt.Value());
- nIEE=aMapVI.FindFromKey(aVold);
- BOPTools_EEInterference& aEE=aEEs(nIEE);
- aEE.Indices(nE[0], nE[1]);
- aEE.SetNewShape(nVnew);
- //
- for (j=0; j<2; ++j) {
- if (aMFence.Add(nE[j])) {
- aE=TopoDS::Edge(myDS->Shape(nE[j]));
- iFlag=myContext->ComputeVE (aVnew, aE, aT);
- if (!iFlag) {
- aPave.SetInterference(-1);
- aPave.SetType (BooleanOperations_EdgeEdge);
- aPave.SetIndex(nVnew);
- aPave.SetParam(aT);
- //
- BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE[j]));
- aPaveSet.Append(aPave);
- }
- }// if (aMFence.Add(nE[j])) {
- }// for (j=0; j<2; ++j) {
- }//for (; aIt.More(); aIt.Next()) {
- }// for (; aItIm.More(); aItIm.Next())
-}
-//
-// case: use_02
-// completely rewritten
-//=======================================================================
-//function : TreatNewVertices
-//purpose :
-//=======================================================================
-void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI,
- TopTools_DataMapOfShapeListOfShape& myImages,
- TopTools_DataMapOfShapeShape& myOrigins)
-{
- Standard_Integer j, i, aNbV, aNbVSD;
- Standard_Real aTol;
- TColStd_ListIteratorOfListOfInteger aIt;
- TopoDS_Shape aSTmp, aVF;
- TopoDS_Vertex aVnew;
- TopTools_IndexedMapOfShape aMV, aMVProcessed;
- TopTools_ListIteratorOfListOfShape aItS;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
- TopTools_DataMapOfShapeListOfShape aMVV;
- NMTDS_IndexedDataMapOfIntegerShape aMIS;
- NMTDS_IndexedDataMapOfShapeBox aMSB;
- //
- NMTDS_BoxBndTreeSelector aSelector;
- NMTDS_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
- //
- myImages.Clear();
- myOrigins.Clear();
- //
- aNbV=aMapVI.Extent();
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
- aMV.Add(aV);
- }
- //
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMV(i);
- Bnd_Box aBox;
- //
- aTol=BRep_Tool::Tolerance(TopoDS::Vertex(aV));
- aBox.SetGap(aTol);
- BRepBndLib::Add(aV, aBox);
- //
- aTreeFiller.Add(i, aBox);
- //
- aMIS.Add(i, aV);
- aMSB.Add(aV, aBox);
- }
- //
- aTreeFiller.Fill();
- //
- // Chains
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMV(i);
- //
- if (aMVProcessed.Contains(aV)) {
- continue;
- }
- //
- Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
- TopTools_ListOfShape aLVSD;
- TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
- TColStd_MapIteratorOfMapOfInteger aIt1;
- //
- aMIP.Add(i);
- while(1) {
- aNbIP=aMIP.Extent();
- aIt1.Initialize(aMIP);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- if (aMIPC.Contains(aIP)) {
- continue;
- }
- //
- const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
- const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
- //
- aSelector.Clear();
- aSelector.SetBox(aBoxVP);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it must not be
- }
- //
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- aIP1=aIt.Value();
- if (aMIP.Contains(aIP1)) {
- continue;
- }
- aMIP1.Add(aIP1);
- } //for (; aIt.More(); aIt.Next()) {
- }//for(; aIt1.More(); aIt1.Next()) {
- //
- aNbIP1=aMIP1.Extent();
- if (!aNbIP1) {
- break; // from while(1)
- }
- //
- aIt1.Initialize(aMIP);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIPC.Add(aIP);
- }
- //
- aMIP.Clear();
- aIt1.Initialize(aMIP1);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIP.Add(aIP);
- }
- aMIP1.Clear();
- }// while(1)
- //...
- aNbIP=aMIPC.Extent();
- if (!aNbIP) {
- aMIPC.Add(i);
- }
- //
- aIt1.Initialize(aMIPC);
- for(j=0; aIt1.More(); aIt1.Next(), ++j) {
- aIP=aIt1.Key();
- const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
- if (!j) {
- aVF=aVP;
- }
- aLVSD.Append(aVP);
- aMVProcessed.Add(aVP);
- }
- myImages.Bind(aVF, aLVSD);
- }// for (i=1; i<=aNbV; ++i) {
- //------------------------------
- //
- // Make new vertices
- aMV.Clear();
- aItIm.Initialize(myImages);
- for (; aItIm.More(); aItIm.Next()) {
- const TopoDS_Shape& aV=aItIm.Key();
- const TopTools_ListOfShape& aLVSD=aItIm.Value();
- aNbVSD=aLVSD.Extent();
- if (aNbVSD>1) {
- aMV.Add(aV);
- MakeNewVertex(aLVSD, aVnew);
- aMVV.Bind(aVnew, aLVSD);
- }
- }
- //
- // UnBind old vertices
- aNbV=aMV.Extent();
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMV(i);
- myImages.UnBind(aV);
- }
- //
- // Bind new vertices
- aItIm.Initialize(aMVV);
- for (; aItIm.More(); aItIm.Next()) {
- const TopoDS_Shape& aV=aItIm.Key();
- const TopTools_ListOfShape& aLVSD=aItIm.Value();
- myImages.Bind(aV, aLVSD);
- }
- //
- // Origins
- aItIm.Initialize(myImages);
- for (; aItIm.More(); aItIm.Next()) {
- const TopoDS_Shape& aV=aItIm.Key();
- const TopTools_ListOfShape& aLVSD=aItIm.Value();
- //
- aItS.Initialize(aLVSD);
- for (; aItS.More(); aItS.Next()) {
- const TopoDS_Shape& aVSD=aItS.Value();
- if (!myOrigins.IsBound(aVSD)) {
- myOrigins.Bind(aVSD, aV);
- }
- }
- }
-}
-
-//=======================================================================
-//function : MakeNewVertex
-//purpose :
-//=======================================================================
-void MakeNewVertex(const TopTools_ListOfShape& aLV,
- TopoDS_Vertex& aNewVertex)
-{
- Standard_Integer aNbV;
- Standard_Real aTolV, aD, aDmax;
- gp_XYZ aGC;
- gp_Pnt aP3D, aPGC;
- TopoDS_Vertex aVx;
- BRep_Builder aBB;
- TopTools_ListIteratorOfListOfShape aIt;
- //
- aNbV=aLV.Extent();
- if (!aNbV) {
- return;
- }
- //
- // center of gravity
- aGC.SetCoord(0.,0.,0.);
- aIt.Initialize(aLV);
- for (; aIt.More(); aIt.Next()) {
- aVx=TopoDS::Vertex(aIt.Value());
- aP3D=BRep_Tool::Pnt(aVx);
- aGC+=aP3D.XYZ();
- }
- aGC/=(Standard_Real)aNbV;
- aPGC.SetXYZ(aGC);
- //
- // tolerance value
- aDmax=-1.;
- aIt.Initialize(aLV);
- for (; aIt.More(); aIt.Next()) {
- aVx=TopoDS::Vertex(aIt.Value());
- aP3D=BRep_Tool::Pnt(aVx);
- aTolV=BRep_Tool::Tolerance(aVx);
- aD=aPGC.Distance(aP3D)+aTolV;
- if (aD>aDmax) {
- aDmax=aD;
- }
- }
- //
- aBB.MakeVertex (aNewVertex, aPGC, aDmax);
-}
-
-//=======================================================================
-// function:EENewVertices
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex,
- const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
-{
- Standard_Integer i, aNewShape, nE1, nE2;
- Standard_Real aT1, aT2;
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- BOPTools_Pave aPave;
- //
- BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
- //
- // one new vertex case is treated in usual way
- //
- // Insert New Vertex in DS;
- myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
- aNewShape=myDS->NumberOfInsertedShapes();
- myDS->SetState (aNewShape, BooleanOperations_ON);
- // Insert New Vertex in EE Interference
- i=aMapVI.FindFromKey(aNewVertex);
- BOPTools_EEInterference& aEEInterf= aEEs(i);
- aEEInterf.SetNewShape(aNewShape);
- // Extact interference info
- aEEInterf.Indices(nE1, nE2);
- const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt();
- VertexParameters(aCPart, aT1, aT2);
- //
- // Add Paves to the myPavePoolNew
- aPave.SetInterference(i);
- aPave.SetType (BooleanOperations_EdgeEdge);
- aPave.SetIndex(aNewShape);
- // Pave for edge nE1
- aPave.SetParam(aT1);
- BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1));
- aPaveSet1.Append(aPave);
- // Pave for edge nE2
- aPave.SetParam(aT2);
- BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2));
- aPaveSet2.Append(aPave);
-}
-
-//=======================================================================
-// function: RefinePavePool
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::RefinePavePool()
-{
- Standard_Integer i, aNbNew;
-
- for (i=1; i<=myNbSources; i++) {
-
- if ((myDS->GetShape(i)).ShapeType()==TopAbs_EDGE) {
- BOPTools_PaveSet& aPS= myPavePool(myDS->RefEdge(i));
- //
- BOPTools_PaveSet& aNewPS= myPavePoolNew(myDS->RefEdge(i));
- BOPTools_ListOfPave& aNewLP=aNewPS.ChangeSet();
- //
- aNbNew=aNewLP.Extent();
- if (aNbNew) {
- BOPTools_ListIteratorOfListOfPave anIt(aNewLP);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_Pave& aPave=anIt.Value();
- aPS.Append(aPave);
- }
- // Clear the ListOfPaveBlock
- BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(i));
- aLPB.Clear();
- // Prepare the paveBlocks for that egde again
- PreparePaveBlocks(i);
- }
- aNewLP.Clear();
- }
- }
-}
-
-//=======================================================================
-// function: PreparePaveBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PreparePaveBlocks(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2)
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean bOk1, bOk2, bOk3, bFlag;
- Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits;
- TColStd_MapOfInteger aMap;
- //
- bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ;
- bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ;
- bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ;
- if (!bOk1 && !bOk2 && !bOk3) {// error: Type mismatch
- return;
- }
- //
- aNb=bOk2 ? 2 : 1;
- //
- myDSIt->Initialize(aType1, aType2);
- for (; myDSIt->More(); myDSIt->Next()) {
- myDSIt->Current(n1, n2, bFlag);
- //
- nE[0]=n1;
- nE[1]=n2;
- if (myDS->GetShapeType(n1)!=TopAbs_EDGE) {
- nE[0]=n2;
- nE[1]=n1;
- }
- //
- for (i=0; i<aNb; ++i) {
- BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE[i]));
- aNbSplits=aLPB.Extent();
- if (!aNbSplits) {
- if (aMap.Add(nE[i])) {
- PreparePaveBlocks(nE[i]);
- if (!myIsDone) {
- return;
- }
- }
- }
- }
- }// for (; myDSIt.More(); myDSIt.Next())
- myIsDone=Standard_True;
-}
-
-//=======================================================================
-// function: PreparePaveBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE)
-{
- myIsDone=Standard_False;
- //
- char buf[512];
- Standard_Integer nV1, nV2, iErr;
- TopoDS_Edge aE;
- TopoDS_Vertex aV1, aV2;
- //
- BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
- // Edge
- aE=TopoDS::Edge(myDS->Shape(nE));
- if (NMTTools_Tools::IsDegenerated(aE)) {
- myIsDone=Standard_True;
- return;
- }
- //
- BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE));
- //
- BOPTools_PaveBlockIterator aPBIt(nE, aPS);
- for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPB=aPBIt.Value();
- const IntTools_Range& aRange=aPB.Range();
- //
- const BOPTools_Pave& aPave1=aPB.Pave1();
- nV1=aPave1.Index();
- aV1=TopoDS::Vertex(myDS->GetShape(nV1));
- //
- const BOPTools_Pave& aPave2=aPB.Pave2();
- nV2=aPave2.Index();
- aV2=TopoDS::Vertex(myDS->GetShape(nV2));
- //
- // ShrunkRange
- IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext);
- iErr=aSR.ErrorStatus();
- if (!aSR.IsDone()) {
- sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE);
- BOPTColStd_Dump::PrintMessage(buf);
- sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE);
- throw
- BOPTColStd_Failure(buf) ;
- }
- //
- if (iErr==6) {
- sprintf(buf,
- "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE);
- BOPTColStd_Dump::PrintMessage(buf);
- }
- else {
- // Check left paves and correct ShrunkRange if it is necessary
- CorrectShrunkRanges (0, aPave1, aSR);
- CorrectShrunkRanges (1, aPave2, aSR);
- }
- //
- aPB.SetShrunkRange(aSR);
- aLPB.Append(aPB);
- } //for (; aPBIt.More(); aPBIt.Next())
- myIsDone=Standard_True;
-}
-
-//=======================================================================
-// function: CorrectShrunkRanges
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::CorrectShrunkRanges(const Standard_Integer aSide,
- const BOPTools_Pave& aPave,
- IntTools_ShrunkRange& aShrunkRange)
-{
- BooleanOperations_KindOfInterference aType;
- Standard_Integer anIndexInterf ;
- //
- aType=aPave.Type();
- if (aType!=BooleanOperations_EdgeEdge) {
- return;
- }
- //
- anIndexInterf=aPave.Interference();
- if (anIndexInterf<0) {
- // it can be EE interf between E and (e1,e2,..en) -> vertex
- // so we can't decide which aEE.CommonPrt() we should take.
- return;
- }
-
- BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
- const BOPTools_EEInterference& aEE=aEEs(anIndexInterf);
- const IntTools_CommonPrt& aCP=aEE.CommonPrt();
- const TopoDS_Edge& aE1=aCP.Edge1();
- const TopoDS_Edge& aE2=aCP.Edge2();
-
- const IntTools_Range& aSR=aShrunkRange.ShrunkRange();
- const TopoDS_Edge& aE=aShrunkRange.Edge();
-
- IntTools_Range aNewRange;
- IntTools_Range aCPRange;
-
- if (aE1.IsSame(aE)) {
- const IntTools_Range& aR1=aCP.Range1();
- aCPRange=aR1;
- }
- if (aE2.IsSame(aE)) {
- const IntTools_SequenceOfRanges& aSeqR=aCP.Ranges2();
- const IntTools_Range& aR2=aSeqR(1);
- aCPRange=aR2;
- }
- //
- Standard_Real aCoeff=1.05, tV, tNV;
- tV=aPave.Param();
- if (aSide==0) { // Left
- if (aCPRange.Last() > aSR.First()) {
- tNV=aCPRange.Last();
- tNV=tV+aCoeff*(tNV-tV);
- aNewRange.SetFirst(tNV);
- aNewRange.SetLast (aSR.Last());
- if(aNewRange.First() < aNewRange.Last()) {
- aShrunkRange.SetShrunkRange(aNewRange);
- }
- }
- }
- else { // Right
- if (aCPRange.First() < aSR.Last()) {
- tNV=aCPRange.First();
- tNV=tV-aCoeff*(tV-tNV);
- aNewRange.SetFirst(aSR.First());
- aNewRange.SetLast (tNV);
-
- if(aNewRange.First() < aNewRange.Last()) {
- aShrunkRange.SetShrunkRange(aNewRange);
- }
- }
- }
-}
-
-//=======================================================================
-// function: IsBlocksCoinside
-// purpose:
-//=======================================================================
-Standard_Boolean NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,
- const BOPTools_PaveBlock& aPB2) const
-{
- Standard_Boolean bRetFlag=Standard_True;
- Standard_Real aTolV11, aTolV12, aTolV21, aTolV22;
- Standard_Real d1121, d1122, d1222, d1221, aTolSum, aCoeff=1.05;
- gp_Pnt aP11, aP12, aP21, aP22;
-
- const TopoDS_Vertex aV11=TopoDS::Vertex(myDS->Shape(aPB1.Pave1().Index()));//mpv
- const TopoDS_Vertex aV12=TopoDS::Vertex(myDS->Shape(aPB1.Pave2().Index()));//mpv
- const TopoDS_Vertex aV21=TopoDS::Vertex(myDS->Shape(aPB2.Pave1().Index()));//mpv
- const TopoDS_Vertex aV22=TopoDS::Vertex(myDS->Shape(aPB2.Pave2().Index()));//mpv
-
- aTolV11=BRep_Tool::Tolerance(aV11);
- aTolV12=BRep_Tool::Tolerance(aV12);
- aTolV21=BRep_Tool::Tolerance(aV21);
- aTolV22=BRep_Tool::Tolerance(aV22);
-
- aP11=BRep_Tool::Pnt(aV11);
- aP12=BRep_Tool::Pnt(aV12);
- aP21=BRep_Tool::Pnt(aV21);
- aP22=BRep_Tool::Pnt(aV22);
-
- d1121=aP11.Distance(aP21);
- aTolSum=aCoeff*(aTolV11+aTolV21);
- if (d1121<aTolSum) {
- d1222=aP12.Distance(aP22);
- aTolSum=aCoeff*(aTolV12+aTolV22);
- if (d1222<aTolSum) {
- return bRetFlag;
- }
- }
- //
- d1122=aP11.Distance(aP22);
- aTolSum=aCoeff*(aTolV11+aTolV22);
- if (d1122<aTolSum) {
- d1221=aP12.Distance(aP21);
- aTolSum=aCoeff*(aTolV12+aTolV21);
- if (d1221<aTolSum) {
- return bRetFlag;
- }
- }
- return !bRetFlag;
-}
-
-//=======================================================================
-// function: ReplaceCommonBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB)
-{
- RemoveCommonBlocks(aLCB);
- SplitCommonBlocks(aLCB);
-}
-
-//=======================================================================
-// function: SplitCommonBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB)
-{
- Standard_Integer nE;
- NMTTools_ListOfCommonBlock aLCBx;
- NMTTools_ListIteratorOfListOfCommonBlock anIt, anItCBx;
- BOPTools_ListIteratorOfListOfPaveBlock anItLPE;
- //
- anIt.Initialize(aLCB);
- for (; anIt.More(); anIt.Next()) {
- const NMTTools_CommonBlock& aCB=anIt.Value();
- //
- //XXX
- aLCBx.Clear();
- //XXX
- SplitCommonBlock(aCB, aLCBx);
- //
- anItCBx.Initialize(aLCBx);
- for (; anItCBx.More(); anItCBx.Next()) {
- const NMTTools_CommonBlock& aCBx=anItCBx.Value();
- const BOPTools_ListOfPaveBlock& aLPBx=aCBx.PaveBlocks();
- //
- anItLPE.Initialize(aLPBx);
- for (; anItLPE.More(); anItLPE.Next()) {
- const BOPTools_PaveBlock& aPBx=anItLPE.Value();
- nE=aPBx.OriginalEdge();
- NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
- aLCBE.Append(aCBx);
- }
- }
- }
- // Modified to provide the order of edges
- // in common block where the edge with max
- // tolerance value will be the first
- // Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- Standard_Integer i, iMax, aNb, aNbCB, nSp;
- Standard_Real aTolSp, aTolMax;
- BOPTools_ListOfPaveBlock *pLPBE;
- //
- aNb=myDS->NumberOfShapesOfTheObject();
- for (nE=1; nE<=aNb; ++nE) {
- const TopoDS_Shape& aE=myDS->Shape(nE);
- if (aE.ShapeType()!=TopAbs_EDGE) {
- continue;
- }
- //
- NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
- aNbCB=aLCBE.Extent();
- if (!aNbCB) {
- continue;
- }
- //
- anIt.Initialize(aLCBE);
- for (; anIt.More(); anIt.Next()) {
- NMTTools_CommonBlock& aCBE=anIt.ChangeValue();
- const BOPTools_ListOfPaveBlock& aLPBE=aCBE.PaveBlocks();
- //
- aTolMax=-1.;
- anItLPE.Initialize(aLPBE);
- for (i=0; anItLPE.More(); anItLPE.Next(), ++i) {
- const BOPTools_PaveBlock& aPB=anItLPE.Value();
- nSp=aPB.OriginalEdge();
- const TopoDS_Edge& aSp=TopoDS::Edge(myDS->Shape(nSp));
- aTolSp=BRep_Tool::Tolerance(aSp);
- if (aTolSp>aTolMax) {
- iMax=i;
- aTolSp=aTolMax;
- }
- }
- //
- BOPTools_ListOfPaveBlock aLPBx;
- //
- anItLPE.Initialize(aLPBE);
- for (i=0; anItLPE.More(); anItLPE.Next(), ++i) {
- const BOPTools_PaveBlock& aPB=anItLPE.Value();
- if (i==iMax) {
- aLPBx.Prepend(aPB);
- }
- else {
- aLPBx.Append(aPB);
- }
- }
- //
- pLPBE=(BOPTools_ListOfPaveBlock *)&aLPBE;
- pLPBE->Clear();
- pLPBE->Append(aLPBx);
- }//for (; anIt.More(); anIt.Next()) {
- }//for (nE=1; nE<=aNb; ++nE) {
- // Contribution of Samtech www.samcef.com END
-}
-
-//=======================================================================
-// function: RemoveCommonBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB)
-{
- Standard_Integer nE;
- NMTTools_ListOfCommonBlock aLCBx;
- NMTTools_ListIteratorOfListOfCommonBlock anItCB, anItCBE;
- BOPTools_ListIteratorOfListOfPaveBlock anItLPB;
- //
- anItCB.Initialize(aLCB);
- for (; anItCB.More(); anItCB.Next()) {
- const NMTTools_CommonBlock& aCB=anItCB.Value();
- const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
- //
- // Remove aCB from each edge
- anItLPB.Initialize(aLPB);
- for (; anItLPB.More(); anItLPB.Next()) {
- const BOPTools_PaveBlock& aPB=anItLPB.Value();
- nE=aPB.OriginalEdge();
- //
- NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
- anItCBE.Initialize(aLCBE);
- for (; anItCBE.More(); anItCBE.Next()) {
- const NMTTools_CommonBlock& aCBE=anItCBE.Value();
- if (aCBE.IsEqual(aCB)) {
- aLCBE.Remove(anItCBE);
- break;
- }
- }
- }
- }
-}
-
-//=======================================================================
-// function: SplitCommonBlock
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB,
- NMTTools_ListOfCommonBlock& aLCBx)
-{
- Standard_Boolean bIsCoincided;
- Standard_Integer i, j,nE, aNbE, aNbSPBx, aNbPB, k;
- BOPTools_SequenceOfPaveBlock aSPBx;
- BOPTools_ListIteratorOfListOfPaveBlock anItLPB;
- BOPTools_ListIteratorOfListOfPave anIt;
- BOPTools_PaveBlockIterator anPBIt;
- //
- const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
- aNbE=aLPB.Extent();
- //
- // 1. Checking: Whether we realy need to split the common block ?
- anItLPB.Initialize(aLPB);
- for (; anItLPB.More(); anItLPB.Next()) {
- const BOPTools_PaveBlock& aPB=anItLPB.Value();
- nE=aPB.OriginalEdge();
- BOPTools_PaveSet& aPSE=myPavePoolNew(myDS->RefEdge(nE));
- aPSE.SortSet();
- //
- BOPTools_PaveSet aPSx;
- //
- const BOPTools_ListOfPave& aLPE=aPSE.Set();
- anIt.Initialize(aLPE);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_Pave& aPx=anIt.Value();
- if (aPB.IsInBlock(aPx)) {
- aPSx.Append(aPx);
- }
- }
- aNbPB=aPSx.Set().Extent();
- break;
- }
- //
- if (!aNbPB) {
- // we need not split it
- aLCBx.Append(aCB);
- return;
- }
- //
- // 2. Get sequence of pave Blocks containing all new pave blocks
- // for each edges's source pave Block
- anItLPB.Initialize(aLPB);
- for (; anItLPB.More(); anItLPB.Next()) {
- const BOPTools_PaveBlock& aPB=anItLPB.Value();
- const BOPTools_Pave& aPave1=aPB.Pave1();
- const BOPTools_Pave& aPave2=aPB.Pave2();
- nE=aPB.OriginalEdge();
- //
- BOPTools_PaveSet aPSx;
- //
- // the set aPsx will contain bounadry paves aPave1, aPave2 and
- // all paves of the edge nE that are inside block aPB
- aPSx.Append(aPave1);
- aPSx.Append(aPave2);
- //
- BOPTools_PaveSet& aPSE=myPavePoolNew(myDS->RefEdge(nE));
- aPSE.SortSet();
- //
- const BOPTools_ListOfPave& aLPE=aPSE.Set();
- anIt.Initialize(aLPE);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_Pave& aPx=anIt.Value();
- if (aPB.IsInBlock(aPx)) {
- aPSx.Append(aPx);
- }
- }
- //
- // Form pave blocks from aPSx and collect them in aSPBx
- anPBIt.Initialize(nE, aPSx);
- for (; anPBIt.More(); anPBIt.Next()) {
- const BOPTools_PaveBlock& aPBx=anPBIt.Value();
- aSPBx.Append(aPBx);
- }
- }
- //
- // 3. Do new common blocks
- //
- const TColStd_ListOfInteger& aLF=aCB.Faces();
- aNbSPBx=aSPBx.Length();
- aNbPB=aNbSPBx/aNbE;
- //
- Standard_Integer k1, k2, n11, n12, n21, n22;
- //
- for (i=1; i<=aNbPB; ++i) {
- NMTTools_CommonBlock aCBx;
- //
- aCBx.AddFaces(aLF);
- //
- const BOPTools_PaveBlock& aPB1=aSPBx(i);
- n11=aPB1.Pave1().Index();
- n12=aPB1.Pave2().Index();
- //
- aCBx.AddPaveBlock(aPB1);
- //
- for (j=2; j<=aNbE; ++j) {
- k1=(j-1)*aNbPB+1;
- k2=k1+aNbPB-1;
- for(k=k1; k<=k2; ++k) {
- const BOPTools_PaveBlock& aPB2=aSPBx(k);
- n21=aPB2.Pave1().Index();
- n22=aPB2.Pave2().Index();
- if ((n21==n11 && n22==n12) || (n21==n12 && n22==n11)) {
- //modified by NIZNHY-PKV Thu Nov 11 08:13:24 2010f
- bIsCoincided=CheckCoincidence(aPB2, aPB1);
- if (bIsCoincided) {
- aCBx.AddPaveBlock(aPB2);
- break;
- }
- //aCBx.AddPaveBlock(aPB2);
- //break;
- //modified by NIZNHY-PKV Thu Nov 11 08:13:31 2010t
- }
- }
- }
- aLCBx.Append(aCBx);
- }
-}
-
-//=======================================================================
-// function: VertexParameters
-// purpose:
-//=======================================================================
-void VertexParameters(const IntTools_CommonPrt& aCPart,
- Standard_Real& aT1,
- Standard_Real& aT2)
-{
- const IntTools_Range& aR1=aCPart.Range1();
- aT1=0.5*(aR1.First()+aR1.Last());
- //
- if((aCPart.VertexParameter1() >= aR1.First()) &&
- (aCPart.VertexParameter1() <= aR1.Last())) {
- aT1 = aCPart.VertexParameter1();
- }
- //
- const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2();
- const IntTools_Range& aR2=aRanges2(1);
- aT2=0.5*(aR2.First()+aR2.Last());
- //
- if((aCPart.VertexParameter2() >= aR2.First()) &&
- (aCPart.VertexParameter2() <= aR2.Last())) {
- aT2 = aCPart.VertexParameter2();
- }
-}
-
-//=======================================================================
-// function: KeepPave
-// purpose:
-//=======================================================================
-Standard_Boolean IsOnPave(const Standard_Real& aT1,
- const IntTools_Range& aRange,
- const Standard_Real& aTolerance)
-{
- Standard_Boolean firstisonpave1, firstisonpave2, bIsOnPave;
- //
- firstisonpave1 = (Abs(aRange.First() - aT1) < aTolerance);
- firstisonpave2 = (Abs(aRange.Last() - aT1) < aTolerance);
- bIsOnPave=(firstisonpave1 || firstisonpave2);
- return bIsOnPave;
-}
-
-//=======================================================================
-// function:FindChains
-// purpose:
-//=======================================================================
-void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
- NMTTools_ListOfCommonBlock& aLCB)
-{
- Standard_Integer i, j, aNbCB, aNbPB;
- BOPTools_IMapOfPaveBlock aProcessedBlocks, aChain;
- //
- aNbCB=aMapCB.Extent();
- for (i=1; i<=aNbCB; ++i) {
- const BOPTools_PaveBlock& aPB=aMapCB.FindKey(i);
- if (aProcessedBlocks.Contains(aPB)) {
- continue;
- }
- //
- aProcessedBlocks.Add(aPB);
- aChain.Add(aPB);
- //
- const BOPTools_IMapOfPaveBlock& aMapPB=aMapCB(i);
- aNbPB=aMapPB.Extent();
- for (j=1; j<=aNbPB; ++j) {
- const BOPTools_PaveBlock& aPBx=aMapPB(j);
- ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain);
- }
- //
- NMTTools_CommonBlock aCB;
- //
- aNbPB=aChain.Extent();
- for (j=1; j<=aNbPB; ++j) {
- const BOPTools_PaveBlock& aPBx=aChain(j);
- aCB.AddPaveBlock(aPBx);
- }
- aLCB.Append(aCB);
- aChain.Clear();
- }
-}
-
-//=======================================================================
-// function:ProcessBlock
-// purpose:
-//=======================================================================
-void ProcessBlock(const BOPTools_PaveBlock& aPB,
- const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
- BOPTools_IMapOfPaveBlock& aProcessedBlocks,
- BOPTools_IMapOfPaveBlock& aChain)
-{
- Standard_Integer j, aNbPB;
- //
- if (aProcessedBlocks.Contains(aPB)) {
- return;
- }
- aProcessedBlocks.Add(aPB);
- aChain.Add(aPB);
- //
- const BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.FindFromKey(aPB);
- aNbPB=aMapPB.Extent();
- for (j=1; j<=aNbPB; ++j) {
- const BOPTools_PaveBlock& aPBx=aMapPB(j);
- ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain);
- }
-}
-// Modified to provide VS interference between
-// vertex as result of EE and a Face of argument
-// Thu Sep 14 14:35:18 2006
-// Contribution of Samtech www.samcef.com BEGIN
-//=======================================================================
-// function: PerformVF1
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PerformVF1()
-{
- Standard_Integer i, aNbEE, n1, n2, nNewShape, aNbS, nF;
- Standard_Integer anIndexIn, aFlag;
- Standard_Real aU, aV;
- TColStd_ListOfInteger aLFI;
- TColStd_ListIteratorOfListOfInteger aItLFI;
- //
- BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences();
- BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
- //
- aNbS=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=aNbS; ++i) {
- const TopoDS_Shape& aF=myDS->Shape(i);
- if (aF.ShapeType()==TopAbs_FACE) {
- aLFI.Append(i);
- }
- }
- if (!aLFI.Extent()) {
- return;
- }
- //
- aNbEE=aEEs.Extent();
- for (i=1; i<=aNbEE; ++i) {
- BOPTools_EEInterference& aEE=aEEs(i);
- aEE.Indices(n1, n2);
- nNewShape=aEE.NewShape();
- if (!nNewShape) {
- continue;
- }
- //
- const TopoDS_Shape& aSnew=myDS->Shape(nNewShape);
- if (aSnew.ShapeType()!=TopAbs_VERTEX) {
- continue;
- }
- //
- const TopoDS_Vertex& aVnew=TopoDS::Vertex(aSnew);
- //
- Bnd_Box aBV;
- //
- BRepBndLib::Add(aVnew, aBV);
- //
- aItLFI.Initialize(aLFI);
- for (; aItLFI.More(); aItLFI.Next()) {
- nF=aItLFI.Value();
- //
- const TopoDS_Face& aF=TopoDS::Face(myDS->Shape(nF));
- const Bnd_Box& aBF=myDS->GetBoundingBox(nF);
- if (aBF.IsOut(aBV)) {
- continue;
- }
- //
- anIndexIn=0;
- aFlag=myContext->ComputeVS (aVnew, aF, aU, aV);
- if (!aFlag) {
- BOPTools_VSInterference anInterf (nNewShape, nF, aU, aV);
- //
- anIndexIn=aVSs.Append(anInterf);
- BOPTools_VSInterference& aVS=aVSs(anIndexIn);
- aVS.SetNewShape(nNewShape);//->
- }
- }
- }
-}
-// Contribution of Samtech www.samcef.com END
-//modified by NIZNHY-PKV Thu Nov 11 08:13:48 2010f
-//=======================================================================
-// function: CheckCoincidence
-// purpose:
-//=======================================================================
-Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPB1,
- const BOPTools_PaveBlock& aPB2)
-{
- Standard_Boolean bRet;
- Standard_Integer nE1, nE2, aNbPoints;
- Standard_Real aT11, aT12, aT21, aT22, aT1m, aD, aTol, aT2x;
- gp_Pnt aP1m;
- //
- bRet=Standard_False;
- //
- aT11=aPB1.Pave1().Param();
- aT12=aPB1.Pave2().Param();
- aT1m=IntTools_Tools::IntermediatePoint (aT11, aT12);
- nE1=aPB1.OriginalEdge();
- const TopoDS_Edge& aE1=(*(TopoDS_Edge*)(&myDS->Shape(nE1)));
- BOPTools_Tools::PointOnEdge(aE1, aT1m, aP1m);
- //
- aT21=aPB2.Pave1().Param();
- aT22=aPB2.Pave2().Param();
- nE2=aPB2.OriginalEdge();
- const TopoDS_Edge& aE2=(*(TopoDS_Edge*)(&myDS->Shape(nE2)));
- //
- GeomAPI_ProjectPointOnCurve& aPPC=myContext->ProjPC(aE2);
- aPPC.Perform(aP1m);
- aNbPoints=aPPC.NbPoints();
- if (aNbPoints) {
- aD=aPPC.LowerDistance();
- //
- aTol=BRep_Tool::Tolerance(aE1);
- aTol=aTol+BRep_Tool::Tolerance(aE2);
- if (aD<aTol) {
- aT2x=aPPC.LowerDistanceParameter();
- if (aT2x>aT21 && aT2x<aT22) {
- return !bRet;
- }
- }
- }
- return bRet;
-}
-//modified by NIZNHY-PKV Thu Nov 11 08:13:55 2010t
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_5.cxx
-// Created: Mon Dec 15 11:28:33 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-
-#include <Bnd_Box.hxx>
-
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Compound.hxx>
-
-#include <TopExp.hxx>
-
-#include <TopTools_IndexedMapOfShape.hxx>
-
-#include <IntTools_ShrunkRange.hxx>
-#include <IntTools_Range.hxx>
-#include <IntTools_EdgeFace.hxx>
-#include <IntTools_SequenceOfCommonPrts.hxx>
-#include <IntTools_CommonPrt.hxx>
-#include <IntTools_Tools.hxx>
-#include <IntTools_Context.hxx>
-
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
-#include <BooleanOperations_OnceExplorer.hxx>
-
-#include <BOPTools_Tools.hxx>
-#include <BOPTools_Pave.hxx>
-#include <BOPTools_PaveSet.hxx>
-#include <BOPTools_ListOfPave.hxx>
-#include <BOPTools_ListIteratorOfListOfPave.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_ESInterference.hxx>
-
-#include <BOPTools_CArray1OfVVInterference.hxx>
-#include <BOPTools_CArray1OfESInterference.hxx>
-#include <BOPTools_VVInterference.hxx>
-#include <BOPTools_ESInterference.hxx>
-#include <BOPTools_IDMapOfPaveBlockIMapOfInteger.hxx>
-#include <BOPTools_IMapOfPaveBlock.hxx>
-#include <BRepTools.hxx>
-
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_CommonBlockAPI.hxx>
-#include <NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx>
-#include <NMTTools_CommonBlockAPI.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_Tools.hxx>
-
-
-static
- void VertexParameter(const IntTools_CommonPrt& aCPart,
- Standard_Real& aT);
-static
- Standard_Boolean IsOnPave(const Standard_Real& aTR,
- const IntTools_Range& aCPRange,
- const Standard_Real& aTolerance);
-//
-//=======================================================================
-// function: PerformEF
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PerformEF()
-{
- Standard_Boolean bJustAdd;
- Standard_Integer n1, n2, anIndexIn, nE, nF, aNbEFs, aBlockLength;
- Standard_Integer aDiscretize;
- Standard_Real aTolE, aTolF, aDeflection;
- BooleanOperations_IndexedDataMapOfShapeInteger aMapVI;
- BOPTools_IDMapOfPaveBlockIMapOfInteger aMapCB;
- BOPTools_IMapOfPaveBlock aIMPBx;
- //
- myIsDone=Standard_False;
- aDeflection=0.01;
- aDiscretize=35;
- //
- BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
- //
- myDSIt->Initialize(TopAbs_EDGE, TopAbs_FACE);
- //
- // BlockLength correction
- aNbEFs=myDSIt->BlockLength();
- aBlockLength=aEFs.BlockLength();
- if (aNbEFs > aBlockLength) {
- aEFs.SetBlockLength(aNbEFs);
- }
- //
- for (; myDSIt->More(); myDSIt->Next()) {
- myDSIt->Current(n1, n2, bJustAdd);
- //
- if(bJustAdd) {
- continue;
- }
- //
- anIndexIn = 0;
- //
- nE=n1;
- nF=n2;
- if (myDS->GetShapeType(n2)==TopAbs_EDGE) {
- nE=n2;
- nF=n1;
- }
- //
- // all Common Blocks for face nF
- NMTTools_ListOfCommonBlock aLCBF;
- CommonBlocksFace(nF, aLCBF);
- NMTTools_CommonBlockAPI aCBAPIF(aLCBF);
- //
- // Edge
- const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
- if (NMTTools_Tools::IsDegenerated(aE)){
- continue;
- }
- //
- // Face
- const TopoDS_Face aF=TopoDS::Face(myDS->Shape(nF));
- //
- TopTools_IndexedMapOfShape aME;
- TopExp::MapShapes(aF, TopAbs_EDGE, aME);
- if (aME.Contains(aE)) {
- continue;
- }
- //
- aTolF=BRep_Tool::Tolerance(aF);
- aTolE=BRep_Tool::Tolerance(aE);
-
- const Bnd_Box& aBBF=myDS->GetBoundingBox(nF);
- //
- // Process each PaveBlock on edge nE
- BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
- //
- BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
- for (; anIt.More(); anIt.Next()) {
- BOPTools_PaveBlock& aPB=anIt.Value();
- if (aCBAPIF.IsCommonBlock(aPB)) {
- continue;
- }
- //
- const IntTools_ShrunkRange& aShrunkRange=aPB.ShrunkRange();
- const IntTools_Range& aSR =aShrunkRange.ShrunkRange();
- const Bnd_Box& aBBE=aShrunkRange.BndBox();
- //
- if (aBBF.IsOut (aBBE)) {
- continue;
- }
- //
- // EF
- IntTools_EdgeFace aEF;
- aEF.SetEdge (aE);
- aEF.SetFace (aF);
- aEF.SetTolE (aTolE);
- aEF.SetTolF (aTolF);
- aEF.SetDiscretize (aDiscretize);
- aEF.SetDeflection (aDeflection);
- //
- aEF.SetContext(myContext);
- //
- IntTools_Range anewSR = aSR;
- //
- // Correction of the Shrunk Range
- BOPTools_Tools::CorrectRange(aE, aF, aSR, anewSR);
- aEF.SetRange (anewSR);
- //
- BRepTools::Write(aE, "/dn20/salome/skv/SALOME/scripts/Dumps/edge");
- BRepTools::Write(aF, "/dn20/salome/skv/SALOME/scripts/Dumps/face");
- aEF.Perform();
- //
- if (aEF.IsDone()) {
- Standard_Boolean bCoinsideFlag;
- Standard_Integer i, aNbCPrts;
- TopAbs_ShapeEnum aType;
- //
- const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts();
- //
- aNbCPrts=aCPrts.Length();
- for (i=1; i<=aNbCPrts; ++i) {
- anIndexIn=0;
- //
- const IntTools_CommonPrt& aCPart=aCPrts(i);
- aType=aCPart.Type();
- //
- switch (aType) {
- //
- case TopAbs_VERTEX: {
- Standard_Boolean bIsOnPave1, bIsOnPave2;
- Standard_Integer nVF;
- Standard_Real aT, aTolToDecide;
- TopoDS_Vertex aNewVertex;
- //
- const IntTools_Range& aR=aCPart.Range1();
- //
- // New Vertex
- VertexParameter(aCPart, aT);
- BOPTools_Tools::MakeNewVertex(aE, aT, aF, aNewVertex);
- //
- //decide to add pave or not
- aTolToDecide=5.e-8;
- bIsOnPave1=IsOnPave(anewSR.First(), aR, aTolToDecide);
- bIsOnPave2=IsOnPave(anewSR.Last() , aR, aTolToDecide);
- //
- if (!bIsOnPave1 && !bIsOnPave2) {
- nVF=CheckFacePaves(aNewVertex, nF);
- if (!nVF) {
- // really new vertex
- // Add Interference to the Pool
- BOPTools_ESInterference anInterf (nE, nF, aCPart);
- anIndexIn=aEFs.Append(anInterf);
- anInterf.SetNewShape(0);
- //
- aMapVI.Add(aNewVertex, anIndexIn);
- aIMPBx.Add(aPB);
- //
- myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF);
- //
- }// if (!nVF)
- }// if (!bIsOnPave1 && !bIsOnPave2)
- //
- //modified by NIZNHY-PKV Fri Apr 18 10:55:38 2008f
- else {
- const BOPTools_Pave& aPave=(bIsOnPave1)? aPB.Pave1() : aPB.Pave2();
- nVF=aPave.Index();
- const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF));
- BOPTools_Tools::UpdateVertex (aVF, aNewVertex);
- }
- //modified by NIZNHY-PKV Fri Apr 18 10:55:40 2008t
- //
- }// case TopAbs_VERTEX:
- break;
- //
- case TopAbs_EDGE: {
- bCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext);
- if (!bCoinsideFlag) {
- break;
- }
- //
- // Fill aMapCB
- if (aMapCB.Contains(aPB)) {
- TColStd_IndexedMapOfInteger& aMapF=aMapCB.ChangeFromKey(aPB);
- aMapF.Add(nF);
- }
- else {
- TColStd_IndexedMapOfInteger aMapF;
- aMapF.Add(nF);
- aMapCB.Add(aPB, aMapF);
- }
- //
- aIMPBx.Add(aPB);
- myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF);
- }// case TopAbs_EDGE:
- break;
-
- default:
- break;
- } // switch (aType)
- } // for (i=1; i<=aNbCPrts; i++)
- } //if (aEF.IsDone())
- } // for (; anIt.More(); anIt.Next())
- }// for (; myDSIt.More(); myDSIt.Next())
- //
- // Treat New vertices
- EFNewVertices(aMapVI);
- //
- // Add draft Common Blocks of EF type
- EFCommonBlocks(aMapCB);
- //
- // Collect all CB we suspected to split by new vertices
- NMTTools_ListOfCommonBlock aLCBx;
- {
- Standard_Integer i, aNbPBx, nEx;
- BOPTools_IMapOfPaveBlock aMx;
- //
- aNbPBx=aIMPBx.Extent();
- for (i=1; i<=aNbPBx; ++i) {
- const BOPTools_PaveBlock& aPBx=aIMPBx(i);
- nEx=aPBx.OriginalEdge();
- NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nEx));
- if (aLCB.Extent()) {
- NMTTools_CommonBlockAPI aCBAPIx(aLCB);
- if (aCBAPIx.IsCommonBlock(aPBx)) {
- NMTTools_CommonBlock& aCBx=aCBAPIx.CommonBlock(aPBx);
- const BOPTools_PaveBlock& aPB1=aCBx.PaveBlock1();
- if (!aMx.Contains(aPB1)){
- aMx.Add(aPB1);
- aLCBx.Append(aCBx);
- }
- }
- }
- }
- }
- //
- // Split the common blocks above
- if (aLCBx.Extent()) {
- ReplaceCommonBlocks(aLCBx);
- }
- //
- myIsDone=Standard_True;
-}
-//=======================================================================
-// function:EFCommonBlocks
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::EFCommonBlocks
- (const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB)
-{
- Standard_Integer i, aNbPB, nE, j, aNbF, nF;
- //
- aNbPB=aMapCB.Extent();
- for (i=1; i<=aNbPB; ++i) {
- const BOPTools_PaveBlock& aPB=aMapCB.FindKey(i);
- const TColStd_IndexedMapOfInteger& aMapF=aMapCB.FindFromIndex(i);
- aNbF=aMapF.Extent();
- //
- nE=aPB.OriginalEdge();
- //
- NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
- //
- NMTTools_CommonBlockAPI aCBAPI(aLCB);
- if (aCBAPI.IsCommonBlock(aPB)) {
- NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
- for (j=1; j<=aNbF; ++j) {
- nF=aMapF(j);
- aCB.AddFace(nF);
- }
- }
- else {
- NMTTools_CommonBlock aCB;
- //
- aCB.AddPaveBlock(aPB);
- for (j=1; j<=aNbF; ++j) {
- nF=aMapF(j);
- aCB.AddFace(nF);
- }
- aLCB.Append(aCB);
- }
- }
-}
-//=======================================================================
-// function:EFNewVertices
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::EFNewVertices
- (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
-{
- Standard_Integer i, j, aNb, aNewShape, aFlag, iX, aNbVV, aNbSimple;
- Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges, iTmp;
- Standard_Real aT;
- TopoDS_Compound aCompound;
- TopoDS_Vertex aNewVertex;
- BRep_Builder aBB;
- BOPTools_Pave aPave;
- NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEF;
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple;
- //
- aNb=aMapVI.Extent();
- if (!aNb) { // no new vertices, no new problems
- return;
- }
- //
- BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
- //
- // 0.
- if (aNb==1) {
- aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1));
- EFNewVertices(aNewVertex, aMapVI);
- return;
- }
- //
- // 1. Make compound from new vertices
- aBB.MakeCompound(aCompound);
- for (i=1; i<=aNb; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
- aBB.Add(aCompound, aV);
- }
- //
- // 2. VV intersection between these vertices
- // using the auxiliary Filler
- NMTTools_PaveFiller tPF;
- //
- tPF.SetCompositeShape(aCompound);
- //
- tPF.Init();
- tPF.PerformVV();
- //
- NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
- NMTDS_InterfPool& tInterfPool=*(tPF.IP());
- BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterferences();
- //
- // 3. Separate Comlex and Simple new vertices
- aNbVV=aVVInterfs.Extent();
- for (i=1; i<=aNbVV; ++i) {
- const BOPTools_VVInterference& aVV=aVVInterfs(i);
- aVV.Indices(aWhat, aWith);
- const TopoDS_Shape& aV1=tDS.Shape(aWhat);
- const TopoDS_Shape& aV2=tDS.Shape(aWith);
- aMNVComplex.Add(aV1);
- aMNVComplex.Add(aV2);
- }
- //
- for (i=1; i<=aNb; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
- if (!aMNVComplex.Contains(aV)) {
- aMNVSimple.Add(aV);
- }
- }
- //
- // 4. Treat Simple new Vertices
- aNbSimple=aMNVSimple.Extent();
- for (i=1; i<=aNbSimple; ++i) {
- const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i));
- EFNewVertices(aV, aMapVI);
- }
- //
- // 3. Fill Maps : NewVertex-edges (aMNVE)
- // NewVertex-interferences (aMNVIEE)
- aNb=aVVInterfs.Extent();
- for (i=1; i<=aNb; ++i) {
- const BOPTools_VVInterference& aVV=aVVInterfs(i);
- aNewShape=aVV.NewShape();
- if (!aNewShape) {
- continue;
- }
- //
- if (!aMNVE.Contains(aNewShape)) {
- TColStd_IndexedMapOfInteger aMx;
- aMNVE.Add(aNewShape, aMx);
- }
- if (!aMNVIEF.Contains(aNewShape)) {
- TColStd_IndexedMapOfInteger aMx;
- aMNVIEF.Add(aNewShape, aMx);
- }
- //
- TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape);
- TColStd_IndexedMapOfInteger& aMIEF=aMNVIEF.ChangeFromKey(aNewShape);
- //
- aVV.Indices(aWhat, aWith);
- //aWhat
- const TopoDS_Shape& aV1=tDS.Shape(aWhat);
- iX=aMapVI.FindFromKey(aV1);
- const BOPTools_ESInterference& aEF1=aEFs(iX);
- aEF1.Indices(nE, nF);
- //
- if (myDS->GetShapeType(nF)==TopAbs_EDGE) {
- iTmp=nE;
- nE=nF;
- nF=iTmp;
- }
- aME.Add(nE);
- aMIEF.Add(iX);
- //aWith
- const TopoDS_Shape& aV2=tDS.Shape(aWith);
- iX=aMapVI.FindFromKey(aV2);
- const BOPTools_ESInterference& aEF2=aEFs(iX);
- aEF2.Indices(nE, nF);
- //
- if (myDS->GetShapeType(nF)==TopAbs_EDGE) {
- iTmp=nE;
- nE=nF;
- nF=iTmp;
- }
- aME.Add(nE);
- aMIEF.Add(iX);
- }// for (i=1; i<=aNb; ++i) {
- //
- // 4. Process new vertices
- aNb=aMNVE.Extent();
- for (i=1; i<=aNb; ++i) { // xx
- //
- // new Vertex
- nV=aMNVE.FindKey(i);
- aNewVertex=TopoDS::Vertex(tDS.Shape(nV));
- //
- // Insert New Vertex in DS;
- myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
- aNewShape=myDS->NumberOfInsertedShapes();
- myDS->SetState (aNewShape, BooleanOperations_ON);
- //
- // Update index of NewShape in EF interferences
- const TColStd_IndexedMapOfInteger& aMIEF=aMNVIEF.FindFromKey(nV);
- aNbIEF=aMIEF.Extent();
- for (j=1; j<=aNbIEF; ++j) {
- iX=aMIEF(j);
- BOPTools_ESInterference& aEF=aEFs(iX);
- aEF.SetNewShape(aNewShape);
- }
- //
- // Update Paves on all edges
- const TColStd_IndexedMapOfInteger& aME=aMNVE(i);
- aNbEdges=aME.Extent();
- for (j=1; j<=aNbEdges; ++j) {
- nE=aME(j);
- const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv
- //
- aFlag=myContext->ComputeVE (aNewVertex, aE, aT);
- //
- if (!aFlag) {
- aPave.SetInterference(-1);
- aPave.SetType (BooleanOperations_EdgeSurface);
- aPave.SetIndex(aNewShape);
- aPave.SetParam(aT);
- //
- BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE));
- aPaveSet.Append(aPave);
- }
- }
- }
-}
-//=======================================================================
-// function:EFNewVertices
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::EFNewVertices
- (const TopoDS_Vertex& aNewVertex,
- const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
-{
- Standard_Integer i, aNewShape, nE, nF;
- Standard_Real aT;
- BOPTools_Pave aPave;
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- //
- BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
- //
- // Insert New Vertex in DS;
- myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
- aNewShape=myDS->NumberOfInsertedShapes();
- myDS->SetState (aNewShape, BooleanOperations_ON);
- //
- // Insert New Vertex in EFInterference
- i=aMapVI.FindFromKey(aNewVertex);
- BOPTools_ESInterference& aEFInterf= aEFs(i);
- aEFInterf.SetNewShape(aNewShape);
- // Extract interference info
- aEFInterf.Indices(nE, nF);
- if (myDS->GetShapeType(nF)==TopAbs_EDGE) {
- nE=nF;
- }
- const IntTools_CommonPrt& aCPart=aEFInterf.CommonPrt();
- VertexParameter(aCPart, aT);
- //
- // Pave for edge nE
- aPave.SetInterference(i);
- aPave.SetType (BooleanOperations_EdgeSurface);
- aPave.SetIndex(aNewShape);
- aPave.SetParam(aT);
- // Append the Pave to the myPavePoolNew
- BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE));
- aPaveSet.Append(aPave);
- //
-}
-//=======================================================================
-// function: CheckFacePaves
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::CheckFacePaves
- (const TopoDS_Vertex& aNewVertex,
- const Standard_Integer nF)
-{
- Standard_Integer nEF, nVF, iFlag, i, aNbV, iRet;
- BOPTools_ListIteratorOfListOfPave anIt;
- TColStd_IndexedMapOfInteger aMVF;
- //
- iRet=0;
- //
- BooleanOperations_OnceExplorer aExp(*myDS);
- aExp.Init(nF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nEF=aExp.Current();
- BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(nEF));
- const BOPTools_ListOfPave& aLP=aPaveSet.Set();
- anIt.Initialize(aLP);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_Pave& aPave=anIt.Value();
- nVF=aPave.Index();
- aMVF.Add(nVF);
- }
- }
- //
- aNbV=aMVF.Extent();
- for (i=1; i<=aNbV; ++i) {
- nVF=aMVF(i);
- const TopoDS_Vertex aVF=TopoDS::Vertex(myDS->Shape(nVF));
- iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF);
- if (!iFlag) {
- return nVF;
- }
- }
- return iRet;
-}
-//
-//=======================================================================
-// function: VertexParameter
-// purpose:
-//=======================================================================
-void VertexParameter(const IntTools_CommonPrt& aCPart,
- Standard_Real& aT)
-{
- const IntTools_Range& aR=aCPart.Range1();
- aT=0.5*(aR.First()+aR.Last());
- if((aCPart.VertexParameter1() >= aR.First()) &&
- (aCPart.VertexParameter1() <= aR.Last())) {
- aT = aCPart.VertexParameter1();
- }
-}
-//=======================================================================
-// function: IsOnPave
-// purpose:
-//=======================================================================
-Standard_Boolean IsOnPave(const Standard_Real& aTR,
- const IntTools_Range& aCPRange,
- const Standard_Real& aTolerance)
-{
- Standard_Boolean bIsOnPave;
- Standard_Real aT1, aT2, dT1, dT2;
- //
- aT1=aCPRange.First();
- aT2=aCPRange.Last();
- bIsOnPave=(aTR>=aT1 && aTR<=aT1);
- if (bIsOnPave) {
- return bIsOnPave;
- }
- //
- dT1=Abs(aTR-aT1);
- dT2=Abs(aTR-aT2);
- bIsOnPave=(dT1<=aTolerance || dT2<=aTolerance);
- return bIsOnPave;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_6.cxx
-// Created: Fri Dec 19 10:27:31 2003
-// Author: Peter KURNEV
-
-#include <NMTTools_PaveFiller.hxx>
-
-#include <Basics_OCCTVersion.hxx>
-
-#include <Precision.hxx>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
-
-
-#include <Geom_TrimmedCurve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <Geom2d_Curve.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <GeomAdaptor_Surface.hxx>
-#include <Geom_Surface.hxx>
-
-#include <BndLib_Add3dCurve.hxx>
-
-#include <TopoDS_Face.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-
-#include <TopExp.hxx>
-
-#include <BRepLib.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepBndLib.hxx>
-
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
-#include <BOPTColStd_IndexedDataMapOfIntegerInteger.hxx>
-
-#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-#include <BooleanOperations_OnceExplorer.hxx>
-#include <BooleanOperations_ShapesDataStructure.hxx>
-
-#include <IntTools_SequenceOfPntOn2Faces.hxx>
-#include <IntTools_SequenceOfCurves.hxx>
-#include <IntTools_FaceFace.hxx>
-#include <IntTools_Tools.hxx>
-#include <IntTools_ShrunkRange.hxx>
-#include <IntTools_Context.hxx>
-
-#include <BOPTools_CArray1OfSSInterference.hxx>
-#include <BOPTools_VSInterference.hxx>
-#include <BOPTools_ESInterference.hxx>
-#include <BOPTools_SSInterference.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPave.hxx>
-#include <BOPTools_Tools.hxx>
-#include <BOPTools_PaveBlockIterator.hxx>
-#include <BOPTools_Tools2D.hxx>
-#include <BOPTools_Tools3D.hxx>
-#include <BOPTools_Curve.hxx>
-
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-#include <NMTTools_Tools.hxx>
-#include <NMTTools_IndexedDataMapOfShapePaveBlock.hxx>
-#include <NMTTools_CommonBlock.hxx>
-#include <NMTTools_CommonBlockAPI.hxx>
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
-#include <NMTTools_DataMapOfIntegerListOfPaveBlock.hxx>
-#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
-#include <NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx>
-#include <NMTTools_MapOfPaveBlock.hxx>
-#include <NMTTools_MapIteratorOfMapOfPaveBlock.hxx>
-#include <NMTTools_FaceInfo.hxx>
-#include <NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx>
-
-static
- Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
- const Handle(IntTools_Context)& aCtx);
-
-//=======================================================================
-// function: PerformFF
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PerformFF()
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, bIsDone;
- Standard_Boolean bJustAdd, bToSplit;
- Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs;
- Standard_Integer aNbCurves, aNbPoints;
- Standard_Real anApproxTol, aTolR3D, aTolR2D;
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapWhat, aMapWith;
- IntTools_SequenceOfPntOn2Faces aPnts;
- IntTools_SequenceOfCurves aCvs;
- //
- BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
- //
- // F/F Interferences [BooleanOperations_SurfaceSurface]
- myDSIt->Initialize(TopAbs_FACE, TopAbs_FACE);
- //
- // BlockLength correction
- aNbFFs=myDSIt->BlockLength();
- aBlockLength=aFFs.BlockLength();
- if (aNbFFs > aBlockLength) {
- aFFs.SetBlockLength(aNbFFs);
- }
- //
- //modified by NIZNHY-PKV Thu Sep 15 08:02:52 2011f
- bToSplit=Standard_False;
- //modified by NIZNHY-PKV Thu Sep 15 08:02:55 2011t
- //
- for (; myDSIt->More(); myDSIt->Next()) {
- myDSIt->Current(n1, n2, bJustAdd);
- //
- nF1 = n2;
- nF2 = n1;
- if(n1 < n2) {
- nF1 = n1;
- nF2 = n2;
- }
- anIndexIn=0;
- aPnts.Clear();
- aCvs.Clear();
- //
- const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
- const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
- //
- // FF
- bToApproxC3d = mySectionAttribute.Approximation();
- bToApproxC2dOnS1 = mySectionAttribute.PCurveOnS1();
- bToApproxC2dOnS2 = mySectionAttribute.PCurveOnS2();
- //
- anApproxTol=1.e-7;
- //
- IntTools_FaceFace aFF;
- //
- aFF.SetParameters (bToApproxC3d, bToApproxC2dOnS1,
- bToApproxC2dOnS2, anApproxTol);
- //
- aFF.Perform(aF1, aF2);
- //
- bIsDone=aFF.IsDone();
- //
- if (!bIsDone) {
- BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts);
- anIndexIn=aFFs.Append(anInterf);
- continue;
- }
- //
- aTolR3D=aFF.TolReached3d();
- aTolR2D=aFF.TolReached2d();
- if (aTolR3D < 1.e-7){
- aTolR3D=1.e-7;
- }
- //
- //modified by NIZNHY-PKV Thu Sep 15 08:03:02 2011f
-#if OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher
- aFF.PrepareLines3D(bToSplit);
-#else
- aFF.PrepareLines3D();
-#endif // OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher
- //modified by NIZNHY-PKV Thu Sep 15 08:03:04 2011t
- //
- const IntTools_SequenceOfCurves& aCvsX=aFF.Lines();
- const IntTools_SequenceOfPntOn2Faces& aPntsX=aFF.Points();
- //
- aNbCurves=aCvsX.Length();
- aNbPoints=aPntsX.Length();
- //
- if (!aNbCurves && !aNbPoints) {
- BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts);
- anIndexIn=aFFs.Append(anInterf);
- continue;
- }
- //
- {
- BOPTools_SSInterference anInterf (nF1, nF2, aTolR3D, aTolR2D, aCvsX, aPntsX);
- anIndexIn=aFFs.Append(anInterf);
- }
- //
- }// for (; myDSIt.More(); myDSIt.Next())
- //
- myIsDone=Standard_True;
-}
-
-//=======================================================================
-// function: MakeBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::MakeBlocks()
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided;
- Standard_Boolean bIsMicroEdge, bHasES;
- Standard_Integer i, aNbFFs, nF1, nF2;
- Standard_Integer nV1, nV2, j, aNbCurves;
- Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion();
- TopoDS_Face aF1, aF2;
- NMTTools_IndexedDataMapOfShapePaveBlock aMEPB;
- BooleanOperations_IndexedDataMapOfShapeInteger aMapEI;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
- //
-
- //
- // 1. Make Section Edges from intersection curves
- // between each pair of faces
- aNbFFs=aFFs.Extent();
- if (!aNbFFs) {
- return;
- }
- //
- FillFaceInfo();
- //
- for (i=1; i<=aNbFFs; ++i) {
- BOPTools_ListOfPaveBlock aLPB;
- TColStd_MapOfInteger aMVStick;
- TopTools_ListOfShape aLSE;
- TColStd_ListOfInteger aLNE;
- BOPTools_PaveSet aPSF;
- NMTTools_MapOfPaveBlock aMPBX;
- TColStd_MapIteratorOfMapOfInteger aItMI;
- NMTTools_MapIteratorOfMapOfPaveBlock aItMPB;
- //
- BOPTools_SSInterference& aFFi=aFFs(i);
- //
- // Faces
- aFFi.Indices(nF1, nF2);
- aF1=*((TopoDS_Face*)(&myDS->Shape(nF1)));
- aF2=*((TopoDS_Face*)(&myDS->Shape(nF2)));
- //
- SharedEdges(nF1, nF2, aLNE, aLSE);
- aFFi.SetSharedEdges(aLNE);
- //
- // aMVStick
- const NMTTools_FaceInfo& aFI1=myFaceInfo.Find(nF1);
- const NMTTools_FaceInfo& aFI2=myFaceInfo.Find(nF2);
- //
- const TColStd_MapOfInteger& aMVOn1=aFI1.VerticesOn();
- const TColStd_MapOfInteger& aMVIn1=aFI1.VerticesIn();
- const TColStd_MapOfInteger& aMVOn2=aFI2.VerticesOn();
- const TColStd_MapOfInteger& aMVIn2=aFI2.VerticesIn();
- //
- for (j=0; j<2; ++j) {
- const TColStd_MapOfInteger& aMV1=(!j) ? aMVOn1 :aMVIn1;
- aItMI.Initialize(aMV1);
- for (; aItMI.More(); aItMI.Next()) {
- nV1=aItMI.Key();
- if (aMVOn2.Contains(nV1) || aMVIn2.Contains(nV1)) {
- aMVStick.Add(nV1);
- }
- }
- }
- //
- // aLPB
- const NMTTools_MapOfPaveBlock& aMPBIn1=aFI1.PaveBlocksIn();
- const NMTTools_MapOfPaveBlock& aMPBOn1=aFI1.PaveBlocksOn();
- const NMTTools_MapOfPaveBlock& aMPBIn2=aFI2.PaveBlocksIn();
- const NMTTools_MapOfPaveBlock& aMPBOn2=aFI2.PaveBlocksOn();
- //
- aMPBX.Clear();
- for (j=0; j<4; ++j) {
- NMTTools_MapOfPaveBlock *pMPB;
- //
- if (!j) {
- pMPB=((NMTTools_MapOfPaveBlock*)&aMPBIn1);
- }
- else if (j==1) {
- pMPB=((NMTTools_MapOfPaveBlock*)&aMPBOn1);
- }
- else if (j==2) {
- pMPB=((NMTTools_MapOfPaveBlock*)&aMPBIn2);
- }
- else if (j==3) {
- pMPB=((NMTTools_MapOfPaveBlock*)&aMPBOn2);
- }
- //
- const NMTTools_MapOfPaveBlock& aMPB=*pMPB;
- aItMPB.Initialize(aMPB);
- for (; aItMPB.More(); aItMPB.Next()) {
- const BOPTools_PaveBlock& aPB=aItMPB.Key();
- if (aMPBX.Add(aPB)) {
- aLPB.Append(aPB);
- }
- //
- else {
- if (j>1) {
- aFFi.AppendBlock(aPB);
- }
- }
- //
- }
- }
- //
- BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
- aNbCurves=aSCvs.Length();
- if (!aNbCurves) {
- continue;
- }
- //
- aTolR3D=aFFi.TolR3D();
- aTol2D=(aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D;
- //
- CorrectTolR3D(aFFi, aMVStick, aTolR3D);
- //
- PrepareSetForFace (nF1, nF2, aLPB, aPSF);
- //
- // Put Paves On Curves
- for (j=1; j<=aNbCurves; ++j) {
- BOPTools_Curve& aBC=aSCvs(j);
- const IntTools_Curve& aC=aBC.Curve();
- // DEBUG f
- Handle(Geom_Curve) aC3D = aC.Curve();
- // DEBUG t
- PutPaveOnCurve (aPSF, aTolR3D, aBC);
- }
- //
- // Put bounding paves on curves
- for (j=1; j<=aNbCurves; ++j) {
- BOPTools_Curve& aBC=aSCvs(j);
- PutBoundPaveOnCurve (aBC, aFFi);
- }
- //modified by NIZNHY-PKV Wed Sep 14 13:12:14 2011f
-#if OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher
- //
- // Put closing pave if needded
- for (j=1; j<=aNbCurves; ++j) {
- BOPTools_Curve& aBC=aSCvs(j);
- PutClosingPaveOnCurve (aBC, aFFi);
- }
-#endif // OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher
- //modified by NIZNHY-PKV Wed Sep 14 13:12:17 2011t
- //
- // Pave Blocks on Curves
- bHasES=Standard_False;
- for (j=1; j<=aNbCurves; ++j) {
- BOPTools_Curve& aBC=aSCvs(j);
- const IntTools_Curve& aIC= aBC.Curve();
- BOPTools_PaveSet& aPaveSet=aBC.Set();
- //
- BOPTools_PaveBlockIterator aPBIter(0, aPaveSet);
- for (; aPBIter.More(); aPBIter.Next()) {
- BOPTools_PaveBlock& aPBNew=aPBIter.Value();
- aPBNew.SetCurve(aIC);
- aPBNew.SetFace1(nF1);
- aPBNew.SetFace2(nF2);
- //
- nV1=aPBNew.Pave1().Index();
- nV2=aPBNew.Pave2().Index();
- aT1=aPBNew.Pave1().Param();
- aT2=aPBNew.Pave2().Param();
- //
- if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) {
- continue;// mkk ft ???
- }
- //
- // 1
- bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D);
- if (bIsExistingPaveBlock) {
- continue;
- }
- //
- bIsCoincided=CheckCoincidence(aPBNew, aLPB);
- if(bIsCoincided) {
- continue;
- }
- //
- // 2
- bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLSE, aTolR3D);
- if (bIsExistingPaveBlock) {
- continue;
- }
- //
- // Checking of validity in 2D
- //
- bIsValidIn2D=myContext->IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTol2D);
- if (!bIsValidIn2D) {
- continue;
- }
- //
- //
- // Make Section Edge
- TopoDS_Edge aES;
- //
- const TopoDS_Vertex aV1=TopoDS::Vertex(myDS->Shape(nV1));
- const TopoDS_Vertex aV2=TopoDS::Vertex(myDS->Shape(nV2));
- //
- {
- Standard_Real aT;
- //
- myContext->IsVertexOnLine(aV1, aIC, aTolR3D, aT);
- BOPTools_Tools::UpdateVertex (aIC, aT, aV1);
- //
- myContext->IsVertexOnLine(aV2, aIC, aTolR3D, aT);
- BOPTools_Tools::UpdateVertex (aIC, aT, aV2);
- }
- //
- BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES);
- //
- NMTTools_Tools::UpdateEdge (aES, aTolR3D);
- bIsMicroEdge=IsMicroEdge(aES, myContext);
- if (bIsMicroEdge) {
- continue;
- }
- //
- {
- Handle(Geom2d_Curve) aC2D1, aC2D2;
- //
- aC2D1=aIC.FirstCurve2d();
- aC2D2=aIC.SecondCurve2d();
- //
- NMTTools_Tools::MakePCurve(aES, aF1, aC2D1);
- NMTTools_Tools::MakePCurve(aES, aF2, aC2D2);
- }
- //
- aMEPB.Add(aES, aPBNew);
- aMapEI.Add(aES, i);
- //
- bHasES=Standard_True;
- }// for (; aPBIter.More(); aPBIter.Next())
- } // end of for (j=1; j<=aNbCurves; ++j)
- // qqf
- if (bHasES) {
- myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
- }
- // qqt
- }// for (i=1; i<=aNbFFs; ++i)
- //=============================================================
- //
- // II. Post treatment
- //
- // Input data: aMEPB, aMapEI
- // Result : section edges in myDS
- //
- Standard_Integer aNbSE;
- //
- aNbSE=aMEPB.Extent();
- if (!aNbSE) {
- // there is nothing to do here
- return;
- }
- //
- BRep_Builder aBB;
- TopoDS_Compound aCompound;
- //
- // 1. Make compound from SE
- aBB.MakeCompound(aCompound);
- for (i=1; i<=aNbSE; ++i) {
- const TopoDS_Shape& aSE=aMEPB.FindKey(i);
- aBB.Add(aCompound, aSE);
- }
- //
- //
- // 2. Intersect SE using auxiliary Filler
- NMTTools_PaveFiller tPF;
- //
- tPF.SetCompositeShape(aCompound);
- //
- // 2.1.VV
- tPF.Init();
- tPF.PerformVV();
- //
- // 2.2.VE
- tPF.myPavePool.Resize (tPF.myNbEdges);
- tPF.PrepareEdges();
- tPF.PerformVE();
- //
- // 2.3.VF
- tPF.PerformVF();
- //
- // 2.4.EE
- tPF.myCommonBlockPool.Resize (tPF.myNbEdges);
- tPF.mySplitShapesPool.Resize (tPF.myNbEdges);
- tPF.myPavePoolNew .Resize (tPF.myNbEdges);
-
- tPF.PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
- tPF.PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
- //
- tPF.PerformEE();
- //
- tPF.RefinePavePool ();
- //
- tPF.myPavePoolNew.Destroy();
- //
- tPF.MakeSplitEdges();
- tPF.UpdateCommonBlocks();
- //
- // 3. Treatment of the result of intersection
- //
- Standard_Integer aNbOld, aNbLines, aNbPB, mV1, mV2, nE, mE, iFF;
- TopAbs_ShapeEnum aType;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTColStd_IndexedDataMapOfIntegerInteger aMNewOld;
- //
- const NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
- const BOPTools_SplitShapesPool& aSSP=tPF.mySplitShapesPool;
- const NMTTools_CommonBlockPool& aCBP=tPF.myCommonBlockPool;
- //
- aNbLines=tDS.NumberOfInsertedShapes();
- aNbOld=tDS.NumberOfShapesOfTheObject();
- //
- // 3.1 Links between indices in tDS and DS (kept in aMNewOld)
- //
- // 3.1.1.Old vertices [ links ]
- for (i=1; i<=aNbOld; ++i) {
- const TopoDS_Shape& aV=tDS.Shape(i);
- aType=aV.ShapeType();
- if (aType!=TopAbs_VERTEX) {
- continue;
- }
- //
- for (j=1; j<=aNbSE; ++j) {
- const BOPTools_PaveBlock& aPBSE=aMEPB(j);
- nV1=aPBSE.Pave1().Index();
- const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv
- if (aV1.IsSame(aV)) {
- aMNewOld.Add(i, nV1);
- break;
- }
- nV2=aPBSE.Pave2().Index();
- const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv
- if (aV2.IsSame(aV)) {
- aMNewOld.Add(i, nV2);
- break;
- }
- }
- }
- //
- // 3.1.2. New vertices [ links ]
- i=tDS.NumberOfSourceShapes()+1;
- for (; i<=aNbLines; ++i) {
- const TopoDS_Shape& aV=tDS.Shape(i);
- aType=aV.ShapeType();
- if (aType!=TopAbs_VERTEX) {
- continue;
- }
- //
- // Insert new vertex in myDS
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
- nV1=myDS->NumberOfInsertedShapes();
- // link
- aMNewOld.Add(i, nV1);
- }
- //
- // 3.2. Treatment of section edges (SE)
- for (i=1; i<=aNbOld; ++i) {
- const TopoDS_Shape& aE=tDS.Shape(i);
- aType=aE.ShapeType();
- if (aType!=TopAbs_EDGE) {
- continue;
- }
- //
- // block of section edge that we already have for this SE
- BOPTools_PaveBlock& aPBSE=aMEPB.ChangeFromKey(aE);
- //
- // Corresponding FF-interference
- iFF=aMapEI.FindFromKey(aE);
- BOPTools_SSInterference& aFFi=aFFs(iFF);
- BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
- //
- BOPTools_Curve& aBC=aSCvs(1);
- //
- const BOPTools_ListOfPaveBlock& aLPB=aSSP(tDS.RefEdge(i));
- aNbPB=aLPB.Extent();
- //
- if (!aNbPB) {
- // no pave blocks -> use aPBSE and whole edge aE
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- //
- nV1=aPBSE.Pave1().Index();
- const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv
- nV2=aPBSE.Pave2().Index();
- const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv
- //
- anASSeq.SetNewSuccessor(nV1);
- anASSeq.SetNewOrientation(aV1.Orientation());
- anASSeq.SetNewSuccessor(nV2);
- anASSeq.SetNewOrientation(aV2.Orientation());
- //
- myDS->InsertShapeAndAncestorsSuccessors(aE, anASSeq);
- nE=myDS->NumberOfInsertedShapes();
- //
- aPBSE.SetEdge(nE);
- aBC.AppendNewBlock(aPBSE);
- //
- continue;
- }
- //
- nF1=aPBSE.Face1();
- nF2=aPBSE.Face2();
- //
- const NMTTools_ListOfCommonBlock& aLCB=aCBP(tDS.RefEdge(i));
- NMTTools_CommonBlockAPI aCBAPI(aLCB);
- //
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- BOPTools_PaveBlock aPB=aIt.Value();
- //
- const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));
- const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));
- //
- if (aCBAPI.IsCommonBlock(aPB)) {
- // it can be Common Block
- Standard_Real aTolEx;
- Handle(Geom2d_Curve) aC2D1, aC2D2;
- TopoDS_Face aF1FWD, aF2FWD;
- //
- NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
- //const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
- //
- aPB=aCB.PaveBlock1();
- mE=aPB.Edge(); // index of edge in tDS
- const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE));
- aTolEx=BRep_Tool::Tolerance(aEx);
- //
- aF1FWD=aF1;
- aF1FWD.Orientation(TopAbs_FORWARD);
- aF2FWD=aF2;
- aF2FWD.Orientation(TopAbs_FORWARD);
- //
- NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1);
- NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2);
- NMTTools_Tools::UpdateEdge (aEx, aTolEx);
- } //if (aCBAPI.IsCommonBlock(aPB))
- //
- // new SE
- mE=aPB.Edge(); // index of edge in tDS
- const TopoDS_Shape& aSp=tDS.Shape(mE);
- //
- const BOPTools_Pave& aPave1=aPB.Pave1();
- aT1=aPave1.Param();
- mV1=aPave1.Index(); // index in tDS
- nV1=aMNewOld.FindFromKey(mV1); // index in myDS
- const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv
- //
- const BOPTools_Pave& aPave2=aPB.Pave2();
- aT2=aPave2.Param();
- mV2=aPave2.Index();
- nV2=aMNewOld.FindFromKey(mV2);
- const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv
- //
- if (!aMNewOld.Contains(mE)) {
- // add new SE to the myDS
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- //
- anASSeq.SetNewSuccessor(nV1);
- anASSeq.SetNewOrientation(aV1.Orientation());
-
- anASSeq.SetNewSuccessor(nV2);
- anASSeq.SetNewOrientation(aV2.Orientation());
-
- myDS->InsertShapeAndAncestorsSuccessors(aSp, anASSeq);
- nE=myDS->NumberOfInsertedShapes();
- //
- aMNewOld.Add(mE, nE);
- }
- else {
- nE=aMNewOld.FindFromKey(mE);
- }
- // Form PaveBlock;
- BOPTools_PaveBlock aPBx;
- BOPTools_Pave aP1, aP2;
- //
- aPBx.SetFace1(nF1);
- aPBx.SetFace1(nF2);
- //
- aP1.SetIndex(nV1);
- aP1.SetParam(aT1);
- //
- aP2.SetIndex(nV2);
- aP2.SetParam(aT2);
- //
- aPBx.SetPave1(aP1);
- aPBx.SetPave2(aP2);
- //
- aPBx.SetEdge(nE);
- //
- aBC.AppendNewBlock(aPBx);
- }// for (; aIt.More(); aIt.Next())
- }// for (i=1; i<=aNbOld; ++i)
- //
- myIsDone=Standard_True;
-}
-
-//=======================================================================
-// function: MakePCurves
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::MakePCurves()
-{
- Standard_Integer i, aNb, nF1, nF2, nE;
- Standard_Integer aNbCB, aNbF, nSp, nF;
- TopAbs_ShapeEnum aType;
- TopoDS_Face aF1FWD, aF2FWD;
- TColStd_ListIteratorOfListOfInteger aItF;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- NMTTools_ListIteratorOfListOfCommonBlock aItCB;
- //
- BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
- //
- aNb=aFFs.Extent();
- for (i=1; i<=aNb; i++) {
- BOPTools_SSInterference& aFF=aFFs(i);
- aFF.Indices(nF1, nF2);
- //
- const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
- const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
- //
- aF1FWD=aF1;
- aF1FWD.Orientation(TopAbs_FORWARD);
- aF2FWD=aF2;
- aF2FWD.Orientation(TopAbs_FORWARD);
- //
- // In, On parts processing
- const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
- //
- anIt.Initialize(aLPBInOn);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB=anIt.Value();
- nE=aPB.Edge();
- const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv
-
- BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
- BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
- }
- }
- // Check common blocks between edges and faces
- // Build P-Curves if they were not built in previos block.
- // The main case is :arguments for e.g aEdge, aFace -> no FFs,
- // but p-curves are needed.
- //
- aNb=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=aNb; ++i) {
- const TopoDS_Shape& aS=myDS->Shape(i);
- aType=aS.ShapeType();
- //
- if (aType!=TopAbs_EDGE) {
- continue;
- }
- const TopoDS_Edge& aE=TopoDS::Edge(aS);
- //
- if (NMTTools_Tools::IsDegenerated(aE)) {
- continue;
- }
- //
- const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i));
- aNbCB=aLCB.Extent();
- if (!aNbCB) {
- continue;
- }
- //
- aItCB.Initialize(aLCB);
- for (; aItCB.More(); aItCB.Next()) {
- const NMTTools_CommonBlock& aCB=aItCB.Value();
- const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1();
- //
- const TColStd_ListOfInteger& aLF=aCB.Faces();
- aNbF=aLF.Extent();
- if (!aNbF) {
- continue;
- }
- //
- nSp=aPB1.Edge();
- const TopoDS_Edge aSp=TopoDS::Edge(myDS->Shape(nSp));//mpv
- //
- aItF.Initialize(aLF);
- for (; aItF.More(); aItF.Next()) {
- nF=aItF.Value();
- aF1FWD=TopoDS::Face(myDS->Shape(nF));
- aF1FWD.Orientation(TopAbs_FORWARD);
- //
- BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aSp, aF1FWD);
- } // for (; aItCB.More(); aItCB.Next()) {
- }//if (aS.ShapeType()==TopAbs_EDGE) {
- }
-}
-
-//=======================================================================
-// function: IsExistingPaveBlock
-// purpose:
-//=======================================================================
-Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew,
- const BOPTools_ListOfPaveBlock& aLPBR,
- const Standard_Real aTolR3D)
-{
- Standard_Boolean bFlag;
- Standard_Integer nVNew1, nVNew2, nV1, nV2, iC;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- bFlag=Standard_False;
- nVNew1=aPBNew.Pave1().Index();
- nVNew2=aPBNew.Pave2().Index();
- //
- anIt.Initialize(aLPBR);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPBR=anIt.Value();
- nV1=aPBR.Pave1().Index();
- nV2=aPBR.Pave2().Index();
- if (nVNew1==nV1 || nVNew1==nV2 || nVNew2==nV1 || nVNew2==nV2) {
- //
- iC=CheckIntermediatePoint(aPBNew, aPBR, aTolR3D);
- if (!iC) {
- return !bFlag;
- }
- }
- }
- return bFlag;
-}
-
-//=======================================================================
-// function: IsExistingPaveBlock
-// purpose:
-//=======================================================================
-Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew,
- const TopTools_ListOfShape& aLSE,
- const Standard_Real aTolR3D)
-{
- Standard_Boolean bFlag;
- Standard_Integer aNbSE, iC;
- Standard_Real aTolE, aTol;
- TopTools_ListIteratorOfListOfShape anIt;
- //
- bFlag=Standard_False;
- //
- aNbSE=aLSE.Extent();
- if (!aNbSE) {
- return bFlag;
- }
- //
- anIt.Initialize(aLSE);
- for (; anIt.More(); anIt.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
- aTolE=BRep_Tool::Tolerance(aE);
- aTol=aTolR3D;
- if (aTolE>aTol) {
- aTol=aTolE;
- }
- iC=CheckIntermediatePoint(aPBNew, aE, aTol);
- if (!iC) {
- return !bFlag;
- }
- }
- return bFlag;
-}
-
-//=======================================================================
-// function: CheckIntermediatePoint
-// purpose:
-//=======================================================================
-Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,
- const BOPTools_PaveBlock& aPBR,
- const Standard_Real aTolC)
-{
- Standard_Integer iVM, nE2;
- //
- nE2=aPBR.Edge();
- const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv
- iVM=CheckIntermediatePoint(aPB, aE2, aTolC);
- //
- return iVM;
-}
-
-//=======================================================================
-// function: CheckIntermediatePoint
-// purpose:
-//=======================================================================
-Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,
- const TopoDS_Edge& aE2,
- const Standard_Real aTolC)
-{
- Standard_Real aT11, aT12, aTM, aTmp;
- Standard_Integer iVM;
- gp_Pnt aPM;
- BRep_Builder aBB;
- TopoDS_Vertex aVM;
- //
- // Vertex
- const BOPTools_Pave& aPave11=aPB.Pave1();
- aT11=aPave11.Param();
- //
- const BOPTools_Pave& aPave12=aPB.Pave2();
- aT12=aPave12.Param();
- //
- aTM=IntTools_Tools::IntermediatePoint (aT11, aT12);
- //
- const IntTools_Curve& aIC=aPB.Curve();
- aIC.D0(aTM, aPM);
- //
- aBB.MakeVertex (aVM, aPM, aTolC);
- //
- iVM=myContext->ComputeVE(aVM, aE2, aTmp);
- //
- return iVM;
-}
-
-//=======================================================================
-// function: PutBoundPaveOnCurve
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PutBoundPaveOnCurve(BOPTools_Curve& aBC,
- BOPTools_SSInterference& aFFi)
-{
- Standard_Boolean bHasBounds, bVF;
- Standard_Integer nF1, nF2;
- Standard_Real aT1, aT2, aTolR3D;
- gp_Pnt aP1, aP2;
- //
- const IntTools_Curve& aIC=aBC.Curve();
- bHasBounds=aIC.HasBounds ();
- if (!bHasBounds){
- return;
- }
- //
- // Bounds
- aIC.Bounds (aT1, aT2, aP1, aP2);
- //
- // Faces
- aFFi.Indices(nF1, nF2);
- aTolR3D=aFFi.TolR3D();
- //
- const TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));//mpv
- const TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));//mpv
- //
- bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
- if (bVF) {
- PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi);
- }
- //
- bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D);
- if (bVF) {
- PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi);
- }
-}
-
-//=======================================================================
-// function: PutBoundPaveOnCurve
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PutBoundPaveOnCurve(const gp_Pnt& aP,
- const Standard_Real aT,
- BOPTools_Curve& aBC,
- BOPTools_SSInterference& aFFi)
-{
- Standard_Boolean bFound1, bFound2;
- Standard_Integer nV;
- Standard_Real aTolV=aFFi.TolR3D();
-
- BOPTools_Pave aPave1, aPave2, aPave;
- BOPTools_PaveSet& aCPS=aBC.Set();
- BOPTools_PaveSet& aFFiPS=aFFi.NewPaveSet();
- const IntTools_Curve& aIC=aBC.Curve();
- //
- bFound1=FindPave(aP, aTolV, aCPS , aPave1);
- bFound2=FindPave(aP, aTolV, aFFiPS, aPave2);
- //
- if (!bFound1 && !bFound2) {
- TopoDS_Vertex aNewVertex;
- BOPTools_Tools::MakeNewVertex(aP, aTolV, aNewVertex);
- //
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
- nV=myDS->NumberOfInsertedShapes();
- aPave.SetIndex(nV);
- aPave.SetParam(aT);
-
- aCPS.Append(aPave);
- aFFiPS.Append(aPave);
- //
- // Append Techno Vertex to the Curve
- TColStd_ListOfInteger& aTVs=aBC.TechnoVertices();
- aTVs.Append(nV);
- }
- if (bFound1 && !bFound2) {
- nV=aPave1.Index();
- aPave.SetIndex(nV);
- aPave.SetParam(aT);
- aFFiPS.Append(aPave);
- //
- const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv
- BOPTools_Tools::UpdateVertex (aIC, aT, aV);
- }
-
- if (!bFound1 && bFound2) {
- nV=aPave2.Index();
- aPave.SetIndex(nV);
- aPave.SetParam(aT);
- aCPS.Append(aPave);
- //
- const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv
- BOPTools_Tools::UpdateVertex (aIC, aT, aV);
- }
-}
-
-//=======================================================================
-// function: FindPave
-// purpose:
-//=======================================================================
-Standard_Boolean NMTTools_PaveFiller::FindPave(const gp_Pnt& aP,
- const Standard_Real aTolPV,
- const BOPTools_PaveSet& aPS,
- BOPTools_Pave& aPave)
-{
- Standard_Integer nV;
- Standard_Boolean bIsVertex=Standard_False;
-
- const BOPTools_ListOfPave& aLP=aPS.Set();
- BOPTools_ListIteratorOfListOfPave anIt(aLP);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_Pave& aPC=anIt.Value();
- nV=aPC.Index();
- const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv
- bIsVertex=IntTools_Tools::IsVertex (aP, aTolPV, aV);
- if (bIsVertex) {
- aPave=aPC;
- return bIsVertex;
- }
- }
- return bIsVertex;
-}
-
-//=======================================================================
-// function: PrepareSetForFace
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PrepareSetForFace(const Standard_Integer ,//nF1,
- const Standard_Integer ,//nF2,
- const BOPTools_ListOfPaveBlock& aLPBC,
- BOPTools_PaveSet& aPSF)
-{
- Standard_Integer nV1, nV2;
- TColStd_MapOfInteger aMap;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- anIt.Initialize(aLPBC);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB=anIt.Value();
- const BOPTools_Pave& aPave1=aPB.Pave1();
- nV1=aPave1.Index();
- if (!aMap.Contains(nV1)) {
- aMap.Add(nV1);
- aPSF.Append(aPave1);
- }
- const BOPTools_Pave& aPave2=aPB.Pave2();
- nV2=aPave2.Index();
- if (!aMap.Contains(nV2)) {
- aMap.Add(nV2);
- aPSF.Append(aPave2);
- }
- }
-}
-
-//=======================================================================
-// function: CheckCoincidence
-// purpose:
-//=======================================================================
-Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPBNew,
- const BOPTools_ListOfPaveBlock& aLPBFF)
-{
- Standard_Boolean bRet;
- Standard_Real aTE;
- Standard_Integer nV11, nV12, nV21, nV22, iVV, iVE, nE2;
- Standard_Integer iV, iCount, iCountExt;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- // V11
- const BOPTools_Pave& aPave11=aPBNew.Pave1();
- nV11=aPave11.Index();
- const TopoDS_Vertex& aV11=TopoDS::Vertex(myDS->Shape(nV11));
-
- // V12
- const BOPTools_Pave& aPave12=aPBNew.Pave2();
- nV12=aPave12.Index();
- const TopoDS_Vertex& aV12=TopoDS::Vertex(myDS->Shape(nV12));
- //
- iCountExt=1;
- iCount=0;
- anIt.Initialize(aLPBFF);
- for (; anIt.More(); anIt.Next()) {
- iCount=0;
- //
- const BOPTools_PaveBlock& aPBR=anIt.Value();
- // V21
- const BOPTools_Pave& aPave21=aPBR.Pave1();
- nV21=aPave21.Index();
-
- // V22
- const BOPTools_Pave& aPave22=aPBR.Pave2();
- nV22=aPave22.Index();
- //
- if (nV11==nV21 || nV11==nV22 || nV12==nV21 || nV12==nV22) {
- continue;
- }
- //
- // E2
- nE2=aPBR.Edge();
- //
- const TopoDS_Vertex& aV21=TopoDS::Vertex(myDS->Shape(nV21));
- const TopoDS_Vertex& aV22=TopoDS::Vertex(myDS->Shape(nV22));
- const TopoDS_Edge& aE2=TopoDS::Edge(myDS->Shape(nE2));
- //
- // VV
- iV=0;
- iVV=IntTools_Tools::ComputeVV (aV11, aV21);
- if (!iVV) {
- iCount++;
- iV++;
- if (iCount>iCountExt) {
- break;
- }
- }
- //
- iVV=IntTools_Tools::ComputeVV (aV11, aV22);
- if (!iVV) {
- iCount++;
- iV++;
- if (iCount>iCountExt) {
- break;
- }
- }
- // VE
- if (!iV) {
- iVE=myContext->ComputeVE (aV11, aE2, aTE);
- if (!iVE) {
- iCount++;
- if (iCount>iCountExt) {
- break;
- }
- }
- }
- // VV
- iV=0;
- iVV=IntTools_Tools::ComputeVV (aV12, aV21);
- if (!iVV) {
- iCount++;
- iV++;
- if (iCount>iCountExt) {
- break;
- }
- }
- //
- iVV=IntTools_Tools::ComputeVV (aV12, aV22);
- if (!iVV) {
- iCount++;
- iV++;
- if (iCount>iCountExt) {
- break;
- }
- }
- // VE
- if (!iV) {
- iVE=myContext->ComputeVE (aV12, aE2, aTE);
- if (!iVE) {
- iCount++;
- if (iCount>iCountExt) {
- break;
- }
- }
- }
- } // next aPBR
- bRet=(Standard_Boolean)(iCount>iCountExt);
- return bRet;
-}
-
-//=======================================================================
-//function : IsMicroEdge
-//purpose :
-//=======================================================================
-Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE,
- const Handle(IntTools_Context)& aCtx)
-{
- Standard_Boolean bRet;
- Standard_Integer iErr;
- Standard_Real aT1, aT2, aTmp;
- Handle(Geom_Curve) aC3D;
- TopoDS_Vertex aV1, aV2;
- IntTools_Range aR;
- //
- bRet=(BRep_Tool::Degenerated(aE) ||
- !BRep_Tool::IsGeometric(aE));
- if (bRet) {
- return bRet;
- }
- //
- aC3D=BRep_Tool::Curve(aE, aT1, aT2);
- TopExp::Vertices(aE, aV1, aV2);
- aT1=BRep_Tool::Parameter(aV1, aE);
- aT2=BRep_Tool::Parameter(aV2, aE);
- if (aT2<aT1) {
- aTmp=aT1;
- aT1=aT2;
- aT2=aTmp;
- }
- //
- aR.SetFirst(aT1);
- aR.SetLast(aT2);
- IntTools_ShrunkRange aSR (aE, aV1, aV2, aR, aCtx);
- iErr=aSR.ErrorStatus();
- bRet=!aSR.IsDone();
- //
- return bRet;
-}
-//=======================================================================
-// function: PutPaveOnCurve
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PutPaveOnCurve(const BOPTools_PaveSet& aPaveSet,
- const Standard_Real aTolR3D,
- BOPTools_Curve& aBC)
-{
- Standard_Integer nV;
- Standard_Boolean bIsVertexOnLine;
- Standard_Real aT;
- BOPTools_ListIteratorOfListOfPave anIt;
- Bnd_Box aBBC;
- GeomAdaptor_Curve aGAC;
- //
- const IntTools_Curve& aC=aBC.Curve();
- Handle (Geom_Curve) aC3D= aC.Curve();
- aGAC.Load(aC3D);
- BndLib_Add3dCurve::Add(aGAC, aTolR3D, aBBC);
- //
- const BOPTools_ListOfPave& aLP=aPaveSet.Set();
- anIt.Initialize(aLP);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_Pave& aPave=anIt.Value();
- //
- nV=aPave.Index();
- const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));
- //
- Bnd_Box aBBV;
- BRepBndLib::Add(aV, aBBV);
- if (aBBC.IsOut(aBBV)){
- continue;
- }
- //
- bIsVertexOnLine=myContext->IsVertexOnLine(aV, aC, aTolR3D, aT);
- //
- //
- if (bIsVertexOnLine) {
- BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface);
- BOPTools_PaveSet& aPS=aBC.Set();
- aPS.Append(aPaveNew);
- //<-B
- }
- }
-}
-//
-//=======================================================================
-//function : FillFaceInfo
-//purpose :
-//=======================================================================
-void NMTTools_PaveFiller::FillFaceInfo()
-{
- Standard_Integer i, aNbS, aNbFFs, nF, aNbVFs, aNbEFs, j, n1, n2, nX, aNbF;
- TopAbs_ShapeEnum aType;
- TopoDS_Shape aS;
- TColStd_ListIteratorOfListOfInteger aItF;
- BOPTools_ListIteratorOfListOfPaveBlock anItPB;
- NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo aItMFI;
- NMTTools_ListIteratorOfListOfCommonBlock aItCB;
- //
- myFaceInfo.Clear();
- //
- BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
- BOPTools_CArray1OfVSInterference& aVFs=myIP->VSInterferences();
- BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences();
- //
- aNbFFs=aFFs.Extent();
- if (!aNbFFs) {
- return;
- }
- //
- // 0.
- for (i=1; i<=aNbFFs; ++i) {
- NMTTools_FaceInfo aFI;
- //
- BOPTools_SSInterference& aFFi=aFFs(i);
- aFFi.Indices(n1, n2);
- myFaceInfo.Bind(n1, aFI);
- myFaceInfo.Bind(n2, aFI);
- }
- //
- // 1.
- aNbS=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=aNbS; ++i) {
- aS=myDS->Shape(i);
- aType=aS.ShapeType();
- if (aType==TopAbs_EDGE) {
- const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i));
- aItCB.Initialize(aLCB);
- for (; aItCB.More(); aItCB.Next()) {
- const NMTTools_CommonBlock& aCB=aItCB.Value();
- const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1();
- const TColStd_ListOfInteger& aLF=aCB.Faces();
- aNbF=aLF.Extent();
- if (!aNbF) {
- continue;
- }
- //
- aItF.Initialize(aLF);
- for (; aItF.More(); aItF.Next()) {
- nF=aItF.Value();
- if (!myFaceInfo.IsBound(nF)) {
- continue;
- }
- //
- NMTTools_FaceInfo& aFI=myFaceInfo.ChangeFind(nF);
- aFI.ChangePaveBlocksIn().Add(aPB1);
- //
- n1=aPB1.Pave1().Index();
- n2=aPB1.Pave2().Index();
- aFI.ChangeVerticesIn().Add(n1);
- aFI.ChangeVerticesIn().Add(n2);
- }
- }
- }// if (aType==TopAbs_EDGE) {
- else if (aType==TopAbs_FACE) {
- if (!myFaceInfo.IsBound(i)) {
- continue;
- }
- //
- BOPTools_ListOfPaveBlock aLPBOn;
- //
- nF=i;
- NMTTools_FaceInfo& aFI=myFaceInfo.ChangeFind(nF);
- //
- RealSplitsFace(nF, aLPBOn);
- //
- anItPB.Initialize(aLPBOn);
- for (; anItPB.More(); anItPB.Next()) {
- const BOPTools_PaveBlock &aPB=anItPB.Value();
- aFI.ChangePaveBlocksOn().Add(aPB);
- //
- n1=aPB.Pave1().Index();
- n2=aPB.Pave2().Index();
- aFI.ChangeVerticesOn().Add(n1);
- aFI.ChangeVerticesOn().Add(n2);
- }
- //
- }// else if (aType==TopAbs_FACE) {
- }// for (i=1; i<=aNbS; ++i) {
- //
- // 2.
- aItMFI.Initialize(myFaceInfo);
- for (; aItMFI.More(); aItMFI.Next()) {
- nF=aItMFI.Key();
- NMTTools_FaceInfo& aFI=*((NMTTools_FaceInfo*)&aItMFI.Value());
- //
- aFI.SetIndex(nF);
- //
- //
- // 2.1 aVFs
- aNbVFs=aVFs.Extent();
- for (j=1; j<=aNbVFs; ++j) {
- BOPTools_VSInterference& aVFj=aVFs(j);
- aVFj.Indices(n1, n2);
- if (nF==n1) {
- aFI.ChangeVerticesIn().Add(n2);
- }
- else if (nF==n2){
- aFI.ChangeVerticesIn().Add(n1);
- }
- }// for (j=1; j<=aNbVFs; ++j) {
- //
- // 2.2 aEFs
- aNbEFs=aEFs.Extent();
- for (j=1; j<=aNbEFs; ++j) {
- BOPTools_ESInterference& aEFj=aEFs(j);
- aEFj.Indices(n1, n2);
- if (!(nF==n1 || nF==n2)) {
- continue;
- }
- //
- nX=aEFj.NewShape();
- if (nX<1) {
- continue;
- }
- //
- aS=myDS->Shape(nX);
- aType=aS.ShapeType();
- if (aType!=TopAbs_VERTEX) {
- continue;
- }
- //
- aFI.ChangeVerticesIn().Add(nX);
- }// for (j=1; j<=aNbEFs; ++j) {
- }// for (; aItMFI.More(); aItMFI.Next()) {
-}
-
-
-#include <gp_Pnt.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Vec.hxx>
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-//=======================================================================
-//function : CorrectTolR3D
-//purpose : Attempt to correct the value of tolerance aTolR3D for
-// the intersection curve in order to
-// compel it to pass through the sticks.
-// Prerequisites:
-// 2. The are based on B-Spline surfaces;
-// 1. There is at least the one intersection curve;
-// 2. The faces have stick vertices to catch the curve;
-// 3. The intersection angle is rather small (0.7-7 deg)
-//
-//=======================================================================
-void NMTTools_PaveFiller::CorrectTolR3D(const BOPTools_SSInterference& aFF,
- const TColStd_MapOfInteger& aMVStick,
- Standard_Real& aTolR3D)
-
-{
- Standard_Boolean bHasBounds;
- Standard_Integer i, nF[2], nV, aNbCurves;
- Standard_Real aT1, aT2, aU, aV, aT, aA, aTolV, aTolVmax;
- Standard_Real aTolR, aTolTresh, aAmin, aAmax;
- TColStd_MapIteratorOfMapOfInteger aIt;
- gp_Pnt aP, aP1, aP2;
- gp_Dir aDN[2];
- gp_Vec aVT;
- Handle(Geom_Surface) aS[2];
- Handle(Geom_Curve) aC3D;
- GeomAdaptor_Surface aGAS;
- GeomAbs_SurfaceType aType;
- TopoDS_Face aF[2];
- //
- aTolTresh=0.0005;
- aAmin=0.012;// 0.7-7 deg
- aAmax=0.12;
- //
- if (!aMVStick.Extent()) {
- return;
- }
- //
- BOPTools_SSInterference& aFFi=*((BOPTools_SSInterference*)&aFF);
- BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
- aNbCurves=aSCvs.Length();
- if (aNbCurves!=1){
- return;
- }
- //
- aFFi.Indices(nF[0], nF[1]);
- for (i=0; i<2; ++i) {
- aF[i]=*((TopoDS_Face*)(&myDS->Shape(nF[i])));
- aS[i]=BRep_Tool::Surface(aF[i]);
- aGAS.Load(aS[i]);
- aType=aGAS.GetType();
- if (aType!=GeomAbs_BSplineSurface) {
- return;
- }
- }
- //
- BOPTools_Curve& aBC=aSCvs(1);
- const IntTools_Curve& aIC=aBC.Curve();
- bHasBounds=aIC.HasBounds();
- if (!bHasBounds){
- return;
- }
- //
- aIC.Bounds (aT1, aT2, aP1, aP2);
- aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
- aC3D=aIC.Curve();
- aC3D->D0(aT, aP);
- //
- for (i=0; i<2; ++i) {
- GeomAPI_ProjectPointOnSurf& aPPS=myContext->ProjPS(aF[i]);
- aPPS.Perform(aP);
- aPPS.LowerDistanceParameters(aU, aV);
- BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]);
- }
- //
- aA=aDN[0].Angle(aDN[1]);
- aA=fabs(aA);
- if (aA > 0.5*M_PI) {
- aA = M_PI - aA;
- }
- //
- if (aA<aAmin || aA>aAmax) {
- return;
- }
- //
- aTolVmax=-1.;
- aIt.Initialize(aMVStick);
- for (; aIt.More(); aIt.Next()) {
- nV=aIt.Key();
- const TopoDS_Vertex& aV=*((TopoDS_Vertex*)(&myDS->Shape(nV)));
- aTolV=BRep_Tool::Tolerance(aV);
- if (aTolV>aTolVmax) {
- aTolVmax=aTolV;
- }
- }
- //
-
- aTolR=aTolVmax/aA;
- if (aTolR<aTolTresh) {
- aTolR3D=aTolR;
- }
-}
-
-//modified by NIZNHY-PKV Wed Sep 14 13:21:13 2011f
-#if OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher
-//=======================================================================
-// function: PutClosingPaveOnCurve
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::PutClosingPaveOnCurve(BOPTools_Curve& aBC,
- BOPTools_SSInterference& aFFi)
-{
- Standard_Boolean bIsClosed, bHasBounds, bAdded;
- Standard_Integer nVC, j;
- Standard_Real aT[2], aTolR3D, aTC, dT, aTx;
- gp_Pnt aP[2] ;
- BOPTools_Pave aPVx;
- BOPTools_ListIteratorOfListOfPave aItLP;
- //
- const IntTools_Curve& aIC=aBC.Curve();
- const Handle (Geom_Curve)& aC3D=aIC.Curve();
- if(aC3D.IsNull()) {
- return;
- }
- //
- bIsClosed=IntTools_Tools::IsClosed(aC3D);
- if (!bIsClosed) {
- return;
- }
- //
- bHasBounds=aIC.HasBounds ();
- if (!bHasBounds){
- return;
- }
- //
- bAdded=Standard_False;
- dT=Precision::PConfusion();
- aTolR3D=aFFi.TolR3D();
- aIC.Bounds (aT[0], aT[1], aP[0], aP[1]);
- //
- BOPTools_PaveSet& aFFiPS=aFFi.NewPaveSet();
- BOPTools_PaveSet& aCPS=aBC.Set();
- //
- const BOPTools_ListOfPave& aLP=aCPS.Set();
- aItLP.Initialize(aLP);
- for (; aItLP.More() && !bAdded; aItLP.Next()) {
- const BOPTools_Pave& aPC=aItLP.Value();
- nVC=aPC.Index();
- const TopoDS_Vertex aVC=TopoDS::Vertex(myDS->Shape(nVC));
- aTC=aPC.Param();
- //
- for (j=0; j<2; ++j) {
- if (fabs(aTC-aT[j]) < dT) {
- aTx=(!j) ? aT[1] : aT[0];
- aPVx.SetIndex(nVC);
- aPVx.SetParam(aTx);
- //
- aCPS.Append(aPVx);
- aFFiPS.Append(aPVx);
- //
- bAdded=Standard_True;
- break;
- }
- }
- }
-}
-#endif // OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher
-//modified by NIZNHY-PKV Wed Sep 14 13:21:17 2011t
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_7.cxx
-// Author: Peter KURNEV
-
-#include <NMTTools_PaveFiller.hxx>
-#include <NMTTools_Tools.hxx>
-
-#include <Bnd_HArray1OfBox.hxx>
-#include <Bnd_BoundSortBox.hxx>
-#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
-
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-
-#include <TopAbs_Orientation.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Compound.hxx>
-
-#include <TopTools_DataMapOfIntegerShape.hxx>
-#include <TopTools_DataMapOfShapeInteger.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-#include <TopTools_DataMapOfShapeListOfInteger.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfIntegerShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-
-#include <TopExp_Explorer.hxx>
-#include <TopExp.hxx>
-//
-#include <IntTools_SequenceOfPntOn2Faces.hxx>
-#include <IntTools_PntOnFace.hxx>
-#include <IntTools_PntOn2Faces.hxx>
-#include <IntTools_Context.hxx>
-
-#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
-
-#include <BOPTools_SSInterference.hxx>
-#include <BOPTools_CArray1OfSSInterference.hxx>
-#include <BOPTools_CArray1OfVVInterference.hxx>
-#include <BOPTools_VVInterference.hxx>
-#include <BOPTools_Tools.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_Pave.hxx>
-#include <BOPTools_Tools.hxx>
-
-#include <NMTDS_Iterator.hxx>
-#include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_InterfPool.hxx>
-
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
-#include <NMTTools_MapOfPaveBlock.hxx>
-
-
-//=======================================================================
-// function: MakeSplitEdges
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::MakeSplitEdges()
-{
- myIsDone=Standard_False;
- //
- Standard_Boolean bIsNewVertex1, bIsNewVertex2;
- Standard_Integer i, aNbS, nV1, nV2, aNbPaveBlocks, aNewShapeIndex;
- Standard_Real t1, t2;
- TopAbs_Orientation anOri;
- TopoDS_Edge aE, aESplit;
- TopoDS_Vertex aV1, aV2;
- //
- aNbS=myDS->NumberOfShapesOfTheObject();
- for (i=1; i<=aNbS; ++i) {
- if (myDS->GetShapeType(i) != TopAbs_EDGE)
- continue;
- //
- // Original Edge
- aE=TopoDS::Edge(myDS->Shape(i));
- if (NMTTools_Tools::IsDegenerated(aE)){
- continue;
- }
- //
- anOri=aE.Orientation();
- aE.Orientation(TopAbs_FORWARD);
- //
- // Making Split Edges
- //
- // Split Set for the Original Edge i
- BOPTools_ListOfPaveBlock& aSplitEdges=mySplitShapesPool(myDS->RefEdge(i));
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
- //
- aNbPaveBlocks=aSplitEdges.Extent();
-
- for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPB=aPBIt.Value();
- // aPave1
- const BOPTools_Pave& aPave1=aPB.Pave1();
- nV1=aPave1.Index();
- t1=aPave1.Param();
- aV1=TopoDS::Vertex(myDS->GetShape(nV1));
- aV1.Orientation(TopAbs_FORWARD);
- // aPave2
- const BOPTools_Pave& aPave2=aPB.Pave2();
- nV2=aPave2.Index();
- t2=aPave2.Param();
- aV2=TopoDS::Vertex(myDS->GetShape(nV2));
- aV2.Orientation(TopAbs_REVERSED);
- //xx
- if (aNbPaveBlocks==1) {
- bIsNewVertex1=myDS->IsNewShape (nV1);
- bIsNewVertex2=myDS->IsNewShape (nV2);
- if (!bIsNewVertex1 && !bIsNewVertex2) {
- aPB.SetEdge(i);
- continue;
- }
- }
- //xx
- BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit);
- //
- // Add Split Part of the Original Edge to the DS
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
-
- anASSeq.SetNewSuccessor(nV1);
- anASSeq.SetNewOrientation(aV1.Orientation());
-
- anASSeq.SetNewSuccessor(nV2);
- anASSeq.SetNewOrientation(aV2.Orientation());
- //
- if (anOri==TopAbs_INTERNAL) {
- anASSeq.SetNewAncestor(i);
- aESplit.Orientation(anOri);
- }
- //
- myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
- aNewShapeIndex=myDS->NumberOfInsertedShapes();
- myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
- //
- // Fill Split Set for the Original Edge
- aPB.SetEdge(aNewShapeIndex);
- //
- }
- }
- myIsDone=Standard_True;
-}
-//=======================================================================
-// function: UpdateCommonBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
-{
- Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF;
- Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp;
- TColStd_ListIteratorOfListOfInteger aItLI;
- gp_Pnt aPMax[2];
- TopoDS_Edge aEMax;
- BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS;
- NMTTools_ListIteratorOfListOfCommonBlock aItLCB;
- NMTTools_MapOfPaveBlock aMPB;
- //
- myIsDone=Standard_False;
- //
- aNbS=myDS->NumberOfShapesOfTheObject();
- for (nE=1; nE<=aNbS; ++nE) {
- if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
- continue;
- }
- //
- const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE));
- if (NMTTools_Tools::IsDegenerated(aE)){
- continue;
- }
- //
- NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
- //modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f
- aNbLCB=aLCB.Extent();
- if (!aNbLCB) {
- continue;
- }
- // 0
- NMTTools_ListOfCommonBlock aLCBx;
- //
- aItLCB.Initialize(aLCB);
- for (; aItLCB.More(); aItLCB.Next()) {
- NMTTools_CommonBlock aCBx;
- //
- NMTTools_CommonBlock& aCB=aItLCB.ChangeValue();
- const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
- aItLPB.Initialize(aLPB);
- for (; aItLPB.More(); aItLPB.Next()) {
- const BOPTools_PaveBlock& aPBx=aItLPB.Value();
- nEx=aPBx.OriginalEdge();
- BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx));
- aItLPBS.Initialize(aLPBS);
- for (; aItLPBS.More(); aItLPBS.Next()) {
- const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
- if (aPBSx.IsEqual(aPBx)) {
- aCBx.AddPaveBlock(aPBSx);
- break;
- }
- }// for (; aItLPBS.More(); aItLPBS.Next()) {
- }// for (; aItLPB.More(); aItLPB.Next()) {
- //
- const TColStd_ListOfInteger& aLI=aCB.Faces();
- aItLI.Initialize(aLI);
- for (; aItLI.More(); aItLI.Next()) {
- nF=aItLI.Value();
- aCBx.AddFace(nF);
- }
- //
- aLCBx.Append(aCBx);
- }//for (; aItLCB.More(); aItLCB.Next()) {
- //
- aLCB.Clear();
- //
- aItLCB.Initialize(aLCBx);
- for (; aItLCB.More(); aItLCB.Next()) {
- NMTTools_CommonBlock& aCBx=aItLCB.ChangeValue();
- aLCB.Append(aCBx);
- }
- //modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t
- // 1
- aItLCB.Initialize(aLCB);
- for (; aItLCB.More(); aItLCB.Next()) {
- NMTTools_CommonBlock& aCB=aItLCB.ChangeValue();
- //
- BOPTools_PaveBlock aPBMax;
- aTolExMax=-1.;
- const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
- aItLPB.Initialize(aLPB);
- for (; aItLPB.More(); aItLPB.Next()) {
- const BOPTools_PaveBlock& aPBx=aItLPB.Value();
- nEx=aPBx.OriginalEdge();
- const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
- aTolEx=BRep_Tool::Tolerance(aEx);
- if (aTolEx>aTolExMax) {
- aTolExMax=aTolEx;
- aEMax=aEx;
- aPBMax=aPBx;
- }
- }
- //
- // 2
- if (aMPB.Contains(aPBMax)) {
- continue;
- }
- aMPB.Add(aPBMax);
- //
- nEMax=aPBMax.OriginalEdge();
- const IntTools_ShrunkRange& aISRMax=aPBMax.ShrunkRange();
- const IntTools_Range& aSRMax=aISRMax.ShrunkRange();
- const Bnd_Box& aBoxMax=aISRMax.BndBox();
- aSRMax.Range(aTSRMax[0], aTSRMax[1]);
- for (j=0; j<2; ++j) {
- BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
- }
- //
- // 3
- aItLPB.Initialize(aLPB);
- for (; aItLPB.More(); aItLPB.Next()) {
- const BOPTools_PaveBlock& aPBx=aItLPB.Value();
- nEx=aPBx.OriginalEdge();
- if (nEx==nEMax) {
- continue;
- }
- //
- const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
- GeomAPI_ProjectPointOnCurve& aPPCx=myContext->ProjPC(aEx);
- //
- for (j=0; j<2; ++j) {
- aPPCx.Perform(aPMax[j]);
- aNbPoints=aPPCx.NbPoints();
- if (!aNbPoints) {
- break;
- }
- aTx[j]=aPPCx.LowerDistanceParameter();
- }
- if (!aNbPoints) {
- // correction the range is impossible due to
- // a projection problem
- continue;
- }
- //
- if (aTx[0]>aTx[1]){
- aTmp=aTx[0];
- aTx[0]=aTx[1];
- aTx[1]=aTmp;
- }
- //
- // 4 Correction
- // 4.1 aPBx
- {
- const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
- IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
- Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
- //
- pSRx->SetFirst(aTx[0]);
- pSRx->SetLast(aTx[1]);
- *pBoxx=aBoxMax;
- }
- //
- // 4.2 aPBSx
- BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
- aItLPBS.Initialize(aLPBSx);
- for (; aItLPBS.More(); aItLPBS.Next()) {
- const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
- if (!aPBSx.IsEqual(aPBx)) {
- continue;
- }
- //
- const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
- IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
- Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
- //
- pSRx->SetFirst(aTx[0]);
- pSRx->SetLast(aTx[1]);
- *pBoxx=aBoxMax;
- }
- //
- //
- }//for (; aItLPB.More(); aItLPB.Next()) {
- }//for (; aItLCB.More(); aItLCB.Next()) {
- }//for (nE=1; nE<=aNbS; ++nE) {
-}
-//=======================================================================
-// function: UpdateCommonBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::UpdateCommonBlocks()
-{
- myIsDone=Standard_False;
- //
- Standard_Integer nE, aNbS, nSp, nEx, nSpx;
- NMTTools_ListIteratorOfListOfCommonBlock aCBIt;
- BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
- //
- aNbS=myDS->NumberOfShapesOfTheObject();
- //
- for (nE=1; nE<=aNbS; ++nE) {
- if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
- continue;
- }
- if (NMTTools_Tools::IsDegenerated(TopoDS::Edge(myDS->Shape(nE)))){
- continue;
- }
- //
- NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
- /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE));
- //
- aCBIt.Initialize(aLCB);
- for (; aCBIt.More(); aCBIt.Next()) {
- NMTTools_CommonBlock& aCB=aCBIt.ChangeValue();
- //
- // Among all PBs of aCB the first PB will be one
- // that have max tolerance value
- {
- Standard_Real aTolEx, aTolExMax;
- BOPTools_ListOfPaveBlock *pLPB, aLPBx;
- //
- aTolExMax=-1.;
- pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
- aPBIt.Initialize(*pLPB);
- for (; aPBIt.More(); aPBIt.Next()) {
- const BOPTools_PaveBlock& aPBx=aPBIt.Value();
- nEx=aPBx.OriginalEdge();
- const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
- aTolEx=BRep_Tool::Tolerance(aEx);
- if (aTolEx>aTolExMax) {
- aTolExMax=aTolEx;
- aLPBx.Prepend(aPBx);
- }
- else{
- aLPBx.Append(aPBx);
- }
- }
- //
- pLPB->Clear();
- *pLPB=aLPBx;
- }
- //
- BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
- nSp=SplitIndex(aPB);
- aPB.SetEdge(nSp);
- //
- const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
- aPBIt.Initialize(aCBLPB);
- for (; aPBIt.More(); aPBIt.Next()) {
- BOPTools_PaveBlock& aPBx=aPBIt.Value();
- nEx=aPBx.OriginalEdge();
- if (nEx==nE) {
- continue;
- }
- //
- nSpx=SplitIndex(aPBx);
- aPBx.SetEdge(nSpx);
- }
- //
- }
- }
-}
-//=======================================================================
-// function: SplitIndex
-// purpose:
-//=======================================================================
-Standard_Integer NMTTools_PaveFiller::SplitIndex
- (const BOPTools_PaveBlock& aPBx) const
-{
- Standard_Integer anOriginalEdge, anEdgeIndex=0;
-
- anOriginalEdge=aPBx.OriginalEdge();
-
- const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
- //
- BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
- for (; anIt.More(); anIt.Next()) {
- BOPTools_PaveBlock& aPB=anIt.Value();
- if (aPB.IsEqual(aPBx)) {
- anEdgeIndex=aPB.Edge();
- return anEdgeIndex;
- }
- }
- return anEdgeIndex;
-}
-
-//=======================================================================
-// function: UpdatePaveBlocks
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::UpdatePaveBlocks()
-{
- myIsDone=Standard_False;
- //
- Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
- Standard_Real aT1, aT2;
- TColStd_IndexedMapOfInteger aMF, aME;
- TopExp_Explorer aExp;
- TopoDS_Vertex aV1, aV2;
- TopoDS_Edge aE;
- BOPTools_Pave aPave1, aPave2;
- BOPTools_PaveBlock aPB;
- //
- BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
- //
- aNbFFs=aFFs.Extent();
- for (i=1; i<=aNbFFs; ++i) {
- BOPTools_SSInterference& aFFi=aFFs(i);
- aFFi.Indices(nF1, nF2);
- aMF.Add(nF1);
- aMF.Add(nF2);
- }
- //
- aNbF=aMF.Extent();
- for(i=1; i<=aNbF; ++i) {
- nF=aMF(i);
- iRankF=myDS->Rank(nF);
- const TopoDS_Shape aF=myDS->Shape(nF);//mpv
- aExp.Init(aF, TopAbs_EDGE);
- for(; aExp.More(); aExp.Next()) {
- aE=TopoDS::Edge(aExp.Current());
- //
- if (NMTTools_Tools::IsDegenerated(aE)) {
- continue;
- }
- //
- nE=myDS->ShapeIndex(aE, iRankF);
- //
- if (aME.Contains(nE)) {
- continue;
- }
- aME.Add(nE);
- //
- BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
- aNbPB=aLPB.Extent();
- if (aNbPB) {
- continue;
- }
- TopExp::Vertices(aE, aV1, aV2);
- //
- nV1=myDS->ShapeIndex(aV1, iRankF);
- aT1=BRep_Tool::Parameter(aV1, aE);
- aPave1.SetIndex(nV1);
- aPave1.SetParam(aT1);
- //
- nV2=myDS->ShapeIndex(aV2, iRankF);
- aT2=BRep_Tool::Parameter(aV2, aE);
- aPave2.SetIndex(nV2);
- aPave2.SetParam(aT2);
- //
- aPB.SetEdge(nE);
- aPB.SetOriginalEdge(nE);
- aPB.SetPave1(aPave1);
- aPB.SetPave2(aPave2);
- //
- aLPB.Append(aPB);
- }
- }
-}
-
-//=======================================================================
-// function: MakeAloneVertices
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::MakeAloneVertices()
-{
- Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV;
- Standard_Real aTolF1, aTolF2, aTolSum, aTolV;
- TColStd_ListIteratorOfListOfInteger aIt;
- TColStd_ListOfInteger aLI;
- TopoDS_Vertex aV;
- TopoDS_Compound aCompound;
- BRep_Builder aBB;
- TopTools_DataMapOfShapeListOfInteger aDMVFF, aDMVFF1;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger aItDMVFF;
- TopTools_DataMapOfShapeShape aDMVV;
- TopTools_DataMapOfIntegerShape aDMIV;
- TopTools_DataMapOfShapeInteger aDMVI;
- TopTools_DataMapIteratorOfDataMapOfShapeInteger aItDMVI;
- TopTools_DataMapIteratorOfDataMapOfIntegerShape aItDMIV;
- //
- aBB.MakeCompound(aCompound);
- //
- myAloneVertices.Clear();
- //
- BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
- //
- // 1. Collect alone vertices from FFs
- aNbV=0;
- aNbFFs=aFFs.Extent();
- for (i=1; i<=aNbFFs; ++i) {
- BOPTools_SSInterference& aFFi=aFFs(i);
- aFFi.Indices(nF1, nF2);
- //
- const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
- const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
- //
- aTolF1=BRep_Tool::Tolerance(aF1);
- aTolF2=BRep_Tool::Tolerance(aF2);
- aTolSum=aTolF1+aTolF2;
- //
- aLI.Clear();
- aLI.Append(nF1);
- aLI.Append(nF2);
- //
- const IntTools_SequenceOfPntOn2Faces& aSeqAlonePnts=aFFi.AlonePnts();
- aNbPnts=aSeqAlonePnts.Length();
- for (j=1; j<=aNbPnts; ++j) {
- const gp_Pnt& aP=aSeqAlonePnts(j).P1().Pnt();
- BOPTools_Tools::MakeNewVertex(aP, aTolSum, aV);
- aDMVFF.Bind(aV, aLI);
- aBB.Add(aCompound, aV);
- ++aNbV;
- }
- }
- if (!aNbV) {
- return;
- }
- //
- // 2. Try to fuse alone vertices themselves;
- FuseVertices(aCompound, aDMVV);
- //
- // if some are fused, replace them by new ones
- aItDMVFF.Initialize(aDMVFF);
- for (; aItDMVFF.More(); aItDMVFF.Next()) {
- const TopoDS_Shape& aVx=aItDMVFF.Key();
- const TColStd_ListOfInteger& aLIx=aItDMVFF.Value();
- //
- if (!aDMVV.IsBound(aVx)) {
- aDMVFF1.Bind(aVx, aLIx);
- }
- else {
- const TopoDS_Shape& aVy=aDMVV.Find(aVx);
-
- if (aDMVFF1.IsBound(aVy)) {
- TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
- aIt.Initialize(aLIx);
- for(; aIt.More(); aIt.Next()) {
- nFx=aIt.Value();
- aLIy.Append(nFx);
- }
- }
- else {
- aDMVFF1.Bind(aVy, aLIx);
- }
- }
- }
- aDMVFF.Clear();
- //
- // refine lists of faces in aDMVFF1;
- aItDMVFF.Initialize(aDMVFF1);
- for (; aItDMVFF.More(); aItDMVFF.Next()) {
- TColStd_MapOfInteger aMIy;
- TColStd_ListOfInteger aLIy;
- //
- const TopoDS_Shape& aVx=aItDMVFF.Key();
- TColStd_ListOfInteger& aLIx=aDMVFF1.ChangeFind(aVx);
- aIt.Initialize(aLIx);
- for(; aIt.More(); aIt.Next()) {
- nFx=aIt.Value();
- if (aMIy.Add(nFx)) {
- aLIy.Append(nFx);
- }
- }
- aLIx.Clear();
- aLIx.Append(aLIy);
- }
- //==================================
- //
- // 3. Collect vertices from DS
- Standard_Integer aNbS, nV, nVSD, aNbVDS, i1, i2, aNbVSD;
- //
- aNbS=myDS->NumberOfShapesOfTheObject();
- // old shapes
- for (i=1; i<=aNbS; ++i) {
- const TopoDS_Shape& aS=myDS->Shape(i);
- if (aS.ShapeType() != TopAbs_VERTEX){
- continue;
- }
- //
- nVSD=FindSDVertex(i);
- nV=(nVSD) ? nVSD : i;
- const TopoDS_Shape& aVx=myDS->Shape(nV);
- if (!aDMVI.IsBound(aVx)) {
- aDMVI.Bind(aVx, nV);
- }
- }
- // new shapes
- i1=myDS->NumberOfSourceShapes()+1;
- i2=myDS->NumberOfInsertedShapes();
- for (i=i1; i<=i2; ++i) {
- const TopoDS_Shape aS=myDS->Shape(i);//mpv
- if (aS.ShapeType() != TopAbs_VERTEX){
- continue;
- }
- if (!aDMVI.IsBound(aS)) {
- aDMVI.Bind(aS, i);
- }
- }
- //
- // 4. Initialize BoundSortBox on aDMVI
- //
- Handle(Bnd_HArray1OfBox) aHAB;
- Bnd_BoundSortBox aBSB;
- //
- aNbVDS=aDMVI.Extent();
- aHAB=new Bnd_HArray1OfBox(1, aNbVDS);
- //
- aItDMVI.Initialize(aDMVI);
- for (i=1; aItDMVI.More(); aItDMVI.Next(), ++i) {
- Bnd_Box aBox;
- //
- nV=aItDMVI.Value();
- aV=TopoDS::Vertex(aItDMVI.Key());
- aTolV=BRep_Tool::Tolerance(aV);
- aBox.SetGap(aTolV);
- BRepBndLib::Add(aV, aBox);
- aHAB->SetValue(i, aBox);
- //
- aDMIV.Bind(i, aV);
- }
- aBSB.Initialize(aHAB);
- //
- // 5. Compare
- aItDMVFF.Initialize(aDMVFF1);
- for (; aItDMVFF.More(); aItDMVFF.Next()) {
- Bnd_Box aBoxV;
- //
- const TColStd_ListOfInteger& aLIFF=aItDMVFF.Value();
- aV=TopoDS::Vertex(aItDMVFF.Key());
- //
- aTolV=BRep_Tool::Tolerance(aV);
- aBoxV.SetGap(aTolV);
- BRepBndLib::Add(aV, aBoxV);
- //
- const TColStd_ListOfInteger& aLIVSD=aBSB.Compare(aBoxV);
- aNbVSD=aLIVSD.Extent();
- if (aNbVSD==0) {
- // add new vertex in DS and update map myAloneVertices
- BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
- //
- myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
- nV=myDS->NumberOfInsertedShapes();
- //
- aIt.Initialize(aLIFF);
- for (; aIt.More(); aIt.Next()) {
- nFx=aIt.Value();
- if (myAloneVertices.Contains(nFx)) {
- TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
- aMVx.Add(nV);
- }
- else {
- TColStd_IndexedMapOfInteger aMVx;
- aMVx.Add(nV);
- myAloneVertices.Add(nFx, aMVx);
- }
- }
- }
- }
- // qqf
- {
- Standard_Integer aNbF, aNbAV, nF, k;
- NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF;
- //
- aNbF=myAloneVertices.Extent();
- if (aNbF<2) {
- return;
- }
- //
- // 1. fill map Alone Vertex/Face -> aMAVF
- for (i=1; i<=aNbF; ++i) {
- nF=myAloneVertices.FindKey(i);
- const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
- aNbAV=aMAV.Extent();
- for(j=1; j<=aNbAV; ++j) {
- nV=aMAV(j);
- if (aMAVF.Contains(nV)) {
- TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
- aMF.Add(nF);
- }
- else{
- TColStd_IndexedMapOfInteger aMF;
- aMF.Add(nF);
- aMAVF.Add(nV, aMF);
- }
- }
- }
- //
- // 2 Obtain pairs of faces
- aNbAV=aMAVF.Extent();
- for (i=1; i<=aNbAV; ++i) {
- const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
- aNbF=aMF.Extent();
- for(j=1; j<aNbF; ++j) {
- nF1=aMF(j);
- for(k=j+1; k<=aNbF; ++k) {
- nF2=aMF(k);
- myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
- }
- }
- }
- }
- // qqt
-}
-//=======================================================================
-// function: AloneVertices
-// purpose:
-//=======================================================================
-const NMTTools_IndexedDataMapOfIndexedMapOfInteger&
- NMTTools_PaveFiller::AloneVertices()const
-{
- return myAloneVertices;
-}
-//=======================================================================
-// function: FuseVertices
-// purpose:
-//=======================================================================
-void NMTTools_PaveFiller::FuseVertices
- (const TopoDS_Shape& aCompound,
- TopTools_DataMapOfShapeShape& aDMVV)const
-{
- Standard_Integer i, aNbVV, n1, n2, nX;
- NMTTools_PaveFiller tPF;
- //
- tPF.SetCompositeShape(aCompound);
- //
- tPF.Init();
- //
- tPF.PerformVV();
- //tPF.PerformNewVertices(); //qq
- //
- NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
- NMTDS_InterfPool& tInterfPool=*(tPF.IP());
- BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences();
- //
- aNbVV=aVVt.Extent();
- for (i=1; i<=aNbVV; ++i) {
- const BOPTools_VVInterference& aVV=aVVt(i);
- aVV.Indices(n1, n2);
- nX=aVV.NewShape();
- if (nX) {
- const TopoDS_Shape& aV1=tDS.Shape(n1);
- const TopoDS_Shape& aV2=tDS.Shape(n2);
- const TopoDS_Shape& aVx=tDS.Shape(nX);
- aDMVV.Bind(aV1, aVx);
- aDMVV.Bind(aV2, aVx);
- }
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_8.cxx
-// Created: Fri Dec 19 11:15:53 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <TopTools_ListOfShape.hxx>
-
-#include <BooleanOperations_ShapesDataStructure.hxx>
-#include <BooleanOperations_OnceExplorer.hxx>
-
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-
-#include <NMTDS_ShapesDataStructure.hxx>
-
-#include <NMTTools_ListOfCommonBlock.hxx>
-#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
-#include <NMTTools_CommonBlock.hxx>
-#include <NMTTools_CommonBlockAPI.hxx>
-
-
-// Modified to add new method Thu Sep 14 14:35:18 2006
-// Contribution of Samtech www.samcef.com BEGIN
-//=======================================================================
-// function: SharedEdges
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::SharedEdges(const Standard_Integer nF1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aLNE,
- TopTools_ListOfShape& aLSE)
-{
- Standard_Integer nE1, nE2;
- TColStd_MapOfInteger aM1;
- //
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- //
- aExp.Init(nF1, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE1=aExp.Current();
- aM1.Add(nE1);
- }
-
- aExp.Init(nF2, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE2=aExp.Current();
- if (aM1.Contains(nE2)) {
- aLNE.Append(nE2);
- const TopoDS_Shape& aE2=myDS->Shape(nE2);
- aLSE.Append(aE2);
- }
- }
-}
-// Contribution of Samtech www.samcef.com END
-//
-//=======================================================================
-// function: RealPaveBlock
-// purpose:
-//=======================================================================
- const BOPTools_PaveBlock& NMTTools_PaveFiller::RealPaveBlock
- (const BOPTools_PaveBlock& aPB,
- TColStd_ListOfInteger& aLB,
- Standard_Integer& aIsCommonBlock)
-{
- Standard_Integer nE, nSpx;
- BOPTools_ListIteratorOfListOfPaveBlock aItPBx;
- //
- aIsCommonBlock=0;
- aLB.Clear();
- nE=aPB.OriginalEdge();
- const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
- NMTTools_CommonBlockAPI aCBAPI(aLCBE);
- if (aCBAPI.IsCommonBlock(aPB)) {
- NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
- //
- aIsCommonBlock=1;
- //
- const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
- aItPBx.Initialize(aLPBx);
- for (; aItPBx.More(); aItPBx.Next()) {
- const BOPTools_PaveBlock& aPBx=aItPBx.Value();
- nSpx=aPBx.Edge();
- aLB.Append(nSpx);
- }
- //
- const BOPTools_PaveBlock& aPBx=aCB.PaveBlock1();
- return aPBx;
- }
- return aPB;
-}
-//
-//=======================================================================
-// function: RealPaveBlock
-// purpose:
-//=======================================================================
- const BOPTools_PaveBlock& NMTTools_PaveFiller::RealPaveBlock(const BOPTools_PaveBlock& aPB)
-{
- Standard_Integer nE;
- //
- nE=aPB.OriginalEdge();
- const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
- NMTTools_CommonBlockAPI aCBAPI(aLCBE);
- if (aCBAPI.IsCommonBlock(aPB)) {
- NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
- const BOPTools_PaveBlock& aPBx=aCB.PaveBlock1();
- return aPBx;
- }
- return aPB;
-}
-//=======================================================================
-// function: CommonBlocksFace
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::CommonBlocksFace(const Standard_Integer nF,
- NMTTools_ListOfCommonBlock& aLCB)
-{
- Standard_Integer nE;
- TopAbs_ShapeEnum aT;
- NMTTools_ListIteratorOfListOfCommonBlock anIt;
- //
- aT=myDS->GetShapeType(nF);
- //
- if (aT!=TopAbs_FACE) {
- return 1; // Type mismatch
- }
- //
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- //
- aExp.Init(nF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE=aExp.Current();
- const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
- anIt.Initialize(aLCBE);
- for (; anIt.More(); anIt.Next()) {
- const NMTTools_CommonBlock& aCBE=anIt.Value();
- aLCB.Append(aCBE);
- }
- }
- return 0; //Ok
-}
-//
-// 1 RealSplits
-//
-//
-//=======================================================================
-// function: RealSplitsFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsFace(const Standard_Integer nF,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- //
- aExp.Init(nF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE=aExp.Current();
- const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
- anIt.Initialize(aLPBE);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB=anIt.Value();
- const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB);
- aLPB.Append(aPBR);
- }
- }
-}
-//=======================================================================
-// function: HasRealSplitsInOnFace
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_PaveFiller::HasRealSplitsInOnFace(const Standard_Integer nF1,
- const Standard_Integer nF2)
-{
- Standard_Boolean bFlag;
- BOPTools_ListOfPaveBlock aLPB;
- //
- RealSplitsInFace(0, nF1, nF2, aLPB);
- //
- bFlag=!aLPB.IsEmpty();
- if (bFlag) {
- return bFlag;
- }
- //
- RealSplitsInFace(0, nF1, nF2, aLPB);
- //
- bFlag=!aLPB.IsEmpty();
- return bFlag;
-}
-//=======================================================================
-// function: RealSplitsInFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer ,//for overriding
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE1;
- //
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- aExp.Init(nF1, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE1=aExp.Current();
- RealSplitsInFace (nE1, nF2, aLPB);
- }
-}
-//=======================================================================
-// function: RealSplitsInFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nF1;
- //
- TColStd_ListIteratorOfListOfInteger anItLFCB;
- NMTTools_ListIteratorOfListOfCommonBlock anItCB;
- //
- const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
- //
- anItCB.Initialize(aLCB);
- for (; anItCB.More(); anItCB.Next()) {
- NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
- const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
- const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1);
-
- const TColStd_ListOfInteger& aLFCB=aCB.Faces();
- anItLFCB.Initialize(aLFCB);
- for (; anItLFCB.More(); anItLFCB.Next()) {
- nF1=anItLFCB.Value();
- if (nF1==nF2) {
- aLPB.Append(aPB1R);
- }
- }
- }
-}
-//=======================================================================
-// function: RealSplitsOnEdge
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsOnEdge(const Standard_Integer nE1,
- const Standard_Integer nE2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE;
- //
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- NMTTools_ListIteratorOfListOfCommonBlock anItCB;
- //
- const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
-
- anItCB.Initialize(aLCB);
- for (; anItCB.More(); anItCB.Next()) {
- NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
- const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
- const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1);
- //
- const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
- anIt.Initialize(aLPBx);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB2=anIt.Value();
- nE=aPB2.OriginalEdge();
- if (nE==nE2) {
- aLPB.Append(aPB1R);
- }
- }
- }
-}
-//=======================================================================
-// function: RealSplitsOnFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE2;
- //
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- aExp.Init(nF2, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE2=aExp.Current();
- RealSplitsOnEdge(nE1, nE2, aLPB);
- }
-}
-//=======================================================================
-// function: RealSplitsOnFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer ,//for overriding
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE1;
- //
-// BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*myDS);
- aExp.Init(nF1, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE1=aExp.Current();
- RealSplitsOnFace(nE1, nF2, aLPB);
- }
-}
-
-// 2 SimpleSplits
-//=======================================================================
-// function: SplitsFace
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE;
- TopAbs_ShapeEnum aT;
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- //
- aT=myDS->GetShapeType(nF);
- //
- if (aT!=TopAbs_FACE) {
- return 1; // Type mismatch
- }
- //
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- //
- aExp.Init(nF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE=aExp.Current();
- const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
- anIt.Initialize(aLPBE);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPBE=anIt.Value();
- aLPB.Append(aPBE);
- }
- }
- return 0; //Ok
-}
-
-//=======================================================================
-// function: SplitsInFace
-// purpose: splits of edges from nF1 in nF2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE1;
- TopAbs_ShapeEnum aT1, aT2;
-
- aT1=myDS->GetShapeType(nF1);
- aT2=myDS->GetShapeType(nF2);
-
- if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
- return 1; // Type mismatch
- }
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- aExp.Init(nF1, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE1=aExp.Current();
- SplitsInFace (nE1, nF2, aLPB);
- }
- return 0; //Ok
-}
-//=======================================================================
-// function: SplitsInFace
-// purpose: splits of edge nE1 in aFace2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nF1;
- TopAbs_ShapeEnum aT1, aT2;
-
- aT1=myDS->GetShapeType(nE1);
- aT2=myDS->GetShapeType(nF2);
-
- if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
- return 1; // Type mismatch
- }
- //
- TColStd_ListIteratorOfListOfInteger anItLFCB;
- NMTTools_ListIteratorOfListOfCommonBlock anItCB;
- //
- const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
- //
- anItCB.Initialize(aLCB);
- for (; anItCB.More(); anItCB.Next()) {
- NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
- const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
-
- const TColStd_ListOfInteger& aLFCB=aCB.Faces();
- anItLFCB.Initialize(aLFCB);
- for (; anItLFCB.More(); anItLFCB.Next()) {
- nF1=anItLFCB.Value();
- if (nF1==nF2) {
- aLPB.Append(aPB1);
- }
- }
- }
- return 0; //Ok
-}
-//=======================================================================
-// function: SplitsOnEdge
-// purpose: splits of edge nE1 on nE2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
- const Standard_Integer nE2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE;
- TopAbs_ShapeEnum aT1, aT2;
-
- aT1=myDS->GetShapeType(nE1);
- aT2=myDS->GetShapeType(nE2);
-
- if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
- return 1; // Type mismatch
- }
- //
- BOPTools_ListIteratorOfListOfPaveBlock anIt;
- NMTTools_ListIteratorOfListOfCommonBlock anItCB;
- //
- const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
-
- anItCB.Initialize(aLCB);
- for (; anItCB.More(); anItCB.Next()) {
- NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
- const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);//XXX
- //
- const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
- anIt.Initialize(aLPBx);
- for (; anIt.More(); anIt.Next()) {
- const BOPTools_PaveBlock& aPB2=anIt.Value();
- nE=aPB2.OriginalEdge();
- if (nE==nE2) {
- aLPB.Append(aPB1);
- }
- }
- }
- return 0; //Ok
-}
-//=======================================================================
-// function: SplitsOnFace
-// purpose: splits of edge nE1 on face nF2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE2, ip;
- TopAbs_ShapeEnum aT1, aT2;
-
- aT1=myDS->GetShapeType(nE1);
- aT2=myDS->GetShapeType(nF2);
-
- if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
- return 1; // Type mismatch
- }
- BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*pDS);
- aExp.Init(nF2, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE2=aExp.Current();
- ip=SplitsOnEdge(nE1, nE2, aLPB);
- if (ip) {
- return ip;
- }
- }
- return 0; //Ok
-}
-//=======================================================================
-// function: SplitsOnFace
-// purpose: splits of edges from face nF1 on face nF2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPTools_ListOfPaveBlock& aLPB)
-{
- Standard_Integer nE1, ip;
- TopAbs_ShapeEnum aT1, aT2;
-
- aT1=myDS->GetShapeType(nF1);
- aT2=myDS->GetShapeType(nF2);
-
- if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
- return 1; // Type mismatch
- }
-// BooleanOperations_ShapesDataStructure *pDS=myDS;
- BooleanOperations_OnceExplorer aExp(*myDS);
- aExp.Init(nF1, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- nE1=aExp.Current();
- ip=SplitsOnFace(nE1, nF2, aLPB);
- if (ip) {
- return ip;
- }
- }
- return 0; //Ok
-}
-
-// 3 Simple Splits indices
-//=======================================================================
-// function: SplitsFace
-// purpose:
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF,
- TColStd_ListOfInteger& aSplits)
-{
- Standard_Integer nE, iErr;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTools_ListOfPaveBlock aLPB;
- //
- iErr=SplitsFace(nF, aLPB);
- if (iErr) {
- return iErr;
- }
-
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- const BOPTools_PaveBlock& aPB=aIt.Value();
- nE=aPB.Edge();
- aSplits.Append(nE);
- }
- return 0; //Ok
-}
-
-//=======================================================================
-// function: SplitsInFace
-// purpose: splits of edges from nF1 in nF2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aSplits)
-{
- Standard_Integer nE, iErr;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTools_ListOfPaveBlock aLPB;
- //
- iErr=SplitsInFace(0, nF1, nF2, aLPB);
- if (iErr) {
- return iErr;
- }
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- const BOPTools_PaveBlock& aPB=aIt.Value();
- nE=aPB.Edge();
- aSplits.Append(nE);
- }
- return iErr;
-}
-//=======================================================================
-// function: SplitsInFace
-// purpose: splits of edge nE1 in aFace2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aSplits)
-{
- Standard_Integer nE, iErr;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTools_ListOfPaveBlock aLPB;
- //
- iErr=SplitsInFace(nE1, nF2, aLPB);
- if (iErr) {
- return iErr;
- }
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- const BOPTools_PaveBlock& aPB=aIt.Value();
- nE=aPB.Edge();
- aSplits.Append(nE);
- }
- return iErr;
-}
-//=======================================================================
-// function: SplitsOnEdge
-// purpose: splits of edge nE1 on nE2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
- const Standard_Integer nE2,
- TColStd_ListOfInteger& aSplits)
-{
- Standard_Integer nE, iErr;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTools_ListOfPaveBlock aLPB;
- //
- iErr=SplitsOnEdge(nE1, nE2, aLPB);
- if (iErr) {
- return iErr;
- }
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- const BOPTools_PaveBlock& aPB=aIt.Value();
- nE=aPB.Edge();
- aSplits.Append(nE);
- }
- return iErr;
-}
-//=======================================================================
-// function: SplitsOnFace
-// purpose: splits of edge nE1 on face nF2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aSplits)
-{
- Standard_Integer nE, iErr;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTools_ListOfPaveBlock aLPB;
- //
- iErr=SplitsOnEdge(nE1, nF2, aLPB);
- if (iErr) {
- return iErr;
- }
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- const BOPTools_PaveBlock& aPB=aIt.Value();
- nE=aPB.Edge();
- aSplits.Append(nE);
- }
- return iErr;
-}
-//=======================================================================
-// function: SplitsOnFace
-// purpose: splits of edges from face nF1 on face nF2
-//=======================================================================
- Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- TColStd_ListOfInteger& aSplits)
-{
- Standard_Integer nE, iErr;
- BOPTools_ListIteratorOfListOfPaveBlock aIt;
- BOPTools_ListOfPaveBlock aLPB;
- //
- iErr=SplitsOnFace(0, nF1, nF2, aLPB);
- if (iErr) {
- return iErr;
- }
-
- aIt.Initialize(aLPB);
- for (; aIt.More(); aIt.Next()) {
- const BOPTools_PaveBlock& aPB=aIt.Value();
- nE=aPB.Edge();
- aSplits.Append(nE);
- }
- return 0; //Ok
-}
-//modified by NIZNHY-PKV Mon Oct 17 12:07:48 2011f
-static
- void SortPaveBlocks(BOPTools_ListOfPaveBlock &);
-static
- void SortShell(const Standard_Integer,
- BOPTools_PaveBlock *);
-static
- Standard_Boolean Less(const BOPTools_PaveBlock &,
- const BOPTools_PaveBlock &);
-
-//=======================================================================
-// function: RealSplitsInFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nF,
- BOPTools_ListOfPaveBlock& aLPBIn)
-{
- Standard_Integer j, aNbCBP, nSpIn;
- TColStd_MapOfInteger aMFence;
- BOPTools_ListOfPaveBlock aLPB;
- BOPTools_ListIteratorOfListOfPaveBlock aItPB;
- NMTTools_ListIteratorOfListOfCommonBlock aItCB;
- //
- NMTTools_CommonBlockPool& aCBP=ChangeCommonBlockPool();
- //
- aNbCBP=aCBP.Extent();
- for (j=1; j<=aNbCBP; ++j) {
- NMTTools_ListOfCommonBlock& aLCB=aCBP(j);
- aItCB.Initialize(aLCB);
- for (; aItCB.More(); aItCB.Next()) {
- NMTTools_CommonBlock& aCB=aItCB.ChangeValue();
- if (aCB.IsPaveBlockOnFace(nF)) {
- const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1();
- nSpIn=aPB1.Edge();
- if (aMFence.Add(nSpIn)){
- aLPB.Append(aPB1);
- }
- }
- }
- }
- //
- SortPaveBlocks(aLPB);
- //
- aItPB.Initialize(aLPB);
- for (; aItPB.More(); aItPB.Next()) {
- const BOPTools_PaveBlock& aPB=aItPB.Value();
- aLPBIn.Append(aPB);
- }
-}
-//=======================================================================
-// function: SortPaveBlocks
-// purpose:
-//=======================================================================
-void SortPaveBlocks(BOPTools_ListOfPaveBlock &aLPBIn)
-{
- Standard_Integer i, aNbPBIn;
- BOPTools_ListIteratorOfListOfPaveBlock aItPB;
- BOPTools_PaveBlock *pPB;
- //
- aNbPBIn=aLPBIn.Extent();
- if (aNbPBIn<2) {
- return;
- }
- //
- pPB=new BOPTools_PaveBlock[aNbPBIn];
- //
- aItPB.Initialize(aLPBIn);
- for (i=0; aItPB.More(); aItPB.Next(), ++i) {
- const BOPTools_PaveBlock& aPB=aItPB.Value();
- pPB[i]=aPB;
- }
- //
- SortShell(aNbPBIn, pPB);
- //
- aLPBIn.Clear();
- for (i=0; i<aNbPBIn; ++i) {
- aLPBIn.Append(pPB[i]);
- }
- //
- delete [] (BOPTools_PaveBlock*)pPB;
-}
-//=======================================================================
-//function : SortShell
-//purpose :
-//=======================================================================
-void SortShell(const Standard_Integer n,
- BOPTools_PaveBlock *a)
-{
- Standard_Integer nd, i, j, l, d=1;
- BOPTools_PaveBlock x;
- //
- while(d<=n) {
- d*=2;
- }
- //
- while (d) {
- d=(d-1)/2;
- //
- nd=n-d;
- for (i=0; i<nd; ++i) {
- j=i;
- m30:;
- l=j+d;
- if (Less(a[l], a[j])) {
- //if (a[l] < a[j]){
- x=a[j];
- a[j]=a[l];
- a[l]=x;
- j-=d;
- if (j > -1) goto m30;
- }//if (a[l] < a[j]){
- }//for (i=0; i<nd; ++i)
- }//while (1)
-}
-
-//=======================================================================
-//function : Less
-//purpose :
-//=======================================================================
-Standard_Boolean Less(const BOPTools_PaveBlock &aPB1,
- const BOPTools_PaveBlock &aPB2)
-{
- Standard_Boolean bRet;
- Standard_Integer iE1, iE2;
- Standard_Real aT11, aT12, aT21, aT22;
- //
- iE1=aPB1.OriginalEdge();
- iE2=aPB2.OriginalEdge();
- if (iE1!=iE2) {
- bRet=(iE1<iE2);
- return bRet;
- }
- //
- aPB1.Parameters(aT11, aT12);
- aPB2.Parameters(aT21, aT22);
- bRet=(aT11<aT21);
- return bRet;
-}
-//modified by NIZNHY-PKV Mon Oct 17 11:44:45 2011t
+++ /dev/null
-// Copyright (C) 2007-2013 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_PaveFiller_9.cxx
-// Created: Fri Dec 19 11:15:53 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_PaveFiller.hxx>
-
-#include <Geom_Surface.hxx>
-
-#include <TopLoc_Location.hxx>
-#include <TopAbs_Orientation.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-
-#include <TopExp_Explorer.hxx>
-
-#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
-#include <BOPTools_ListOfPaveBlock.hxx>
-#include <BOPTools_PaveBlock.hxx>
-#include <BOPTools_Tools3D.hxx>
-
-#include <NMTDS_ShapesDataStructure.hxx>
-
-#include <NMTTools_CommonBlockAPI.hxx>
-#include <NMTTools_CommonBlock.hxx>
-
-
-//=======================================================================
-// function: PrepareFace
-// purpose:
-//=======================================================================
- void NMTTools_PaveFiller::PrepareFace(const Standard_Integer nF,
- TopoDS_Face& newFace)
-{
- Standard_Boolean bToReverse, bIsDegenerated;
- Standard_Integer iRankF, nE, nSp, aNbPB;
- Standard_Real aTol;
- TopLoc_Location aLoc;
- TopoDS_Face aF;
- TopoDS_Wire newWire;
- TopoDS_Edge aSp;
- TopAbs_Orientation anOrF, anOrE;
- BRep_Builder aBB;
- TopExp_Explorer aExpW, aExpE;
- BOPTools_ListIteratorOfListOfPaveBlock aItPB;
- //
- iRankF=myDS->Rank(nF);
- aF=TopoDS::Face(myDS->Shape(nF));
- anOrF=aF.Orientation();
- aF.Orientation(TopAbs_FORWARD);
- //
- Handle(Geom_Surface) aS=BRep_Tool::Surface(aF, aLoc);
- aTol=BRep_Tool::Tolerance(aF);
- //
- aBB.MakeFace (newFace, aS, aLoc, aTol);
- //
- aExpW.Init(aF, TopAbs_WIRE);
- for (; aExpW.More(); aExpW.Next()) {
- const TopoDS_Shape& aW=aExpW.Current();
- aBB.MakeWire(newWire);
- //
- aExpE.Init(aW, TopAbs_EDGE);
- for (; aExpE.More(); aExpE.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current());
- bIsDegenerated=BRep_Tool::Degenerated(aE);
- anOrE=aE.Orientation();
- //
- nE=myDS->ShapeIndex(aE, iRankF);
- const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
- aNbPB=aLPB.Extent();
- if (!aNbPB) {
- aBB.Add(newWire, aE);
- continue;
- }
- //
- aItPB.Initialize(aLPB);
- for (; aItPB.More(); aItPB.Next()) {
- const BOPTools_PaveBlock& aPB=aItPB.Value();
- const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB);
- nSp=aPBR.Edge();
- //
- aSp=TopoDS::Edge(myDS->Shape(nSp));
- if (!bIsDegenerated) {
- bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, myContext);
- if (bToReverse) {
- aSp.Reverse();
- }
- }
- else {
- aSp.Orientation(anOrE);
- }
- aBB.Add(newWire, aSp);
- }
- }
- aBB.Add(newFace, newWire);
- }
- newFace.Orientation(anOrF);
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_Tools.cxx
-// Created: Mon Dec 8 10:35:15 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTTools_Tools.hxx>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-#include <gp_Pnt.hxx>
-#include <gp_XYZ.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Geom_Surface.hxx>
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Edge.hxx>
-
-#include <TopExp.hxx>
-
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-
-#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
-#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
-
-#include <BOPTools_VVInterference.hxx>
-#include <BOPTools_SSInterference.hxx>
-
-#include <BOPTools_Tools2D.hxx>
-#include <BOPTools_Tools.hxx>
-#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
-#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
-#include <NMTTools_CoupleOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <Geom2d_Curve.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <BOPTools_Tools2D.hxx>
-#include <BRepLib.hxx>
-#include <BOPTools_Tools3D.hxx>
-#include <TopExp_Explorer.hxx>
-//
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <Precision.hxx>
-
-static
- void ProcessBlock(const Standard_Integer iV,
- const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
- TColStd_IndexedMapOfInteger& aProcessed,
- TColStd_IndexedMapOfInteger& aChain);
-static
- void ProcessBlock(const TopoDS_Shape& aF,
- const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
- TopTools_IndexedMapOfShape& aProcessed,
- TopTools_IndexedMapOfShape& aChain);
-
-//modified by NIZNHY-PKV Thu Nov 16 10:46:53 2006f SKL/PartC5
-//=======================================================================
-// function: UpdateEdge
-// purpose:
-//=======================================================================
- void NMTTools_Tools::UpdateEdge(const TopoDS_Edge& aE,
- const Standard_Real aTolR)
-{
- Standard_Real aTolE, aTolES, aTolV;
- TopoDS_Iterator aIt;
- BRep_Builder aBB;
- //
- aTolE=BRep_Tool::Tolerance(aE);
- aTolES=Max(aTolR, aTolE);
- aBB.UpdateEdge(aE, aTolES);
- //
- aIt.Initialize(aE);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Vertex& aV=TopoDS::Vertex(aIt.Value());
- aTolV=BRep_Tool::Tolerance(aV);
- if (aTolV<aTolES) {
- aBB.UpdateVertex(aV, aTolES);
- }
- }
-}
-//=======================================================================
-// function: MakePCurve
-// purpose:
-//=======================================================================
- void NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const Handle(Geom2d_Curve)& aC2Dx1)
-
-{
- Standard_Real aTolE, aT1, aT2, aOutFirst, aOutLast, aOutTol;
- Handle(Geom2d_Curve) aC2D, aC2DA;
- TopoDS_Face aFFWD;
- BRep_Builder aBB;
- //
- aFFWD=aF;
- aFFWD.Orientation(TopAbs_FORWARD);
- //
- aTolE=BRep_Tool::Tolerance(aE);
- //
- const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
- Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aT1, aT2);
- //
- aC2D=aC2Dx1;
- if (aC2D.IsNull()) { // ?
- BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
- BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True);
- }
- //
- if (aC3DE->IsPeriodic()) {
- BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA);
- }
- else {
- BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA);
- }
- //
- aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
- BRepLib::SameParameter(aE);
-}
-/*
-//=======================================================================
-// function: MakePCurve
-// purpose:
-//=======================================================================
- void NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const Handle(Geom2d_Curve)& aC2Dx,
- const Standard_Real aTolR2D)
-{
- Standard_Integer k, aNbV;
- Standard_Real aTolEdge, aTolFact, aTolV, aTolVmax;
- Standard_Real aTFirst, aTLast, aOutFirst, aOutLast, aOutTol;
- TopoDS_Face aFFWD;
- TopTools_IndexedMapOfShape aVMap;
- BRep_Builder aBB;
- //
- aFFWD=aF;
- aFFWD.Orientation(TopAbs_FORWARD);
- //
- aTolEdge=BRep_Tool::Tolerance(aE);
- aTolFact=Max(aTolEdge, aTolR2D);
- //
- TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
- //
- aTolVmax=-1.;
- aNbV=aVMap.Extent();
- for (k=1; k<=aNbV; ++k) {
- const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
- aTolV=BRep_Tool::Tolerance(aV);
- if (aTolV>aTolVmax) {
- aTolVmax=aTolV;
- }
- }
- //
- if (aTolFact>aTolVmax) {
- aTolFact=aTolVmax;
- }
- //
- const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aTFirst, aTLast);
- Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aTFirst, aTLast);
- //
- Handle(Geom2d_Curve) aC2D, aC2DA;
- //
- aC2D=aC2Dx;
- if (aC2D.IsNull()) {
- BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
- BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True);
- }
- if (aC3DE->IsPeriodic()) {
- BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aTFirst, aTLast, aC2D, aC2DA);
- }
- else {
- BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA);
- }
- //
- aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact);
- BRepLib::SameParameter(aE);
-}
-*/
-//modified by NIZNHY-PKV Thu Nov 16 10:46:55 2006t
-//=======================================================================
-// function: IsSplitInOnFace
-// purpose:
-//=======================================================================
- Standard_Boolean NMTTools_Tools::IsSplitInOnFace(const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const Handle(IntTools_Context)& aContext)
-{
- Standard_Boolean bFlag;
- Standard_Real aT, aTolE, aTolF, aTol, aDist, aU, aV;
- gp_Pnt aP;
- gp_Pnt2d aP2D;
- //
- aTolE=BRep_Tool::Tolerance(aE);
- aTolF=BRep_Tool::Tolerance(aF);
- aTol=aTolE+aTolF;
- //
- GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
- //
- aT=BOPTools_Tools2D::IntermediatePoint(aE);
- BOPTools_Tools::PointOnEdge(aE, aT, aP);
- //
- aProjector.Perform(aP);
- bFlag=aProjector.IsDone();
- if (!bFlag) {
- return bFlag;
- }
- //
- aDist=aProjector.LowerDistance();
- bFlag=(aDist <= aTol);
- if (!bFlag) {
- return bFlag;
- }
- //
- aProjector.LowerDistanceParameters(aU, aV);
- aP2D.SetCoord(aU, aV);
- bFlag=aContext->IsPointInOnFace (aF, aP2D);
- return bFlag;
-}
-//=======================================================================
-// function: NMTTools_Tools::MakeNewVertex
-// purpose :
-//=======================================================================
- void NMTTools_Tools::MakeNewVertex(const TopTools_ListOfShape& aLVs,
- TopoDS_Vertex& aNewVertex)
-{
- Standard_Integer aNb;
- Standard_Real aTi, aDi, aDmax=-1.e5;
- gp_Pnt aPi, aP;
- gp_XYZ aXYZ(0.,0.,0.), aXYZi;
- TopTools_ListIteratorOfListOfShape anIt;
- //
- aNb=aLVs.Extent();
- if (!aNb) {
- return;
- }
- //
- anIt.Initialize(aLVs);
- for (; anIt.More(); anIt.Next()) {
- TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value());
- aPi=BRep_Tool::Pnt(aVi);
- aXYZi=aPi.XYZ();
- aXYZ=aXYZ+aXYZi;
- }
- //
- aXYZ.Divide((Standard_Real)aNb);
- aP.SetXYZ(aXYZ);
- //
- anIt.Initialize(aLVs);
- for (; anIt.More(); anIt.Next()) {
- TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value());
- aPi=BRep_Tool::Pnt(aVi);
- aTi=BRep_Tool::Tolerance(aVi);
- aDi=aP.Distance(aPi);
- aDi=aDi+aTi;
- if (aDi > aDmax) {
- aDmax=aDi;
- }
- }
- BRep_Builder aBB;
- aBB.MakeVertex (aNewVertex, aP, aDmax);
-}
-//=======================================================================
-// function: FindChains
-// purpose :
-//=======================================================================
- void NMTTools_Tools::FindChains(const BOPTools_CArray1OfSSInterference& FFs,
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains)
-{
- Standard_Boolean bIsTangentFaces;
- Standard_Integer j, aNb, anIndex1, anIndex2;
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV;
- //
- aNb=FFs.Extent();
- for (j=1; j<=aNb; ++j) {
- const BOPTools_SSInterference& aFF=FFs(j);
- //
- bIsTangentFaces=aFF.IsTangentFaces();
- if (!bIsTangentFaces) {
- continue;
- }
- //
- aFF.Indices(anIndex1, anIndex2);
- //
- if (aMCV.Contains(anIndex1)) {
- TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1);
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- }
- else {
- TColStd_IndexedMapOfInteger aMV;
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- aMCV.Add(anIndex1, aMV);
- }
- //
- if (aMCV.Contains(anIndex2)) {
- TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2);
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- }
- else {
- TColStd_IndexedMapOfInteger aMV;
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- aMCV.Add(anIndex2, aMV);
- }
- }
- NMTTools_Tools::FindChains(aMCV, aMapChains);
-}
-//=======================================================================
-// function: FindChains
-// purpose :
-//=======================================================================
- void NMTTools_Tools::FindChains(const BOPTools_CArray1OfVVInterference& VVs,
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains)
-{
- Standard_Integer j, aNb, anIndex1, anIndex2;
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV;
- //
- aNb=VVs.Extent();
- for (j=1; j<=aNb; ++j) {
- const BOPTools_VVInterference& VV=VVs(j);
- VV.Indices(anIndex1, anIndex2);
- //
- if (aMCV.Contains(anIndex1)) {
- TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1);
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- }
- else {
- TColStd_IndexedMapOfInteger aMV;
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- aMCV.Add(anIndex1, aMV);
- }
- //
- if (aMCV.Contains(anIndex2)) {
- TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2);
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- }
- else {
- TColStd_IndexedMapOfInteger aMV;
- aMV.Add(anIndex1);
- aMV.Add(anIndex2);
- aMCV.Add(anIndex2, aMV);
- }
- }
- NMTTools_Tools::FindChains(aMCV, aMapChains);
-}
-
-//=======================================================================
-// function: FindChains
-// purpose :
-//=======================================================================
- void NMTTools_Tools::FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains)
-{
- Standard_Integer i, j, aNbCV, aNbV, iV, iVx;
- TColStd_IndexedMapOfInteger aProcessed, aChain;
- //
- aNbCV=aMCV.Extent();
- for (i=1; i<=aNbCV; ++i) {
- iV=aMCV.FindKey(i);
- if (aProcessed.Contains(iV)) {
- continue;
- }
- //
- aProcessed.Add(iV);
- aChain.Add(iV);
- //
- const TColStd_IndexedMapOfInteger& aMV=aMCV(i);
- aNbV=aMV.Extent();
- for (j=1; j<=aNbV; ++j) {
- iVx=aMV(j);
- ProcessBlock(iVx, aMCV, aProcessed, aChain);
- }
- aMapChains.Add(i, aChain);
- aChain.Clear();
- }
-}
-//=======================================================================
-// function: ProcessBlock
-// purpose:
-//=======================================================================
-void ProcessBlock(const Standard_Integer iV,
- const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
- TColStd_IndexedMapOfInteger& aProcessed,
- TColStd_IndexedMapOfInteger& aChain)
-{
- Standard_Integer j, aNbV, iVx;
- //
- if (aProcessed.Contains(iV)) {
- return;
- }
- aProcessed.Add(iV);
- aChain.Add(iV);
- //
- const TColStd_IndexedMapOfInteger& aMV=aMCV.FindFromKey(iV);
- aNbV=aMV.Extent();
- for (j=1; j<=aNbV; ++j) {
- iVx=aMV(j);
- ProcessBlock(iVx, aMCV, aProcessed, aChain);
- }
-}
-//=======================================================================
-// function: AreFacesSameDomain
-// purpose :
-//=======================================================================
- Standard_Boolean NMTTools_Tools::AreFacesSameDomain(const TopoDS_Face& aF1x,
- const TopoDS_Face& aF2y,
- const Handle(IntTools_Context)& aCtx)
-{
- Standard_Boolean bFlag;
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- Standard_Integer aNbE1, aNbE2;
- Standard_Real aTolF1, aTolF2, aTol;
- gp_Pnt2d aP2D;
- gp_Pnt aP;
- TopoDS_Face aF1, aF2;
- TopExp_Explorer aExp;
- TopTools_MapOfShape aME1, aME2;
- TopTools_MapIteratorOfMapOfShape aIt;
- //
- bFlag=Standard_False;
- // Contribution of Samtech www.samcef.com END
- //
- aF1=aF1x;
- aF1.Orientation(TopAbs_FORWARD);
- aF2=aF2y;
- aF2.Orientation(TopAbs_FORWARD);
- //
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- //
- // 1
- aExp.Init(aF1, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
- if (!BRep_Tool::Degenerated(aE)) {
- aME1.Add(aE);
- }
- }
- //
- aExp.Init(aF2, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
- if (!BRep_Tool::Degenerated(aE)) {
- if (!aME1.Contains(aE)) {
- return bFlag;
- }
- aME2.Add(aE);
- }
- }
- //
- // Contribution of Samtech www.samcef.com END
- //
- aNbE1=aME1.Extent();
- aNbE2=aME2.Extent();
- //
- if(!aNbE1 || !aNbE2){
- return bFlag;
- }
- //
- if(aNbE1!=aNbE2) {
- return bFlag;
- }
- //
- // 2
- aTolF1=BRep_Tool::Tolerance(aF1);
- aTolF2=BRep_Tool::Tolerance(aF2);
- aTol=aTolF1+aTolF2;
- //
- aIt.Initialize(aME1);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Edge& aE=TopoDS::Edge(aIt.Key());
- BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP);
- bFlag=aCtx->IsValidPointForFace(aP, aF2, aTol);
- break;
- }
- //
- return bFlag;
-}
-//=======================================================================
-// function: FindChains
-// purpose :
-//=======================================================================
- void NMTTools_Tools::FindChains(const NMTTools_ListOfCoupleOfShape& aLCS,
- NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
-{
- NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
- NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
- //
- aItCS.Initialize(aLCS);
- for (; aItCS.More(); aItCS.Next()) {
- const NMTTools_CoupleOfShape& 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);
- }
- }
- NMTTools_Tools::FindChains(aMCV, aMapChains);
-}
-//=======================================================================
-// function: FindChains
-// purpose :
-//=======================================================================
- void NMTTools_Tools::FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
- NMTTools_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 NMTTools_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);
- }
-}
-
-//=======================================================================
-// function: IsDegenerated
-// purpose :
-//=======================================================================
-Standard_Boolean NMTTools_Tools::IsDegenerated(const TopoDS_Edge &theEdge)
-{
- Standard_Boolean aResult = BRep_Tool::Degenerated(theEdge);
-
- if (!aResult) {
- // Check if there is a null-length 3d curve.
- Standard_Real aF;
- Standard_Real aL;
- Handle(Geom_Curve) aCrv = BRep_Tool::Curve(theEdge, aF, aL);
-
- aResult = aCrv.IsNull();
-
- if (!aResult) {
- const Standard_Real aTolConf2 =
- Precision::Confusion()*Precision::Confusion();
- gp_Pnt aPnt[2] = { aCrv->Value(aF), aCrv->Value(aL) };
-
- if (aPnt[0].SquareDistance(aPnt[1]) <= aTolConf2) {
- // Check the middle point.
- const gp_Pnt aPMid = aCrv->Value(0.5*(aF + aL));
-
- if (aPnt[0].SquareDistance(aPMid) <= aTolConf2) {
- // 3D curve is degenerated.
- aResult = Standard_True;
- }
- }
- }
- }
-
- return aResult;
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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_Tools.hxx
-// Created: Mon Dec 8 10:35:15 2003
-// Author: Peter KURNEV
-// <pkv@irinox>
-
-#ifndef _NMTTools_Tools_HeaderFile
-#define _NMTTools_Tools_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Boolean.hxx>
-#include <Handle_IntTools_Context.hxx>
-#include <Handle_Geom2d_Curve.hxx>
-#include <Standard_Real.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <BOPTools_CArray1OfVVInterference.hxx>
-#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
-#include <BOPTools_CArray1OfSSInterference.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <IntTools_Context.hxx>
-#include <NMTTools_ListOfCoupleOfShape.hxx>
-#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
-#include <Geom2d_Curve.hxx>
-
-//=======================================================================
-//function : NMTTools_Tools
-//purpose :
-//=======================================================================
-class NMTTools_Tools {
- public:
- Standard_EXPORT
- static void MakeNewVertex(const TopTools_ListOfShape& aLV,
- TopoDS_Vertex& aNewVertex) ;
-
- Standard_EXPORT
- static void FindChains(const BOPTools_CArray1OfVVInterference& aVVs,
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ;
-
- Standard_EXPORT
- static void FindChains(const BOPTools_CArray1OfSSInterference& aVVs,
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ;
-
- Standard_EXPORT
- static void FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
- BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ;
-
- Standard_EXPORT
- static Standard_Boolean IsSplitInOnFace(const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const Handle(IntTools_Context)& aCtx) ;
-
- Standard_EXPORT
- static Standard_Boolean AreFacesSameDomain(const TopoDS_Face& aF1,
- const TopoDS_Face& aF2,
- const Handle(IntTools_Context)& aCtx) ;
-
- Standard_EXPORT
- static void FindChains(const NMTTools_ListOfCoupleOfShape& aLCS,
- NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM) ;
-
- Standard_EXPORT
- static void FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM1,
- NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM2) ;
-
- Standard_EXPORT
- static void MakePCurve(const TopoDS_Edge& aE,
- const TopoDS_Face& aF,
- const Handle(Geom2d_Curve)& aC2D) ;
-
- Standard_EXPORT
- static void UpdateEdge(const TopoDS_Edge& aE,
- const Standard_Real aTol) ;
-
- Standard_EXPORT
- static Standard_Boolean IsDegenerated(const TopoDS_Edge &theEdge);
-
-};
-#endif