Merge from BR_new_bop4 (porting to new OCCT BOP) 13/09/2013

This commit is contained in:
vsr 2013-09-16 13:59:50 +00:00
parent fcc908e69c
commit b5c2a231e7
223 changed files with 2560 additions and 28203 deletions

View File

@ -225,7 +225,7 @@ INCLUDE(CMakePackageConfigHelpers)
# 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)

View File

@ -48,8 +48,6 @@ FIND_LIBRARY(GroupGUI GroupGUI ${GEOM_ROOT_DIR}/lib/salome)
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)

View File

@ -120,8 +120,6 @@ SET(GEOM_GEOMEngine GEOMEngine)
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)

View File

@ -28,8 +28,6 @@ INCLUDE_DIRECTORIES(
${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}

View File

@ -51,8 +51,6 @@
#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 @@*/
@ -90,6 +88,8 @@
#include <GC_MakeConicalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <cmath>
#include "AdvancedEngine_Types.hxx"
@ -1143,7 +1143,7 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
// 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;
@ -1197,47 +1197,39 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
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()) {
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();
@ -1251,26 +1243,55 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
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");
@ -1289,7 +1310,7 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
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()) {
@ -1903,9 +1924,9 @@ TopoDS_Shape GEOMImpl_IAdvancedOperations::MakeThicknessReduction (gp_Ax2 theAxe
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);

View File

@ -21,7 +21,7 @@
# 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
)

View File

