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;
169 std::list< Handle(_pyCommand) > myArgCmds; // where this obj is used as an argument
172 void setID(const _pyID& theID);
174 _pyObject(const Handle(_pyCommand)& theCreationCmd, const _pyID& theID=_pyID());
175 const _pyID& GetID() { return myID.IsEmpty() ? myCreationCmd->GetResultValue() : myID; }
176 static _pyID FatherID(const _pyID & childID);
177 const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
178 int GetNbCalls() const { return myProcessedCmds.size(); }
179 bool IsInStudy() const { return myIsPublished; }
180 virtual void SetRemovedFromStudy(const bool isRemoved) { myIsPublished = !isRemoved; }
181 void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
182 int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
183 void AddProcessedCmd( const Handle(_pyCommand) & cmd )
184 { if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
185 std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; }
186 void AddArgCmd( const Handle(_pyCommand) & cmd ) { myArgCmds.push_back( cmd ); }
187 virtual void Process(const Handle(_pyCommand) & cmd) { AddProcessedCmd(cmd); }
188 virtual void Flush() = 0;
189 virtual const char* AccessorMethod() const;
190 virtual bool CanClear();
191 virtual void ClearCommands();
192 virtual void Free() {}
194 DEFINE_STANDARD_RTTI (_pyObject)
197 // -------------------------------------------------------------------------------------
199 * \brief Data used to restore cleared Compute() command of an exported mesh
200 * when an imported mesh is created
202 // -------------------------------------------------------------------------------------
203 struct ExportedMeshData
205 Handle(_pyMesh) myMesh;
206 Handle(_pyCommand) myLastComputeCmd;
207 _AString myLastComputeCmdString;
208 ExportedMeshData() {}
209 ExportedMeshData( const Handle(_pyMesh)& mesh, Handle(_pyCommand) computeCmd):
210 myMesh( mesh ), myLastComputeCmd( computeCmd )
212 if ( !myLastComputeCmd.IsNull())
213 myLastComputeCmdString = myLastComputeCmd->GetString();
217 // -------------------------------------------------------------------------------------
219 * \brief Class corresponding to SMESH_Gen. It holds info on existing
220 * meshes and hypotheses
222 // -------------------------------------------------------------------------------------
223 class _pyGen: public _pyObject
226 _pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
227 Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
228 std::set< TCollection_AsciiString >& theRemovedObjIDs,
229 SALOMEDS::Study_ptr& theStudy,
230 const bool theToKeepAllCommands);
231 Handle(_pyCommand) AddCommand( const _AString& theCommand );
232 void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
233 void SetCommandAfter ( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
234 void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
235 Handle(_pyCommand)& GetLastCommand();
236 std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
237 void PlaceSubmeshAfterItsCreation( Handle(_pyCommand) theCmdUsingSubmesh ) const;
239 _pyID GenerateNewID( const _pyID& theID );
240 void AddObject( Handle(_pyObject)& theObj );
241 void CheckObjectIsReCreated( Handle(_pyObject)& theObj );
242 void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
243 Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
244 Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
245 Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
246 Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
247 const Handle(_pyHypothesis)& theHypothesis);
249 void SetAccessorMethod(const _pyID& theID, const char* theMethod );
250 bool AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const;
251 bool AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const;
252 virtual const char* AccessorMethod() const;
254 bool IsGeomObject(const _pyID& theObjID) const;
255 bool IsNotPublished(const _pyID& theObjID) const;
256 void ObjectCreationRemoved(const _pyID& theObjID);
257 void KeepAgrCmds(const _pyID& theObjID) { myKeepAgrCmdsIDs.push_back( theObjID ); }
258 bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
259 void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
260 { myFile2ExportedMesh[ file ] = mesh; }
261 ExportedMeshData& FindExportedMesh( const _AString& file )
262 { return myFile2ExportedMesh[ file ]; }
264 virtual void Process( const Handle(_pyCommand)& theCommand );
265 virtual void Flush();
266 virtual void ClearCommands();
269 Handle( _pyHypothesisReader ) GetHypothesisReader() const;
272 void setNeighbourCommand( Handle(_pyCommand)& theCmd,
273 Handle(_pyCommand)& theOtherCmd,
274 const bool theIsAfter );
275 //void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
278 std::map< _pyID, Handle(_pyMesh) > myMeshes;
279 std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
280 std::map< _pyID, Handle(_pyObject) > myObjects;
281 std::map< _pyID, Handle(_pyHypothesis) > myHypos;
282 std::list< _pyID > myKeepAgrCmdsIDs;
283 std::list< Handle(_pyCommand) > myCommands;
285 Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
286 Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
287 std::set< TCollection_AsciiString >& myRemovedObjIDs;
288 Handle(_pyCommand) myLastCommand;
290 bool myToKeepAllCommands;
291 SALOMEDS::Study_var myStudy;
292 int myGeomIDNb, myGeomIDIndex;
293 std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
294 Handle( _pyHypothesisReader ) myHypReader;
296 DEFINE_STANDARD_RTTI (_pyGen)
299 // -------------------------------------------------------------------------------------
301 * \brief Contains commands concerning mesh substructures
303 // -------------------------------------------------------------------------------------
304 #define _pyMesh_ACCESS_METHOD "GetMesh()"
305 class _pyMesh: public _pyObject
307 std::list< Handle(_pyHypothesis) > myHypos;
308 std::list< Handle(_pyCommand) > myAddHypCmds, myNotConvertedAddHypCmds;
309 std::list< Handle(_pySubMesh) > mySubmeshes;
310 std::list< Handle(_pyGroup) > myGroups;
311 std::list< Handle(_pyMeshEditor)> myEditors;
312 //d::list< Handle(_pyMesh) > myFatherMeshes; // this mesh depends on
313 std::list< Handle(_pyMesh) > myChildMeshes; // depending on me
314 bool myGeomNotInStudy;
315 Handle(_pyCommand) myLastComputeCmd;
317 _pyMesh(const Handle(_pyCommand) creationCmd);
318 _pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID & id);
319 const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); }
320 void AddGroup( const Handle(_pyGroup)& g ) { myGroups.push_back( g ); }
321 void AddEditor( const Handle(_pyMeshEditor)& e ) { myEditors.push_back( e ); }
322 bool IsNotGeomPublished() { return myGeomNotInStudy; }
323 virtual void Process( const Handle(_pyCommand)& theCommand);
324 virtual void Flush();
325 virtual void SetRemovedFromStudy(const bool isRemoved);
326 virtual bool CanClear();
327 virtual void ClearCommands();
328 virtual void Free() { /*myFatherMeshes.clear();*/ myChildMeshes.clear(); }
329 virtual const char* AccessorMethod() const { return _pyMesh_ACCESS_METHOD; }
331 void addFatherMesh( const Handle(_pyMesh)& mesh );
332 void addFatherMesh( const _pyID& meshID );
333 static bool NeedMeshAccess( const Handle(_pyCommand)& theCommand );
334 static void AddMeshAccess( const Handle(_pyCommand)& theCommand )
335 { theCommand->SetObject( theCommand->GetObject() + "." _pyMesh_ACCESS_METHOD ); }
337 DEFINE_STANDARD_RTTI (_pyMesh)
339 #undef _pyMesh_ACCESS_METHOD
341 // -------------------------------------------------------------------------------------
343 * \brief MeshEditor convert its commands to ones of mesh
345 // -------------------------------------------------------------------------------------
346 class _pyMeshEditor: public _pyObject
349 _AString myCreationCmdStr;
351 _pyMeshEditor(const Handle(_pyCommand)& theCreationCmd);
352 _pyID GetMesh() const { return myMesh; }
353 virtual void Process( const Handle(_pyCommand)& theCommand);
354 virtual void Flush() {}
355 virtual bool CanClear();
357 DEFINE_STANDARD_RTTI (_pyMesh)
360 // -------------------------------------------------------------------------------------
362 * \brief Root class for hypothesis
364 // -------------------------------------------------------------------------------------
365 class _pyHypothesis: public _pyObject
367 friend class _pyHypothesisReader;
369 bool myIsAlgo, myIsWrapped;
370 _pyID myGeom, myMesh;
371 struct CreationMethod {
372 _AString myMethod; // method of algo or mesh creating a hyp
373 // myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myMethod
374 std::vector<_AString> myArgMethods;
375 std::vector<int> myArgNb; // arg nb countered from 1
376 std::vector<_AString> myArgs; // creation arguments
378 void setCreationArg( const int argNb, const _AString& arg );
379 // a hypothesis can be created by different algos by different methods
380 typedef std::map<_AString, CreationMethod > TType2CrMethod;
381 TType2CrMethod myAlgoType2CreationMethod;
382 std::set< _AString > myAccumulativeMethods;
383 CreationMethod* myCurCrMethod; // used for adding to myAlgoType2CreationMethod
384 std::list<Handle(_pyCommand)> myArgCommands;
385 std::list<Handle(_pyCommand)> myUnusedCommands;
386 std::list<Handle(_pyObject) > myReferredObjs;
387 // maps used to clear commands setting parameters if result of setting is
388 // discared (e.g. by mesh.Clear())
389 std::map<_AString, std::list<Handle(_pyCommand)> > myMeth2Commands;
390 std::map< _pyCommand::TAddr, std::list<Handle(_pyCommand) > > myComputeAddr2Cmds;
391 std::list<Handle(_pyCommand) > myComputeCmds;
392 void rememberCmdOfParameter( const Handle(_pyCommand) & cmd );
393 bool isCmdUsedForCompute( const Handle(_pyCommand) & cmd,
394 _pyCommand::TAddr avoidComputeAddr=NULL ) const;
396 _pyHypothesis(const Handle(_pyCommand)& theCreationCmd);
397 void SetConvMethodAndType(const _AString& creationMethod, const _AString& type)
398 { myCurCrMethod = &myAlgoType2CreationMethod[ type ];
399 myCurCrMethod->myMethod = creationMethod; }
400 void AddArgMethod(const _AString& method, const int argNb = 1)
401 { myCurCrMethod->myArgMethods.push_back( method );
402 myCurCrMethod->myArgNb.push_back( argNb ); }
403 void AddAccumulativeMethod( const _AString& method)
404 { myAccumulativeMethods.insert( method ); }
405 //const TColStd_SequenceOfAsciiString& GetArgs() const { return myArgs; }
406 const std::list<Handle(_pyCommand)>& GetArgCommands() const { return myArgCommands; }
407 void ClearAllCommands();
408 virtual bool IsAlgo() const { return myIsAlgo; }
409 bool IsValid() const { return !myAlgoType2CreationMethod.empty(); }
410 bool IsWrapped() const { return myIsWrapped; }
411 const _pyID & GetGeom() const { return myGeom; }
412 void SetMesh( const _pyID& theMeshId) { if ( myMesh.IsEmpty() ) myMesh = theMeshId; }
413 const _pyID & GetMesh() const { return myMesh; }
414 const _AString& GetAlgoType() const
415 { return myAlgoType2CreationMethod.begin()->first; }
416 const _AString& GetAlgoCreationMethod() const
417 { return myAlgoType2CreationMethod.begin()->second.myMethod; }
418 bool CanBeCreatedBy(const _AString& algoType ) const
419 { return myAlgoType2CreationMethod.find( algoType ) != myAlgoType2CreationMethod.end(); }
420 const _AString& GetCreationMethod(const _AString& algoType)
421 { return ( myCurCrMethod = & myAlgoType2CreationMethod[ algoType ])->myMethod; }
422 static Handle(_pyHypothesis) NewHypothesis( const Handle(_pyCommand)& theCreationCmd);
424 virtual bool IsWrappable(const _pyID& theMesh) const;
425 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
426 const _pyID& theMesh);
427 virtual void Process( const Handle(_pyCommand)& theCommand);
428 virtual void Flush();
429 virtual void Free() { myReferredObjs.clear(); }
430 virtual void Assign( const Handle(_pyHypothesis)& theOther,
431 const _pyID& theMesh );
432 virtual bool CanClear();
433 virtual void ClearCommands();
434 virtual bool GetReferredMeshesAndGeom( std::list< Handle(_pyMesh) >& meshes );
436 void MeshComputed ( const Handle(_pyCommand)& theComputeCommand );
437 void ComputeDiscarded( const Handle(_pyCommand)& theComputeCommand );
438 //void ComputeSaved ( const Handle(_pyCommand)& theComputeCommand );
441 DEFINE_STANDARD_RTTI (_pyHypothesis)
444 // -------------------------------------------------------------------------------------
446 * \brief Class representing smesh.Mesh_Algorithm
448 // -------------------------------------------------------------------------------------
449 class _pyAlgorithm: public _pyHypothesis
452 _pyAlgorithm(const Handle(_pyCommand)& theCreationCmd);
453 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
454 const _pyID& theMesh);
455 virtual const char* AccessorMethod() const { return "GetAlgorithm()"; }
456 virtual bool IsWrappable(const _pyID& theMesh) { return !myIsWrapped; }
458 DEFINE_STANDARD_RTTI (_pyAlgorithm)
461 // -------------------------------------------------------------------------------------
463 * \brief Class for hypotheses having several parameters modified by one method
465 // -------------------------------------------------------------------------------------
466 class _pyComplexParamHypo: public _pyHypothesis
469 _pyComplexParamHypo(const Handle(_pyCommand)& theCreationCmd): _pyHypothesis(theCreationCmd) {}
470 virtual void Process( const Handle(_pyCommand)& theCommand);
471 virtual void Flush();
473 DEFINE_STANDARD_RTTI (_pyComplexParamHypo)
475 DEFINE_STANDARD_HANDLE (_pyComplexParamHypo, _pyHypothesis);
477 // -------------------------------------------------------------------------------------
479 * \brief Class for LayerDistribution hypothesis conversion
481 // -------------------------------------------------------------------------------------
482 class _pyLayerDistributionHypo: public _pyHypothesis
484 Handle(_pyHypothesis) my1dHyp;
485 _AString myAlgoMethod;
487 _pyLayerDistributionHypo(const Handle(_pyCommand)& theCreationCmd, const char* algoMethod):
488 _pyHypothesis(theCreationCmd), myAlgoMethod((char*)algoMethod) {}
489 virtual void Process( const Handle(_pyCommand)& theCommand);
490 virtual void Flush();
491 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
492 const _pyID& theMesh);
493 virtual void Free() { my1dHyp.Nullify(); }
495 DEFINE_STANDARD_RTTI (_pyLayerDistributionHypo)
497 DEFINE_STANDARD_HANDLE (_pyLayerDistributionHypo, _pyHypothesis);
499 // -------------------------------------------------------------------------------------
501 * \brief Class representing NumberOfSegments hypothesis
503 // -------------------------------------------------------------------------------------
504 class _pyNumberOfSegmentsHyp: public _pyHypothesis
507 _pyNumberOfSegmentsHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
508 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
509 const _pyID& theMesh);
512 DEFINE_STANDARD_RTTI (_pyNumberOfSegmentsHyp)
514 DEFINE_STANDARD_HANDLE (_pyNumberOfSegmentsHyp, _pyHypothesis);
516 // -------------------------------------------------------------------------------------
518 * \brief Class representing SegmentLengthAroundVertex hypothesis
520 // -------------------------------------------------------------------------------------
521 class _pySegmentLengthAroundVertexHyp: public _pyHypothesis
524 _pySegmentLengthAroundVertexHyp(const Handle(_pyCommand)& theCrCmd): _pyHypothesis(theCrCmd) {}
525 virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
526 const _pyID& theMesh);
527 DEFINE_STANDARD_RTTI (_pySegmentLengthAroundVertexHyp)
529 DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
531 // -------------------------------------------------------------------------------------
533 * \brief SelfEraser erases creation command if no more it's commands invoked
535 // -------------------------------------------------------------------------------------
536 class _pySelfEraser: public _pyObject
538 bool myIgnoreOwnCalls; // not to erase only if this obj is used as argument
540 _pySelfEraser(const Handle(_pyCommand)& theCreationCmd);
541 void IgnoreOwnCalls() { myIgnoreOwnCalls = true; }
542 virtual void Flush();
544 DEFINE_STANDARD_RTTI (_pySelfEraser)
546 DEFINE_STANDARD_HANDLE (_pySelfEraser, _pyObject);
548 // -------------------------------------------------------------------------------------
550 * \brief SubMesh creation can be moved to the end of engine commands
552 // -------------------------------------------------------------------------------------
553 class _pySubMesh: public _pyObject
555 Handle(_pyObject) myCreator;
556 Handle(_pyMesh) myMesh;
558 _pySubMesh(const Handle(_pyCommand)& theCreationCmd);
559 virtual void Process( const Handle(_pyCommand)& theCommand);
560 virtual void Flush();
561 virtual Handle(_pyMesh) GetMesh() { return myMesh; }
562 virtual void Free() { myCreator.Nullify(); myMesh.Nullify(); }
563 void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
564 static bool CanBeArgOfMethod(const _AString& theMethodName);
566 DEFINE_STANDARD_RTTI (_pySubMesh)
568 // -------------------------------------------------------------------------------------
570 * \brief A filter sets a human readable name to self
572 // -------------------------------------------------------------------------------------
573 class _pyFilter: public _pyObject
575 _pyID myNewID, myMesh;
576 //std::list< Handle(_pyObject) > myUsers;
578 _pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
579 //void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
580 virtual void Process( const Handle(_pyCommand)& theCommand);
581 virtual void Flush();
582 //virtual bool CanClear();
583 //virtual void Free() { myUsers.clear(); }
584 const _pyID& GetNewID() const { return myNewID; }
586 DEFINE_STANDARD_RTTI (_pyFilter)
588 DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject);
590 // -------------------------------------------------------------------------------------
592 * \brief To convert creation of a group by filter
594 // -------------------------------------------------------------------------------------
595 class _pyGroup: public _pySubMesh
597 Handle(_pyFilter) myFilter;
598 bool myCanClearCreationCmd;
600 _pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id=_pyID());
601 virtual void Process( const Handle(_pyCommand)& theCommand);
602 virtual void Flush();
603 virtual void Free() { myFilter.Nullify(); }
604 virtual bool CanClear();
605 void RemovedWithContents();
607 DEFINE_STANDARD_RTTI (_pyGroup)
610 // -------------------------------------------------------------------------------------
612 * \brief Class reading _pyHypothesis'es from resource files of mesher Plugins
614 // -------------------------------------------------------------------------------------
615 class _pyHypothesisReader: public Standard_Transient
617 std::map<_AString, Handle(_pyHypothesis)> myType2Hyp;
619 _pyHypothesisReader();
620 Handle(_pyHypothesis) GetHypothesis(const _AString& hypType,
621 const Handle(_pyCommand)& creationCmd) const;
622 DEFINE_STANDARD_RTTI (_pyHypothesisReader)