From: Paul RASCLE Date: Wed, 10 Feb 2016 17:30:15 +0000 (+0100) Subject: take LocalCS into account when importing SinusX file X-Git-Tag: SALOME_HYDRO_V1.0~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=31e8cb744178a783c586a5ea9bfcccee5173244c;p=modules%2Fhydro.git take LocalCS into account when importing SinusX file --- diff --git a/src/HYDROData/HYDROData_SinusX.cxx b/src/HYDROData/HYDROData_SinusX.cxx index 3927c0a3..c7f7701e 100644 --- a/src/HYDROData/HYDROData_SinusX.cxx +++ b/src/HYDROData/HYDROData_SinusX.cxx @@ -124,17 +124,25 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( theDocument->CreateObject( KIND_BATHYMETRY ) ); HYDROData_Bathymetry::AltitudePoints aAPoints; for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++) - aAPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[j])); + { + gp_XYZ aLocalPoint = gp_XYZ (myCurveBlocks[i].myXYZPoints[j]); + theDocument->Transform(aLocalPoint, true); + aAPoints.Append(aLocalPoint); + } aBath->SetAltitudePoints(aAPoints); aBath->SetName(GetName(myCurveBlocks[i].myName + "_bath")); theEntities.Append(aBath); } - if (myCurveBlocks[i].myType == 1 || myCurveBlocks[i].myType == 3) + if (myCurveBlocks[i].myType == 1 || myCurveBlocks[i].myType == 3) // XYZ curve or isocontour { NCollection_Sequence aPoints; for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++) - aPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[j])); + { + gp_XYZ aLocalPoint = gp_XYZ (myCurveBlocks[i].myXYZPoints[j]); + theDocument->Transform(aLocalPoint, true); + aPoints.Append(aLocalPoint); + } /*if (myCurveBlocks[i].myIsClosed) aPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[0]));*/ Handle(HYDROData_ProfileUZ) aProfileUZ = Handle(HYDROData_ProfileUZ)::DownCast( theDocument->CreateObject( KIND_PROFILEUZ ) ); @@ -153,9 +161,9 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec theEntities.Append(aProfileUZ); theEntities.Append(aProfile); } - if (myCurveBlocks[i].myType == 2) + if (myCurveBlocks[i].myType == 2) // XYZ profile { - if (myCurveBlocks[i].myCurvePlane == 2) + if (myCurveBlocks[i].myCurvePlane == 2) // plane XoZ { if (myCurveBlocks[i].myAdditionalCurveInfo.size() == 4) { @@ -168,21 +176,31 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec aProfile->SetParametricPoints(aPointList); if ( ! (myCurveBlocks[i].myAdditionalCurveInfo[0] == 0 && myCurveBlocks[i].myAdditionalCurveInfo[1] == 0 && myCurveBlocks[i].myAdditionalCurveInfo[2] == 0 && myCurveBlocks[i].myAdditionalCurveInfo[3] == 0) ) - { - aProfile->SetLeftPoint(gp_XY(myCurveBlocks[i].myAdditionalCurveInfo[0], myCurveBlocks[i].myAdditionalCurveInfo[1])); - aProfile->SetRightPoint(gp_XY(myCurveBlocks[i].myAdditionalCurveInfo[2], myCurveBlocks[i].myAdditionalCurveInfo[3])); + { // georeferenced profile + double xl = myCurveBlocks[i].myAdditionalCurveInfo[0]; + double yl = myCurveBlocks[i].myAdditionalCurveInfo[1]; + double xr = myCurveBlocks[i].myAdditionalCurveInfo[2]; + double yr = myCurveBlocks[i].myAdditionalCurveInfo[3]; + theDocument->Transform(xl, yl , true); + theDocument->Transform(xr, yr , true); + aProfile->SetLeftPoint(gp_XY(xl, yl)); + aProfile->SetRightPoint(gp_XY(xr, yr)); aProfile->Update(); } aProfile->SetName(GetName(myCurveBlocks[i].myName + "_profile")); theEntities.Append(aProfile); } } - if (myCurveBlocks[i].myCurvePlane == 0) + if (myCurveBlocks[i].myCurvePlane == 0) // plane XoY { Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( theDocument->CreateObject( KIND_PROFILE ) ); HYDROData_Profile::ProfilePoints aPointList; for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++) - aPointList.Append(myCurveBlocks[i].myXYZPoints[j]); + { + gp_XYZ aLocalPoint = gp_XYZ (myCurveBlocks[i].myXYZPoints[j]); + theDocument->Transform(aLocalPoint, true); + aPointList.Append(aLocalPoint); + } aProfile->GetProfileUZ()->SetSectionType(0, myCurveBlocks[i].myIsSpline ? HYDROData_PolylineXY::SECTION_SPLINE : HYDROData_PolylineXY::SECTION_POLYLINE); aProfile->GetProfileUZ()->SetSectionClosed(0, myCurveBlocks[i].myIsClosed ? true : false); aProfile->SetProfilePoints(aPointList); @@ -216,13 +234,13 @@ bool HYDROData_SinusX::Parse(QFile& theFile) { HYDROGUI_CurveBlock aCurveBlockInfo; if (aList[1] == "C") - aCurveBlockInfo.myType = 1; + aCurveBlockInfo.myType = 1; // XYZ curve else if (aList[1] == "P") - aCurveBlockInfo.myType = 2; + aCurveBlockInfo.myType = 2; // XYZ profile else if (aList[1] == "N") - aCurveBlockInfo.myType = 3; + aCurveBlockInfo.myType = 3; // isocontour else if (aList[1] == "S") - aCurveBlockInfo.myType = 4; + aCurveBlockInfo.myType = 4; // Scatter plot if (aList.size() == 9) { @@ -405,4 +423,4 @@ void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_Sequence