Back to index

salome-smesh  6.5.0
SMESH_2smeshpy.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File      : SMESH_smesh.hxx
00024 // Created   : Fri Nov 18 12:05:18 2005
00025 // Author    : Edward AGAPOV (eap)
00026 //
00027 #ifndef SMESH_smesh_HeaderFile
00028 #define SMESH_smesh_HeaderFile
00029 
00030 #include <Standard_DefineHandle.hxx>
00031 #include <Standard_Type.hxx>
00032 #include <Standard_Transient.hxx>
00033 #include <TCollection_AsciiString.hxx>
00034 #include <TColStd_SequenceOfAsciiString.hxx>
00035 #include <TColStd_SequenceOfInteger.hxx>
00036 
00037 #include <list>
00038 #include <map>
00039 #include <vector>
00040 
00041 #include <SALOMEconfig.h>
00042 #include CORBA_CLIENT_HEADER(SALOMEDS)
00043 
00044 // ===========================================================================================
00056 // ===========================================================================================
00057 
00058 class Resource_DataMapOfAsciiStringAsciiString;
00059 
00060 // ===========================================================================================
00061 // =====================
00062 //    INTERNAL STUFF
00063 // =====================
00064 // ===========================================================================================
00065 
00066 class _pyCommand;
00067 class _pyObject;
00068 class _pyGen;
00069 class _pyMesh;
00070 class _pySubMesh;
00071 class _pyHypothesis;
00072 class _pyAlgorithm;
00073 class _pyHypothesisReader;
00074 
00075 DEFINE_STANDARD_HANDLE (_pyCommand         ,Standard_Transient);
00076 DEFINE_STANDARD_HANDLE (_pyObject          ,Standard_Transient);
00077 DEFINE_STANDARD_HANDLE (_pyHypothesisReader,Standard_Transient);
00078 DEFINE_STANDARD_HANDLE (_pyGen             ,_pyObject);
00079 DEFINE_STANDARD_HANDLE (_pyMesh            ,_pyObject);
00080 DEFINE_STANDARD_HANDLE (_pySubMesh         ,_pyObject);
00081 DEFINE_STANDARD_HANDLE (_pyGroup           ,_pySubMesh);
00082 DEFINE_STANDARD_HANDLE (_pyMeshEditor      ,_pyObject);
00083 DEFINE_STANDARD_HANDLE (_pyHypothesis      ,_pyObject);
00084 DEFINE_STANDARD_HANDLE (_pyAlgorithm       ,_pyHypothesis);
00085 
00086 typedef TCollection_AsciiString _pyID;
00087 typedef TCollection_AsciiString _AString;
00088 
00089 // ===========================================================
00094 // ===========================================================
00095 
00096 class _pyCommand: public Standard_Transient
00097 {
00098   int                             myOrderNb;            
00099   _AString                        myString;             
00100   _AString                        myRes, myObj, myMeth; 
00101   TColStd_SequenceOfAsciiString   myArgs;               
00102   TColStd_SequenceOfInteger       myBegPos;             
00103   std::list< Handle(_pyCommand) > myDependentCmds; 
00104 
00105   enum { UNKNOWN=-1, EMPTY=0, RESULT_IND, OBJECT_IND, METHOD_IND, ARG1_IND };
00106   int  GetBegPos( int thePartIndex );
00107   void SetBegPos( int thePartIndex, int thePosition );
00108   void SetPart( int thePartIndex, const _AString& theNewPart, _AString& theOldPart);
00109   void FindAllArgs() { GetArg(1); }
00110 
00111 public:
00112   _pyCommand() {};
00113   _pyCommand( const _AString& theString, int theNb=-1 )
00114     : myString( theString ), myOrderNb( theNb ) {};
00115   _AString & GetString() { return myString; }
00116   int GetOrderNb() const { return myOrderNb; }
00117   void SetOrderNb( int theNb ) { myOrderNb = theNb; }
00118   typedef void* TAddr;
00119   TAddr GetAddress() const { return (void*) this; }
00120   int Length() { return myString.Length(); }
00121   void Clear() { myString.Clear(); myBegPos.Clear(); myArgs.Clear(); }
00122   bool IsEmpty() const { return myString.IsEmpty(); }
00123   _AString GetIndentation();
00124   const _AString & GetResultValue();
00125   const int GetNbResultValues();
00126   _AString GetResultValue(int res);
00127   const _AString & GetObject();
00128   const _AString & GetMethod();
00129   const _AString & GetArg( int index );
00130   int GetNbArgs() { FindAllArgs(); return myArgs.Length(); }
00131   bool MethodStartsFrom(const _AString& beg)
00132   { GetMethod(); return ( myMeth.Location( beg, 1, myMeth.Length() ) == 1 ); }
00133   void SetResultValue( const _AString& theResult )
00134   { GetResultValue(); SetPart( RESULT_IND, theResult, myRes ); }
00135   void SetObject(const _AString& theObject)
00136   { GetObject(); SetPart( OBJECT_IND, theObject, myObj ); }
00137   void SetMethod(const _AString& theMethod)
00138   { GetMethod(); SetPart( METHOD_IND, theMethod, myMeth ); }
00139   void SetArg( int index, const _AString& theArg);
00140   void RemoveArgs();
00141   void Comment();
00142   static bool SkipSpaces( const _AString & theSring, int & thePos );
00143   static _AString GetWord( const _AString & theSring, int & theStartPos,
00144                            const bool theForward, const bool dotIsWord = false);
00145   static bool IsStudyEntry( const _AString& str );
00146   static std::list< _pyID > GetStudyEntries( const _AString& str );
00147   void AddDependantCmd( Handle(_pyCommand) cmd, bool prepend = false)
00148   { if (prepend) myDependentCmds.push_front( cmd ); else myDependentCmds.push_back( cmd ); }
00149   bool SetDependentCmdsAfter() const;
00150 
00151   bool AddAccessorMethod( _pyID theObjectID, const char* theAcsMethod );
00152 
00153   DEFINE_STANDARD_RTTI (_pyCommand)
00154 };
00155 
00156 // -------------------------------------------------------------------------------------
00160 // -------------------------------------------------------------------------------------
00161 
00162 class _pyObject: public Standard_Transient
00163 {
00164 protected:
00165   _pyID                           myID;
00166   Handle(_pyCommand)              myCreationCmd;
00167   std::list< Handle(_pyCommand) > myProcessedCmds;
00168   bool                            myIsPublished;
00169 
00170   void setID(const _pyID& theID);
00171 public:
00172   _pyObject(const Handle(_pyCommand)& theCreationCmd, const _pyID& theID=_pyID());
00173   const _pyID& GetID() { return myID.IsEmpty() ? myCreationCmd->GetResultValue() : myID; }
00174   static _pyID FatherID(const _pyID & childID);
00175   const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
00176   int GetNbCalls() const { return myProcessedCmds.size(); }
00177   bool IsInStudy() const { return myIsPublished; }
00178   virtual void SetRemovedFromStudy(const bool isRemoved) { myIsPublished = !isRemoved; }
00179   void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
00180   int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
00181   void AddProcessedCmd( const Handle(_pyCommand) & cmd )
00182   { if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
00183   std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; }
00184   virtual void Process(const Handle(_pyCommand) & cmd) { AddProcessedCmd(cmd); }
00185   virtual void Flush() = 0;
00186   virtual const char* AccessorMethod() const;
00187   virtual bool CanClear() { return !myIsPublished; }
00188   virtual void ClearCommands();
00189   virtual void Free() {}
00190 
00191   DEFINE_STANDARD_RTTI (_pyObject)
00192 };
00193 
00194 // -------------------------------------------------------------------------------------
00199 // -------------------------------------------------------------------------------------
00200 struct ExportedMeshData
00201 {
00202   Handle(_pyMesh)    myMesh;
00203   Handle(_pyCommand) myLastComputeCmd;
00204   _AString           myLastComputeCmdString;
00205   ExportedMeshData() {}
00206   ExportedMeshData( const Handle(_pyMesh)& mesh, Handle(_pyCommand) computeCmd):
00207     myMesh( mesh ), myLastComputeCmd( computeCmd )
00208   {
00209     if ( !myLastComputeCmd.IsNull())
00210       myLastComputeCmdString = myLastComputeCmd->GetString();
00211   }
00212 };
00213 
00214 // -------------------------------------------------------------------------------------
00219 // -------------------------------------------------------------------------------------
00220 class _pyGen: public _pyObject
00221 {
00222 public:
00223   _pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
00224          Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
00225          SALOMEDS::Study_ptr&                      theStudy,
00226          const bool                                theToKeepAllCommands);
00227   Handle(_pyCommand) AddCommand( const _AString& theCommand );
00228   void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
00229   void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
00230   void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
00231   Handle(_pyCommand)& GetLastCommand();
00232   std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
00233 
00234   _pyID GenerateNewID( const _pyID& theID );
00235   void AddObject( Handle(_pyObject)& theObj );
00236   void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
00237   Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
00238   Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
00239   Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
00240   Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
00241                                   const Handle(_pyHypothesis)& theHypothesis);
00242 
00243   void SetAccessorMethod(const _pyID& theID, const char* theMethod );
00244   bool AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const;
00245   bool AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const;
00246   virtual const char* AccessorMethod() const;
00247 
00248   bool IsGeomObject(const _pyID& theObjID) const;
00249   bool IsNotPublished(const _pyID& theObjID) const;
00250   bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
00251   void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
00252   { myFile2ExportedMesh[ file ] = mesh; }
00253   ExportedMeshData& FindExportedMesh( const _AString& file )
00254   { return myFile2ExportedMesh[ file ]; }
00255 
00256   virtual void Process( const Handle(_pyCommand)& theCommand );
00257   virtual void Flush();
00258   virtual void ClearCommands();
00259   virtual void Free();
00260 
00261   Handle( _pyHypothesisReader ) GetHypothesisReader() const;
00262 
00263 private:
00264   void setNeighbourCommand( Handle(_pyCommand)& theCmd,
00265                             Handle(_pyCommand)& theOtherCmd,
00266                             const bool theIsAfter );
00267   
00268 private:
00269   std::map< _pyID, Handle(_pyMesh) >       myMeshes;
00270   std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
00271   std::map< _pyID, Handle(_pyObject) >     myObjects;
00272   std::list< Handle(_pyHypothesis) >       myHypos;
00273   std::list< Handle(_pyCommand) >          myCommands;
00274   int                                      myNbCommands;
00275   Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
00276   Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
00277   Handle(_pyCommand)                       myLastCommand;
00278   int                                      myNbFilters;
00279   bool                                     myToKeepAllCommands;
00280   SALOMEDS::Study_var                      myStudy;
00281   int                                      myGeomIDNb, myGeomIDIndex;
00282   std::map< _AString, ExportedMeshData >   myFile2ExportedMesh;
00283   Handle( _pyHypothesisReader )            myHypReader;
00284 
00285   DEFINE_STANDARD_RTTI (_pyGen)
00286 };
00287 
00288 // -------------------------------------------------------------------------------------
00292 // -------------------------------------------------------------------------------------
00293 #define _pyMesh_ACCESS_METHOD "GetMesh()"
00294 class _pyMesh: public _pyObject
00295 {
00296   std::list< Handle(_pyHypothesis) > myHypos;
00297   std::list< Handle(_pyCommand) >    myAddHypCmds;
00298   std::list< Handle(_pySubMesh) >    mySubmeshes;
00299   std::list< Handle(_pyGroup) >      myGroups;
00300   std::list< Handle(_pyMeshEditor)>  myEditors;
00301   //d::list< Handle(_pyMesh) >       myFatherMeshes; // this mesh depends on
00302   std::list< Handle(_pyMesh) >       myChildMeshes; // depending on me
00303   bool                               myGeomNotInStudy;
00304   Handle(_pyCommand)                 myLastComputeCmd;
00305 public:
00306   _pyMesh(const Handle(_pyCommand) creationCmd);
00307   _pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID & id);
00308   const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); }
00309   void AddGroup( const Handle(_pyGroup)& g ) { myGroups.push_back( g ); }
00310   void AddEditor( const Handle(_pyMeshEditor)& e ) { myEditors.push_back( e ); }
00311   bool IsNotGeomPublished() { return myGeomNotInStudy; }
00312   virtual void Process( const Handle(_pyCommand)& theCommand);
00313   virtual void Flush();
00314   virtual void SetRemovedFromStudy(const bool isRemoved);
00315   virtual bool CanClear();
00316   virtual void ClearCommands();
00317   virtual void Free() { /*myFatherMeshes.clear();*/ myChildMeshes.clear(); }
00318   virtual const char* AccessorMethod() const { return _pyMesh_ACCESS_METHOD; }
00319 private:
00320   void addFatherMesh( const Handle(_pyMesh)& mesh );
00321   void addFatherMesh( const _pyID& meshID );
00322   static bool NeedMeshAccess( const Handle(_pyCommand)& theCommand );
00323   static void AddMeshAccess( const Handle(_pyCommand)& theCommand )
00324   { theCommand->SetObject( theCommand->GetObject() + "." _pyMesh_ACCESS_METHOD ); }
00325 
00326   DEFINE_STANDARD_RTTI (_pyMesh)
00327 };
00328 #undef _pyMesh_ACCESS_METHOD 
00329 
00330 // -------------------------------------------------------------------------------------
00334 // -------------------------------------------------------------------------------------
00335 class _pyMeshEditor: public _pyObject
00336 {
00337   _pyID    myMesh;
00338   _AString myCreationCmdStr;
00339 public:
00340   _pyMeshEditor(const Handle(_pyCommand)& theCreationCmd);
00341   _pyID GetMesh() const { return myMesh; }
00342   virtual void Process( const Handle(_pyCommand)& theCommand);
00343   virtual void Flush() {}
00344   virtual bool CanClear();
00345 
00346   DEFINE_STANDARD_RTTI (_pyMesh)
00347 };
00348 
00349 // -------------------------------------------------------------------------------------
00353 // -------------------------------------------------------------------------------------
00354 class _pyHypothesis: public _pyObject
00355 {
00356   friend class _pyHypothesisReader;
00357 protected:
00358   bool    myIsAlgo, myIsWrapped;
00359   _pyID   myGeom,   myMesh;
00360   struct CreationMethod {
00361     _AString              myMethod; // method of algo or mesh creating a hyp
00362     // myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myAlgoMethod
00363     std::vector<_AString> myArgMethods;
00364     std::vector<int>      myArgNb; // arg nb countered from 1
00365     std::vector<_AString> myArgs; // creation arguments
00366   };
00367   void setCreationArg( const int argNb, const _AString& arg );
00368   // a hypothesis can be created by different algos by different methods
00369   typedef std::map<_AString, CreationMethod > TType2CrMethod;
00370   TType2CrMethod                myAlgoType2CreationMethod;
00371   CreationMethod*               myCurCrMethod; // used for adding to myAlgoType2CreationMethod
00372   std::list<Handle(_pyCommand)> myArgCommands;
00373   std::list<Handle(_pyCommand)> myUnusedCommands;
00374   std::list<Handle(_pyObject) > myReferredObjs;
00375   // maps used to clear commands setting parameters if result of setting is
00376   // discared (e.g. by mesh.Clear())
00377   std::map<_AString, std::list<Handle(_pyCommand)> >            myMeth2Commands;
00378   std::map< _pyCommand::TAddr, std::list<Handle(_pyCommand) > > myComputeAddr2Cmds;
00379   std::list<Handle(_pyCommand) >                                myComputeCmds;
00380   void rememberCmdOfParameter( const Handle(_pyCommand) & cmd );
00381   bool isCmdUsedForCompute( const Handle(_pyCommand) & cmd,
00382                             _pyCommand::TAddr avoidComputeAddr=NULL ) const;
00383 public:
00384   _pyHypothesis(const Handle(_pyCommand)& theCreationCmd);
00385   void SetConvMethodAndType(const _AString& creationMethod, const _AString& type)
00386   { myCurCrMethod = &myAlgoType2CreationMethod[ type ];
00387     myCurCrMethod->myMethod = creationMethod; }
00388   void AddArgMethod(const _AString& method, const int argNb = 1)
00389   { myCurCrMethod->myArgMethods.push_back( method );
00390     myCurCrMethod->myArgNb.push_back( argNb ); }
00391   //const TColStd_SequenceOfAsciiString& GetArgs() const { return myArgs; }
00392   const std::list<Handle(_pyCommand)>& GetArgCommands() const { return myArgCommands; }
00393   void ClearAllCommands();
00394   virtual bool IsAlgo() const { return myIsAlgo; }
00395   bool IsValid() const { return !myAlgoType2CreationMethod.empty(); }
00396   bool IsWrapped() const { return myIsWrapped; }
00397   const _pyID & GetGeom() const { return myGeom; }
00398   void SetMesh( const _pyID& theMeshId) { if ( myMesh.IsEmpty() ) myMesh = theMeshId; }
00399   const _pyID & GetMesh() const { return myMesh; }
00400   const _AString& GetAlgoType() const
00401   { return myAlgoType2CreationMethod.begin()->first; }
00402   const _AString& GetAlgoCreationMethod() const
00403   { return myAlgoType2CreationMethod.begin()->second.myMethod; }
00404   bool CanBeCreatedBy(const _AString& algoType ) const
00405   { return myAlgoType2CreationMethod.find( algoType ) != myAlgoType2CreationMethod.end(); }
00406   const _AString& GetCreationMethod(const _AString& algoType)
00407   { return ( myCurCrMethod = & myAlgoType2CreationMethod[ algoType ])->myMethod; }
00408   static Handle(_pyHypothesis) NewHypothesis( const Handle(_pyCommand)& theCreationCmd);
00409 
00410   virtual bool IsWrappable(const _pyID& theMesh) const;
00411   virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
00412                                   const _pyID&              theMesh);
00413   virtual void Process( const Handle(_pyCommand)& theCommand);
00414   virtual void Flush();
00415   virtual void Free() { myReferredObjs.clear(); }
00416   virtual void Assign( const Handle(_pyHypothesis)& theOther,
00417                        const _pyID&                 theMesh );
00418   virtual bool CanClear();
00419   virtual void ClearCommands();
00420   virtual bool GetReferredMeshesAndGeom( std::list< Handle(_pyMesh) >& meshes );
00421 
00422   void MeshComputed    ( const Handle(_pyCommand)& theComputeCommand );
00423   void ComputeDiscarded( const Handle(_pyCommand)& theComputeCommand );
00424   //void ComputeSaved    ( const Handle(_pyCommand)& theComputeCommand );
00425 
00426 
00427   DEFINE_STANDARD_RTTI (_pyHypothesis)
00428 };
00429 
00430 // -------------------------------------------------------------------------------------
00434 // -------------------------------------------------------------------------------------
00435 class _pyAlgorithm: public _pyHypothesis
00436 {
00437 public:
00438   _pyAlgorithm(const Handle(_pyCommand)& theCreationCmd);
00439   virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
00440                                   const _pyID&              theMesh);
00441   virtual const char* AccessorMethod() const { return "GetAlgorithm()"; }
00442   virtual bool IsWrappable(const _pyID& theMesh) { return !myIsWrapped; }
00443 
00444   DEFINE_STANDARD_RTTI (_pyAlgorithm)
00445 };
00446 
00447 // -------------------------------------------------------------------------------------
00451 // -------------------------------------------------------------------------------------
00452 class _pyComplexParamHypo: public _pyHypothesis
00453 {
00454 public:
00455   _pyComplexParamHypo(const Handle(_pyCommand)& theCreationCmd): _pyHypothesis(theCreationCmd) {}
00456   virtual void Process( const Handle(_pyCommand)& theCommand);
00457   virtual void Flush();
00458 
00459   DEFINE_STANDARD_RTTI (_pyComplexParamHypo)
00460 };
00461 DEFINE_STANDARD_HANDLE (_pyComplexParamHypo, _pyHypothesis);
00462 
00463 // -------------------------------------------------------------------------------------
00467 // -------------------------------------------------------------------------------------
00468 class _pyLayerDistributionHypo: public _pyHypothesis
00469 {
00470   Handle(_pyHypothesis) my1dHyp;
00471   _AString              myAlgoMethod;
00472 public:
00473   _pyLayerDistributionHypo(const Handle(_pyCommand)& theCreationCmd, const char* algoMethod):
00474     _pyHypothesis(theCreationCmd), myAlgoMethod((char*)algoMethod) {}
00475   virtual void Process( const Handle(_pyCommand)& theCommand);
00476   virtual void Flush();
00477   virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
00478                                   const _pyID&              theMesh);
00479   virtual void Free() { my1dHyp.Nullify(); }
00480 
00481   DEFINE_STANDARD_RTTI (_pyLayerDistributionHypo)
00482 };
00483 DEFINE_STANDARD_HANDLE (_pyLayerDistributionHypo, _pyHypothesis);
00484 
00485 // -------------------------------------------------------------------------------------
00489 // -------------------------------------------------------------------------------------
00490 class _pyNumberOfSegmentsHyp: public _pyHypothesis
00491 {
00492 public:
00493   _pyNumberOfSegmentsHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
00494   virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
00495                                   const _pyID&              theMesh);
00496   void Flush();
00497 
00498   DEFINE_STANDARD_RTTI (_pyNumberOfSegmentsHyp)
00499 };
00500 DEFINE_STANDARD_HANDLE (_pyNumberOfSegmentsHyp, _pyHypothesis);
00501 
00502 // -------------------------------------------------------------------------------------
00506 // -------------------------------------------------------------------------------------
00507 class _pySegmentLengthAroundVertexHyp: public _pyHypothesis
00508 {
00509 public:
00510   _pySegmentLengthAroundVertexHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
00511   virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
00512                                   const _pyID&              theMesh);
00513   DEFINE_STANDARD_RTTI (_pySegmentLengthAroundVertexHyp)
00514 };
00515 DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
00516 
00517 // -------------------------------------------------------------------------------------
00521 // -------------------------------------------------------------------------------------
00522 class _pySelfEraser: public _pyObject
00523 {
00524 public:
00525   _pySelfEraser(const Handle(_pyCommand)& theCreationCmd)
00526     :_pyObject(theCreationCmd) { myIsPublished = true; }
00527   virtual void Flush();
00528 
00529   DEFINE_STANDARD_RTTI (_pySelfEraser)
00530 };
00531 DEFINE_STANDARD_HANDLE (_pySelfEraser, _pyObject);
00532 
00533 // -------------------------------------------------------------------------------------
00537 // -------------------------------------------------------------------------------------
00538 class _pySubMesh:  public _pyObject
00539 {
00540   Handle(_pyObject) myCreator;
00541   Handle(_pyMesh) myMesh;
00542 public:
00543   _pySubMesh(const Handle(_pyCommand)& theCreationCmd);
00544   virtual void Process( const Handle(_pyCommand)& theCommand);
00545   virtual void Flush();
00546   virtual Handle(_pyMesh) GetMesh() { return myMesh; }
00547   virtual void Free() { myCreator.Nullify(); myMesh.Nullify(); }
00548   void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
00549 
00550   DEFINE_STANDARD_RTTI (_pySubMesh)
00551 };
00552 // -------------------------------------------------------------------------------------
00556 // -------------------------------------------------------------------------------------
00557 class _pyFilter:  public _pyObject
00558 {
00559   _pyID myNewID, myMesh;
00560   std::list< Handle(_pyObject) > myUsers;
00561 public:
00562   _pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
00563   void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
00564   virtual void Process( const Handle(_pyCommand)& theCommand);
00565   virtual void Flush();
00566   virtual bool CanClear();
00567   virtual void Free() { myUsers.clear(); }
00568   const _pyID& GetNewID() const { return myNewID; }
00569 
00570   DEFINE_STANDARD_RTTI (_pyFilter)
00571 };
00572 DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject);
00573 
00574 // -------------------------------------------------------------------------------------
00578 // -------------------------------------------------------------------------------------
00579 class _pyGroup:  public _pySubMesh
00580 {
00581   Handle(_pyFilter) myFilter;
00582   bool              myCanClearCreationCmd;
00583 public:
00584   _pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id=_pyID());
00585   virtual void Process( const Handle(_pyCommand)& theCommand);
00586   virtual void Flush();
00587   virtual void Free() { myFilter.Nullify(); }
00588 
00589   DEFINE_STANDARD_RTTI (_pyGroup)
00590 };
00591 
00592 // -------------------------------------------------------------------------------------
00596 // -------------------------------------------------------------------------------------
00597 class _pyHypothesisReader: public Standard_Transient
00598 {
00599   std::map<_AString, Handle(_pyHypothesis)> myType2Hyp;
00600 public:
00601   _pyHypothesisReader();
00602   Handle(_pyHypothesis) GetHypothesis(const _AString&           hypType,
00603                                       const Handle(_pyCommand)& creationCmd) const;
00604   DEFINE_STANDARD_RTTI (_pyHypothesisReader)
00605 };
00606 
00607 #endif