From: skl Date: Wed, 13 Jun 2007 07:24:14 +0000 (+0000) Subject: Integration next version of GEOM packages from PKV. X-Git-Tag: V3_2_7~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb8ad5d0b765b845b96493b480c676db2fa6eab8;p=modules%2Fgeom.git Integration next version of GEOM packages from PKV. --- diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.cdl b/src/GEOMAlgo/GEOMAlgo_Builder.cdl index 967bc05f9..a6f4ca406 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Builder.cdl @@ -37,8 +37,8 @@ uses MapOfShape from TopTools, Image from BRepAlgo, - DSFiller from NMTTools, - PDSFiller from NMTTools + PaveFiller from NMTTools, + PPaveFiller from NMTTools --raises @@ -54,8 +54,8 @@ is is redefined; PerformWithFiller(me:out; - theDSF: DSFiller from NMTTools) - ---Purpose: Performs calculations using prepared DSFiller + theDSF: PaveFiller from NMTTools) + ---Purpose: Performs calculations using prepared PaveFiller -- object theDSF is virtual; @@ -99,13 +99,12 @@ is -- -- protected methods -- - -- PerformInternal(me:out; - theDSF: DSFiller from NMTTools) + theDSF: PaveFiller from NMTTools) ---Purpose: Performs calculations using prepared DSFiller -- object theDSF - is protected; - -- + is virtual protected; + PrepareHistory (me:out) ---Purpose: Prepare information for history support is redefined protected; @@ -234,7 +233,7 @@ is -- ===================================================== fields - myDSFiller : PDSFiller from NMTTools is protected; + myPaveFiller : PPaveFiller from NMTTools is protected; myShapes : ListOfShape from TopTools is protected; -- Common usage myNbTypes : Integer from Standard is protected; @@ -248,7 +247,7 @@ fields mySameDomainShapes: IndexedDataMapOfShapeShape from TopTools is protected; -- solids myDraftSolids : IndexedDataMapOfShapeShape from TopTools is protected; - myEntryPoint : Integer from Standard is protected; + myEntryPoint : Integer from Standard is protected; -- end Builder; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.cxx b/src/GEOMAlgo/GEOMAlgo_Builder.cxx index 284cd7b10..ebb875893 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.cxx @@ -38,9 +38,8 @@ #include -#include - #include +#include //======================================================================= //function : @@ -51,7 +50,7 @@ GEOMAlgo_BuilderShape() { myNbTypes=9; - myDSFiller=NULL; + myPaveFiller=NULL; myEntryPoint=0; // Entry point through PerformWithFiller () } //======================================================================= @@ -61,9 +60,9 @@ GEOMAlgo_Builder::~GEOMAlgo_Builder() { if (myEntryPoint==1) { - if (myDSFiller) { - delete myDSFiller; - myDSFiller=NULL; + if (myPaveFiller) { + delete myPaveFiller; + myPaveFiller=NULL; } } } @@ -260,23 +259,19 @@ aBB.Add(aCS, aS); } // - if (myDSFiller) { - delete myDSFiller; - myDSFiller=NULL; - } - NMTTools_DSFiller* pDSF=new NMTTools_DSFiller; + NMTTools_PaveFiller* pPF=new NMTTools_PaveFiller; // - pDSF->SetCompositeShape(aCS); - pDSF->Perform(); + pPF->SetCompositeShape(aCS); + pPF->Perform(); // myEntryPoint=1; - PerformInternal(*pDSF); + PerformInternal(*pPF); } //======================================================================= //function : PerformWithFiller //purpose : //======================================================================= - void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_DSFiller& theDSF) + void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_PaveFiller& theDSF) { myEntryPoint=0; // @@ -286,18 +281,18 @@ //function : PerformInternal //purpose : //======================================================================= - void GEOMAlgo_Builder::PerformInternal(const NMTTools_DSFiller& theDSF) + void GEOMAlgo_Builder::PerformInternal(const NMTTools_PaveFiller& pPF) { myErrorStatus=0; // Standard_Boolean bIsDone; // - // 0. myDSFiller - myDSFiller=(NMTTools_DSFiller *)&theDSF; + // 0. myPaveFiller + myPaveFiller=(NMTTools_PaveFiller *)&pPF; // - bIsDone=myDSFiller->IsDone(); + bIsDone=myPaveFiller->IsDone(); if (!bIsDone) { - myErrorStatus=2; // DSFiller is failed + myErrorStatus=2; // PaveFiller is failed return; } // @@ -406,6 +401,6 @@ // // 0 - Ok // 1 - The object is just initialized -// 2 - DSFiller is failed +// 2 - PaveFiller is failed // 10 - No shapes to process // 30 - SolidBuilder failed diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.hxx b/src/GEOMAlgo/GEOMAlgo_Builder.hxx index 2f38d77fb..930b3edf0 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.hxx @@ -20,8 +20,8 @@ #ifndef _GEOMAlgo_Builder_HeaderFile #define _GEOMAlgo_Builder_HeaderFile -#ifndef _NMTTools_PDSFiller_HeaderFile -#include +#ifndef _NMTTools_PPaveFiller_HeaderFile +#include #endif #ifndef _TopTools_ListOfShape_HeaderFile #include @@ -50,7 +50,7 @@ #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif -class NMTTools_DSFiller; +class NMTTools_PaveFiller; class TopoDS_Shape; class TopTools_ListOfShape; class BRepAlgo_Image; @@ -90,9 +90,9 @@ Standard_EXPORT virtual ~GEOMAlgo_Builder(); //! Performs calculations
Standard_EXPORT virtual void Perform() ; -//! Performs calculations using prepared DSFiller
+//! Performs calculations using prepared PaveFiller
//! object theDSF
-Standard_EXPORT virtual void PerformWithFiller(const NMTTools_DSFiller& theDSF) ; +Standard_EXPORT virtual void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ; //! Adds argument theShape of the operation
Standard_EXPORT virtual void AddShape(const TopoDS_Shape& theShape) ; @@ -139,7 +139,7 @@ protected: //! Performs calculations using prepared DSFiller
//! object theDSF
-Standard_EXPORT void PerformInternal(const NMTTools_DSFiller& theDSF) ; +Standard_EXPORT virtual void PerformInternal(const NMTTools_PaveFiller& theDSF) ; //! Prepare information for history support
Standard_EXPORT virtual void PrepareHistory() ; @@ -214,7 +214,7 @@ Standard_EXPORT void BuildDraftSolid(const TopoDS_Shape& theSolid,TopoDS_Shape // Fields PROTECTED // -NMTTools_PDSFiller myDSFiller; +NMTTools_PPaveFiller myPaveFiller; TopTools_ListOfShape myShapes; Standard_Integer myNbTypes; TopTools_MapOfShape myMapFence; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.jxx b/src/GEOMAlgo/GEOMAlgo_Builder.jxx index 1965f5ec7..4cc8d4a52 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder.jxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.jxx @@ -17,8 +17,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#ifndef _NMTTools_DSFiller_HeaderFile -#include +#ifndef _NMTTools_PaveFiller_HeaderFile +#include #endif #ifndef _TopoDS_Shape_HeaderFile #include diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx index 72a8b39dc..728c8404d 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx @@ -20,7 +20,7 @@ #include #include -#include +//#include #include #include #include diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx index d42da67e2..b6cdfee66 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx @@ -47,7 +47,6 @@ // #include // -#include #include #include #include @@ -78,8 +77,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; // Standard_Integer i, aNb, iV; // @@ -94,7 +93,6 @@ static myImages.Bind(aV, aVSD); // mySameDomainShapes.Add(aV, aVSD); - // } } } @@ -108,8 +106,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool(); IntTools_Context& aCtx=pPF->ChangeContext(); @@ -218,8 +216,8 @@ static TopTools_MapOfShape aMS; TopTools_MapIteratorOfMapOfShape aItS; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // aNbS=aDS.NumberOfShapesOfTheObject(); diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx index 068fbc564..92e9e2cc8 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +67,6 @@ #include #include -#include #include #include #include @@ -83,6 +81,7 @@ #include #include #include +#include static void UpdateCandidates(const Standard_Integer , @@ -109,9 +108,9 @@ static //======================================================================= void GEOMAlgo_Builder::FillIn2DParts() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + 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(); // @@ -193,9 +192,9 @@ static //======================================================================= void GEOMAlgo_Builder::BuildSplitFaces() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); IntTools_Context& aCtx= pPF->ChangeContext(); // @@ -388,9 +387,9 @@ static //======================================================================= void GEOMAlgo_Builder::FillSameDomainFaces() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); IntTools_Context& aCtx= pPF->ChangeContext(); // @@ -513,7 +512,7 @@ static TopTools_ListOfShape aLFx; TopTools_ListIteratorOfListOfShape aIt; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); // aNb=aDS.NumberOfShapesOfTheObject(); for (i=1; i<=aNb; ++i) { @@ -557,9 +556,9 @@ static //======================================================================= void GEOMAlgo_Builder::FillInternalVertices() { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; + NMTDS_InterfPool* pIP=pPF->IP(); IntTools_Context& aCtx= pPF->ChangeContext(); // BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx index 220cc453f..649c60370 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx @@ -56,7 +56,6 @@ #include #include -#include #include #include @@ -93,8 +92,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // Standard_Boolean bToReverse; @@ -186,8 +185,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // Standard_Boolean bIsIN, bHasImage; @@ -416,8 +415,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // Standard_Integer i, aNbS, iErr; @@ -589,8 +588,8 @@ static { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx= pPF->ChangeContext(); // //Standard_Boolean bHasImage; diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx index 080093803..8465cebba 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx @@ -35,7 +35,6 @@ #include #include -#include #include @@ -49,8 +48,8 @@ static //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Generated(const TopoDS_Shape& theS) { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx=pPF->ChangeContext(); // Standard_Boolean bHasImage, bToReverse; @@ -104,8 +103,8 @@ static //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Modified(const TopoDS_Shape& theS) { - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); + NMTTools_PaveFiller* pPF=myPaveFiller; IntTools_Context& aCtx=pPF->ChangeContext(); // Standard_Boolean bHasImage, bToReverse; diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx index bcbf18afe..431719ab1 100755 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx @@ -42,7 +42,6 @@ #include -#include static void TreatCompound(const TopoDS_Shape& aC, @@ -320,6 +319,6 @@ void TreatCompound(const TopoDS_Shape& aC1, // // 0 - Ok // 1 - The object is just initialized -// 2 - DSFiller is failed +// 2 - PaveFiller is failed // 10 - No shapes to process // 30 - SolidBuilder failed diff --git a/src/GEOMAlgo/Makefile.in b/src/GEOMAlgo/Makefile.in index 447899ee3..e6294d4fb 100644 --- a/src/GEOMAlgo/Makefile.in +++ b/src/GEOMAlgo/Makefile.in @@ -238,7 +238,7 @@ EXPORT_IDLS= CPPFLAGS += $(OCC_INCLUDES) $(KERNEL_CXXFLAGS) CXXFLAGS += $(OCC_CXXFLAGS) $(KERNEL_CXXFLAGS) -LDFLAGS += $(CAS_LDPATH) -lTKBO $(KERNEL_LDFLAGS) +LDFLAGS += $(CAS_LDPATH) -lTKBO $(KERNEL_LDFLAGS) -lNMTTools %_moc.cxx: %.h $(MOC) $< -o $@ diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index 9e2d85745..5ecfa98a9 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -34,7 +34,8 @@ #include #include -#include +//#include +#include #include #include "utilities.h" @@ -470,14 +471,21 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aCompound = anArgs(1); // Glue coincident faces and edges (with Partition algorithm). - NMTAlgo_Splitter1 PS; - PS.AddShape(aCompound); - PS.Compute(); - PS.SetRemoveWebs(Standard_False); -// PS.Build(aCompound.ShapeType()); - PS.Build(TopAbs_SOLID); - - aShape = PS.Shape(); + //NMTAlgo_Splitter1 PS; + //PS.AddShape(aCompound); + //PS.Compute(); + //PS.SetRemoveWebs(Standard_False); + // PS.Build(aCompound.ShapeType()); + //PS.Build(TopAbs_SOLID); + //aShape = PS.Shape(); + + GEOMAlgo_Gluer aGluer; + aGluer.SetShape(aCompound); + aGluer.SetCheckGeometry(Standard_True); + aGluer.Perform(); + aShape = aGluer.Result(); + + } else { } diff --git a/src/GEOMImpl/Makefile.in b/src/GEOMImpl/Makefile.in index 73061a42c..168b01cd1 100644 --- a/src/GEOMImpl/Makefile.in +++ b/src/GEOMImpl/Makefile.in @@ -114,7 +114,7 @@ EXPORT_HEADERS= GEOMImpl_Gen.hxx \ # additionnal information to compil and link file CPPFLAGS += $(OCC_INCLUDES) $(KERNEL_CXXFLAGS) $(BOOST_CPPFLAGS) CXXFLAGS += $(OCC_CXXFLAGS) $(KERNEL_CXXFLAGS) -LDFLAGS += $(KERNEL_LDFLAGS) $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lGEOMbasic -lNMTAlgo -lGEOMAlgo -lShHealOper +LDFLAGS += $(KERNEL_LDFLAGS) $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lGEOMbasic -lGEOMAlgo -lShHealOper # additional file to be cleaned diff --git a/src/Makefile.in b/src/Makefile.in index c3f92245f..6140bd005 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -34,7 +34,7 @@ VPATH=.:@srcdir@ #SUBDIRS = OBJECT ARCHIMEDE NMTDS NMTTools NMTAlgo GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport ShHealOper GEOMImpl GEOM_I GEOMClient DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI GEOM_I_Superv GEOM_SWIG STLExport -SUBDIRS = ARCHIMEDE NMTDS NMTTools NMTAlgo GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG STLExport +SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG STLExport ifeq (@WITHIHM@,yes) SUBDIRS+= OBJECT DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI GEOM_SWIG_WITHIHM diff --git a/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..a48a632d0 --- /dev/null +++ b/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#define _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger); + +class Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) : public Handle(TCollection_MapNode) { + public: + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)():Handle(TCollection_MapNode)() {} + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(const NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& operator=(const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& operator=(const NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* operator->() const + { + return (NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(); + + Standard_EXPORT static const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/NMTDS/Makefile.in b/src/NMTDS/Makefile.in index 23f815f85..c2e15ae1a 100644 --- a/src/NMTDS/Makefile.in +++ b/src/NMTDS/Makefile.in @@ -39,6 +39,9 @@ LIB = libNMTDS.la LIB_SRC = \ NMTDS_CArray1OfIndexRange_0.cxx \ + NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx \ + NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx \ + NMTDS_DataMapOfIntegerMapOfInteger_0.cxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx \ @@ -46,7 +49,9 @@ LIB_SRC = \ NMTDS_IndexedDataMapOfIntegerShape_0.cxx \ NMTDS_IndexedDataMapOfShapeBox_0.cxx \ NMTDS_IndexRange.cxx \ + NMTDS_InterfPool.cxx \ NMTDS_Iterator.cxx \ + NMTDS_IteratorCheckerSI.cxx \ NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx \ NMTDS_ListIteratorOfListOfPassKey_0.cxx \ NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx \ @@ -63,9 +68,12 @@ LIB_SRC = \ NMTDS_PassKeyBoolean.cxx \ NMTDS_PassKey.cxx \ NMTDS_PassKeyMapHasher.cxx \ + NMTDS_PassKeyShape.cxx \ + NMTDS_PassKeyShapeMapHasher.cxx \ NMTDS_ShapesDataStructure.cxx \ NMTDS_StdMapNodeOfMapOfPassKey_0.cxx \ NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx \ + NMTDS_Tools.cxx \ NMTDS_BoxBndTree.cxx LIB_CLIENT_IDL = @@ -73,6 +81,7 @@ LIB_SERVER_IDL = # header files EXPORT_HEADERS = \ + Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx \ Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ @@ -82,6 +91,9 @@ EXPORT_HEADERS = \ Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx \ Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx \ NMTDS_CArray1OfIndexRange.hxx \ + NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx \ + NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx \ + NMTDS_DataMapOfIntegerMapOfInteger.hxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ @@ -89,7 +101,10 @@ EXPORT_HEADERS = \ NMTDS_IndexedDataMapOfIntegerShape.hxx \ NMTDS_IndexedDataMapOfShapeBox.hxx \ NMTDS_IndexRange.hxx \ + NMTDS_InterfPool.hxx \ + NMTDS_InterfType.hxx \ NMTDS_Iterator.hxx \ + NMTDS_IteratorCheckerSI.hxx \ NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx \ NMTDS_ListIteratorOfListOfPassKey.hxx \ @@ -104,12 +119,17 @@ EXPORT_HEADERS = \ NMTDS_MapOfPassKeyBoolean.hxx \ NMTDS_MapOfPassKey.hxx \ NMTDS_PassKeyBoolean.hxx \ + NMTDS_PInterfPool.hxx \ + NMTDS_PIterator.hxx \ NMTDS_PassKey.hxx \ NMTDS_PassKeyMapHasher.hxx \ + NMTDS_PassKeyShape.hxx \ + NMTDS_PassKeyShapeMapHasher.hxx \ NMTDS_PShapesDataStructure.hxx \ NMTDS_ShapesDataStructure.hxx \ NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx \ NMTDS_StdMapNodeOfMapOfPassKey.hxx \ + NMTDS_Tools.hxx \ NMTDS_BoxBndTree.hxx # idl files diff --git a/src/NMTDS/NMTDS.cdl b/src/NMTDS/NMTDS.cdl index c023fff9e..cabb10f4b 100644 --- a/src/NMTDS/NMTDS.cdl +++ b/src/NMTDS/NMTDS.cdl @@ -28,29 +28,49 @@ package NMTDS ---Purpose: uses - TCollection, TColStd, Bnd, TopoDS, TopAbs, TopTools, - BooleanOperations, - BOPTColStd + BooleanOperations, + BOPTools, + BOPTColStd + is + enumeration InterfType is + TI_VV, + TI_VE, + TI_VF, + TI_EE, + TI_EF, + TI_FF, + TI_UNKNOWN + end InterfType; + -- class ShapesDataStructure; class IndexRange; -- Modified to Add new classes Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN class Iterator; + class PassKey; class PassKeyBoolean; class PassKeyMapHasher; -- Contribution of Samtech www.samcef.com END - + class PassKeyShape; + class PassKeyShapeMapHasher; + --modified by NIZNHY-PKV Tue Feb 6 10:40:02 2007f + class IteratorCheckerSI; + class Tools; + class InterfPool; + --modified by NIZNHY-PKV Tue Feb 6 10:40:04 2007t pointer PShapesDataStructure to ShapesDataStructure from NMTDS; - + pointer PIterator to Iterator from NMTDS; + pointer PInterfPool to InterfPool from NMTDS; + class CArray1OfIndexRange instantiates CArray1 from BOPTColStd(IndexRange from NMTDS); @@ -79,7 +99,7 @@ is PassKeyMapHasher from NMTDS); -- Contribution of Samtech www.samcef.com END - +--modified by NIZNHY-PKV Tue Oct 10 11:19:06 2006f class IndexedDataMapOfShapeBox instantiates IndexedDataMap from TCollection (Shape from TopoDS, Box from Bnd, @@ -88,6 +108,12 @@ is instantiates IndexedDataMap from TCollection (Integer from Standard, Shape from TopoDS, MapIntegerHasher from TColStd); + + class DataMapOfIntegerMapOfInteger + instantiates DataMap from TCollection (Integer from Standard, + MapOfInteger from TColStd, + MapIntegerHasher from TColStd); +--modified by NIZNHY-PKV Tue Oct 10 11:19:08 2006t end NMTDS; diff --git a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..5c782f2d4 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,115 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#define _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class TColStd_MapOfInteger; +class TColStd_MapIntegerHasher; +class NMTDS_DataMapOfIntegerMapOfInteger; +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger : public TCollection_BasicMapIterator { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger(); + + +Standard_EXPORT NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger(const NMTDS_DataMapOfIntegerMapOfInteger& aMap); + + +Standard_EXPORT void Initialize(const NMTDS_DataMapOfIntegerMapOfInteger& aMap) ; + + +Standard_EXPORT const Standard_Integer& Key() const; + + +Standard_EXPORT const TColStd_MapOfInteger& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx new file mode 100644 index 000000000..52c8d5334 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx @@ -0,0 +1,54 @@ +// Copyright (C) 2005 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 + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..89989c7a3 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,131 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#define _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class TColStd_MapOfInteger; +class TColStd_MapIntegerHasher; +class NMTDS_DataMapOfIntegerMapOfInteger; +class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; + + + +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger : public TCollection_MapNode { + +public: + // Methods PUBLIC + // + +NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger(const Standard_Integer& K,const TColStd_MapOfInteger& I,const TCollection_MapNodePtr& n); + + Standard_Integer& Key() const; + + TColStd_MapOfInteger& Value() const; +//Standard_EXPORT ~NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myKey; +TColStd_MapOfInteger myValue; + + +}; + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx new file mode 100644 index 000000000..81d4ca5ad --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx @@ -0,0 +1,100 @@ +// Copyright (C) 2005 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 + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +//NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::~NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger() {} + + + +Standard_EXPORT Handle_Standard_Type& NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger", + sizeof(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger))) { + _anOtherObject = Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)((Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::DynamicType() const +{ + return STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) ; +} +//Standard_Boolean NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) == AType || TCollection_MapNode::IsKind(AType)); +//} +//Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::~Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger() {} +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx new file mode 100644 index 000000000..2e7c5b402 --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx @@ -0,0 +1,154 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#define _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class TColStd_MapOfInteger; +class TColStd_MapIntegerHasher; +class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; +class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_DataMapOfIntegerMapOfInteger : public TCollection_BasicMap { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger(const Standard_Integer NbBuckets = 1); + + +Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger& Assign(const NMTDS_DataMapOfIntegerMapOfInteger& Other) ; + NMTDS_DataMapOfIntegerMapOfInteger& operator =(const NMTDS_DataMapOfIntegerMapOfInteger& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; + + +Standard_EXPORT void Clear() ; +~NMTDS_DataMapOfIntegerMapOfInteger() +{ + Clear(); +} + + + +Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const TColStd_MapOfInteger& I) ; + + +Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; + + +Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; + + +Standard_EXPORT const TColStd_MapOfInteger& Find(const Standard_Integer& K) const; + const TColStd_MapOfInteger& operator()(const Standard_Integer& K) const +{ + return Find(K); +} + + + +Standard_EXPORT TColStd_MapOfInteger& ChangeFind(const Standard_Integer& K) ; + TColStd_MapOfInteger& operator()(const Standard_Integer& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + +Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger(const NMTDS_DataMapOfIntegerMapOfInteger& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx new file mode 100644 index 000000000..ca6e0ffea --- /dev/null +++ b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx @@ -0,0 +1,57 @@ +// Copyright (C) 2005 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 + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TColStd_MapOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif +#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#include +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem TColStd_MapOfInteger +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger +#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() +#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/NMTDS/NMTDS_InterfPool.cdl b/src/NMTDS/NMTDS_InterfPool.cdl new file mode 100644 index 000000000..8b74d08c4 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.cdl @@ -0,0 +1,151 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTDS_InterfPool.cdl +-- Created: Wed Feb 21 10:10:58 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class InterfPool from NMTDS + + ---Purpose: + +uses + MapOfPassKeyBoolean from NMTDS, + ListOfPassKeyBoolean from NMTDS, + PassKeyBoolean from NMTDS, + InterfType from NMTDS, + -- + CArray1OfSSInterference from BOPTools, + CArray1OfESInterference from BOPTools, + CArray1OfVSInterference from BOPTools, + CArray1OfEEInterference from BOPTools, + CArray1OfVEInterference from BOPTools, + CArray1OfVVInterference from BOPTools + +--raises + +is + Create + returns InterfPool from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_InterfPool();" + + + Add (me:out; + aPKB : PassKeyBoolean from NMTDS; + aType: InterfType from NMTDS) + returns Boolean from Standard; + + Add (me:out; + aInd1 : Integer from Standard; + aInd2 : Integer from Standard; + aType : InterfType from NMTDS) + returns Boolean from Standard; + + Add (me:out; + aInd1 : Integer from Standard; + aInd2 : Integer from Standard; + bFlag : Boolean from Standard; + aType : InterfType from NMTDS) + returns Boolean from Standard; + + Contains(me; + aPKB : PassKeyBoolean from NMTDS) + returns Boolean from Standard; + + Contains(me; + aInd1 : Integer from Standard; + aInd2 : Integer from Standard) + returns Boolean from Standard; + + Get(me) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + Get(me; + aType : InterfType from NMTDS) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + Get(me; + aInd : Integer from Standard) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + Get(me; + aInd : Integer from Standard; + aType: InterfType from NMTDS) + returns ListOfPassKeyBoolean from NMTDS; + ---C++: return const & + + -- + -- Interferences + -- + SSInterferences (me:out) + returns CArray1OfSSInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to array Of F/F interferences + --- + ESInterferences (me:out) + returns CArray1OfESInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to array Of E/F interferences + --- + VSInterferences (me:out) + returns CArray1OfVSInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to array Of V/F interferences + --- + EEInterferences (me:out) + returns CArray1OfEEInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to arrray Of E/E interferences + --- + VEInterferences (me:out) + returns CArray1OfVEInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to arrray Of V/E interferences + --- + VVInterferences (me:out) + returns CArray1OfVVInterference from BOPTools; + ---C++: return & + ---Purpose: + --- Returns the reference to arrray Of V/V interferences + --- + +fields + myTable : MapOfPassKeyBoolean from NMTDS [6] is protected; + myList : ListOfPassKeyBoolean from NMTDS is protected; + myMaxInd: Integer from Standard is protected; + -- + mySSInterferences : CArray1OfSSInterference from BOPTools is protected; + myESInterferences : CArray1OfESInterference from BOPTools is protected; + myVSInterferences : CArray1OfVSInterference from BOPTools is protected; + myEEInterferences : CArray1OfEEInterference from BOPTools is protected; + myVEInterferences : CArray1OfVEInterference from BOPTools is protected; + myVVInterferences : CArray1OfVVInterference from BOPTools is protected; + +end InterfPool; diff --git a/src/NMTDS/NMTDS_InterfPool.cxx b/src/NMTDS/NMTDS_InterfPool.cxx new file mode 100644 index 000000000..95774e9f7 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.cxx @@ -0,0 +1,281 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTDS_.InterfPoolcxx +// Created: Wed Feb 21 10:35:35 2007 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include + +static + Standard_Integer TypeToInteger(const NMTDS_InterfType aType); + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_InterfPool::NMTDS_InterfPool() +{ + myMaxInd=6; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_InterfPool::~NMTDS_InterfPool() +{ +} +//======================================================================= +//function : Add +//purpose : +//======================================================================= + Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PassKeyBoolean& aPKB, + const NMTDS_InterfType aType) +{ + Standard_Boolean bRet; + Standard_Integer iType; + // + bRet=Standard_False; + // + iType=TypeToInteger(aType); + if (iType>-1 && iTypeClear(); + // + for (i=0; iAppend(aPKB); + } + } + return myList; +} +//======================================================================= +//function : Get +//purpose : +//======================================================================= + const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd)const +{ + Standard_Integer i, n1, n2; + NMTDS_ListOfPassKeyBoolean* pL; + // + pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL->Clear(); + // + for (i=0; iAppend(aPKB); + } + } + } + return myList; +} +//======================================================================= +//function : Get +//purpose : +//======================================================================= + const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const NMTDS_InterfType aType)const +{ + Standard_Integer iType; + NMTDS_ListOfPassKeyBoolean* pL; + // + pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL->Clear(); + // + iType=TypeToInteger(aType); + if (iType>-1 && iTypeAppend(aPKB); + } + } + return myList; +} +//======================================================================= +//function : Get +//purpose : +//======================================================================= + const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd, + const NMTDS_InterfType aType)const +{ + Standard_Integer n1, n2; + NMTDS_ListOfPassKeyBoolean *pL, aLPKB; + NMTDS_ListIteratorOfListOfPassKeyBoolean aIt; + // + aLPKB=Get(aType); + // + pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL->Clear(); + // + aIt.Initialize (aLPKB); + for (; aIt.More(); aIt.Next()) { + const NMTDS_PassKeyBoolean& aPKB=aIt.Value(); + aPKB.Ids(n1, n2); + if(n1==aInd || n2==aInd) { + pL->Append(aPKB); + } + } + return myList; +} +//////////////////// +//=========================================================================== +//function : SSInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences() +{ + return mySSInterferences; +} +//=========================================================================== +//function : ESInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences() +{ + return myESInterferences; +} +//=========================================================================== +//function : VSInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences() +{ + return myVSInterferences; +} +//=========================================================================== +//function : EEInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences() +{ + return myEEInterferences; +} +//=========================================================================== +//function : VEInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences() +{ + return myVEInterferences; +} +//=========================================================================== +//function : VVInterferences +//purpose : +//=========================================================================== + BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences() +{ + return myVVInterferences; +} +//////////////////// +//======================================================================= +//function : TypeToInteger +//purpose : +//======================================================================= +Standard_Integer TypeToInteger(const NMTDS_InterfType aType) +{ + return (Standard_Integer)aType; +} diff --git a/src/NMTDS/NMTDS_InterfPool.hxx b/src/NMTDS/NMTDS_InterfPool.hxx new file mode 100644 index 000000000..f0bfd2111 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.hxx @@ -0,0 +1,191 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_InterfPool_HeaderFile +#define _NMTDS_InterfPool_HeaderFile + +#ifndef _NMTDS_MapOfPassKeyBoolean_HeaderFile +#include +#endif +#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfESInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfEEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _NMTDS_InterfType_HeaderFile +#include +#endif +class NMTDS_PassKeyBoolean; +class NMTDS_ListOfPassKeyBoolean; +class BOPTools_CArray1OfSSInterference; +class BOPTools_CArray1OfESInterference; +class BOPTools_CArray1OfVSInterference; +class BOPTools_CArray1OfEEInterference; +class BOPTools_CArray1OfVEInterference; +class BOPTools_CArray1OfVVInterference; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_InterfPool { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_InterfPool(); +Standard_EXPORT virtual ~NMTDS_InterfPool(); + + +Standard_EXPORT Standard_Boolean Add(const NMTDS_PassKeyBoolean& aPKB,const NMTDS_InterfType aType) ; + + +Standard_EXPORT Standard_Boolean Add(const Standard_Integer aInd1,const Standard_Integer aInd2,const NMTDS_InterfType aType) ; + + +Standard_EXPORT Standard_Boolean Add(const Standard_Integer aInd1,const Standard_Integer aInd2,const Standard_Boolean bFlag,const NMTDS_InterfType aType) ; + + +Standard_EXPORT Standard_Boolean Contains(const NMTDS_PassKeyBoolean& aPKB) const; + + +Standard_EXPORT Standard_Boolean Contains(const Standard_Integer aInd1,const Standard_Integer aInd2) const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get() const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const NMTDS_InterfType aType) const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const Standard_Integer aInd) const; + + +Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const Standard_Integer aInd,const NMTDS_InterfType aType) const; + + +//! Returns the reference to array Of F/F interferences
+Standard_EXPORT BOPTools_CArray1OfSSInterference& SSInterferences() ; + + +//! Returns the reference to array Of E/F interferences
+Standard_EXPORT BOPTools_CArray1OfESInterference& ESInterferences() ; + + +//! Returns the reference to array Of V/F interferences
+Standard_EXPORT BOPTools_CArray1OfVSInterference& VSInterferences() ; + + +//! Returns the reference to arrray Of E/E interferences
+Standard_EXPORT BOPTools_CArray1OfEEInterference& EEInterferences() ; + + +//! Returns the reference to arrray Of V/E interferences
+Standard_EXPORT BOPTools_CArray1OfVEInterference& VEInterferences() ; + + +//! Returns the reference to arrray Of V/V interferences
+Standard_EXPORT BOPTools_CArray1OfVVInterference& VVInterferences() ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +NMTDS_MapOfPassKeyBoolean myTable[6]; +NMTDS_ListOfPassKeyBoolean myList; +Standard_Integer myMaxInd; +BOPTools_CArray1OfSSInterference mySSInterferences; +BOPTools_CArray1OfESInterference myESInterferences; +BOPTools_CArray1OfVSInterference myVSInterferences; +BOPTools_CArray1OfEEInterference myEEInterferences; +BOPTools_CArray1OfVEInterference myVEInterferences; +BOPTools_CArray1OfVVInterference myVVInterferences; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_InterfPool.ixx b/src/NMTDS/NMTDS_InterfPool.ixx new file mode 100644 index 000000000..c608b6885 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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 + + + + diff --git a/src/NMTDS/NMTDS_InterfPool.jxx b/src/NMTDS/NMTDS_InterfPool.jxx new file mode 100644 index 000000000..f12d52951 --- /dev/null +++ b/src/NMTDS/NMTDS_InterfPool.jxx @@ -0,0 +1,46 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_PassKeyBoolean_HeaderFile +#include +#endif +#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfESInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVSInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfEEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVEInterference_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile +#include +#endif +#ifndef _NMTDS_InterfPool_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_InterfType.hxx b/src/NMTDS/NMTDS_InterfType.hxx new file mode 100644 index 000000000..d32f9835b --- /dev/null +++ b/src/NMTDS/NMTDS_InterfType.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_InterfType_HeaderFile +#define _NMTDS_InterfType_HeaderFile + + +enum NMTDS_InterfType { + NMTDS_TI_VV, +NMTDS_TI_VE, +NMTDS_TI_VF, +NMTDS_TI_EE, +NMTDS_TI_EF, +NMTDS_TI_FF, +NMTDS_TI_UNKNOWN +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/NMTDS/NMTDS_Iterator.cdl b/src/NMTDS/NMTDS_Iterator.cdl index 05a026a73..d73a1d5d3 100755 --- a/src/NMTDS/NMTDS_Iterator.cdl +++ b/src/NMTDS/NMTDS_Iterator.cdl @@ -24,7 +24,7 @@ class Iterator from NMTDS - + ---Purpose: uses @@ -33,7 +33,9 @@ uses ShapesDataStructure from NMTDS, PShapesDataStructure from NMTDS, ListOfPassKeyBoolean from NMTDS, - ListIteratorOfListOfPassKeyBoolean from NMTDS + ListIteratorOfListOfPassKeyBoolean from NMTDS, + PassKeyBoolean from NMTDS + --raises is @@ -61,18 +63,28 @@ is aIndex2:out Integer from Standard; aWithSubShape: out Boolean from Standard); - Prepare(me:out); - + Prepare(me:out) + is virtual; + + Intersect(me:out) + is virtual protected; + ExpectedLength(me) returns Integer from Standard; + BlockLength(me) + returns Integer from Standard; + SDVertices(me) returns DataMapOfIntegerListOfInteger from TColStd; - ---C++:return const & - + ---C++:return const & + + FillMVSD(myclass; + aMVSD1:DataMapOfIntegerListOfInteger from TColStd; + aMVSD2:out DataMapOfIntegerListOfInteger from TColStd); fields - myPDS :PShapesDataStructure from NMTDS is protected; + myDS :PShapesDataStructure from NMTDS is protected; myLists :ListOfPassKeyBoolean from NMTDS [6] is protected; myIterator :ListIteratorOfListOfPassKeyBoolean from NMTDS is protected; myEmptyList:ListOfPassKeyBoolean from NMTDS is protected; diff --git a/src/NMTDS/NMTDS_Iterator.cxx b/src/NMTDS/NMTDS_Iterator.cxx index d186736c0..8e894d6d4 100755 --- a/src/NMTDS/NMTDS_Iterator.cxx +++ b/src/NMTDS/NMTDS_Iterator.cxx @@ -1,18 +1,17 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2006 SAMTECH +// // 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 +// 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 +// +// 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 +// 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 @@ -24,44 +23,35 @@ #include -#include -#include +// #include -#include +// #include -#include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include #include -#include #include #include - +// +#include +#include +#include +// +#include +// #include #include - -static - void ComputeBoxEx(const Standard_Integer aIx, - NMTDS_ShapesDataStructure* pDS, - Bnd_Box& aBoxEx); - -static inline - Standard_Boolean IsValidType(const TopAbs_ShapeEnum aT); - -static - Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2); - +#include +#include +#include +#include +#include +#include +#include +#include +#include //======================================================================= //function : NMTDS_Iterator @@ -69,7 +59,7 @@ static //======================================================================= NMTDS_Iterator::NMTDS_Iterator() { - myPDS=NULL; + myDS=NULL; myLength=0; } //======================================================================= @@ -85,7 +75,7 @@ static //======================================================================= void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS) { - myPDS=aDS; + myDS=aDS; } //======================================================================= // function: DS @@ -93,7 +83,7 @@ static //======================================================================= const NMTDS_ShapesDataStructure& NMTDS_Iterator::DS()const { - return *myPDS; + return *myDS; } //======================================================================= // function: ExpectedLength @@ -104,6 +94,24 @@ static return myLength; } //======================================================================= +// function: BlockLength +// purpose: +//======================================================================= + Standard_Integer NMTDS_Iterator::BlockLength() const +{ + Standard_Integer aNbIIs; + Standard_Real aCfPredict=.5; + + aNbIIs=ExpectedLength(); + + if (aNbIIs<=1) { + return 1; + } + // + aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs); + return aNbIIs; +} +//======================================================================= // function: Initialize // purpose: //======================================================================= @@ -112,7 +120,7 @@ static { Standard_Integer iX; // - iX=TypeToInteger(aType1, aType2); + iX=NMTDS_Tools::TypeToInteger(aType1, aType2); if (iX>=0) { myIterator.Initialize(myLists[iX]); myLength=myLists[iX].Extent(); @@ -158,52 +166,62 @@ static { return myMVSD; } - //======================================================================= // function: Prepare // purpose: //======================================================================= void NMTDS_Iterator::Prepare() +{ + Standard_Integer i; + // + myLength=0; + for (i=0; i<6; ++i) { + myLists[i].Clear(); + } + myMVSD.Clear(); + // + if (myDS==NULL){ + return; + } + Intersect(); +} +//======================================================================= +// function: Intersect +// purpose: +//======================================================================= + void NMTDS_Iterator::Intersect() { Standard_Boolean bFlag; - Standard_Integer aNb, i, aNbB, aNbR; + Standard_Integer aNb, i, aNbB, aNbR, iFlag; Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV; TColStd_ListIteratorOfListOfInteger aIt; TColStd_DataMapOfIntegerInteger aMII; - TColStd_MapOfInteger aMFence; + //modified by NIZNHY-PKV Mon Jan 22 15:08:00 2007f + //TColStd_MapOfInteger aMFence; + TColStd_DataMapOfIntegerListOfInteger aMVSD; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; + //modified by NIZNHY-PKV Mon Jan 22 10:21:50 2007t TopTools_DataMapOfShapeInteger aMSI; TopAbs_ShapeEnum aTi, aTj; NMTDS_PassKeyBoolean aPKXB; NMTDS_MapOfPassKeyBoolean aMPKXB; NMTDS_IndexedDataMapOfShapeBox aMSB; - Handle(Bnd_HArray1OfBox) aHAB; - Bnd_BoundSortBox aBSB; // NMTDS_BoxBndTreeSelector aSelector; NMTDS_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // - if (myPDS==NULL){ - return; - } - // - myLength=0; - for (i=0; i<6; ++i) { - myLists[i].Clear(); - } - myMVSD.Clear(); - // - const NMTDS_CArray1OfIndexRange& aRanges=myPDS->Ranges(); + const NMTDS_CArray1OfIndexRange& aRanges=myDS->Ranges(); aNbR=aRanges.Extent(); // - aNb=myPDS->NumberOfShapesOfTheObject(); + aNb=myDS->NumberOfShapesOfTheObject(); for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aS=myPDS->Shape(i); + const TopoDS_Shape& aS=myDS->Shape(i); aTi=aS.ShapeType(); - if (IsValidType(aTi)) { + if (NMTDS_Tools::HasBRep(aTi)) { Bnd_Box aBoxEx; // - ComputeBoxEx(i, myPDS, aBoxEx); + myDS->ComputeBoxEx(i, aBoxEx); aMSI.Bind(aS, i); aMSB.Add(aS, aBoxEx); } @@ -228,9 +246,9 @@ static i1=aR.First(); i2=aR.Last(); for (i=i1; i<=i2; ++i) { - const TopoDS_Shape& aSi=myPDS->Shape(i); + const TopoDS_Shape& aSi=myDS->Shape(i); aTi=aSi.ShapeType(); - if (!IsValidType(aTi)){ + if (!NMTDS_Tools::HasBRep(aTi)){ continue; } const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi); @@ -257,25 +275,24 @@ static } // aPKXB.SetIds(i, j); + // if (aMPKXB.Add(aPKXB)) { bFlag=Standard_False;// Bounding boxes are intersected - const Bnd_Box& aBoxi=myPDS->GetBoundingBox(i); - const Bnd_Box& aBoxj=myPDS->GetBoundingBox(j); + const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); + const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); if (aBoxi.IsOut(aBoxj)) { bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected } - const TopoDS_Shape& aSj=myPDS->Shape(j); + const TopoDS_Shape& aSj=myDS->Shape(j); aTj=aSj.ShapeType(); - iX=TypeToInteger(aTi, aTj); - + iX=NMTDS_Tools::TypeToInteger(aTi, aTj); + //bFlag=(iStatus==2); aPKXB.SetFlag(bFlag); myLists[iX].Append(aPKXB); // // VSD prepare if (iX==5) { //VV - if (aMFence.Add(j)) { - aLV.Append(j); - } + aLV.Append(j); } }// if (aMPKXB.Add(aPKXB)) { }// for (; aIt.More(); aIt.Next()) { @@ -283,112 +300,154 @@ static // VSD treatment aNbLV=aLV.Extent(); if (aNbLV) { - myMVSD.Bind(i, aLV); + TColStd_ListOfInteger aLV1; + // + const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + const TopoDS_Shape& aSj=myDS->Shape(j); + const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); + iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); + if (!iFlag) { + aLV1.Append(j); + } + else { + aPKXB.SetIds(i, j); + aMPKXB.Remove(aPKXB); + } + } + aMVSD.Bind(i, aLV1); } }//for (i=i1; i<=i2; ++i) { }//for (iR=1; iRGetBoundingBox(aIx); - aBoxEx.Add(aBox); // - aNbS=pDS->NumberOfSuccessors(aIx); - for (i=1; i<=aNbS; ++i) { - Bnd_Box aBoxS; - iS=pDS->GetSuccessor(aIx, i); - ComputeBoxEx(iS, pDS, aBoxS); - aBoxEx.Add(aBoxS); - } + // Chains + //================= + myMVSD.Clear(); + NMTDS_Iterator::FillMVSD(aMVSD, myMVSD); } - //======================================================================= -// function: TypeToInteger -// purpose: +//function : FillMVSD +//purpose : //======================================================================= -Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) + void NMTDS_Iterator::FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD, + TColStd_DataMapOfIntegerListOfInteger& bMVSD) { - Standard_Integer iRet, iT1, iT2, iX; - // - iRet=-1; - iT1=(Standard_Integer)aType1; - iT2=(Standard_Integer)aType2; + Standard_Boolean bFound; + Standard_Integer aNbVSD, iCnt, i, j, k; + TColStd_ListOfInteger aLV; + TColStd_ListIteratorOfListOfInteger aIt; + TColStd_MapOfInteger aMF; + TColStd_MapIteratorOfMapOfInteger aItMI; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; + NMTDS_DataMapOfIntegerMapOfInteger aDMIMI; + NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger aIti, aItj; // - iX=iT2*10+iT1; - switch (iX) { - case 77: - iRet=5; // VV - break; - case 76: - case 67: - iRet=4; // VE - break; - case 74: - case 47: - iRet=2; // VF - break; - case 66: - iRet=3; // EE - break; - case 64: - case 46: - iRet=1; // EF - break; - case 44: - iRet=0; // FF - break; - default: - break; + aNbVSD=aMVSD.Extent(); + if (!aNbVSD) { + return; } - return iRet; -} - -/* -// - // check - TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1; - TColStd_DataMapIteratorOfDataMapOfIntegerInteger aIt2; // - printf(" \n"); - printf(" aMVLV.Extent()=%d\n", aMVLV.Extent()); - aIt1.Initialize(aMVLV); - for (; aIt1.More(); aIt1.Next()) { - i=aIt1.Key(); - printf(" i=%d (", i); - const TColStd_ListOfInteger& aLV=aIt1.Value(); - aIt.Initialize(aLV); + aItVSD.Initialize(aMVSD); + for (; aItVSD.More(); aItVSD.Next()) { + TColStd_MapOfInteger aMI; + // + i=aItVSD.Key(); + aMI.Add(i); + const TColStd_ListOfInteger& aLVSD=aItVSD.Value(); + aIt.Initialize(aLVSD); for (; aIt.More(); aIt.Next()) { j=aIt.Value(); - printf(" %d", j); + aMI.Add(j); } - printf(")\n"); + aDMIMI.Bind(i, aMI); } - // - printf(" \n"); - printf(" aMVV.Extent()=%d\n", aMVV.Extent()); - aIt2.Initialize(aMVV); - for (; aIt2.More(); aIt2.Next()) { - i=aIt2.Key(); - j=aIt2.Value(); - printf(" (%d, %d)\n", i, j); + // i + aIti.Initialize(aDMIMI); + for (; aIti.More(); aIti.Next()) { + i=aIti.Key(); + if (aMF.Contains(i)) { + continue; + } + aMF.Add(i); + // + //TColStd_MapOfInteger& aMIi=aDMIMI.ChangeFind(i); + TColStd_MapOfInteger *pMIi=(TColStd_MapOfInteger *)&aIti.Value(); + TColStd_MapOfInteger& aMIi=*pMIi; + // j + while (1) { + iCnt=0; + aItj.Initialize(aDMIMI); + for (; aItj.More(); aItj.Next()) { + j=aItj.Key(); + if (aMF.Contains(j)) { + continue; + } + // + //TColStd_MapOfInteger& aMIj=aDMIMI.ChangeFind(j); + TColStd_MapOfInteger *pMj=(TColStd_MapOfInteger *)&aItj.Value(); + TColStd_MapOfInteger& aMIj=*pMj; + // + aItMI.Initialize(aMIj); + for (; aItMI.More(); aItMI.Next()) { + k=aItMI.Key(); + bFound=aMIi.Contains(k); + if (bFound) { + break; + } + } + if (!bFound) { + continue; + } + // + aItMI.Initialize(aMIj); + for (; aItMI.More(); aItMI.Next()) { + k=aItMI.Key(); + aMIi.Add(k); + } + // + if (aMF.Add(j)) { + ++iCnt; + } + } //for (; aItj.More(); aItj.Next()) { + if (!iCnt) { + break; + } + } // while (1) { + // + aLV.Clear(); + aItMI.Initialize(aMIi); + for (; aItMI.More(); aItMI.Next()) { + k=aItMI.Key(); + if (k!=i) { + aLV.Append(k); + } + } + bMVSD.Bind(i, aLV); + }// for (; aIti.More(); aIti.Next()) { +} + + /* + { + // check + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItX; + // + printf(" \n"); + printf(" myMVSD.Extent()=%d\n", myMVSD.Extent()); + aItX.Initialize(myMVSD); + for (; aItX.More(); aItX.Next()) { + i=aItX.Key(); + printf(" i=%d (", i); + const TColStd_ListOfInteger& aLV=aItX.Value(); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + printf(" %d", j); + } + printf(")\n"); + } } - printf("\n"); */ + diff --git a/src/NMTDS/NMTDS_Iterator.hxx b/src/NMTDS/NMTDS_Iterator.hxx index d2d260ccd..25ae15ec0 100644 --- a/src/NMTDS/NMTDS_Iterator.hxx +++ b/src/NMTDS/NMTDS_Iterator.hxx @@ -95,15 +95,21 @@ Standard_EXPORT void Next() ; Standard_EXPORT void Current(Standard_Integer& aIndex1,Standard_Integer& aIndex2,Standard_Boolean& aWithSubShape) const; -Standard_EXPORT void Prepare() ; +Standard_EXPORT virtual void Prepare() ; Standard_EXPORT Standard_Integer ExpectedLength() const; +Standard_EXPORT Standard_Integer BlockLength() const; + + Standard_EXPORT const TColStd_DataMapOfIntegerListOfInteger& SDVertices() const; +Standard_EXPORT static void FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD1,TColStd_DataMapOfIntegerListOfInteger& aMVSD2) ; + + @@ -113,9 +119,12 @@ protected: // +Standard_EXPORT virtual void Intersect() ; + + // Fields PROTECTED // -NMTDS_PShapesDataStructure myPDS; +NMTDS_PShapesDataStructure myDS; NMTDS_ListOfPassKeyBoolean myLists[6]; NMTDS_ListIteratorOfListOfPassKeyBoolean myIterator; NMTDS_ListOfPassKeyBoolean myEmptyList; diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.cdl b/src/NMTDS/NMTDS_IteratorCheckerSI.cdl new file mode 100644 index 000000000..c7f765003 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.cdl @@ -0,0 +1,41 @@ +-- Copyright (C) 2007 SAMTECH +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTDS_IteratorCheckerSI.cdl +-- Created: Tue Feb 6 10:18:27 2007 +-- Author: Peter KURNEV + + +class IteratorCheckerSI from NMTDS + inherits Iterator from NMTDS + + ---Purpose: + +--uses +--raises + +is + Create + returns IteratorCheckerSI from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_IteratorCheckerSI();" + + Intersect(me:out) + is redefined protected; + +--fields +end IteratorCheckerSI; diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.cxx b/src/NMTDS/NMTDS_IteratorCheckerSI.cxx new file mode 100644 index 000000000..da2290b93 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.cxx @@ -0,0 +1,225 @@ +// Copyright (C) 2007 SAMTECH +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTDS_IteratorChecker.cxx +// Created: Tue Feb 6 10:37:59 2007 +// Author: Peter KURNEV + + +#include + +#include +#include +#include +// +#include +#include +#include +#include +// +#include +#include +#include +#include +#include +#include +#include +#include +// +#include +// +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_IteratorCheckerSI::NMTDS_IteratorCheckerSI() +: + NMTDS_Iterator() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_IteratorCheckerSI::~NMTDS_IteratorCheckerSI() +{ +} +//======================================================================= +// function: Intersect +// purpose: +//======================================================================= + void NMTDS_IteratorCheckerSI::Intersect() +{ + Standard_Boolean bFlag; + Standard_Integer aNbS, i, aNbA, aNbB, iFlag; + Standard_Integer aNbSD, iX, j, iDS, jB, k, aNbLV; + TColStd_ListIteratorOfListOfInteger aIt; + TColStd_DataMapOfIntegerInteger aMII; + TColStd_DataMapOfIntegerListOfInteger aMVSD; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; + TopTools_DataMapOfShapeInteger aMSI; + TopAbs_ShapeEnum aTi, aTj; + NMTDS_PassKeyBoolean aPKXB; + NMTDS_MapOfPassKeyBoolean aMPKXB; + NMTDS_IndexedDataMapOfShapeBox aMSB; + NMTDS_MapOfPassKeyBoolean aMPA;//myPairsAvoid + // + NMTDS_BoxBndTreeSelector aSelector; + NMTDS_BoxBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + aNbS=myDS->NumberOfShapesOfTheObject(); + // + // myPairsAvoid, aMSI, aMSB + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSi=myDS->Shape(i); + aTi=aSi.ShapeType(); + if (NMTDS_Tools::HasBRep(aTi)) { + if (aTi!=TopAbs_VERTEX) { + TColStd_IndexedMapOfInteger aMA; + // + myDS->GetAllSuccessors(i, aMA); + // + aNbA=aMA.Extent(); + for (j=1; j<=aNbA; ++j) { + iX=aMA(j); + aPKXB.Clear(); + aPKXB.SetIds(i, iX); + aMPA.Add(aPKXB); + } + } + else { + aPKXB.Clear(); + aPKXB.SetIds(i, i); + aMPA.Add(aPKXB); + } + // + Bnd_Box aBoxEx; + // + myDS->ComputeBoxEx(i, aBoxEx); + aMSI.Bind(aSi, i); + aMSB.Add(aSi, aBoxEx); + } + } + // + // aMII + aNbB=aMSB.Extent(); + for (i=1; i<=aNbB; ++i) { + const TopoDS_Shape& aS=aMSB.FindKey(i); + const Bnd_Box& aBoxEx=aMSB(i); + // + aTreeFiller.Add(i, aBoxEx); + // + iDS=aMSI.Find(aS); + aMII.Bind(i, iDS); + } + // + aTreeFiller.Fill(); + // + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSi=myDS->Shape(i); + aTi=aSi.ShapeType(); + if (!NMTDS_Tools::HasBRep(aTi)){ + continue; + } + const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi); + aSelector.Clear(); + aSelector.SetBox(aBoxEx); + // + aNbSD=aBBTree.Select(aSelector); + if (!aNbSD){ + continue; + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + // + k=0; + TColStd_ListOfInteger aLV; + // + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + jB=aIt.Value(); // box index in MII + j=aMII.Find(jB); // DS index + // + aPKXB.SetIds(i, j); + if (aMPA.Contains(aPKXB)) { + continue; + } + // + if (aMPKXB.Add(aPKXB)) { + bFlag=Standard_False;// Bounding boxes are intersected + const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); + const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); + if (aBoxi.IsOut(aBoxj)) { + bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected + } + const TopoDS_Shape& aSj=myDS->Shape(j); + aTj=aSj.ShapeType(); + iX=NMTDS_Tools::TypeToInteger(aTi, aTj); + //bFlag=(iStatus==2); + aPKXB.SetFlag(bFlag); + myLists[iX].Append(aPKXB); + // + // VSD prepare + if (iX==5) { //VV + aLV.Append(j); + } + }// if (aMPKXB.Add(aPKXB)) { + }// for (; aIt.More(); aIt.Next()) { + // + // VSD treatment + aNbLV=aLV.Extent(); + if (aNbLV) { + TColStd_ListOfInteger aLV1; + // + const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + const TopoDS_Shape& aSj=myDS->Shape(j); + const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); + iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); + if (!iFlag) { + aLV1.Append(j); + } + else { + aPKXB.SetIds(i, j); + aMPKXB.Remove(aPKXB); + } + } + aMVSD.Bind(i, aLV1); + } + }//for (i=1; i<=aNbS; ++i) { + // + // + // 2. Chains + //================= + myMVSD.Clear(); + NMTDS_Iterator::FillMVSD(aMVSD, myMVSD); +} + diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.hxx b/src/NMTDS/NMTDS_IteratorCheckerSI.hxx new file mode 100644 index 000000000..f11a9c1c2 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.hxx @@ -0,0 +1,96 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_IteratorCheckerSI_HeaderFile +#define _NMTDS_IteratorCheckerSI_HeaderFile + +#ifndef _NMTDS_Iterator_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_IteratorCheckerSI : public NMTDS_Iterator { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_IteratorCheckerSI(); +Standard_EXPORT virtual ~NMTDS_IteratorCheckerSI(); + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void Intersect() ; + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.ixx b/src/NMTDS/NMTDS_IteratorCheckerSI.ixx new file mode 100644 index 000000000..6346ab519 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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 + + + + diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.jxx b/src/NMTDS/NMTDS_IteratorCheckerSI.jxx new file mode 100644 index 000000000..dc6afc1b7 --- /dev/null +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_IteratorCheckerSI_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_PInterfPool.hxx b/src/NMTDS/NMTDS_PInterfPool.hxx new file mode 100644 index 000000000..7084ba333 --- /dev/null +++ b/src/NMTDS/NMTDS_PInterfPool.hxx @@ -0,0 +1,27 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_PInterfPool_HeaderFile +#define _NMTDS_PInterfPool_HeaderFile + +class NMTDS_InterfPool; + +typedef NMTDS_InterfPool* NMTDS_PInterfPool; + +#endif diff --git a/src/NMTDS/NMTDS_PIterator.hxx b/src/NMTDS/NMTDS_PIterator.hxx new file mode 100644 index 000000000..8cefa5bb5 --- /dev/null +++ b/src/NMTDS/NMTDS_PIterator.hxx @@ -0,0 +1,27 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_PIterator_HeaderFile +#define _NMTDS_PIterator_HeaderFile + +class NMTDS_Iterator; + +typedef NMTDS_Iterator* NMTDS_PIterator; + +#endif diff --git a/src/NMTDS/NMTDS_PassKey.cdl b/src/NMTDS/NMTDS_PassKey.cdl index e9a637a46..905a8d62a 100755 --- a/src/NMTDS/NMTDS_PassKey.cdl +++ b/src/NMTDS/NMTDS_PassKey.cdl @@ -1,4 +1,5 @@ --- Copyright (C) 2006 SAMTECH +-- Copyright (C) 2005 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 @@ -14,67 +15,83 @@ -- 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 +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- -- File: NMTDS_PassKey.cdl --- Created: +-- Created: Mon Nov 20 12:16:13 2006 -- Author: Peter KURNEV -- + class PassKey from NMTDS ---Purpose: uses Shape from TopoDS, - ListOfInteger from TColStd - + IndexedMapOfInteger from TColStd, + ListOfInteger from TColStd + --raises is Create returns PassKey from NMTDS; - - Assign(me:out; - Other : PassKey from NMTDS) - returns PassKey from NMTDS; - ---C++: alias operator = - ---C++: return & --- + ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKey();" + + Create(Other:PassKey from NMTDS) + returns PassKey from NMTDS; + ---C++: alias "Standard_EXPORT NMTDS_PassKey& operator =(const NMTDS_PassKey& Other);" + + Clear(me:out); + SetIds(me:out; - aI1 :Integer from Standard; + aI1 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; aI2 :Integer from Standard); - NbMax(me) - returns Integer from Standard; - - Clear(me:out); + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard; + aI3 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard; + aI3 :Integer from Standard; + aI4 :Integer from Standard); - Compute(me:out); + SetIds(me:out; + aLS :ListOfInteger from TColStd); + + NbIds(me) + returns Integer from Standard; IsEqual(me; aOther:PassKey from NMTDS) returns Boolean from Standard; - - Key(me) - returns Address from Standard; HashCode(me; Upper : Integer from Standard) returns Integer from Standard; - + Id(me; + aIndex: Integer from Standard) + returns Integer from Standard; + Ids(me; aI1 :out Integer from Standard; aI2 :out Integer from Standard); - - Dump(me); + Dump(me; + aHex:Integer from Standard=0); + + fields - myNbIds: Integer from Standard is protected; - myNbMax: Integer from Standard is protected; - mySum : Integer from Standard is protected; - myIds : Integer from Standard [2] is protected; + mySum : Integer from Standard is protected; + myMap : IndexedMapOfInteger from TColStd is protected; end PassKey; diff --git a/src/NMTDS/NMTDS_PassKey.cxx b/src/NMTDS/NMTDS_PassKey.cxx index 910400cd6..2d2d52ea0 100755 --- a/src/NMTDS/NMTDS_PassKey.cxx +++ b/src/NMTDS/NMTDS_PassKey.cxx @@ -1,4 +1,5 @@ -// Copyright (C) 2006 SAMTECH +// Copyright (C) 2005 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 @@ -16,10 +17,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_PassKey.cxx -// Created: +// +// File: NMTDS_Algo.cxx +// Created: Sat Dec 04 12:39:47 2004 // Author: Peter KURNEV -// +// #include @@ -27,13 +29,12 @@ #include #include #include +#include #ifdef WNT #pragma warning( disable : 4101) #endif -static - void SortShell(const int n, int* a); static Standard_Integer NormalizedId(const Standard_Integer aId, const Standard_Integer aDiv); @@ -44,129 +45,197 @@ static //======================================================================= NMTDS_PassKey::NMTDS_PassKey() { - Clear(); + Clear(); +} +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PassKey::NMTDS_PassKey(const NMTDS_PassKey& aOther) +{ + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; } //======================================================================= -//function :Assign +//function :operator = //purpose : //======================================================================= - NMTDS_PassKey& NMTDS_PassKey::Assign(const NMTDS_PassKey& anOther) + NMTDS_PassKey& NMTDS_PassKey::operator =(const NMTDS_PassKey& aOther) { - myNbIds=anOther.myNbIds; - myNbMax=anOther.myNbMax; - mySum=anOther.mySum; - memcpy(myIds, anOther.myIds, sizeof(myIds)); + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; return *this; } //======================================================================= +//function :~ +//purpose : +//======================================================================= + NMTDS_PassKey::~NMTDS_PassKey() +{ +} +//======================================================================= //function :Clear //purpose : //======================================================================= void NMTDS_PassKey::Clear() { - Standard_Integer i; - // myNbIds=0; - myNbMax=2; mySum=0; - for (i=0; imyNbIds) { + return -1; + } + return myMap(aIndex); } //======================================================================= -//function :IsEqual +//function :Ids //purpose : //======================================================================= - Standard_Boolean NMTDS_PassKey::IsEqual(const NMTDS_PassKey& anOther) const + void NMTDS_PassKey::Ids(Standard_Integer& aId1, + Standard_Integer& aId2) const { - Standard_Integer iIsEqual; - Standard_Boolean bIsEqual; - // - iIsEqual=memcmp(myIds, anOther.myIds, sizeof(myIds)); - bIsEqual=Standard_False; - if (!iIsEqual) { - bIsEqual=!bIsEqual; + aId1=0; + aId2=0; + if (myNbIds>1) { + aId1=myMap(1); + aId2=myMap(2); } - return bIsEqual; } //======================================================================= -//function :Key +//function :IsEqual //purpose : //======================================================================= - Standard_Address NMTDS_PassKey::Key()const + Standard_Boolean NMTDS_PassKey::IsEqual(const NMTDS_PassKey& aOther) const { - return (Standard_Address)myIds; + Standard_Boolean bRet; + Standard_Integer i, aId; + // + bRet=Standard_False; + // + if (myNbIds!=aOther.myNbIds) { + return bRet; + } + for (i=1; i<=myNbIds; ++i) { + aId=myMap(i); + if (!aOther.myMap.Contains(aId)) { + return bRet; + } + } + return !bRet; } //======================================================================= //function : HashCode //purpose : //======================================================================= - Standard_Integer NMTDS_PassKey::HashCode(const Standard_Integer Upper) const + Standard_Integer NMTDS_PassKey::HashCode(const Standard_Integer aUpper) const { - return ::HashCode(mySum, Upper); + return ::HashCode(mySum, aUpper); } //======================================================================= //function : Dump //purpose : //======================================================================= - void NMTDS_PassKey::Dump()const + void NMTDS_PassKey::Dump(const Standard_Integer )const { - Standard_Integer i; - // - printf(" PassKey: {"); - for (i=0; i -1) goto m30; - }//if (a[l] < a[j]){ - }//for (i=0; i #endif +#ifndef _TColStd_IndexedMapOfInteger_HeaderFile +#include +#endif #ifndef _Standard_Boolean_HeaderFile #include #endif -#ifndef _Standard_Address_HeaderFile -#include -#endif +class TColStd_ListOfInteger; #ifndef _Standard_HeaderFile @@ -60,41 +61,47 @@ public: Standard_EXPORT NMTDS_PassKey(); +Standard_EXPORT virtual ~NMTDS_PassKey(); + +Standard_EXPORT NMTDS_PassKey(const NMTDS_PassKey& Other); +Standard_EXPORT NMTDS_PassKey& operator =(const NMTDS_PassKey& Other); + + +Standard_EXPORT void Clear() ; -Standard_EXPORT NMTDS_PassKey& Assign(const NMTDS_PassKey& Other) ; - NMTDS_PassKey& operator =(const NMTDS_PassKey& Other) -{ - return Assign(Other); -} +Standard_EXPORT void SetIds(const Standard_Integer aI1) ; Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2) ; -Standard_EXPORT Standard_Integer NbMax() const; +Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3) ; -Standard_EXPORT void Clear() ; +Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3,const Standard_Integer aI4) ; -Standard_EXPORT void Compute() ; +Standard_EXPORT void SetIds(const TColStd_ListOfInteger& aLS) ; -Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const; +Standard_EXPORT Standard_Integer NbIds() const; -Standard_EXPORT Standard_Address Key() const; +Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const; Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; +Standard_EXPORT Standard_Integer Id(const Standard_Integer aIndex) const; + + Standard_EXPORT void Ids(Standard_Integer& aI1,Standard_Integer& aI2) const; -Standard_EXPORT void Dump() const; +Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; @@ -109,9 +116,8 @@ protected: // Fields PROTECTED // Standard_Integer myNbIds; -Standard_Integer myNbMax; Standard_Integer mySum; -Standard_Integer myIds[2]; +TColStd_IndexedMapOfInteger myMap; private: diff --git a/src/NMTDS/NMTDS_PassKey.jxx b/src/NMTDS/NMTDS_PassKey.jxx index 02ef906d3..ba0d04dd1 100644 --- a/src/NMTDS/NMTDS_PassKey.jxx +++ b/src/NMTDS/NMTDS_PassKey.jxx @@ -17,6 +17,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif #ifndef _NMTDS_PassKey_HeaderFile #include #endif diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.cdl b/src/NMTDS/NMTDS_PassKeyBoolean.cdl index 2ad7871a0..c34a3244a 100755 --- a/src/NMTDS/NMTDS_PassKeyBoolean.cdl +++ b/src/NMTDS/NMTDS_PassKeyBoolean.cdl @@ -36,21 +36,16 @@ uses is Create returns PassKeyBoolean from NMTDS; - - Assign(me:out; - Other : PassKeyBoolean from NMTDS) - returns PassKeyBoolean from NMTDS; - ---C++: alias operator = - ---C++: return & --- + ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKeyBoolean();" + SetFlag(me:out; aFlag: Boolean from Standard); - + ---C++: alias " Standard_EXPORT NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other);" + Flag(me) returns Boolean from Standard; fields - myFlag: Boolean from Standard is protected; end PassKeyBoolean; diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.cxx b/src/NMTDS/NMTDS_PassKeyBoolean.cxx index 11f90ee79..059751fe2 100755 --- a/src/NMTDS/NMTDS_PassKeyBoolean.cxx +++ b/src/NMTDS/NMTDS_PassKeyBoolean.cxx @@ -25,7 +25,7 @@ #include //======================================================================= -//function : NMTDS_PassKeyBoolean +//function : //purpose : //======================================================================= NMTDS_PassKeyBoolean::NMTDS_PassKeyBoolean() @@ -35,13 +35,20 @@ { } //======================================================================= -//function :Assign +//function : ~ //purpose : //======================================================================= - NMTDS_PassKeyBoolean& NMTDS_PassKeyBoolean::Assign(const NMTDS_PassKeyBoolean& anOther) + NMTDS_PassKeyBoolean::~NMTDS_PassKeyBoolean() +{ +} +//======================================================================= +//function :operator = +//purpose : +//======================================================================= + NMTDS_PassKeyBoolean& NMTDS_PassKeyBoolean::operator =(const NMTDS_PassKeyBoolean& anOther) { myFlag=anOther.myFlag; - NMTDS_PassKey::Assign(anOther); + NMTDS_PassKey::operator =(anOther); return *this; } //======================================================================= diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.hxx b/src/NMTDS/NMTDS_PassKeyBoolean.hxx index 0ac2e06b6..604cfa30b 100644 --- a/src/NMTDS/NMTDS_PassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_PassKeyBoolean.hxx @@ -57,17 +57,11 @@ public: Standard_EXPORT NMTDS_PassKeyBoolean(); - - -Standard_EXPORT NMTDS_PassKeyBoolean& Assign(const NMTDS_PassKeyBoolean& Other) ; - NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other) -{ - return Assign(Other); -} - +Standard_EXPORT virtual ~NMTDS_PassKeyBoolean(); Standard_EXPORT void SetFlag(const Standard_Boolean aFlag) ; + Standard_EXPORT NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other); Standard_EXPORT Standard_Boolean Flag() const; diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.cdl b/src/NMTDS/NMTDS_PassKeyMapHasher.cdl index ae537d787..de75ce8f9 100755 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.cdl +++ b/src/NMTDS/NMTDS_PassKeyMapHasher.cdl @@ -1,4 +1,5 @@ --- Copyright (C) 2006 SAMTECH +-- Copyright (C) 2005 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 @@ -14,8 +15,8 @@ -- 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 --- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- -- File: NMTDS_PassKeyMapHasher.cdl -- Created: -- Author: Peter KURNEV diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.cxx b/src/NMTDS/NMTDS_PassKeyMapHasher.cxx index 09e4ad047..ac7910947 100755 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.cxx +++ b/src/NMTDS/NMTDS_PassKeyMapHasher.cxx @@ -1,4 +1,5 @@ -// Copyright (C) 2006 SAMTECH +// Copyright (C) 2005 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 @@ -28,17 +29,17 @@ //function : HashCode //purpose : //======================================================================= - Standard_Integer NMTDS_PassKeyMapHasher::HashCode(const NMTDS_PassKey& aPKey, + Standard_Integer NMTDS_PassKeyMapHasher::HashCode(const NMTDS_PassKey& aPK, const Standard_Integer Upper) { - return aPKey.HashCode(Upper); + return aPK.HashCode(Upper); } //======================================================================= //function :IsEqual //purpose : //======================================================================= - Standard_Boolean NMTDS_PassKeyMapHasher::IsEqual(const NMTDS_PassKey& aPKey1, - const NMTDS_PassKey& aPKey2) + Standard_Boolean NMTDS_PassKeyMapHasher::IsEqual(const NMTDS_PassKey& aPK1, + const NMTDS_PassKey& aPK2) { - return aPKey1.IsEqual(aPKey2); + return aPK1.IsEqual(aPK2); } diff --git a/src/NMTDS/NMTDS_PassKeyShape.cdl b/src/NMTDS/NMTDS_PassKeyShape.cdl new file mode 100644 index 000000000..081226594 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.cdl @@ -0,0 +1,95 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTDS_PassKeyShape.cdl +-- Created: +-- Author: Peter KURNEV +-- + + +class PassKeyShape from NMTDS + + ---Purpose: + +uses + Shape from TopoDS, + ListOfShape from TopTools, + IndexedMapOfShape from TopTools + +--raises + +is + Create + returns PassKeyShape from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKeyShape();" + + Create(Other:PassKeyShape from NMTDS) + returns PassKeyShape from NMTDS; + + Assign(me:out; + Other : PassKeyShape from NMTDS) + returns PassKeyShape from NMTDS; + ---C++: alias operator = + ---C++: return & + + SetShapes(me:out; + aS :Shape from TopoDS); + + SetShapes(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS); + + SetShapes(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS; + aS3 :Shape from TopoDS); + + SetShapes(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS; + aS3 :Shape from TopoDS; + aS4 :Shape from TopoDS); + + SetShapes(me:out; + aLS :ListOfShape from TopTools); + + Clear(me:out); + + + NbIds(me) + returns Integer from Standard; + + IsEqual(me; + aOther:PassKeyShape from NMTDS) + returns Boolean from Standard; + + HashCode(me; + Upper : Integer from Standard) + returns Integer from Standard; + + Dump(me; + aHex:Integer from Standard=0); + +fields + myNbIds:Integer from Standard is protected; + mySum :Integer from Standard is protected; + myUpper:Integer from Standard is protected; + myMap :IndexedMapOfShape from TopTools is protected; + +end PassKeyShape; diff --git a/src/NMTDS/NMTDS_PassKeyShape.cxx b/src/NMTDS/NMTDS_PassKeyShape.cxx new file mode 100644 index 000000000..c4af3a480 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.cxx @@ -0,0 +1,227 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTDS_PassKeyShape.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +#include +#include + + +static + Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv); +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PassKeyShape::NMTDS_PassKeyShape() +{ + myUpper=432123; +} +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PassKeyShape::NMTDS_PassKeyShape(const NMTDS_PassKeyShape& aOther) +{ + myUpper=432123; + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; +} +//======================================================================= +//function :~ +//purpose : +//======================================================================= + NMTDS_PassKeyShape::~NMTDS_PassKeyShape() +{ +} +//======================================================================= +//function :Assign +//purpose : +//======================================================================= + NMTDS_PassKeyShape& NMTDS_PassKeyShape::Assign(const NMTDS_PassKeyShape& aOther) +{ + myUpper=432123; + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; + return *this; +} +//======================================================================= +//function :Clear +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::Clear() +{ + myNbIds=0; + mySum=0; + myMap.Clear(); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1) + +{ + Standard_Integer aHC; + // + Clear(); + myNbIds=1; + myMap.Add(aS1); + aHC=aS1.HashCode(myUpper); + mySum=NormalizedId(aHC, myNbIds); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + TopTools_ListOfShape aLS; + // + aLS.Append(aS1); + aLS.Append(aS2); + SetShapes(aLS); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) +{ + TopTools_ListOfShape aLS; + // + aLS.Append(aS1); + aLS.Append(aS2); + aLS.Append(aS3); + SetShapes(aLS); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) +{ + TopTools_ListOfShape aLS; + // + aLS.Append(aS1); + aLS.Append(aS2); + aLS.Append(aS3); + aLS.Append(aS4); + SetShapes(aLS); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS) +{ + Standard_Integer i, aId, aIdN; + TopTools_ListIteratorOfListOfShape aIt; + // + Clear(); + aIt.Initialize(aLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + myMap.Add(aS); + } + myNbIds=myMap.Extent(); + for(i=1; i<=myNbIds; ++i) { + const TopoDS_Shape& aS=myMap(i); + aId=aS.HashCode(myUpper); + aIdN=NormalizedId(aId, myNbIds); + mySum+=aIdN; + } +} +//======================================================================= +//function :NbIds +//purpose : +//======================================================================= + Standard_Integer NMTDS_PassKeyShape::NbIds()const +{ + return myNbIds; +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean NMTDS_PassKeyShape::IsEqual(const NMTDS_PassKeyShape& aOther) const +{ + Standard_Boolean bRet; + Standard_Integer i; + // + bRet=Standard_False; + // + if (myNbIds!=aOther.myNbIds) { + return bRet; + } + for (i=1; i<=myNbIds; ++i) { + const TopoDS_Shape& aS=myMap(i); + if (!aOther.myMap.Contains(aS)) { + return bRet; + } + } + return !bRet; +} +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer NMTDS_PassKeyShape::HashCode(const Standard_Integer aUpper) const +{ + return ::HashCode(mySum, aUpper); +} +//======================================================================= +//function : Dump +//purpose : +//======================================================================= + void NMTDS_PassKeyShape::Dump(const Standard_Integer)const +{ +} +//======================================================================= +// function: NormalizedId +// purpose : +//======================================================================= +Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv) +{ + Standard_Integer aMax, aTresh, aIdRet; + // + aIdRet=aId; + aMax=::IntegerLast(); + aTresh=aMax/aDiv; + if (aId>aTresh) { + aIdRet=aId%aTresh; + } + return aIdRet; +} diff --git a/src/NMTDS/NMTDS_PassKeyShape.hxx b/src/NMTDS/NMTDS_PassKeyShape.hxx new file mode 100644 index 000000000..81eaa8096 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.hxx @@ -0,0 +1,146 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_PassKeyShape_HeaderFile +#define _NMTDS_PassKeyShape_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedMapOfShape_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class TopoDS_Shape; +class TopTools_ListOfShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_PassKeyShape { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTDS_PassKeyShape(); +Standard_EXPORT virtual ~NMTDS_PassKeyShape(); + + +Standard_EXPORT NMTDS_PassKeyShape(const NMTDS_PassKeyShape& Other); + + +Standard_EXPORT NMTDS_PassKeyShape& Assign(const NMTDS_PassKeyShape& Other) ; + NMTDS_PassKeyShape& operator =(const NMTDS_PassKeyShape& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3,const TopoDS_Shape& aS4) ; + + +Standard_EXPORT void SetShapes(const TopTools_ListOfShape& aLS) ; + + +Standard_EXPORT void Clear() ; + + +Standard_EXPORT Standard_Integer NbIds() const; + + +Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aOther) const; + + +Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; + + +Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +Standard_Integer myNbIds; +Standard_Integer mySum; +Standard_Integer myUpper; +TopTools_IndexedMapOfShape myMap; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_PassKeyShape.ixx b/src/NMTDS/NMTDS_PassKeyShape.ixx new file mode 100644 index 000000000..90c37bd34 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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 + + + + diff --git a/src/NMTDS/NMTDS_PassKeyShape.jxx b/src/NMTDS/NMTDS_PassKeyShape.jxx new file mode 100644 index 000000000..9d79955e4 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShape.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _NMTDS_PassKeyShape_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl new file mode 100644 index 000000000..77c066755 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl @@ -0,0 +1,47 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTDS_PassKeyMapHasher.cdl +-- Created: +-- Author: Peter KURNEV +-- + + +class PassKeyShapeMapHasher from NMTDS + + ---Purpose: + +uses + PassKeyShape from NMTDS + +--raises + +is + HashCode(myclass; + aPKey : PassKeyShape from NMTDS; + Upper : Integer from Standard) + returns Integer from Standard; + + + IsEqual(myclass; + aPKey1 : PassKeyShape from NMTDS; + aPKey2 : PassKeyShape from NMTDS) + returns Boolean from Standard; + +end PassKeyShapeMapHasher; diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx new file mode 100644 index 000000000..e637e3380 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTDS_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer NMTDS_PassKeyShapeMapHasher::HashCode(const NMTDS_PassKeyShape& aPK, + const Standard_Integer Upper) +{ + return aPK.HashCode(Upper); +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean NMTDS_PassKeyShapeMapHasher::IsEqual(const NMTDS_PassKeyShape& aPK1, + const NMTDS_PassKeyShape& aPK2) +{ + return aPK1.IsEqual(aPK2); +} diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx new file mode 100644 index 000000000..e48436737 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx @@ -0,0 +1,99 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_PassKeyShapeMapHasher_HeaderFile +#define _NMTDS_PassKeyShapeMapHasher_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class NMTDS_PassKeyShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_PassKeyShapeMapHasher { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT static Standard_Integer HashCode(const NMTDS_PassKeyShape& aPKey,const Standard_Integer Upper) ; + + +Standard_EXPORT static Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aPKey1,const NMTDS_PassKeyShape& aPKey2) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx new file mode 100644 index 000000000..c7148fd5d --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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 + + + + diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx new file mode 100644 index 000000000..f0e81fc33 --- /dev/null +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_PassKeyShape_HeaderFile +#include +#endif +#ifndef _NMTDS_PassKeyShapeMapHasher_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cdl b/src/NMTDS/NMTDS_ShapesDataStructure.cdl index 1922b4861..5a2f93f72 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cdl +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cdl @@ -27,8 +27,10 @@ class ShapesDataStructure from NMTDS ---Purpose: -uses - Shape from TopoDS, +uses + Box from Bnd, + IndexedMapOfInteger from TColStd, + Shape from TopoDS, IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations, CArray1OfIndexRange from NMTDS, IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger from NMTDS @@ -79,6 +81,14 @@ is aMS :out IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations); -- Contribution of Samtech www.samcef.com END + GetAllSuccessors(me; + anIndex:Integer from Standard; + aScrs :out IndexedMapOfInteger from TColStd); + + ComputeBoxEx(me; + anIndex:Integer from Standard; + aBox:out Box from Bnd); + fields myCompositeShape: Shape from TopoDS is protected; myRanges : CArray1OfIndexRange from NMTDS is protected; diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cxx b/src/NMTDS/NMTDS_ShapesDataStructure.cxx index c7355995b..a9a0e7370 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cxx @@ -24,19 +24,28 @@ #include - -#include - #include #include - -#include #include -#include - #include #include +#include #include +// +#include +#include +#include +#include + + +static + void ComputeBoxExS(const Standard_Integer aIx, + const NMTDS_ShapesDataStructure* pDS, + Bnd_Box& aBoxEx); +static + void GetAllSuccessorsS(const Standard_Integer nS, + const NMTDS_ShapesDataStructure* myDS, + TColStd_IndexedMapOfInteger& aMA); //=========================================================================== //function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure @@ -170,7 +179,6 @@ } //modified by NIZNHY-PKV Tue Feb 27 17:06:03 2007t } - // aNbS=aMSA.Extent(); // // Fill myRanges @@ -214,6 +222,7 @@ // Contribution of Samtech www.samcef.com BEGIN // // Fill the table + //aShift=0; //for (i=0; i<2; ++i) { // if (i) { @@ -226,7 +235,7 @@ // InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift); // } //} - + aShift=0; for (j=1; j<=aNbS; ++j) { const TopoDS_Shape& aSx=aMSA.FindKey(j); @@ -361,3 +370,72 @@ // Contribution of Samtech www.samcef.com END return aIndex; } + +//======================================================================= +//function : ComputeBoxEx +//purpose : +//======================================================================= + void NMTDS_ShapesDataStructure::ComputeBoxEx (const Standard_Integer aIx, + Bnd_Box& aBoxEx)const +{ + ComputeBoxExS(aIx, this, aBoxEx); +} +//======================================================================= +//function : GetAllSuccessors +//purpose : +//======================================================================= + void NMTDS_ShapesDataStructure::GetAllSuccessors(const Standard_Integer nS, + TColStd_IndexedMapOfInteger& aMA)const +{ + GetAllSuccessorsS(nS, this, aMA); +} +//======================================================================= +//function : GetAllSuccessorsS +//purpose : +//======================================================================= +void GetAllSuccessorsS(const Standard_Integer nS, + const NMTDS_ShapesDataStructure* myDS, + TColStd_IndexedMapOfInteger& aMA) +{ + TopAbs_ShapeEnum aT; + Standard_Integer i, nSx, aNbSuccessors, *pSuccessors; + Standard_Address xSuccessors; + // + const TopoDS_Shape& aS=myDS->Shape(nS); + aT=aS.ShapeType(); + if(NMTDS_Tools::HasBRep(aT)) { + aMA.Add(nS); + // + if (aT==TopAbs_VERTEX) { + return; + } + } + // + myDS->GetSuccessors(nS, xSuccessors, aNbSuccessors); + pSuccessors=(Standard_Integer*)xSuccessors; + for (i=0; iGetBoundingBox(aIx); + aBoxEx.Add(aBox); + // + aNbS=pDS->NumberOfSuccessors(aIx); + for (i=1; i<=aNbS; ++i) { + Bnd_Box aBoxS; + iS=pDS->GetSuccessor(aIx, i); + ComputeBoxExS(iS, pDS, aBoxS); + aBoxEx.Add(aBoxS); + } +} diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.hxx b/src/NMTDS/NMTDS_ShapesDataStructure.hxx index b3e8065f8..9d149f5a7 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.hxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.hxx @@ -38,6 +38,8 @@ class TopoDS_Shape; class NMTDS_CArray1OfIndexRange; class BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors; +class TColStd_IndexedMapOfInteger; +class Bnd_Box; #ifndef _Standard_HeaderFile @@ -98,6 +100,12 @@ Standard_EXPORT void FillMap(const TopoDS_Shape& aS,BooleanOperations_IndexedD Standard_EXPORT void FillSubshapes(const TopoDS_Shape& aS,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const; +Standard_EXPORT void GetAllSuccessors(const Standard_Integer anIndex,TColStd_IndexedMapOfInteger& aScrs) const; + + +Standard_EXPORT void ComputeBoxEx(const Standard_Integer anIndex,Bnd_Box& aBox) const; + + diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.jxx b/src/NMTDS/NMTDS_ShapesDataStructure.jxx index 5ae9a8554..41897c615 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.jxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.jxx @@ -26,6 +26,12 @@ #ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile #include #endif +#ifndef _TColStd_IndexedMapOfInteger_HeaderFile +#include +#endif +#ifndef _Bnd_Box_HeaderFile +#include +#endif #ifndef _NMTDS_ShapesDataStructure_HeaderFile #include #endif diff --git a/src/NMTDS/NMTDS_Tools.cdl b/src/NMTDS/NMTDS_Tools.cdl new file mode 100644 index 000000000..1465d4d16 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.cdl @@ -0,0 +1,64 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTDS_Tools.cdl +-- Created: Tue Feb 20 14:56:14 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class Tools from NMTDS + + ---Purpose: + +uses + ShapeEnum from TopAbs, + Vertex from TopoDS, + Shape from TopoDS, + IndexedDataMapOfShapeShape from TopTools + +--raises + +is + TypeToInteger(myclass; + aT1: ShapeEnum from TopAbs; + aT2: ShapeEnum from TopAbs) + returns Integer from Standard; + + HasBRep(myclass; + aT: ShapeEnum from TopAbs) + returns Boolean from Standard; + + ComputeVV(myclass; + aV1:Vertex from TopoDS; + aV2:Vertex from TopoDS) + returns Integer from Standard; + + CopyShape(myclass; + aS:Shape from TopoDS; + aSC:out Shape from TopoDS); + + CopyShape(myclass; + aS:Shape from TopoDS; + aSC :out Shape from TopoDS; + aMSS :out IndexedDataMapOfShapeShape from TopTools); +--fields + +end Tools; diff --git a/src/NMTDS/NMTDS_Tools.cxx b/src/NMTDS/NMTDS_Tools.cxx new file mode 100644 index 000000000..8944fe501 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.cxx @@ -0,0 +1,173 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTDS_Tools.cxx +// Created: Tue Feb 20 14:57:28 2007 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void CopySource(const TopoDS_Shape& aS, + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC); + +//======================================================================= +//function : CopyShape +//purpose : +//======================================================================= + void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC) +{ + TopTools_IndexedDataMapOfShapeShape aMapSS; + // + CopySource(aS, aMapSS, aSC); +} +//======================================================================= +//function : CopyShape +//purpose : +//======================================================================= + void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC, + TopTools_IndexedDataMapOfShapeShape& aMapSS) +{ + CopySource(aS, aMapSS, aSC); +} +//======================================================================= +//function : CopySource +//purpose : +//======================================================================= +void CopySource(const TopoDS_Shape& aS, + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC) +{ + Standard_Boolean bFree; + TopAbs_ShapeEnum aT; + TopoDS_Iterator aIt; + BRep_Builder BB; + // + aT=aS.ShapeType(); + // + if (aMapSS.Contains(aS)) { + aSC=aMapSS.ChangeFromKey(aS); + aSC.Orientation(aS.Orientation()); + return; + } + else { + aSC=aS.EmptyCopied(); + aMapSS.Add(aS, aSC); + } + // + bFree=aSC.Free(); + aSC.Free(Standard_True); + aIt.Initialize(aS); + for (; aIt.More(); aIt.Next()) { + TopoDS_Shape aSCx; + // + const TopoDS_Shape& aSx=aIt.Value(); + // + CopySource (aSx, aMapSS, aSCx); + // + aSCx.Orientation(aSx.Orientation()); + BB.Add(aSC, aSCx); + } + aSC.Free(bFree); +} +//======================================================================= +// function: ComputeVV +// purpose: +//======================================================================= + Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1, + const TopoDS_Vertex& aV2) +{ + Standard_Real aTolV1, aTolV2, aTolSum, aTolSum2, aD2; + gp_Pnt aP1, aP2; + // + aTolV1=BRep_Tool::Tolerance(aV1); + aTolV2=BRep_Tool::Tolerance(aV2); + aTolSum=aTolV1+aTolV2; + aTolSum2=aTolSum*aTolSum; + // + aP1=BRep_Tool::Pnt(aV1); + aP2=BRep_Tool::Pnt(aV2); + // + aD2=aP1.SquareDistance(aP2); + if (aD2>aTolSum2) { + return -1; + } + return 0; +} +//======================================================================= +// function: HasBRep +// purpose: +//======================================================================= + Standard_Boolean NMTDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) +{ + return (aTi==TopAbs_VERTEX || aTi==TopAbs_EDGE || aTi==TopAbs_FACE); +} +//======================================================================= +//function : TypeToInteger +//purpose : +//======================================================================= + Standard_Integer NMTDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + Standard_Integer iRet, iT1, iT2, iX; + // + iRet=-1; + iT1=(Standard_Integer)aType1; + iT2=(Standard_Integer)aType2; + // + iX=iT2*10+iT1; + switch (iX) { + case 77: + iRet=5; // VV + break; + case 76: + case 67: + iRet=4; // VE + break; + case 74: + case 47: + iRet=2; // VF + break; + case 66: + iRet=3; // EE + break; + case 64: + case 46: + iRet=1; // EF + break; + case 44: + iRet=0; // FF + break; + default: + break; + } + return iRet; +} diff --git a/src/NMTDS/NMTDS_Tools.hxx b/src/NMTDS/NMTDS_Tools.hxx new file mode 100644 index 000000000..c7eb8fdc9 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.hxx @@ -0,0 +1,113 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTDS_Tools_HeaderFile +#define _NMTDS_Tools_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class TopoDS_Vertex; +class TopoDS_Shape; +class TopTools_IndexedDataMapOfShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTDS_Tools { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aT1,const TopAbs_ShapeEnum aT2) ; + + +Standard_EXPORT static Standard_Boolean HasBRep(const TopAbs_ShapeEnum aT) ; + + +Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& aV1,const TopoDS_Vertex& aV2) ; + + +Standard_EXPORT static void CopyShape(const TopoDS_Shape& aS,TopoDS_Shape& aSC) ; + + +Standard_EXPORT static void CopyShape(const TopoDS_Shape& aS,TopoDS_Shape& aSC,TopTools_IndexedDataMapOfShapeShape& aMSS) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_Tools.ixx b/src/NMTDS/NMTDS_Tools.ixx new file mode 100644 index 000000000..8e5877b34 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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 + + + + diff --git a/src/NMTDS/NMTDS_Tools.jxx b/src/NMTDS/NMTDS_Tools.jxx new file mode 100644 index 000000000..4359a18a7 --- /dev/null +++ b/src/NMTDS/NMTDS_Tools.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile +#include +#endif +#ifndef _NMTDS_Tools_HeaderFile +#include +#endif diff --git a/src/NMTTools/Makefile.in b/src/NMTTools/Makefile.in index 0e8cd2abd..63c77356a 100644 --- a/src/NMTTools/Makefile.in +++ b/src/NMTTools/Makefile.in @@ -37,12 +37,13 @@ VPATH=.:@srcdir@ # Libraries targets LIB = libNMTTools.la LIB_SRC = \ + NMTTools_CheckerSI.cxx \ + NMTTools_CheckerSI_1.cxx \ NMTTools_CommonBlockAPI.cxx \ NMTTools_CommonBlock.cxx \ NMTTools_CommonBlockPool_0.cxx \ NMTTools_CoupleOfShape.cxx \ NMTTools_DEProcessor.cxx \ - NMTTools_DSFiller.cxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx \ @@ -67,7 +68,6 @@ LIB_SRC = \ NMTTools_PaveFiller_8.cxx \ NMTTools_PaveFiller_9.cxx \ NMTTools_PaveFiller.cxx \ - NMTTools_PCurveMaker.cxx \ NMTTools_Tools.cxx \ NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx \ NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx \ @@ -90,12 +90,12 @@ EXPORT_HEADERS = \ Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx \ Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx \ NMTDS_Iterator.hxx \ + NMTTools_CheckerSI.hxx \ NMTTools_CommonBlockAPI.hxx \ NMTTools_CommonBlock.hxx \ NMTTools_CommonBlockPool.hxx \ NMTTools_CoupleOfShape.hxx \ NMTTools_DEProcessor.hxx \ - NMTTools_DSFiller.hxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx \ NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx \ @@ -110,8 +110,6 @@ EXPORT_HEADERS = \ NMTTools_ListOfCommonBlock.hxx \ NMTTools_ListOfCoupleOfShape.hxx \ NMTTools_PaveFiller.hxx \ - NMTTools_PCurveMaker.hxx \ - NMTTools_PDSFiller.hxx \ NMTTools_PPaveFiller.hxx \ NMTTools_Tools.hxx \ Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx \ diff --git a/src/NMTTools/NMTTools.cdl b/src/NMTTools/NMTTools.cdl index 6342a3082..14ce83e18 100644 --- a/src/NMTTools/NMTTools.cdl +++ b/src/NMTTools/NMTTools.cdl @@ -44,18 +44,21 @@ uses NMTDS is - class IteratorOfCoupleOfShape; - class DSFiller; + --class IteratorOfCoupleOfShape; + --class DSFiller; class PaveFiller; class Tools; class CommonBlock; class CommonBlockAPI; - class PCurveMaker; + --class PCurveMaker; class DEProcessor; - class CoupleOfShape; - + class CoupleOfShape; + --modified by NIZNHY-PKV Mon Feb 19 11:39:24 2007f + class CheckerSI; + --modified by NIZNHY-PKV Mon Feb 19 11:39:27 2007t + pointer PPaveFiller to PaveFiller from NMTTools; - pointer PDSFiller to DSFiller from NMTTools; + --pointer PDSFiller to DSFiller from NMTTools; class ListOfCommonBlock instantiates List from TCollection(CommonBlock from NMTTools); diff --git a/src/NMTTools/NMTTools_CheckerSI.cdl b/src/NMTTools/NMTTools_CheckerSI.cdl new file mode 100644 index 000000000..50518ecd0 --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.cdl @@ -0,0 +1,64 @@ +-- Copyright (C) 2006 SAMTECH +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: NMTTools_CheckerSI.cdl +-- Created: Mon Feb 19 11:23:55 2007 +-- Author: Peter KURNEV + + +class CheckerSI from NMTTools + inherits PaveFiller from NMTTools + ---Purpose: + +uses + ShapeEnum from TopAbs + +--raises + +is + + Create + returns CheckerSI from NMTTools; + ---C++: alias "Standard_EXPORT virtual ~NMTTools_CheckerSI();" + + Perform (me:out) + is redefined; + + Init (me:out) + is redefined protected; + + Clear (me:out) + is redefined protected; + + PreparePaveBlocks (me:out; + nE:Integer from Standard) + is redefined protected; + + PreparePaveBlocks (me:out; + aType1: ShapeEnum from TopAbs; + aType2: ShapeEnum from TopAbs) + is redefined protected; + + StopStatus(me) + returns Integer from Standard; + + +fields + myStopStatus: Integer from Standard is protected; + +end CheckerSI; diff --git a/src/NMTTools/NMTTools_CheckerSI.cxx b/src/NMTTools/NMTTools_CheckerSI.cxx new file mode 100644 index 000000000..f3158795f --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.cxx @@ -0,0 +1,177 @@ +// Copyright (C) 2006 SAMTECH +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTTools_CheckerSI.cxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTTools_CheckerSI::NMTTools_CheckerSI() +: + NMTTools_PaveFiller() +{ + myStopStatus=0; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTTools_CheckerSI::~NMTTools_CheckerSI() +{ +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= + void NMTTools_CheckerSI::Clear() +{ + NMTTools_PaveFiller::Clear(); +} +//======================================================================= +//function : StopStatus +//purpose : +//======================================================================= + Standard_Integer NMTTools_CheckerSI::StopStatus()const +{ + return myStopStatus; +} +//======================================================================= +//function : Init +//purpose : +//======================================================================= + void NMTTools_CheckerSI::Init() +{ + myIsDone=Standard_False; + if (myCompositeShape.IsNull()) { + return; + } + // + Clear(); + // 1. + myDS=new NMTDS_ShapesDataStructure; + myDS->SetCompositeShape(myCompositeShape); + myDS->Init(); + // + // 2. + myDSIt=new NMTDS_IteratorCheckerSI; + myDSIt->SetDS(myDS); + myDSIt->Prepare(); + // + // 4. + myNbSources=myDS->NumberOfShapesOfTheObject()+ + myDS->NumberOfShapesOfTheTool(); + myNbEdges=myDS->NbEdges(); + // 5 + myIP=new NMTDS_InterfPool; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void NMTTools_CheckerSI::Perform() +{ + myIsDone=Standard_False; + myStopStatus=0; + // + Init(); + //1.VV + // + PerformVV(); + // + // 2.VE + myPavePool.Resize (myNbEdges); + + PrepareEdges(); + // + PerformVE(); + // + // 3.VF + PerformVF(); + // + // 4.EE + myCommonBlockPool.Resize (myNbEdges); + mySplitShapesPool.Resize (myNbEdges); + myPavePoolNew .Resize (myNbEdges); + // + PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE); + if (myStopStatus) { + return; + } + PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE); + if (myStopStatus) { + return; + } + // + PerformEE(); + // + RefinePavePool (); + if (myStopStatus) { + return; + } + // + myPavePoolNew.Destroy(); + myPavePoolNew.Resize (myNbEdges); + // + // 5.EF + PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE); + if (myStopStatus) { + return; + } + // + PerformEF(); + // + RefinePavePool(); + if (myStopStatus) { + return; + } + // + myPavePoolNew.Destroy(); + // + MakeSplitEdges(); + // + UpdateCommonBlocks(); + // + // 6. FF + PerformFF (); + // + MakeBlocks(); + // + MakePCurves(); + // + // 7. Postprocessing + UpdatePaveBlocks(); + // + NMTTools_DEProcessor aDEP(*this); + aDEP.Do(); + // + MakeAloneVertices(); + // + myIsDone=Standard_True; +} diff --git a/src/NMTTools/NMTTools_CheckerSI.hxx b/src/NMTTools/NMTTools_CheckerSI.hxx new file mode 100644 index 000000000..4aacb49d2 --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.hxx @@ -0,0 +1,118 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTTools_CheckerSI_HeaderFile +#define _NMTTools_CheckerSI_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _NMTTools_PaveFiller_HeaderFile +#include +#endif +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class NMTTools_CheckerSI : public NMTTools_PaveFiller { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT NMTTools_CheckerSI(); +Standard_EXPORT virtual ~NMTTools_CheckerSI(); + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT Standard_Integer StopStatus() const; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void Init() ; + + +Standard_EXPORT virtual void Clear() ; + + +Standard_EXPORT virtual void PreparePaveBlocks(const Standard_Integer nE) ; + + +Standard_EXPORT virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1,const TopAbs_ShapeEnum aType2) ; + + + // Fields PROTECTED + // +Standard_Integer myStopStatus; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTTools/NMTTools_CheckerSI.ixx b/src/NMTTools/NMTTools_CheckerSI.ixx new file mode 100644 index 000000000..5d3e0201d --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 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 + + + + diff --git a/src/NMTTools/NMTTools_CheckerSI.jxx b/src/NMTTools/NMTTools_CheckerSI.jxx new file mode 100644 index 000000000..68bdc3096 --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _NMTTools_CheckerSI_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_CheckerSI_1.cxx b/src/NMTTools/NMTTools_CheckerSI_1.cxx new file mode 100755 index 000000000..36ab867df --- /dev/null +++ b/src/NMTTools/NMTTools_CheckerSI_1.cxx @@ -0,0 +1,160 @@ +// Copyright (C) 2006 SAMTECH +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: NMTTools_CheckerSI.cxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV +// + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +static + Standard_Boolean IsValid(const TopoDS_Edge& aE, + const TopoDS_Vertex& aV, + const Standard_Real aTV1, + const Standard_Real aTV2); + +//======================================================================= +// function: PreparePaveBlocks +// purpose: +//======================================================================= + void NMTTools_CheckerSI::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + NMTTools_PaveFiller::PreparePaveBlocks(aType1, aType2); +} +//======================================================================= +// function: PreparePaveBlocks +// purpose: +//======================================================================= + void NMTTools_CheckerSI::PreparePaveBlocks(const Standard_Integer nE) +{ + myIsDone=Standard_False; + // + char buf[32]={"SR"}; + Standard_Boolean bIsValid; + Standard_Integer nV1, nV2, iErr; + Standard_Real aT1, aT2; + TopoDS_Edge aE; + TopoDS_Vertex aV1, aV2; + // + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); + // Edge + aE=TopoDS::Edge(myDS->Shape(nE)); + if (BRep_Tool::Degenerated(aE)) { + myIsDone=Standard_True; + return; + } + // + BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); + + BOPTools_PaveBlockIterator aPBIt(nE, aPS); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + const IntTools_Range& aRange=aPB.Range(); + // + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + aV1=TopoDS::Vertex(myDS->Shape(nV1)); + aT1=aPave1.Param(); + // + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + aV2=TopoDS::Vertex(myDS->Shape(nV2)); + aT2=aPave2.Param(); + // + bIsValid=Standard_True; + if (nV1==nV2) { + bIsValid=IsValid(aE, aV1, aT1, aT2); + if (!bIsValid) { + //printf(" pb SR: nV nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); + myStopStatus=1; + } + } + // + IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); + iErr=aSR.ErrorStatus(); + if (!aSR.IsDone()) { + //printf(" pb SR: Done nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); + aSR.SetShrunkRange(aRange); + //throw BOPTColStd_Failure(buf) ; + } + else if (iErr!=6) { + CorrectShrunkRanges (0, aPave1, aSR); + CorrectShrunkRanges (1, aPave2, aSR); + } + aPB.SetShrunkRange(aSR); + aLPB.Append(aPB); + } //for (; aPBIt.More(); aPBIt.Next()) + myIsDone=Standard_True; +} + +//======================================================================= +//function : IsValid +//purpose : +//======================================================================= +Standard_Boolean IsValid(const TopoDS_Edge& aE, + const TopoDS_Vertex& aV, + const Standard_Real aTV1, + const Standard_Real aTV2) +{ + Standard_Boolean bRet; + Standard_Integer i, aNbP, aNbP1; + Standard_Real aTolV2, aTC1, aTC2, dT, aTC, aD2; + Handle(Geom_Curve) aC; + gp_Pnt aPV, aPC; + // + bRet=Standard_False; + aTolV2=BRep_Tool::Tolerance(aV); + aTolV2=aTolV2*aTolV2; + aPV=BRep_Tool::Pnt(aV); + aC=BRep_Tool::Curve(aE, aTC1, aTC2); + aNbP=7; + aNbP1=aNbP-1; + dT=(aTV2-aTV1)/aNbP1; + // + for (i=1; iD0(aTC, aPC); + aD2=aPV.SquareDistance(aPC); + bRet=aD2>aTolV2; + } + return bRet; +} diff --git a/src/NMTTools/NMTTools_DEProcessor.cxx b/src/NMTTools/NMTTools_DEProcessor.cxx index 9c5f860f5..0933b0104 100644 --- a/src/NMTTools/NMTTools_DEProcessor.cxx +++ b/src/NMTTools/NMTTools_DEProcessor.cxx @@ -74,7 +74,7 @@ #include #include #include -#include + #include #include @@ -90,7 +90,7 @@ #include #include - +#include //======================================================================= // function: NMTTools_DEProcessor::NMTTools_DEProcessor @@ -189,7 +189,7 @@ void NMTTools_DEProcessor::DoPaves() { - Standard_Integer i, aNbE, nED, nVD, nFD, aNbLPB; + Standard_Integer i, aNbE, nED, nVD, aNbLPB, nFD; // nFD=0; aNbE=myDEMap.Extent(); @@ -203,16 +203,15 @@ TColStd_ListIteratorOfListOfInteger anIt(nLF); for (; anIt.More(); anIt.Next()) { nFD=anIt.Value(); - // + BOPTools_ListOfPaveBlock aLPB; FindPaveBlocks(nED, nVD, nFD, aLPB); - //modified by NIZNHY-PKV Fri Mar 23 10:35:27 2007f - // + // xxf aNbLPB=aLPB.Extent(); if (!aNbLPB) { continue; } - //modified by NIZNHY-PKV Fri Mar 23 10:35:33 2007t + //xxt FillPaveSet (nED, nVD, nFD, aLPB); } // @@ -236,7 +235,8 @@ BOPTools_ListIteratorOfListOfPaveBlock anIt; Standard_Integer i, aNb, nF2, nV; // - BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences(); + //BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=(myFiller->IP())->SSInterferences(); // aNb=aFFs.Extent(); for (i=1; i<=aNb; ++i) { diff --git a/src/NMTTools/NMTTools_PaveFiller.cdl b/src/NMTTools/NMTTools_PaveFiller.cdl index 3cee74a1a..19340bc8c 100644 --- a/src/NMTTools/NMTTools_PaveFiller.cdl +++ b/src/NMTTools/NMTTools_PaveFiller.cdl @@ -28,19 +28,18 @@ class PaveFiller from NMTTools ---Purpose: uses - -- Modified to add new definitions Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - ListOfInteger from TColStd, - -- Contribution of Samtech www.samcef.com END DataMapOfIntegerInteger from TColStd, Pnt from gp, ShapeEnum from TopAbs, Vertex from TopoDS, Face from TopoDS, + Shape from TopoDS, -- Modified to add new definitions Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN Edge from TopoDS, - ListOfShape from TopTools, + ListOfShape from TopTools, + DataMapOfShapeShape from TopTools, + ListOfInteger from TColStd, -- Contribution of Samtech www.samcef.com END Context from IntTools, @@ -48,8 +47,8 @@ uses IndexedDataMapOfShapeInteger from BooleanOperations, - InterferencePool from BOPTools, - PInterferencePool from BOPTools, + --InterferencePool from BOPTools, + --PInterferencePool from BOPTools, PavePool from BOPTools, PaveBlock from BOPTools, ListOfPaveBlock from BOPTools, @@ -66,48 +65,77 @@ uses CommonBlockPool from NMTTools, CommonBlock from NMTTools, ListOfCommonBlock from NMTTools, - -- Modified to add new definitions Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - IndexedDataMapOfIndexedMapOfInteger from NMTTools, - -- Contribution of Samtech www.samcef.com END + ShapesDataStructure from NMTDS, + -- Modified to add new definitions Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN PShapesDataStructure from NMTDS, - Iterator from NMTDS + Iterator from NMTDS, + IndexedDataMapOfIndexedMapOfInteger from NMTTools, -- Contribution of Samtech www.samcef.com END + + PIterator from NMTDS, + PInterfPool from NMTDS --raises is Create - returns PaveFiller from NMTTools; + returns PaveFiller from NMTTools; + ---C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller();" - Create(aIP:InterferencePool from BOPTools) - returns PaveFiller from NMTTools; + -- Create(aIP:InterferencePool from BOPTools) + -- returns PaveFiller from NMTTools; - Destroy (me: in out) - is virtual; - ---C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();}" + -- Destroy (me: in out) + --is virtual; + -- -C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();}" -- -- Selectors/Modifiers - SetInterferencePool(me:out; - aIP:InterferencePool from BOPTools); - - InterfPool(me:out) - returns PInterferencePool from BOPTools; + --SetInterferencePool(me:out; + -- aIP:PInterferencePool from BOPTools); + + SetCompositeShape (me:out; + aS: Shape from TopoDS); + + CompositeShape(me) + returns Shape from TopoDS; + ---C++: return const& + + --InterfPool(me:out) + --returns PInterferencePool from BOPTools; + + --SetDS(me:out; + -- aDS:PShapesDataStructure from NMTDS); + + DS(me:out) + returns PShapesDataStructure from NMTDS; + + --SetDSIt(me:out; + -- aIt:PIterator from NMTDS); + + DSIt(me:out) + returns PIterator from NMTDS; + + IP(me:out) + returns PInterfPool from NMTDS; -- -- Perform the algo -- Modified to add new method Thu Sep 14 14:35:18 2006 -- Contribution of Samtech www.samcef.com BEGIN - Init (me:out); + Init (me:out) + is virtual protected; -- Contribution of Samtech www.samcef.com END + Clear (me:out) + is virtual protected; + Perform (me:out) is virtual; PerformVV (me:out) - is virtual ; + is virtual protected; PerformVE (me:out) is virtual protected; @@ -142,28 +170,25 @@ is anE:Integer from Standard) is virtual protected; - PerformNewVertices (me:out) - is virtual ; + --PerformNewVertices (me:out) + --is virtual; PrepareEdges (me:out) is virtual protected; - SortTypes (me; - anInd1:in out Integer from Standard; - anInd2:in out Integer from Standard) - is protected; + --SortTypes (me; + -- anInd1:in out Integer from Standard; + -- anInd2:in out Integer from Standard) + -- is protected; - ExpectedPoolLength(me) - returns Integer from Standard - is protected; + --ExpectedPoolLength(me) + -- returns Integer from Standard + --is protected; -- -- Query section IsDone(me) returns Boolean from Standard; - DS(me:out) - returns PShapesDataStructure from NMTDS; - Context(me) returns Context from IntTools; ---C++:return const & @@ -200,7 +225,7 @@ is nV: Integer from Standard) returns Integer from Standard; - IsSuccesstorsComputed (me; + IsSuccessorsComputed (me; iF1:Integer from Standard; iF2:Integer from Standard) returns Boolean from Standard @@ -500,18 +525,17 @@ is aLSE :out ListOfShape from TopTools); -- Contribution of Samtech www.samcef.com END + FuseVertices(me; + aC:Shape from TopoDS; + aDMVV: out DataMapOfShapeShape from TopTools); + fields - myIntrPool : PInterferencePool from BOPTools is protected; + --myIntrPool : PInterferencePool from BOPTools is protected; myDS : PShapesDataStructure from NMTDS is protected; myIsDone : Boolean from Standard is protected; myNbSources : Integer from Standard is protected; myNbEdges : Integer from Standard is protected; - -- Modified to add new field Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - myDSIt : Iterator from NMTDS is protected; - -- Contribution of Samtech www.samcef.com END - myPavePool : PavePool from BOPTools is protected; myPavePoolNew : PavePool from BOPTools is protected; myCommonBlockPool : CommonBlockPool from NMTTools is protected; @@ -520,7 +544,10 @@ fields myContext : Context from IntTools is protected; mySectionAttribute : SSIntersectionAttribute from BOPTools is protected; myAloneVertices : IndexedDataMapOfIndexedMapOfInteger from NMTTools is protected; - -- - myVSD : DataMapOfIntegerInteger from TColStd is protected; - -- + --modified by NIZNHY-PKV Wed Oct 11 11:06:50 2006f + myVSD : DataMapOfIntegerInteger from TColStd is protected; + myDSIt : PIterator from NMTDS is protected; + myCompositeShape : Shape from TopoDS is protected; + myIP : PInterfPool from NMTDS is protected; + --modified by NIZNHY-PKV Wed Oct 11 11:06:55 2006t end PaveFiller; diff --git a/src/NMTTools/NMTTools_PaveFiller.cxx b/src/NMTTools/NMTTools_PaveFiller.cxx index 9c76d8910..236a077dc 100644 --- a/src/NMTTools/NMTTools_PaveFiller.cxx +++ b/src/NMTTools/NMTTools_PaveFiller.cxx @@ -27,71 +27,97 @@ #include #include #include +#include +#include -// //======================================================================= // function: NMTTools_PaveFiller::NMTTools_PaveFiller // purpose: //======================================================================= NMTTools_PaveFiller::NMTTools_PaveFiller() { - myIntrPool=NULL; myDS=NULL; + myDSIt=NULL; myIsDone=Standard_False; myNbSources=0; myNbEdges=0; + myIP=NULL; } //======================================================================= -// function:NMTTools_PaveFiller::NMTTools_PaveFiller +// function: ~ // purpose: //======================================================================= - NMTTools_PaveFiller::NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP) + NMTTools_PaveFiller::~NMTTools_PaveFiller() { - SetInterferencePool(aIP); + Clear(); } //======================================================================= -// function: Destroy +// function: Clear // purpose: //======================================================================= - void NMTTools_PaveFiller::Destroy() + void NMTTools_PaveFiller::Clear() { + if (myDSIt) { + delete myDSIt; + } + if (myDS) { + delete myDS; + } + myDSIt=NULL; + myDS=NULL; + + if (myIP) { + delete myIP; + } + myIP=NULL; } //======================================================================= -// function: SetInterferencePool +// function: SetCompositeShape // purpose: //======================================================================= - void NMTTools_PaveFiller::SetInterferencePool(const BOPTools_InterferencePool& aIP) + void NMTTools_PaveFiller::SetCompositeShape(const TopoDS_Shape& aS) { - myIsDone=Standard_False; - // - myIntrPool=(BOPTools_InterferencePool*)&aIP; - myDS=(NMTDS_ShapesDataStructure*)myIntrPool->DS(); - myNbSources=myDS->NumberOfShapesOfTheObject()+myDS->NumberOfShapesOfTheTool(); - myNbEdges=myDS->NbEdges(); + myCompositeShape=aS; } //======================================================================= -// function: InterfPool +// function: CompositeShape // purpose: //======================================================================= - BOPTools_PInterferencePool NMTTools_PaveFiller::InterfPool() + const TopoDS_Shape& NMTTools_PaveFiller::CompositeShape()const { - return myIntrPool; + return myCompositeShape; } //======================================================================= -// function:IsDone +// function: DS // purpose: //======================================================================= - Standard_Boolean NMTTools_PaveFiller::IsDone() const + NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS() { - return myIsDone; + return myDS; } //======================================================================= -// function: DS +// function: DSIt // purpose: //======================================================================= - NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS() + NMTDS_PIterator NMTTools_PaveFiller::DSIt() { - return myDS; + return myDSIt; +} +//======================================================================= +// function: IP +// purpose: +//======================================================================= + NMTDS_PInterfPool NMTTools_PaveFiller::IP() +{ + return myIP; +} +//======================================================================= +// function:IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::IsDone() const +{ + return myIsDone; } //======================================================================= // function: Context @@ -149,7 +175,6 @@ { return mySplitShapesPool; } - //======================================================================= // function: ChangeSplitShapesPool // purpose: @@ -164,11 +189,29 @@ //======================================================================= void NMTTools_PaveFiller::Init() { - myDSIt.SetDS(myDS); - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - myDSIt.Prepare(); - // Contribution of Samtech www.samcef.com END + myIsDone=Standard_False; + if (myCompositeShape.IsNull()) { + return; + } + // + Clear(); + // 1. + myDS=new NMTDS_ShapesDataStructure; + myDS->SetCompositeShape(myCompositeShape); + myDS->Init(); + // + // 2. + myDSIt=new NMTDS_Iterator; + myDSIt->SetDS(myDS); + myDSIt->Prepare(); + // + // 3. + myNbSources=myDS->NumberOfShapesOfTheObject()+ + myDS->NumberOfShapesOfTheTool(); + myNbEdges=myDS->NbEdges(); + // + // 4 + myIP=new NMTDS_InterfPool; } //======================================================================= @@ -179,6 +222,7 @@ { myIsDone=Standard_False; // + //---------------- try { // 0. // Modified Thu Sep 14 14:35:18 2006 @@ -188,7 +232,6 @@ //1.VV // PerformVV(); - PerformNewVertices(); // // 2.VE myPavePool.Resize (myNbEdges); @@ -217,7 +260,6 @@ // // 5.EF PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE); - PerformEF(); // RefinePavePool(); diff --git a/src/NMTTools/NMTTools_PaveFiller.hxx b/src/NMTTools/NMTTools_PaveFiller.hxx index ab479896e..2d6492a3f 100644 --- a/src/NMTTools/NMTTools_PaveFiller.hxx +++ b/src/NMTTools/NMTTools_PaveFiller.hxx @@ -20,9 +20,6 @@ #ifndef _NMTTools_PaveFiller_HeaderFile #define _NMTTools_PaveFiller_HeaderFile -#ifndef _BOPTools_PInterferencePool_HeaderFile -#include -#endif #ifndef _NMTDS_PShapesDataStructure_HeaderFile #include #endif @@ -32,9 +29,6 @@ #ifndef _Standard_Integer_HeaderFile #include #endif -#ifndef _NMTDS_Iterator_HeaderFile -#include -#endif #ifndef _BOPTools_PavePool_HeaderFile #include #endif @@ -56,13 +50,22 @@ #ifndef _TColStd_DataMapOfIntegerInteger_HeaderFile #include #endif +#ifndef _NMTDS_PIterator_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTDS_PInterfPool_HeaderFile +#include +#endif #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif #ifndef _Standard_Real_HeaderFile #include #endif -class BOPTools_InterferencePool; +class TopoDS_Shape; class BOPTools_Pave; class IntTools_ShrunkRange; class IntTools_Context; @@ -86,6 +89,7 @@ class gp_Pnt; class NMTTools_IndexedDataMapOfIndexedMapOfInteger; class TopTools_ListOfShape; class TopoDS_Edge; +class TopTools_DataMapOfShapeShape; #ifndef _Standard_HeaderFile @@ -117,39 +121,30 @@ public: Standard_EXPORT NMTTools_PaveFiller(); +Standard_EXPORT virtual ~NMTTools_PaveFiller(); -Standard_EXPORT NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP); +Standard_EXPORT void SetCompositeShape(const TopoDS_Shape& aS) ; -Standard_EXPORT virtual void Destroy() ; -Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();} +Standard_EXPORT const TopoDS_Shape& CompositeShape() const; -Standard_EXPORT void SetInterferencePool(const BOPTools_InterferencePool& aIP) ; +Standard_EXPORT NMTDS_PShapesDataStructure DS() ; -Standard_EXPORT BOPTools_PInterferencePool InterfPool() ; +Standard_EXPORT NMTDS_PIterator DSIt() ; -Standard_EXPORT void Init() ; +Standard_EXPORT NMTDS_PInterfPool IP() ; Standard_EXPORT virtual void Perform() ; -Standard_EXPORT virtual void PerformVV() ; - - -Standard_EXPORT virtual void PerformNewVertices() ; - - Standard_EXPORT Standard_Boolean IsDone() const; -Standard_EXPORT NMTDS_PShapesDataStructure DS() ; - - Standard_EXPORT const IntTools_Context& Context() const; @@ -285,6 +280,9 @@ Standard_EXPORT Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlo Standard_EXPORT void SharedEdges(const Standard_Integer nF1,const Standard_Integer nF2,TColStd_ListOfInteger& aLNE,TopTools_ListOfShape& aLSE) ; +Standard_EXPORT void FuseVertices(const TopoDS_Shape& aC,TopTools_DataMapOfShapeShape& aDMVV) const; + + @@ -294,6 +292,15 @@ protected: // +Standard_EXPORT virtual void Init() ; + + +Standard_EXPORT virtual void Clear() ; + + +Standard_EXPORT virtual void PerformVV() ; + + Standard_EXPORT virtual void PerformVE() ; @@ -324,13 +331,7 @@ Standard_EXPORT virtual void PreparePaveBlocks(const Standard_Integer anE) ; Standard_EXPORT virtual void PrepareEdges() ; -Standard_EXPORT void SortTypes(Standard_Integer& anInd1,Standard_Integer& anInd2) const; - - -Standard_EXPORT Standard_Integer ExpectedPoolLength() const; - - -Standard_EXPORT Standard_Boolean IsSuccesstorsComputed(const Standard_Integer iF1,const Standard_Integer iF2) const; +Standard_EXPORT Standard_Boolean IsSuccessorsComputed(const Standard_Integer iF1,const Standard_Integer iF2) const; Standard_EXPORT Standard_Boolean IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,const BOPTools_PaveBlock& aPB2) const; @@ -392,12 +393,10 @@ Standard_EXPORT void MakeAloneVertices() ; // Fields PROTECTED // -BOPTools_PInterferencePool myIntrPool; NMTDS_PShapesDataStructure myDS; Standard_Boolean myIsDone; Standard_Integer myNbSources; Standard_Integer myNbEdges; -NMTDS_Iterator myDSIt; BOPTools_PavePool myPavePool; BOPTools_PavePool myPavePoolNew; NMTTools_CommonBlockPool myCommonBlockPool; @@ -406,6 +405,9 @@ IntTools_Context myContext; BOPTools_SSIntersectionAttribute mySectionAttribute; NMTTools_IndexedDataMapOfIndexedMapOfInteger myAloneVertices; TColStd_DataMapOfIntegerInteger myVSD; +NMTDS_PIterator myDSIt; +TopoDS_Shape myCompositeShape; +NMTDS_PInterfPool myIP; private: diff --git a/src/NMTTools/NMTTools_PaveFiller.jxx b/src/NMTTools/NMTTools_PaveFiller.jxx index 0e63c963e..1c7e98a59 100644 --- a/src/NMTTools/NMTTools_PaveFiller.jxx +++ b/src/NMTTools/NMTTools_PaveFiller.jxx @@ -17,8 +17,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#ifndef _BOPTools_InterferencePool_HeaderFile -#include +#ifndef _TopoDS_Shape_HeaderFile +#include #endif #ifndef _BOPTools_Pave_HeaderFile #include @@ -89,6 +89,9 @@ #ifndef _TopoDS_Edge_HeaderFile #include #endif +#ifndef _TopTools_DataMapOfShapeShape_HeaderFile +#include +#endif #ifndef _NMTTools_PaveFiller_HeaderFile #include #endif diff --git a/src/NMTTools/NMTTools_PaveFiller_0.cxx b/src/NMTTools/NMTTools_PaveFiller_0.cxx index e64607d3e..6a355d3df 100644 --- a/src/NMTTools/NMTTools_PaveFiller_0.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_0.cxx @@ -1,65 +1,70 @@ // Copyright (C) 2005 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 +// 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 +// +// 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 +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_1.cxx -// Created: Mon Dec 8 11:47:55 2003 +// File: NMTTools_PaveFiller_0.cxx +// Created: Mon Dec 8 11:45:51 2003 // Author: Peter KURNEV // + #include +#include #include -#include + +#include #include -#include +#include //======================================================================= -//function : SortTypes -//purpose : +// function:IsSuccesstorsComputed +// purpose: //======================================================================= - void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat, - Standard_Integer& theWith)const -{ - Standard_Boolean aReverseFlag=Standard_True; - - TopAbs_ShapeEnum aType1= myDS->GetShapeType(theWhat), - aType2= myDS->GetShapeType(theWith); - - if (aType1==aType2) - return; - - if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE){ - aReverseFlag=Standard_False; + Standard_Boolean NMTTools_PaveFiller::IsSuccessorsComputed(const Standard_Integer aN1, + const Standard_Integer aN2)const +{ + Standard_Boolean bComputed; + Standard_Integer i, nSuc, n1, n2, ntmp, aNbS; + TopAbs_ShapeEnum aType; + TColStd_IndexedMapOfInteger aMSuc; + // + n1=aN1; + n2=aN2; + aType=myDS->GetShapeType(aN1); + if (aType!=TopAbs_VERTEX) { + ntmp=n1; + n1=n2; + n2=ntmp; } - - if (aType1==TopAbs_VERTEX && - (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) { - aReverseFlag=Standard_False; + // + myDS->GetAllSuccessors(n2, aMSuc); + aNbS=aMSuc.Extent(); + for (i=1; i<=aNbS; ++i) { + nSuc=aMSuc(i); + bComputed=myIP->Contains(n1, nSuc); + if (bComputed) { + break; + } } - - Standard_Integer aWhat, aWith; - aWhat=(aReverseFlag) ? theWith : theWhat; - aWith=(aReverseFlag) ? theWhat : theWith; - - theWhat=aWhat; - theWith=aWith; + return bComputed; } +/* //======================================================================= // function: ExpectedPoolLength // purpose: @@ -72,7 +77,7 @@ // Contribution of Samtech www.samcef.com BEGIN //const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple(); //aNbIIs=aLC.Extent(); - aNbIIs=myDSIt.ExpectedLength(); + aNbIIs=myDSIt->ExpectedLength(); // Contribution of Samtech www.samcef.com END // if (aNbIIs==1) { @@ -83,57 +88,39 @@ return aNbIIs; } +*/ +/* //======================================================================= -// function:IsSuccesstorsComputed -// purpose: +//function : SortTypes +//purpose : //======================================================================= - Standard_Boolean NMTTools_PaveFiller::IsSuccesstorsComputed(const Standard_Integer aN1, - const Standard_Integer aN2)const -{ - Standard_Integer nSuc, n1, n2; - - BooleanOperations_OnceExplorer aExp(*myDS); - TopAbs_ShapeEnum aType=myDS->GetShapeType(aN1); - - n1=aN1; - n2=aN2; - - if (aType!=TopAbs_VERTEX) { - Standard_Integer ntmp=n1; - n1=n2; - n2=ntmp; + void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat, + Standard_Integer& theWith)const +{ + Standard_Integer aWhat, aWith; + Standard_Boolean aReverseFlag; + TopAbs_ShapeEnum aType1, aType2; + // + aType1= myDS->GetShapeType(theWhat), + aType2= myDS->GetShapeType(theWith); + // + if (aType1==aType2) { + return; } - - aType=myDS->GetShapeType(n2); - if (aType==TopAbs_EDGE) { - aExp.Init(n2, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nSuc=aExp.Current(); - if (myIntrPool->IsComputed(n1, nSuc)) { - return Standard_True; - } - } - return Standard_False; + // + aReverseFlag=Standard_True; + if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE) { + aReverseFlag=Standard_False; } - - else if (aType==TopAbs_FACE) { - aExp.Init(n2, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nSuc=aExp.Current(); - if (myIntrPool->IsComputed(n1, nSuc)) { - return Standard_True; - } - } - - aExp.Init(n2, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - nSuc=aExp.Current(); - if (myIntrPool->IsComputed(n1, nSuc)) { - return Standard_True; - } - } - return Standard_False; + if (aType1==TopAbs_VERTEX && + (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) { + aReverseFlag=Standard_False; } - - return Standard_False; + // + aWhat=(aReverseFlag) ? theWith : theWhat; + aWith=(aReverseFlag) ? theWhat : theWith; + // + theWhat=aWhat; + theWith=aWith; } +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_1.cxx b/src/NMTTools/NMTTools_PaveFiller_1.cxx index 086e395f6..d4cca964a 100644 --- a/src/NMTTools/NMTTools_PaveFiller_1.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_1.cxx @@ -21,13 +21,14 @@ // Created: Mon Dec 8 11:47:55 2003 // Author: Peter KURNEV // + #include #include #include #include #include - + #include #include #include @@ -35,12 +36,14 @@ #include #include +#include #include #include -#include -#include +#include +#include #include + #include //======================================================================= @@ -51,47 +54,47 @@ { myIsDone=Standard_False; // - Standard_Integer anIndexIn, aWhat, aWith, aNbVVs, aBlockLength, aNbVSD; - Standard_Integer nVnew; + Standard_Integer aNbVVs, aBL, aNbVSD, nVnew, i, j, n1, n2; TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1; - TColStd_ListIteratorOfListOfInteger aIt; + TColStd_ListIteratorOfListOfInteger aItX, aItY; + TColStd_ListOfInteger aLIX; TopTools_ListOfShape aLV; TopoDS_Vertex aVnew; - TopoDS_Shape aS; // myVSD.Clear(); // - BOPTools_CArray1OfVVInterference& aVVs=myIntrPool->VVInterferences(); - // - // BlockLength correction - aNbVVs=ExpectedPoolLength(); - aBlockLength=aVVs.BlockLength(); - if (aNbVVs > aBlockLength) { - aVVs.SetBlockLength(aNbVVs); - } - // - const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt.SDVertices(); + const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt->SDVertices(); aNbVSD=aMVSD.Extent(); if (!aNbVSD) { return; } // + BOPTools_CArray1OfVVInterference& aVVs=myIP->VVInterferences(); + // + // BlockLength correction + myDSIt->Initialize(TopAbs_VERTEX, TopAbs_VERTEX); + aNbVVs=myDSIt->BlockLength(); + aBL=aVVs.BlockLength(); + if (aNbVVs > aBL) { + aVVs.SetBlockLength(aNbVVs); + } + // aIt1.Initialize(aMVSD); for (; aIt1.More(); aIt1.Next()) { aLV.Clear(); // - aWhat=aIt1.Key(); + n1=aIt1.Key(); const TColStd_ListOfInteger& aLIV=aIt1.Value(); // // new vertex - aIt.Initialize(aLIV); - for (; aIt.More(); aIt.Next()) { - aWith=aIt.Value(); - aS=myDS->Shape(aWith); - aLV.Append(aS); + const TopoDS_Shape& aS1=myDS->Shape(n1); + aLV.Append(aS1); + aItX.Initialize(aLIV); + for (; aItX.More(); aItX.Next()) { + n2=aItX.Value(); + const TopoDS_Shape& aS2=myDS->Shape(n2); + aLV.Append(aS2); } - aS=myDS->Shape(aWhat); - aLV.Append(aS); // NMTTools_Tools::MakeNewVertex(aLV, aVnew); // @@ -101,30 +104,38 @@ nVnew=myDS->NumberOfInsertedShapes(); myDS->SetState (nVnew, BooleanOperations_ON); // + // myVSD, aLIX + aLIX.Clear(); + aLIX.Append(n1); + myVSD.Bind(n1, nVnew); + // + aItX.Initialize(aLIV); + for (; aItX.More(); aItX.Next()) { + n2=aItX.Value(); + aLIX.Append(n2); + myVSD.Bind(n2, nVnew); + } + // // interferences - aIt.Initialize(aLIV); - for (; aIt.More(); aIt.Next()) { - aWith=aIt.Value(); - BOPTools_VVInterference aVV(aWhat, aWith); - aVV.SetNewShape(nVnew); - anIndexIn=aVVs.Append(aVV); - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexVertex, anIndexIn); - // - // to find SD-Vertices - myVSD.Bind(aWith, nVnew); + aItX.Initialize(aLIX); + for (i=0; aItX.More(); aItX.Next(), ++i) { + aItY.Initialize(aLIX); + for (j=0; aItY.More(); aItY.Next(), ++j) { + if (j>i) { + n1=aItX.Value(); + n2=aItY.Value(); + myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV); + // + BOPTools_VVInterference aVV(n1, n2); + aVV.SetNewShape(nVnew); + aVVs.Append(aVV); + } + } } - myVSD.Bind(aWhat, nVnew); }//for (; aIt1.More(); aIt1.Next()) { myIsDone=Standard_True; } //======================================================================= -// function: PerformNewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::PerformNewVertices() -{ -} -//======================================================================= // function: FindSDVertex // purpose: //======================================================================= @@ -138,3 +149,12 @@ } return nVSD; } +/* +//======================================================================= +// function: PerformNewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformNewVertices() +{ +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_2.cxx b/src/NMTTools/NMTTools_PaveFiller_2.cxx index 8febb88c2..4c3c9ed33 100644 --- a/src/NMTTools/NMTTools_PaveFiller_2.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_2.cxx @@ -1,18 +1,18 @@ // Copyright (C) 2005 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 +// 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 +// +// 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 +// 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 @@ -47,20 +47,137 @@ #include #include - +#include #include +#include // // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN #include #include #include -// + static Standard_Boolean Contains(const TopoDS_Edge& aE, const TopoDS_Vertex& aV); // Contribution of Samtech www.samcef.com END + +//======================================================================= +// function: PerformVE +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformVE() +{ + myIsDone=Standard_False; + // + Standard_Boolean bJustAdd; + Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVEs, aBlockLength, iSDV, nV1; + Standard_Real aT; + TopoDS_Vertex aV1; + TopoDS_Edge aE2; + BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; + BOPTools_CoupleOfInteger aCouple; + // + BOPTools_CArray1OfVEInterference& aVEs=myIP->VEInterferences(); + // + myDSIt->Initialize (TopAbs_VERTEX, TopAbs_EDGE); + // + // BlockLength correction + aNbVEs=myDSIt->BlockLength(); + aBlockLength=aVEs.BlockLength(); + if (aNbVEs > aBlockLength) { + aVEs.SetBlockLength(aNbVEs); + } + // + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); + if (!IsSuccessorsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; // Vertex + aWith=n2; // Edge + if (myDS->GetShapeType(n1)==TopAbs_EDGE) { + aWhat=n2; + aWith=n1; + } + // + if(bJustAdd) { + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + continue; + } + // Edge + aE2=TopoDS::Edge(myDS->Shape(aWith)); + if (BRep_Tool::Degenerated(aE2)){ + continue; + } + // Vertex + nV1=aWhat; + aV1=TopoDS::Vertex(myDS->Shape(aWhat)); + // + iSDV=FindSDVertex(aWhat); + if (iSDV) { + nV1=iSDV; + aV1=TopoDS::Vertex(myDS->Shape(nV1)); + // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 + // Contribution of Samtech www.samcef.com BEGIN + Standard_Integer nVE, iSDVE, iRet; + // + BooleanOperations_OnceExplorer aExp(*myDS); + iRet=0; + aExp.Init(aWith, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nVE=aExp.Current(); + iSDVE=FindSDVertex(nVE); + if (iSDVE==iSDV) { + iRet=1; + break; + } + } + if (iRet) { + continue; + } + } + else { + if (Contains(aE2, aV1)) { + continue; + } + // Contribution of Samtech www.samcef.com END + } + // + aFlag=myContext.ComputeVE (aV1, aE2, aT); + // + if (!aFlag) { + // Add Interference to the Pool + BOPTools_VEInterference anInterf (aWhat, aWith, aT); + anIndexIn=aVEs.Append(anInterf); + // + // Add Pave to the Edge's myPavePool + aCouple.SetCouple(nV1, aWith); + if (!aSnareMap.Contains(aCouple)){ + aSnareMap.Add(aCouple); + // + BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); + aPave.SetInterference(anIndexIn); + BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); + aPaveSet.Append(aPave); + } + // + // State for the Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VEInterference& aVE=aVEs(anIndexIn); + aVE.SetNewShape(aWhat); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VE); + } + // qqt + } + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + } + } + myIsDone=Standard_True; +} //======================================================================= // function: PrepareEdges // purpose: @@ -106,116 +223,7 @@ static } } } -//======================================================================= -// function: PerformVE -// purpose: -//======================================================================= - void NMTTools_PaveFiller::PerformVE() -{ - myIsDone=Standard_False; - // - Standard_Boolean bJustAddInterference; - Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVEs, aBlockLength, iSDV, nV1; - Standard_Real aT; - TopoDS_Vertex aV1; - TopoDS_Edge aE2; - BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; - BOPTools_CoupleOfInteger aCouple; - // - BOPTools_CArray1OfVEInterference& aVEs=myIntrPool->VEInterferences(); - // - myDSIt.Initialize (TopAbs_VERTEX, TopAbs_EDGE); - // - // BlockLength correction - aNbVEs=ExpectedPoolLength(); - aBlockLength=aVEs.BlockLength(); - if (aNbVEs > aBlockLength) { - aVEs.SetBlockLength(aNbVEs); - } - // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAddInterference); - // - if (! myIntrPool->IsComputed(n1, n2)) { - if (! IsSuccesstorsComputed(n1, n2)) { - anIndexIn=0; - aWhat=n1; // Vertex - aWith=n2; // Edge - SortTypes(aWhat, aWith); - // - if(bJustAddInterference) { - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); - continue; - } - // Edge - aE2=TopoDS::Edge(myDS->Shape(aWith)); - if (BRep_Tool::Degenerated(aE2)){ - continue; - } - // Vertex - nV1=aWhat; - aV1=TopoDS::Vertex(myDS->Shape(aWhat)); - // - iSDV=FindSDVertex(aWhat); - if (iSDV) { - nV1=iSDV; - aV1=TopoDS::Vertex(myDS->Shape(nV1)); - // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - Standard_Integer nVE, iSDVE, iRet; - // - BooleanOperations_OnceExplorer aExp(*myDS); - iRet=0; - aExp.Init(aWith, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nVE=aExp.Current(); - iSDVE=FindSDVertex(nVE); - if (iSDVE==iSDV) { - iRet=1; - break; - } - } - if (iRet) { - continue; - } - } - else { - if (Contains(aE2, aV1)) { - continue; - } - // Contribution of Samtech www.samcef.com END - } - // - aFlag=myContext.ComputeVE (aV1, aE2, aT); - // - if (!aFlag) { - // Add Interference to the Pool - BOPTools_VEInterference anInterf (aWhat, aWith, aT); - anIndexIn=aVEs.Append(anInterf); - // - // Add Pave to the Edge's myPavePool - aCouple.SetCouple(nV1, aWith); - if (!aSnareMap.Contains(aCouple)){ - aSnareMap.Add(aCouple); - // - BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); - aPave.SetInterference(anIndexIn); - BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); - aPaveSet.Append(aPave); - } - // - // State for the Vertex in DS; - myDS->SetState (aWhat, BooleanOperations_ON); - // Insert Vertex in Interference Object - BOPTools_VEInterference& aVE=aVEs(anIndexIn); - aVE.SetNewShape(aWhat); - } - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); - } - } - } - myIsDone=Standard_True; -} + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= diff --git a/src/NMTTools/NMTTools_PaveFiller_3.cxx b/src/NMTTools/NMTTools_PaveFiller_3.cxx index 7869f87d0..ca458c329 100644 --- a/src/NMTTools/NMTTools_PaveFiller_3.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_3.cxx @@ -1,18 +1,18 @@ // Copyright (C) 2005 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 +// 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 +// +// 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 +// 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 @@ -30,11 +30,15 @@ #include #include +#include + #include #include +#include #include -#include +#include + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN @@ -50,71 +54,76 @@ static { myIsDone=Standard_False; // - Standard_Boolean aJustAddInterference; + Standard_Boolean aJustAdd; Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV; Standard_Real aU, aV; TopoDS_Vertex aV1; TopoDS_Face aF2; // - BOPTools_CArray1OfVSInterference& aVSs=myIntrPool->VSInterferences(); + BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences(); // // V/E Interferences - myDSIt.Initialize(TopAbs_VERTEX, TopAbs_FACE); + myDSIt->Initialize(TopAbs_VERTEX, TopAbs_FACE); // // BlockLength correction - aNbVSs=ExpectedPoolLength(); + aNbVSs=myDSIt->BlockLength(); aBlockLength=aVSs.BlockLength(); if (aNbVSs > aBlockLength) { aVSs.SetBlockLength(aNbVSs); } // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, aJustAddInterference); - // - if (! myIntrPool->IsComputed(n1, n2)) { - if (! IsSuccesstorsComputed(n1, n2)) { - anIndexIn=0; - aWhat=n1; // Vertex - aWith=n2; // Face - SortTypes(aWhat, aWith); - // - iSDV=FindSDVertex(aWhat); - // - if(aJustAddInterference) { - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); - continue; - } - // - aV1=TopoDS::Vertex(myDS->Shape(aWhat)); - if (iSDV) { - aV1=TopoDS::Vertex(myDS->Shape(iSDV)); - } + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, aJustAdd); + if (! IsSuccessorsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; // Vertex + aWith=n2; // Face + if (myDS->GetShapeType(n1)==TopAbs_FACE) { + aWhat=n2; + aWith=n1; + } + // + iSDV=FindSDVertex(aWhat); // - aF2=TopoDS::Face(myDS->Shape(aWith)); + if(aJustAdd) { + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + continue; + } + // + aV1=TopoDS::Vertex(myDS->Shape(aWhat)); + if (iSDV) { + aV1=TopoDS::Vertex(myDS->Shape(iSDV)); + } // - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - if (Contains(aF2, aV1)) { - continue; - } - // Contribution of Samtech www.samcef.com END + aF2=TopoDS::Face(myDS->Shape(aWith)); + // + // Modified Thu Sep 14 14:35:18 2006 + // Contribution of Samtech www.samcef.com BEGIN + if (Contains(aF2, aV1)) { + continue; + } + // Contribution of Samtech www.samcef.com END + // + aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + // + if (!aFlag) { // - aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + // Add Interference to the Pool + BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); + anIndexIn=aVSs.Append(anInterf); // - if (!aFlag) { - // - // Add Interference to the Pool - BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); - anIndexIn=aVSs.Append(anInterf); - // - // SetState for Vertex in DS; - myDS->SetState (aWhat, BooleanOperations_ON); - // Insert Vertex in Interference Object - BOPTools_VSInterference& aVS=aVSs(anIndexIn); - aVS.SetNewShape(aWhat); + // SetState for Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VSInterference& aVS=aVSs(anIndexIn); + aVS.SetNewShape(aWhat); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF); } - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + // qqt } + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); } } myIsDone=Standard_True; diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx index 3a9a1c5c9..dc2bf3e75 100644 --- a/src/NMTTools/NMTTools_PaveFiller_4.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -28,8 +28,14 @@ #include #include +#include +#include +#include + #include #include +#include +#include #include #include @@ -37,11 +43,18 @@ #include #include +#include +#include +#include +#include +#include #include #include +#include -#include +#include +#include #include #include @@ -67,14 +80,17 @@ #include #include -#include -#include - #include #include #include +#include #include +#include +#include +#include +#include +#include #include #include @@ -90,30 +106,7 @@ #include // Contribution of Samtech www.samcef.com END // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // -#include -#include -#include -#include static @@ -165,31 +158,30 @@ static BooleanOperations_IndexedDataMapOfShapeInteger aMapVI; BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB; // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); + // + myDSIt->Initialize(TopAbs_EDGE, TopAbs_EDGE); // // BlockLength correction - aNbVEs=ExpectedPoolLength(); + aNbVEs=myDSIt->BlockLength(); aBlockLength=aEEs.BlockLength(); if (aNbVEs > aBlockLength) { aEEs.SetBlockLength(aNbVEs); } // - myDSIt.Initialize(TopAbs_EDGE, TopAbs_EDGE); - // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAdd); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); anIndexIn = 0; // - if (myIntrPool->IsComputed(n1, n2)) { - continue; - } + //if (myIntrPool->IsComputed(n1, n2)) { + // continue; + //} // nE1=n1; nE2=n2; - SortTypes(nE1, nE2); // if(bJustAdd) { - myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); + //myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); continue; } // @@ -296,7 +288,7 @@ static bIsOnPave2=IsOnPave(aT2, aR2, aTol); // if(bIsOnPave1 || bIsOnPave2) { - myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + //myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); continue; } // @@ -306,7 +298,12 @@ static BOPTools_EEInterference anInterf (aWhat, aWith, aCPart); // anIndexIn=aEEs.Append(anInterf); - myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + //myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); + } + // qqt // // Collect aMapVI.Add(aNewVertex, anIndexIn); @@ -321,7 +318,7 @@ static aCoinsideFlag=IsBlocksCoinside(aPB1, aPB2); // if (aNbComPrt2>1 || !aCoinsideFlag) { - myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + //myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); break; } // @@ -349,6 +346,11 @@ static aMapPB.Add(aPB2); aMapCB.Add(aPB2, aMapPB); } + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); + } + // qqt } break; default: @@ -396,7 +398,7 @@ static TColStd_MapOfInteger aMFence; BOPTools_Pave aPave; // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // aNb=aMapVI.Extent(); if (!aNb) { // no new vertices, no new problems @@ -575,10 +577,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap //... aNbIP=aMIPC.Extent(); if (!aNbIP) { - //modified by NIZNHY-PKV Tue Jan 9 14:26:09 2007f aMIPC.Add(i); - //continue; - //modified by NIZNHY-PKV Tue Jan 9 14:26:12 2007t } // aIt1.Initialize(aMIPC); @@ -698,7 +697,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; BOPTools_Pave aPave; // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // // one new vertex case is treated in usual way // @@ -770,58 +769,43 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, { myIsDone=Standard_False; // - Standard_Boolean Ok1, Ok2, Ok3; - Ok1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; - Ok2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; - Ok3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; - if (!Ok1 && !Ok2 && !Ok3) { - // error: Type mismatch + Standard_Boolean bOk1, bOk2, bOk3, bFlag; + Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits; + TColStd_MapOfInteger aMap; + + bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; + bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; + bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; + if (!bOk1 && !bOk2 && !bOk3) {// error: Type mismatch return; } // - Standard_Boolean aFlag = Standard_False; - Standard_Integer n1, n2, nE1, nE2, aNbSplits; - TColStd_MapOfInteger aMap; - // - myDSIt.Initialize(aType1, aType2); + aNb=bOk2 ? 2 : 1; // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, aFlag); - nE1=n1; - nE2=n2; - SortTypes(nE1, nE2); + myDSIt->Initialize(aType1, aType2); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bFlag); // - if (aType1==TopAbs_EDGE) { - BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1)); - aNbSplits=aLPB1.Extent(); - if (!aNbSplits) { - if (!aMap.Contains(nE1)) { - aMap.Add(nE1); - PreparePaveBlocks(nE1); - // - if (!myIsDone) { - return; - } - } - } + nE[0]=n1; + nE[1]=n2; + if (myDS->GetShapeType(n1)!=TopAbs_EDGE) { + nE[0]=n2; + nE[1]=n1; } // - if (aType2==TopAbs_EDGE) { - BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2)); - aNbSplits=aLPB2.Extent(); + for (i=0; iRefEdge(nE[i])); + aNbSplits=aLPB.Extent(); if (!aNbSplits) { - if (!aMap.Contains(nE2)) { - aMap.Add(nE2); - PreparePaveBlocks(nE2); - // + if (aMap.Add(nE[i])) { + PreparePaveBlocks(nE[i]); if (!myIsDone) { return; } } } - }// if (aType2==TopAbs_EDGE) + } }// for (; myDSIt.More(); myDSIt.Next()) - myIsDone=Standard_True; } //======================================================================= @@ -831,65 +815,60 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE) { myIsDone=Standard_False; - - Standard_Integer nV1, nV2; - + // + char buf[512]; + Standard_Integer nV1, nV2, iErr; TopoDS_Edge aE; TopoDS_Vertex aV1, aV2; - - // SplitShapesPool + // BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); // Edge aE=TopoDS::Edge(myDS->Shape(nE)); + if (BRep_Tool::Degenerated(aE)) { + myIsDone=Standard_True; + return; + } // - if (!BRep_Tool::Degenerated(aE)){ + BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); + + BOPTools_PaveBlockIterator aPBIt(nE, aPS); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + const IntTools_Range& aRange=aPB.Range(); // - BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); - - BOPTools_PaveBlockIterator aPBIt(nE, aPS); - for (; aPBIt.More(); aPBIt.Next()) { - BOPTools_PaveBlock& aPB=aPBIt.Value(); - - const IntTools_Range& aRange=aPB.Range(); - - const BOPTools_Pave& aPave1=aPB.Pave1(); - nV1=aPave1.Index(); - aV1=TopoDS::Vertex(myDS->GetShape(nV1)); - - const BOPTools_Pave& aPave2=aPB.Pave2(); - nV2=aPave2.Index(); - aV2=TopoDS::Vertex(myDS->GetShape(nV2)); - // - // ShrunkRange - IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); - // - Standard_Integer anErrorStatus; - anErrorStatus=aSR.ErrorStatus(); - - char buf[512]; - if (!aSR.IsDone()) { - sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); - BOPTColStd_Dump::PrintMessage(buf); - sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); - throw - BOPTColStd_Failure(buf) ; - } - // - if (anErrorStatus==6) { - sprintf(buf, - "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); - BOPTColStd_Dump::PrintMessage(buf); - } - else { - // Check left paves and correct ShrunkRange if it is necessary - CorrectShrunkRanges (0, aPave1, aSR); - CorrectShrunkRanges (1, aPave2, aSR); - } - // - aPB.SetShrunkRange(aSR); - aLPB.Append(aPB); - } //for (; aPBIt1.More(); aPBIt1.Next()) - } + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + aV1=TopoDS::Vertex(myDS->GetShape(nV1)); + // + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + aV2=TopoDS::Vertex(myDS->GetShape(nV2)); + // + // ShrunkRange + IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); + iErr=aSR.ErrorStatus(); + if (!aSR.IsDone()) { + sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); + BOPTColStd_Dump::PrintMessage(buf); + sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); + throw + BOPTColStd_Failure(buf) ; + } + // + if (iErr==6) { + sprintf(buf, + "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); + BOPTColStd_Dump::PrintMessage(buf); + } + else { + // Check left paves and correct ShrunkRange if it is necessary + CorrectShrunkRanges (0, aPave1, aSR); + CorrectShrunkRanges (1, aPave2, aSR); + } + // + aPB.SetShrunkRange(aSR); + aLPB.Append(aPB); + } //for (; aPBIt.More(); aPBIt.Next()) myIsDone=Standard_True; } //======================================================================= @@ -915,7 +894,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, return; } - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); const BOPTools_EEInterference& aEE=aEEs(anIndexInterf); const IntTools_CommonPrt& aCP=aEE.CommonPrt(); const TopoDS_Edge& aE1=aCP.Edge1(); @@ -945,8 +924,10 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, tNV=tV+aCoeff*(tNV-tV); aNewRange.SetFirst(tNV); aNewRange.SetLast (aSR.Last()); - - if(aNewRange.First() > aNewRange.Last()) { + //modified by NIZNHY-PKV Tue Jan 23 14:07:55 2007f + //if(aNewRange.First() > aNewRange.Last()) { + if(aNewRange.First() < aNewRange.Last()) { + //modified by NIZNHY-PKV Tue Jan 23 14:08:02 2007t aShrunkRange.SetShrunkRange(aNewRange); } } @@ -1370,8 +1351,8 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, TColStd_ListOfInteger aLFI; TColStd_ListIteratorOfListOfInteger aItLFI; // - BOPTools_CArray1OfVSInterference& aVSs=myIntrPool->VSInterferences(); - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences(); + BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // aNbS=myDS->NumberOfShapesOfTheObject(); for (i=1; i<=aNbS; ++i) { @@ -1427,213 +1408,3 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, } } // Contribution of Samtech www.samcef.com END -/* -//======================================================================= -// function:EENewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) -{ - Standard_Integer aNb, i, j, aNewShape, aNbEdges, aNbIEE, aNbVV, aNbSimple; - Standard_Integer aWhat, aWith, i1, i2, nE1, nE2, nE, nV, aFlag; - Standard_Real aT; - TopoDS_Compound aCompound; - BRep_Builder aBB; - NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEE; - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - BOPTools_Pave aPave; - TopoDS_Vertex aNewVertex; - TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; - // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); - // - aNb=aMapVI.Extent(); - // - if (!aNb) { // no new vertices, no new problems - return; - } - // - // 0. - if (aNb==1) { - aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1)); - EENewVertices(aNewVertex, aMapVI); - return; - } - // - // 1. Make compound from new vertices - aBB.MakeCompound(aCompound); - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aV=aMapVI.FindKey(i); - aBB.Add(aCompound, aV); - } - // - // 2. VV intersection between these vertices - // using the auxiliary Filler - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); - // - BOPTools_InterferencePool tInterfPool(tDS); - NMTTools_PaveFiller tPaveFiller(tInterfPool); - // - tPaveFiller.Init(); - // - tPaveFiller.PerformVV(); - tPaveFiller.PerformNewVertices(); - // - const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); - // - // 3. Separate Comlex and Simple new vertices - aNbVV=aVVInterfs.Extent(); - for (i=1; i<=aNbVV; ++i) { - const BOPTools_VVInterference& aVV=aVVInterfs(i); - aVV.Indices(aWhat, aWith); - const TopoDS_Shape& aV1=tDS.Shape(aWhat); - const TopoDS_Shape& aV2=tDS.Shape(aWith); - aMNVComplex.Add(aV1); - aMNVComplex.Add(aV2); - } - // - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aV=aMapVI.FindKey(i); - if (!aMNVComplex.Contains(aV)) { - aMNVSimple.Add(aV); - } - } - // - // 4. Treat Simple new Vertices - aNbSimple=aMNVSimple.Extent(); - for (i=1; i<=aNbSimple; ++i) { - const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i)); - EENewVertices(aV, aMapVI); - } - // - // 3. Fill Maps : NewVertex-edges (aMNVE) - // NewVertex-interferences (aMNVIEE) - for (i=1; i<=aNbVV; ++i) { - const BOPTools_VVInterference& aVV=aVVInterfs(i); - aNewShape=aVV.NewShape(); - if (!aNewShape) { - continue; - } - // - if (!aMNVE.Contains(aNewShape)) { - TColStd_IndexedMapOfInteger aMx; - aMNVE.Add(aNewShape, aMx); - } - if (!aMNVIEE.Contains(aNewShape)) { - TColStd_IndexedMapOfInteger aMx; - aMNVIEE.Add(aNewShape, aMx); - } - // - TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); - TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.ChangeFromKey(aNewShape); - // - aVV.Indices(aWhat, aWith); - //aWhat - const TopoDS_Shape& aV1=tDS.Shape(aWhat); - i1=aMapVI.FindFromKey(aV1); - const BOPTools_EEInterference& aEE1=aEEs(i1); - aEE1.Indices(nE1, nE2); - aME.Add(nE1); - aME.Add(nE2); - aMIEE.Add(i1); - //aWith - const TopoDS_Shape& aV2=tDS.Shape(aWith); - i2=aMapVI.FindFromKey(aV2); - const BOPTools_EEInterference& aEE2=aEEs(i2); - aEE2.Indices(nE1, nE2); - aME.Add(nE1); - aME.Add(nE2); - aMIEE.Add(i2); - // - //printf(" VV: (%d, %d) -> %d\n", aWhat, aWith, aNewShape); - } - // - // 4. Process new vertices - aNb=aMNVE.Extent(); - for (i=1; i<=aNb; ++i) { // xx - // - // new Vertex - nV=aMNVE.FindKey(i); - aNewVertex=TopoDS::Vertex(tDS.Shape(nV)); - // - // Insert New Vertex in DS; - myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); - aNewShape=myDS->NumberOfInsertedShapes(); - myDS->SetState (aNewShape, BooleanOperations_ON); - // - // Update index of NewShape in EE interferences - const TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.FindFromKey(nV);//(i); - aNbIEE=aMIEE.Extent(); - for (j=1; j<=aNbIEE; ++j) { - i1=aMIEE(j); - BOPTools_EEInterference& aEE1=aEEs(i1); - aEE1.SetNewShape(aNewShape); - } - // - // Update Paves on edges - const TColStd_IndexedMapOfInteger& aME=aMNVE(i); - aNbEdges=aME.Extent(); - for (j=1; j<=aNbEdges; ++j) { - nE=aME(j); - const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv - // - aFlag=myContext.ComputeVE (aNewVertex, aE, aT); - // - if (!aFlag) { - aPave.SetInterference(-1); - aPave.SetType (BooleanOperations_EdgeEdge); - aPave.SetIndex(aNewShape); - aPave.SetParam(aT); - // - BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); - aPaveSet.Append(aPave); - } - } - }// for (i=1; i<=aNb; ++i) {// xx -} -//======================================================================= -// function:EENewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, - const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) -{ - Standard_Integer i, aNewShape, nE1, nE2; - Standard_Real aT1, aT2; - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - BOPTools_Pave aPave; - // - BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); - // - // one new vertex case is treated in usual way - // - // Insert New Vertex in DS; - myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); - aNewShape=myDS->NumberOfInsertedShapes(); - myDS->SetState (aNewShape, BooleanOperations_ON); - // Insert New Vertex in EE Interference - i=aMapVI.FindFromKey(aNewVertex); - BOPTools_EEInterference& aEEInterf= aEEs(i); - aEEInterf.SetNewShape(aNewShape); - // Extact interference info - aEEInterf.Indices(nE1, nE2); - const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt(); - VertexParameters(aCPart, aT1, aT2); - // - // Add Paves to the myPavePoolNew - aPave.SetInterference(i); - aPave.SetType (BooleanOperations_EdgeEdge); - aPave.SetIndex(aNewShape); - // Pave for edge nE1 - aPave.SetParam(aT1); - BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1)); - aPaveSet1.Append(aPave); - // Pave for edge nE2 - aPave.SetParam(aT2); - BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); - aPaveSet2.Append(aPave); -} -*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_5.cxx b/src/NMTTools/NMTTools_PaveFiller_5.cxx index 0c6dbab26..01ec5e0bb 100644 --- a/src/NMTTools/NMTTools_PaveFiller_5.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_5.cxx @@ -40,6 +40,8 @@ #include #include +#include + #include #include @@ -63,7 +65,7 @@ #include #include #include -#include + #include #include #include @@ -72,14 +74,15 @@ #include #include +#include +#include #include #include #include #include #include -#include -#include + static void VertexParameter(const IntTools_CommonPrt& aCPart, @@ -105,28 +108,32 @@ static BOPTools_IDMapOfPaveBlockIMapOfInteger aMapCB; BOPTools_IMapOfPaveBlock aIMPBx; // - BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); // - myDSIt.Initialize(TopAbs_EDGE, TopAbs_FACE); + myDSIt->Initialize(TopAbs_EDGE, TopAbs_FACE); // // BlockLength correction - aNbEFs=ExpectedPoolLength(); + aNbEFs=myDSIt->BlockLength(); aBlockLength=aEFs.BlockLength(); if (aNbEFs > aBlockLength) { aEFs.SetBlockLength(aNbEFs); } // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAdd); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); anIndexIn = 0; // - if (myIntrPool->IsComputed(n1, n2)) { - continue; - } + //if (myIntrPool->IsComputed(n1, n2)) { + // continue; + //} // nE=n1; - nF=n2; - SortTypes(nE, nF); + nF=n2; + if (myDS->GetShapeType(n2)==TopAbs_EDGE) { + nE=n2; + nF=n1; + } + //SortTypes(nE, nF); // // all Common Blocks for face nF //XXX @@ -135,7 +142,7 @@ static NMTTools_CommonBlockAPI aCBAPIF(aLCBF); //XXX if(bJustAdd) { - myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + //myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); continue; } // Edge @@ -246,10 +253,15 @@ static // aMapVI.Add(aNewVertex, anIndexIn); aIMPBx.Add(aPB); + // qqf + { + myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); + } + // qqt // }// if (!nVF) }// if (!bIsOnPave1 && !bIsOnPave2) - myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + //myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); }// case TopAbs_VERTEX: break; // @@ -258,7 +270,7 @@ static // aCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext); if (!aCoinsideFlag) { - myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + //myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); break; } // @@ -272,9 +284,12 @@ static aMapF.Add(nF); aMapCB.Add(aPB, aMapF); } - //modified by NIZNHY-PKV Fri Jan 23 14:13:08 2004 f aIMPBx.Add(aPB); - //modified by NIZNHY-PKV Fri Jan 23 14:13:10 2004 t + // qqf + { + myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); + } + // qqt }// case TopAbs_EDGE: break; @@ -370,7 +385,7 @@ static void NMTTools_PaveFiller::EFNewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) { Standard_Integer i, j, aNb, aNewShape, aFlag, iX, aNbVV, aNbSimple; - Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges; + Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges, iTmp; Standard_Real aT; TopoDS_Compound aCompound; TopoDS_Vertex aNewVertex; @@ -380,7 +395,7 @@ static BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; // - BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); // aNb=aMapVI.Extent(); // @@ -404,20 +419,19 @@ static // // 2. VV intersection between these vertices // using the auxiliary Filler - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); - // - BOPTools_InterferencePool tInterfPool(tDS); - NMTTools_PaveFiller tPaveFiller(tInterfPool); + NMTTools_PaveFiller tPF; // - tPaveFiller.Init(); + tPF.SetCompositeShape(aCompound); // - tPaveFiller.PerformVV(); - tPaveFiller.PerformNewVertices(); + tPF.Init(); + tPF.PerformVV(); + //tPF.PerformNewVertices(); qq // - const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); + //const BOPTools_InterferencePool& tInterfPool=*(tPF.InterfPool()); + NMTDS_InterfPool& tInterfPool=*(tPF.IP()); + //const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterferences(); // // 3. Separate Comlex and Simple new vertices aNbVV=aVVInterfs.Extent(); @@ -472,7 +486,12 @@ static iX=aMapVI.FindFromKey(aV1); const BOPTools_ESInterference& aEF1=aEFs(iX); aEF1.Indices(nE, nF); - SortTypes(nE, nF); + //SortTypes(nE, nF); + if (myDS->GetShapeType(nF)==TopAbs_EDGE) { + iTmp=nE; + nE=nF; + nF=iTmp; + } aME.Add(nE); aMIEF.Add(iX); //aWith @@ -480,7 +499,12 @@ static iX=aMapVI.FindFromKey(aV2); const BOPTools_ESInterference& aEF2=aEFs(iX); aEF2.Indices(nE, nF); - SortTypes(nE, nF); + //SortTypes(nE, nF); + if (myDS->GetShapeType(nF)==TopAbs_EDGE) { + iTmp=nE; + nE=nF; + nF=iTmp; + } aME.Add(nE); aMIEF.Add(iX); } @@ -539,7 +563,7 @@ static BOPTools_Pave aPave; BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; // - BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); // // Insert New Vertex in DS; myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); @@ -551,7 +575,10 @@ static aEFInterf.SetNewShape(aNewShape); // Extract interference info aEFInterf.Indices(nE, nF); - SortTypes(nE, nF); + //SortTypes(nE, nF); + if (myDS->GetShapeType(nF)==TopAbs_EDGE) { + nE=nF; + } const IntTools_CommonPrt& aCPart=aEFInterf.CommonPrt(); VertexParameter(aCPart, aT); // diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx index f15df64dc..1d88deac4 100644 --- a/src/NMTTools/NMTTools_PaveFiller_6.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -31,24 +31,36 @@ #include #include +#include +#include +#include +#include +#include -#include #include - +#include +#include #include + #include #include #include #include +#include +#include #include +#include #include #include #include #include +#include +#include +#include #include #include @@ -62,14 +74,15 @@ #include #include #include +#include #include -#include -#include -#include -#include -#include -#include +//#include +//#include +//#include +//#include +//#include + #include #include #include @@ -79,55 +92,18 @@ #include #include +#include #include +#include + +#include #include #include -#include -#include -#include -#include -// -#include -#include -#include -#include -#include -#include -#include -//// #include #include -#include + #include -#include -#include -#include -#include -#include -#include -#include #include -// -#include - -static - Standard_Boolean IsPairFound(const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_InterferencePool* myIntrPool, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith); - -static - void FMapWhat(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWhat); -static - void FMapWith(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWith); -static - Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, - const TColStd_IndexedMapOfInteger& aMapWith); // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN @@ -137,9 +113,11 @@ static TopTools_ListOfShape& aLS); // Contribution of Samtech www.samcef.com END +//modified by NIZNHY-PKV Mon Dec 4 12:56:04 2006f static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, IntTools_Context& aCtx); +//modified by NIZNHY-PKV Mon Dec 4 12:56:08 2006t //======================================================================= // function: PerformFF @@ -149,7 +127,7 @@ static { myIsDone=Standard_False; // - Standard_Boolean bIsFound, bJustAdd, bIsComputed; + Standard_Boolean bJustAdd;//, bIsComputed, bIsFound; Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs; Standard_Boolean bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, bIsDone; Standard_Integer aNbCurves, aNbPoints; @@ -159,25 +137,25 @@ static IntTools_SequenceOfCurves aCvs; BooleanOperations_KindOfInterference aTypeFF=BooleanOperations_SurfaceSurface; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // // F/F Interferences [BooleanOperations_SurfaceSurface] - myDSIt.Initialize(TopAbs_FACE, TopAbs_FACE); + myDSIt->Initialize(TopAbs_FACE, TopAbs_FACE); // // BlockLength correction - aNbFFs=ExpectedPoolLength(); + aNbFFs=myDSIt->BlockLength(); aBlockLength=aFFs.BlockLength(); if (aNbFFs > aBlockLength) { aFFs.SetBlockLength(aNbFFs); } // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAdd); + for (; myDSIt->More(); myDSIt->Next()) { + myDSIt->Current(n1, n2, bJustAdd); // - bIsComputed=myIntrPool->IsComputed(n1, n2); - if (bIsComputed) { - continue; - } + //bIsComputed=myIntrPool->IsComputed(n1, n2); + //if (bIsComputed) { + // continue; + //} // nF1 = n2; nF2 = n1; @@ -189,8 +167,8 @@ static aPnts.Clear(); aCvs.Clear(); // + /* bIsFound=IsPairFound(nF1, nF2, myIntrPool, aMapWhat, aMapWith); - // if (bJustAdd) { if (!bIsFound) { myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); @@ -202,6 +180,7 @@ static } continue; } + */ // const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv @@ -222,7 +201,9 @@ static // bIsDone=aFF.IsDone(); // + if (!bIsDone) { + /* if (!bIsFound) { myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); } @@ -231,6 +212,7 @@ static anIndexIn=aFFs.Append(anInterf); myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); } + */ continue; } // @@ -251,14 +233,14 @@ static if (!aNbCurves && !aNbPoints) { BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); anIndexIn=aFFs.Append(anInterf); - myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + //myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); continue; } // { BOPTools_SSInterference anInterf (nF1, nF2, aTolR3D, aTolR2D, aCvsX, aPntsX); anIndexIn=aFFs.Append(anInterf); - myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + //myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); } // }// for (; myDSIt.More(); myDSIt.Next()) @@ -278,7 +260,7 @@ static Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided; // Contribution of Samtech www.samcef.com END // - Standard_Boolean bIsMicroEdge; + Standard_Boolean bIsMicroEdge, bHasES; Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; Standard_Integer nV1, nV2, j, aNbCurves; Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion(); @@ -286,7 +268,7 @@ static BooleanOperations_IndexedDataMapOfShapeInteger aMapEI; BOPTools_ListIteratorOfListOfPaveBlock anIt; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNbFFs=aFFs.Extent(); // @@ -375,11 +357,9 @@ static // // 1. Produce Section Edges from intersection curves // between each pair of faces - // aNbFFs=aFFs.Extent(); // for (i=1; i<=aNbFFs; ++i) { - BOPTools_SSInterference& aFFi=aFFs(i); // // Faces @@ -456,6 +436,7 @@ static } // // Pave Blocks on Curves + bHasES=Standard_False; for (j=1; j<=aNbCurves; ++j) { BOPTools_Curve& aBC=aSCvs(j); const IntTools_Curve& aIC= aBC.Curve(); @@ -472,13 +453,12 @@ static nV2=aPBNew.Pave2().Index(); aT1=aPBNew.Pave1().Param(); aT2=aPBNew.Pave2().Param(); - // ??? + // if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) { - continue;// mkk ft + continue;// mkk ft ??? } // // 1 - bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D); if (bIsExistingPaveBlock) { continue; @@ -517,17 +497,13 @@ static // BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); // - // use_01 f - // NMTTools_Tools::UpdateEdge (aES, aTolR3D); bIsMicroEdge=IsMicroEdge(aES, myContext); if (bIsMicroEdge) { continue; } // - //use_01 t - // - // SKL/PartC5 f + { Handle(Geom2d_Curve) aC2D1, aC2D2; // @@ -536,14 +512,19 @@ static // NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); - //SKL/PartC5 t } // aMEPB.Add(aES, aPBNew); aMapEI.Add(aES, i); - } - + // + bHasES=Standard_True; + }// for (; aPBIter.More(); aPBIter.Next()) } // end of for (j=1; j<=aNbCurves; ++j) + // qqf + if (bHasES) { + myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF); + } + // qqt }// for (i=1; i<=aNbFFs; ++i) //============================================================= // @@ -572,18 +553,14 @@ static // // // 2. Intersect SE using auxiliary Filler - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); + NMTTools_PaveFiller tPF; // - BOPTools_InterferencePool tIP(tDS); - NMTTools_PaveFiller tPF(tIP); + tPF.SetCompositeShape(aCompound); // // 2.1.VV tPF.Init(); tPF.PerformVV(); - tPF.PerformNewVertices(); + //tPF.PerformNewVertices(); qq // // 2.2.VE tPF.myPavePool.Resize (tPF.myNbEdges); @@ -617,6 +594,7 @@ static BOPTools_ListIteratorOfListOfPaveBlock aIt; BOPTColStd_IndexedDataMapOfIntegerInteger aMNewOld; // + const NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); const BOPTools_SplitShapesPool& aSSP=tPF.mySplitShapesPool; const NMTTools_CommonBlockPool& aCBP=tPF.myCommonBlockPool; // @@ -743,11 +721,9 @@ static aF2FWD=aF2; aF2FWD.Orientation(TopAbs_FORWARD); // - // SKL/PartC5 f NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1); NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2); NMTTools_Tools::UpdateEdge (aEx, aTolEx); - //SKL/PartC5 t } //if (aCBAPI.IsCommonBlock(aPB)) // // new SE @@ -816,13 +792,13 @@ static { Standard_Integer i, aNb, nF1, nF2, nE; Standard_Integer aNbCB, aNbF, nSp, nF; + TopAbs_ShapeEnum aType; TopoDS_Face aF1FWD, aF2FWD; TColStd_ListIteratorOfListOfInteger aItF; BOPTools_ListIteratorOfListOfPaveBlock anIt; NMTTools_ListIteratorOfListOfCommonBlock aItCB; - TopAbs_ShapeEnum aType; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNb=aFFs.Extent(); for (i=1; i<=aNb; i++) { @@ -849,7 +825,7 @@ static BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); } - } + } // //modified by NIZNHY-PKV Fri Mar 23 10:35:02 2007f // Check common blocks between edges and faces @@ -1212,122 +1188,8 @@ static } } ///////////// -//======================================================================= -// function: IsPairFound -// purpose: -//======================================================================= -Standard_Boolean IsPairFound(const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_InterferencePool* myIntrPool, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith) -{ - Standard_Boolean bIsFound; - // - if (!aMapWhat.Contains(nF1)) { - TColStd_IndexedMapOfInteger aMWhat; - FMapWhat(nF1, myIntrPool, aMWhat); - aMapWhat.Add(nF1, aMWhat); - } - // - if (!aMapWith.Contains(nF2)) { - TColStd_IndexedMapOfInteger aMWith; - FMapWith(nF2, myIntrPool, aMWith); - aMapWith.Add(nF2, aMWith); - } - // - const TColStd_IndexedMapOfInteger& aMWht=aMapWhat.FindFromKey(nF1); - const TColStd_IndexedMapOfInteger& aMWit=aMapWith.FindFromKey(nF2); - // - bIsFound=IsFound(aMWht, aMWit); - // - return bIsFound; -} -//======================================================================= -// function: FMapWhat -// purpose: -//======================================================================= -void FMapWhat(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWhat) - -{ - Standard_Integer nE, nV; - - - BooleanOperations_ShapesDataStructure* myDS=myIntrPool->DS(); - BooleanOperations_OnceExplorer aExp(*myDS); - // - // What - aMapWhat.Add(nF); - aExp.Init(nF, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nV=aExp.Current(); - aMapWhat.Add(nV); - } - // - aExp.Init(nF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - nE=aExp.Current(); - aMapWhat.Add(nE); - } -} -//======================================================================= -// function: FMapWith -// purpose: -//======================================================================= -void FMapWith(const Standard_Integer nF, - BOPTools_InterferencePool* myIntrPool, - TColStd_IndexedMapOfInteger& aMapWith) -{ - TColStd_IndexedMapOfInteger aMapWhat; - - FMapWhat(nF, myIntrPool, aMapWhat); - // - // With - Standard_Integer i, aNb, anIndex, aWhat, aWith; - BOPTools_ListIteratorOfListOfInterference anIt; - - const BOPTools_CArray1OfInterferenceLine& anArrIL= myIntrPool->InterferenceTable(); - aNb=aMapWhat.Extent(); - for (i=1; i<=aNb; i++) { - aWhat=aMapWhat(i); - - const BOPTools_InterferenceLine& aWithLine=anArrIL(aWhat); - - const BOPTools_ListOfInterference& aLI=aWithLine.List(); - anIt.Initialize(aLI); - for (; anIt.More(); anIt.Next()) { - const BOPTools_Interference& anIntf=anIt.Value(); - anIndex=anIntf.Index(); - if (anIndex) { - aWith=anIntf.With(); - aMapWith.Add(aWith); - } - } - } -} -//======================================================================= -// function: IsFound -// purpose: -//======================================================================= -Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, - const TColStd_IndexedMapOfInteger& aMapWith) -{ - Standard_Boolean bFlag=Standard_False; - Standard_Integer i, aNb, aWhat; - - aNb=aMapWhat.Extent(); - for (i=1; i<=aNb; i++) { - aWhat=aMapWhat(i); - if (aMapWith.Contains(aWhat)) { - return !bFlag; - } - } - return bFlag; -} // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= @@ -1476,7 +1338,7 @@ void SharedEdges1(const TopoDS_Face& aF1, // // Contribution of Samtech www.samcef.com END -// use_01 f +//modified by NIZNHY-PKV Mon Dec 4 12:30:38 2006f use_01 //======================================================================= //function : IsMicroEdge //purpose : @@ -1515,4 +1377,139 @@ Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, // return bRet; } -// use_01 t +//modified by NIZNHY-PKV Mon Dec 4 12:55:50 2006t +/* +static + Standard_Boolean IsPairFound(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_InterferencePool* myIntrPool, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith); + +static + void FMapWhat(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWhat); +static + void FMapWith(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWith); +static + Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, + const TColStd_IndexedMapOfInteger& aMapWith); + +//======================================================================= +// function: IsPairFound +// purpose: +//======================================================================= +Standard_Boolean IsPairFound(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_InterferencePool* myIntrPool, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith) +{ + Standard_Boolean bIsFound; + // + if (!aMapWhat.Contains(nF1)) { + TColStd_IndexedMapOfInteger aMWhat; + FMapWhat(nF1, myIntrPool, aMWhat); + aMapWhat.Add(nF1, aMWhat); + } + // + if (!aMapWith.Contains(nF2)) { + TColStd_IndexedMapOfInteger aMWith; + FMapWith(nF2, myIntrPool, aMWith); + aMapWith.Add(nF2, aMWith); + } + // + const TColStd_IndexedMapOfInteger& aMWht=aMapWhat.FindFromKey(nF1); + const TColStd_IndexedMapOfInteger& aMWit=aMapWith.FindFromKey(nF2); + // + bIsFound=IsFound(aMWht, aMWit); + // + return bIsFound; +} +//======================================================================= +// function: FMapWhat +// purpose: +//======================================================================= +void FMapWhat(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWhat) + +{ + Standard_Integer nE, nV; + // + BooleanOperations_ShapesDataStructure* myDS=myIntrPool->DS(); + BooleanOperations_OnceExplorer aExp(*myDS); + // + // What + aMapWhat.Add(nF); + aExp.Init(nF, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nV=aExp.Current(); + aMapWhat.Add(nV); + } + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE=aExp.Current(); + aMapWhat.Add(nE); + } +} +//======================================================================= +// function: FMapWith +// purpose: +//======================================================================= +void FMapWith(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWith) +{ + TColStd_IndexedMapOfInteger aMapWhat; + + FMapWhat(nF, myIntrPool, aMapWhat); + // + // With + Standard_Integer i, aNb, anIndex, aWhat, aWith; + BOPTools_ListIteratorOfListOfInterference anIt; + + const BOPTools_CArray1OfInterferenceLine& anArrIL= myIntrPool->InterferenceTable(); + + aNb=aMapWhat.Extent(); + for (i=1; i<=aNb; i++) { + aWhat=aMapWhat(i); + + const BOPTools_InterferenceLine& aWithLine=anArrIL(aWhat); + + const BOPTools_ListOfInterference& aLI=aWithLine.List(); + anIt.Initialize(aLI); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Interference& anIntf=anIt.Value(); + anIndex=anIntf.Index(); + if (anIndex) { + aWith=anIntf.With(); + aMapWith.Add(aWith); + } + } + } +} +//======================================================================= +// function: IsFound +// purpose: +//======================================================================= +Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, + const TColStd_IndexedMapOfInteger& aMapWith) +{ + Standard_Boolean bFlag=Standard_False; + Standard_Integer i, aNb, aWhat; + + aNb=aMapWhat.Extent(); + for (i=1; i<=aNb; i++) { + aWhat=aMapWhat(i); + if (aMapWith.Contains(aWhat)) { + return !bFlag; + } + } + return bFlag; +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_7.cxx b/src/NMTTools/NMTTools_PaveFiller_7.cxx index 30b69f3f0..ef23a7e29 100644 --- a/src/NMTTools/NMTTools_PaveFiller_7.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_7.cxx @@ -25,54 +25,61 @@ #include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + #include #include #include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include #include -#include -#include -#include + #include -#include #include -#include - // #include #include #include -#include -#include -#include -#include -#include + +#include + +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN static @@ -286,7 +293,7 @@ static BOPTools_Pave aPave1, aPave2; BOPTools_PaveBlock aPB; // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNbFFs=aFFs.Extent(); for (i=1; i<=aNbFFs; ++i) { @@ -371,7 +378,7 @@ static // myAloneVertices.Clear(); // - BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // // 1. Collect alone vertices from FFs aNbV=0; @@ -545,6 +552,50 @@ static } } } + // qqf + { + Standard_Integer aNbF, aNbAV, nF, k; + NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF; + // + aNbF=myAloneVertices.Extent(); + if (aNbF<2) { + return; + } + // + // 1. fill map Alone Vertex/Face -> aMAVF + for (i=1; i<=aNbF; ++i) { + nF=myAloneVertices.FindKey(i); + const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i); + aNbAV=aMAV.Extent(); + for(j=1; j<=aNbAV; ++j) { + nV=aMAV(j); + if (aMAVF.Contains(nV)) { + TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV); + aMF.Add(nF); + } + else{ + TColStd_IndexedMapOfInteger aMF; + aMF.Add(nF); + aMAVF.Add(nV, aMF); + } + } + } + // + // 2 Obtain pairs of faces + aNbAV=aMAVF.Extent(); + for (i=1; i<=aNbAV; ++i) { + const TColStd_IndexedMapOfInteger& aMF=aMAVF(i); + aNbF=aMF.Extent(); + for(j=1; jAdd(nF1, nF2, Standard_True, NMTDS_TI_FF); + } + } + } + } + // qqt } //======================================================================= // function: AloneVertices @@ -558,24 +609,22 @@ static // function: FuseVertices // purpose: //======================================================================= -void FuseVertices(const TopoDS_Shape& aCompound, - TopTools_DataMapOfShapeShape& aDMVV) + void NMTTools_PaveFiller::FuseVertices(const TopoDS_Shape& aCompound, + TopTools_DataMapOfShapeShape& aDMVV)const { Standard_Integer i, aNbVV, n1, n2, nX; - NMTDS_ShapesDataStructure tDS; - // - tDS.SetCompositeShape(aCompound); - tDS.Init(); + NMTTools_PaveFiller tPF; // - BOPTools_InterferencePool tInterfPool(tDS); - NMTTools_PaveFiller tPaveFiller(tInterfPool); + tPF.SetCompositeShape(aCompound); // - tPaveFiller.Init(); + tPF.Init(); // - tPaveFiller.PerformVV(); - tPaveFiller.PerformNewVertices(); + tPF.PerformVV(); + //tPF.PerformNewVertices(); //qq // - const BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterfs(); + NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); + NMTDS_InterfPool& tInterfPool=*(tPF.IP()); + BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences(); // aNbVV=aVVt.Extent(); for (i=1; i<=aNbVV; ++i) {