// 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: GEOMAlgo_Builder.cxx // Created: // Author: Peter KURNEV #include #include #include #include #include #include #include #include #include #include #include #include //======================================================================= //function : //purpose : //======================================================================= GEOMAlgo_Builder::GEOMAlgo_Builder() : GEOMAlgo_BuilderShape() { myNbTypes=9; myPaveFiller=NULL; myEntryPoint=0; // Entry point through PerformWithFiller () } //======================================================================= //function : ~ //purpose : //======================================================================= GEOMAlgo_Builder::~GEOMAlgo_Builder() { if (myEntryPoint==1) { if (myPaveFiller) { delete myPaveFiller; myPaveFiller=NULL; } } } //======================================================================= //function : AddCompound //purpose : //======================================================================= void GEOMAlgo_Builder::AddCompound(const TopoDS_Shape& theShape) { TopoDS_Iterator aIt; // aIt.Initialize(theShape); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aS=aIt.Value(); AddShape(aS); } } //======================================================================= //function : AddShape //purpose : //======================================================================= void GEOMAlgo_Builder::AddShape(const TopoDS_Shape& theShape) { if (myMapFence.Add(theShape)) { myShapes.Append(theShape); } } //======================================================================= //function : Shapes //purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Shapes()const { return myShapes; } //======================================================================= //function : Clear //purpose : //======================================================================= void GEOMAlgo_Builder::Clear() { myShapes.Clear(); ClearInternals(); } //======================================================================= //function : ClearInternals //purpose : //======================================================================= void GEOMAlgo_Builder::ClearInternals() { Standard_Integer i; // for (i=0; iSetCompositeShape(aCS); pPF->Perform(); // myEntryPoint=1; PerformInternal(*pPF); } //======================================================================= //function : PerformWithFiller //purpose : //======================================================================= void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_PaveFiller& theDSF) { myEntryPoint=0; // PerformInternal(theDSF); } //======================================================================= //function : PerformInternal //purpose : //======================================================================= void GEOMAlgo_Builder::PerformInternal(const NMTTools_PaveFiller& pPF) { myErrorStatus=0; // Standard_Boolean bIsDone; // // 0. myPaveFiller myPaveFiller=(NMTTools_PaveFiller *)&pPF; // bIsDone=myPaveFiller->IsDone(); if (!bIsDone) { myErrorStatus=2; // PaveFiller is failed return; } // // 1. Clear Internal fields ClearInternals(); // // 2. Prepare Prepare(); if (myErrorStatus) { return; } // // 3. Fill Images // // 3.1 Vertices FillImagesVertices(); if (myErrorStatus) { return; } // BuildResult(TopAbs_VERTEX); if (myErrorStatus) { return; } // 3.2 Edges FillImagesEdges(); if (myErrorStatus) { return; } BuildResult(TopAbs_EDGE); if (myErrorStatus) { return; } // 3.3 Wires FillImagesContainers(TopAbs_WIRE); if (myErrorStatus) { return; } BuildResult(TopAbs_WIRE); if (myErrorStatus) { return; } // 3.4 Faces FillImagesFaces(); if (myErrorStatus) { return; } BuildResult(TopAbs_FACE); if (myErrorStatus) { return; } // 3.5 Shells FillImagesContainers(TopAbs_SHELL); if (myErrorStatus) { return; } BuildResult(TopAbs_SHELL); if (myErrorStatus) { return; } // 3.6 Solids FillImagesSolids(); if (myErrorStatus) { return; } BuildResult(TopAbs_SOLID); if (myErrorStatus) { return; } // 3.7 CompSolids FillImagesContainers(TopAbs_COMPSOLID); if (myErrorStatus) { return; } BuildResult(TopAbs_COMPSOLID); if (myErrorStatus) { return; } // 3.8 Compounds FillImagesContainers(TopAbs_COMPOUND); if (myErrorStatus) { return; } BuildResult(TopAbs_COMPOUND); if (myErrorStatus) { return; } // // 4.History PrepareHistory(); // // 5 Post-treatment PostTreat(); } // // myErrorStatus // // 0 - Ok // 1 - The object is just initialized // 2 - PaveFiller is failed // 10 - No shapes to process // 30 - SolidBuilder failed