@ -23,8 +23,6 @@
INCLUDE_DIRECTORIES(
${CAS_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/NMTTools
${PROJECT_SOURCE_DIR}/src/NMTDS
${CMAKE_CURRENT_SOURCE_DIR}
)
@ -37,54 +35,42 @@ ADD_DEFINITIONS(
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
@ -99,65 +85,52 @@ SET(GEOMAlgo_HEADERS
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
@ -166,24 +139,16 @@ SET(GEOMAlgo_SOURCES
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_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 ---

View File

@ -1,145 +1,110 @@
GEOMAlgo_Builder_0.cxx
GEOMAlgo_Builder_1.cxx
GEOMAlgo_Builder_2.cxx
GEOMAlgo_Builder_3.cxx
GEOMAlgo_Builder_4.cxx
GEOMAlgo_ShapeInfoFiller_1.cxx
GEOMAlgo_Tools_1.cxx
GEOMAlgo_Gluer2.hxx
GEOMAlgo_Gluer2.cxx
GEOMAlgo_Gluer2_1.cxx
GEOMAlgo_Gluer2_2.cxx
GEOMAlgo_Gluer2_3.cxx
GEOMAlgo_GluerAlgo.hxx
GEOMAlgo_GluerAlgo.cxx
GEOMAlgo_GlueDetector.hxx
GEOMAlgo_GlueDetector.cxx
GEOMAlgo_GetInPlace.hxx
GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GetInPlace_1.cxx
GEOMAlgo_GetInPlace_2.cxx
GEOMAlgo_GetInPlace_3.cxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_FinderShapeOnQuad.cxx
GEOMAlgo_WireSplitter.hxx
GEOMAlgo_WireSplitter.cxx
GEOMAlgo_WESScaler.hxx
GEOMAlgo_WESScaler.cxx
GEOMAlgo_WESCorrector.hxx
GEOMAlgo_WESCorrector.cxx
GEOMAlgo_WireEdgeSet.hxx
GEOMAlgo_WireEdgeSet.cxx
GEOMAlgo_GlueAnalyser.hxx
GEOMAlgo_GlueAnalyser.cxx
GEOMAlgo_Gluer.hxx
GEOMAlgo_Gluer.cxx
GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOn2.cxx
GEOMAlgo_FinderShapeOn1.hxx
GEOMAlgo_FinderShapeOn1.cxx
GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOn.cxx
GEOMAlgo_ShapeAlgo.hxx
GEOMAlgo_ShapeAlgo.cxx
GEOMAlgo_SolidSolid.hxx
GEOMAlgo_SolidSolid.cxx
GEOMAlgo_ShellSolid.hxx
GEOMAlgo_ShellSolid.cxx
GEOMAlgo_Algo.hxx
GEOMAlgo_Algo.cxx
GEOMAlgo_ShapeSolid.hxx
GEOMAlgo_ShapeSolid.cxx
GEOMAlgo_VertexSolid.hxx
GEOMAlgo_VertexSolid.cxx
GEOMAlgo_WireSolid.hxx
GEOMAlgo_WireSolid.cxx
GEOMAlgo_ShapeSolid.hxx
GEOMAlgo_ShapeSolid.cxx
GEOMAlgo_Splitter.hxx
GEOMAlgo_Splitter.cxx
GEOMAlgo_Builder.hxx
GEOMAlgo_Builder.cxx
GEOMAlgo_BuilderShape.hxx
GEOMAlgo_BuilderShape.cxx
GEOMAlgo_BuilderArea.hxx
GEOMAlgo_BuilderArea.cxx
GEOMAlgo_BuilderFace.hxx
GEOMAlgo_BuilderFace.cxx
GEOMAlgo_BuilderSolid.hxx
GEOMAlgo_BuilderSolid.cxx
GEOMAlgo_ShapeInfoFiller.hxx
GEOMAlgo_ShapeInfoFiller.cxx
GEOMAlgo_Algo.hxx
GEOMAlgo_Algo.cxx
GEOMAlgo_ShapeSet.hxx
GEOMAlgo_ShapeSet.cxx
GEOMAlgo_SurfaceTools.hxx
GEOMAlgo_SurfaceTools.cxx
GEOMAlgo_State.hxx
GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_KindOfClosed.hxx
GEOMAlgo_KindOfName.hxx
GEOMAlgo_KindOfShape.hxx
GEOMAlgo_ShapeInfo.hxx
GEOMAlgo_ShapeInfo.cxx
GEOMAlgo_CoupleOfShapes.hxx
GEOMAlgo_CoupleOfShapes.cxx
GEOMAlgo_BuilderTools.hxx
GEOMAlgo_BuilderTools.cxx
GEOMAlgo_Tools3D.hxx
GEOMAlgo_Tools3D.cxx
GEOMAlgo_Tools.hxx
GEOMAlgo_Tools.cxx
GEOMAlgo_PWireEdgeSet.hxx
GEOMAlgo_StateCollector.cxx
GEOMAlgo_StateCollector.hxx
GEOMAlgo_PassKey.hxx
GEOMAlgo_PassKey.cxx
GEOMAlgo_PassKeyMapHasher.hxx
GEOMAlgo_PassKeyMapHasher.cxx
GEOMAlgo_PassKeyShape.hxx
GEOMAlgo_PassKeyShape.cxx
GEOMAlgo_PassKeyShapeMapHasher.hxx
GEOMAlgo_PassKeyShapeMapHasher.cxx
GEOMAlgo_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_Clsf.hxx
GEOMAlgo_Clsf.cxx
GEOMAlgo_HAlgo.hxx
GEOMAlgo_HAlgo.cxx
GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOn2.cxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_FinderShapeOnQuad.cxx
GEOMAlgo_Gluer.hxx
GEOMAlgo_Gluer.cxx
GEOMAlgo_GlueAnalyser.hxx
GEOMAlgo_GlueAnalyser.cxx
GEOMAlgo_GluerAlgo.hxx
GEOMAlgo_GluerAlgo.cxx
GEOMAlgo_GlueDetector.hxx
GEOMAlgo_GlueDetector.cxx
GEOMAlgo_BuilderShape.hxx
GEOMAlgo_BuilderShape.cxx
GEOMAlgo_Gluer2.hxx
GEOMAlgo_Gluer2.cxx
GEOMAlgo_Gluer2_1.cxx
GEOMAlgo_Gluer2_2.cxx
GEOMAlgo_Gluer2_3.cxx
GEOMAlgo_GetInPlace.hxx
GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GetInPlace_1.cxx
GEOMAlgo_GetInPlace_2.cxx
GEOMAlgo_GetInPlace_3.cxx
GEOMAlgo_Splitter.hxx
GEOMAlgo_Splitter.cxx
GEOMAlgo_ShapeInfoFiller.hxx
GEOMAlgo_ShapeInfoFiller.cxx
GEOMAlgo_ShapeInfoFiller_1.cxx
GEOMAlgo_RemoverWebs.hxx
GEOMAlgo_RemoverWebs.cxx
GEOMAlgo_ListOfCoupleOfShapes.hxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
GEOMAlgo_PassKeyShape.hxx
GEOMAlgo_PassKeyShape.cxx
GEOMAlgo_PassKeyShapeMapHasher.hxx
GEOMAlgo_PassKeyShapeMapHasher.cxx
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_State.hxx
GEOMAlgo_SurfaceTools.hxx
GEOMAlgo_SurfaceTools.cxx
GEOMAlgo_ListOfPnt.hxx
GEOMAlgo_ListIteratorOfListOfPnt.hxx
GEOMAlgo_DataMapOfShapeShapeSet.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx
GEOMAlgo_DataMapOfShapeReal.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx
GEOMAlgo_DataMapOfRealListOfShape.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx
GEOMAlgo_StateCollector.cxx
GEOMAlgo_StateCollector.hxx
GEOMAlgo_PassKey.hxx
GEOMAlgo_PassKey.cxx
GEOMAlgo_PassKeyMapHasher.hxx
GEOMAlgo_PassKeyMapHasher.cxx
GEOMAlgo_RemoverWebs.hxx
GEOMAlgo_RemoverWebs.cxx
GEOMAlgo_DataMapOfPassKeyInteger.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx
GEOMAlgo_DataMapOfPassKeyShapeShape.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx
GEOMAlgo_DataMapOfOrientedShapeShape.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx
GEOMAlgo_DataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapOfShapePnt.hxx
GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx
GEOMAlgo_IndexedDataMapOfShapeBox.hxx
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
GEOMAlgo_IndexedDataMapOfShapeBox.hxx
GEOMAlgo_CoupleOfShapes.hxx
GEOMAlgo_CoupleOfShapes.cxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
GEOMAlgo_ListOfCoupleOfShapes.hxx
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
GEOMAlgo_DataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapOfShapePnt.hxx
GEOMAlgo_BndSphere.hxx
GEOMAlgo_BndSphere.cxx
GEOMAlgo_BndSphere.lxx
GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
GEOMAlgo_BndSphereTree.hxx
GEOMAlgo_BndSphereTree.cxx
GEOMAlgo_BoxBndTree.hxx
GEOMAlgo_BoxBndTree.cxx
GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_KindOfClosed.hxx
GEOMAlgo_KindOfName.hxx
GEOMAlgo_KindOfShape.hxx
GEOMAlgo_ShapeInfo.hxx
GEOMAlgo_ShapeInfo.cxx
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Basics_OCCTVersion.hxx

View File

@ -27,26 +27,7 @@ package GEOMAlgo
---Purpose:
uses
TCollection,
TColgp,
Geom,
Bnd,
gp,
GeomAdaptor,
TopAbs,
TopoDS,
TopTools,
IntTools,
BOPTools,
BOP,
TColStd,
BOPTColStd,
BRepAlgo,
NMTDS,
NMTTools
--uses
is
-- Enumerations
@ -56,72 +37,96 @@ is
imported KindOfBounds from GEOMAlgo;
imported KindOfClosed from GEOMAlgo;
--
-- Gluer / GetInPlace
imported Gluer2 from GEOMAlgo;
imported GlueDetector from GEOMAlgo;
imported GluerAlgo from GEOMAlgo;
imported GetInPlace from GEOMAlgo;
-- Algos
imported 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 Algo from GEOMAlgo;
imported ShapeSolid from GEOMAlgo;
imported VertexSolid from GEOMAlgo;
imported WireSolid from GEOMAlgo;
imported ShapeSolid from GEOMAlgo;
imported Splitter from GEOMAlgo;
imported Builder 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 BuilderSolid from GEOMAlgo;
imported BuilderFace from GEOMAlgo;
imported BuilderArea from GEOMAlgo;
imported Gluer2 from GEOMAlgo;
imported GetInPlace from GEOMAlgo;
imported Splitter from GEOMAlgo;
--
--
imported AlgoTools from GEOMAlgo;
-- Gluer / GetInPlace
--
--
-- 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 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 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;

View File

@ -31,7 +31,7 @@
// function:
// purpose:
//=======================================================================
GEOMAlgo_Algo::GEOMAlgo_Algo()
GEOMAlgo_Algo::GEOMAlgo_Algo()
:
myErrorStatus(1),
myWarningStatus(0),
@ -41,14 +41,14 @@
// function: ~
// purpose:
//=======================================================================
GEOMAlgo_Algo::~GEOMAlgo_Algo()
GEOMAlgo_Algo::~GEOMAlgo_Algo()
{
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
void GEOMAlgo_Algo::CheckData()
void GEOMAlgo_Algo::CheckData()
{
myErrorStatus=0;
}
@ -56,7 +56,7 @@
// function: CheckResult
// purpose:
//=======================================================================
void GEOMAlgo_Algo::CheckResult()
void GEOMAlgo_Algo::CheckResult()
{
myErrorStatus=0;
}
@ -64,7 +64,7 @@
// function: ErrorStatus
// purpose:
//=======================================================================
Standard_Integer GEOMAlgo_Algo::ErrorStatus()const
Standard_Integer GEOMAlgo_Algo::ErrorStatus()const
{
return myErrorStatus;
}
@ -72,7 +72,7 @@
// function: WarningStatus
// purpose:
//=======================================================================
Standard_Integer GEOMAlgo_Algo::WarningStatus()const
Standard_Integer GEOMAlgo_Algo::WarningStatus()const
{
return myWarningStatus;
}
@ -84,7 +84,7 @@
//function : ComputeInternalShapes
//purpose :
//=======================================================================
void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
{
myComputeInternalShapes = theFlag;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,201 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMAlgo_AlgoTools.hxx
// Created :
// Author : Peter KURNEV
#ifndef _GEOMAlgo_AlgoTools_HeaderFile
#define _GEOMAlgo_AlgoTools_HeaderFile
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Boolean.hxx>
#include <Handle_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

View File

@ -0,0 +1,141 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMAlgo_AlgoTools_2.cxx
// Created :
// Author : Peter KURNEV
#include <GEOMAlgo_AlgoTools.hxx>
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
static
void ProcessBlock(const TopoDS_Shape& aF,
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
TopTools_IndexedMapOfShape& aProcessed,
TopTools_IndexedMapOfShape& aChain);
//=======================================================================
// function: FindChains
// purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
{
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
//
aItCS.Initialize(aLCS);
for (; aItCS.More(); aItCS.Next()) {
const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value();
//
const TopoDS_Shape& aF1=aCS.Shape1();
const TopoDS_Shape& aF2=aCS.Shape2();
//
//
if (aMCV.Contains(aF1)) {
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1);
aMV.Add(aF1);
aMV.Add(aF2);
}
else {
TopTools_IndexedMapOfShape aMV;
aMV.Add(aF1);
aMV.Add(aF2);
aMCV.Add(aF1, aMV);
}
//
if (aMCV.Contains(aF2)) {
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2);
aMV.Add(aF1);
aMV.Add(aF2);
}
else {
TopTools_IndexedMapOfShape aMV;
aMV.Add(aF1);
aMV.Add(aF2);
aMCV.Add(aF2, aMV);
}
}
GEOMAlgo_AlgoTools::FindChains(aMCV, aMapChains);
}
//=======================================================================
// function: FindChains
// purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
{
Standard_Integer i, j, aNbCV, aNbV;
TopTools_IndexedMapOfShape aProcessed, aChain;
//
aNbCV=aMCV.Extent();
for (i=1; i<=aNbCV; ++i) {
const TopoDS_Shape& aF=aMCV.FindKey(i);
if (aProcessed.Contains(aF)) {
continue;
}
//
aProcessed.Add(aF);
aChain.Add(aF);
//
const TopTools_IndexedMapOfShape& aMV=aMCV(i);
aNbV=aMV.Extent();
for (j=1; j<=aNbV; ++j) {
const TopoDS_Shape& aFx=aMV(j);
ProcessBlock(aFx, aMCV, aProcessed, aChain);
}
aMapChains.Add(aF, aChain);
aChain.Clear();
}
}
//=======================================================================
// function: ProcessBlock
// purpose:
//=======================================================================
void ProcessBlock(const TopoDS_Shape& aF,
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
TopTools_IndexedMapOfShape& aProcessed,
TopTools_IndexedMapOfShape& aChain)
{
Standard_Integer j, aNbV;
//
if (aProcessed.Contains(aF)) {
return;
}
aProcessed.Add(aF);
aChain.Add(aF);
//
const TopTools_IndexedMapOfShape& aMV=aMCV.FindFromKey(aF);
aNbV=aMV.Extent();
for (j=1; j<=aNbV; ++j) {
const TopoDS_Shape& aFx=aMV(j);
ProcessBlock(aFx, aMCV, aProcessed, aChain);
}
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -17,18 +17,18 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BndSphere.cxx
// File: GEOMAlgo_BndSphere.cxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTDS_BndSphere.hxx>
#include <GEOMAlgo_BndSphere.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
NMTDS_BndSphere::NMTDS_BndSphere()
GEOMAlgo_BndSphere::GEOMAlgo_BndSphere()
{
myCenter.SetCoord(0., 0., 0.);
myRadius=0.;
@ -38,14 +38,14 @@
//function : ~
//purpose :
//=======================================================================
NMTDS_BndSphere::~NMTDS_BndSphere()
GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere()
{
}
//=======================================================================
//function : IsOut
//purpose :
//=======================================================================
Standard_Boolean NMTDS_BndSphere::IsOut(const NMTDS_BndSphere& theOther)const
Standard_Boolean GEOMAlgo_BndSphere::IsOut(const GEOMAlgo_BndSphere& theOther)const
{
Standard_Real aD2, aT2;
//

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -17,13 +17,13 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BndSphere.hxx
// File: GEOMAlgo_BndSphere.hxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
#ifndef _NMTDS_BndSphere_HeaderFile
#define _NMTDS_BndSphere_HeaderFile
#ifndef _GEOMAlgo_BndSphere_HeaderFile
#define _GEOMAlgo_BndSphere_HeaderFile
#include <Standard.hxx>
#include <Standard_Macro.hxx>
@ -32,16 +32,16 @@
#include <Standard_Boolean.hxx>
//=======================================================================
//class : NMTDS_BndSphere
//class : GEOMAlgo_BndSphere
//purpose :
//=======================================================================
class NMTDS_BndSphere {
class GEOMAlgo_BndSphere {
public:
Standard_EXPORT
NMTDS_BndSphere();
GEOMAlgo_BndSphere();
Standard_EXPORT
virtual ~NMTDS_BndSphere();
virtual ~GEOMAlgo_BndSphere();
void SetCenter(const gp_Pnt& theP) ;
@ -55,10 +55,10 @@ class NMTDS_BndSphere {
Standard_Real Gap() const;
void Add(const NMTDS_BndSphere& theOther) ;
void Add(const GEOMAlgo_BndSphere& theOther) ;
Standard_EXPORT
Standard_Boolean IsOut(const NMTDS_BndSphere& theOther) const;
Standard_Boolean IsOut(const GEOMAlgo_BndSphere& theOther) const;
Standard_Real SquareExtent() const;
@ -68,6 +68,6 @@ class NMTDS_BndSphere {
Standard_Real myGap;
};
#include <NMTDS_BndSphere.lxx>
#include <GEOMAlgo_BndSphere.lxx>
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -17,7 +17,7 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BndSphere.lxx
// File: GEOMAlgo_BndSphere.lxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
@ -25,7 +25,7 @@
//function : SetCenter
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::SetCenter(const gp_Pnt& theP)
inline void GEOMAlgo_BndSphere::SetCenter(const gp_Pnt& theP)
//
{
myCenter=theP;
@ -34,7 +34,7 @@
//function : Center
//purpose :
//=======================================================================
inline const gp_Pnt& NMTDS_BndSphere::Center()const
inline const gp_Pnt& GEOMAlgo_BndSphere::Center()const
{
return myCenter;
}
@ -42,7 +42,7 @@
//function : SetRadius
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::SetRadius(const Standard_Real theR)
inline void GEOMAlgo_BndSphere::SetRadius(const Standard_Real theR)
{
myRadius=theR;
}
@ -50,7 +50,7 @@
//function : Radius
//purpose :
//=======================================================================
inline Standard_Real NMTDS_BndSphere::Radius()const
inline Standard_Real GEOMAlgo_BndSphere::Radius()const
{
return myRadius;
}
@ -58,7 +58,7 @@
//function : SetGap
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::SetGap(const Standard_Real theGap)
inline void GEOMAlgo_BndSphere::SetGap(const Standard_Real theGap)
{
myGap=theGap;
}
@ -66,7 +66,7 @@
//function : Gap
//purpose :
//=======================================================================
inline Standard_Real NMTDS_BndSphere::Gap()const
inline Standard_Real GEOMAlgo_BndSphere::Gap()const
{
return myGap;
}
@ -74,7 +74,7 @@
//function : Add
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::Add(const NMTDS_BndSphere& theOther)
inline void GEOMAlgo_BndSphere::Add(const GEOMAlgo_BndSphere& theOther)
{
Standard_Real aTmax, aR, aT, aTOther;
gp_Pnt aPc;
@ -96,7 +96,7 @@
//function : SquareExtent
//purpose :
//=======================================================================
inline Standard_Real NMTDS_BndSphere::SquareExtent()const
inline Standard_Real GEOMAlgo_BndSphere::SquareExtent()const
{
Standard_Real aD;
//

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -17,31 +17,31 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BndSphereTree.cxx
// File: GEOMAlgo_BndSphereTree.cxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTDS_BndSphereTree.hxx>
#include <GEOMAlgo_BndSphereTree.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
NMTDS_BndSphereTreeSelector::NMTDS_BndSphereTreeSelector()
GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
NMTDS_BndSphereTreeSelector::~NMTDS_BndSphereTreeSelector()
GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector()
{
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean NMTDS_BndSphereTreeSelector::Reject (const NMTDS_BndSphere& aBox) const
Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Reject (const GEOMAlgo_BndSphere& aBox) const
{
Standard_Boolean bRet;
//
@ -52,7 +52,7 @@
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean NMTDS_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
{
Standard_Boolean bRet=Standard_False;
//
@ -66,7 +66,7 @@
//function : SetBox
//purpose :
//=======================================================================
void NMTDS_BndSphereTreeSelector::SetBox(const NMTDS_BndSphere& aBox)
void GEOMAlgo_BndSphereTreeSelector::SetBox(const GEOMAlgo_BndSphere& aBox)
{
myBox=aBox;
}
@ -74,7 +74,7 @@
//function : Clear
//purpose :
//=======================================================================
void NMTDS_BndSphereTreeSelector::Clear()
void GEOMAlgo_BndSphereTreeSelector::Clear()
{
myFence.Clear();
myIndices.Clear();
@ -83,7 +83,7 @@
//function : Indices
//purpose :
//=======================================================================
const TColStd_ListOfInteger& NMTDS_BndSphereTreeSelector::Indices() const
const TColStd_ListOfInteger& GEOMAlgo_BndSphereTreeSelector::Indices() const
{
return myIndices;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -17,34 +17,34 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BndSphereTree.hxx
// File: GEOMAlgo_BndSphereTree.hxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
//
#ifndef NMTDS_BndSphereTree_HeaderFile
#define NMTDS_BndSphereTree_HeaderFile
#ifndef GEOMAlgo_BndSphereTree_HeaderFile
#define GEOMAlgo_BndSphereTree_HeaderFile
#include <NCollection_UBTree.hxx>
#include <NMTDS_BndSphere.hxx>
#include <GEOMAlgo_BndSphere.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
typedef NCollection_UBTree <Standard_Integer , NMTDS_BndSphere> NMTDS_BndSphereTree;
typedef NCollection_UBTree <Standard_Integer , GEOMAlgo_BndSphere> GEOMAlgo_BndSphereTree;
class NMTDS_BndSphereTreeSelector : public NMTDS_BndSphereTree::Selector {
class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector {
public:
Standard_EXPORT NMTDS_BndSphereTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const NMTDS_BndSphere&) const;
Standard_EXPORT GEOMAlgo_BndSphereTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const GEOMAlgo_BndSphere&) const;
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
Standard_EXPORT virtual ~NMTDS_BndSphereTreeSelector();
Standard_EXPORT virtual ~GEOMAlgo_BndSphereTreeSelector();
Standard_EXPORT void Clear();
Standard_EXPORT void SetBox(const NMTDS_BndSphere&);
Standard_EXPORT void SetBox(const GEOMAlgo_BndSphere&);
Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
protected:
NMTDS_BndSphere myBox;
GEOMAlgo_BndSphere myBox;
TColStd_MapOfInteger myFence;
TColStd_ListOfInteger myIndices;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -20,31 +20,31 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BoxBndTree.cxx
// File: GEOMAlgo_BoxBndTree.cxx
// Created: Tue Oct 17 13:04:11 2006
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTDS_BoxBndTree.hxx>
#include <GEOMAlgo_BoxBndTree.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
NMTDS_BoxBndTreeSelector::NMTDS_BoxBndTreeSelector()
GEOMAlgo_BoxBndTreeSelector::GEOMAlgo_BoxBndTreeSelector()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
NMTDS_BoxBndTreeSelector::~NMTDS_BoxBndTreeSelector()
GEOMAlgo_BoxBndTreeSelector::~GEOMAlgo_BoxBndTreeSelector()
{
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean NMTDS_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
Standard_Boolean GEOMAlgo_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
{
Standard_Boolean bRet;
//
@ -55,7 +55,7 @@
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean NMTDS_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
Standard_Boolean GEOMAlgo_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
{
Standard_Boolean bRet=Standard_False;
//
@ -69,7 +69,7 @@
//function : SetBox
//purpose :
//=======================================================================
void NMTDS_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
void GEOMAlgo_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
{
myBox=aBox;
}
@ -77,7 +77,7 @@
//function : Clear
//purpose :
//=======================================================================
void NMTDS_BoxBndTreeSelector::Clear()
void GEOMAlgo_BoxBndTreeSelector::Clear()
{
myFence.Clear();
myIndices.Clear();
@ -86,7 +86,7 @@
//function : Indices
//purpose :
//=======================================================================
const TColStd_ListOfInteger& NMTDS_BoxBndTreeSelector::Indices() const
const TColStd_ListOfInteger& GEOMAlgo_BoxBndTreeSelector::Indices() const
{
return myIndices;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -20,27 +20,27 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_BoxBndTree.hxx
// File: GEOMAlgo_BoxBndTree.hxx
// Created: Tue Oct 17 12:50:31 2006
// Author: Peter KURNEV
// <pkv@irinox>
//
#ifndef NMTDS_BoxBndTree_HeaderFile
#define NMTDS_BoxBndTree_HeaderFile
#ifndef GEOMAlgo_BoxBndTree_HeaderFile
#define GEOMAlgo_BoxBndTree_HeaderFile
#include <NCollection_UBTree.hxx>
#include <Bnd_Box.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> NMTDS_BoxBndTree;
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> GEOMAlgo_BoxBndTree;
class NMTDS_BoxBndTreeSelector : public NMTDS_BoxBndTree::Selector {
class GEOMAlgo_BoxBndTreeSelector : public GEOMAlgo_BoxBndTree::Selector {
public:
Standard_EXPORT NMTDS_BoxBndTreeSelector();
Standard_EXPORT GEOMAlgo_BoxBndTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box&) const;
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
Standard_EXPORT virtual ~NMTDS_BoxBndTreeSelector();
Standard_EXPORT virtual ~GEOMAlgo_BoxBndTreeSelector();
Standard_EXPORT void Clear();
Standard_EXPORT void SetBox(const Bnd_Box&);

View File

@ -1,416 +0,0 @@
// 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

View File

@ -1,224 +0,0 @@
// 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

View File

@ -1,142 +0,0 @@
// 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()
{
}

View File

@ -1,112 +0,0 @@
// 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

View File

@ -1,711 +0,0 @@
// 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);
}
*/

View File

@ -1,91 +0,0 @@
// 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

View File

@ -25,6 +25,7 @@
// Author: Peter KURNEV
//
#include <GEOMAlgo_BuilderShape.hxx>
//=======================================================================
//function :
//purpose :
@ -117,11 +118,8 @@
myHasDeleted=Standard_False;
myHasGenerated=Standard_False;
myHasModified=Standard_False;
//modified by NIZNHY-PKV Thu Dec 7 11:14:15 2006
myImagesResult.Clear();
//modified by NIZNHY-PKV Thu Dec 7 11:14:17 2006t
}
//modified by NIZNHY-PKV Thu Dec 7 11:57:00 2006f
//=======================================================================
//function : ImagesResult
//purpose :
@ -130,4 +128,3 @@
{
return myImagesResult;
}
//modified by NIZNHY-PKV Thu Dec 7 11:57:04 2006t

View File

@ -29,11 +29,14 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Boolean.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <GEOMAlgo_Algo.hxx>

View File

@ -1,931 +0,0 @@
// 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

View File

@ -1,77 +0,0 @@
// 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

View File

@ -1,292 +0,0 @@
// 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
}

View File

@ -1,48 +0,0 @@
// 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

View File

@ -1,64 +0,0 @@
// 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;
}

View File

@ -1,360 +0,0 @@
// 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);
}

View File

@ -1,999 +0,0 @@
// 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;
}
*/

View File

@ -1,770 +0,0 @@
// 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

View File

@ -1,316 +0,0 @@
// 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);
}
}

View File

@ -27,21 +27,25 @@
//
#include <GEOMAlgo_ClsfBox.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <GEOMAlgo_SurfaceTools.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <Geom_Surface.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Plane.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>
#include <gp_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)

View File

@ -30,7 +30,7 @@
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
//#include <Handle_GEOMAlgo_ClsfBox.hxx>
#include <TopoDS_Shape.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GEOMAlgo_Clsf.hxx>

View File

@ -25,8 +25,10 @@
#include <GEOMAlgo_ClsfSolid.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_Builder.hxx>
#include <BRepClass3d_SolidClassifier.hxx>

View File

@ -27,7 +27,6 @@
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
//#include <Handle_GEOMAlgo_ClsfSolid.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Address.hxx>
#include <GEOMAlgo_Clsf.hxx>

View File

@ -26,10 +26,12 @@
// <pkv@irinox>
//
#include <GEOMAlgo_ClsfSurf.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <GEOMAlgo_SurfaceTools.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GEOMAlgo_SurfaceTools.hxx>
IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf);
IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf);

View File

@ -30,7 +30,6 @@
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
//#include <Handle_GEOMAlgo_ClsfSurf.hxx>
#include <Handle_Geom_Surface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GEOMAlgo_Clsf.hxx>

View File

@ -1,32 +0,0 @@
// 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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,32 +0,0 @@
// 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

View File

@ -1,32 +0,0 @@
// 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

View File

@ -1,42 +0,0 @@
// 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

View File

@ -1,40 +0,0 @@
// 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

View File

@ -1,43 +0,0 @@
// 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

View File

@ -1,41 +0,0 @@
// 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

View File

@ -1,42 +0,0 @@
// 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

View File

@ -64,7 +64,7 @@
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
#include <BOPTools_DSFiller.hxx>
//#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
@ -72,7 +72,10 @@
#include <GEOMAlgo_ShapeSolid.hxx>
#include <GEOMAlgo_SolidSolid.hxx>
#include <GEOMAlgo_SurfaceTools.hxx>
#include <GEOMAlgo_Tools.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPCol_ListOfShape.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn
@ -267,7 +270,7 @@ void GEOMAlgo_FinderShapeOn::Find()
return;
}
//
bICS=GEOMAlgo_Tools::IsCompositeShape(myArg2);
bICS=GEOMAlgo_AlgoTools::IsCompositeShape(myArg2);
if (!bICS || myIsAnalytic) {
TopoDS_Compound aCmp;
BRep_Builder aBB;
@ -303,19 +306,18 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
Standard_Integer i, iErr;
TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
TopTools_ListIteratorOfListOfShape aIt;
BOPTools_DSFiller aDF;
BOPCol_ListOfShape aLS;
BOPAlgo_PaveFiller aPF;
//
// 1. Prepare DSFiller
aDF.SetShapes (myArg1, aS);
bIsDone=aDF.IsDone();
if (!bIsDone) {
myErrorStatus=30; // wrong args are used for DSFiller
return;
}
aDF.Perform();
bIsDone=aDF.IsDone();
if (!bIsDone) {
myErrorStatus=31; // DSFiller failed
aLS.Append(myArg1);
aLS.Append(aS);
aPF.SetArguments(aLS);
//
aPF.Perform();
iErr=aPF.ErrorStatus();
if (iErr) {
myErrorStatus=31; // PaveFiller is failed
return;
}
//
@ -347,7 +349,7 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
return;
}
//
pSS->SetFiller(aDF);
pSS->SetFiller(aPF);
pSS->Perform();
iErr=pSS->ErrorStatus();
if (iErr) {
@ -396,6 +398,7 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1()
#else
aMF.Init(mySurface, Standard_True);
#endif
aFErr=aMF.Error();
if (aFErr!=BRepLib_FaceDone) {
myErrorStatus=20; // can not build the face
@ -409,6 +412,7 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1()
aM.Add(aF);
TopExp::MapShapes(aF, TopAbs_VERTEX, aM);
TopExp::MapShapes(aF, TopAbs_EDGE, aM);
aNb=aM.Extent();
for (i=1; i<=aNb; ++i) {
const TopoDS_Shape& aS=aM(i);

View File

@ -30,17 +30,22 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Boolean.hxx>
#include <Handle_Geom_Surface.hxx>
#include <Geom_Surface.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <GEOMAlgo_State.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
#include <Standard_Boolean.hxx>
#include <GEOMAlgo_State.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <Geom_Surface.hxx>
#include <TopoDS_Shape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn

View File

@ -69,15 +69,14 @@
#include <BRepLib_MakeEdge.hxx>
#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
#include <GEOMAlgo_SurfaceTools.hxx>
#include <GEOMAlgo_StateCollector.hxx>
#include <GEOMAlgo_FinderShapeOn.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
#include <GEOMAlgo_PassKey.hxx>
#include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn1
//purpose :
@ -548,7 +547,7 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
//
aTRF=BRep_Tool::Triangulation(aF, aLoc);
if (aTRF.IsNull()) {
if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aF)) {
if (!GEOMAlgo_AlgoTools::BuildTriangulation(aF)) {
myWarningStatus=20; // no triangulation found
return;
}
@ -793,63 +792,3 @@ TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP)
// 20- no triangulation found
// 30- can not obtain the line from the link
//modified by NIZNHY-PKV Thu Jan 26 10:01:14 2012f
/*
//=======================================================================
//function : InnerPoints
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
GEOMAlgo_ListOfPnt& aLP)
{
myErrorStatus=0;
//
Standard_Integer j, aNbNodes, aIndex, aNb;
Handle(Poly_PolygonOnTriangulation) aPTE;
Handle(Poly_Triangulation) aTRE;
TopLoc_Location aLoc;
gp_Pnt aP;
//
aLP.Clear();
BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc);
if (aTRE.IsNull() || aPTE.IsNull()) {
Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc);
if (aPE.IsNull()) {
if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aE)) {
myErrorStatus=20; // no triangulation found
return;
}
aPE = BRep_Tool::Polygon3D(aE, aLoc);
}
const gp_Trsf& aTrsf=aLoc.Transformation();
const TColgp_Array1OfPnt& aNodes=aPE->Nodes();
//
aNbNodes=aPE->NbNodes();
Standard_Integer low = aNodes.Lower(), up = aNodes.Upper();
for (j=low+1; j<up; ++j) {
aP=aNodes(j).Transformed(aTrsf);
aLP.Append(aP);
}
}
else {
const gp_Trsf& aTrsf=aLoc.Transformation();
const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
//
aNbNodes=aPTE->NbNodes();
const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
for (j=2; j<aNbNodes; ++j) {
aIndex=aInds(j);
aP=aNodes(aIndex).Transformed(aTrsf);
aLP.Append(aP);
}
}
//
aNb=aLP.Extent();
if (!aNb && myNbPntsMin) {
// try to fill it yourself
InnerPoints(aE, myNbPntsMin, aLP);
aNb=aLP.Extent();
}
}
*/
//modified by NIZNHY-PKV Thu Jan 26 10:01:17 2012t

View File

@ -70,7 +70,6 @@
#include <BRepLib_MakeEdge.hxx>
#include <GEOMAlgo_ListIteratorOfListOfPnt.hxx>
#include <GEOMAlgo_SurfaceTools.hxx>
#include <GEOMAlgo_StateCollector.hxx>
#include <GEOMAlgo_FinderShapeOn.hxx>
@ -88,12 +87,12 @@
#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()

View File

@ -29,18 +29,21 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <GEOMAlgo_State.hxx>
#include <Standard_Integer.hxx>
//#include <Handle_GEOMAlgo_Clsf.hxx>
#include <GEOMAlgo_Clsf.hxx>
#include <TopTools_ListOfShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <GEOMAlgo_Clsf.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_ListOfShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
#include <GEOMAlgo_State.hxx>
#include <GEOMAlgo_ListOfPnt.hxx>
#include <GEOMAlgo_Clsf.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn2

View File

@ -25,7 +25,7 @@
#include <GEOMAlgo_GetInPlace.hxx>
#include <NMTDS_BoxBndTree.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <Bnd_Box.hxx>
@ -58,9 +58,8 @@
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <NMTTools_CoupleOfShape.hxx>
#include <GEOMAlgo_Tools.hxx>
#include <GEOMAlgo_BoxBndTree.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
static
@ -301,10 +300,10 @@ void GEOMAlgo_GetInPlace::Intersect()
TopTools_DataMapOfShapeListOfShape aDMSLS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
TopTools_ListIteratorOfListOfShape aItLS;
NMTTools_CoupleOfShape aCS;
GEOMAlgo_CoupleOfShapes aCS;
//
NMTDS_BoxBndTreeSelector aSelector;
NMTDS_BoxBndTree aBBTree;
GEOMAlgo_BoxBndTreeSelector aSelector;
GEOMAlgo_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
myErrorStatus=0;
@ -391,7 +390,7 @@ void GEOMAlgo_GetInPlace::PerformVV()
//
myIterator.Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aV1=aCS.Shape1();
const TopoDS_Shape& aV2=aCS.Shape2();
//
@ -446,7 +445,7 @@ void GEOMAlgo_GetInPlace::PerformVE()
// 2. Fill Shapes In
myIterator.Initialize(TopAbs_EDGE, TopAbs_VERTEX);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aE1=aCS.Shape1();
const TopoDS_Shape& aV2=aCS.Shape2();
//
@ -481,7 +480,7 @@ void GEOMAlgo_GetInPlace::PerformEE()
//
myIterator.Initialize(TopAbs_EDGE, TopAbs_EDGE);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aE1=aCS.Shape1();
const TopoDS_Shape& aE2=aCS.Shape2();
//
@ -528,7 +527,7 @@ void GEOMAlgo_GetInPlace::PerformVF()
//
myIterator.Initialize(TopAbs_FACE, TopAbs_VERTEX);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aF1=aCS.Shape1();
const TopoDS_Shape& aV2=aCS.Shape2();
//
@ -626,7 +625,7 @@ void GEOMAlgo_GetInPlace::PerformEF()
//
myIterator.Initialize(TopAbs_FACE, TopAbs_EDGE);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aF1=aCS.Shape1();
const TopoDS_Shape& aE2=aCS.Shape2();
//
@ -679,7 +678,7 @@ void GEOMAlgo_GetInPlace::PerformFF()
//
myIterator.Initialize(TopAbs_FACE, TopAbs_FACE);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aF1=aCS.Shape1();
const TopoDS_Shape& aF2=aCS.Shape2();
//
@ -773,7 +772,7 @@ void GEOMAlgo_GetInPlace::PerformZF()
//
myIterator.Initialize(TopAbs_SOLID, TopAbs_FACE);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aSo1=aCS.Shape1();
const TopoDS_Shape& aF2=aCS.Shape2();
//
@ -809,7 +808,7 @@ void GEOMAlgo_GetInPlace::PerformZZ()
//
myIterator.Initialize(TopAbs_SOLID, TopAbs_SOLID);
for (; myIterator.More(); myIterator.Next()) {
const NMTTools_CoupleOfShape& aCS=myIterator.Value();
const GEOMAlgo_CoupleOfShapes& aCS=myIterator.Value();
const TopoDS_Shape& aSo1=aCS.Shape1();
const TopoDS_Shape& aSo2=aCS.Shape2();
//

View File

@ -35,9 +35,9 @@
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <NMTTools_CoupleOfShape.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx>
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_DataMapOfShapeMapOfShape.hxx>
#include <GEOMAlgo_GluerAlgo.hxx>
@ -81,7 +81,7 @@ class GEOMAlgo_GetInPlaceIterator {
* The pair of intersected shapes.
*/
//Standard_EXPORT
void AppendPair(const NMTTools_CoupleOfShape& theCS) ;
void AppendPair(const GEOMAlgo_CoupleOfShapes& theCS) ;
/**
* Initialize the iterator.
@ -113,13 +113,13 @@ class GEOMAlgo_GetInPlaceIterator {
* The pair of intersected shapes.
*/
//Standard_EXPORT
const NMTTools_CoupleOfShape& Value() const;
const GEOMAlgo_CoupleOfShapes& Value() const;
protected:
Standard_Integer myDim;
NMTTools_ListOfCoupleOfShape myLists[10];
NMTTools_ListOfCoupleOfShape myEmptyList;
NMTTools_ListIteratorOfListOfCoupleOfShape myIterator;
GEOMAlgo_ListOfCoupleOfShapes myLists[10];
GEOMAlgo_ListOfCoupleOfShapes myEmptyList;
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes myIterator;
private:
};

View File

@ -59,8 +59,7 @@
#include <IntTools_Tools.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_Tools2D.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
@ -259,7 +258,7 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
}
//
aP2Dx.Coord(aUx, aVx);
BOPTools_Tools2D::FaceNormal(aF, aUx, aVx, aDNx);
GEOMAlgo_AlgoTools::FaceNormal(aF, aUx, aVx, aDNx);
aDNx.Reverse();
//
aP.SetXYZ(aPx.XYZ()+aCoef*aTol*aDNx.XYZ());

View File

@ -25,7 +25,7 @@
#include <GEOMAlgo_GetInPlace.hxx>
#include <NMTTools_CoupleOfShape.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
static
Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
@ -62,7 +62,7 @@ void GEOMAlgo_GetInPlaceIterator::Clear()
//function : AppendPair
//purpose :
//=======================================================================
void GEOMAlgo_GetInPlaceIterator::AppendPair(const NMTTools_CoupleOfShape& theCS)
void GEOMAlgo_GetInPlaceIterator::AppendPair(const GEOMAlgo_CoupleOfShapes& theCS)
{
Standard_Integer iX;
TopAbs_ShapeEnum aType1, aType2;
@ -114,7 +114,7 @@ void GEOMAlgo_GetInPlaceIterator::Next()
// function: Value
// purpose:
//=======================================================================
const NMTTools_CoupleOfShape& GEOMAlgo_GetInPlaceIterator::Value()const
const GEOMAlgo_CoupleOfShapes& GEOMAlgo_GetInPlaceIterator::Value()const
{
return myIterator.Value();
}

View File

@ -26,11 +26,20 @@
#include <GEOMAlgo_GlueAnalyser.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <BRepBndLib.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Vertex.hxx>
#include <BRep_Builder.hxx>
@ -41,24 +50,16 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
#include <GEOMAlgo_Tools.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_Gluer.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <TopoDS_Vertex.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
#include <Bnd_Box.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRepBndLib.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_Gluer.hxx>
//=======================================================================
//function :
@ -302,7 +303,7 @@
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
if (iErr) {
myErrorStatus=200;
return;

View File

@ -52,21 +52,21 @@
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <NMTDS_BndSphereTree.hxx>
#include <NMTDS_BndSphere.hxx>
#include <NMTDS_IndexedDataMapOfShapeBndSphere.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
#include <GEOMAlgo_Tools.hxx>
//
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
//modified by NIZNHY-PKV Tue Mar 13 10:25:47 2012f
#include <GEOMAlgo_BndSphereTree.hxx>
#include <GEOMAlgo_BndSphere.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
//
static
Standard_Integer CheckAncesstors
(const TopoDS_Shape& aVSD,
@ -74,7 +74,6 @@ static
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ);
//modified by NIZNHY-PKV Tue Mar 13 10:25:50 2012t
//=======================================================================
//function :
@ -159,10 +158,10 @@ void GEOMAlgo_GlueDetector::DetectVertices()
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
NMTDS_BndSphereTreeSelector aSelector;
NMTDS_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
GEOMAlgo_BndSphereTreeSelector aSelector;
GEOMAlgo_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, GEOMAlgo_BndSphere> aTreeFiller(aBBTree);
//
myErrorStatus=0;
//
@ -174,7 +173,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
}
//
for (i=1; i<=aNbV; ++i) {
NMTDS_BndSphere aBox;
GEOMAlgo_BndSphere aBox;
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
aPV=BRep_Tool::Pnt(aV);
@ -217,7 +216,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
}
//
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
//
aSelector.Clear();
aSelector.SetBox(aBoxVP);
@ -357,7 +356,7 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTolerance, myContext);
iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTolerance, myContext);
if (iErr) {
myErrorStatus=200;
return;

View File

@ -55,11 +55,9 @@ public:
Standard_EXPORT virtual
void Perform() ;
//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f
Standard_EXPORT
const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes();
//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t
//------------------------------------------------
protected:
Standard_EXPORT
void DetectVertices() ;
@ -81,7 +79,6 @@ protected:
void FacePassKey(const TopoDS_Face& aF,
GEOMAlgo_PassKeyShape& aPK) ;
//modified by NIZNHY-PKV Tue Mar 13 09:53:03 2012f
Standard_EXPORT
void CheckDetected();
//
@ -94,7 +91,6 @@ protected:
protected:
TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes;
//modified by NIZNHY-PKV Tue Mar 13 09:53:08 2012t
};
#endif

View File

@ -27,7 +27,7 @@
//
#include <GEOMAlgo_Gluer.hxx>
#include <NMTDS_BoxBndTree.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
@ -75,23 +75,22 @@
#include <BRepLib.hxx>
#include <BRepTools.hxx>
#include <BRepBndLib.hxx>
//
#include <IntTools_Tools.hxx>
#include <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
@ -226,12 +225,12 @@ void GEOMAlgo_Gluer::MakeVertices()
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
//modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f
//GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
//modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t
//
NMTDS_BndSphereTreeSelector aSelector;
NMTDS_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
GEOMAlgo_BndSphereTreeSelector aSelector;
GEOMAlgo_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, GEOMAlgo_BndSphere> aTreeFiller(aBBTree);
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
@ -241,7 +240,7 @@ void GEOMAlgo_Gluer::MakeVertices()
}
//
for (i=1; i<=aNbV; ++i) {
NMTDS_BndSphere aBox;
GEOMAlgo_BndSphere aBox;
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
aPV=BRep_Tool::Pnt(aV);
@ -285,7 +284,7 @@ void GEOMAlgo_Gluer::MakeVertices()
//
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
//modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
//const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
//modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
//
@ -463,14 +462,8 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
//
aER.Orientation(TopAbs_FORWARD);
if (!BRep_Tool::Degenerated(aER)) {
// build p-curve
//if (bIsUPeriodic) {
// GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
//}
//BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
//
// orient image
Standard_Boolean bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
}
@ -522,7 +515,7 @@ void GEOMAlgo_Gluer::MakeSolids()
myResult=aCmp;
//
if (aMS.Extent()) {
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
BOPTools_AlgoTools::CorrectCurveOnSurface(myResult, 0.0001);
}
}
//=======================================================================
@ -637,7 +630,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext);
iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTol, myContext);
if (iErr) {
myErrorStatus=200;
return;
@ -933,7 +926,7 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
}
//
else {
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
BOPTools_AlgoTools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
}
}
//=======================================================================
@ -960,7 +953,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
aFFWD.Orientation(TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFFWD, aLoc);
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
bIsUPeriodic=GEOMAlgo_AlgoTools::IsUPeriodic(aS);
aTol=BRep_Tool::Tolerance(aFFWD);
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
//
@ -979,12 +972,12 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
if (!BRep_Tool::Degenerated(aER)) {
// build p-curve
if (bIsUPeriodic) {
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
}
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
// orient image
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
}
@ -1033,16 +1026,16 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
//
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
aC3D->D0(aT, aP);
myContext->ProjectPointOnEdge(aP, aER, aTR);
//
BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
if (aF.Orientation()==TopAbs_REVERSED) {
aDNF.Reverse();
}
//
BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
if (aFR.Orientation()==TopAbs_REVERSED) {
aDNFR.Reverse();
}

View File

@ -31,22 +31,27 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <Standard_Integer.hxx>
#include <TopTools_ListOfShape.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
//=======================================================================
//class : GEOMAlgo_Gluer
//purpose :

View File

@ -44,8 +44,10 @@
#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
@ -441,7 +443,7 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
continue;
}
//
GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
GEOMAlgo_AlgoTools::MakeContainer(aType, aWnew);
aWnew.Orientation(aW.Orientation());
//
aItS.Initialize(aW);
@ -450,7 +452,7 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
if (myOrigins.IsBound(aE)) {
aEnew=myOrigins.Find(aE);
//
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aEnew, aE, myContext);
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aEnew, aE, myContext);
if (bToReverse) {
aEnew.Reverse();
}
@ -509,7 +511,7 @@ void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC)
return;
}
//
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew);
//
aItC.Initialize(aC);
for (; aItC.More(); aItC.Next()) {
@ -599,7 +601,7 @@ void GEOMAlgo_Gluer2::BuildResult()
return;
}
//
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew);
//
aItC.Initialize(myArgument);
for (; aItC.More(); aItC.Next()) {
@ -619,7 +621,7 @@ void GEOMAlgo_Gluer2::BuildResult()
TopoDS_Shape aCnew1;
TopTools_IndexedMapOfShape aM;
//
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew1);
GEOMAlgo_AlgoTools::MakeContainer(TopAbs_COMPOUND, aCnew1);
//
TopExp::MapShapes(aCnew, TopAbs_SOLID, aM);

View File

@ -35,12 +35,11 @@
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <NMTTools_CoupleOfShape.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx>
#include <GEOMAlgo_GluerAlgo.hxx>
#include <GEOMAlgo_BuilderShape.hxx>
#include <GEOMAlgo_GlueDetector.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
//=======================================================================
//class : GEOMAlgo_Gluer2
@ -170,8 +169,8 @@ protected:
TopoDS_Face& theFnew) ;
Standard_EXPORT
void TreatPair(const NMTTools_CoupleOfShape& theCS,
NMTTools_ListOfCoupleOfShape& theLCS) ;
void TreatPair(const GEOMAlgo_CoupleOfShapes& theCS,
GEOMAlgo_ListOfCoupleOfShapes& theLCS) ;
protected:
TopTools_DataMapOfShapeListOfShape myShapesToGlue;
@ -180,9 +179,8 @@ protected:
TopTools_DataMapOfShapeListOfShape myImagesToWork;
TopTools_DataMapOfShapeShape myOriginsToWork;
Standard_Boolean myKeepNonSolids;
//modified by NIZNHY-PKV Tue Mar 13 13:30:40 2012f
GEOMAlgo_GlueDetector myDetector;
//modified by NIZNHY-PKV Tue Mar 13 13:30:43 2012t
private:
};
#endif

View File

@ -51,11 +51,9 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPTools_Tools.hxx>
#include <BOPTools_Tools2D.hxx>
#include <BOPTools_Tools3D.hxx>
#include <GEOMAlgo_Tools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
//=======================================================================
//function : MakeBRepShapes
@ -117,7 +115,7 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
//
aTol=BRep_Tool::Tolerance(aFF);
aS=BRep_Tool::Surface(aFF, aLoc);
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
bIsUPeriodic=GEOMAlgo_AlgoTools::IsUPeriodic(aS);
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
//
aBB.MakeFace (aFnew, aS, aLoc, aTol);
@ -160,18 +158,17 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
if (!BRep_Tool::Degenerated(aEx)) {
aEx.Orientation(TopAbs_FORWARD);
if (bIsUPeriodic) {
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
}
//
//modified by NIZNHY-PKV Fri Feb 03 11:18:17 2012f
iRet=GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(aE, aEx, aFF, myContext);
iRet=GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace(aE, aEx, aFF, myContext);
if (iRet) {
continue;
}
//BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF);
//modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t
//
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext);
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aEx, aE, myContext);
if (bIsToReverse) {
aEx.Reverse();
}
@ -223,7 +220,7 @@ void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
aVR2.Orientation(TopAbs_REVERSED);
//
if (!bIsDE) {
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
BOPTools_AlgoTools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
}
else {
Standard_Real aTol;

View File

@ -31,8 +31,9 @@
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <GEOMAlgo_BuilderShape.hxx>
#include <GEOMAlgo_Tools3D.hxx>
//=======================================================================
//function : PrepareHistory
@ -98,7 +99,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
aSim.Orientation(theS.Orientation());
}
else {
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext);
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
if (bToReverse) {
aSim.Reverse();
}

View File

@ -44,13 +44,13 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <NMTTools_CoupleOfShape.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx>
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
#include <NMTTools_Tools.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
#include <GEOMAlgo_GlueDetector.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
static
@ -130,9 +130,9 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
Standard_Integer aNbSG, i, j, k, aNbC, aNb, aNbSD;
TopTools_ListIteratorOfListOfShape aItLS1, aItLS2;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
NMTTools_CoupleOfShape aCS;
NMTTools_ListOfCoupleOfShape aLCS;
NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
GEOMAlgo_CoupleOfShapes aCS;
GEOMAlgo_ListOfCoupleOfShapes aLCS;
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
//
myErrorStatus=0;
myWarningStatus=0;
@ -186,9 +186,9 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
//
// 2. Find Chains
TopTools_ListOfShape aLSX;
NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC;
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMC;
//
NMTTools_Tools::FindChains(aLCS, aMC);
GEOMAlgo_AlgoTools::FindChains(aLCS, aMC);
//
// 3. myImagesToWork, myOriginsToWork
aNbC=aMC.Extent();
@ -209,8 +209,8 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
//function : TreatPair
//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
NMTTools_ListOfCoupleOfShape& aLCS)
void GEOMAlgo_Gluer2::TreatPair(const GEOMAlgo_CoupleOfShapes& aCS,
GEOMAlgo_ListOfCoupleOfShapes& aLCS)
{
if (myErrorStatus) {
return;
@ -222,7 +222,7 @@ void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
TopTools_IndexedMapOfShape aMS1, aMS2;
TopTools_DataMapOfShapeListOfShape aDMSLS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
NMTTools_CoupleOfShape aCSS;
GEOMAlgo_CoupleOfShapes aCSS;
//
// 1. Checking the pair on whether it can be glued at all
// 1.1

View File

@ -25,7 +25,7 @@
// <peter@PREFEX>
//
#include <GEOMAlgo_GluerAlgo.hxx>
#include <IntTools_Context.hxx>
#include <BOPInt_Context.hxx>
//=======================================================================
@ -97,7 +97,7 @@ Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const
//function : SetContext
//purpose :
//=======================================================================
void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext)
void GEOMAlgo_GluerAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
{
myContext=theContext;
}
@ -105,7 +105,7 @@ void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext)
//function : Context
//purpose :
//=======================================================================
const Handle(IntTools_Context)& GEOMAlgo_GluerAlgo::Context()
const Handle(BOPInt_Context)& GEOMAlgo_GluerAlgo::Context()
{
return myContext;
}
@ -141,6 +141,6 @@ void GEOMAlgo_GluerAlgo::Clear()
void GEOMAlgo_GluerAlgo::Perform()
{
if (myContext.IsNull()) {
myContext=new IntTools_Context;
myContext=new BOPInt_Context;
}
}

View File

@ -31,10 +31,10 @@
#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
@ -74,10 +74,10 @@ public:
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;
@ -89,7 +89,7 @@ protected:
TopoDS_Shape myArgument;
Standard_Real myTolerance;
Standard_Boolean myCheckGeometry;
Handle(IntTools_Context) myContext;
Handle(BOPInt_Context) myContext;
TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins;

View File

@ -31,7 +31,6 @@
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
//#include <Handle_GEOMAlgo_HAlgo.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -17,24 +17,25 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTDS_IndexedDataMapOfShapeBox.hxx
// File: GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
// Created: Mon Feb 20 09:17:01 2012
// Author:
// <pkv@BDEURI37616>
#ifndef NMTDS_IndexedDataMapOfShapeBox_HeaderFile
#define NMTDS_IndexedDataMapOfShapeBox_HeaderFile
#ifndef GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
#define GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <Bnd_Box.hxx>
#include <GEOMAlgo_BndSphere.hxx>
#define _NCollection_MapHasher
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher> NMTDS_IndexedDataMapOfShapeBox;
typedef NCollection_IndexedDataMap<TopoDS_Shape, GEOMAlgo_BndSphere, TopTools_ShapeMapHasher> GEOMAlgo_IndexedDataMapOfShapeBndSphere;
#undef _NCollection_MapHasher

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
// 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
@ -16,18 +16,18 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx
// File: GEOMAlgo_IndexedDataMapOfIndexedMapOfInteger.hxx
// Created: Mon Feb 20 09:20:07 2012
// Author:
// <pkv@BDEURI37616>
// File: NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx
// File: GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
// Created: Mon Feb 20 11:59:23 2012
// Author:
// <pkv@BDEURI37616>
#ifndef NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
#define NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
#ifndef GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
#define GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
#include <TopoDS_Shape.hxx>
@ -38,7 +38,7 @@
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_IndexedDataMap <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> NMTTools_IndexedDataMapOfShapeIndexedMapOfShape;
typedef NCollection_IndexedDataMap <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape;
#undef _NCollection_MapHasher

View File

@ -1,35 +0,0 @@
// 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

View File

@ -31,9 +31,10 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
//=======================================================================
//class : GEOMAlgo_PassKey

View File

@ -1,4 +1,4 @@
// 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
@ -24,28 +24,24 @@
// 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 :
@ -106,7 +102,7 @@ void GEOMAlgo_RemoverWebs::Perform()
if (!myContext.IsNull()) {
myContext.Nullify();
}
myContext=new IntTools_Context;
myContext=new BOPInt_Context;
//
BuildSolid();
//
@ -123,14 +119,14 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
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
@ -148,9 +144,9 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
//
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()) {
@ -158,12 +154,12 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
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);
BOPTools::MapShapesAndAncestors(aShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
//
aNbF=aMFS.Extent();
for (i=1; i<=aNbF; ++i) {
@ -179,7 +175,7 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
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);
@ -214,7 +210,7 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
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);
@ -225,7 +221,7 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
return;
}
//
const TopTools_ListOfShape& aLSR=aSB.Areas();
const BOPCol_ListOfShape& aLSR=aSB.Areas();
//
// 4 Add the internals
if (aNbSI) {
@ -243,17 +239,17 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
//function : AddInternalShapes
//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;
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) {
@ -263,7 +259,7 @@ void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR,
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);
//

