From: skl Date: Thu, 7 Dec 2006 10:39:45 +0000 (+0000) Subject: Improvements for gluing and new command GetShapesOnBox. X-Git-Tag: V3_2_4pre1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f4f9f3fb740034280f449c5ee4da5e367bb15042;p=modules%2Fgeom.git Improvements for gluing and new command GetShapesOnBox. --- diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl index 75e5b2106..f290d14d0 100755 --- a/src/GEOMAlgo/GEOMAlgo.cdl +++ b/src/GEOMAlgo/GEOMAlgo.cdl @@ -40,14 +40,13 @@ uses IntTools, BOPTools, BOP, - --|| + TColStd, BOPTColStd, BRepAlgo, NMTDS, NMTTools - --|| - + is -- -- enumerations @@ -60,10 +59,17 @@ is ST_ONIN, ST_ONOUT, ST_INOUT - end State; + end State; + -- + deferred class HAlgo; + deferred class Clsf; + class ClsfSurf; + class ClsfBox; + class FinderShapeOn2; + class PassKeyShapeMapHasher; -- -- classes - -- + -- deferred class Algo; deferred class ShapeAlgo; -- @@ -74,6 +80,7 @@ is class PassKey; class PassKeyMapHasher; class PassKeyShape; + class SurfaceTools; class Tools; -- @@ -86,7 +93,8 @@ is class FinderShapeOn; -- class FinderShapeOn1; - class StateCollector; + class StateCollector; + -- -- Builder/Splitter deferred class BuilderShape; @@ -128,10 +136,7 @@ is MapRealHasher from TColStd); -- -- instantiations - class IndexedDataMapOfPassKeyShapeListOfShape - instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, - ListOfShape from TopTools, - PassKeyMapHasher from GEOMAlgo); + class IndexedDataMapOfShapeBox instantiates IndexedDataMap from TCollection (Shape from TopoDS, @@ -153,10 +158,14 @@ is class ListOfPnt instantiates List from TCollection (Pnt from gp); - - class DataMapOfPassKeyInteger instantiates DataMap from TCollection (PassKey from GEOMAlgo, Integer from Standard, - PassKeyMapHasher from GEOMAlgo); + PassKeyMapHasher from GEOMAlgo); + + class IndexedDataMapOfPassKeyShapeListOfShape + instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, + ListOfShape from TopTools, + PassKeyShapeMapHasher from GEOMAlgo); + end GEOMAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.cdl b/src/GEOMAlgo/GEOMAlgo_Clsf.cdl new file mode 100644 index 000000000..d32329d18 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.cdl @@ -0,0 +1,75 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: GEOMAlgo_Clsf.cdl +-- Created: Wed Nov 22 10:19:29 2006 +-- Author: Peter KURNEV +-- + + +deferred class Clsf from GEOMAlgo + inherits HAlgo from GEOMAlgo + + ---Purpose: + +uses + State from TopAbs, + Pnt from gp, + Curve from Geom, + Surface from Geom + +--raises + +is + Initialize + returns mutable Clsf from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Clsf();" + + SetPnt(me:mutable; + aP:Pnt from gp); + + Pnt(me) + returns Pnt from gp; + ---C++:return const& + + SetTolerance(me:mutable; + aT:Real from Standard); + + Tolerance(me) + returns Real from Standard; + + State(me) + returns State from TopAbs; + + CanBeON(me; + aCT:Curve from Geom) + returns Boolean from Standard + is virtual; + + CanBeON(me; + aST:Surface from Geom) + returns Boolean from Standard + is virtual; + +fields + myState :State from TopAbs is protected; + myPnt :Pnt from gp is protected; + myTolerance:Real from Standard is protected; + +end Clsf; diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.cxx b/src/GEOMAlgo/GEOMAlgo_Clsf.cxx new file mode 100644 index 000000000..91b1b2a07 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.cxx @@ -0,0 +1,102 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_Classifier.cxx +// Created: Wed Nov 22 10:23:04 2006 +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_Clsf::GEOMAlgo_Clsf() +: + GEOMAlgo_HAlgo() +{ + myState=TopAbs_UNKNOWN; + myPnt.SetCoord(99.,99.,99.); + myTolerance=0.0001; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_Clsf::~GEOMAlgo_Clsf() +{ +} +//======================================================================= +//function : SetTolerance +//purpose : +//======================================================================= + void GEOMAlgo_Clsf::SetTolerance(const Standard_Real aT) +{ + myTolerance=aT; +} +//======================================================================= +//function : Tolerance +//purpose : +//======================================================================= + Standard_Real GEOMAlgo_Clsf::Tolerance()const +{ + return myTolerance; +} +//======================================================================= +//function : SetPnt +//purpose : +//======================================================================= + void GEOMAlgo_Clsf::SetPnt(const gp_Pnt& aP) +{ + myPnt=aP; +} +//======================================================================= +//function : Pnt +//purpose : +//======================================================================= + const gp_Pnt& GEOMAlgo_Clsf::Pnt()const +{ + return myPnt; +} +//======================================================================= +//function : State +//purpose : +//======================================================================= + TopAbs_State GEOMAlgo_Clsf::State() const +{ + return myState; +} +//======================================================================= +//function : CanBeON +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_Clsf::CanBeON(const Handle(Geom_Curve)& ) const +{ + return Standard_True; +} +//======================================================================= +//function : CanBeON +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_Clsf::CanBeON(const Handle(Geom_Surface)& ) const +{ + return Standard_True; +} diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.hxx b/src/GEOMAlgo/GEOMAlgo_Clsf.hxx new file mode 100644 index 000000000..3b2c43abb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.hxx @@ -0,0 +1,130 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_Clsf_HeaderFile +#define _GEOMAlgo_Clsf_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#include +#endif + +#ifndef _TopAbs_State_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_HAlgo_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Handle_Geom_Curve_HeaderFile +#include +#endif +#ifndef _Handle_Geom_Surface_HeaderFile +#include +#endif +class gp_Pnt; +class Geom_Curve; +class Geom_Surface; + + + +class GEOMAlgo_Clsf : public GEOMAlgo_HAlgo { + +public: + // Methods PUBLIC + // + + +Standard_EXPORT void SetPnt(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Pnt() const; + + +Standard_EXPORT void SetTolerance(const Standard_Real aT) ; + + +Standard_EXPORT Standard_Real Tolerance() const; + + +Standard_EXPORT TopAbs_State State() const; + + +Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aCT) const; + + +Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; +//Standard_EXPORT ~GEOMAlgo_Clsf(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT GEOMAlgo_Clsf(); +Standard_EXPORT virtual ~GEOMAlgo_Clsf(); + + + // Fields PROTECTED + // +TopAbs_State myState; +gp_Pnt myPnt; +Standard_Real myTolerance; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.ixx b/src/GEOMAlgo/GEOMAlgo_Clsf.ixx new file mode 100644 index 000000000..bb7371ff2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.ixx @@ -0,0 +1,73 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +//GEOMAlgo_Clsf::~GEOMAlgo_Clsf() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_Clsf_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_HAlgo); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_Clsf", + sizeof(GEOMAlgo_Clsf), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_Clsf) Handle(GEOMAlgo_Clsf)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_Clsf) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_Clsf))) { + _anOtherObject = Handle(GEOMAlgo_Clsf)((Handle(GEOMAlgo_Clsf)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_Clsf::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_Clsf) ; +} +//Standard_Boolean GEOMAlgo_Clsf::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_Clsf) == AType || GEOMAlgo_HAlgo::IsKind(AType)); +//} +//Handle_GEOMAlgo_Clsf::~Handle_GEOMAlgo_Clsf() {} + diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.jxx b/src/GEOMAlgo/GEOMAlgo_Clsf.jxx new file mode 100644 index 000000000..775a63809 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _Geom_Curve_HeaderFile +#include +#endif +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Clsf_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cdl new file mode 100644 index 000000000..21c385de7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cdl @@ -0,0 +1,70 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: GEOMAlgo_ClsfBox.cdl +-- Created: Wed Nov 22 10:19:29 2006 +-- Author: Peter KURNEV +-- + + +class ClsfBox from GEOMAlgo + inherits Clsf from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS, + Curve from Geom, + Surface from Geom, + Surface from GeomAdaptor + +--raises + +is + Create + returns mutable ClsfBox from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfBox();" + + SetBox(me:mutable; + aS:Shape from TopoDS); + + Box(me) + returns Shape from TopoDS; + ---C++: return const & + + Perform(me:mutable) + is redefined; + + CheckData(me:mutable) + is redefined; + + CanBeON(me; + aC:Curve from Geom) + returns Boolean from Standard + is redefined; + + CanBeON(me; + aST:Surface from Geom) + returns Boolean from Standard + is redefined; + +fields + myBox : Shape from TopoDS is protected; + myGAS : Surface from GeomAdaptor [6] is protected; +end ClsfBox; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx new file mode 100644 index 000000000..1abad5406 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx @@ -0,0 +1,216 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_ClsfSurf.cxx +// Created: Wed Nov 22 10:41:47 2006 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ClsfBox::GEOMAlgo_ClsfBox() +: + GEOMAlgo_Clsf() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ClsfBox::~GEOMAlgo_ClsfBox() +{ +} +//======================================================================= +//function : SetBox +//purpose : +//======================================================================= + void GEOMAlgo_ClsfBox::SetBox(const TopoDS_Shape& aBox) +{ + myBox=aBox; +} +//======================================================================= +//function : Box +//purpose : +//======================================================================= + const TopoDS_Shape& GEOMAlgo_ClsfBox::Box() const +{ + return myBox; +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_ClsfBox::CheckData() +{ + Standard_Integer i, aNbF; + TopAbs_ShapeEnum aTypeShape; + TopAbs_Orientation aOr; + GeomAbs_SurfaceType aType; + Handle(Geom_Surface) aS; + TopTools_IndexedMapOfShape aMF; + // + myErrorStatus=0; + // + if(myBox.IsNull()) { + myErrorStatus=10; // myBox=NULL + return; + } + // + aTypeShape=myBox.ShapeType(); + if (aTypeShape!=TopAbs_SOLID) { + myErrorStatus=11; // unallowed shape type + return; + } + // + TopExp::MapShapes(myBox, TopAbs_FACE, aMF); + aNbF=aMF.Extent(); + if (aNbF!=6) { + myErrorStatus=12; // wrong number of faces + return; + } + // + for (i=1; i<=aNbF; ++i) { + const TopoDS_Face& aF=TopoDS::Face(aMF(i)); + aOr=aF.Orientation(); + if (!(aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED)) { + myErrorStatus=12; // unallowed orientation of face + return; + } + // + aS=BRep_Tool::Surface(aF); + myGAS[i-1].Load(aS); + aType=myGAS[i-1].GetType(); + if (!aType==GeomAbs_Plane) { + myErrorStatus=13; // unallowed surface type + return; + } + // + if(aOr==TopAbs_REVERSED) { + gp_Ax1 aAx1; + gp_Pln aPln; + gp_Pnt aP; + gp_Dir aD; + Handle(Geom_Plane) aSR; + // + aPln=myGAS[i-1].Plane(); + aAx1=aPln.Axis(); + aP=aAx1.Location(); + aD=aAx1.Direction(); + aD.Reverse(); + aSR=new Geom_Plane(aP, aD); + myGAS[i-1].Load(aSR); + } + } +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_ClsfBox::Perform() +{ + myErrorStatus=0; + // + const Standard_Integer aNbS=6; + Standard_Integer i, aNbON, aNbIN, iNext; + TopAbs_State aSt; + /* + CheckData(); + if(myErrorStatus) { + return; + } + */ + iNext=1; + aNbON=0; + aNbIN=0; + for(i=0; i +#endif +#ifndef _Handle_GEOMAlgo_ClsfBox_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GeomAdaptor_Surface_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Clsf_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Handle_Geom_Curve_HeaderFile +#include +#endif +#ifndef _Handle_Geom_Surface_HeaderFile +#include +#endif +class TopoDS_Shape; +class Geom_Curve; +class Geom_Surface; + + + +class GEOMAlgo_ClsfBox : public GEOMAlgo_Clsf { + +public: + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ClsfBox(); +Standard_EXPORT virtual ~GEOMAlgo_ClsfBox(); + + +Standard_EXPORT void SetBox(const TopoDS_Shape& aS) ; + + +Standard_EXPORT const TopoDS_Shape& Box() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT virtual void CheckData() ; + + +Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const; + + +Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; +//Standard_EXPORT ~GEOMAlgo_ClsfBox(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +TopoDS_Shape myBox; +GeomAdaptor_Surface myGAS[6]; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfBox.ixx new file mode 100644 index 000000000..8406273be --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfBox.ixx @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +//GEOMAlgo_ClsfBox::~GEOMAlgo_ClsfBox() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfBox_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); + static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfBox", + sizeof(GEOMAlgo_ClsfBox), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_ClsfBox) Handle(GEOMAlgo_ClsfBox)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_ClsfBox) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfBox))) { + _anOtherObject = Handle(GEOMAlgo_ClsfBox)((Handle(GEOMAlgo_ClsfBox)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_ClsfBox::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_ClsfBox) ; +} +//Standard_Boolean GEOMAlgo_ClsfBox::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_ClsfBox) == AType || GEOMAlgo_Clsf::IsKind(AType)); +//} +//Handle_GEOMAlgo_ClsfBox::~Handle_GEOMAlgo_ClsfBox() {} + diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfBox.jxx new file mode 100644 index 000000000..dfcc22957 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfBox.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _Geom_Curve_HeaderFile +#include +#endif +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ClsfBox_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cdl new file mode 100644 index 000000000..15c0b69d4 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cdl @@ -0,0 +1,70 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: GEOMAlgo_ClsfSurf.cdl +-- Created: Wed Nov 22 10:19:29 2006 +-- Author: Peter KURNEV +-- + + +class ClsfSurf from GEOMAlgo + inherits Clsf from GEOMAlgo + + ---Purpose: + +uses + Curve from Geom, + Surface from Geom, + Surface from GeomAdaptor + +--raises + +is + Create + returns mutable ClsfSurf from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfSurf();" + + SetSurface(me:mutable; + aS:Surface from Geom); + + Surface(me) + returns Surface from Geom; + ---C++: return const & + + Perform(me:mutable) + is redefined; + + CheckData(me:mutable) + is redefined; + + CanBeON(me; + aC:Curve from Geom) + returns Boolean from Standard + is redefined; + + CanBeON(me; + aST:Surface from Geom) + returns Boolean from Standard + is redefined; + +fields + myS : Surface from Geom is protected; + myGAS : Surface from GeomAdaptor is protected; + +end ClsfSurf; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx new file mode 100644 index 000000000..a7b05096f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx @@ -0,0 +1,136 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_ClsfSurf.cxx +// Created: Wed Nov 22 10:41:47 2006 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ClsfSurf::GEOMAlgo_ClsfSurf() +: + GEOMAlgo_Clsf() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ClsfSurf::~GEOMAlgo_ClsfSurf() +{ +} +//======================================================================= +//function : SetSurface +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSurf::SetSurface(const Handle(Geom_Surface)& aS) +{ + myS=aS; +} +//======================================================================= +//function : Surface +//purpose : +//======================================================================= + const Handle(Geom_Surface)& GEOMAlgo_ClsfSurf::Surface() const +{ + return myS; +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSurf::CheckData() +{ + GeomAbs_SurfaceType aType; + // + myErrorStatus=0; + // + if(myS.IsNull()) { + myErrorStatus=10; // mySurface=NULL + return; + } + // + myGAS.Load(myS); + aType=myGAS.GetType(); + if (!(aType==GeomAbs_Plane || + aType==GeomAbs_Cylinder || + aType==GeomAbs_Sphere)) { + myErrorStatus=11; // unallowed surface type + } +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSurf::Perform() +{ + myErrorStatus=0; + /* + CheckData(); + if(myErrorStatus) { + return; + } + */ + GEOMAlgo_SurfaceTools::GetState(myPnt, myGAS, myTolerance, myState); +} +//======================================================================= +//function : CanBeON +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_ClsfSurf::CanBeON(const Handle(Geom_Curve)& aC) const +{ + GeomAbs_SurfaceType aST; + GeomAbs_CurveType aCT; + GeomAdaptor_Curve aGAC; + // + aGAC.Load(aC); + aCT=aGAC.GetType(); + // + aST=myGAS.GetType(); + if (aCT==GeomAbs_Line && aST==GeomAbs_Sphere) { + return Standard_False; + } + return Standard_True; +} +//======================================================================= +//function : CanBeON +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_ClsfSurf::CanBeON(const Handle(Geom_Surface)& aS1) const +{ + Standard_Boolean bRet; + GeomAbs_SurfaceType aST, aST1; + GeomAdaptor_Surface aGAS1; + // + aST=myGAS.GetType(); + aGAS1.Load(aS1); + aST1=aGAS1.GetType(); + bRet=(aST1==aST); + // + return bRet; +} diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx new file mode 100644 index 000000000..f35629562 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx @@ -0,0 +1,119 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_ClsfSurf_HeaderFile +#define _GEOMAlgo_ClsfSurf_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_ClsfSurf_HeaderFile +#include +#endif + +#ifndef _Handle_Geom_Surface_HeaderFile +#include +#endif +#ifndef _GeomAdaptor_Surface_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Clsf_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Handle_Geom_Curve_HeaderFile +#include +#endif +class Geom_Surface; +class Geom_Curve; + + + +class GEOMAlgo_ClsfSurf : public GEOMAlgo_Clsf { + +public: + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ClsfSurf(); +Standard_EXPORT virtual ~GEOMAlgo_ClsfSurf(); + + +Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ; + + +Standard_EXPORT const Handle_Geom_Surface& Surface() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT virtual void CheckData() ; + + +Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const; + + +Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; +//Standard_EXPORT ~GEOMAlgo_ClsfSurf(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +Handle_Geom_Surface myS; +GeomAdaptor_Surface myGAS; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.ixx new file mode 100644 index 000000000..dadf131a0 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.ixx @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +//GEOMAlgo_ClsfSurf::~GEOMAlgo_ClsfSurf() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfSurf_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); + static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfSurf", + sizeof(GEOMAlgo_ClsfSurf), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_ClsfSurf) Handle(GEOMAlgo_ClsfSurf)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_ClsfSurf) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfSurf))) { + _anOtherObject = Handle(GEOMAlgo_ClsfSurf)((Handle(GEOMAlgo_ClsfSurf)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_ClsfSurf::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_ClsfSurf) ; +} +//Standard_Boolean GEOMAlgo_ClsfSurf::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_ClsfSurf) == AType || GEOMAlgo_Clsf::IsKind(AType)); +//} +//Handle_GEOMAlgo_ClsfSurf::~Handle_GEOMAlgo_ClsfSurf() {} + diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.jxx new file mode 100644 index 000000000..6d8048bd8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _Geom_Curve_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ClsfSurf_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx index 6a8f33bb4..98f4afe30 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx @@ -67,12 +67,13 @@ #include #include -#include -#include -#include + #include #include +#include +#include +#include //======================================================================= //function : GEOMAlgo_FinderShapeOn1 @@ -529,8 +530,7 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, { myErrorStatus=0; // - Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNbMax, aNb; - Standard_Integer iCnt, *pIds; + Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNb, iCnt;//, aNbMax, *pIds; TopLoc_Location aLoc; Handle(Poly_Triangulation) aTRF; TColStd_MapOfInteger aMBN; @@ -578,12 +578,20 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, iCnt=aIt.Value(); if (iCnt==1) { const GEOMAlgo_PassKey& aPK=aIt.Key(); + //qf + /* aNbMax=aPK.NbMax(); pIds=(Standard_Integer*)aPK.Key(); for (k=1; k<3; ++k) { aNx=*(pIds+aNbMax-k); aMBN.Add(aNx); } + */ + aNx=(Standard_Integer)aPK.Id(1); + aMBN.Add(aNx); + aNx=(Standard_Integer)aPK.Id(2); + aMBN.Add(aNx); + //qt } } // @@ -620,10 +628,17 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, // take the first having occured inner link // and discretize it const GEOMAlgo_PassKey& aPK=aIt.Key(); + //qf + /* aNbMax=aPK.NbMax(); pIds=(Standard_Integer*)aPK.Key(); aN1=*(pIds+aNbMax-1); aN2=*(pIds+aNbMax-2); + */ + // + aN1=(Standard_Integer)aPK.Id(1); + aN2=(Standard_Integer)aPK.Id(2); + //qt aP1=aNodes(aN1).Transformed(aTrsf); aP2=aNodes(aN2).Transformed(aTrsf); // diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cdl new file mode 100644 index 000000000..c0a1b9253 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cdl @@ -0,0 +1,138 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: GEOMAlgo_FinderShapeOn1.cdl +-- Created: Fri Mar 4 10:26:54 2005 +-- Author: Peter KURNEV +-- + + +class FinderShapeOn2 from GEOMAlgo + inherits ShapeAlgo from GEOMAlgo + + ---Purpose: + +uses + Pnt from gp, + ShapeEnum from TopAbs, + State from TopAbs, + Face from TopoDS, + Edge from TopoDS, + ListOfShape from TopTools, + + State from GEOMAlgo, + ListOfPnt from GEOMAlgo, + IndexedDataMapOfShapeState from GEOMAlgo, + Clsf from GEOMAlgo + +--raises + +is + Create + returns FinderShapeOn2 from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn2();" + + SetClsf(me:out; + aClsf:Clsf from GEOMAlgo); + + Clsf(me) + returns Clsf from GEOMAlgo; + ---C++: return const & + + SetShapeType(me:out; + aST:ShapeEnum from TopAbs); + + ShapeType(me) + returns ShapeEnum from TopAbs; + + SetState(me:out; + aSF:State from GEOMAlgo); + + State(me) + returns State from GEOMAlgo; + + SetNbPntsMin(me:out; + aNb:Integer from Standard); + + NbPntsMin(me) + returns Integer from Standard; + + SetNbPntsMax(me:out; + aNb:Integer from Standard); + + NbPntsMax(me) + returns Integer from Standard; + + Perform(me:out) + is redefined; + + Shapes(me) + returns ListOfShape from TopTools; + ---C++: return const & + -- + -- protected methods + -- + CheckData(me:out) + is redefined protected; + + ProcessVertices(me:out) + is protected; + + ProcessEdges(me:out) + is protected; + + ProcessFaces(me:out) + is protected; + + ProcessSolids(me:out) + is protected; + + InnerPoints(me:out; + aF :Face from TopoDS; + aLP:out ListOfPnt from GEOMAlgo) + is protected; + + InnerPoints(me:out; + aE :Edge from TopoDS; + aLP:out ListOfPnt from GEOMAlgo) + is protected; + + InnerPoints(me:out; + aE :Edge from TopoDS; + aNbPnts: Integer from Standard; + aLP:out ListOfPnt from GEOMAlgo) + is protected; + + MSS (me) + returns IndexedDataMapOfShapeState from GEOMAlgo; + ---C++:return const & + + +fields + myShapeType : ShapeEnum from TopAbs is protected; + myState : State from GEOMAlgo is protected; + myNbPntsMin : Integer from Standard is protected; + myNbPntsMax : Integer from Standard is protected; + myClsf : Clsf from GEOMAlgo is protected; + -- + myLS : ListOfShape from TopTools is protected; + -- + myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; + +end FinderShapeOn2; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx new file mode 100644 index 000000000..8a386d0b8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx @@ -0,0 +1,821 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_FinderShapeOn1.cxx +// Created: Fri Mar 4 10:31:06 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 + +//======================================================================= +//function : GEOMAlgo_FinderShapeOn1 +//purpose : +//======================================================================= + GEOMAlgo_FinderShapeOn2::GEOMAlgo_FinderShapeOn2() +: + GEOMAlgo_ShapeAlgo() +{ + myTolerance=0.0001; + myShapeType=TopAbs_VERTEX; + myState=GEOMAlgo_ST_UNKNOWN; + myNbPntsMin=3; + myNbPntsMax=0; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_FinderShapeOn2::~GEOMAlgo_FinderShapeOn2() +{ +} +//======================================================================= +//function : SetClsf +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf) +{ + myClsf=aClsf; +} +//======================================================================= +//function : Clsf +//purpose : +//======================================================================= + const Handle(GEOMAlgo_Clsf)& GEOMAlgo_FinderShapeOn2::Clsf() const +{ + return myClsf; +} +//======================================================================= +//function : SetShapeType +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::SetShapeType(const TopAbs_ShapeEnum aType) +{ + myShapeType=aType; +} +//======================================================================= +//function : ShapeType +//purpose : +//======================================================================= + TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn2::ShapeType()const +{ + return myShapeType; +} +//======================================================================= +//function : SetState +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::SetState(const GEOMAlgo_State aState) +{ + myState=aState; +} +//======================================================================= +//function : State +//purpose : +//======================================================================= + GEOMAlgo_State GEOMAlgo_FinderShapeOn2::State() const +{ + return myState; +} +//======================================================================= +//function : SetNbPntsMin +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::SetNbPntsMin(const Standard_Integer aNb) +{ + myNbPntsMin=aNb; +} +//======================================================================= +//function : NbPntsMin +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMin()const +{ + return myNbPntsMin; +} +//======================================================================= +//function : SetNbPntsMax +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::SetNbPntsMax(const Standard_Integer aNb) +{ + myNbPntsMax=aNb; +} +//======================================================================= +//function : NbPntsMax +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMax()const +{ + return myNbPntsMax; +} +//======================================================================= +// function: MSS +// purpose: +//======================================================================= + const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn2::MSS() const +{ + return myMSS; +} +//======================================================================= +// function: Shapes +// purpose: +//======================================================================= + const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn2::Shapes() const +{ + Standard_Integer i, aNb; + 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); + if (aS.ShapeType()==myShapeType) { + pL->Append(aS); + } + } + return myLS; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + myLS.Clear(); + myMSS.Clear(); + // + CheckData(); + if(myErrorStatus) { + return; + } + // + myClsf->SetTolerance(myTolerance); + // + // 1 + ProcessVertices(); + if(myErrorStatus) { + return; + } + if (myShapeType==TopAbs_VERTEX) { + return; + } + // + // 2 + ProcessEdges(); + if(myErrorStatus) { + return; + } + if (myShapeType==TopAbs_EDGE) { + return; + } + // + // 3 + ProcessFaces(); + if(myErrorStatus) { + return; + } + if (myShapeType==TopAbs_FACE) { + return; + } + // + // 4 + ProcessSolids(); + // +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::CheckData() +{ + Standard_Integer iErr; + // + myErrorStatus=0; + // + if(myClsf.IsNull()) { + myErrorStatus=10; // myClsf=NULL + return; + } + // + myClsf->CheckData(); + iErr=myClsf->ErrorStatus(); + if (iErr) { + myErrorStatus=41; // invalid data for classifier + 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 : ProcessVertices +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::ProcessVertices() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState; + Standard_Integer i, aNb, iErr; + gp_Pnt aP; + TopTools_IndexedMapOfShape aM; + TopAbs_State aSt; + // + TopExp::MapShapes(myShape, TopAbs_VERTEX, aM); + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aM(i)); + aP=BRep_Tool::Pnt(aV); + // + myClsf->SetPnt(aP); + myClsf->Perform(); + iErr=myClsf->ErrorStatus(); + if (iErr) { + myErrorStatus=40; // point can not be classified + return; + } + // + aSt=myClsf->State(); + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + // + if (myShapeType==TopAbs_VERTEX){ + if (bIsConformState) { + myMSS.Add(aV, aSt); + } + } + else if (bIsConformState || aSt==TopAbs_ON) { + myMSS.Add(aV, aSt); + } + } +} +//======================================================================= +//function : ProcessEdges +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::ProcessEdges() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState, bIsToBreak; + Standard_Integer i, aNb, iCnt, iErr; + TopAbs_State aSt; + TopTools_IndexedMapOfShape aM; + TopExp_Explorer aExp; + GEOMAlgo_ListIteratorOfListOfPnt aIt; + // + TopExp::MapShapes(myShape, TopAbs_EDGE, aM); + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + GEOMAlgo_ListOfPnt aLP; + GEOMAlgo_StateCollector aSC; + // + const TopoDS_Edge& aE=TopoDS::Edge(aM(i)); + // + aExp.Init(aE, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aV=aExp.Current(); + // + bIsConformState=myMSS.Contains(aV); + if (!bIsConformState) { + break;// vertex has non-conformed state + } + else { + aSt=myMSS.FindFromKey(aV); + aSC.AppendState(aSt); + } + } + // + if (!bIsConformState) { + continue; // vertex has non-conformed state,skip edge + } + // + if (BRep_Tool::Degenerated(aE)) { + myMSS.Add(aE, aSt); + continue; + } + // + if (myState==GEOMAlgo_ST_ON) { + Standard_Boolean bCanBeON; + Standard_Real aT1, aT2; + Handle(Geom_Curve) aC; + // + aC=BRep_Tool::Curve(aE, aT1, aT2); + bCanBeON=myClsf->CanBeON(aC); + if(!bCanBeON) { + continue; + } + } + // + InnerPoints(aE, aLP); + if (myErrorStatus) { + return; + } + // + bIsConformState=Standard_True; + aIt.Initialize(aLP); + for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { + if (myNbPntsMax) { + if (iCnt > myNbPntsMax) { + break; + } + } + // + const gp_Pnt& aP=aIt.Value(); + // + myClsf->SetPnt(aP); + myClsf->Perform(); + iErr=myClsf->ErrorStatus(); + if (iErr) { + myErrorStatus=40; // point can not be classified + return; + } + // + aSt=myClsf->State(); + // + bIsToBreak=aSC.AppendState(aSt); + if (bIsToBreak) { + break; + } + } + // + aSt=aSC.State(); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (myShapeType==TopAbs_EDGE) { + if (bIsConformState) { + myMSS.Add(aE, aSt); + } + } + else if (bIsConformState || aSt==TopAbs_ON) { + myMSS.Add(aE, aSt); + } + } // for (i=1; i<=aNb; ++i) next edge +} +//======================================================================= +//function : ProcessFaces +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::ProcessFaces() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState, bIsToBreak, bCanBeON; + Standard_Integer i, aNbF, iCnt, iErr; + TopAbs_State aSt; + TopTools_IndexedMapOfShape aM; + TopExp_Explorer aExp; + GEOMAlgo_ListIteratorOfListOfPnt aIt; + // + TopExp::MapShapes(myShape, TopAbs_FACE, aM); + aNbF=aM.Extent(); + for (i=1; i<=aNbF; ++i) { + GEOMAlgo_StateCollector aSC; + GEOMAlgo_ListOfPnt aLP; + // + const TopoDS_Face& aF=TopoDS::Face(aM(i)); + // + if (myState==GEOMAlgo_ST_ON) { + Handle(Geom_Surface) aS; + // + aS=BRep_Tool::Surface(aF); + bCanBeON=myClsf->CanBeON(aS); + if(!bCanBeON) { + continue; + } + } + // + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aE=aExp.Current(); + bIsConformState=myMSS.Contains(aE); + if (!bIsConformState) { + break;// edge has non-conformed state + } + else { + aSt=myMSS.FindFromKey(aE); + aSC.AppendState(aSt); + } + } + // + if (!bIsConformState) { + continue; // edge has non-conformed state,skip face + } + // + InnerPoints(aF, aLP); + if (myErrorStatus) { + return; + } + // + bIsConformState=Standard_True; + aIt.Initialize(aLP); + for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { + if (myNbPntsMax) { + if (iCnt > myNbPntsMax) { + break; + } + } + // + const gp_Pnt& aP=aIt.Value(); + // + myClsf->SetPnt(aP); + myClsf->Perform(); + iErr=myClsf->ErrorStatus(); + if (iErr) { + myErrorStatus=40; // point can not be classified + return; + } + // + aSt=myClsf->State(); + // + bIsToBreak=aSC.AppendState(aSt); + if (bIsToBreak) { + break; + } + } + // + aSt=aSC.State(); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (myShapeType==TopAbs_FACE) { + if (bIsConformState) { + myMSS.Add(aF, aSt); + } + } + else if (bIsConformState || aSt==TopAbs_ON) { + myMSS.Add(aF, aSt); + } + }// for (i=1; i<=aNb; ++i) next face +} +//======================================================================= +//function : ProcessSolids +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::ProcessSolids() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState; + Standard_Integer i, aNbS, j, aNbF; + TopTools_IndexedMapOfShape aM, aMF; + TopAbs_State aSt; + // + TopExp::MapShapes(myShape, TopAbs_SOLID, aM); + aNbS=aM.Extent(); + for (i=1; i<=aNbS; ++i) { + GEOMAlgo_StateCollector aSC; + // + const TopoDS_Shape& aSd=aM(i); + aMF.Clear(); + TopExp::MapShapes(aSd, TopAbs_FACE, aMF); + aNbF=aMF.Extent(); + for (j=1; j<=aNbF; ++j) { + const TopoDS_Shape& aF=aMF(j); + bIsConformState=myMSS.Contains(aF); + if (!bIsConformState) { + break;// face has non-conformed state + } + else { + aSt=myMSS.FindFromKey(aF); + aSC.AppendState(aSt); + } + } + // + if (!bIsConformState) { + continue; // face has non-conformed state,skip solid + } + // + aSt=aSC.State(); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (bIsConformState) { + myMSS.Add(aSd, aSt); + } + } +} +// +//======================================================================= +//function : InnerPoints +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Face& aF, + GEOMAlgo_ListOfPnt& aLP) +{ + myErrorStatus=0; + // + Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNb, iCnt;//, aNbMax, *pIds; + TopLoc_Location aLoc; + Handle(Poly_Triangulation) aTRF; + TColStd_MapOfInteger aMBN; + GEOMAlgo_DataMapOfPassKeyInteger aMPKI; + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger aIt; + gp_Pnt aP, aP1, aP2; + // + aLP.Clear(); + // + aTRF=BRep_Tool::Triangulation(aF, aLoc); + if (aTRF.IsNull()) { + myErrorStatus=20; // no triangulation found + return; + } + // + const gp_Trsf& aTrsf=aLoc.Transformation(); + const Poly_Array1OfTriangle& aTrs=aTRF->Triangles(); + const TColgp_Array1OfPnt& aNodes=aTRF->Nodes(); + // + // map link/nbtriangles + j1=aTrs.Lower(); + j2=aTrs.Upper(); + for (j=j1; j<=j2; ++j) { + const Poly_Triangle& aTr=aTrs(j); + aTr.Get(n[0], n[1], n[2]); + n[3]=n[0]; + for (k=0; k<3; ++k) { + GEOMAlgo_PassKey aPK; + // + aPK.SetIds(n[k], n[k+1]); + if (aMPKI.IsBound(aPK)) { + Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); + ++iCntX; + } + else { + aMPKI.Bind(aPK, 1); + } + } + } + // + // boundary nodes aMBN + aNbLinks=aMPKI.Extent(); + aIt.Initialize(aMPKI); + for (; aIt.More(); aIt.Next()) { + iCnt=aIt.Value(); + if (iCnt==1) { + const GEOMAlgo_PassKey& aPK=aIt.Key(); + //qf + /* + aNbMax=aPK.NbMax(); + pIds=(Standard_Integer*)aPK.Key(); + for (k=1; k<3; ++k) { + aNx=*(pIds+aNbMax-k); + aMBN.Add(aNx); + } + */ + aNx=(Standard_Integer)aPK.Id(1); + aMBN.Add(aNx); + aNx=(Standard_Integer)aPK.Id(2); + aMBN.Add(aNx); + //qt + } + } + // + // inner nodes=all_nodes - boundary_nodes + j1=aNodes.Lower(); + j2=aNodes.Upper(); + for (j=j1; j<=j2; ++j) { + if (!aMBN.Contains(j)) { + aP=aNodes(j).Transformed(aTrsf); + aLP.Append(aP); + } + } + // + aNb=aLP.Extent(); + // + if (!aNb && myNbPntsMin) { + // try to fill it yourself + Standard_Boolean bIsDone; + Standard_Integer aN1, aN2; + Handle(Geom_Surface) aS; + GeomAdaptor_Surface aGAS; + GeomAbs_SurfaceType aType; + // + aS=BRep_Tool::Surface(aF); + aGAS.Load(aS); + aType=aGAS.GetType(); + if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) { + // inner links + aNbLinks=aMPKI.Extent(); + aIt.Initialize(aMPKI); + for (; aIt.More(); aIt.Next()) { + iCnt=aIt.Value(); + if (iCnt>1) { + // take the first having occured inner link + // and discretize it + const GEOMAlgo_PassKey& aPK=aIt.Key(); + //qf + /* + aNbMax=aPK.NbMax(); + pIds=(Standard_Integer*)aPK.Key(); + aN1=*(pIds+aNbMax-1); + aN2=*(pIds+aNbMax-2); + */ + // + aN1=(Standard_Integer)aPK.Id(1); + aN2=(Standard_Integer)aPK.Id(2); + //qt + aP1=aNodes(aN1).Transformed(aTrsf); + aP2=aNodes(aN2).Transformed(aTrsf); + // + if (aType==GeomAbs_Cylinder) { + Standard_Real aTolSM; + gp_Cylinder aCyl; + // + aTolSM=1.523e-6;//~1.-cos(0.1 deg) + aCyl=aGAS.Cylinder(); + if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { + continue; + } + } + // + BRepLib_MakeEdge aBME(aP1, aP2); + bIsDone=aBME.IsDone(); + if (!bIsDone) { + myErrorStatus=30; //can not obtain the line fron the link + return; + } + // + const TopoDS_Shape& aSx=aBME.Shape(); + const TopoDS_Edge& aE=TopoDS::Edge(aSx); + // + InnerPoints(aE, myNbPntsMin, aLP); + break; + }// if (iCnt>1) + }// for (; aIt.More(); aIt.Next()) + }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) + }// if (!aNb && myNbPntsMin) { +} +//======================================================================= +//function : InnerPoints +//purpose : +//======================================================================= + void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE, + GEOMAlgo_ListOfPnt& aLP) +{ + myErrorStatus=0; + // + Standard_Integer j, aNbNodes, aIndex, aNb; + Handle(Poly_PolygonOnTriangulation) aPTE; + Handle(Poly_Triangulation) aTRE; + TopLoc_Location aLoc; + gp_Pnt aP; + // + aLP.Clear(); + BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc); + if (aTRE.IsNull() || aPTE.IsNull()) { + myErrorStatus=20; // no triangulation found + return; + } + // + const gp_Trsf& aTrsf=aLoc.Transformation(); + const TColgp_Array1OfPnt& aNodes=aTRE->Nodes(); + // + aNbNodes=aPTE->NbNodes(); + const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); + for (j=2; jD0(aT, aP); + aLP.Append(aP); + } +} + +// +// myErrorStatus : +// +// 10 -myClsf=NULL +// 11 -myShape=NULL +// 12 -unallowed type of subshapes +// 13 -unallowed state +// 15 -unallowed surface type +// 20- no triangulation found +// 30- can not obtain the line from the link +// 40- point can not be classified +// 41- invalid data for classifier + diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx new file mode 100644 index 000000000..1d467a51e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx @@ -0,0 +1,187 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_FinderShapeOn2_HeaderFile +#define _GEOMAlgo_FinderShapeOn2_HeaderFile + +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_State_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile +#include +#endif +class GEOMAlgo_Clsf; +class TopTools_ListOfShape; +class TopoDS_Face; +class GEOMAlgo_ListOfPnt; +class TopoDS_Edge; +class GEOMAlgo_IndexedDataMapOfShapeState; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_FinderShapeOn2 : 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_FinderShapeOn2(); +Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn2(); + + +Standard_EXPORT void SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf) ; + + +Standard_EXPORT const Handle_GEOMAlgo_Clsf& Clsf() const; + + +Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ; + + +Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; + + +Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ; + + +Standard_EXPORT GEOMAlgo_State State() const; + + +Standard_EXPORT void SetNbPntsMin(const Standard_Integer aNb) ; + + +Standard_EXPORT Standard_Integer NbPntsMin() const; + + +Standard_EXPORT void SetNbPntsMax(const Standard_Integer aNb) ; + + +Standard_EXPORT Standard_Integer NbPntsMax() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT const TopTools_ListOfShape& Shapes() const; + + +Standard_EXPORT const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void CheckData() ; + + +Standard_EXPORT void ProcessVertices() ; + + +Standard_EXPORT void ProcessEdges() ; + + +Standard_EXPORT void ProcessFaces() ; + + +Standard_EXPORT void ProcessSolids() ; + + +Standard_EXPORT void InnerPoints(const TopoDS_Face& aF,GEOMAlgo_ListOfPnt& aLP) ; + + +Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,GEOMAlgo_ListOfPnt& aLP) ; + + +Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,const Standard_Integer aNbPnts,GEOMAlgo_ListOfPnt& aLP) ; + + + // Fields PROTECTED + // +TopAbs_ShapeEnum myShapeType; +GEOMAlgo_State myState; +Standard_Integer myNbPntsMin; +Standard_Integer myNbPntsMax; +Handle_GEOMAlgo_Clsf myClsf; +TopTools_ListOfShape myLS; +GEOMAlgo_IndexedDataMapOfShapeState myMSS; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.ixx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.ixx new file mode 100644 index 000000000..9e17577cf --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.jxx new file mode 100644 index 000000000..62172c460 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.jxx @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_Clsf_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ListOfPnt_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_FinderShapeOn2_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl index 26fadda0a..97dd6f476 100644 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl @@ -21,7 +21,6 @@ -- Created: Wed Dec 15 11:03:03 2004 -- Author: Peter KURNEV -- ----Copyright: Matra Datavision 2004 class GlueAnalyser from GEOMAlgo diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx index b8aff7294..e38911f5b 100644 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx @@ -270,7 +270,7 @@ for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aS=aMF(i); // - aPKF.Clear(); + //aPKF.Clear();//qft if (aType==TopAbs_FACE) { const TopoDS_Face& aF=TopoDS::Face(aS); FacePassKey(aF, aPKF); @@ -341,9 +341,10 @@ TopTools_IndexedDataMapOfShapeListOfShape aMFS; TopTools_IndexedMapOfShape aMx, aMS; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + GEOMAlgo_CoupleOfShapes aCS; + // GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLS; GEOMAlgo_PassKeyShape aPKSx; - GEOMAlgo_CoupleOfShapes aCS; // aBB.MakeCompound(aCmp); // @@ -383,8 +384,11 @@ continue; } // - aPKSx.Clear(); - aPKSx.SetIds(aSx[0], aSx[1]); + //aPKSx.Clear();//qft + //qf + //aPKSx.SetIds(aSx[0], aSx[1]); + aPKSx.SetShapes(aSx[0], aSx[1]); + //qt // if (!aMPKLS.Contains(aPKSx)) { TopTools_ListOfShape aLSx; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cdl b/src/GEOMAlgo/GEOMAlgo_Gluer.cdl index 9b213cb3e..fe629e68b 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cdl @@ -21,7 +21,6 @@ -- Created: Sat Dec 04 12:41:32 2004 -- Author: Peter KURNEV -- ----Copyright: Matra Datavision 2004 class Gluer from GEOMAlgo @@ -106,12 +105,12 @@ is EdgePassKey(me:out; aE:Edge from TopoDS; - aPK:out PassKeyShape from GEOMAlgo) + aPK:out PassKeyShape from GEOMAlgo) is protected; FacePassKey(me:out; aF:Face from TopoDS; - aPK:out PassKeyShape from GEOMAlgo) + aPK:out PassKeyShape from GEOMAlgo) is protected; MakeVertex(me:out; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index 1e6d31e6b..cb2b0d424 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -77,8 +77,8 @@ #include #include -#include -#include +#include //qft +#include //qft #include // @@ -424,8 +424,8 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) TopoDS_Shape aNewShape; TopTools_IndexedMapOfShape aMF; TopTools_ListIteratorOfListOfShape aItS; - GEOMAlgo_PassKeyShape aPKF; - GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; + GEOMAlgo_PassKeyShape aPKF;//qft + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;//qft // TopExp::MapShapes(myShape, aType, aMF); // @@ -433,7 +433,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aS=aMF(i); // - aPKF.Clear(); + //aPKF.Clear();//qft if (aType==TopAbs_FACE) { const TopoDS_Face& aF=TopoDS::Face(aS); FacePassKey(aF, aPKF); @@ -622,17 +622,21 @@ void GEOMAlgo_Gluer::InnerTolerance() void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, GEOMAlgo_PassKeyShape& aPK) { - Standard_Integer i, aNbE, aNbMax; + Standard_Integer i, aNbE;//, aNbMax;//qft TopTools_ListOfShape aLE; TopTools_IndexedMapOfShape aME; // TopExp::MapShapes(aF, TopAbs_EDGE, aME); aNbE=aME.Extent(); + //qf + /* aNbMax=aPK.NbMax(); if (!aNbE || aNbE>aNbMax) { - myErrorStatus=101; // temprorary - return; + myErrorStatus=101; // temprorary + return; } + */ + //qt // for (i=1; i<=aNbE; ++i) { const TopoDS_Shape& aE=aME(i); @@ -643,7 +647,10 @@ void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, const TopoDS_Shape& aER=myOrigins.Find(aE); aLE.Append(aER); } - aPK.SetIds(aLE); + //qf + //aPK.SetIds(aLE); + aPK.SetShapes(aLE); + //qt } //======================================================================= //function : EdgePassKey @@ -662,7 +669,10 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, } const TopoDS_Shape& aVR1=myOrigins.Find(aV1); const TopoDS_Shape& aVR2=myOrigins.Find(aV2); - aPK.SetIds(aVR1, aVR2); + //qf + //aPK.SetIds(aVR1, aVR2); + aPK.SetShapes(aVR1, aVR2); + //qt } //======================================================================= //function : MakeVertex diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.cdl b/src/GEOMAlgo/GEOMAlgo_HAlgo.cdl new file mode 100644 index 000000000..0da634889 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.cdl @@ -0,0 +1,57 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: GEOMAlgo_Algo.cdl +-- Created: Sat Dec 04 12:37:56 2004 +-- Author: Peter KURNEV +-- + + +deferred class HAlgo from GEOMAlgo + inherits TShared from MMgt + ---Purpose: + +--uses +--raises + +is + Initialize + returns mutable HAlgo from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_HAlgo();" + + Perform(me:mutable) + is deferred; + + CheckData(me:mutable) + is virtual; + + CheckResult(me:mutable) + is virtual; + + ErrorStatus (me) + returns Integer from Standard; + + WarningStatus (me) + returns Integer from Standard; + +fields + myErrorStatus : Integer from Standard is protected; + myWarningStatus : Integer from Standard is protected; + +end HAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx new file mode 100644 index 000000000..807929c73 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx @@ -0,0 +1,78 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_Algo.cxx +// Created: Sat Dec 04 12:39:47 2004 +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +// function: +// purpose: +//======================================================================= + GEOMAlgo_HAlgo::GEOMAlgo_HAlgo() +: + myErrorStatus(1), + myWarningStatus(0) +{} +//======================================================================= +// function: ~ +// purpose: +//======================================================================= + GEOMAlgo_HAlgo::~GEOMAlgo_HAlgo() +{ +} +//======================================================================= +// function: CheckData +// purpose: +//======================================================================= + void GEOMAlgo_HAlgo::CheckData() +{ + myErrorStatus=0; +} +//======================================================================= +// function: CheckResult +// purpose: +//======================================================================= + void GEOMAlgo_HAlgo::CheckResult() +{ + myErrorStatus=0; +} +//======================================================================= +// function: ErrorStatus +// purpose: +//======================================================================= + Standard_Integer GEOMAlgo_HAlgo::ErrorStatus()const +{ + return myErrorStatus; +} +//======================================================================= +// function: WarningStatus +// purpose: +//======================================================================= + Standard_Integer GEOMAlgo_HAlgo::WarningStatus()const +{ + return myWarningStatus; +} +// myErrorStatus +// +// 1 - object is just initialized diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx b/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx new file mode 100644 index 000000000..0f25b53de --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx @@ -0,0 +1,105 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_HAlgo_HeaderFile +#define _GEOMAlgo_HAlgo_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_HAlgo_HeaderFile +#include +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif + + + +class GEOMAlgo_HAlgo : public MMgt_TShared { + +public: + // Methods PUBLIC + // + + +Standard_EXPORT virtual void Perform() = 0; + + +Standard_EXPORT virtual void CheckData() ; + + +Standard_EXPORT virtual void CheckResult() ; + + +Standard_EXPORT Standard_Integer ErrorStatus() const; + + +Standard_EXPORT Standard_Integer WarningStatus() const; +//Standard_EXPORT ~GEOMAlgo_HAlgo(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT GEOMAlgo_HAlgo(); +Standard_EXPORT virtual ~GEOMAlgo_HAlgo(); + + + // Fields PROTECTED + // +Standard_Integer myErrorStatus; +Standard_Integer myWarningStatus; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.ixx b/src/GEOMAlgo/GEOMAlgo_HAlgo.ixx new file mode 100644 index 000000000..96a32edb8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.ixx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +//GEOMAlgo_HAlgo::~GEOMAlgo_HAlgo() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_HAlgo_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_HAlgo", + sizeof(GEOMAlgo_HAlgo), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_HAlgo) Handle(GEOMAlgo_HAlgo)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_HAlgo) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_HAlgo))) { + _anOtherObject = Handle(GEOMAlgo_HAlgo)((Handle(GEOMAlgo_HAlgo)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_HAlgo::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_HAlgo) ; +} +//Standard_Boolean GEOMAlgo_HAlgo::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_HAlgo) == AType || MMgt_TShared::IsKind(AType)); +//} +//Handle_GEOMAlgo_HAlgo::~Handle_GEOMAlgo_HAlgo() {} + diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.jxx b/src/GEOMAlgo/GEOMAlgo_HAlgo.jxx new file mode 100644 index 000000000..e6d20409d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_HAlgo_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx index 4d5556d0d..ce1a5003a 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx @@ -44,7 +44,7 @@ #endif class GEOMAlgo_PassKeyShape; class TopTools_ListOfShape; -class GEOMAlgo_PassKeyMapHasher; +class GEOMAlgo_PassKeyShapeMapHasher; class GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; @@ -104,8 +104,8 @@ TCollection_MapNodePtr myNext2; #define TheKey_hxx #define TheItem TopTools_ListOfShape #define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx #define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape #define TCollection_IndexedDataMapNode_hxx #define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx index dbdb8ae8a..ddacd8762 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx @@ -29,8 +29,8 @@ #ifndef _TopTools_ListOfShape_HeaderFile #include #endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include #endif #ifndef _GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile #include @@ -86,8 +86,8 @@ const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKe #define TheKey_hxx #define TheItem TopTools_ListOfShape #define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx #define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape #define TCollection_IndexedDataMapNode_hxx #define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx index df92465d1..b27ee9a81 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx @@ -37,7 +37,7 @@ class Standard_OutOfRange; class Standard_NoSuchObject; class GEOMAlgo_PassKeyShape; class TopTools_ListOfShape; -class GEOMAlgo_PassKeyMapHasher; +class GEOMAlgo_PassKeyShapeMapHasher; class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape; diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx index cbd20e4f0..ccd40ac28 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx @@ -34,8 +34,8 @@ #ifndef _TopTools_ListOfShape_HeaderFile #include #endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include #endif #ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile #include @@ -46,8 +46,8 @@ #define TheKey_hxx #define TheItem TopTools_ListOfShape #define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx #define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape #define TCollection_IndexedDataMapNode_hxx #define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.cdl b/src/GEOMAlgo/GEOMAlgo_PassKey.cdl index 91aa09751..8b84345a4 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.cdl +++ b/src/GEOMAlgo/GEOMAlgo_PassKey.cdl @@ -16,12 +16,11 @@ -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- +-- -- File: GEOMAlgo_PassKey.cdl --- Created: +-- Created: Mon Nov 20 12:16:13 2006 -- Author: Peter KURNEV -- ----Copyright: class PassKey from GEOMAlgo @@ -30,25 +29,32 @@ class PassKey from GEOMAlgo uses Shape from TopoDS, - ListOfInteger from TColStd - + IndexedMapOfInteger from TColStd, + ListOfInteger from TColStd + --raises is Create returns PassKey from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_PassKey();" + + Create(Other:PassKey from GEOMAlgo) + returns PassKey from GEOMAlgo; Assign(me:out; Other : PassKey from GEOMAlgo) returns PassKey from GEOMAlgo; ---C++: alias operator = ---C++: return & + + Clear(me:out); -- SetIds(me:out; aI1 :Integer from Standard); SetIds(me:out; - aI1 :Integer from Standard; + aI1 :Integer from Standard; aI2 :Integer from Standard); SetIds(me:out; @@ -64,20 +70,13 @@ is SetIds(me:out; aLS :ListOfInteger from TColStd); - - NbMax(me) + + NbIds(me) returns Integer from Standard; - - Clear(me:out); - - Compute(me:out); IsEqual(me; aOther:PassKey from GEOMAlgo) returns Boolean from Standard; - - Key(me) - returns Address from Standard; HashCode(me; Upper : Integer from Standard) @@ -85,16 +84,16 @@ is Id(me; aIndex: Integer from Standard) - returns Integer from Standard; + returns Integer from Standard; - Dump(me); - + Dump(me; + aHex:Integer from Standard=0); + + fields - myNbIds: Integer from Standard is protected; - myNbMax: Integer from Standard is protected; - mySum : Integer from Standard is protected; - myIds : Integer from Standard [8] is protected; + mySum : Integer from Standard is protected; + myMap : IndexedMapOfInteger from TColStd is protected; end PassKey; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.cxx b/src/GEOMAlgo/GEOMAlgo_PassKey.cxx index f38e29f60..342a116f2 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKey.cxx @@ -17,10 +17,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_PassKey.cxx -// Created: +// +// File: GEOMAlgo_Algo.cxx +// Created: Sat Dec 04 12:39:47 2004 // Author: Peter KURNEV -// +// #include @@ -28,13 +29,12 @@ #include #include #include +#include #ifdef WNT #pragma warning( disable : 4101) #endif -static - void SortShell(const int n, int* a); static Standard_Integer NormalizedId(const Standard_Integer aId, const Standard_Integer aDiv); @@ -45,115 +45,102 @@ static //======================================================================= GEOMAlgo_PassKey::GEOMAlgo_PassKey() { - Clear(); + Clear(); +} +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_PassKey::GEOMAlgo_PassKey(const GEOMAlgo_PassKey& aOther) +{ + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; } //======================================================================= //function :Assign //purpose : //======================================================================= - GEOMAlgo_PassKey& GEOMAlgo_PassKey::Assign(const GEOMAlgo_PassKey& anOther) + GEOMAlgo_PassKey& GEOMAlgo_PassKey::Assign(const GEOMAlgo_PassKey& aOther) { - myNbIds=anOther.myNbIds; - myNbMax=anOther.myNbMax; - mySum=anOther.mySum; - memcpy(myIds, anOther.myIds, sizeof(myIds)); + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; return *this; } //======================================================================= +//function :~ +//purpose : +//======================================================================= + GEOMAlgo_PassKey::~GEOMAlgo_PassKey() +{ +} +//======================================================================= //function :Clear //purpose : //======================================================================= void GEOMAlgo_PassKey::Clear() { - Standard_Integer i; - // myNbIds=0; - myNbMax=8; mySum=0; - for (i=0; i myNbMax) { - return; - } - // - myNbIds=aNb; - mySum=0; - i=myNbMax-myNbIds; + Clear(); aIt.Initialize(aLI); - for (; aIt.More(); aIt.Next(), ++i) { - anId=aIt.Value(); - myIds[i]=anId; - aIdN=NormalizedId(anId, myNbIds); - mySum+=aIdN; + for (; aIt.More(); aIt.Next()) { + aId=aIt.Value(); + myMap.Add(aId); } - // - Compute(); -} -//======================================================================= -//function :Id -//purpose : -//======================================================================= - Standard_Integer GEOMAlgo_PassKey::Id(const Standard_Integer aIndex)const -{ - if (aIndex < 0 || aIndex >= myNbMax) { - return 0; + myNbIds=myMap.Extent(); + for(i=1; i<=myNbIds; ++i) { + aId=myMap(i); + aIdN=NormalizedId(aId, myNbIds); + mySum+=aIdN; } - return myIds[aIndex]; } //======================================================================= -//function :NbMax +//function :NbIds //purpose : //======================================================================= - Standard_Integer GEOMAlgo_PassKey::NbMax()const + Standard_Integer GEOMAlgo_PassKey::NbIds()const { - return myNbMax; + return myNbIds; } //======================================================================= -//function :Compute +//function :Id //purpose : //======================================================================= - void GEOMAlgo_PassKey::Compute() + Standard_Integer GEOMAlgo_PassKey::Id(const Standard_Integer aIndex) const { - SortShell(myNbIds, myIds+myNbMax-myNbIds); + if (aIndex<1 || aIndex>myNbIds) { + return -1; + } + return myMap(aIndex); } //======================================================================= //function :IsEqual //purpose : //======================================================================= - Standard_Boolean GEOMAlgo_PassKey::IsEqual(const GEOMAlgo_PassKey& anOther) const + Standard_Boolean GEOMAlgo_PassKey::IsEqual(const GEOMAlgo_PassKey& aOther) const { - Standard_Integer iIsEqual; - Standard_Boolean bIsEqual; + Standard_Boolean bRet; + Standard_Integer i, aId; // - iIsEqual=memcmp(myIds, anOther.myIds, sizeof(myIds)); - bIsEqual=Standard_False; - if (!iIsEqual) { - bIsEqual=!bIsEqual; + bRet=Standard_False; + // + if (myNbIds!=aOther.myNbIds) { + return bRet; } - return bIsEqual; -} -//======================================================================= -//function :Key -//purpose : -//======================================================================= - Standard_Address GEOMAlgo_PassKey::Key()const -{ - return (Standard_Address)myIds; + for (i=1; i<=myNbIds; ++i) { + aId=myMap(i); + if (!aOther.myMap.Contains(aId)) { + return bRet; + } + } + return !bRet; } //======================================================================= //function : HashCode //purpose : //======================================================================= - Standard_Integer GEOMAlgo_PassKey::HashCode(const Standard_Integer Upper) const + Standard_Integer GEOMAlgo_PassKey::HashCode(const Standard_Integer aUpper) const { - //return (mySum % Upper); - return ::HashCode(mySum, Upper); + return ::HashCode(mySum, aUpper); } //======================================================================= //function : Dump //purpose : //======================================================================= - void GEOMAlgo_PassKey::Dump()const + void GEOMAlgo_PassKey::Dump(const Standard_Integer )const { - Standard_Integer i; - // - printf(" PassKey: {"); - for (i=0; i -1) goto m30; - }//if (a[l] < a[j]){ - }//for (i=0; i #endif +#ifndef _TColStd_IndexedMapOfInteger_HeaderFile +#include +#endif #ifndef _Standard_Boolean_HeaderFile #include #endif -#ifndef _Standard_Address_HeaderFile -#include -#endif class TColStd_ListOfInteger; @@ -61,6 +61,10 @@ public: Standard_EXPORT GEOMAlgo_PassKey(); +Standard_EXPORT virtual ~GEOMAlgo_PassKey(); + + +Standard_EXPORT GEOMAlgo_PassKey(const GEOMAlgo_PassKey& Other); Standard_EXPORT GEOMAlgo_PassKey& Assign(const GEOMAlgo_PassKey& Other) ; @@ -71,6 +75,9 @@ Standard_EXPORT GEOMAlgo_PassKey& Assign(const GEOMAlgo_PassKey& Other) ; +Standard_EXPORT void Clear() ; + + Standard_EXPORT void SetIds(const Standard_Integer aI1) ; @@ -86,28 +93,19 @@ Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer Standard_EXPORT void SetIds(const TColStd_ListOfInteger& aLS) ; -Standard_EXPORT Standard_Integer NbMax() const; - - -Standard_EXPORT void Clear() ; - - -Standard_EXPORT void Compute() ; +Standard_EXPORT Standard_Integer NbIds() const; Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aOther) const; -Standard_EXPORT Standard_Address Key() const; - - Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; Standard_EXPORT Standard_Integer Id(const Standard_Integer aIndex) const; -Standard_EXPORT void Dump() const; +Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; @@ -122,9 +120,8 @@ protected: // Fields PROTECTED // Standard_Integer myNbIds; -Standard_Integer myNbMax; Standard_Integer mySum; -Standard_Integer myIds[8]; +TColStd_IndexedMapOfInteger myMap; private: diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl index 92e4d599b..a0ba022fc 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl @@ -21,7 +21,6 @@ -- Created: -- Author: Peter KURNEV -- ----Copyright: class PassKeyMapHasher from GEOMAlgo diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx index fbd3d81cb..654278f7e 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx @@ -29,17 +29,17 @@ //function : HashCode //purpose : //======================================================================= - Standard_Integer GEOMAlgo_PassKeyMapHasher::HashCode(const GEOMAlgo_PassKey& aPKey, + Standard_Integer GEOMAlgo_PassKeyMapHasher::HashCode(const GEOMAlgo_PassKey& aPK, const Standard_Integer Upper) { - return aPKey.HashCode(Upper); + return aPK.HashCode(Upper); } //======================================================================= //function :IsEqual //purpose : //======================================================================= - Standard_Boolean GEOMAlgo_PassKeyMapHasher::IsEqual(const GEOMAlgo_PassKey& aPKey1, - const GEOMAlgo_PassKey& aPKey2) + Standard_Boolean GEOMAlgo_PassKeyMapHasher::IsEqual(const GEOMAlgo_PassKey& aPK1, + const GEOMAlgo_PassKey& aPK2) { - return aPKey1.IsEqual(aPKey2); + return aPK1.IsEqual(aPK2); } diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl index d5d47c0bd..5215a4de4 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl @@ -21,47 +21,75 @@ -- Created: -- Author: Peter KURNEV -- ----Copyright: class PassKeyShape from GEOMAlgo - inherits PassKey from GEOMAlgo - + ---Purpose: uses Shape from TopoDS, - ListOfShape from TopTools - + ListOfShape from TopTools, + IndexedMapOfShape from TopTools + --raises is Create returns PassKeyShape from GEOMAlgo; - - SetIds(me:out; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_PassKeyShape();" + + Create(Other:PassKeyShape from GEOMAlgo) + returns PassKeyShape from GEOMAlgo; + + Assign(me:out; + Other : PassKeyShape from GEOMAlgo) + returns PassKeyShape from GEOMAlgo; + ---C++: alias operator = + ---C++: return & + + SetShapes(me:out; aS :Shape from TopoDS); - SetIds(me:out; + SetShapes(me:out; aS1 :Shape from TopoDS; aS2 :Shape from TopoDS); - SetIds(me:out; + SetShapes(me:out; aS1 :Shape from TopoDS; aS2 :Shape from TopoDS; aS3 :Shape from TopoDS); - SetIds(me:out; + SetShapes(me:out; aS1 :Shape from TopoDS; aS2 :Shape from TopoDS; aS3 :Shape from TopoDS; aS4 :Shape from TopoDS); - SetIds(me:out; + SetShapes(me:out; aLS :ListOfShape from TopTools); - + + Clear(me:out); + + NbIds(me) + returns Integer from Standard; + + IsEqual(me; + aOther:PassKeyShape from GEOMAlgo) + returns Boolean from Standard; + + HashCode(me; + Upper : Integer from Standard) + returns Integer from Standard; + + Dump(me; + aHex:Integer from Standard=0); + fields - myUpper : Integer from Standard is protected; + myNbIds:Integer from Standard is protected; + mySum :Integer from Standard is protected; + myUpper:Integer from Standard is protected; + myMap :IndexedMapOfShape from TopTools is protected; end PassKeyShape; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx index cd90291c2..df01791ad 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx @@ -25,107 +25,203 @@ #include -#include -#include - +#include #include -#include + +static + Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv); //======================================================================= //function : //purpose : //======================================================================= GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape() -: - GEOMAlgo_PassKey() { myUpper=432123; - GEOMAlgo_PassKey::Clear(); } //======================================================================= -//function :SetIds +//function : +//purpose : +//======================================================================= + GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& aOther) +{ + myUpper=432123; + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; +} +//======================================================================= +//function :~ +//purpose : +//======================================================================= + GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() +{ +} +//======================================================================= +//function :Assign +//purpose : +//======================================================================= + GEOMAlgo_PassKeyShape& GEOMAlgo_PassKeyShape::Assign(const GEOMAlgo_PassKeyShape& aOther) +{ + myUpper=432123; + myNbIds=aOther.myNbIds; + mySum=aOther.mySum; + myMap=aOther.myMap; + return *this; +} +//======================================================================= +//function :Clear //purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1) + void GEOMAlgo_PassKeyShape::Clear() +{ + myNbIds=0; + mySum=0; + myMap.Clear(); +} +//======================================================================= +//function :SetShapes +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1) { - Standard_Integer anId1; + Standard_Integer aHC; // - anId1=aS1.HashCode(myUpper); - GEOMAlgo_PassKey::SetIds(anId1); + Clear(); + myNbIds=1; + myMap.Add(aS1); + aHC=aS1.HashCode(myUpper); + mySum=NormalizedId(aHC, myNbIds); } //======================================================================= -//function :SetIds +//function :SetShapes //purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) + void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) { - Standard_Integer anId1, anId2; + TopTools_ListOfShape aLS; // - anId1=aS1.HashCode(myUpper); - anId2=aS2.HashCode(myUpper); - // - GEOMAlgo_PassKey::SetIds(anId1, anId2); + aLS.Append(aS1); + aLS.Append(aS2); + SetShapes(aLS); } //======================================================================= -//function :SetIds +//function :SetShapes //purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3) + void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) { - Standard_Integer anId1, anId2, anId3; - // - anId1=aS1.HashCode(myUpper); - anId2=aS2.HashCode(myUpper); - anId3=aS3.HashCode(myUpper); + TopTools_ListOfShape aLS; // - GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3); + aLS.Append(aS1); + aLS.Append(aS2); + aLS.Append(aS3); + SetShapes(aLS); } //======================================================================= -//function :SetIds +//function :SetShapes //purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3, - const TopoDS_Shape& aS4) + void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) { - Standard_Integer anId1, anId2, anId3, anId4; + TopTools_ListOfShape aLS; // - anId1=aS1.HashCode(myUpper); - anId2=aS2.HashCode(myUpper); - anId3=aS3.HashCode(myUpper); - anId4=aS4.HashCode(myUpper); - // - GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3, anId4); + aLS.Append(aS1); + aLS.Append(aS2); + aLS.Append(aS3); + aLS.Append(aS4); + SetShapes(aLS); } //======================================================================= -//function :SetIds +//function :SetShapes //purpose : //======================================================================= - void GEOMAlgo_PassKeyShape::SetIds(const TopTools_ListOfShape& aLS) + void GEOMAlgo_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS) { - Standard_Integer anId; + Standard_Integer i, aId, aIdN; TopTools_ListIteratorOfListOfShape aIt; - TColStd_ListOfInteger aLI; - // - //aNb=aLS.Extent(); - //if (aNb<1 || aNb > myNbMax) { - // return; - //} // - //myNbIds=aNb; - //mySum=0; - //i=myNbMax-myNbIds; - + Clear(); aIt.Initialize(aLS); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aS=aIt.Value(); - anId=aS.HashCode(myUpper); - aLI.Append(anId); + myMap.Add(aS); + } + myNbIds=myMap.Extent(); + for(i=1; i<=myNbIds; ++i) { + const TopoDS_Shape& aS=myMap(i); + aId=aS.HashCode(myUpper); + aIdN=NormalizedId(aId, myNbIds); + mySum+=aIdN; + } +} +//======================================================================= +//function :NbIds +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKeyShape::NbIds()const +{ + return myNbIds; +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_PassKeyShape::IsEqual(const GEOMAlgo_PassKeyShape& aOther) const +{ + Standard_Boolean bRet; + Standard_Integer i; + // + bRet=Standard_False; + // + if (myNbIds!=aOther.myNbIds) { + return bRet; + } + for (i=1; i<=myNbIds; ++i) { + const TopoDS_Shape& aS=myMap(i); + if (!aOther.myMap.Contains(aS)) { + return bRet; + } + } + return !bRet; +} +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKeyShape::HashCode(const Standard_Integer aUpper) const +{ + return ::HashCode(mySum, aUpper); +} +//======================================================================= +//function : Dump +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::Dump(const Standard_Integer)const +{ +} +//======================================================================= +// function: NormalizedId +// purpose : +//======================================================================= +Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv) +{ + Standard_Integer aMax, aTresh, aIdRet; + // + aIdRet=aId; + aMax=::IntegerLast(); + aTresh=aMax/aDiv; + if (aId>aTresh) { + aIdRet=aId%aTresh; } - GEOMAlgo_PassKey::SetIds(aLI); + return aIdRet; } diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx index ad06f55c4..d54dd3c0b 100644 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx @@ -23,8 +23,11 @@ #ifndef _Standard_Integer_HeaderFile #include #endif -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include +#ifndef _TopTools_IndexedMapOfShape_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include #endif class TopoDS_Shape; class TopTools_ListOfShape; @@ -38,7 +41,7 @@ class TopTools_ListOfShape; #endif -class GEOMAlgo_PassKeyShape : public GEOMAlgo_PassKey { +class GEOMAlgo_PassKeyShape { public: @@ -59,21 +62,48 @@ public: Standard_EXPORT GEOMAlgo_PassKeyShape(); +Standard_EXPORT virtual ~GEOMAlgo_PassKeyShape(); + + +Standard_EXPORT GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& Other); + + +Standard_EXPORT GEOMAlgo_PassKeyShape& Assign(const GEOMAlgo_PassKeyShape& Other) ; + GEOMAlgo_PassKeyShape& operator =(const GEOMAlgo_PassKeyShape& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3) ; + + +Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3,const TopoDS_Shape& aS4) ; + + +Standard_EXPORT void SetShapes(const TopTools_ListOfShape& aLS) ; -Standard_EXPORT void SetIds(const TopoDS_Shape& aS) ; +Standard_EXPORT void Clear() ; -Standard_EXPORT void SetIds(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; +Standard_EXPORT Standard_Integer NbIds() const; -Standard_EXPORT void SetIds(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3) ; +Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const; -Standard_EXPORT void SetIds(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3,const TopoDS_Shape& aS4) ; +Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; -Standard_EXPORT void SetIds(const TopTools_ListOfShape& aLS) ; +Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; @@ -87,7 +117,10 @@ protected: // Fields PROTECTED // +Standard_Integer myNbIds; +Standard_Integer mySum; Standard_Integer myUpper; +TopTools_IndexedMapOfShape myMap; private: diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cdl new file mode 100644 index 000000000..393b7e78f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cdl @@ -0,0 +1,47 @@ +-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- +-- File: GEOMAlgo_PassKeyMapHasher.cdl +-- Created: +-- Author: Peter KURNEV +-- + + +class PassKeyShapeMapHasher from GEOMAlgo + + ---Purpose: + +uses + PassKeyShape from GEOMAlgo + +--raises + +is + HashCode(myclass; + aPKey : PassKeyShape from GEOMAlgo; + Upper : Integer from Standard) + returns Integer from Standard; + + + IsEqual(myclass; + aPKey1 : PassKeyShape from GEOMAlgo; + aPKey2 : PassKeyShape from GEOMAlgo) + returns Boolean from Standard; + +end PassKeyShapeMapHasher; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx new file mode 100644 index 000000000..70478af43 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKeyShapeMapHasher::HashCode(const GEOMAlgo_PassKeyShape& aPK, + const Standard_Integer Upper) +{ + return aPK.HashCode(Upper); +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_PassKeyShapeMapHasher::IsEqual(const GEOMAlgo_PassKeyShape& aPK1, + const GEOMAlgo_PassKeyShape& aPK2) +{ + return aPK1.IsEqual(aPK2); +} diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx new file mode 100644 index 000000000..53caf6a70 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx @@ -0,0 +1,99 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#define _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class GEOMAlgo_PassKeyShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_PassKeyShapeMapHasher { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey,const Standard_Integer Upper) ; + + +Standard_EXPORT static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1,const GEOMAlgo_PassKeyShape& aPKey2) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.ixx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.ixx new file mode 100644 index 000000000..ae17ce089 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.ixx @@ -0,0 +1,24 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.jxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.jxx new file mode 100644 index 000000000..99130d0ba --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cdl b/src/GEOMAlgo/GEOMAlgo_Tools.cdl index e2c6b1a31..ece735396 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Tools.cdl @@ -21,7 +21,6 @@ -- Created: Mon Dec 6 11:26:02 2004 -- Author: Peter KURNEV -- ----Copyright: Matra Datavision 2004 class Tools from GEOMAlgo @@ -38,7 +37,7 @@ uses ListOfShape from TopTools, IndexedDataMapOfShapeListOfShape from TopTools, Context from IntTools, - IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo + IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo --qft --raises @@ -48,7 +47,7 @@ is returns Boolean from Standard; RefineSDShapes(myclass; - aMSD:out IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo; + aMSD:out IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo; --qft aTol:Real from Standard; aCtx:out Context from IntTools) returns Integer from Standard; diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cxx b/src/GEOMAlgo/GEOMAlgo_Tools.cxx index 5e3991bfe..65250c364 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools.cxx @@ -52,8 +52,8 @@ #include #include -#include -#include +#include //qft +#include //qft static void GetCount(const TopoDS_Shape& aS, @@ -107,9 +107,9 @@ void GetCount(const TopoDS_Shape& aS, //function : RefineSDShapes //purpose : //======================================================================= -Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape &aMPKLE, - const Standard_Real aTol, - IntTools_Context& aCtx) + Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE, + const Standard_Real aTol, + IntTools_Context& aCtx) { Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd; TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd; @@ -156,7 +156,10 @@ Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKey const TopoDS_Shape& aE1=aMEToAdd.FindKey(i); const TopTools_ListOfShape& aLE=aMEToAdd(i); // - aPKE1.SetIds(aE1); + //qf + //aPKE1.SetIds(aE1); + aPKE1.SetShapes(aE1); + //qt aMPKLE.Add(aPKE1, aLE); } // diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_Clsf.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_Clsf.hxx new file mode 100644 index 000000000..8b9bf2d35 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_Clsf.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#define _Handle_GEOMAlgo_Clsf_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_GEOMAlgo_HAlgo_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(GEOMAlgo_HAlgo); +class GEOMAlgo_Clsf; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_Clsf); + +class Handle(GEOMAlgo_Clsf) : public Handle(GEOMAlgo_HAlgo) { + public: + Handle(GEOMAlgo_Clsf)():Handle(GEOMAlgo_HAlgo)() {} + Handle(GEOMAlgo_Clsf)(const Handle(GEOMAlgo_Clsf)& aHandle) : Handle(GEOMAlgo_HAlgo)(aHandle) + { + } + + Handle(GEOMAlgo_Clsf)(const GEOMAlgo_Clsf* anItem) : Handle(GEOMAlgo_HAlgo)((GEOMAlgo_HAlgo *)anItem) + { + } + + Handle(GEOMAlgo_Clsf)& operator=(const Handle(GEOMAlgo_Clsf)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_Clsf)& operator=(const GEOMAlgo_Clsf* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_Clsf* operator->() const + { + return (GEOMAlgo_Clsf *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_Clsf)(); + + Standard_EXPORT static const Handle(GEOMAlgo_Clsf) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfBox.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfBox.hxx new file mode 100644 index 000000000..b397bddb8 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfBox.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _Handle_GEOMAlgo_ClsfBox_HeaderFile +#define _Handle_GEOMAlgo_ClsfBox_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(GEOMAlgo_Clsf); +class GEOMAlgo_ClsfBox; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfBox); + +class Handle(GEOMAlgo_ClsfBox) : public Handle(GEOMAlgo_Clsf) { + public: + Handle(GEOMAlgo_ClsfBox)():Handle(GEOMAlgo_Clsf)() {} + Handle(GEOMAlgo_ClsfBox)(const Handle(GEOMAlgo_ClsfBox)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) + { + } + + Handle(GEOMAlgo_ClsfBox)(const GEOMAlgo_ClsfBox* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) + { + } + + Handle(GEOMAlgo_ClsfBox)& operator=(const Handle(GEOMAlgo_ClsfBox)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_ClsfBox)& operator=(const GEOMAlgo_ClsfBox* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_ClsfBox* operator->() const + { + return (GEOMAlgo_ClsfBox *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_ClsfBox)(); + + Standard_EXPORT static const Handle(GEOMAlgo_ClsfBox) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSurf.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSurf.hxx new file mode 100644 index 000000000..ca42ed917 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSurf.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _Handle_GEOMAlgo_ClsfSurf_HeaderFile +#define _Handle_GEOMAlgo_ClsfSurf_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(GEOMAlgo_Clsf); +class GEOMAlgo_ClsfSurf; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfSurf); + +class Handle(GEOMAlgo_ClsfSurf) : public Handle(GEOMAlgo_Clsf) { + public: + Handle(GEOMAlgo_ClsfSurf)():Handle(GEOMAlgo_Clsf)() {} + Handle(GEOMAlgo_ClsfSurf)(const Handle(GEOMAlgo_ClsfSurf)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) + { + } + + Handle(GEOMAlgo_ClsfSurf)(const GEOMAlgo_ClsfSurf* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) + { + } + + Handle(GEOMAlgo_ClsfSurf)& operator=(const Handle(GEOMAlgo_ClsfSurf)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_ClsfSurf)& operator=(const GEOMAlgo_ClsfSurf* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_ClsfSurf* operator->() const + { + return (GEOMAlgo_ClsfSurf *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_ClsfSurf)(); + + Standard_EXPORT static const Handle(GEOMAlgo_ClsfSurf) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_HAlgo.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_HAlgo.hxx new file mode 100644 index 000000000..861c3e3ea --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_HAlgo.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _Handle_GEOMAlgo_HAlgo_HeaderFile +#define _Handle_GEOMAlgo_HAlgo_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class GEOMAlgo_HAlgo; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_HAlgo); + +class Handle(GEOMAlgo_HAlgo) : public Handle(MMgt_TShared) { + public: + Handle(GEOMAlgo_HAlgo)():Handle(MMgt_TShared)() {} + Handle(GEOMAlgo_HAlgo)(const Handle(GEOMAlgo_HAlgo)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(GEOMAlgo_HAlgo)(const GEOMAlgo_HAlgo* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(GEOMAlgo_HAlgo)& operator=(const Handle(GEOMAlgo_HAlgo)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_HAlgo)& operator=(const GEOMAlgo_HAlgo* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_HAlgo* operator->() const + { + return (GEOMAlgo_HAlgo *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_HAlgo)(); + + Standard_EXPORT static const Handle(GEOMAlgo_HAlgo) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Makefile.in b/src/GEOMAlgo/Makefile.in index 0ea15e24a..5cd728723 100644 --- a/src/GEOMAlgo/Makefile.in +++ b/src/GEOMAlgo/Makefile.in @@ -55,6 +55,9 @@ LIB_SRC = \ GEOMAlgo_BuilderShape.cxx \ GEOMAlgo_BuilderSolid.cxx \ GEOMAlgo_BuilderTools.cxx \ + GEOMAlgo_ClsfBox.cxx \ + GEOMAlgo_Clsf.cxx \ + GEOMAlgo_ClsfSurf.cxx \ GEOMAlgo_CoupleOfShapes.cxx \ GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx \ GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx \ @@ -69,10 +72,12 @@ LIB_SRC = \ GEOMAlgo_DataMapOfShapeReal_0.cxx \ GEOMAlgo_DataMapOfShapeShapeSet_0.cxx \ GEOMAlgo_FinderShapeOn1.cxx \ + GEOMAlgo_FinderShapeOn2.cxx \ GEOMAlgo_FinderShapeOn.cxx \ GEOMAlgo_FinderShapeOnQuad.cxx \ GEOMAlgo_GlueAnalyser.cxx \ GEOMAlgo_Gluer.cxx \ + GEOMAlgo_HAlgo.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ @@ -92,6 +97,7 @@ LIB_SRC = \ GEOMAlgo_PassKey.cxx \ GEOMAlgo_PassKeyMapHasher.cxx \ GEOMAlgo_PassKeyShape.cxx \ + GEOMAlgo_PassKeyShapeMapHasher.cxx \ GEOMAlgo_ShapeAlgo.cxx \ GEOMAlgo_ShapeSet.cxx \ GEOMAlgo_ShapeSolid.cxx \ @@ -124,6 +130,9 @@ EXPORT_HEADERS = \ GEOMAlgo_BuilderShape.hxx \ GEOMAlgo_BuilderSolid.hxx \ GEOMAlgo_BuilderTools.hxx \ + GEOMAlgo_ClsfBox.hxx \ + GEOMAlgo_Clsf.hxx \ + GEOMAlgo_ClsfSurf.hxx \ GEOMAlgo_CoupleOfShapes.hxx \ GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx \ GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx \ @@ -138,10 +147,12 @@ EXPORT_HEADERS = \ GEOMAlgo_DataMapOfShapeReal.hxx \ GEOMAlgo_DataMapOfShapeShapeSet.hxx \ GEOMAlgo_FinderShapeOn1.hxx \ + GEOMAlgo_FinderShapeOn2.hxx \ GEOMAlgo_FinderShapeOn.hxx \ GEOMAlgo_FinderShapeOnQuad.hxx \ GEOMAlgo_GlueAnalyser.hxx \ GEOMAlgo_Gluer.hxx \ + GEOMAlgo_HAlgo.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx \ @@ -161,6 +172,7 @@ EXPORT_HEADERS = \ GEOMAlgo_PassKey.hxx \ GEOMAlgo_PassKeyMapHasher.hxx \ GEOMAlgo_PassKeyShape.hxx \ + GEOMAlgo_PassKeyShapeMapHasher.hxx \ GEOMAlgo_PWireEdgeSet.hxx \ GEOMAlgo_ShapeAlgo.hxx \ GEOMAlgo_ShapeSet.hxx \ @@ -178,10 +190,14 @@ EXPORT_HEADERS = \ GEOMAlgo_WireEdgeSet.hxx \ GEOMAlgo_WireSolid.hxx \ GEOMAlgo_WireSplitter.hxx \ + Handle_GEOMAlgo_ClsfBox.hxx \ + Handle_GEOMAlgo_Clsf.hxx \ + Handle_GEOMAlgo_ClsfSurf.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx \ + Handle_GEOMAlgo_HAlgo.hxx \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx \