+//================================================================================
+/*!
+ * \brief Convert methods of 1D hypotheses to my own methods
+ * \param theCommand - The called hypothesis method
+ */
+//================================================================================
+
+void _pyLayerDistributionHypo::Process( const Handle(_pyCommand)& theCommand)
+{
+ if ( theCommand->GetMethod() != "SetLayerDistribution" )
+ return;
+
+ _pyID newName; // name for 1D hyp = "HypType" + "_Distribution"
+
+ const _pyID& hyp1dID = theCommand->GetArg( 1 );
+ Handle(_pyHypothesis) hyp1d = theGen->FindHyp( hyp1dID );
+ if ( hyp1d.IsNull() ) // apparently hypId changed at study restoration
+ hyp1d = my1dHyp;
+ else if ( !my1dHyp.IsNull() && hyp1dID != my1dHyp->GetID() ) {
+ // 1D hypo is already set, so distribution changes and the old
+ // 1D hypo is thrown away
+ my1dHyp->ClearAllCommands();
+ }
+ my1dHyp = hyp1d;
+ if ( my1dHyp.IsNull() )
+ return; // something wrong :(
+
+ // make a new name for 1D hyp = "HypType" + "_Distribution"
+ if ( my1dHyp->GetCreationCmd()->GetMethod() == "CreateHypothesis" ) {
+ // not yet converted creation cmd
+ TCollection_AsciiString hypTypeQuoted = my1dHyp->GetCreationCmd()->GetArg(1);
+ TCollection_AsciiString hypType = hypTypeQuoted.SubString( 2, hypTypeQuoted.Length() - 1 );
+ newName = hypType + "_Distribution";
+ my1dHyp->GetCreationCmd()->SetResultValue( newName );
+ }
+ else {
+ // already converted creation cmd
+ newName = my1dHyp->GetCreationCmd()->GetResultValue();
+ }
+
+ // as creation of 1D hyp was written later then it's edition,
+ // we need to find all it's edition calls and process them
+ list< Handle(_pyCommand) >& cmds = theGen->GetCommands();
+ list< Handle(_pyCommand) >::iterator cmdIt = cmds.begin();
+ for ( ; cmdIt != cmds.end(); ++cmdIt ) {
+ const _pyID& objID = (*cmdIt)->GetObject();
+ if ( objID == hyp1dID ) {
+ my1dHyp->Process( *cmdIt );
+ my1dHyp->GetCreationCmd()->AddDependantCmd( *cmdIt );
+ ( *cmdIt )->SetObject( newName );
+ }
+ }
+ if ( !myArgCommands.empty() )
+ myArgCommands.front()->Clear();
+ theCommand->SetArg( 1, newName );
+ myArgCommands.push_back( theCommand );
+ // copy hyp1d's creation method and args
+// myCreationMethod = hyp1d->GetCreationMethod();
+// myArgs = hyp1d->GetArgs();
+// // make them cleared at conversion
+// myArgCommands = hyp1d->GetArgCommands();
+
+// // to be cleared at convertion only
+// myArgCommands.push_back( theCommand );
+}
+
+//================================================================================
+/*!
+ * \brief
+ * \param theAdditionCmd -
+ * \param theMesh -
+ * \retval bool -
+ */
+//================================================================================
+
+bool _pyLayerDistributionHypo::Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
+ const _pyID& theMesh)
+{
+ myIsWrapped = false;
+
+ if ( my1dHyp.IsNull() )
+ return false;
+
+ // set "SetLayerDistribution()" after addition cmd
+ theAdditionCmd->AddDependantCmd( myArgCommands.front() );
+
+ _pyID geom = theAdditionCmd->GetArg( 1 );
+
+ my1dHyp->SetMesh( theMesh );
+ if ( !my1dHyp->Addition2Creation( theAdditionCmd, theMesh ))
+ return false;
+
+ // clear "SetLayerDistribution()" cmd
+ myArgCommands.front()->Clear();
+
+ // Convert my creation => me = RadialPrismAlgo.Get3DHypothesis()
+
+ // find RadialPrism algo created on <geom> for theMesh
+ Handle(_pyHypothesis) algo = theGen->FindAlgo( geom, theMesh, this );
+ if ( !algo.IsNull() ) {
+ GetCreationCmd()->SetObject( algo->GetID() );
+ GetCreationCmd()->SetMethod( "Get3DHypothesis" );
+ GetCreationCmd()->RemoveArgs();
+ theAdditionCmd->AddDependantCmd( GetCreationCmd() );
+ myIsWrapped = true;
+ }
+ return myIsWrapped;
+}
+
+//================================================================================
+/*!
+ * \brief
+ */
+//================================================================================
+
+void _pyLayerDistributionHypo::Flush()
+{
+ //my1dHyp.Nullify();
+ //_pyHypothesis::Flush();
+}
+