View File

@ -1,4 +1,4 @@
// 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
@ -22,8 +22,7 @@
// 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:
@ -39,8 +38,8 @@
#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
@ -67,8 +66,8 @@ protected:
void BuildSolid() ;
Standard_EXPORT
static void AddInternalShapes(const TopTools_ListOfShape& ,
const TopTools_IndexedMapOfShape& );
static void AddInternalShapes(const BOPCol_ListOfShape& ,
const BOPCol_IndexedMapOfShape& );
//
};

View File

@ -26,7 +26,7 @@
// <pkv@irinox>
//
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <IntTools_Context.hxx>
#include <BOPInt_Context.hxx>
//=======================================================================
//function : GEOMAlgo_ShapeAlgo
@ -50,7 +50,7 @@ GEOMAlgo_ShapeAlgo::~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;
}
@ -58,7 +58,7 @@ void GEOMAlgo_ShapeAlgo::SetContext(const Handle(IntTools_Context)& theContext)
//function : Context
//purpose :
//=======================================================================
const Handle(IntTools_Context)& GEOMAlgo_ShapeAlgo::Context()const
const Handle(BOPInt_Context)& GEOMAlgo_ShapeAlgo::Context()const
{
return myContext;
}
@ -109,6 +109,6 @@ const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Result()const
void GEOMAlgo_ShapeAlgo::Perform()
{
if (myContext.IsNull()) {
myContext=new IntTools_Context;
myContext=new BOPInt_Context;
}
}

