From fedf580aaa1cdbe35e069626879b922dc7fbb2ff Mon Sep 17 00:00:00 2001 From: smh Date: Thu, 2 Jun 2005 09:34:45 +0000 Subject: [PATCH] SMH: Add forgotten files --- src/GEOM/GEOM_PythonDump.cxx | 94 +++ src/GEOM/GEOM_PythonDump.hxx | 55 ++ src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl | 96 +++ src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx | 528 +++++++++++++ src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx | 144 ++++ src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx | 26 + src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx | 15 + ...deOfIndexedDataMapOfPassKeyListOfShape.hxx | 147 ++++ ...OfIndexedDataMapOfPassKeyListOfShape_0.cxx | 103 +++ ...lgo_IndexedDataMapOfPassKeyListOfShape.hxx | 141 ++++ ...o_IndexedDataMapOfPassKeyListOfShape_0.cxx | 60 ++ src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl | 48 ++ src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx | 61 ++ src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx | 115 +++ src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx | 26 + src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx | 9 + src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl | 34 + src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx | 350 +++++++++ src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx | 96 +++ src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx | 26 + src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx | 3 + src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl | 39 + src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx | 182 +++++ src/GEOMAlgo/GEOMAlgo_SolidSolid.hxx | 101 +++ src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx | 26 + src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx | 6 + src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl | 32 + src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx | 219 ++++++ src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx | 95 +++ src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx | 26 + src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx | 3 + src/GEOMAlgo/GEOMAlgo_WireSolid.cdl | 31 + src/GEOMAlgo/GEOMAlgo_WireSolid.cxx | 152 ++++ src/GEOMAlgo/GEOMAlgo_WireSolid.hxx | 95 +++ src/GEOMAlgo/GEOMAlgo_WireSolid.ixx | 26 + src/GEOMAlgo/GEOMAlgo_WireSolid.jxx | 3 + ...deOfIndexedDataMapOfPassKeyListOfShape.hxx | 91 +++ src/GEOMFiltersSelection/GEOM_EdgeFilter.h | 20 + src/GEOMFiltersSelection/GEOM_FaceFilter.h | 20 + src/GEOMFiltersSelection/GEOM_LogicalFilter.h | 30 + src/GEOMFiltersSelection/GEOM_OCCFilter.cxx | 46 ++ src/GEOMFiltersSelection/GEOM_OCCFilter.h | 29 + src/GEOMFiltersSelection/GEOM_PreviewFilter.h | 15 + .../GEOM_SelectionFilter.cxx | 164 ++++ .../GEOM_SelectionFilter.h | 41 + src/GEOMFiltersSelection/GEOM_TypeFilter.h | 25 + src/GEOMGUI/GEOMGUI_OCCSelector.cxx | 259 +++++++ src/GEOMGUI/GEOMGUI_OCCSelector.h | 18 + src/GEOMGUI/GEOMGUI_Selection.cxx | 159 ++++ src/GEOMGUI/GEOMGUI_Selection.h | 55 ++ src/GEOMGUI/GEOM_images.po | 728 ++++++++++++++++++ src/GEOM_I/GEOM_DumpPython.cc | 90 +++ 52 files changed, 5003 insertions(+) create mode 100644 src/GEOM/GEOM_PythonDump.cxx create mode 100644 src/GEOM/GEOM_PythonDump.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl create mode 100644 src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx create mode 100644 src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx create mode 100644 src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl create mode 100644 src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl create mode 100644 src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx create mode 100644 src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx create mode 100644 src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl create mode 100644 src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_SolidSolid.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx create mode 100644 src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx create mode 100644 src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl create mode 100644 src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx create mode 100644 src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx create mode 100644 src/GEOMAlgo/GEOMAlgo_WireSolid.cdl create mode 100644 src/GEOMAlgo/GEOMAlgo_WireSolid.cxx create mode 100644 src/GEOMAlgo/GEOMAlgo_WireSolid.hxx create mode 100644 src/GEOMAlgo/GEOMAlgo_WireSolid.ixx create mode 100644 src/GEOMAlgo/GEOMAlgo_WireSolid.jxx create mode 100644 src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx create mode 100644 src/GEOMFiltersSelection/GEOM_EdgeFilter.h create mode 100644 src/GEOMFiltersSelection/GEOM_FaceFilter.h create mode 100644 src/GEOMFiltersSelection/GEOM_LogicalFilter.h create mode 100644 src/GEOMFiltersSelection/GEOM_OCCFilter.cxx create mode 100644 src/GEOMFiltersSelection/GEOM_OCCFilter.h create mode 100644 src/GEOMFiltersSelection/GEOM_PreviewFilter.h create mode 100644 src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx create mode 100644 src/GEOMFiltersSelection/GEOM_SelectionFilter.h create mode 100644 src/GEOMFiltersSelection/GEOM_TypeFilter.h create mode 100644 src/GEOMGUI/GEOMGUI_OCCSelector.cxx create mode 100644 src/GEOMGUI/GEOMGUI_OCCSelector.h create mode 100644 src/GEOMGUI/GEOMGUI_Selection.cxx create mode 100644 src/GEOMGUI/GEOMGUI_Selection.h create mode 100644 src/GEOMGUI/GEOM_images.po create mode 100644 src/GEOM_I/GEOM_DumpPython.cc diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx new file mode 100644 index 000000000..ee18fca2a --- /dev/null +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -0,0 +1,94 @@ +// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#include "GEOM_PythonDump.hxx" + +#include + +namespace GEOM +{ + size_t TPythonDump::myCounter = 0; + + TPythonDump::TPythonDump (Handle(GEOM_Function)& theFunction) + { + myFunction = theFunction; + myCounter++; + } + + TPythonDump::~TPythonDump() + { + if (--myCounter == 0) { + myFunction->SetDescription((char *)myStream.str().c_str()); + } + } + +// TPythonDump::operator TCollection_AsciiString () const +// { +// if (myCounter == 1) { +// return TCollection_AsciiString ((char *)myStream.str().c_str()); +// } +// return TCollection_AsciiString (); +// } + + TPythonDump& TPythonDump::operator<< (long int theArg) + { + myStream<GetEntry(), anEntry); + myStream << anEntry.ToCString(); + return *this; + } +} diff --git a/src/GEOM/GEOM_PythonDump.hxx b/src/GEOM/GEOM_PythonDump.hxx new file mode 100644 index 000000000..867abac78 --- /dev/null +++ b/src/GEOM/GEOM_PythonDump.hxx @@ -0,0 +1,55 @@ +// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifndef _GEOM_PYTHONDUMP_HXX_ +#define _GEOM_PYTHONDUMP_HXX_ + +#include + +#include "GEOM_Object.hxx" +#include "GEOM_Function.hxx" + +#include + +namespace GEOM +{ + class TPythonDump + { + std::ostringstream myStream; + static size_t myCounter; + + Handle(GEOM_Function) myFunction; + + public: + TPythonDump (Handle(GEOM_Function)& theFunction); + virtual ~TPythonDump(); + +// operator TCollection_AsciiString () const; + + TPythonDump& operator<< (long int theArg); + TPythonDump& operator<< (int theArg); + TPythonDump& operator<< (double theArg); + TPythonDump& operator<< (float theArg); + TPythonDump& operator<< (const void* theArg); + TPythonDump& operator<< (const char* theArg); + TPythonDump& operator<< (const Handle(GEOM_Object)& theObject); + }; +} + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl new file mode 100644 index 000000000..4f8cfaaf3 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl @@ -0,0 +1,96 @@ +-- File: GEOMAlgo_FinderShapeOn.cdl +-- Created: Tue Jan 11 14:35:52 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class FinderShapeOn from GEOMAlgo + inherits ShapeAlgo from GEOMAlgo + + ---Purpose: + +uses + Surface from Geom, + ShapeEnum from TopAbs, + ListOfShape from TopTools, + DataMapOfShapeShape from TopTools, + Shape from TopoDS, + State from GEOMAlgo, + IndexedDataMapOfShapeState from GEOMAlgo + +--raises + +is + Create + returns FinderShapeOn from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();" + + Perform(me:out) + is redefined; + + SetSurface(me:out; + aS:Surface from Geom); + + SetShapeType(me:out; + aST:ShapeEnum from TopAbs); + + SetState(me:out; + aSF:State from GEOMAlgo); + + Surface(me) + returns Surface from Geom; + ---C++: return const & + + ShapeType(me) + returns ShapeEnum from TopAbs; + + State(me) + returns State from GEOMAlgo; + + Shapes(me) + returns ListOfShape from TopTools; + ---C++: return const & + + -- + -- protected methods + -- + CheckData(me:out) + is redefined protected; + + MakeArgument1(me:out) + is protected; + + MakeArgument2(me:out) + is protected; + + Find(me:out) + is protected; + + Find(me:out; + aS:Shape from TopoDS) + is protected; + + FindVertices(me:out) + is protected; + + CopySource(myclass; + aS :Shape from TopoDS; + aImages : out DataMapOfShapeShape from TopTools; + aOriginals: out DataMapOfShapeShape from TopTools; + aSC : out Shape from TopoDS); + + + +fields + mySurface : Surface from Geom is protected; + myShapeType : ShapeEnum from TopAbs is protected; + myState : State from GEOMAlgo is protected; + myArg1 : Shape from TopoDS is protected; + myArg2 : Shape from TopoDS is protected; + myLS : ListOfShape from TopTools is protected; + myImages : DataMapOfShapeShape from TopTools is protected; + myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; + myIsAnalytic : Boolean from Standard is protected; + +end FinderShapeOn; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx new file mode 100644 index 000000000..ce9b55f8d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx @@ -0,0 +1,528 @@ +// File: GEOMAlgo_FinderShapeOn.cxx +// Created: Tue Jan 11 14:44:31 2005 +// 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 +#include +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_FinderShapeOn +//purpose : +//======================================================================= +GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn() +: + GEOMAlgo_ShapeAlgo() +{ + myTolerance=0.0001; + myShapeType=TopAbs_VERTEX; + myState=GEOMAlgo_ST_UNKNOWN; + myIsAnalytic=Standard_True; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_FinderShapeOn::~GEOMAlgo_FinderShapeOn() +{ +} +//======================================================================= +//function : SetSurface +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS) +{ + mySurface=aS; +} +//======================================================================= +//function : Surface +//purpose : +//======================================================================= +const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const +{ + return mySurface; +} +//======================================================================= +//function : SetShapeType +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType) +{ + myShapeType=aType; +} +//======================================================================= +//function : ShapeType +//purpose : +//======================================================================= +TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const +{ + return myShapeType; +} +//======================================================================= +//function : SetState +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState) +{ + myState=aState; +} +//======================================================================= +//function : State +//purpose : +//======================================================================= +GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const +{ + return myState; +} +//======================================================================= +// function: Shapes +// purpose: +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const +{ + Standard_Boolean bIsConformState; + Standard_Integer i, aNb; + TopAbs_State aSt; + TopTools_ListOfShape* pL; + // + pL=(TopTools_ListOfShape*) &myLS; + pL->Clear(); + // + aNb=myMSS.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=myMSS.FindKey(i); + aSt=myMSS.FindFromIndex(i); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (bIsConformState) { + pL->Append(aS); + } + } + return myLS; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + myLS.Clear(); + myMSS.Clear(); + // + if (!myResult.IsNull()){ + myResult.Nullify(); + } + // + CheckData(); + if(myErrorStatus) { + return; + } + // + myIsAnalytic=GEOMAlgo_SurfaceTools::IsAnalytic(mySurface); + // + MakeArgument1(); + if(myErrorStatus) { + return; + } + // + if (myIsAnalytic && myShapeType==TopAbs_VERTEX) { + FindVertices(); + return; + } + // + MakeArgument2(); + if(myErrorStatus) { + return; + } + // + Find(); + if(myErrorStatus || myWarningStatus) { + return; + } + // +} +//======================================================================= +//function : FindVertices +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::FindVertices() +{ + Standard_Integer i, aNb, iErr; + TopAbs_State aSt; + TopAbs_Orientation aOr; + gp_Pnt aP; + TopTools_IndexedMapOfShape aM; + // + TopExp::MapShapes(myArg1, TopAbs_FACE, aM); + const TopoDS_Face& aF=TopoDS::Face(aM(1)); + aOr=aF.Orientation(); + // + aM.Clear(); + TopExp::MapShapes(myShape, myShapeType, aM); + aNb=aM.Extent(); + if (!aNb) { + myWarningStatus=10; // No found subshapes of type myShapeType + return; + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + const TopoDS_Vertex& aV=TopoDS::Vertex(aS); + aP=BRep_Tool::Pnt(aV); + iErr=GEOMAlgo_SurfaceTools::GetState(aP, mySurface, myTolerance, aSt); + if (aOr==TopAbs_REVERSED) { + aSt=GEOMAlgo_SurfaceTools::ReverseState(aSt); + } + myMSS.Add(aS, aSt); + } +} +//======================================================================= +//function : Find +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::Find() +{ + Standard_Integer i, aNb; + Standard_Boolean bICS; + TopTools_IndexedMapOfShape aM; + // + TopExp::MapShapes(myArg2, myShapeType, aM); + // + aNb=aM.Extent(); + if (!aNb) { + myWarningStatus=10; // No found subshapes of type myShapeType + return; + } + // + bICS=GEOMAlgo_Tools::IsCompositeShape(myArg2); + if (!bICS || myIsAnalytic) { + TopoDS_Compound aCmp; + BRep_Builder aBB; + // + aBB.MakeCompound(aCmp); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aSi=aM(i); + aBB.Add(aCmp, aSi); + } + // + aM.Clear(); + aM.Add(aCmp); + aNb=1; + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + Find(aS); + if (myErrorStatus) { + return; + } + } +} +//======================================================================= +//function : Find +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bIsDone; + Standard_Integer i, iErr; + TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON}; + TopTools_ListIteratorOfListOfShape aIt; + BOPTools_DSFiller aDF; + // + // 1. Prepare DSFiller + aDF.SetShapes (myArg1, aS); + bIsDone=aDF.IsDone(); + if (!bIsDone) { + myErrorStatus=30; // wrong args are used for DSFiller + return; + } + aDF.Perform(); + bIsDone=aDF.IsDone(); + if (!bIsDone) { + myErrorStatus=31; // DSFiller failed + return; + } + // + // 2. Find shapes + GEOMAlgo_ShapeSolid* pSS; + GEOMAlgo_VertexSolid aVXS; + GEOMAlgo_WireSolid aWRS; + GEOMAlgo_ShellSolid aSHS; + GEOMAlgo_SolidSolid aSLS; + // + pSS=NULL; + // + switch (myShapeType) { + case TopAbs_VERTEX: + pSS=&aVXS; + break; + case TopAbs_EDGE: + pSS=&aWRS; + break; + case TopAbs_FACE: + pSS=&aSHS; + break; + case TopAbs_SOLID: + aSLS.SetShape2(myArg2); + pSS=&aSLS; + break; + default: + myErrorStatus=12; // unallowed subshape type + return; + } + // + pSS->SetFiller(aDF); + pSS->Perform(); + iErr=pSS->ErrorStatus(); + if (iErr) { + myErrorStatus=32; // builder ShapeSolid failed + return; + } + // + for (i=0; i<3; ++i) { + const TopTools_ListOfShape& aLS=pSS->Shapes(aSts[i]); + aIt.Initialize(aLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSImage=aIt.Value(); + if (myImages.IsBound(aSImage)) { + const TopoDS_Shape& aSx=myImages.Find(aSImage); + myMSS.Add(aSx, aSts[i]); + } + else { + myErrorStatus=33;// can not find original shape + return; + } + } + } +} +//======================================================================= +//function : MakeArgument1 +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::MakeArgument1() +{ + myErrorStatus=0; + // + Standard_Integer i, aNb; + TopAbs_ShapeEnum aType; + BRepLib_FaceError aFErr; + BRepLib_MakeFace aMF; + TopTools_IndexedMapOfShape aM; + BRep_Builder aBB; + TopoDS_Face aFace; + TopoDS_Shell aSh; + TopoDS_Solid aSd; + // + // Argument 1 + if (!myIsAnalytic) { + aMF.Init(mySurface, Standard_True); + aFErr=aMF.Error(); + if (aFErr!=BRepLib_FaceDone) { + myErrorStatus=20; // can not build the face + return; + } + // + const TopoDS_Shape& aF=aMF.Shape(); + aFace=TopoDS::Face(aF); + // + // update tolerances + aM.Add(aF); + TopExp::MapShapes(aF, TopAbs_VERTEX, aM); + TopExp::MapShapes(aF, TopAbs_EDGE, aM); + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + aType=aS.ShapeType(); + switch (aType) { + case TopAbs_VERTEX: { + const TopoDS_Vertex& aVx=TopoDS::Vertex(aS); + aBB.UpdateVertex(aVx, myTolerance); + } + break; + case TopAbs_EDGE: { + const TopoDS_Edge& aEx=TopoDS::Edge(aS); + aBB.UpdateEdge(aEx, myTolerance); + } + break; + case TopAbs_FACE: { + const TopoDS_Face& aFx=TopoDS::Face(aS); + aBB.UpdateFace(aFx, myTolerance); + } + break; + default: + break; + } + } + } // + else { + aBB.MakeFace(aFace, mySurface, myTolerance); + } + // + // make solid + aBB.MakeShell(aSh); + aBB.Add(aSh, aFace); + aBB.MakeSolid(aSd); + aBB.Add(aSd, aSh); + myArg1=aSd; +} +//======================================================================= +//function : MakeArgument2 +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::MakeArgument2() +{ + myErrorStatus=0; + // + TopoDS_Shape aSC; + TopTools_DataMapOfShapeShape aOriginals; + // + myImages.Clear(); + // + GEOMAlgo_FinderShapeOn::CopySource(myShape, myImages, aOriginals, aSC); + // + myArg2=aSC; +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::CheckData() +{ + myErrorStatus=0; + // + if(mySurface.IsNull()) { + myErrorStatus=10; // mySurface=NULL + return; + } + // + if (myShape.IsNull()) { + myErrorStatus=11; // myShape=NULL + return; + } + // + if (!(myShapeType==TopAbs_VERTEX || + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { + myErrorStatus=12; // unallowed subshape type + return; + } + // + if (myState==GEOMAlgo_ST_UNKNOWN || + myState==GEOMAlgo_ST_INOUT) { + myErrorStatus=13; // unallowed state type + return; + } +} +// +//======================================================================= +//function : CopySource +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE, + TopTools_DataMapOfShapeShape& aImages, + TopTools_DataMapOfShapeShape& aOriginals, + TopoDS_Shape& aEx) +{ + Standard_Boolean bFree; + TopAbs_ShapeEnum aType; + Standard_Integer aR; + BRep_Builder BB; + TopoDS_Iterator aIt; + // + aType=aE.ShapeType(); + // + if (aOriginals.IsBound(aE)) { + aEx=aOriginals.ChangeFind(aE); + return; + } + else { + aEx=aE.EmptyCopied(); + aOriginals.Bind(aE, aEx); + aImages.Bind(aEx, aE); + } + // + aR=(Standard_Integer)aType+1; + if (aR>TopAbs_VERTEX) { + return; + } + // + bFree=aEx.Free(); + aEx.Free(Standard_True); + // + aType=(TopAbs_ShapeEnum) aR; + // + aIt.Initialize(aE);//, Standard_False); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aV=aIt.Value(); + TopoDS_Shape aVx; + // + CopySource (aV, aImages, aOriginals, aVx); + // + aVx.Orientation(aV.Orientation()); + BB.Add(aEx, aVx); + } + // + aEx.Free(bFree); +} + +// +// myErrorStatus : +// +// 10 -mySurface=NULL +// 11 -myShape=NULL +// 12 -unallowed type of subshapes +// 13 -unallowed state +// 20 -can not build the face +// 30 -wrong args are used for DSFiller +// 31 -DSFiller failed +// 32 -builder ShapeSolid failed +// 33 -can not find original shape +// +// myWarningStatus +// +// 10 -subshapes of type myShapeType can not be fond in myShape + diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx new file mode 100644 index 000000000..42129bc28 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx @@ -0,0 +1,144 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile +#define _GEOMAlgo_FinderShapeOn_HeaderFile + +#ifndef _Handle_Geom_Surface_HeaderFile +#include +#endif +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_State_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopTools_DataMapOfShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile +#include +#endif +class Geom_Surface; +class TopTools_ListOfShape; +class TopoDS_Shape; +class TopTools_DataMapOfShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_FinderShapeOn : public GEOMAlgo_ShapeAlgo { + +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 GEOMAlgo_FinderShapeOn(); +Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn(); +Standard_EXPORT virtual void Perform() ; +Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ; +Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ; +Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ; +Standard_EXPORT const Handle_Geom_Surface& Surface() const; +Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; +Standard_EXPORT GEOMAlgo_State State() const; +Standard_EXPORT const TopTools_ListOfShape& Shapes() const; +Standard_EXPORT static void CopySource(const TopoDS_Shape& aS,TopTools_DataMapOfShapeShape& aImages,TopTools_DataMapOfShapeShape& aOriginals,TopoDS_Shape& aSC) ; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT virtual void CheckData() ; +Standard_EXPORT void MakeArgument1() ; +Standard_EXPORT void MakeArgument2() ; +Standard_EXPORT void Find() ; +Standard_EXPORT void Find(const TopoDS_Shape& aS) ; +Standard_EXPORT void FindVertices() ; + + + // Fields PROTECTED + // +Handle_Geom_Surface mySurface; +TopAbs_ShapeEnum myShapeType; +GEOMAlgo_State myState; +TopoDS_Shape myArg1; +TopoDS_Shape myArg2; +TopTools_ListOfShape myLS; +TopTools_DataMapOfShapeShape myImages; +GEOMAlgo_IndexedDataMapOfShapeState myMSS; +Standard_Boolean myIsAnalytic; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx new file mode 100644 index 000000000..00afa2d33 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx new file mode 100644 index 000000000..d9a848049 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx @@ -0,0 +1,15 @@ +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_DataMapOfShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx new file mode 100644 index 000000000..af09ac4f9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx @@ -0,0 +1,147 @@ +// File generated by CPPExt (Transient) +// +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile +#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile +#include +#endif + +#ifndef _GEOMAlgo_PassKey_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +class GEOMAlgo_PassKey; +class TopTools_ListOfShape; +class GEOMAlgo_PassKeyMapHasher; +class GEOMAlgo_IndexedDataMapOfPassKeyListOfShape; + + +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape : public TCollection_MapNode { + +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 + // +GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape(const GEOMAlgo_PassKey& K1,const Standard_Integer K2,const TopTools_ListOfShape& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); + GEOMAlgo_PassKey& Key1() const; + Standard_Integer& Key2() const; + TCollection_MapNodePtr& Next2() const; + TopTools_ListOfShape& Value() const; +Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_(); + 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 + // +GEOMAlgo_PassKey myKey1; +Standard_Integer myKey2; +TopTools_ListOfShape myValue; +TCollection_MapNodePtr myNext2; + + +}; + +#define TheKey GEOMAlgo_PassKey +#define TheKey_hxx +#define TheItem TopTools_ListOfShape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_IndexedDataMapNode +#undef TCollection_IndexedDataMapNode_hxx +#undef Handle_TCollection_IndexedDataMapNode +#undef TCollection_IndexedDataMapNode_Type_ +#undef TCollection_IndexedDataMap +#undef TCollection_IndexedDataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx new file mode 100644 index 000000000..97be9daa0 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx @@ -0,0 +1,103 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _GEOMAlgo_PassKey_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_HeaderFile +#include +#endif +GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape", + sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape))) { + _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) ; +} +Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape() {} +#define TheKey GEOMAlgo_PassKey +#define TheKey_hxx +#define TheItem TopTools_ListOfShape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx new file mode 100644 index 000000000..e89044f20 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx @@ -0,0 +1,141 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_HeaderFile +#define _GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_OutOfRange; +class Standard_NoSuchObject; +class GEOMAlgo_PassKey; +class TopTools_ListOfShape; +class GEOMAlgo_PassKeyMapHasher; +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_IndexedDataMapOfPassKeyListOfShape : 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 GEOMAlgo_IndexedDataMapOfPassKeyListOfShape(const Standard_Integer NbBuckets = 1); +Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Assign(const GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Other) ; + GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& operator =(const GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~GEOMAlgo_IndexedDataMapOfPassKeyListOfShape() +{ + Clear(); +} + +Standard_EXPORT Standard_Integer Add(const GEOMAlgo_PassKey& K,const TopTools_ListOfShape& I) ; +Standard_EXPORT void Substitute(const Standard_Integer I,const GEOMAlgo_PassKey& K,const TopTools_ListOfShape& T) ; +Standard_EXPORT void RemoveLast() ; +Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_PassKey& K) const; +Standard_EXPORT const GEOMAlgo_PassKey& FindKey(const Standard_Integer I) const; +Standard_EXPORT const TopTools_ListOfShape& FindFromIndex(const Standard_Integer I) const; + const TopTools_ListOfShape& operator ()(const Standard_Integer I) const +{ + return FindFromIndex(I); +} + +Standard_EXPORT TopTools_ListOfShape& ChangeFromIndex(const Standard_Integer I) ; + TopTools_ListOfShape& operator ()(const Standard_Integer I) +{ + return ChangeFromIndex(I); +} + +Standard_EXPORT Standard_Integer FindIndex(const GEOMAlgo_PassKey& K) const; +Standard_EXPORT const TopTools_ListOfShape& FindFromKey(const GEOMAlgo_PassKey& K) const; +Standard_EXPORT TopTools_ListOfShape& ChangeFromKey(const GEOMAlgo_PassKey& K) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyListOfShape(const GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx new file mode 100644 index 000000000..94bdc322b --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx @@ -0,0 +1,60 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKey_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile +#include +#endif + + +#define TheKey GEOMAlgo_PassKey +#define TheKey_hxx +#define TheItem TopTools_ListOfShape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyListOfShape +#define TCollection_IndexedDataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl new file mode 100644 index 000000000..c0dcdd422 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl @@ -0,0 +1,48 @@ +-- File: GEOMAlgo_ShapeSolid.cdl +-- Created: Thu Jan 13 12:44:07 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +deferred class ShapeSolid from GEOMAlgo + inherits Algo from GEOMAlgo + + ---Purpose: + +uses + State from TopAbs, + ListOfShape from TopTools, + PDSFiller from BOPTools, + DSFiller from BOPTools +--raises + +is + Initialize + returns ShapeSolid from GEOMAlgo; + + + SetFiller(me:out; + aDSF:DSFiller from BOPTools); + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();" + + + Shapes(me; + aState:State from TopAbs) + returns ListOfShape from TopTools; + ---C++: return const & + + BuildResult (me:out) + is deferred protected; + + Prepare(me:out) + is deferred protected; + +fields + myLSIN : ListOfShape from TopTools is protected; + myLSOUT : ListOfShape from TopTools is protected; + myLSON : ListOfShape from TopTools is protected; + myRank : Integer from Standard is protected; + myDSFiller : PDSFiller from BOPTools is protected; + +end ShapeSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx new file mode 100644 index 000000000..e0cebcf23 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx @@ -0,0 +1,61 @@ +// File: GEOMAlgo_ShapeSolid.cxx +// Created: Thu Jan 13 12:54:48 2005 +// Author: Peter KURNEV +// + + +#include + +#include +#include + +//======================================================================= +//function : GEOMAlgo_ShapeSolid +//purpose : +//======================================================================= +GEOMAlgo_ShapeSolid::GEOMAlgo_ShapeSolid() +: + GEOMAlgo_Algo(), + myRank(0), + myDSFiller(NULL) +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : SetFiller +//purpose : +//======================================================================= +void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller) +{ + myDSFiller=(BOPTools_DSFiller*) &aDSFiller; +} +//======================================================================= +// function: Shapes +// purpose: +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_ShapeSolid::Shapes(const TopAbs_State aState) const +{ + const TopTools_ListOfShape *pL; + // + switch (aState) { + case TopAbs_IN: + pL=&myLSIN; + break; + case TopAbs_OUT: + pL=&myLSOUT; + break; + case TopAbs_ON: + pL=&myLSON; + break; + default: + pL=&myLSON; + break; + } + return *pL; +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx new file mode 100644 index 000000000..6142c1b72 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx @@ -0,0 +1,115 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_ShapeSolid_HeaderFile +#define _GEOMAlgo_ShapeSolid_HeaderFile + +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _BOPTools_PDSFiller_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Algo_HeaderFile +#include +#endif +#ifndef _TopAbs_State_HeaderFile +#include +#endif +class BOPTools_DSFiller; +class TopTools_ListOfShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo { + +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 void SetFiller(const BOPTools_DSFiller& aDSF) ; +Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid(); +Standard_EXPORT const TopTools_ListOfShape& Shapes(const TopAbs_State aState) const; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT GEOMAlgo_ShapeSolid(); +Standard_EXPORT virtual void BuildResult() = 0; +Standard_EXPORT virtual void Prepare() = 0; + + + // Fields PROTECTED + // +TopTools_ListOfShape myLSIN; +TopTools_ListOfShape myLSOUT; +TopTools_ListOfShape myLSON; +Standard_Integer myRank; +BOPTools_PDSFiller myDSFiller; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx new file mode 100644 index 000000000..1ef447531 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx new file mode 100644 index 000000000..d0cdc370f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx @@ -0,0 +1,9 @@ +#ifndef _BOPTools_DSFiller_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl new file mode 100644 index 000000000..7489b6a96 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl @@ -0,0 +1,34 @@ +-- File: GEOMAlgo_ShellSolid.cdl +-- Created: Wed Jan 12 12:45:20 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class ShellSolid from GEOMAlgo + inherits ShapeSolid from GEOMAlgo + ---Purpose: + +--uses +--raises + +is + Create + returns ShellSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();" + + Perform (me:out) + is redefined; + + Prepare(me:out) + is redefined protected; + + BuildResult (me:out) + is redefined protected; + + DetectSDFaces(me:out) + is protected; + +--fields + +end ShellSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx new file mode 100644 index 000000000..e7da2ac05 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx @@ -0,0 +1,350 @@ +// File: GEOMAlgo_ShellSolid.cxx +// Created: Wed Jan 12 12:49:45 2005 +// 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_ShellSolid +//purpose : +//======================================================================= +GEOMAlgo_ShellSolid::GEOMAlgo_ShellSolid() +: + GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_ShellSolid::~GEOMAlgo_ShellSolid() +{ +} +//======================================================================= +// function: +// purpose: +//======================================================================= +void GEOMAlgo_ShellSolid::Perform() +{ + myErrorStatus=0; + // + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + // + myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2; + BuildResult(); + } + catch (Standard_Failure) { + myErrorStatus=12; + } +} +//======================================================================= +// function: Prepare +// purpose: +//======================================================================= +void GEOMAlgo_ShellSolid::Prepare() +{ + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + // + // 1 States + BOPTools_SolidStateFiller aStateFiller(aPaveFiller); + aStateFiller.Do(); + // + // 2 Project section edges on corresp. faces -> P-Curves on edges. + BOPTools_PCurveMaker aPCurveMaker(aPaveFiller); + aPCurveMaker.Do(); + // + // 3. Degenerated Edges Processing + BOPTools_DEProcessor aDEProcessor(aPaveFiller); + aDEProcessor.Do(); + // + // 4. Detect Same Domain Faces + DetectSDFaces(); +} +//================================================================================= +// function: BuildResult +// purpose: +//================================================================================= +void GEOMAlgo_ShellSolid::BuildResult() +{ + Standard_Boolean bIsTouchCase; + Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSp, iRank1; + Standard_Integer nE, nF, aNbPB, iBeg, iEnd; + BooleanOperations_StateOfShape aState; + TopExp_Explorer anExp; + TopAbs_ShapeEnum aType; + gp_Pnt2d aP2D; + gp_Pnt aP3D; + // + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool(); + BOPTools_InterferencePool* pInterfPool=(BOPTools_InterferencePool*) &anInterfPool; + BOPTools_CArray1OfSSInterference& aFFs=pInterfPool->SSInterferences(); + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool(); + // + // 1. process pf non-interferring faces + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (myRank==2) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType!=TopAbs_FACE) { + continue; + } + // + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i)); + aState=aDS.GetState(i); + if (aState==BooleanOperations_IN) { + myLSIN.Append(aF1); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aF1); + } + } + // + // 2. process pf interferred faces + aNbFFs=aFFs.Extent(); + for (i=1; i<=aNbFFs; ++i) { + BOPTools_SSInterference& aFFi=aFFs(i); + // + nF1=aFFi.Index1(); + nF2=aFFi.Index2(); + iRank1=aDS.Rank(nF1); + nF=(iRank1==myRank) ? nF1 : nF2; + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF)); + // + bIsTouchCase=aFFi.IsTangentFaces(); + // + if (bIsTouchCase) { + myLSON.Append(aF1); + continue; + } + // + // Has section edges ? + aNbS=0; + BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves(); + aNbCurves=aBCurves.Length(); + for (j=1; j<=aNbCurves; j++) { + BOPTools_Curve& aBC=aBCurves(j); + const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks(); + aNbS=aSectEdges.Extent(); + if (aNbS) { + break; + } + } + // + if (aNbS) { // it has + continue; + } + // + anExp.Init(aF1, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current()); + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + nE=aDS.ShapeIndex(aE, myRank); + const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE)); + aNbPB=aLPB.Extent(); + // + if (aNbPB<2) { + nSp=nE; + if (aNbPB) { + const BOPTools_PaveBlock& aPB=aLPB.First(); + nSp=aPB.Edge(); + } + const TopoDS_Shape& aSp=aDS.Shape(nSp); + // + aState=aDS.GetState(nSp); + if (aState==BooleanOperations_IN) { + myLSIN.Append(aF1); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aF1); + } + else if (aState==BooleanOperations_ON) { + Standard_Real aTol; + TopAbs_State aSt; + // + //const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1)); + //aTol=BRep_Tool::Tolerance(aF2); + aTol=1.e-7; + // + BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D); + const TopoDS_Solid& aRefSolid=(myRank==1) ? + TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object()); + // + BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller; + IntTools_Context& aCtx=pPF->ChangeContext(); + // + BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aRefSolid); + aSC.Perform(aP3D, aTol); + aSt=aSC.State(); + if (aSt==TopAbs_IN) { + myLSIN.Append(aF1); + } + else if (aSt==TopAbs_OUT) { + myLSOUT.Append(aF1); + } + } + break; + } // if (aNbPB<2) { + } //for (; anExp.More(); anExp.Next()) + } +} +//======================================================================= +// function: DetectSDFaces +// purpose: +//======================================================================= +void GEOMAlgo_ShellSolid::DetectSDFaces() +{ + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences(); + // + Standard_Boolean bFlag; + Standard_Integer i, aNb, nF1, nF2, iZone, aNbSps, iSenseFlag; + gp_Dir aDNF1, aDNF2; + + aNb=aFFs.Extent(); + for (i=1; i<=aNb; i++) { + bFlag=Standard_False; + + BOPTools_SSInterference& aFF=aFFs(i); + + nF1=aFF.Index1(); + nF2=aFF.Index2(); + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2)); + // + // iSenseFlag; + const BOPTools_ListOfPaveBlock& aLPB=aFF.PaveBlocks(); + aNbSps=aLPB.Extent(); + + if (!aNbSps) { + continue; + } + + const BOPTools_PaveBlock& aPB=aLPB.First(); + const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge())); + + BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1); + BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2); + iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2); + // + if (iSenseFlag==1 || iSenseFlag==-1) { + // + // + TopoDS_Face aF1FWD=aF1; + aF1FWD.Orientation (TopAbs_FORWARD); + + BOP_WireEdgeSet aWES (aF1FWD); + BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller); + aWESFiller.SetSenseFlag(iSenseFlag); + aWESFiller.SetOperation(BOP_COMMON); + aWESFiller.Do(aWES); + + BOP_FaceBuilder aFB; + aFB.Do(aWES); + const TopTools_ListOfShape& aLF=aFB.NewFaces(); + + iZone=0; + TopTools_ListIteratorOfListOfShape anIt(aLF); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aFR=anIt.Value(); + + if (aFR.ShapeType()==TopAbs_FACE) { + const TopoDS_Face& aFaceResult=TopoDS::Face(aFR); + // + Standard_Boolean bIsValidIn2D, bNegativeFlag; + bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag); + if (bIsValidIn2D) { + //if(CheckSameDomainFaceInside(aFaceResult, aF2)) { + iZone=1; + break; + //} + } + // + } + } + + if (iZone) { + bFlag=Standard_True; + aFF.SetStatesMap(aWESFiller.StatesMap()); + } + + }// if (iSenseFlag) + + aFF.SetTangentFacesFlag(bFlag); + aFF.SetSenseFlag (iSenseFlag); + }// end of for (i=1; i<=aNb; i++) +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx new file mode 100644 index 000000000..16415ecc7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx @@ -0,0 +1,96 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_ShellSolid_HeaderFile +#define _GEOMAlgo_ShellSolid_HeaderFile + +#ifndef _GEOMAlgo_ShapeSolid_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid { + +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 GEOMAlgo_ShellSolid(); +Standard_EXPORT virtual ~GEOMAlgo_ShellSolid(); +Standard_EXPORT virtual void Perform() ; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT virtual void Prepare() ; +Standard_EXPORT virtual void BuildResult() ; +Standard_EXPORT void DetectSDFaces() ; + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx new file mode 100644 index 000000000..f5b12e14e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx new file mode 100644 index 000000000..e9afe6d41 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx @@ -0,0 +1,3 @@ +#ifndef _GEOMAlgo_ShellSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl new file mode 100644 index 000000000..3634282e8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl @@ -0,0 +1,39 @@ +-- File: GEOMAlgo_SolidSolid.cdl +-- Created: Wed Jan 26 12:05:14 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class SolidSolid from GEOMAlgo + inherits ShellSolid from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS + +--raises + +is + Create + returns SolidSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_SolidSolid();" + + Perform (me:out) + is redefined; + + BuildResult (me:out) + is redefined protected; + + SetShape2 (me:out; + aS: Shape from TopoDS); + + Shape2 (me) + returns Shape from TopoDS; + ---C++: return const & + +fields + myS2: Shape from TopoDS is protected; + +end SolidSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx new file mode 100644 index 000000000..c4596bdb0 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx @@ -0,0 +1,182 @@ +// File: GEOMAlgo_SolidSolid.cxx +// Created: Wed Jan 26 12:06:26 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +//======================================================================= +//function : GEOMAlgo_SolidSolid +//purpose : +//======================================================================= +GEOMAlgo_SolidSolid::GEOMAlgo_SolidSolid() +: + GEOMAlgo_ShellSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_SolidSolid::~GEOMAlgo_SolidSolid() +{ +} +//======================================================================= +// function: SetShape2 +// purpose: +//======================================================================= +void GEOMAlgo_SolidSolid::SetShape2(const TopoDS_Shape& aS2) +{ + myS2=aS2; +} +//======================================================================= +// function: Shape2 +// purpose: +//======================================================================= +const TopoDS_Shape& GEOMAlgo_SolidSolid::Shape2()const +{ + return myS2; +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= +void GEOMAlgo_SolidSolid::Perform() +{ + myErrorStatus=0; + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + // + myRank=2; + BuildResult(); + } + catch (Standard_Failure) { + myErrorStatus=12; + } +} +//================================================================================= +// function: BuildResult +// purpose: +//================================================================================= +void GEOMAlgo_SolidSolid::BuildResult() +{ + myErrorStatus=0; + // + Standard_Integer i, j, aNbF, aNbS; + Standard_Integer aNbFIN, aNbFOUT, aNbFON, aNbFINTR; + TopAbs_State aState; + TopTools_ListIteratorOfListOfShape aIt; + TopTools_IndexedMapOfShape aMF, aMS; + GEOMAlgo_IndexedDataMapOfShapeState aMFS; + // + // 1. classify the faces + GEOMAlgo_ShellSolid::BuildResult(); + // + // 2. fill Shape-State map + aIt.Initialize(myLSIN); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFS.Add(aF, TopAbs_IN); + } + aIt.Initialize(myLSOUT); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFS.Add(aF, TopAbs_OUT); + } + aIt.Initialize(myLSON); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFS.Add(aF, TopAbs_ON); + } + myLSIN.Clear(); + myLSON.Clear(); + myLSOUT.Clear(); + // + // 3. fill states for solids + TopExp::MapShapes(myS2, TopAbs_SOLID, aMS); + // + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSolid=aMS(i); + // + aMF.Clear(); + TopExp::MapShapes(aSolid, TopAbs_FACE, aMF); + // + aNbFIN=0; + aNbFOUT=0; + aNbFON=0; + aNbFINTR=0; + // + aNbF=aMF.Extent(); + for(j=1; j +#endif +#ifndef _GEOMAlgo_ShellSolid_HeaderFile +#include +#endif +class TopoDS_Shape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_SolidSolid : public GEOMAlgo_ShellSolid { + +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 GEOMAlgo_SolidSolid(); +Standard_EXPORT virtual ~GEOMAlgo_SolidSolid(); +Standard_EXPORT virtual void Perform() ; +Standard_EXPORT void SetShape2(const TopoDS_Shape& aS) ; +Standard_EXPORT const TopoDS_Shape& Shape2() const; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT virtual void BuildResult() ; + + + // Fields PROTECTED + // +TopoDS_Shape myS2; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx new file mode 100644 index 000000000..9db5bd64f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx new file mode 100644 index 000000000..abe70c5ce --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx @@ -0,0 +1,6 @@ +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_SolidSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl new file mode 100644 index 000000000..9a7c6232a --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl @@ -0,0 +1,32 @@ +-- File: GEOMAlgo_VertexSolid.cdl +-- Created: Wed Jan 12 16:34:53 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class VertexSolid from GEOMAlgo + inherits ShapeSolid from GEOMAlgo + + ---Purpose: + +--uses +--raises + +is + Create + returns VertexSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_VertexSolid();" + + Perform (me:out) + is redefined; + + Prepare(me:out) + is redefined protected; + + BuildResult (me:out) + is redefined protected; + +--fields + +end VertexSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx new file mode 100644 index 000000000..1257362ed --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx @@ -0,0 +1,219 @@ +// File: GEOMAlgo_VertexSolid.cxx +// Created: Wed Jan 12 16:36:40 2005 +// 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 + +//======================================================================= +//function : GEOMAlgo_VertexSolid +//purpose : +//======================================================================= +GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid() +: + GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid() +{ +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= +void GEOMAlgo_VertexSolid::Perform() +{ + myErrorStatus=0; + // + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + Standard_Integer aNbF; + TopTools_IndexedMapOfShape aM; + // + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + const TopoDS_Shape& aObj=aDS.Object(); + // + TopExp::MapShapes(aObj, TopAbs_FACE, aM); + aNbF=aM.Extent(); + myRank=(aNbF) ? 2 : 1; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + BuildResult(); + } + // + catch (Standard_Failure) { + myErrorStatus = 12; + } +} +//======================================================================= +// function: Prepare +// purpose: +//======================================================================= +void GEOMAlgo_VertexSolid::Prepare() +{ + Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound; + Standard_Real aTol; + TopAbs_State aSt; + TopAbs_ShapeEnum aType; + BooleanOperations_StateOfShape aState; + gp_Pnt aP3D; + // + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + BooleanOperations_ShapesDataStructure* pDS=(BooleanOperations_ShapesDataStructure*)&aDS; + const BOPTools_InterferencePool& aIP=myDSFiller->InterfPool(); + BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP; + BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences(); + const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller(); + BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF; + IntTools_Context& aCtx=pPF->ChangeContext(); + // + const TopoDS_Shape& aObj=aDS.Object(); + const TopoDS_Shape& aTool=aDS.Tool(); + // + const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj); + const TopoDS_Shape& aSV =(myRank==1)? aObj : aTool; + // + BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aSolid); + // + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (myRank==2) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType!=TopAbs_VERTEX) { + continue; + } + // + const TopoDS_Vertex& aV=TopoDS::Vertex(aDS.Shape(i)); + // + aState=aDS.GetState(i); + if (aState==BooleanOperations_ON || + aState==BooleanOperations_IN || + aState==BooleanOperations_OUT) { + continue; + } + // + iFound=0; + aNbVV=aVVs.Extent(); + for (j=1; j<=aNbVV; ++j) { + BOPTools_VVInterference& aVV=aVVs(j); + aVV.Indices(n1, n2); + if (n1==i || n2==i) { + pDS->SetState (n1, BooleanOperations_ON); + pDS->SetState (n2, BooleanOperations_ON); + iFound=1; + break; + } + } + if (iFound) { + continue; + } + // + aP3D=BRep_Tool::Pnt(aV); + aTol=1.E-7; + aSC.Perform(aP3D, aTol); + aSt=aSC.State(); + if (aSt==TopAbs_IN) { + pDS->SetState (i, BooleanOperations_IN); + } + else if (aSt==TopAbs_OUT) { + pDS->SetState (i, BooleanOperations_OUT); + } + } +} +//======================================================================= +// function: BuildResult +// purpose: +//======================================================================= +void GEOMAlgo_VertexSolid::BuildResult() +{ + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + // + Standard_Integer i, iBeg, iEnd; + TopAbs_ShapeEnum aType; + BooleanOperations_StateOfShape aState; + // + myLSIN.Clear(); + myLSOUT.Clear(); + myLSON.Clear(); + // + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (myRank==2) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType!=TopAbs_VERTEX) { + continue; + } + const TopoDS_Shape& aV=aDS.Shape(i); + aState=aDS.GetState(i); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aV); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aV); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aV); + } + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx new file mode 100644 index 000000000..103c7f2f6 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx @@ -0,0 +1,95 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_VertexSolid_HeaderFile +#define _GEOMAlgo_VertexSolid_HeaderFile + +#ifndef _GEOMAlgo_ShapeSolid_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_VertexSolid : public GEOMAlgo_ShapeSolid { + +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 GEOMAlgo_VertexSolid(); +Standard_EXPORT virtual ~GEOMAlgo_VertexSolid(); +Standard_EXPORT virtual void Perform() ; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT virtual void Prepare() ; +Standard_EXPORT virtual void BuildResult() ; + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx new file mode 100644 index 000000000..e2351fef2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx new file mode 100644 index 000000000..8c7c253e9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx @@ -0,0 +1,3 @@ +#ifndef _GEOMAlgo_VertexSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl b/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl new file mode 100644 index 000000000..d85db1291 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl @@ -0,0 +1,31 @@ +-- File: GEOMAlgo_WireSolid.cdl +-- Created: Wed Jan 12 10:17:00 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class WireSolid from GEOMAlgo + inherits ShapeSolid from GEOMAlgo + ---Purpose: + +--uses +--raises + +is + Create + returns WireSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_WireSolid();" + + Perform (me:out) + is redefined; + + Prepare(me:out) + is redefined protected; + + BuildResult (me:out) + is redefined protected; + +--fields + +end WireSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx new file mode 100644 index 000000000..faaf3612f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx @@ -0,0 +1,152 @@ +// File: GEOMAlgo_WireSolid.cxx +// Created: Wed Jan 12 10:19:31 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_WireSolid +//purpose : +//======================================================================= +GEOMAlgo_WireSolid::GEOMAlgo_WireSolid() +: + GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid() +{ +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= +void GEOMAlgo_WireSolid::Perform() +{ + myErrorStatus=0; + // + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + BuildResult(); + } + // + catch (Standard_Failure) { + myErrorStatus= 12; + } +} +//======================================================================= +// function: Prepare +// purpose: +//======================================================================= +void GEOMAlgo_WireSolid::Prepare() +{ + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + // + BOPTools_WireStateFiller aStateFiller(aPaveFiller); + aStateFiller.Do(); + // +} +//======================================================================= +// function: BuildResult +// purpose: +//======================================================================= +void GEOMAlgo_WireSolid::BuildResult() +{ + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool(); + // + Standard_Integer i, aNbPB, nSp, iBeg, iEnd; + TopAbs_ShapeEnum aType; + BooleanOperations_StateOfShape aState; + // + myLSIN.Clear(); + myLSOUT.Clear(); + myLSON.Clear(); + // + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (aDS.Tool().ShapeType()==TopAbs_WIRE) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType==TopAbs_EDGE) { + const TopoDS_Shape& aE=aDS.Shape(i); + const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i)); + aNbPB=aLPB.Extent(); + // + if (!aNbPB) { + aState=aDS.GetState(i); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aE); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aE); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aE); + } + } + // + else if (aNbPB==1) { + const BOPTools_PaveBlock& aPB=aLPB.First(); + nSp=aPB.Edge(); + const TopoDS_Shape& aSp=aDS.Shape(nSp); + aState=aDS.GetState(nSp); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aE); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aE); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aE); + } + } + } + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx new file mode 100644 index 000000000..7212908dc --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx @@ -0,0 +1,95 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_WireSolid_HeaderFile +#define _GEOMAlgo_WireSolid_HeaderFile + +#ifndef _GEOMAlgo_ShapeSolid_HeaderFile +#include +#endif + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_WireSolid : public GEOMAlgo_ShapeSolid { + +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 GEOMAlgo_WireSolid(); +Standard_EXPORT virtual ~GEOMAlgo_WireSolid(); +Standard_EXPORT virtual void Perform() ; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT virtual void Prepare() ; +Standard_EXPORT virtual void BuildResult() ; + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.ixx b/src/GEOMAlgo/GEOMAlgo_WireSolid.ixx new file mode 100644 index 000000000..37b35b408 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx new file mode 100644 index 000000000..a37f27e72 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx @@ -0,0 +1,3 @@ +#ifndef _GEOMAlgo_WireSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx new file mode 100644 index 000000000..e246513bc --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx @@ -0,0 +1,91 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile +#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_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 GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape); + +class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) : public Handle(TCollection_MapNode) { + 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); + } + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)():Handle(TCollection_MapNode)() {} + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* operator->() + { + return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape *)ControlAccess(); + } + + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* operator->() const + { + return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)(); + + Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMFiltersSelection/GEOM_EdgeFilter.h b/src/GEOMFiltersSelection/GEOM_EdgeFilter.h new file mode 100644 index 000000000..86e29864a --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_EdgeFilter.h @@ -0,0 +1,20 @@ +#ifndef GEOM_EDGEFILTER_H +#define GEOM_EDGEFILTER_H + +#include "GEOM_SelectionFilter.h" + +class GEOM_EdgeFilter : public GEOM_SelectionFilter +{ +public: + GEOM_EdgeFilter( SalomeApp_Study* study, const int kind ); + ~GEOM_EdgeFilter(); + +protected: + bool isShapeOk( const TopoDS_Shape& ) const; + +private: + int myKind; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_FaceFilter.h b/src/GEOMFiltersSelection/GEOM_FaceFilter.h new file mode 100644 index 000000000..febd2ae93 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_FaceFilter.h @@ -0,0 +1,20 @@ +#ifndef GEOM_FACEFILTER_H +#define GEOM_FACEFILTER_H + +#include "GEOM_SelectionFilter.h" + +class GEOM_FaceFilter : public GEOM_SelectionFilter +{ +public: + GEOM_FaceFilter( SalomeApp_Study* study, const int kind ); + ~GEOM_FaceFilter(); + +protected: + bool isShapeOk( const TopoDS_Shape& ) const; + +private: + int myKind; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_LogicalFilter.h b/src/GEOMFiltersSelection/GEOM_LogicalFilter.h new file mode 100644 index 000000000..55e64ef61 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_LogicalFilter.h @@ -0,0 +1,30 @@ +#ifndef GEOM_LOGICALFILTER_H +#define GEOM_LOGICALFILTER_H + +#include + +#include + +class GEOM_LogicalFilter : public SUIT_SelectionFilter +{ +public: + enum { LO_OR, LO_AND, LO_NOT, LO_UNDEFINED }; + +public: + GEOM_LogicalFilter( const QPtrList& lst, const int op ); + ~GEOM_LogicalFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; + + void setFilters( const QPtrList& lst ); + void setOperation( const int ); + QPtrList getFilters() const; + int getOperation() const; + +private: + QPtrList myFilters; + int myOperation; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx b/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx new file mode 100644 index 000000000..6f22d93c1 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx @@ -0,0 +1,46 @@ +#include "GEOM_OCCFilter.h" + +#include +#include + +#include + +#include +#include + +IMPLEMENT_STANDARD_HANDLE(GEOM_OCCFilter, SelectMgr_Filter) +IMPLEMENT_STANDARD_RTTIEXT(GEOM_OCCFilter, SelectMgr_Filter) + +//======================================================================= +// function : GEOM_OCCFilter +// purpose : +//======================================================================= +GEOM_OCCFilter::GEOM_OCCFilter( SalomeApp_SelectionMgr* theSelMgr ) + : SelectMgr_Filter() +{ + mySelMgr = theSelMgr; +} + +//======================================================================= +// function : ~GEOM_OCCFilter +// purpose : +//======================================================================= +GEOM_OCCFilter::~GEOM_OCCFilter() +{ +} + +//======================================================================= +// function : IsOk +// purpose : +//======================================================================= +Standard_Boolean GEOM_OCCFilter::IsOk( const Handle(SelectMgr_EntityOwner)& anObj ) const +{ + Handle(AIS_InteractiveObject) anAIS = Handle(AIS_InteractiveObject)::DownCast( anObj->Selectable() ); + if ( anAIS.IsNull() || !anAIS->HasOwner() ) + return false; + + Handle(SALOME_InteractiveObject) anIO = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner()); + if ( anIO.IsNull() ) return false; + + return mySelMgr->isOk( new SalomeApp_DataOwner( QString( anIO->getEntry() ) ) ); +} diff --git a/src/GEOMFiltersSelection/GEOM_OCCFilter.h b/src/GEOMFiltersSelection/GEOM_OCCFilter.h new file mode 100644 index 000000000..70665bd5b --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_OCCFilter.h @@ -0,0 +1,29 @@ +#ifndef GEOM_OCCFILTER_H +#define GEOM_OCCFILTER_H + +#include + +#include + +class SalomeApp_SelectionMgr; + +class GEOM_OCCFilter : public SelectMgr_Filter +{ +public: + GEOM_OCCFilter( SalomeApp_SelectionMgr* theSelMgr); + ~GEOM_OCCFilter(); + + virtual Standard_Boolean IsOk( const Handle(SelectMgr_EntityOwner)& anObj ) const; + +private: + SalomeApp_SelectionMgr* mySelMgr; + +public: + + DEFINE_STANDARD_RTTI(GEOM_OCCFilter); + +}; + +DEFINE_STANDARD_HANDLE(GEOM_OCCFilter, SelectMgr_Filter) + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_PreviewFilter.h b/src/GEOMFiltersSelection/GEOM_PreviewFilter.h new file mode 100644 index 000000000..b10b7481c --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_PreviewFilter.h @@ -0,0 +1,15 @@ +#ifndef GEOM_PREVIEW_FILTER_H +#define GEOM_PREVIEW_FILTER_H + +#include + +class GEOM_PreviewFilter : public SalomeApp_Filter +{ +public: + GEOM_PreviewFilter( SalomeApp_Study* study ); + ~GEOM_PreviewFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx new file mode 100644 index 000000000..0b3b69c12 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx @@ -0,0 +1,164 @@ +#include "GEOM_SelectionFilter.h" + +#include "GEOM_Client.hxx" + +#include +#include +#include + +#include + +#include + +#include + + + +//======================================================================= +// function : GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_SelectionFilter::GEOM_SelectionFilter( SalomeApp_Study* study, const bool theAll ) + : SalomeApp_Filter(study) +{ + myAll = theAll; +} + +//======================================================================= +// function : ~GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_SelectionFilter::~GEOM_SelectionFilter() +{ +} + +//======================================================================= +// function : isOk +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const +{ + GEOM::GEOM_Object_var obj = getObject( sOwner ); + if ( !CORBA::is_nil( obj ) && obj->IsShape() ) + { + if ( isAll() ) + return true; + + TopoDS_Shape shape; + if ( getShape( obj, shape ) ) + return contains( shape.ShapeType() ) && isShapeOk( shape ); + } + return false; +} + +//======================================================================= +// function : getObject +// purpose : +//======================================================================= +GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject( const SUIT_DataOwner* sOwner ) const +{ + GEOM::GEOM_Object_var anObj; + + const SalomeApp_DataOwner* owner = dynamic_cast ( sOwner ); + SalomeApp_Study* appStudy = getStudy(); + if ( owner && appStudy ) + { + _PTR(Study) study = appStudy->studyDS(); + QString entry = owner->entry(); + + _PTR(SObject) aSO( study->FindObjectID( entry.latin1() ) ); + if ( aSO ) + anObj = GEOM::GEOM_Object::_narrow(dynamic_cast(aSO.get())->GetObject()); + } + + if ( !CORBA::is_nil( anObj ) ) + return anObj._retn(); + + return GEOM::GEOM_Object::_nil(); +} + +//======================================================================= +// function : getShape +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::getShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theShape ) const +{ + if ( !CORBA::is_nil( theObject ) ) + { + SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( app ) + { + SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() ); + Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); + GEOM::GEOM_Gen_var geomGen = GEOM::GEOM_Gen::_narrow( comp ); + if ( !CORBA::is_nil( geomGen ) ) + { + TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); + + if ( !aTopoDSShape.IsNull() ) + { + theShape = aTopoDSShape; + return true; + } + } + } + } + return false; +} + +//======================================================================= +// function : contains +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::contains( const int type ) const +{ + return myTypes.contains( type ); +} + +//======================================================================= +// function : add +// purpose : +//======================================================================= +void GEOM_SelectionFilter::add( const int type ) +{ + if ( !contains( type ) ) + myTypes.append( type ); +} + +//======================================================================= +// function : remove +// purpose : +//======================================================================= +void GEOM_SelectionFilter::remove( const int type ) +{ + if ( contains( type ) ) + myTypes.remove( type ); +} + +//======================================================================= +// function : setAll +// purpose : +//======================================================================= +void GEOM_SelectionFilter::setAll( const bool all ) +{ + myAll = all; +} + +//======================================================================= +// function : isAll +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::isAll() const +{ + return myAll; +} + +//======================================================================= +// function : isShapeOk +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::isShapeOk( const TopoDS_Shape& ) const +{ + return true; +} + diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.h b/src/GEOMFiltersSelection/GEOM_SelectionFilter.h new file mode 100644 index 000000000..b05f053d5 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.h @@ -0,0 +1,41 @@ +#ifndef GEOM_SELECTIONFILTER_H +#define GEOM_SELECTIONFILTER_H + +#include + +#include + +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +class GEOM_SelectionFilter : public SalomeApp_Filter +{ +public: + GEOM_SelectionFilter( SalomeApp_Study* study, const bool theAll = false ); + ~GEOM_SelectionFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; + +protected: + GEOM::GEOM_Object_ptr getObject( const SUIT_DataOwner* ) const; + bool getShape( const GEOM::GEOM_Object_ptr&, TopoDS_Shape& ) const; + + bool contains( const int ) const; + void add( const int ); + void remove( const int ); + + void setAll( const bool ); + bool isAll() const; + + bool isShapeOk( const TopoDS_Shape& ) const; + +private: + QValueList myTypes; + bool myAll; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_TypeFilter.h b/src/GEOMFiltersSelection/GEOM_TypeFilter.h new file mode 100644 index 000000000..393b16a9a --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_TypeFilter.h @@ -0,0 +1,25 @@ +#ifndef GEOM_TYPEFILTER_H +#define GEOM_TYPEFILTER_H + +#include "GEOM_SelectionFilter.h" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +class GEOM_TypeFilter : public GEOM_SelectionFilter +{ +public: + GEOM_TypeFilter(SalomeApp_Study* study, const int type ); + ~GEOM_TypeFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; + + int type() const; + +private: + int myType; + +}; + +#endif diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx new file mode 100644 index 000000000..c2afc40b9 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -0,0 +1,259 @@ +#include "GEOMGUI_OCCSelector.h" + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================ +// Function : GEOMGUI_OCCSelector +// Purpose : +//================================================================ +GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr ) +: SalomeApp_OCCSelector( viewer, mgr ) +{ +} + +//================================================================ +// Function : ~GEOMGUI_OCCSelector +// Purpose : +//================================================================ +GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector() +{ +} + +//================================================================ +// Function : getSelection +// Purpose : +//================================================================ +void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const +{ + OCCViewer_Viewer* vw = viewer(); + if ( !vw ) + return; + + Handle(AIS_InteractiveContext) ic = vw->getAISContext(); + + if ( ic->HasOpenedContext() ) + { + for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() ) + { + Handle(SelectMgr_EntityOwner) anOwner = ic->SelectedOwner(); + if ( anOwner.IsNull() ) + continue; + + Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast( anOwner->Selectable() ); + + QString entryStr = entry( io ); + int index = -1; + + if ( anOwner->ComesFromDecomposition() ) // == Local Selection + { + TopoDS_Shape subShape = anOwner->Shape(); + Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast( io ); + if ( !aisShape.IsNull() ) + { + TopoDS_Shape bigShape = aisShape->Shape(); + + TopTools_IndexedMapOfShape subShapes; + TopExp::MapShapes( bigShape, subShapes ); + index = subShapes.FindIndex( subShape ); + } + } + + if ( !entryStr.isEmpty() ) + { + SalomeApp_DataOwner* owner; + if ( index > -1 ) // Local Selection + owner = new SalomeApp_DataSubOwner( entryStr, index ); + else // Global Selection + owner = new SalomeApp_DataOwner( entryStr ); + + aList.append( SUIT_DataOwnerPtr( owner ) ); + } + } + } + else + { + for ( ic->InitCurrent(); ic->MoreCurrent(); ic->NextCurrent() ) + { + Handle(AIS_InteractiveObject) io = ic->Current(); + + QString entryStr = entry( io ); + + if ( !entryStr.isEmpty() ) + { + SalomeApp_DataOwner* owner = new SalomeApp_DataOwner( entryStr ); + aList.append( SUIT_DataOwnerPtr( owner ) ); + } + } + } +} + +//================================================================ +// Function : getEntityOwners +// Purpose : +//================================================================ +static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, + const Handle(AIS_InteractiveContext)& theIC, + SelectMgr_IndexedMapOfOwner& theMap ) +{ + if ( theObj.IsNull() || theIC.IsNull() ) + return; + + TColStd_ListOfInteger modes; + theIC->ActivatedModes( theObj, modes ); + + TColStd_ListIteratorOfListOfInteger itr( modes ); + for (; itr.More(); itr.Next() ) { + int m = itr.Value(); + if ( !theObj->HasSelection( m ) ) + continue; + + Handle(SelectMgr_Selection) sel = theObj->Selection( m ); + + for ( sel->Init(); sel->More(); sel->Next() ) { + Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive(); + if ( entity.IsNull() ) + continue; + + Handle(SelectMgr_EntityOwner) owner = + Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); + if ( !owner.IsNull() ) + theMap.Add( owner ); + } + } +} + +//================================================================ +// Function : setSelection +// Purpose : +//================================================================ +void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) +{ + OCCViewer_Viewer* vw = viewer(); + if ( !vw ) + return; + + Handle(AIS_InteractiveContext) ic = vw->getAISContext(); + + NCollection_DataMap indexesMap; // "entry - list_of_int" map for LOCAL selection + QMap globalSelMap; // only Key=entry from this map is used. value(int) is NOT used at all. + SelectMgr_IndexedMapOfOwner ownersmap; // map of owners to be selected + + AIS_ListOfInteractive aDispList; + ic->DisplayedObjects( aDispList ); + + // build a map of data owner indexes to be selected. + // "entry - to - list_of_ids" map + for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) + { + const SalomeApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); + if ( subOwner ) + { + QString entry = subOwner->entry(); + if ( indexesMap.IsBound( TCollection_AsciiString((char*)entry.latin1()))) + { + TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind((char*)entry.latin1()); + subIndexes.Add( subOwner->index() ); + //indexesMap.replace( entry, subIndexes ); + } + else + { + TColStd_IndexedMapOfInteger subIndexes; + subIndexes.Add( subOwner->index() ); + indexesMap.Bind((char*)entry.latin1(), subIndexes); + } + } + else // the owner is NOT a sub owner, maybe it is a DataOwner == GLOBAL selection + { + const SalomeApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); + if ( owner ) + { + globalSelMap[owner->entry()] = 1; + } + } + } + + // get all owners. Fill "entry - list_of_owners" map. + for ( AIS_ListIteratorOfListOfInteractive it( aDispList ); it.More(); it.Next() ) + { + Handle(AIS_InteractiveObject) io = it.Value(); + QString entryStr = entry( io ); + if ( !entryStr.isEmpty() ) + { + //EntryToListOfOwnerMap entryOwnersMap; // "entry - list_of_owners" map. temporary use. + SelectMgr_IndexedMapOfOwner owners; + getEntityOwners( io, ic, owners ); // get all owners + + for ( int i = 1, n = owners.Extent(); i <= n; i++ ) + { + Handle(SelectMgr_EntityOwner) anOwner = owners( i ); + if ( anOwner.IsNull() || !anOwner->HasShape() ) + continue; + + // GLOBAL selection + if ( !anOwner->ComesFromDecomposition() && globalSelMap.contains( entryStr ) ) + { + ownersmap.Add( anOwner ); + } + // LOCAL selection + else + { + Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast( io ); + + if ( !aisShape.IsNull() && indexesMap.IsBound( (char*)entryStr.latin1() ) ) + { + TopoDS_Shape shape = aisShape->Shape(); + TopTools_IndexedMapOfShape aMapOfShapes; + TopExp::MapShapes( shape, aMapOfShapes ); + const TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind((char*)entryStr.latin1()); + + const TopoDS_Shape& aSubShape = anOwner->Shape(); + int aSubShapeId = aMapOfShapes.FindIndex( aSubShape ); + + // check if the "sub_shape_index" is found in the "map of indexes for this entry", + // which was passes in the parameter + if ( subIndexes.Contains( aSubShapeId ) ) + { + ownersmap.Add( anOwner ); + } + } + } // end of local selection + } // end of for(owners) + }// end of if(entry) + }// end of for(AIS_all_ios) + + vw->unHighlightAll( false ); + + // DO the selection + for ( int i = 1, n = ownersmap.Extent(); i <= n; i++ ) + { + Handle(SelectMgr_EntityOwner) owner = ownersmap( i ); + if ( owner->State() ) + continue; + + if ( ic->HasOpenedContext() ) + ic->AddOrRemoveSelected( owner, false ); + else + ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false ); + } + + vw->update(); +} diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.h b/src/GEOMGUI/GEOMGUI_OCCSelector.h new file mode 100644 index 000000000..70ab0b77c --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.h @@ -0,0 +1,18 @@ +#ifndef GEOMGUI_OCCSELECTOR_H +#define GEOMGUI_OCCSELECTOR_H + +#include + +class GEOMGUI_OCCSelector : public SalomeApp_OCCSelector +{ +public: + GEOMGUI_OCCSelector( OCCViewer_Viewer*, SUIT_SelectionMgr* ); + virtual ~GEOMGUI_OCCSelector(); + +protected: + virtual void getSelection( SUIT_DataOwnerPtrList& ) const; + virtual void setSelection( const SUIT_DataOwnerPtrList& ); + +}; + +#endif diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx new file mode 100644 index 000000000..8896412aa --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -0,0 +1,159 @@ +#include + +#include "GEOMGUI_Selection.h" +#include "GEOM_Displayer.h" +#include "GEOMImpl_Types.hxx" + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +GEOMGUI_Selection::GEOMGUI_Selection() +{ +} + +GEOMGUI_Selection::~GEOMGUI_Selection() +{ +} + +QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const +{ + QtxValue val( SalomeApp_Selection::param( ind, p ) ); + if ( !val.isValid() ) { + if ( p == "isVisible" ) val = QtxValue( isVisible( ind ) ); + else if ( p == "isOCC" ) val = QtxValue( isOCC() ); + else if ( p == "type" ) val = QtxValue( typeName( ind ) ); + else if ( p == "displaymode" ) val = QtxValue( displayMode( ind ) ); + } + + //printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() ); + + return val; +} + +QString GEOMGUI_Selection::typeName( const int index ) const +{ + if ( isComponent( index ) ) + return "Component"; + GEOM::GEOM_Object_var anObj = getObject( index ); + if ( !CORBA::is_nil( anObj ) ) { + const int aGeomType = anObj->GetType(); + if ( aGeomType == GEOM_GROUP ) + return "Group"; + else + return "Shape"; + } + return "Unknown"; +} + +bool GEOMGUI_Selection::isVisible( const int index ) const +{ + GEOM::GEOM_Object_var obj = getObject( index ); + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if ( !CORBA::is_nil( obj ) && view ) { + Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).latin1(), "GEOM", "TEMP_IO" ); + return view->isVisible( io ); + } + return false; +} + +bool GEOMGUI_Selection::isOCC() const +{ + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + return ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); +} + +QString GEOMGUI_Selection::displayMode( const int index ) const +{ + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if ( view ) { + SALOME_Prs* prs = view->CreatePrs( entry( index ) ); + if ( prs ) { + if ( isOCC() ) { // assuming OCC + SOCC_Prs* occPrs = (SOCC_Prs*) prs; + AIS_ListOfInteractive lst; + occPrs->GetObjects( lst ); + if ( lst.Extent() ) { + Handle(AIS_InteractiveObject) io = lst.First(); + if ( !io.IsNull() ) { + int dm = io->DisplayMode(); + if ( dm == AIS_WireFrame ) + return "Wireframe"; + else if ( dm == AIS_Shaded ) + return "Shading"; + else { // return default display mode of AIS_InteractiveContext + OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*) SUIT_Session::session()->activeApplication()->desktop( + )->activeWindow()->getViewManager()->getViewModel(); + Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); + dm = ic->DisplayMode(); + if ( dm == AIS_WireFrame ) + return "Wireframe"; + else if ( dm == AIS_Shaded ) + return "Shading"; + } + } + } + } + else { // assuming VTK + + } + } + } + return ""; +} + +bool GEOMGUI_Selection::isComponent( const int index ) const +{ + SalomeApp_Study* appStudy = dynamic_cast + (SUIT_Session::session()->activeApplication()->activeStudy()); + + if ( appStudy && index >= 0 && index < count() ) { + _PTR(Study) study = appStudy->studyDS(); + QString anEntry = entry( index ); + + if ( study && !anEntry.isNull() ) { + _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) ); + if ( aSO && aSO->GetFatherComponent() ) + return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR(); + } + } + return false; +} + +GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const +{ + SalomeApp_Study* appStudy = dynamic_cast + (SUIT_Session::session()->activeApplication()->activeStudy()); + + if ( appStudy && index >= 0 && index < count() ) { + _PTR(Study) study = appStudy->studyDS(); + QString anEntry = entry( index ); + + if ( study && !anEntry.isNull() ) { + _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) ); + if ( aSO ) { + SALOMEDS_SObject* aDSObj = dynamic_cast( aSO.get() ); + return GEOM::GEOM_Object::_narrow( aDSObj->GetObject() ); + } + } + } + return GEOM::GEOM_Object::_nil(); +} diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h new file mode 100644 index 000000000..dc98b1f02 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_Selection.h @@ -0,0 +1,55 @@ +// GEOMGUI_Selection +// +// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMGUI_Selection.h +// Author : Alexander SOLOVYOV +// Module : GUI +// $Header$ + +#ifndef GEOMGUI_SELECTION_HeaderFile +#define GEOMGUI_SELECTION_HeaderFile + +#include + +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +class GEOMGUI_Selection : public SalomeApp_Selection +{ +public: + GEOMGUI_Selection(); + virtual ~GEOMGUI_Selection(); + + virtual QtxValue param( const int, const QString& ) const; + +private: + bool isVisible( const int ) const; + bool isOCC() const; + QString typeName( const int ) const; + QString displayMode( const int ) const; + + bool isComponent( const int ) const; + GEOM::GEOM_Object_ptr getObject( const int ) const; +}; + +#endif diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po new file mode 100644 index 000000000..0b690ec75 --- /dev/null +++ b/src/GEOMGUI/GEOM_images.po @@ -0,0 +1,728 @@ +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. translating +# from French to English, "Foo::Bar" would be translated to "Pub", +# not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n" +"PO-Revision-Date: 2003-09-22 16:39+0200\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +#Select +msgid "ICON_SELECT" +msgstr "select1.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_Geometry" +msgstr "geometry.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_COMPOUND" +msgstr "tree_compound.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_COMPSOLID" +msgstr "tree_compsolid.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_EDGE" +msgstr "tree_edge.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_FACE" +msgstr "tree_face.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_SHAPE" +msgstr "tree_shape.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_SHELL" +msgstr "tree_shell.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_SOLID" +msgstr "tree_solid.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_VERTEX" +msgstr "tree_vertex.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_WIRE" +msgstr "tree_wire.png" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_BLOCK" +msgstr "tree_block.png" + +#BoxDlg +msgid "ICON_DLG_BOX_2P" +msgstr "box2points.png" + +#BoxDlg +msgid "ICON_DLG_BOX_DXYZ" +msgstr "boxdxyz.png" + +#CylinderDlg +msgid "ICON_DLG_CYLINDER_PV" +msgstr "cylinderpointvector.png" + +#CylinderDlg +msgid "ICON_DLG_CYLINDER_DXYZ" +msgstr "cylinderdxyz.png" + +#SphereDlg +msgid "ICON_DLG_SPHERE_P" +msgstr "spherepoint.png" + +#SphereDlg +msgid "ICON_DLG_SPHERE_DXYZ" +msgstr "spheredxyz.png" + +#torusDlg +msgid "ICON_DLG_TORUS_PV" +msgstr "toruspointvector.png" + +#ConeDlg +msgid "ICON_DLG_CONE_PV" +msgstr "conepointvector.png" + +#torusDlg +msgid "ICON_DLG_TORUS_DXYZ" +msgstr "torusdxyz.png" + +#ConeDlg +msgid "ICON_DLG_CONE_DXYZ" +msgstr "conedxyz.png" + +#LineDlg +msgid "ICON_DLG_LINE_2P" +msgstr "line2points.png" + +#LineDlg +msgid "ICON_DLG_LINE_EDGE" +msgstr "lineedge.png" + +#LineDlg +msgid "ICON_DLG_LINE_PV" +msgstr "linepointvector.png" + +#CircleDlg +msgid "ICON_DLG_CIRCLE_PV" +msgstr "circlepointvector.png" + +#VectorDlg +msgid "ICON_DLG_VECTOR_2P" +msgstr "vector2points.png" + +#vectorDlg +msgid "ICON_DLG_VECTOR_DXYZ" +msgstr "vectordxyz.png" + +#PlaneDlg +msgid "ICON_DLG_PLANE_DXYZ" +msgstr "planedxyz.png" + +#PlaneDlg +msgid "ICON_DLG_PLANE_FACE" +msgstr "planeface.png" + +#PlaneDlg +msgid "ICON_DLG_PLANE_PV" +msgstr "planepointvector.png" + +#WorkingPlaneDlg +msgid "ICON_DLG_WPLANE_FACE" +msgstr "planeworkingface.png" + +#WorkingPlaneDlg +msgid "ICON_DLG_WPLANE_VECTOR" +msgstr "planeworkingvector.png" + +#WorkingPlaneDlg +msgid "ICON_DLG_WPLANE_ORIGIN" +msgstr "planeworkingorigin.png" + +#PointDlg +msgid "ICON_DLG_POINT" +msgstr "point2.png" + +#PointDlg +msgid "ICON_DLG_POINT_REF" +msgstr "point3.png" + +#PoinDlg +msgid "ICON_DLG_POINT_EDGE" +msgstr "pointonedge.png" + +#ArcDlg +msgid "ICON_DLG_ARC" +msgstr "arc.png" + +#ArchimedeDlg +msgid "ICON_DLG_ARCHIMEDE" +msgstr "archimede.png" + +#PartitionDlg +msgid "ICON_DLG_PARTITION" +msgstr "partition.png" + +#PartitionDlg +msgid "ICON_DLG_PARTITION_KEEP_FACES" +msgstr "partitionkeep.png" + +#PartitionDlg +msgid "ICON_DLG_PARTITION_PLANE" +msgstr "partitionplane.png" + +#CenterMassDlg +msgid "ICON_DLG_CENTERMASS" +msgstr "centergravity.png" + +#BoundingBoxDlg +msgid "ICON_DLG_BOUNDING_BOX" +msgstr "bounding.png" + +#CommonDlg +msgid "ICON_DLG_COMMON" +msgstr "common.png" + +#CompoundDlg +msgid "ICON_DLG_BUILD_COMPOUND" +msgstr "build_compound.png" + +#CutDlg +msgid "ICON_DLG_CUT" +msgstr "cut.png" + +#EdgeDlg +msgid "ICON_DLG_BUILD_EDGE" +msgstr "build_edge.png" + +#FaceDlg +msgid "ICON_DLG_BUILD_FACE" +msgstr "build_face.png" + +#ShellDlg +msgid "ICON_DLG_BUILD_SHELL" +msgstr "build_shell.png" + +#SolidDlg +msgid "ICON_DLG_BUILD_SOLID" +msgstr "build_solid.png" + +#WireDlg +msgid "ICON_DLG_BUILD_WIRE" +msgstr "build_wire.png" + +#FillingDlg +msgid "ICON_DLG_FILLING" +msgstr "filling.png" + +#FuseDlg +msgid "ICON_DLG_FUSE" +msgstr "fuse.png" + +#InertiaDlg +msgid "ICON_DLG_INERTIA" +msgstr "axisinertia.png" + +#ToleranceDlg +msgid "ICON_DLG_TOLERANCE" +msgstr "tolerance.png" + +#BasicPropertiesDlg +msgid "ICON_DLG_BASICPROPERTIES" +msgstr "basicproperties.png" + +#WhatisDlg +msgid "ICON_DLG_WHATIS" +msgstr "whatis.png" + +#MinDistDlg +msgid "ICON_DLG_MINDIST" +msgstr "mindist.png" + +#MirrorDlg (MZN: add icons for point and axe) +msgid "ICON_DLG_MIRROR_POINT" +msgstr "mirrorPoint.png" + +msgid "ICON_DLG_MIRROR_AXE" +msgstr "mirrorAxe.png" + +msgid "ICON_DLG_MIRROR_PLANE" +msgstr "mirrorPlane.png" + +#TranslationDlg +msgid "ICON_DLG_TRANSLATION_DXYZ" +msgstr "translationDxyz.png" + +#TranslationDlg +msgid "ICON_DLG_TRANSLATION_POINTS" +msgstr "translationPoints.png" + +#TranslationDlg +msgid "ICON_DLG_TRANSLATION_VECTOR" +msgstr "translationVector.png" + +#RotationDlg +msgid "ICON_DLG_ROTATION" +msgstr "rotate.png" + +#ScaleDlg +msgid "ICON_DLG_SCALE" +msgstr "scale.png" + +#OffsetDlg +msgid "ICON_DLG_OFFSET" +msgstr "offset.png" + +#OrientationDlg +msgid "ICON_DLG_DIVIDE_EDGE" +msgstr "pointonedge.png" + +#SewingDlg +msgid "ICON_DLG_SEWING" +msgstr "sewing.png" + +#PipeDlg +msgid "ICON_DLG_PIPE" +msgstr "pipe.png" + +#PrismDlg +msgid "ICON_DLG_PRISM" +msgstr "prism.png" + +#RevolutionDlg +msgid "ICON_DLG_REVOL" +msgstr "revol.png" + +#SectionDlg +msgid "ICON_DLG_SECTION" +msgstr "section.png" + +#SubShapeDlg +msgid "ICON_DLG_SUBSHAPE" +msgstr "subshape.png" + +#FilletDlg +msgid "ICON_DLG_FILLET" +msgstr "fillet.png" + +#ChamferDlg +msgid "ICON_DLG_CHAMFER" +msgstr "chamfer.png" + +#FilletDlg +msgid "ICON_DLG_FILLET_ALL" +msgstr "filletall.png" + +#ChamferDlg +msgid "ICON_DLG_CHAMFER_ALL" +msgstr "chamferall.png" + +#FilletDlg +msgid "ICON_DLG_FILLET_EDGE" +msgstr "filletedge.png" + +#ChamferDlg +msgid "ICON_DLG_CHAMFER_EDGE" +msgstr "chamferedge.png" + +#FilletDlg +msgid "ICON_DLG_FILLET_FACE" +msgstr "filletface.png" + +#ChamferDlg +msgid "ICON_DLG_CHAMFER_FACE" +msgstr "chamferface.png" + +#ChamferDlg +msgid "ICON_DLG_CHECKSHAPE" +msgstr "check.png" + +msgid "ICON_DLG_CHECK_COMPOUND_OF_BLOCKS" +msgstr "check_blocks_compound.png" + +#SupressFaceDlg +msgid "ICON_DLG_SUPRESS_FACE" +msgstr "supressface.png" + +msgid "ICON_DLG_CLOSECONTOUR" +msgstr "closecontour.png" + +#SupressHoleDlg +msgid "ICON_DLG_SUPRESS_HOLE" +msgstr "supresshole.png" + +#SupressHoleDlg +msgid "ICON_DLG_SUPRESS_HOLE_FACE_SHELL" +msgstr "supressHolesOnFaceShell.png" + +#MultiTranslationDlg +msgid "ICON_DLG_MULTITRANSLATION_SIMPLE" +msgstr "multitranslationsimple.png" + +#MultiTranslationDlg +msgid "ICON_DLG_MULTITRANSLATION" +msgstr "multitranslation.png" + +#MultiTranslationDlg +msgid "ICON_DLG_MULTITRANSLATION_DOUBLE" +msgstr "multitranslationdouble.png" + +#MultiRotationDlg +msgid "ICON_DLG_MULTIROTATION_SIMPLE" +msgstr "multirotationsimple.png" + +#MultiRotationDlg +msgid "ICON_DLG_MULTIROTATION" +msgstr "multirotation.png" + +#MultiRotationDlg +msgid "ICON_DLG_MULTIROTATION_DOUBLE" +msgstr "multirotationdouble.png" + +#EllipseDlg +msgid "ICON_DLG_ELLIPSE_PV" +msgstr "ellipsepointvector.png" + +#SplineDlg +msgid "ICON_DLG_SPLINE" +msgstr "spline.png" + +#SplineDlg +msgid "ICON_DLG_BEZIER" +msgstr "bezier.png" + +#SplineDlg +msgid "ICON_DLG_INTERPOL" +msgstr "interpol.png" + +msgid "ICON_DLG_CIRCLE_PNTS" +msgstr "circle3points.png" + +msgid "ICON_DLG_PLANE_3PNTS" +msgstr "plane3points.png" + +msgid "ICON_DLG_POLYLINE" +msgstr "polyline.png" + +msgid "ICON_DLG_SUPPRESS_INT_WIRES" +msgstr "suppressintwires.png" + +msgid "ICON_DLG_ADD_POINT_ON_EDGE" +msgstr "pointonedge.png" + +msgid "ICON_DLG_SUPPRESS_HOLES" +msgstr "supressHolesOnFaceShell.png" + +msgid "ICON_MARKER" +msgstr "marker.png" + +msgid "ICON_MARKER2" +msgstr "marker2.png" + +msgid "ICON_MARKER3" +msgstr "marker3.png" + +msgid "ICON_DLG_POSITION" +msgstr "position.png" + +msgid "ICON_DLG_POSITION2" +msgstr "position2.png" + +msgid "ICON_DLG_UNDO" +msgstr "undo.png" + +msgid "ICON_DLG_REDO" +msgstr "redo.png" + +msgid "ICON_OBJBROWSER_GROUP_PNT" +msgstr "tree_group_vertex.png" + +msgid "ICON_OBJBROWSER_GROUP_EDGE" +msgstr "tree_group_edge.png" + +msgid "ICON_OBJBROWSER_GROUP_FACE" +msgstr "tree_group_face.png" + +msgid "ICON_OBJBROWSER_GROUP_SOLID" +msgstr "tree_group_solid.png" + +msgid "ICON_OBJBROWSER_LCS" +msgstr "tree_lcs.png" + +msgid "ICON_DLG_SHAPEPROCESS" +msgstr "shapeprocess.png" + +#BlocksGUI_BlockDlg +msgid "ICON_DLG_BLOCK_2F" +msgstr "block_2f.png" + +msgid "ICON_DLG_BLOCK_6F" +msgstr "block_6f.png" + +#BlocksGUI_ExplodeDlg +msgid "ICON_DLG_BLOCK_EXPLODE" +msgstr "subblock.png" + +#BlocksGUI_TrsfDlg +msgid "ICON_DLG_BLOCK_MULTITRSF_SIMPLE" +msgstr "block_multitrsf_simple.png" + +msgid "ICON_DLG_BLOCK_MULTITRSF_DOUBLE" +msgstr "block_multitrsf_double.png" + +#BlocksGUI_QuadFaceDlg +msgid "ICON_DLG_QUAD_FACE_4_VERT" +msgstr "block_face_4v.png" + +msgid "ICON_DLG_QUAD_FACE_2_EDGE" +msgstr "block_face_2e.png" + +msgid "ICON_DLG_QUAD_FACE_4_EDGE" +msgstr "block_face_4e.png" + +msgid "ICON_DLG_GLUE_FACES" +msgstr "glue.png" + +msgid "ICON_DLG_FREE_FACES" +msgstr "free_faces.png" + +msgid "ICON_DLG_PROPAGATE" +msgstr "propagate.png" + +msgid "ICO_DELETE" +msgstr "delete.png" + +msgid "ICO_POINT" +msgstr "point2.png" + +msgid "ICO_LINE" +msgstr "line.png" + +msgid "ICO_CIRCLE" +msgstr "circle.png" + +msgid "ICO_ELLIPSE" +msgstr "ellipse.png" + +msgid "ICO_ARC" +msgstr "arc.png" + +msgid "ICO_CURVE" +msgstr "spline.png" + +msgid "ICO_VECTOR" +msgstr "vector.png" + +msgid "ICO_PLANE" +msgstr "plane.png" + +msgid "ICO_WORK_PLANE" +msgstr "planeWorking.png" + +msgid "ICO_LOCAL_CS" +msgstr "marker.png" + +msgid "ICO_BOX" +msgstr "box.png" + +msgid "ICO_CYLINDER" +msgstr "cylinder.png" + +msgid "ICO_SPHERE" +msgstr "sphere.png" + +msgid "ICO_TORUS" +msgstr "torus.png" + +msgid "ICO_CONE" +msgstr "cone.png" + +msgid "ICO_EXTRUSION" +msgstr "prism.png" + +msgid "ICO_REVOLUTION" +msgstr "revol.png" + +msgid "ICO_FILLING" +msgstr "filling.png" + +msgid "ICO_PIPE" +msgstr "pipe.png" + +msgid "ICO_GROUP_CREATE" +msgstr "group_new.png" + +msgid "ICO_GROUP_EDIT" +msgstr "group_edit.png" + +msgid "ICO_Q_FACE" +msgstr "build_face.png" + +msgid "ICO_HEX_SOLID" +msgstr "box.png" + +msgid "ICO_SKETCH" +msgstr "sketch.png" + +msgid "ICO_EXPLODE" +msgstr "subshape.png" + +msgid "ICO_EDGE" +msgstr "build_edge.png" + +msgid "ICO_WIRE" +msgstr "build_wire.png" + +msgid "ICO_FACE" +msgstr "build_face.png" + +msgid "ICO_SHELL" +msgstr "build_shell.png" + +msgid "ICO_SOLID" +msgstr "build_solid.png" + +msgid "ICO_COMPOUND" +msgstr "build_compound.png" + +msgid "ICO_FUSE" +msgstr "fuse.png" + +msgid "ICO_COMMON" +msgstr "common.png" + +msgid "ICO_CUT" +msgstr "cut.png" + +msgid "ICO_SECTION" +msgstr "section.png" + +msgid "ICO_TRANSLATION" +msgstr "translationVector.png" + +msgid "ICO_ROTATION" +msgstr "rotate.png" + +msgid "ICO_MODIFY_LOCATION" +msgstr "position2.png" + +msgid "ICO_MIRROR" +msgstr "mirrorPlane.png" + +msgid "ICO_SCALE" +msgstr "scale.png" + +msgid "ICO_OFFSET" +msgstr "offset.png" + +msgid "ICO_MUL_TRANSLATION" +msgstr "multitranslation.png" + +msgid "ICO_MUL_ROTATION" +msgstr "multirotation.png" + +msgid "ICO_PARTITION" +msgstr "partition.png" + +msgid "ICO_ARCHIMEDE" +msgstr "archimede.png" + +msgid "ICO_FILLET" +msgstr "fillet.png" + +msgid "ICO_CHAMFER" +msgstr "chamfer.png" + +msgid "ICO_MUL_TRANSFORM" +msgstr "multirotation.png" + +msgid "ICO_EXPLODE_BLOCKS" +msgstr "subshape.png" + +msgid "ICO_PROPAGATE" +msgstr "propagate.png" + +msgid "ICO_SEWING" +msgstr "sewing.png" + +msgid "ICO_GLUE_FACES" +msgstr "glue.png" + +msgid "ICO_SUPPRESS_FACES" +msgstr "supressface.png" + +msgid "ICO_SUPPERSS_HOLES" +msgstr "supresshole.png" + +msgid "ICO_SHAPE_PROCESS" +msgstr "shapeprocess.png" + +msgid "ICO_CLOSE_CONTOUR" +msgstr "closecontour.png" + +msgid "ICO_SUPPRESS_INT_WIRES" +msgstr "suppressintwires.png" + +msgid "ICO_POINT_ON_EDGE" +msgstr "pointonedge.png" + +msgid "ICO_CHECK_FREE_BNDS" +msgstr "free_bound.png" + +msgid "ICO_CHECK_FREE_FACES" +msgstr "free_faces.png" + +msgid "ICO_POINT_COORDS" +msgstr "point_coord.png" + +msgid "ICO_BASIC_PROPS" +msgstr "basicproperties.png" + +msgid "ICO_MASS_CENTER" +msgstr "centergravity.png" + +msgid "ICO_INERTIA" +msgstr "axisinertia.png" + +msgid "ICO_BND_BOX" +msgstr "bounding.png" + +msgid "ICO_MIN_DIST" +msgstr "mindist.png" + +msgid "ICO_TOLERANCE" +msgstr "tolerance.png" + +msgid "ICO_WHAT_IS" +msgstr "whatis.png" + +msgid "ICO_CHECK" +msgstr "check.png" + +msgid "ICO_CHECK_COMPOUND" +msgstr "check_blocks_compound.png" + +msgid "ICO_SHADING" +msgstr "shading.png" + +msgid "ICO_DISPLAY_ALL" +msgstr "displayall.png" + +msgid "ICO_ERASE_ALL" +msgstr "eraseall.png" + +msgid "ICO_DISPLAY" +msgstr "display.png" + +msgid "ICO_DISPLAY_ONLY" +msgstr "displayonly.png" + +msgid "ICO_ERASE" +msgstr "erase.png" diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc new file mode 100644 index 000000000..0b714de68 --- /dev/null +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -0,0 +1,90 @@ +using namespace std; + +#include "GEOM_Gen_i.hh" +#include +#include +#include +#include + +//======================================================================= +//function : DumpPython +//purpose : +//======================================================================= + +Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript) +{ + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy); + if(CORBA::is_nil(aStudy)) + return new Engines::TMPFile(0); + + SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType()); + if(CORBA::is_nil(aSO)) + return new Engines::TMPFile(0); + + Resource_DataMapOfAsciiStringAsciiString aMap; + + SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO); + for(Itr->InitEx(true); Itr->More(); Itr->Next()) { + SALOMEDS::SObject_var aValue = Itr->Value(); + CORBA::String_var IOR = aValue->GetIOR(); + if(strlen(IOR.in()) > 0) { + CORBA::Object_var obj = _orb->string_to_object(IOR); + GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_narrow(obj); + if(!CORBA::is_nil(GO)) { + CORBA::String_var aName = aValue->GetName(); + CORBA::String_var anEntry = GO->GetEntry(); + aMap.Bind( (char*)anEntry.in(), (char*)aName.in() ); + } + } + } + + TCollection_AsciiString aScript = + "### This file is generated by SALOME automatically by dump python funcitonality\n" + "### of GEOM component\n\n"; + aScript += _impl->DumpPython(aStudy->StudyId(), aMap, isPublished, isValidScript); + + int aLen = aScript.Length(); + unsigned char* aBuffer = new unsigned char[aLen+1]; + strcpy((char*)aBuffer, aScript.ToCString()); + + CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; + Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); + + return aStreamFile._retn(); +} + +//======================================================================= +//function : GetDumpName +//purpose : +//======================================================================= + +char* GEOM_Gen_i::GetDumpName (const char* theStudyEntry) +{ + const char* name = _impl->GetDumpName( theStudyEntry ); + if ( name && strlen( name ) > 0 ) + return strdup( name ); + + return NULL; +} + +//======================================================================= +//function : GetAllDumpNames +//purpose : +//======================================================================= + +GEOM::string_array* GEOM_Gen_i::GetAllDumpNames() +{ + Handle(TColStd_HSequenceOfAsciiString) aHSeq = _impl->GetAllDumpNames(); + int i = 0, aLen = aHSeq->Length(); + + GEOM::string_array_var seq = new GEOM::string_array(); + seq->length(aLen); + + for (; i < aLen; i++) { + seq[i] = CORBA::string_dup(aHSeq->Value(i + 1).ToCString()); + } + + return seq._retn(); +} -- 2.30.2