From: Paul RASCLE Date: Mon, 27 Jul 2020 14:58:20 +0000 (+0200) Subject: when importing several isoContours from SinusX with the same name, treat them as... X-Git-Tag: SH_V2_2_0~86 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=daa87628ed7bc4033d311efd035a44da12a668ea;p=modules%2Fhydro.git when importing several isoContours from SinusX with the same name, treat them as several sections of one polyline --- diff --git a/src/HYDROData/HYDROData_SinusX.cxx b/src/HYDROData/HYDROData_SinusX.cxx index 8ffc1319..e9e376f4 100644 --- a/src/HYDROData/HYDROData_SinusX.cxx +++ b/src/HYDROData/HYDROData_SinusX.cxx @@ -34,6 +34,7 @@ #include #include #include +#include //#define _DEVDEBUG_ #include "HYDRO_trace.hxx" @@ -128,6 +129,8 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec if (importOptions && (myCurveBlocks.size() != importOptions->size())) importOptions = NULL; //incorrect input + QMap polyMap; + for ( size_t i = 0; i < myCurveBlocks.size(); i++ ) { if (myCurveBlocks[i].myType == 4) /// scatter plot -> to bathy @@ -166,19 +169,28 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec 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 ) );