View File

@ -32,7 +32,7 @@
#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>
//=======================================================================
@ -45,11 +45,11 @@ class GEOMAlgo_ShapeAlgo : public GEOMAlgo_Algo
//! 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) ;
@ -80,6 +80,6 @@ protected:
TopoDS_Shape myShape;
Standard_Real myTolerance;
TopoDS_Shape myResult;
Handle_IntTools_Context myContext;
Handle_BOPInt_Context myContext;
};
#endif

View File

@ -25,16 +25,18 @@
#include <Standard_Macro.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Integer.hxx>
#include <GEOMAlgo_KindOfShape.hxx>
#include <GEOMAlgo_KindOfName.hxx>
#include <GEOMAlgo_KindOfBounds.hxx>
#include <GEOMAlgo_KindOfClosed.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax3.hxx>
#include <Standard_Real.hxx>
#include <gp_Ax2.hxx>
#include <GEOMAlgo_KindOfShape.hxx>
#include <GEOMAlgo_KindOfName.hxx>
#include <GEOMAlgo_KindOfBounds.hxx>
#include <GEOMAlgo_KindOfClosed.hxx>
//=======================================================================

View File

@ -1,177 +0,0 @@
// 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

View File

@ -1,92 +0,0 @@
// 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

View File

@ -52,9 +52,9 @@ GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid()
//function : SetFiller
//purpose :
//=======================================================================
void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller)
void GEOMAlgo_ShapeSolid::SetFiller(const BOPAlgo_PaveFiller& aDSFiller)
{
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
myDSFiller=(BOPAlgo_PaveFiller*) &aDSFiller;
}
//=======================================================================
// function: Shapes

