1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SMESH_smesh.hxx
24 // Created : Fri Nov 18 12:05:18 2005
25 // Author : Edward AGAPOV (eap)
27 #ifndef SMESH_smesh_HeaderFile
28 #define SMESH_smesh_HeaderFile
30 #include <Standard_DefineHandle.hxx>
31 #include <Standard_Type.hxx>
32 #include <Standard_Transient.hxx>
33 #include <TCollection_AsciiString.hxx>
34 #include <TColStd_SequenceOfAsciiString.hxx>
35 #include <TColStd_SequenceOfInteger.hxx>
42 #include <SALOMEconfig.h>
43 #include CORBA_CLIENT_HEADER(SALOMEDS)
45 // ===========================================================================================
47 * This file was created in order to respond to requirement of bug PAL10494:
48 * SMESH python dump uses idl interface.
50 * The creation reason is that smesh.py commands defining hypotheses encapsulate
51 * several SMESH engine method calls. As well, the dependencies between smesh.py
52 * classes differ from ones between corresponding SMESH IDL interfaces.
54 * Everything here is for internal usage by SMESH_2smeshpy::ConvertScript()
55 * declared in SMESH_PythonDump.hxx
57 // ===========================================================================================
59 class Resource_DataMapOfAsciiStringAsciiString;
61 // ===========================================================================================
62 // =====================
64 // =====================
65 // ===========================================================================================
74 class _pyHypothesisReader;
76 DEFINE_STANDARD_HANDLE (_pyCommand ,Standard_Transient);
77 DEFINE_STANDARD_HANDLE (_pyObject ,Standard_Transient);
78 DEFINE_STANDARD_HANDLE (_pyHypothesisReader,Standard_Transient);
79 DEFINE_STANDARD_HANDLE (_pyGen ,_pyObject);
80 DEFINE_STANDARD_HANDLE (_pyMesh ,_pyObject);
81 DEFINE_STANDARD_HANDLE (_pySubMesh ,_pyObject);
82 DEFINE_STANDARD_HANDLE (_pyGroup ,_pySubMesh);
83 DEFINE_STANDARD_HANDLE (_pyMeshEditor ,_pyObject);
84 DEFINE_STANDARD_HANDLE (_pyHypothesis ,_pyObject);
85 DEFINE_STANDARD_HANDLE (_pyAlgorithm ,_pyHypothesis);
87 typedef TCollection_AsciiString _pyID;
88 typedef TCollection_AsciiString _AString;
90 // ===========================================================
92 * \brief Class operating on a command string looking like
93 * ResultValue = Object.Method( Arg1, Arg2,...)
95 // ===========================================================
97 class _pyCommand: public Standard_Transient
99 int myOrderNb; //!< position within the script
100 _AString myString; //!< command text
101 _AString myRes, myObj, myMeth; //!< found parts of command
102 TColStd_SequenceOfAsciiString myArgs; //!< found arguments
103 TColStd_SequenceOfInteger myBegPos; //!< where myRes, myObj, ... begin
104 std::list< Handle(_pyCommand) > myDependentCmds; //!< commands that sould follow me in the script
106 enum { UNKNOWN=-1, EMPTY=0, RESULT_IND, OBJECT_IND, METHOD_IND, ARG1_IND };
107 int GetBegPos( int thePartIndex );
108 void SetBegPos( int thePartIndex, int thePosition );
109 void SetPart( int thePartIndex, const _AString& theNewPart, _AString& theOldPart);
110 void FindAllArgs() { GetArg(1); }
114 _pyCommand( const _AString& theString, int theNb=-1 )
115 : myString( theString ), myOrderNb( theNb ) {};
116 _AString & GetString() { return myString; }
117 int GetOrderNb() const { return myOrderNb; }
118 void SetOrderNb( int theNb ) { myOrderNb = theNb; }
120 TAddr GetAddress() const { return (void*) this; }
121 int Length() { return myString.Length(); }
122 void Clear() { myString.Clear(); myBegPos.Clear(); myArgs.Clear(); }
123 bool IsEmpty() const { return myString.IsEmpty(); }
124 _AString GetIndentation();
125 const _AString & GetResultValue();
126 const int GetNbResultValues();
127 _AString GetResultValue(int res);
128 const _AString & GetObject();
129 const _AString & GetMethod();
130 const _AString & GetArg( int index );
131 int GetNbArgs() { FindAllArgs(); return myArgs.Length(); }
132 bool MethodStartsFrom(const _AString& beg)
133 { GetMethod(); return ( myMeth.Location( beg, 1, myMeth.Length() ) == 1 ); }
134 void SetResultValue( const _AString& theResult )
135 { GetResultValue(); SetPart( RESULT_IND, theResult, myRes ); }
136 void SetObject(const _AString& theObject)
137 { GetObject(); SetPart( OBJECT_IND, theObject, myObj ); }
138 void SetMethod(const _AString& theMethod)
139 { GetMethod(); SetPart( METHOD_IND, theMethod, myMeth ); }
140 void SetArg( int index, const _AString& theArg);
143 static bool SkipSpaces( const _AString & theSring, int & thePos );
144 static _AString GetWord( const _AString & theSring, int & theStartPos,
145 const bool theForward, const bool dotIsWord = false);
146 static bool IsStudyEntry( const _AString& str );
147 static std::list< _pyID > GetStudyEntries( const _AString& str );
148 void AddDependantCmd( Handle(_pyCommand) cmd, bool prepend = false)
149 { if (prepend) myDependentCmds.push_front( cmd ); else myDependentCmds.push_back( cmd ); }
150 bool SetDependentCmdsAfter() const;
152 bool AddAccessorMethod( _pyID theObjectID, const char* theAcsMethod );
154 DEFINE_STANDARD_RTTI (_pyCommand)
157 // -------------------------------------------------------------------------------------
159 * \brief Root of all objects. It counts calls of Process()
161 // -------------------------------------------------------------------------------------
163 class _pyObject: public Standard_Transient
167 Handle(_pyCommand) myCreationCmd;
168 std::list< Handle(_pyCommand) > myProcessedCmds;
171 void setID(const _pyID& theID);
173 _pyObject(const Handle(_pyCommand)& theCreationCmd, const _pyID& theID=_pyID());
174 const _pyID& GetID() { return myID.IsEmpty() ? myCreationCmd->GetResultValue() : myID; }
175 static _pyID FatherID(const _pyID & childID);
176 const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
177 int GetNbCalls() const { return myProcessedCmds.size(); }
178 bool IsInStudy() const { return myIsPublished; }
179 virtual void SetRemovedFromStudy(const bool isRemoved) { myIsPublished = !isRemoved; }
180 void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
181 int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
182 void AddProcessedCmd( const Handle(_pyCommand) & cmd )
183 { if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
184 std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; }
185 virtual void Process(const Handle(_pyCommand) & cmd) { AddProcessedCmd(cmd); }
186 virtual void Flush() = 0;
187 virtual const char* AccessorMethod() const;
188 virtual bool CanClear() { return !myIsPublished; }
189 virtual void ClearCommands();
190 virtual void Free() {}
192 DEFINE_STANDARD_RTTI (_pyObject)
195 // -------------------------------------------------------------------------------------
197 * \brief Data used to restore cleared Compute() command of an exported mesh
198 * when an imported mesh is created
200 // -------------------------------------------------------------------------------------
201 struct ExportedMeshData
203 Handle(_pyMesh) myMesh;
204 Handle(_pyCommand) myLastComputeCmd;
205 _AString myLastComputeCmdString;
206 ExportedMeshData() {}
207 ExportedMeshData( const Handle(_pyMesh)& mesh, Handle(_pyCommand) computeCmd):
208 myMesh( mesh ), myLastComputeCmd( computeCmd )
210 if ( !myLastComputeCmd.IsNull())
211 myLastComputeCmdString = myLastComputeCmd->GetString();
215 // -------------------------------------------------------------------------------------
217 * \brief Class corresponding to SMESH_Gen. It holds info on existing
218 * meshes and hypotheses
220 // -------------------------------------------------------------------------------------
221 class _pyGen: public _pyObject
224 _pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
225 Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
226 SALOMEDS::Study_ptr& theStudy,
227 const bool theToKeepAllCommands);
228 Handle(_pyCommand) AddCommand( const _AString& theCommand );
229 void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
230 void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
231 void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
232 Handle(_pyCommand)& GetLastCommand();
233 std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
234 void PlaceSubmeshAfterItsCreation( Handle(_pyCommand) theCmdUsingSubmesh ) const;
236 _pyID GenerateNewID( const _pyID& theID );
237 void AddObject( Handle(_pyObject)& theObj );
238 void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
239 Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
240 Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
241 Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
242 Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
243 const Handle(_pyHypothesis)& theHypothesis);
245 void SetAccessorMethod(const _pyID& theID, const char* theMethod );
246 bool AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const;
247 bool AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const;
248 virtual const char* AccessorMethod() const;
250 bool IsGeomObject(const _pyID& theObjID) const;
251 bool IsNotPublished(const _pyID& theObjID) const;
252 bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
253 void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
254 { myFile2ExportedMesh[ file ] = mesh; }
255 ExportedMeshData& FindExportedMesh( const _AString& file )
256 { return myFile2ExportedMesh[ file ]; }
258 virtual void Process( const Handle(_pyCommand)& theCommand );
259 virtual void Flush();
260 virtual void ClearCommands();
263 Handle( _pyHypothesisReader ) GetHypothesisReader() const;
266 void setNeighbourCommand( Handle(_pyCommand)& theCmd,
267 Handle(_pyCommand)& theOtherCmd,
268 const bool theIsAfter );
271 std::map< _pyID, Handle(_pyMesh) > myMeshes;
272 std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
273 std::map< _pyID, Handle(_pyObject) > myObjects;
274 std::list< Handle(_pyHypothesis) > myHypos;
275 std::list< Handle(_pyCommand) > myCommands;
277 Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
278 Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
279 Handle(_pyCommand) myLastCommand;
281 bool myToKeepAllCommands;
282 SALOMEDS::Study_var myStudy;
283 int myGeomIDNb, myGeomIDIndex;
284 std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
285 Handle( _pyHypothesisReader ) myHypReader;
287 DEFINE_STANDARD_RTTI (_pyGen)
290 // -------------------------------------------------------------------------------------
292 * \brief Contains commands concerning mesh substructures
294 // -------------------------------------------------------------------------------------
295 #define _pyMesh_ACCESS_METHOD "GetMesh()"
296 class _pyMesh: public _pyObject
298 std::list< Handle(_pyHypothesis) > myHypos;
299 std::list< Handle(_pyCommand) > myAddHypCmds;
300 std::list< Handle(_pySubMesh) > mySubmeshes;
301 std::list< Handle(_pyGroup) > myGroups;
302 std::list< Handle(_pyMeshEditor)> myEditors;
303 //d::list< Handle(_pyMesh) > myFatherMeshes; // this mesh depends on
304 std::list< Handle(_pyMesh) > myChildMeshes; // depending on me
305 bool myGeomNotInStudy;
306 Handle(_pyCommand) myLastComputeCmd;
308 _pyMesh(const Handle(_pyCommand) creationCmd);
309 _pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID & id);
310 const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); }
311 void AddGroup( const Handle(_pyGroup)& g ) { myGroups.push_back( g ); }
312 void AddEditor( const Handle(_pyMeshEditor)& e ) { myEditors.push_back( e ); }
313 bool IsNotGeomPublished() { return myGeomNotInStudy; }
314 virtual void Process( const Handle(_pyCommand)& theCommand);
315 virtual void Flush();
316 virtual void SetRemovedFromStudy(const bool isRemoved);
317 virtual bool CanClear();
318 virtual void ClearCommands();
319 virtual void Free() { /*myFatherMeshes.clear();*/ myChildMeshes.clear(); }
320 virtual const char* AccessorMethod() const { return _pyMesh_ACCESS_METHOD; }
322 void addFatherMesh( const Handle(_pyMesh)& mesh );
323 void addFatherMesh( const _pyID& meshID );
324 static bool NeedMeshAccess( const Handle(_pyCommand)& theCommand );
325 static void AddMeshAccess( const Handle(_pyCommand)& theCommand )
326 { theCommand->SetObject( theCommand->GetObject() + "." _pyMesh_ACCESS_METHOD ); }
328 DEFINE_STANDARD_RTTI (_pyMesh)
330 #undef _pyMesh_ACCESS_METHOD
332 // -------------------------------------------------------------------------------------
334 * \brief MeshEditor convert its commands to ones of mesh
336 // -------------------------------------------------------------------------------------
337 class _pyMeshEditor: public _pyObject
340 _AString myCreationCmdStr;
342 _pyMeshEditor(const Handle(_pyCommand)& theCreationCmd);
343 _pyID GetMesh() const { return myMesh; }
344 virtual void Process( const Handle(_pyCommand)& theCommand);
345 virtual void Flush() {}
346 virtual bool CanClear();
348 DEFINE_STANDARD_RTTI (_pyMesh)
351 // -------------------------------------------------------------------------------------
353 * \brief Root class for hypothesis
355 // -------------------------------------------------------------------------------------
356 class _pyHypothesis: public _pyObject
358 friend class _pyHypothesisReader;
360 bool myIsAlgo, myIsWrapped;
361 _pyID myGeom, myMesh;
362 struct CreationMethod {
363 _AString myMethod; // method of algo or mesh creating a hyp
364 // myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myMethod
365 std::vector<_AString> myArgMethods;
366 std::vector<int> myArgNb; // arg nb countered from 1
367 std::vector<_AString> myArgs; // creation arguments
369 void setCreationArg( const int argNb, const _AString& arg );
370 // a hypothesis can be created by different algos by different methods
371 typedef std::map<_AString, CreationMethod > TType2CrMethod;
372 TType2CrMethod myAlgoType2CreationMethod;
373 std::set< _AString > myAccumulativeMethods;
374 CreationMethod* myCurCrMethod; // used for adding to myAlgoType2CreationMethod
375 std::list<Handle(_pyCommand)> myArgCommands;
376 std::list<Handle(_pyCommand)> myUnusedCommands;
377 std::list<Handle(_pyObject) > myReferredObjs;
378 // maps used to clear commands setting parameters if result of setting is
379 // discared (e.g. by mesh.Clear())
380 std::map<_AString, std::list<Handle(_pyCommand)> > myMeth2Commands;
381 std::map< _pyCommand::TAddr, std::list<Handle(_pyCommand) > > myComputeAddr2Cmds;
382 std::list<Handle(_pyCommand) > myComputeCmds;
383 void rememberCmdOfParameter( const Handle(_pyCommand) & cmd );
384 bool isCmdUsedForCompute( const Handle(_pyCommand) & cmd,
385 _pyCommand::TAddr avoidComputeAddr=NULL ) const;
387 _pyHypothesis(const Handle(_pyCommand)& theCreationCmd);
388 void SetConvMethodAndType(const _AString& creationMethod, const _AString& type)
389 { myCurCrMethod = &myAlgoType2CreationMethod[ type ];
390 myCurCrMethod->myMethod = creationMethod; }
391 void AddArgMethod(const _AString& method, const int argNb = 1)
392 { myCurCrMethod->myArgMethods.push_back( method );
393 myCurCrMethod->myArgNb.push_back( argNb ); }
394 void AddAccumulativeMethod( const _AString& method)
395 { myAccumulativeMethods.insert( method ); }
396 //const TColStd_SequenceOfAsciiString& GetArgs() const { return myArgs; }
397 const std::list<Handle(_pyCommand)>& GetArgCommands() const { return myArgCommands; }
398 void ClearAllCommands();
399 virtual bool IsAlgo() const { return myIsAlgo; }
400 bool IsValid() const { return !myAlgoType2CreationMethod.empty(); }
401 bool IsWrapped() const { return myIsWrapped; }
402 const _pyID & GetGeom() const { return myGeom; }
403 void SetMesh( const _pyID& theMeshId) { if ( myMesh.IsEmpty() ) myMesh = theMeshId; }
404 const _pyID & GetMesh() const { return myMesh; }
405 const _AString& GetAlgoType() const
406 { return myAlgoType2CreationMethod.begin()->first; }
407 const _AString& GetAlgoCreationMethod() const
408 { return myAlgoType2CreationMethod.begin()->second.myMethod; }
409 bool CanBeCreatedBy(const _AString& algoType ) const
410 { return myAlgoType2CreationMethod.find( algoType ) != myAlgoType2CreationMethod.end(); }
411 const _AString& GetCreationMethod(const _AString& algoType)
412 { return ( myCurCrMethod = & myAlgoType2CreationMethod[ algoType ])->myMethod; }
413 static Handle(_pyHypothesis) NewHypothesis( const Handle(_pyCommand)& theCreationCmd);
415 virtual bool IsWrappable(const _pyID& theMesh) const;
416 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
417 const _pyID& theMesh);
418 virtual void Process( const Handle(_pyCommand)& theCommand);
419 virtual void Flush();
420 virtual void Free() { myReferredObjs.clear(); }
421 virtual void Assign( const Handle(_pyHypothesis)& theOther,
422 const _pyID& theMesh );
423 virtual bool CanClear();
424 virtual void ClearCommands();
425 virtual bool GetReferredMeshesAndGeom( std::list< Handle(_pyMesh) >& meshes );
427 void MeshComputed ( const Handle(_pyCommand)& theComputeCommand );
428 void ComputeDiscarded( const Handle(_pyCommand)& theComputeCommand );
429 //void ComputeSaved ( const Handle(_pyCommand)& theComputeCommand );
432 DEFINE_STANDARD_RTTI (_pyHypothesis)
435 // -------------------------------------------------------------------------------------
437 * \brief Class representing smesh.Mesh_Algorithm
439 // -------------------------------------------------------------------------------------
440 class _pyAlgorithm: public _pyHypothesis
443 _pyAlgorithm(const Handle(_pyCommand)& theCreationCmd);
444 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
445 const _pyID& theMesh);
446 virtual const char* AccessorMethod() const { return "GetAlgorithm()"; }
447 virtual bool IsWrappable(const _pyID& theMesh) { return !myIsWrapped; }
449 DEFINE_STANDARD_RTTI (_pyAlgorithm)
452 // -------------------------------------------------------------------------------------
454 * \brief Class for hypotheses having several parameters modified by one method
456 // -------------------------------------------------------------------------------------
457 class _pyComplexParamHypo: public _pyHypothesis
460 _pyComplexParamHypo(const Handle(_pyCommand)& theCreationCmd): _pyHypothesis(theCreationCmd) {}
461 virtual void Process( const Handle(_pyCommand)& theCommand);
462 virtual void Flush();
464 DEFINE_STANDARD_RTTI (_pyComplexParamHypo)
466 DEFINE_STANDARD_HANDLE (_pyComplexParamHypo, _pyHypothesis);
468 // -------------------------------------------------------------------------------------
470 * \brief Class for LayerDistribution hypothesis conversion
472 // -------------------------------------------------------------------------------------
473 class _pyLayerDistributionHypo: public _pyHypothesis
475 Handle(_pyHypothesis) my1dHyp;
476 _AString myAlgoMethod;
478 _pyLayerDistributionHypo(const Handle(_pyCommand)& theCreationCmd, const char* algoMethod):
479 _pyHypothesis(theCreationCmd), myAlgoMethod((char*)algoMethod) {}
480 virtual void Process( const Handle(_pyCommand)& theCommand);
481 virtual void Flush();
482 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
483 const _pyID& theMesh);
484 virtual void Free() { my1dHyp.Nullify(); }
486 DEFINE_STANDARD_RTTI (_pyLayerDistributionHypo)
488 DEFINE_STANDARD_HANDLE (_pyLayerDistributionHypo, _pyHypothesis);
490 // -------------------------------------------------------------------------------------
492 * \brief Class representing NumberOfSegments hypothesis
494 // -------------------------------------------------------------------------------------
495 class _pyNumberOfSegmentsHyp: public _pyHypothesis
498 _pyNumberOfSegmentsHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
499 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
500 const _pyID& theMesh);
503 DEFINE_STANDARD_RTTI (_pyNumberOfSegmentsHyp)
505 DEFINE_STANDARD_HANDLE (_pyNumberOfSegmentsHyp, _pyHypothesis);
507 // -------------------------------------------------------------------------------------
509 * \brief Class representing SegmentLengthAroundVertex hypothesis
511 // -------------------------------------------------------------------------------------
512 class _pySegmentLengthAroundVertexHyp: public _pyHypothesis
515 _pySegmentLengthAroundVertexHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
516 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
517 const _pyID& theMesh);
518 DEFINE_STANDARD_RTTI (_pySegmentLengthAroundVertexHyp)
520 DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
522 // -------------------------------------------------------------------------------------
524 * \brief SelfEraser erases creation command if no more it's commands invoked
526 // -------------------------------------------------------------------------------------
527 class _pySelfEraser: public _pyObject
530 _pySelfEraser(const Handle(_pyCommand)& theCreationCmd)
531 :_pyObject(theCreationCmd) { myIsPublished = true; }
532 virtual void Flush();
534 DEFINE_STANDARD_RTTI (_pySelfEraser)
536 DEFINE_STANDARD_HANDLE (_pySelfEraser, _pyObject);
538 // -------------------------------------------------------------------------------------
540 * \brief SubMesh creation can be moved to the end of engine commands
542 // -------------------------------------------------------------------------------------
543 class _pySubMesh: public _pyObject
545 Handle(_pyObject) myCreator;
546 Handle(_pyMesh) myMesh;
548 _pySubMesh(const Handle(_pyCommand)& theCreationCmd);
549 virtual void Process( const Handle(_pyCommand)& theCommand);
550 virtual void Flush();
551 virtual Handle(_pyMesh) GetMesh() { return myMesh; }
552 virtual void Free() { myCreator.Nullify(); myMesh.Nullify(); }
553 void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
554 static bool CanBeArgOfMethod(const _AString& theMethodName);
556 DEFINE_STANDARD_RTTI (_pySubMesh)
558 // -------------------------------------------------------------------------------------
560 * \brief A filter sets a human readable name to self
562 // -------------------------------------------------------------------------------------
563 class _pyFilter: public _pyObject
565 _pyID myNewID, myMesh;
566 std::list< Handle(_pyObject) > myUsers;
568 _pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
569 void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
570 virtual void Process( const Handle(_pyCommand)& theCommand);
571 virtual void Flush();
572 virtual bool CanClear();
573 virtual void Free() { myUsers.clear(); }
574 const _pyID& GetNewID() const { return myNewID; }
576 DEFINE_STANDARD_RTTI (_pyFilter)
578 DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject);
580 // -------------------------------------------------------------------------------------
582 * \brief To convert creation of a group by filter
584 // -------------------------------------------------------------------------------------
585 class _pyGroup: public _pySubMesh
587 Handle(_pyFilter) myFilter;
588 bool myCanClearCreationCmd;
590 _pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id=_pyID());
591 virtual void Process( const Handle(_pyCommand)& theCommand);
592 virtual void Flush();
593 virtual void Free() { myFilter.Nullify(); }
595 DEFINE_STANDARD_RTTI (_pyGroup)
598 // -------------------------------------------------------------------------------------
600 * \brief Class reading _pyHypothesis'es from resource files of mesher Plugins
602 // -------------------------------------------------------------------------------------
603 class _pyHypothesisReader: public Standard_Transient
605 std::map<_AString, Handle(_pyHypothesis)> myType2Hyp;
607 _pyHypothesisReader();
608 Handle(_pyHypothesis) GetHypothesis(const _AString& hypType,
609 const Handle(_pyCommand)& creationCmd) const;
610 DEFINE_STANDARD_RTTI (_pyHypothesisReader)