From: asl Date: Fri, 26 Jun 2015 13:00:34 +0000 (+0300) Subject: refs #585: merge X-Git-Tag: v1.4.2~18^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87c8246d7106bfe669bb217fba42f75bc3721194;p=modules%2Fhydro.git refs #585: merge --- diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index 43eda5ff..757805c1 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -51,7 +51,7 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD for( int i=0, n=aCurves.size(); i aCurvesList = Split( aCurves[i], thePoint, theTolerance ); - bool isLocalOK = CreatePolylines( theDoc, thePolyline->GetName(), aCurvesList ); + bool isLocalOK = CreatePolylines( theDoc, thePolyline->GetName(), aCurvesList, true ); isOK = isOK && isLocalOK; } return isOK; @@ -74,8 +74,8 @@ bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theD int f = thePolylines.Lower(), l = thePolylines.Upper(); for( int i=f; i<=l; i++ ) { - Handle( HYDROData_PolylineXY ) aPolylineI = Handle( HYDROData_PolylineXY )::DownCast( thePolylines.Value( i ) ); - if( !split( theDoc, aPolylineI, thePolylines, theTolerance, i ) ) + Handle( HYDROData_PolylineXY ) aPolyline = Handle( HYDROData_PolylineXY )::DownCast( thePolylines.Value( i ) ); + if( !split( theDoc, aPolyline, thePolylines, theTolerance, i ) ) return false; } return true; @@ -89,15 +89,30 @@ bool HYDROData_PolylineOperator::Merge( const Handle( HYDROData_Document )& theD { TopoDS_Shape aMergedPolyline; - //TODO + int f = thePolylines.Lower(), l = thePolylines.Upper(); + for( int i=f; i<=l; i++ ) + { + Handle( HYDROData_PolylineXY ) aPolyline = Handle( HYDROData_PolylineXY )::DownCast( thePolylines.Value( i ) ); + std::vector aCurves = GetWires( aPolyline ); + for( int j=0, m=aCurves.size(); j aShapes( 1 ); aShapes[0] = aMergedPolyline; - CreatePolylines( theDoc, theName, aShapes ); + CreatePolylines( theDoc, theName, aShapes, false ); return true; } +bool HYDROData_PolylineOperator::Merge( TopoDS_Shape& theShape, const TopoDS_Wire& theWire, + bool isConnectByNewSegment, double theTolerance ) +{ + //TODO + return true; +} + bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theDoc, const Handle( HYDROData_PolylineXY )& thePolyline, const HYDROData_SequenceOfObjects& theTools, @@ -132,7 +147,7 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD aResults = aNewResults; } - CreatePolylines( theDoc, thePolyline->GetName(), aResults ); + CreatePolylines( theDoc, thePolyline->GetName(), aResults, true ); return isOK; } @@ -186,7 +201,8 @@ std::vector HYDROData_PolylineOperator::Split( const std::vector& theShapes ) + const std::vector& theShapes, + bool isUseIndices ) { if( theDoc.IsNull() ) return false; diff --git a/src/HYDROData/HYDROData_PolylineOperator.h b/src/HYDROData/HYDROData_PolylineOperator.h index 0613c239..3f92f0be 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.h +++ b/src/HYDROData/HYDROData_PolylineOperator.h @@ -64,9 +64,13 @@ protected: static std::vector Split( const std::vector& theWires, double theTolerance ); + static bool Merge( TopoDS_Shape& theShape, const TopoDS_Wire& theWire, + bool isConnectByNewSegment, double theTolerance ); + static bool CreatePolylines( const Handle( HYDROData_Document )& theDoc, const QString& theNamePrefix, - const std::vector& theShape ); + const std::vector& theShape, + bool isUseIndices ); }; #endif