View File

@ -30,12 +30,15 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Standard_Integer.hxx>
#include <BOPTools_PDSFiller.hxx>
#include <GEOMAlgo_Algo.hxx>
#include <TopAbs_State.hxx>
#include <BOPTools_DSFiller.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_PPaveFiller.hxx>
#include <GEOMAlgo_Algo.hxx>
//=======================================================================
//function : GEOMAlgo_ShapeSolid
@ -45,7 +48,7 @@ class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo
{
public:
Standard_EXPORT
void SetFiller(const BOPTools_DSFiller& aDSF) ;
void SetFiller(const BOPAlgo_PaveFiller& aDSF) ;
Standard_EXPORT
virtual ~GEOMAlgo_ShapeSolid();
@ -58,16 +61,13 @@ protected:
GEOMAlgo_ShapeSolid();
Standard_EXPORT
virtual void BuildResult() = 0;
Standard_EXPORT
virtual void Prepare() = 0;
virtual void BuildResult()=0;
TopTools_ListOfShape myLSIN;
TopTools_ListOfShape myLSOUT;
TopTools_ListOfShape myLSON;
Standard_Integer myRank;
BOPTools_PDSFiller myDSFiller;
BOPAlgo_PPaveFiller myDSFiller;
};
#endif

View File

@ -46,33 +46,118 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <IntTools_Context.hxx>
#include <BOPTColStd_Dump.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPInt_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SolidStateFiller.hxx>
#include <BOPTools_PCurveMaker.hxx>
#include <BOPTools_DEProcessor.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_SequenceOfCurves.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : GEOMAlgo_ShellSolidBuilder
//purpose :
//=======================================================================
class GEOMAlgo_ShellSolidBuilder : public BOPAlgo_Builder {
public:
Standard_EXPORT
GEOMAlgo_ShellSolidBuilder();
#include <BOP_WireEdgeSet.hxx>
#include <BOP_SDFWESFiller.hxx>
#include <BOP_FaceBuilder.hxx>
Standard_EXPORT
virtual ~GEOMAlgo_ShellSolidBuilder();
protected:
Standard_EXPORT
virtual void PerformInternal(const BOPAlgo_PaveFiller& theFiller);
};
//=======================================================================
//function : GEOMAlgo_ShellSolidBuilder
//purpose :
//=======================================================================
GEOMAlgo_ShellSolidBuilder::GEOMAlgo_ShellSolidBuilder()
:
BOPAlgo_Builder()
{
}
//=======================================================================
//function : ~GEOMAlgo_ShellSolidBuilder
//purpose :
//=======================================================================
GEOMAlgo_ShellSolidBuilder::~GEOMAlgo_ShellSolidBuilder()
{
}
//=======================================================================
//function : PerformInternal
//purpose :
//=======================================================================
void GEOMAlgo_ShellSolidBuilder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
//
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
myDS=myPaveFiller->PDS();
myContext=myPaveFiller->Context();
//
// 1. CheckData
CheckData();
if (myErrorStatus) {
return;
}
//
// 2. Prepare
Prepare();
if (myErrorStatus) {
return;
}
//
// 3. Fill Images
// 3.1 Vertice
FillImagesVertices();
if (myErrorStatus) {
return;
}
//
BuildResult(TopAbs_VERTEX);
if (myErrorStatus) {
return;
}
// 3.2 Edges
FillImagesEdges();
if (myErrorStatus) {
return;
}
//
BuildResult(TopAbs_EDGE);
if (myErrorStatus) {
return;
}
//
// 3.3 Wires
FillImagesContainers(TopAbs_WIRE);
if (myErrorStatus) {
return;
}
//
BuildResult(TopAbs_WIRE);
if (myErrorStatus) {
return;
}
// 3.4 Faces
FillImagesFaces();
if (myErrorStatus) {
return;
}
//
BuildResult(TopAbs_FACE);
if (myErrorStatus) {
return;
}
}
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//function : GEOMAlgo_ShellSolid
//purpose :
@ -98,274 +183,126 @@ void GEOMAlgo_ShellSolid::Perform()
myErrorStatus=0;
//
try {
Standard_Integer aNbArgs, iRank, iErr, iBeg, iEnd, i, aNbSp;
Standard_Real aTol;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
gp_Pnt aP;
gp_Pnt2d aP2D;
TopoDS_Face aF;
//
myLSIN.Clear();
myLSOUT.Clear();
myLSON.Clear();
//
aTol=1.e-7;
//
if (myDSFiller==NULL) {
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
if(myDSFiller->ErrorStatus()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
const BOPDS_DS& aDS=myDSFiller->DS();
BOPDS_DS* pDS=(BOPDS_DS*)&aDS;
const BOPCol_ListOfShape& aLS=pDS->Arguments();
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
aNbArgs=aLS.Extent();
if (aNbArgs!=2) {
myErrorStatus=13;
return;
}
//
myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2;
BuildResult();
iRank=-1;
const TopoDS_Shape& aObj=aLS.First();
if (aObj.ShapeType()==TopAbs_SHELL) {
iRank=0;
}
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();
const TopoDS_Shape& aTool=aLS.Last();
if (aTool.ShapeType()==TopAbs_SHELL) {
iRank=1;
}
//
if (iRank==-1) {
myErrorStatus=14;
return;
}
//
Handle(BOPInt_Context) aCtx=myDSFiller->Context();
const BOPDS_IndexRange& aRange=pDS->Range(iRank);
aRange.Indices(iBeg, iEnd);
const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
//
//------------------------------ShellSolidBuilder
GEOMAlgo_ShellSolidBuilder aSSB;
//
aSSB.PerformWithFiller(*myDSFiller);
iErr=aSSB.ErrorStatus();
if (iErr) {
myErrorStatus=15;
return;
}
//
const BOPCol_DataMapOfShapeListOfShape& aImages=aSSB.Images();
//
//-------------------------------
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
const TopoDS_Shape& aS=pDS->Shape(i);
aType=aS.ShapeType();
if (aType!=TopAbs_FACE) {
continue;
}
//
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i));
aState=aDS.GetState(i);
if (aState==BooleanOperations_IN) {
myLSIN.Append(aF1);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aF1);
}
aState=TopAbs_UNKNOWN;
aF=*((TopoDS_Face*)&aS);
//
if (!aImages.IsBound(aS)) {
iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
if (iErr) {
myErrorStatus=16;
return;
}
//
// 2. process pf interferred faces
aNbFFs=aFFs.Extent();
for (i=1; i<=aNbFFs; ++i) {
BOPTools_SSInterference& aFFi=aFFs(i);
//
nF1=aFFi.Index1();
nF2=aFFi.Index2();
iRank1=aDS.Rank(nF1);
nF=(iRank1==myRank) ? nF1 : nF2;
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF));
//
bIsTouchCase=aFFi.IsTangentFaces();
//
if (bIsTouchCase) {
myLSON.Append(aF1);
aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
}
else {
const BOPCol_ListOfShape& aLSp=aImages.Find(aS);
aNbSp=aLSp.Extent();
if (aNbSp>0) {
continue;
}
//
// Has section edges ?
aNbS=0;
BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves();
aNbCurves=aBCurves.Length();
for (j=1; j<=aNbCurves; j++) {
BOPTools_Curve& aBC=aBCurves(j);
const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks();
aNbS=aSectEdges.Extent();
if (aNbS) {
break;
}
if (aNbSp==1) {
aF=*((TopoDS_Face*)&aLSp.First());
}
//
if (aNbS) { // it has
continue;
iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
if (iErr) {
myErrorStatus=16;
return;
}
//
anExp.Init(aF1, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
if (BRep_Tool::Degenerated(aE)) {
continue;
aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
}
//
nE=aDS.ShapeIndex(aE, myRank);
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE));
aNbPB=aLPB.Extent();
//
if (aNbPB<2) {
nSp=nE;
if (aNbPB) {
const BOPTools_PaveBlock& aPB=aLPB.First();
nSp=aPB.Edge();
//----------
if (aState==TopAbs_ON) {
myLSON.Append(aF);
}
/*const TopoDS_Shape& aSp=*/aDS.Shape(nSp);
//
aState=aDS.GetState(nSp);
if (aState==BooleanOperations_IN) {
myLSIN.Append(aF1);
else if (aState==TopAbs_OUT) {
myLSOUT.Append(aF);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aF1);
else if (aState==TopAbs_IN) {
myLSIN.Append(aF);
}
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())
//----------
}//for (i=iBeg; i<=iEnd; ++i) {
}// try
catch (Standard_Failure) {
myErrorStatus=12;
}
}
//=======================================================================
// function: DetectSDFaces
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::DetectSDFaces()
{
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
//
Standard_Boolean bFlag;
Standard_Integer i, aNb, nF1, nF2, iZone, aNbSps, iSenseFlag;
gp_Dir aDNF1, aDNF2;
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
bFlag=Standard_False;
BOPTools_SSInterference& aFF=aFFs(i);
nF1=aFF.Index1();
nF2=aFF.Index2();
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
//
// iSenseFlag;
const BOPTools_ListOfPaveBlock& aLPB=aFF.PaveBlocks();
aNbSps=aLPB.Extent();
if (!aNbSps) {
continue;
}
const BOPTools_PaveBlock& aPB=aLPB.First();
const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge()));
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1);
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2);
iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2);
//
if (iSenseFlag==1 || iSenseFlag==-1) {
//
//
TopoDS_Face aF1FWD=aF1;
aF1FWD.Orientation (TopAbs_FORWARD);
BOP_WireEdgeSet aWES (aF1FWD);
BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller);
aWESFiller.SetSenseFlag(iSenseFlag);
aWESFiller.SetOperation(BOP_COMMON);
aWESFiller.Do(aWES);
BOP_FaceBuilder aFB;
aFB.Do(aWES);
const TopTools_ListOfShape& aLF=aFB.NewFaces();
iZone=0;
TopTools_ListIteratorOfListOfShape anIt(aLF);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aFR=anIt.Value();
if (aFR.ShapeType()==TopAbs_FACE) {
const TopoDS_Face& aFaceResult=TopoDS::Face(aFR);
//
Standard_Boolean bIsValidIn2D, bNegativeFlag;
bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag);
if (bIsValidIn2D) {
//if(CheckSameDomainFaceInside(aFaceResult, aF2)) {
iZone=1;
break;
//}
}
//
}
}
if (iZone) {
bFlag=Standard_True;
aFF.SetStatesMap(aWESFiller.StatesMap());
}
}// if (iSenseFlag)
aFF.SetTangentFacesFlag(bFlag);
aFF.SetSenseFlag (iSenseFlag);
}// end of for (i=1; i<=aNb; i++)
}

