Salome HOME
Merge branch 'BR_LAND_COVER_MAP' into BR_quadtree
[modules/hydro.git] / src / HYDROData / HYDROData_Bathymetry.cxx
index 23dfb286c2f7d84406cefeb7c83cf0e1d37dd3ab..9fabcb648d6175233c79c51efa9170d050e5782a 100644 (file)
@@ -30,6 +30,7 @@
 #include <TDataStd_AsciiString.hxx>
 #include <TDataStd_Integer.hxx>
 
+#include <QColor>
 #include <QFile>
 #include <QFileInfo>
 #include <QPointF>
@@ -72,7 +73,8 @@ HYDROData_Bathymetry::~HYDROData_Bathymetry()
 //    myListOfNodes.clear();
 }
 
-QStringList HYDROData_Bathymetry::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+QStringList HYDROData_Bathymetry::DumpToPython( const QString& thePyScriptPath,
+                                                MapOfTreatedObjects& theTreatedObjects ) const
 {
   QStringList aResList = dumpObjectCreation( theTreatedObjects );
   QString aBathymetryName = GetObjPyName();
@@ -112,10 +114,10 @@ void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints )
     aCoordsArray->SetValue( i * 3 + 2, aPoint.Z() );
   }
 
-  SetToUpdate( true );
+  Changed( Geom_Z );
 }
 
-HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() const
+HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(bool IsConvertToGlobal) const
 {
   AltitudePoints aPoints;
 
@@ -127,6 +129,7 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c
   if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) )
     return aPoints;
 
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab );
   for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; )
   {
     if ( i + 3 > n + 1 )
@@ -137,6 +140,8 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c
     aPoint.SetY( aCoordsArray->Value( i++ ) );
     aPoint.SetZ( aCoordsArray->Value( i++ ) );
 
+    if( IsConvertToGlobal )
+      aDoc->Transform( aPoint, false );
     aPoints.Append( aPoint );
   }
 
@@ -188,12 +193,12 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
 
 void HYDROData_Bathymetry::RemoveAltitudePoints()
 {
-  TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
-  if (!aLabel.IsNull())
-    {
-      aLabel.ForgetAllAttributes();
-      SetToUpdate(true);
-    }
+  TDF_Label aLabel = myLab.FindChild( DataTag_AltitudePoints, false );
+  if ( !aLabel.IsNull() )
+  {
+    aLabel.ForgetAllAttributes();
+    Changed( Geom_Z );
+  }
 }
 
 void interpolateAltitudeForPoints( const gp_XY&                               thePoint,
@@ -251,7 +256,7 @@ void interpolateAltitudeForPoints( const gp_XY&                               th
 
 double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint) const
 {
-  //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
+  DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
   double anInvalidAltitude = GetInvalidAltitude();
   double aResAltitude = anInvalidAltitude;
 
@@ -445,7 +450,7 @@ void HYDROData_Bathymetry::SetAltitudesInverted( const bool theIsInverted,
 
   TDataStd_Integer::Set( myLab.FindChild( DataTag_AltitudesInverted ), (Standard_Integer)theIsInverted );
 
-  SetToUpdate( true );
+  Changed( Geom_Z );
 
   if ( !theIsUpdate )
     return;
@@ -717,6 +722,9 @@ Handle_HYDROData_PolylineXY HYDROData_Bathymetry::CreateBoundaryPolyline() const
   aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmin, Ymax ) );
   aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymax ) );
   aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymin ) );
+  
+  aResult->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
+  
   aResult->Update();
 
   return aResult;