+
+ aPolylineXY->SetName( aPolyXYName );
+ aPolylineXY->SetWireColor(HYDROData_PolylineXY::DefaultWireColor());
+ aPolylineXY->Update();
+
+ aBath->SetAltitudePoints(aAPoints);
+ aBath->SetName( aBathName );
+
+ aPolylineObj->SetPolylineXY (aPolylineXY, false);
+ aPolylineObj->SetAltitudeObject(aBath);
+
+ aPolylineObj->SetBorderColor( HYDROData_Polyline3D::DefaultBorderColor() );
+ aPolylineObj->SetName( aPoly3DName );
+
+ aPolylineObj->Update();
+
+ size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+ if ( anActiveViewId == 0 )
+ anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
+
+ module()->setObjectVisible( anActiveViewId, aPolylineXY, true );
+ module()->setObjectVisible( anActiveViewId, aPolylineObj, true );
+
+ module()->setIsToUpdate( aPolylineObj );
+}
+
+void HYDROGUI_ImportPolylineOp::ProcessSHPPolyXY(SHPObject* anObj, QString theFileName, int theInd)
+{
+ //if (anObj->nSHPType != SHPT_ARC && anObj->nSHPType != SHPT_ARCM)
+ // return false;
+ Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) );
+
+ int nParts = anObj->nParts;
+ for ( int i = 0 ; i < nParts ; i++ )
+ {
+ int StartIndex = anObj->panPartStart[i];
+ int EndIndex;
+ if (i != nParts - 1)
+ EndIndex = anObj->panPartStart[i + 1];
+ else
+ EndIndex = anObj->nVertices;
+
+ bool IsClosed = false;
+ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+ if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
+ anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] )
+ {
+ IsClosed = true;
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true);
+ }
+ else
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, false);
+
+ if (IsClosed)
+ EndIndex--;
+ for ( int k = StartIndex; k < EndIndex ; k++ )
+ {
+ HYDROData_PolylineXY::Point aSectPoint;
+ aSectPoint.SetX( anObj->padfX[k] );
+ aSectPoint.SetY( anObj->padfY[k] );
+ aPolylineXY->AddPoint( i, aSectPoint );
+ }
+
+ }
+
+ aPolylineXY->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
+ aPolylineXY->SetName( theFileName + "_PolyXY_" + QString::number(theInd) );
+
+ aPolylineXY->Update();
+
+ size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+ if ( anActiveViewId == 0 )
+ anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
+
+ module()->setObjectVisible( anActiveViewId, aPolylineXY, true );
+
+ module()->setIsToUpdate( aPolylineXY );
+}
+
+void HYDROGUI_ImportPolylineOp::ProcessSHPPoly3D(SHPObject* anObj, QString theFileName, int theInd)
+{
+ Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) );
+
+ Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) );
+
+ Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) );
+ HYDROData_Bathymetry::AltitudePoints aAPoints;
+
+ int nParts = anObj->nParts;
+ for ( int i = 0 ; i < nParts ; i++ )
+ {
+ //bool aSectClosure = true;
+ int StartIndex = anObj->panPartStart[i];
+ int EndIndex;
+ if (i != nParts - 1)
+ EndIndex = anObj->panPartStart[i + 1];
+ else
+ EndIndex = anObj->nVertices;
+
+ bool IsClosed = false;
+ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+ if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
+ anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] &&
+ anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])
+ {
+ IsClosed = true;
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true );
+ }
+ else
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, false );
+
+ if (IsClosed)
+ EndIndex--;
+ for ( int k = StartIndex ; k < EndIndex ; k++ )
+ {
+ HYDROData_PolylineXY::Point aSectPoint;
+ aSectPoint.SetX( anObj->padfX[k] );
+ aSectPoint.SetY( anObj->padfY[k] );
+ aPolylineXY->AddPoint( i, aSectPoint );
+ aAPoints.Append(gp_XYZ (anObj->padfX[k], anObj->padfY[k], anObj->padfZ[k]));
+ }
+ }
+
+
+ QString aBathName = theFileName + "_bath_" + QString::number(theInd);
+ QString aPolyXYName = theFileName + "_polyXY_" + QString::number(theInd);
+ QString aPoly3DName = theFileName + "_poly3D_" + QString::number(theInd);