View File

@ -50,12 +50,9 @@ class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid
protected:
Standard_EXPORT
virtual void Prepare() ;
virtual void BuildResult() {
};
Standard_EXPORT
virtual void BuildResult() ;
Standard_EXPORT
void DetectSDFaces() ;
};
#endif

View File

@ -37,8 +37,6 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeState.hxx>
@ -86,19 +84,11 @@ void GEOMAlgo_SolidSolid::Perform()
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
if(myDSFiller->ErrorStatus()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
}
//
myRank=2;
BuildResult();
}
@ -122,7 +112,7 @@ void GEOMAlgo_SolidSolid::BuildResult()
GEOMAlgo_IndexedDataMapOfShapeState aMFS;
//
// 1. classify the faces
GEOMAlgo_ShellSolid::BuildResult();
GEOMAlgo_ShellSolid::Perform();
//
// 2. fill Shape-State map
aIt.Initialize(myLSIN);
@ -140,6 +130,7 @@ void GEOMAlgo_SolidSolid::BuildResult()
const TopoDS_Shape& aF=aIt.Value();
aMFS.Add(aF, TopAbs_ON);
}
//
myLSIN.Clear();
myLSON.Clear();
myLSOUT.Clear();

View File

@ -31,6 +31,7 @@
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
//=======================================================================
@ -59,7 +60,6 @@ protected:
Standard_EXPORT
virtual void BuildResult() ;
TopoDS_Shape myS2;
};
#endif

