1 // Copyright (C) 2007-2013 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 smeshBuilder.py commands defining hypotheses encapsulate
51 * several SMESH engine method calls. As well, the dependencies between smeshBuilder.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 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 std::set< TCollection_AsciiString >& theRemovedObjIDs,
227 SALOMEDS::Study_ptr& theStudy,
228 const bool theToKeepAllCommands);
229 Handle(_pyCommand) AddCommand( const _AString& theCommand );
230 void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
231 void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
232 void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
233 Handle(_pyCommand)& GetLastCommand();
234 std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
235 void PlaceSubmeshAfterItsCreation( Handle(_pyCommand) theCmdUsingSubmesh ) const;
237 _pyID GenerateNewID( const _pyID& theID );
238 void AddObject( Handle(_pyObject)& theObj );
239 void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
240 Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
241 Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
242 Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
243 Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
244 const Handle(_pyHypothesis)& theHypothesis);
246 void SetAccessorMethod(const _pyID& theID, const char* theMethod );
247 bool AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const;
248 bool AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const;
249 virtual const char* AccessorMethod() const;
251 bool IsGeomObject(const _pyID& theObjID) const;
252 bool IsNotPublished(const _pyID& theObjID) const;
253 void ObjectCreationRemoved(const _pyID& theObjID);
254 bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
255 void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
256 { myFile2ExportedMesh[ file ] = mesh; }
257 ExportedMeshData& FindExportedMesh( const _AString& file )
258 { return myFile2ExportedMesh[ file ]; }
260 virtual void Process( const Handle(_pyCommand)& theCommand );
261 virtual void Flush();
262 virtual void ClearCommands();
265 Handle( _pyHypothesisReader ) GetHypothesisReader() const;
268 void setNeighbourCommand( Handle(_pyCommand)& theCmd,
269 Handle(_pyCommand)& theOtherCmd,
270 const bool theIsAfter );
273 std::map< _pyID, Handle(_pyMesh) > myMeshes;
274 std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
275 std::map< _pyID, Handle(_pyObject) > myObjects;
276 std::list< Handle(_pyHypothesis) > myHypos;
277 std::list< Handle(_pyCommand) > myCommands;
279 Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
280 Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
281 std::set< TCollection_AsciiString >& myRemovedObjIDs;
282 Handle(_pyCommand) myLastCommand;
284 bool myToKeepAllCommands;
285 SALOMEDS::Study_var myStudy;
286 int myGeomIDNb, myGeomIDIndex;
287 std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
288 Handle( _pyHypothesisReader ) myHypReader;
290 DEFINE_STANDARD_RTTI (_pyGen)
293 // -------------------------------------------------------------------------------------
295 * \brief Contains commands concerning mesh substructures
297 // -------------------------------------------------------------------------------------
298 #define _pyMesh_ACCESS_METHOD "GetMesh()"
299 class _pyMesh: public _pyObject
301 std::list< Handle(_pyHypothesis) > myHypos;
302 std::list< Handle(_pyCommand) > myAddHypCmds, myNotConvertedAddHypCmds;
303 std::list< Handle(_pySubMesh) > mySubmeshes;
304 std::list< Handle(_pyGroup) > myGroups;
305 std::list< Handle(_pyMeshEditor)> myEditors;
306 //d::list< Handle(_pyMesh) > myFatherMeshes; // this mesh depends on
307 std::list< Handle(_pyMesh) > myChildMeshes; // depending on me
308 bool myGeomNotInStudy;
309 Handle(_pyCommand) myLastComputeCmd;
311 _pyMesh(const Handle(_pyCommand) creationCmd);
312 _pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID & id);
313 const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); }
314 void AddGroup( const Handle(_pyGroup)& g ) { myGroups.push_back( g ); }
315 void AddEditor( const Handle(_pyMeshEditor)& e ) { myEditors.push_back( e ); }
316 bool IsNotGeomPublished() { return myGeomNotInStudy; }
317 virtual void Process( const Handle(_pyCommand)& theCommand);
318 virtual void Flush();
319 virtual void SetRemovedFromStudy(const bool isRemoved);
320 virtual bool CanClear();
321 virtual void ClearCommands();
322 virtual void Free() { /*myFatherMeshes.clear();*/ myChildMeshes.clear(); }
323 virtual const char* AccessorMethod() const { return _pyMesh_ACCESS_METHOD; }
325 void addFatherMesh( const Handle(_pyMesh)& mesh );
326 void addFatherMesh( const _pyID& meshID );
327 static bool NeedMeshAccess( const Handle(_pyCommand)& theCommand );
328 static void AddMeshAccess( const Handle(_pyCommand)& theCommand )
329 { theCommand->SetObject( theCommand->GetObject() + "." _pyMesh_ACCESS_METHOD ); }
331 DEFINE_STANDARD_RTTI (_pyMesh)
333 #undef _pyMesh_ACCESS_METHOD
335 // -------------------------------------------------------------------------------------
337 * \brief MeshEditor convert its commands to ones of mesh
339 // -------------------------------------------------------------------------------------
340 class _pyMeshEditor: public _pyObject
343 _AString myCreationCmdStr;
345 _pyMeshEditor(const Handle(_pyCommand)& theCreationCmd);
346 _pyID GetMesh() const { return myMesh; }
347 virtual void Process( const Handle(_pyCommand)& theCommand);
348 virtual void Flush() {}
349 virtual bool CanClear();
351 DEFINE_STANDARD_RTTI (_pyMesh)
354 // -------------------------------------------------------------------------------------
356 * \brief Root class for hypothesis
358 // -------------------------------------------------------------------------------------
359 class _pyHypothesis: public _pyObject
361 friend class _pyHypothesisReader;
363 bool myIsAlgo, myIsWrapped;
364 _pyID myGeom, myMesh;
365 struct CreationMethod {
366 _AString myMethod; // method of algo or mesh creating a hyp
367 // myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myMethod
368 std::vector<_AString> myArgMethods;
369 std::vector<int> myArgNb; // arg nb countered from 1
370 std::vector<_AString> myArgs; // creation arguments
372 void setCreationArg( const int argNb, const _AString& arg );
373 // a hypothesis can be created by different algos by different methods
374 typedef std::map<_AString, CreationMethod > TType2CrMethod;
375 TType2CrMethod myAlgoType2CreationMethod;
376 std::set< _AString > myAccumulativeMethods;
377 CreationMethod* myCurCrMethod; // used for adding to myAlgoType2CreationMethod
378 std::list<Handle(_pyCommand)> myArgCommands;
379 std::list<Handle(_pyCommand)> myUnusedCommands;
380 std::list<Handle(_pyObject) > myReferredObjs;
381 // maps used to clear commands setting parameters if result of setting is
382 // discared (e.g. by mesh.Clear())
383 std::map<_AString, std::list<Handle(_pyCommand)> > myMeth2Commands;
384 std::map< _pyCommand::TAddr, std::list<Handle(_pyCommand) > > myComputeAddr2Cmds;
385 std::list<Handle(_pyCommand) > myComputeCmds;
386 void rememberCmdOfParameter( const Handle(_pyCommand) & cmd );
387 bool isCmdUsedForCompute( const Handle(_pyCommand) & cmd,
388 _pyCommand::TAddr avoidComputeAddr=NULL ) const;
390 _pyHypothesis(const Handle(_pyCommand)& theCreationCmd);
391 void SetConvMethodAndType(const _AString& creationMethod, const _AString& type)
392 { myCurCrMethod = &myAlgoType2CreationMethod[ type ];
393 myCurCrMethod->myMethod = creationMethod; }
394 void AddArgMethod(const _AString& method, const int argNb = 1)
395 { myCurCrMethod->myArgMethods.push_back( method );
396 myCurCrMethod->myArgNb.push_back( argNb ); }
397 void AddAccumulativeMethod( const _AString& method)
398 { myAccumulativeMethods.insert( method ); }
399 //const TColStd_SequenceOfAsciiString& GetArgs() const { return myArgs; }
400 const std::list<Handle(_pyCommand)>& GetArgCommands() const { return myArgCommands; }
401 void ClearAllCommands();
402 virtual bool IsAlgo() const { return myIsAlgo; }
403 bool IsValid() const { return !myAlgoType2CreationMethod.empty(); }
404 bool IsWrapped() const { return myIsWrapped; }
405 const _pyID & GetGeom() const { return myGeom; }
406 void SetMesh( const _pyID& theMeshId) { if ( myMesh.IsEmpty() ) myMesh = theMeshId; }
407 const _pyID & GetMesh() const { return myMesh; }
408 const _AString& GetAlgoType() const
409 { return myAlgoType2CreationMethod.begin()->first; }
410 const _AString& GetAlgoCreationMethod() const
411 { return myAlgoType2CreationMethod.begin()->second.myMethod; }
412 bool CanBeCreatedBy(const _AString& algoType ) const
413 { return myAlgoType2CreationMethod.find( algoType ) != myAlgoType2CreationMethod.end(); }
414 const _AString& GetCreationMethod(const _AString& algoType)
415 { return ( myCurCrMethod = & myAlgoType2CreationMethod[ algoType ])->myMethod; }
416 static Handle(_pyHypothesis) NewHypothesis( const Handle(_pyCommand)& theCreationCmd);
418 virtual bool IsWrappable(const _pyID& theMesh) const;
419 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
420 const _pyID& theMesh);
421 virtual void Process( const Handle(_pyCommand)& theCommand);
422 virtual void Flush();
423 virtual void Free() { myReferredObjs.clear(); }
424 virtual void Assign( const Handle(_pyHypothesis)& theOther,
425 const _pyID& theMesh );
426 virtual bool CanClear();
427 virtual void ClearCommands();
428 virtual bool GetReferredMeshesAndGeom( std::list< Handle(_pyMesh) >& meshes );
430 void MeshComputed ( const Handle(_pyCommand)& theComputeCommand );
431 void ComputeDiscarded( const Handle(_pyCommand)& theComputeCommand );
432 //void ComputeSaved ( const Handle(_pyCommand)& theComputeCommand );
435 DEFINE_STANDARD_RTTI (_pyHypothesis)
438 // -------------------------------------------------------------------------------------
440 * \brief Class representing smesh.Mesh_Algorithm
442 // -------------------------------------------------------------------------------------
443 class _pyAlgorithm: public _pyHypothesis
446 _pyAlgorithm(const Handle(_pyCommand)& theCreationCmd);
447 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
448 const _pyID& theMesh);
449 virtual const char* AccessorMethod() const { return "GetAlgorithm()"; }
450 virtual bool IsWrappable(const _pyID& theMesh) { return !myIsWrapped; }
452 DEFINE_STANDARD_RTTI (_pyAlgorithm)
455 // -------------------------------------------------------------------------------------
457 * \brief Class for hypotheses having several parameters modified by one method
459 // -------------------------------------------------------------------------------------
460 class _pyComplexParamHypo: public _pyHypothesis
463 _pyComplexParamHypo(const Handle(_pyCommand)& theCreationCmd): _pyHypothesis(theCreationCmd) {}
464 virtual void Process( const Handle(_pyCommand)& theCommand);
465 virtual void Flush();
467 DEFINE_STANDARD_RTTI (_pyComplexParamHypo)
469 DEFINE_STANDARD_HANDLE (_pyComplexParamHypo, _pyHypothesis);
471 // -------------------------------------------------------------------------------------
473 * \brief Class for LayerDistribution hypothesis conversion
475 // -------------------------------------------------------------------------------------
476 class _pyLayerDistributionHypo: public _pyHypothesis
478 Handle(_pyHypothesis) my1dHyp;
479 _AString myAlgoMethod;
481 _pyLayerDistributionHypo(const Handle(_pyCommand)& theCreationCmd, const char* algoMethod):
482 _pyHypothesis(theCreationCmd), myAlgoMethod((char*)algoMethod) {}
483 virtual void Process( const Handle(_pyCommand)& theCommand);
484 virtual void Flush();
485 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
486 const _pyID& theMesh);
487 virtual void Free() { my1dHyp.Nullify(); }
489 DEFINE_STANDARD_RTTI (_pyLayerDistributionHypo)
491 DEFINE_STANDARD_HANDLE (_pyLayerDistributionHypo, _pyHypothesis);
493 // -------------------------------------------------------------------------------------
495 * \brief Class representing NumberOfSegments hypothesis
497 // -------------------------------------------------------------------------------------
498 class _pyNumberOfSegmentsHyp: public _pyHypothesis
501 _pyNumberOfSegmentsHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
502 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
503 const _pyID& theMesh);
506 DEFINE_STANDARD_RTTI (_pyNumberOfSegmentsHyp)
508 DEFINE_STANDARD_HANDLE (_pyNumberOfSegmentsHyp, _pyHypothesis);
510 // -------------------------------------------------------------------------------------
512 * \brief Class representing SegmentLengthAroundVertex hypothesis
514 // -------------------------------------------------------------------------------------
515 class _pySegmentLengthAroundVertexHyp: public _pyHypothesis
518 _pySegmentLengthAroundVertexHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
519 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
520 const _pyID& theMesh);
521 DEFINE_STANDARD_RTTI (_pySegmentLengthAroundVertexHyp)
523 DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
525 // -------------------------------------------------------------------------------------
527 * \brief SelfEraser erases creation command if no more it's commands invoked
529 // -------------------------------------------------------------------------------------
530 class _pySelfEraser: public _pyObject
533 _pySelfEraser(const Handle(_pyCommand)& theCreationCmd)
534 :_pyObject(theCreationCmd) { myIsPublished = true; }
535 virtual void Flush();
537 DEFINE_STANDARD_RTTI (_pySelfEraser)
539 DEFINE_STANDARD_HANDLE (_pySelfEraser, _pyObject);
541 // -------------------------------------------------------------------------------------
543 * \brief SubMesh creation can be moved to the end of engine commands
545 // -------------------------------------------------------------------------------------
546 class _pySubMesh: public _pyObject
548 Handle(_pyObject) myCreator;
549 Handle(_pyMesh) myMesh;
551 _pySubMesh(const Handle(_pyCommand)& theCreationCmd);
552 virtual void Process( const Handle(_pyCommand)& theCommand);
553 virtual void Flush();
554 virtual Handle(_pyMesh) GetMesh() { return myMesh; }
555 virtual void Free() { myCreator.Nullify(); myMesh.Nullify(); }
556 void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
557 static bool CanBeArgOfMethod(const _AString& theMethodName);
559 DEFINE_STANDARD_RTTI (_pySubMesh)
561 // -------------------------------------------------------------------------------------
563 * \brief A filter sets a human readable name to self
565 // -------------------------------------------------------------------------------------
566 class _pyFilter: public _pyObject
568 _pyID myNewID, myMesh;
569 std::list< Handle(_pyObject) > myUsers;
571 _pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
572 void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
573 virtual void Process( const Handle(_pyCommand)& theCommand);
574 virtual void Flush();
575 virtual bool CanClear();
576 virtual void Free() { myUsers.clear(); }
577 const _pyID& GetNewID() const { return myNewID; }
579 DEFINE_STANDARD_RTTI (_pyFilter)
581 DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject);
583 // -------------------------------------------------------------------------------------
585 * \brief To convert creation of a group by filter
587 // -------------------------------------------------------------------------------------
588 class _pyGroup: public _pySubMesh
590 Handle(_pyFilter) myFilter;
591 bool myCanClearCreationCmd;
593 _pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id=_pyID());
594 virtual void Process( const Handle(_pyCommand)& theCommand);
595 virtual void Flush();
596 virtual void Free() { myFilter.Nullify(); }
597 virtual bool CanClear();
598 void RemovedWithContents();
600 DEFINE_STANDARD_RTTI (_pyGroup)
603 // -------------------------------------------------------------------------------------
605 * \brief Class reading _pyHypothesis'es from resource files of mesher Plugins
607 // -------------------------------------------------------------------------------------
608 class _pyHypothesisReader: public Standard_Transient
610 std::map<_AString, Handle(_pyHypothesis)> myType2Hyp;
612 _pyHypothesisReader();
613 Handle(_pyHypothesis) GetHypothesis(const _AString& hypType,
614 const Handle(_pyCommand)& creationCmd) const;
615 DEFINE_STANDARD_RTTI (_pyHypothesisReader)