0020082: EDF 869 GEOM : Edges Orientation indicator/reverse

convert SetReversedEdges(),
     improve GetWord() to return a whole list
This commit is contained in:
eap 2009-07-15 13:41:14 +00:00
parent 4479d7348d
commit 2e8fa1f01c

View File

@ -1207,14 +1207,21 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
hyp->AddArgMethod( "SetNumberOfSegments" ); hyp->AddArgMethod( "SetNumberOfSegments" );
// arg of SetScaleFactor() will become the 2-nd arg of hyp creation command // arg of SetScaleFactor() will become the 2-nd arg of hyp creation command
hyp->AddArgMethod( "SetScaleFactor" ); hyp->AddArgMethod( "SetScaleFactor" );
hyp->AddArgMethod( "SetReversedEdges" );
} }
else if ( hypType == "Arithmetic1D" ) { else if ( hypType == "Arithmetic1D" ) {
hyp = new _pyComplexParamHypo( theCreationCmd ); hyp = new _pyComplexParamHypo( theCreationCmd );
hyp->SetConvMethodAndType( "Arithmetic1D", "Regular_1D"); hyp->SetConvMethodAndType( "Arithmetic1D", "Regular_1D");
hyp->AddArgMethod( "SetStartLength" );
hyp->AddArgMethod( "SetEndLength" );
hyp->AddArgMethod( "SetReversedEdges" );
} }
else if ( hypType == "StartEndLength" ) { else if ( hypType == "StartEndLength" ) {
hyp = new _pyComplexParamHypo( theCreationCmd ); hyp = new _pyComplexParamHypo( theCreationCmd );
hyp->SetConvMethodAndType( "StartEndLength", "Regular_1D"); hyp->SetConvMethodAndType( "StartEndLength", "Regular_1D");
hyp->AddArgMethod( "SetStartLength" );
hyp->AddArgMethod( "SetEndLength" );
hyp->AddArgMethod( "SetReversedEdges" );
} }
else if ( hypType == "Deflection1D" ) { else if ( hypType == "Deflection1D" ) {
hyp->SetConvMethodAndType( "Deflection1D", "Regular_1D"); hyp->SetConvMethodAndType( "Deflection1D", "Regular_1D");
@ -1550,15 +1557,38 @@ void _pyHypothesis::Assign( const Handle(_pyHypothesis)& theOther,
void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand) void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand)
{ {
// ex: hyp.SetLength(start, 1) if( theCommand->GetMethod() == "SetLength" )
// hyp.SetLength(end, 0) {
ASSERT(( theCommand->GetMethod() == "SetLength" )); // NOW it becomes OBSOLETE
ASSERT(( theCommand->GetArg( 2 ).IsIntegerValue() )); // ex: hyp.SetLength(start, 1)
int i = 2 - theCommand->GetArg( 2 ).IntegerValue(); // hyp.SetLength(end, 0)
while ( myArgs.Length() < i ) ASSERT(( theCommand->GetArg( 2 ).IsIntegerValue() ));
myArgs.Append( "[]" ); int i = 2 - theCommand->GetArg( 2 ).IntegerValue();
myArgs( i ) = theCommand->GetArg( 1 ); // arg value while ( myArgs.Length() < i )
myArgCommands.push_back( theCommand ); myArgs.Append( "[]" );
myArgs( i ) = theCommand->GetArg( 1 ); // arg value
myArgCommands.push_back( theCommand );
}
else
{
_pyHypothesis::Process( theCommand );
}
}
//================================================================================
/*!
* \brief Clear SetObjectEntry() as it is called by methods of Mesh_Segment
*/
//================================================================================
void _pyComplexParamHypo::Flush()
{
if ( IsWrapped() )
{
list < Handle(_pyCommand) >::iterator cmd = myUnknownCommands.begin();
for ( ; cmd != myUnknownCommands.end(); ++cmd )
if ((*cmd)->GetMethod() == "SetObjectEntry" )
(*cmd)->Clear();
}
} }
//================================================================================ //================================================================================
@ -1729,6 +1759,8 @@ void _pyNumberOfSegmentsHyp::Flush()
for ( ; !distrTypeNb && cmd != myUnknownCommands.rend(); ++cmd ) for ( ; !distrTypeNb && cmd != myUnknownCommands.rend(); ++cmd )
if ( (*cmd)->GetMethod() == "SetDistrType" ) if ( (*cmd)->GetMethod() == "SetDistrType" )
distrTypeNb = (*cmd)->GetOrderNb(); distrTypeNb = (*cmd)->GetOrderNb();
else if (IsWrapped() && (*cmd)->GetMethod() == "SetObjectEntry" )
(*cmd)->Clear();
// clear commands before the last SetDistrType() // clear commands before the last SetDistrType()
list<Handle(_pyCommand)> * cmds[2] = { &myArgCommands, &myUnknownCommands }; list<Handle(_pyCommand)> * cmds[2] = { &myArgCommands, &myUnknownCommands };
@ -2108,10 +2140,11 @@ TCollection_AsciiString _pyCommand::GetWord( const TCollection_AsciiString & the
// end // end
end = beg + 1; end = beg + 1;
char begChar = theString.Value( beg ); char begChar = theString.Value( beg );
if ( begChar == '"' || begChar == '\'' ) { if ( begChar == '"' || begChar == '\'' || begChar == '[') {
// end is at the corresponding quoting mark char endChar = ( begChar == '[' ) ? ']' : begChar;
// end is at the corresponding quoting mark or bracket
while ( end < theString.Length() && while ( end < theString.Length() &&
( theString.Value( end ) != begChar || theString.Value( end-1 ) == '\\')) ( theString.Value( end ) != endChar || theString.Value( end-1 ) == '\\'))
++end; ++end;
} }
else { else {