X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_PolylineOperator.cxx;h=0bc2d326069380329d9f92e0bb4d15626c24eff5;hb=545854182f0363f61284d5abe34c3627d4f3b088;hp=3a4183e8db3fd7b46fa85cdff3508f6b64225d73;hpb=19ae50f3858a077a34385debc9e08de1d8fc42b9;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index 3a4183e8..0bc2d326 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -19,8 +19,11 @@ #include #include #include +#include +#ifndef LIGHT_MODE #include +#endif #include #include @@ -44,7 +47,9 @@ #include #include #include -#include +#include +#include +#include template void append( std::vector& theList, const std::vector& theList2 ) { @@ -77,8 +82,9 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD for( int i=0, n=aCurves.size(); i aCurvesList; - Split(aCurves[i], thePoint, theTolerance, aCurvesList); - bool isLocalOK = CreatePolylines( theDoc, thePolyline->GetName(), aCurvesList, true ); + Split( aCurves[i], thePoint, theTolerance, aCurvesList ); + bool isLocalOK = CreatePolylines( theDoc, thePolyline->GetName(), + aCurvesList, true, thePolyline->GetWireColor() ); isOK = isOK && isLocalOK; } return isOK; @@ -157,7 +163,7 @@ bool HYDROData_PolylineOperator::Merge( const Handle( HYDROData_Document )& theD std::vector aPolylines(1); aPolylines[0] = aWireSet; - CreatePolylines(theDoc, theName, aPolylines, false); + CreatePolylines( theDoc, theName, aPolylines, false, QColor() ); return true; } @@ -225,7 +231,7 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD } } - CreatePolylines(theDoc, thePolyline->GetName(), aResult, true); + CreatePolylines( theDoc, thePolyline->GetName(), aResult, true, thePolyline->GetWireColor() ); return true; } @@ -277,7 +283,8 @@ void HYDROData_PolylineOperator::Split( bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Document )& theDoc, const QString& theNamePrefix, const std::vector& theShapes, - bool isUseIndices ) + bool isUseIndices, + const QColor& theColor ) { if( theDoc.IsNull() ) return false; @@ -304,6 +311,9 @@ bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Docume { aPolyline->SetName( theNamePrefix ); } + + if( theColor.isValid() ) + aPolyline->SetWireColor( theColor ); } return true; } @@ -331,7 +341,9 @@ double HYDROData_PolylineOperator::ReduceDeflection( } Handle(Geom_BSplineCurve) aBSpline2; const bool isClosed = theCurve.IsClosed(); +#ifndef LIGHT_MODE if (!CurveCreator_Utils::constructBSpline(aPs2, isClosed, aBSpline2)) +#endif { return -1; } @@ -407,3 +419,43 @@ double HYDROData_PolylineOperator::ReduceDeflection( } return aMaxDefl; } + +bool HYDROData_PolylineOperator::Extract( const Handle(HYDROData_Document)& theDocument, + const Handle(HYDROData_Object)& theObject ) +{ + if( theObject.IsNull() || theDocument.IsNull() ) + return false; + + QList aBoundShapes; + QStringList aBoundNames; + + theObject->GetBoundaries( aBoundShapes, aBoundNames ); + + for( int i=0, n=aBoundShapes.size(); iCreateObject( KIND_POLYLINEXY ) ); + + if( aPolyline.IsNull() ) + return false; + + aPolyline->SetShape( aShape ); + + int anIndex = 0; + QString aName = aBoundName; + while( !theDocument->FindObjectByName( aName ).IsNull() ) + { + anIndex++; + aName = aBoundName + "_" + QString::number( anIndex ); + } + aPolyline->SetName( aName ); + } + + return true; +}