#include <QStringList>
#include <QTextStream>
#include <QColor>
+#include <QMap>
//#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
if (importOptions && (myCurveBlocks.size() != importOptions->size()))
importOptions = NULL; //incorrect input
+ QMap<QString,Handle(HYDROData_PolylineXY) > polyMap;
+
for ( size_t i = 0; i < myCurveBlocks.size(); i++ )
{
if (myCurveBlocks[i].myType == 4) /// scatter plot -> to bathy
aPoints.Append(aLocalPoint);
}
- Handle(HYDROData_PolylineXY) aPolyXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
+ QString polyName = myCurveBlocks[i].myName;
+ Handle(HYDROData_PolylineXY) aPolyXY;
+ if (polyMap.contains(polyName))
+ aPolyXY = polyMap[polyName];
+ else
+ {
+ aPolyXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
+ polyMap[polyName] = aPolyXY;
+ aPolyXY->SetName(GetName(myCurveBlocks[i].myName));
+ aPolyXY->SetWireColor(HYDROData_PolylineXY::DefaultWireColor());
+ theEntities.Append(aPolyXY);
+ }
aPolyXY->AddSection( "",
myCurveBlocks[i].myIsSpline ? HYDROData_PolylineXY::SECTION_SPLINE : HYDROData_PolylineXY::SECTION_POLYLINE,
- myCurveBlocks[i].myIsClosed ? true : false);
- aPolyXY->SetName(GetName(myCurveBlocks[i].myName));
- aPolyXY->SetWireColor(HYDROData_PolylineXY::DefaultWireColor());
+ myCurveBlocks[i].myIsClosed ? true : false);
+ int numSec = aPolyXY->NbSections() -1;
for ( int k = 1; k <= aPoints.Size(); k++ ) {
const HYDROData_Profile::ProfilePoint& aBottomPoint = aPoints.Value( k );
- aPolyXY->AddPoint( 0, HYDROData_PolylineXY::Point( aBottomPoint.X(), aBottomPoint.Y() ) );
+ aPolyXY->AddPoint( numSec, HYDROData_PolylineXY::Point( aBottomPoint.X(), aBottomPoint.Y() ) );
}
- theEntities.Append(aPolyXY);
if (!importOptions || (importOptions && (*importOptions)[i].ImportAsProfile == true))
{
Handle(HYDROData_ProfileUZ) aProfileUZ = Handle(HYDROData_ProfileUZ)::DownCast( theDocument->CreateObject( KIND_PROFILEUZ ) );