for( int i=0, n=aCurves.size(); i<n; i++ )
{
std::vector<TopoDS_Shape> 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;
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;
{
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<TopoDS_Wire> aCurves = GetWires( aPolyline );
+ for( int j=0, m=aCurves.size(); j<m; j++ )
+ if( !Merge( aMergedPolyline, aCurves[j], isConnectByNewSegment, theTolerance ) )
+ return false;
+ }
std::vector<TopoDS_Shape> 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,
aResults = aNewResults;
}
- CreatePolylines( theDoc, thePolyline->GetName(), aResults );
+ CreatePolylines( theDoc, thePolyline->GetName(), aResults, true );
return isOK;
}
bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Document )& theDoc,
const QString& theNamePrefix,
- const std::vector<TopoDS_Shape>& theShapes )
+ const std::vector<TopoDS_Shape>& theShapes,
+ bool isUseIndices )
{
if( theDoc.IsNull() )
return false;
static std::vector<TopoDS_Shape> Split( const std::vector<TopoDS_Wire>& 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<TopoDS_Shape>& theShape );
+ const std::vector<TopoDS_Shape>& theShape,
+ bool isUseIndices );
};
#endif