View File

@ -21,8 +21,11 @@
//
// File: GEOMAlgo_Splitter.cxx
// Created: Thu Sep 06 10:54:04 2012
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <GEOMAlgo_Splitter.hxx>
#include <TopAbs_ShapeEnum.hxx>
@ -31,30 +34,41 @@
#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);
BOPCol_ListOfShape& aLSX);
//=======================================================================
//function :
//purpose :
//=======================================================================
GEOMAlgo_Splitter::GEOMAlgo_Splitter()
GEOMAlgo_Splitter::GEOMAlgo_Splitter()
:
GEOMAlgo_Builder()
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
myLimit=TopAbs_SHAPE;
myLimitMode=0;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
GEOMAlgo_Splitter::GEOMAlgo_Splitter
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
myLimit=TopAbs_SHAPE;
myLimitMode=0;
@ -63,40 +77,26 @@ static
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
GEOMAlgo_Splitter::~GEOMAlgo_Splitter()
{
}
//=======================================================================
//function : AddToolCompound
//purpose :
//=======================================================================
void GEOMAlgo_Splitter::AddToolCompound(const TopoDS_Shape& theShape)
{
TopoDS_Iterator aIt;
//
aIt.Initialize(theShape);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
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 :
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_Splitter::Tools()const
const BOPCol_ListOfShape& GEOMAlgo_Splitter::Tools()const
{
return myTools;
}
@ -104,7 +104,7 @@ static
//function : SetLimit
//purpose :
//=======================================================================
void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit)
void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit)
{
myLimit=aLimit;
}
@ -112,7 +112,7 @@ static
//function : Limit
//purpose :
//=======================================================================
TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const
TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const
{
return myLimit;
}
@ -120,7 +120,7 @@ static
//function : SetLimitMode
//purpose :
//=======================================================================
void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode)
void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode)
{
myLimitMode=aMode;
}
@ -128,7 +128,7 @@ static
//function : LimitMode
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Splitter::LimitMode()const
Standard_Integer GEOMAlgo_Splitter::LimitMode()const
{
return myLimitMode;
}
@ -136,33 +136,33 @@ static
//function : Clear
//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 :
//=======================================================================
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();
@ -183,34 +183,33 @@ static
//function : PostTreat
//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;
//
// 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)) {
@ -242,38 +241,29 @@ static
}
}// 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
//
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
}
}
}
@ -281,19 +271,33 @@ static
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 :
//=======================================================================
void TreatCompound(const TopoDS_Shape& aC1,
TopTools_ListOfShape& aLSX)
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);

