Salome HOME
Merge branch 'BR_HYDRO_IMPS_2016' into pre/IMPS_2016
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
index 927bd86524aee657da9c88063146792e5aa3da40..93499b742335d4787b5b438ab74b44875a3b7f80 100644 (file)
 #include "HYDROData_IAltitudeObject.h"
 #include <TopoDS_Shape.hxx>
 #include <TDataStd_Integer.hxx>
+#include <TDataStd_Real.hxx>
 
 #include <QColor>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,HYDROData_Entity)
 
@@ -73,11 +77,11 @@ void HYDROData_Object::Update()
 {
   if( IsMustBeUpdated( Geom_2d ) )
   {
-    removeTopShape();
-    removeGroupObjects();
+    RemoveTopShape();
+    RemoveGroupObjects();
   }
   if( IsMustBeUpdated( Geom_3d ) )
-    removeShape3D();
+    RemoveShape3D();
 
   checkAndSetAltitudeObject();
   HYDROData_Entity::Update();
@@ -309,6 +313,7 @@ void HYDROData_Object::checkAndSetAltitudeObject()
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
 
   ObjectKind anAltitudeObjectType = getAltitudeObjectType();
+  //DEBTRACE("HYDROData_Object::checkAndSetAltitudeObject anAltitudeObjectType="<< anAltitudeObjectType);
   if ( anAltitudeObjectType == KIND_UNKNOWN )
     return; // No need to create altitude object
 
@@ -323,6 +328,7 @@ void HYDROData_Object::checkAndSetAltitudeObject()
       HYDROData_Iterator::CreateObject( aChildLabel, anAltitudeObjectType ) );
 
   QString anAltitudePref = GetName() + "_Altitude";
+  //DEBTRACE("anAltitudePref " << anAltitudePref.toStdString());
   QString anAltitudeName = HYDROData_Tool::GenerateObjectName( aDocument, anAltitudePref );
   anAltitudeObject->SetName( anAltitudeName );
 
@@ -374,3 +380,26 @@ void HYDROData_Object::SetIsSubmersible( bool isSubmersible ) const
 {
   TDataStd_Integer::Set( myLab, isSubmersible ? 1 : 0 );
 }
+
+void HYDROData_Object::GetBoundaries( QList<TopoDS_Shape>& theBoundShapes,
+                                      QStringList& theBoundNames ) const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+    HYDROData_SequenceOfObjects::Iterator anIter( aGroups );
+    for ( ; anIter.More(); anIter.Next() )
+    {
+      Handle(HYDROData_ShapesGroup) aGroup =
+        Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
+      if( aGroup.IsNull() )
+        continue;
+
+      QString aName = aGroup->GetName();
+      TopTools_SequenceOfShape aShapes;
+      aGroup->GetShapes( aShapes );
+      for( int i=1, n=aShapes.Length(); i<=n; i++ )
+      {
+        theBoundShapes.append( aShapes( i ) );
+        theBoundNames.append( aName );
+      }
+    }
+}