static const Standard_GUID GUID_IS_UNEDITABLE("e5799736-9030-4051-91a4-2e58321fa153");
-#define PYTHON_POLYLINEXY_ID "KIND_POLYLINEXY"
-
const double LOCAL_SELECTION_TOLERANCE = 0.0001;
TCollection_AsciiString getUniqueSectionName( const NCollection_Sequence<TCollection_AsciiString>& theNamesSeq )
QStringList HYDROData_PolylineXY::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
- QStringList aResList;
+ QStringList aResList = dumpObjectCreation( theTreatedObjects );
+ QString aPolylineName = GetObjPyName();
- Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
- if ( aDocument.IsNull() )
- return aResList;
-
- QString aDocName = aDocument->GetDocPyName();
- QString aPolylineName = GetName();
+ // Set the wire color
+ QStringList aWireColorDef;
- aResList << QString( "%1 = %2.CreateObject( %3 );" )
- .arg( aPolylineName ).arg( aDocName ).arg( PYTHON_POLYLINEXY_ID );
- aResList << QString( "%1.SetName( \"%1\" );" ).arg( aPolylineName );
+ QColor aWireColor = GetWireColor();
+ setPythonObjectColor( aWireColorDef, aWireColor, DefaultWireColor(), "SetWireColor" );
+
+ if ( !aWireColorDef.isEmpty() )
+ {
+ aResList << aWireColorDef;
+ aResList << QString( "" );
+ }
// Set polilyne data
NCollection_Sequence<TCollection_AsciiString> aSectNames;
aResList << QString( "%1.AddSection( \"%2\", %3, %4 );" ).arg( aPolylineName )
.arg( aSectName.ToCString() ).arg( aSectType ).arg( aSectClosure );
- HYDROData_PolylineXY::PointsList aSectPointsList = GetPoints( i );
+ HYDROData_IPolyline::PointsList aSectPointsList = GetPoints( i - 1 );
for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
{
const Point& aSectPoint = aSectPointsList.Value( k );
- aResList << QString( "%1.AddPoint( %2, QPointF( %3, %4 ) );" ).arg( aPolylineName )
+ aResList << QString( "%1.AddPoint( %2, gp_XY( %3, %4 ) );" ).arg( aPolylineName )
.arg( i - 1 ).arg( aSectPoint.X() ).arg( aSectPoint.Y() );
}
}
+ aResList << QString( "" );
+ aResList << QString( "%1.Update();" ).arg( aPolylineName );
+ aResList << QString( "" );
+
return aResList;
}
aMakeWire.Add( aPnt );
}
if( theIsClosed )
- aMakeWire.Close();//.Add( thePoints.Value( 1 ) );
+ aMakeWire.Close();
if ( aMakeWire.IsDone() )
aWire = aMakeWire.Wire();