View File

@ -22,76 +22,77 @@
// 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() ;
//! Adds Tool argument theShape of the operation <br>
Standard_EXPORT
virtual void AddTool(const TopoDS_Shape& theShape) ;
//! Returns the arguments of the operation <br>
Standard_EXPORT
const TopTools_ListOfShape& Tools() const;
void AddTool(const TopoDS_Shape& theShape);
Standard_EXPORT
void SetLimit(const TopAbs_ShapeEnum aLimit) ;
const BOPCol_ListOfShape& Tools()const;
Standard_EXPORT
TopAbs_ShapeEnum Limit() const;
void SetLimit(const TopAbs_ShapeEnum aLimit);
Standard_EXPORT
void SetLimitMode(const Standard_Integer aLimitMode) ;
TopAbs_ShapeEnum Limit()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>
void SetLimitMode(const Standard_Integer aMode);
Standard_EXPORT
void AddToolCompound(const TopoDS_Shape& theShape) ;
Standard_Integer LimitMode()const;
Standard_EXPORT
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>
virtual void BuildResult(const TopAbs_ShapeEnum theType);
Standard_EXPORT
virtual void PostTreat() ;
virtual void PostTreat();
TopTools_ListOfShape myTools;
TopTools_MapOfShape myMapTools;
protected:
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
TopAbs_ShapeEnum myLimit;
Standard_Integer myLimitMode;
};
#endif

View File

@ -1,121 +0,0 @@
// 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

File diff suppressed because it is too large Load Diff

View File

@ -1,240 +0,0 @@
// 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

View File

@ -1,352 +0,0 @@
// 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;
}

Some files were not shown because too many files have changed in this diff Show More