]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Debug features for object groups.
authoradv <adv@opencascade.com>
Thu, 19 Dec 2013 05:52:03 +0000 (05:52 +0000)
committeradv <adv@opencascade.com>
Thu, 19 Dec 2013 05:52:03 +0000 (05:52 +0000)
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DataModel.h
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 4a1baf917f2cff0683977c17c43ec6dc5a2ba887..89c3edc292968b051d9ca6a426e6c2466b4e8127 100644 (file)
@@ -705,6 +705,30 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParen
   return new HYDROGUI_NamedObject( theParent, theName, theParentEntry );
 }
 
+void HYDROGUI_DataModel::buildObjectPartition( SUIT_DataObject*                   theObject,
+                                               const HYDROData_SequenceOfObjects& theObjects,
+                                               const QString&                     thePartName,
+                                               const bool                         theIsCreateEmpty )
+{
+  if ( theObjects.IsEmpty() && !theIsCreateEmpty )
+    return;
+
+  HYDROGUI_DataObject* aGuiObj = dynamic_cast<HYDROGUI_DataObject*>( theObject );
+  if ( !aGuiObj )
+    return;
+
+  LightApp_DataObject* aPartSect = 
+    createObject( aGuiObj, thePartName, aGuiObj->entry() );
+
+  HYDROData_SequenceOfObjects::Iterator anIter( theObjects );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    Handle(HYDROData_Entity) anObj = anIter.Value();
+    if( !anObj.IsNull() && !anObj->IsRemoved() )
+      createObject( aPartSect, anObj, aGuiObj->entry(), false );
+  }
+}
+
 void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
                                           SUIT_DataObject* theObject,
                                           const QString&   theParentEntry,
@@ -728,18 +752,8 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
       createObject( aGuiObj, anObject3D, aGuiObj->entry(), false );
 
 #ifdef DEB_GROUPS
-    LightApp_DataObject* aGroupsSect = 
-      createObject( aGuiObj, tr( "OBJECT_GROUPS" ), aGuiObj->entry() );
-
     HYDROData_SequenceOfObjects anObjGroups = aGeomObj->GetGroups();
-    HYDROData_SequenceOfObjects::Iterator anIter( anObjGroups );
-    for ( ; anIter.More(); anIter.Next() )
-    {
-      Handle(HYDROData_ShapesGroup) anObjGroup =
-        Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
-      if( !anObjGroup.IsNull() && !anObjGroup->IsRemoved() )
-        createObject( aGroupsSect, anObjGroup, aGuiObj->entry(), false );
-    }
+    buildObjectPartition( aGuiObj, anObjGroups, tr( "OBJECT_GROUPS" ), false );
 #endif
   }
 
@@ -826,6 +840,15 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
       if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() )
         createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation );
     }
+
+#ifdef DEB_GROUPS
+    HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetSplittedGroups();
+    buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false );
+
+    HYDROData_SequenceOfObjects aCalcSplitGroups = aCaseObj->GetSplittedGroups();
+    buildObjectPartition( aGuiObj, aCalcSplitGroups, tr( "CASE_SPLITTED_GROUPS" ), false );
+#endif
+
   }
   else if ( anObjectKind == KIND_REGION )
   {
index 077905a5ff96fdb811f9bf422d5b2cd27ad57a29..019350e1a849a5ab3cff1c512a550f38dddedc37 100644 (file)
@@ -320,6 +320,18 @@ protected:
                                      const QString&           theParentEntry,
                                      const bool               theIsBuildTree ,
                                      const bool               theIsInOperation = false );
+  /**
+   * Build partition for object.
+   * \param theObject gui object for which the partition will be build
+   * \param theObjects sequence of builded objects
+   * \param thePartName name of created partition
+   * \param theIsCreateEmpty if true then partition will be created in any case
+   */
+  void                 buildObjectPartition( SUIT_DataObject*                   theObject,
+                                             const HYDROData_SequenceOfObjects& theObjects,
+                                             const QString&                     thePartName,
+                                             const bool                         theIsCreateEmpty );
+
   /**
    * Build tree of a model object.
    * \param theParent a created object will be appended as a child of this object
index 81eabc1f0c87b4c71c0fdc1c53acac2711aa8099..6091e92e95aa640e45c657788f075d6b79e091f3 100644 (file)
@@ -308,6 +308,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsChannel = false;
   bool anIsDigue = false;
   bool anIsDummyObject3D = false;
+  bool anIsGroup = false;
   bool anIsObjectCanBeColored = false;
 
   // Check the selected GEOM objects (take into account the Object Browser only)
@@ -416,6 +417,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         anIsDigue = true;
       else if( anObjectKind == KIND_DUMMY_3D )
         anIsDummyObject3D = true;
+      else if( anObjectKind == KIND_SHAPES_GROUP || anObjectKind == KIND_SPLITTED_GROUP )
+        anIsGroup = true;
     }
 
     if ( !anIsObjectCanBeColored )
@@ -587,7 +590,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         anIsImmersibleZone || anIsZone || anIsRegion ||
         anIsBathymetry || anIsObstacle || anIsStream ||
         anIsChannel || anIsDigue || anIsDummyObject3D ||
-        anIsValidProfile )
+        anIsValidProfile || anIsGroup )
     {
       if( anIsHiddenInSelection )
         theMenu->addAction( action( ShowId ) );
index 597c9db775e82e70464816dee99f4e502f7c7f1c..37eaf35001c6050e1f74bab38968ac0aaa59cef9 100644 (file)
@@ -47,6 +47,7 @@
 #include <HYDROData_Polyline3D.h>
 #include <HYDROData_Profile.h>
 #include <HYDROData_Region.h>
+#include <HYDROData_ShapesGroup.h>
 #include <HYDROData_Stream.h>
 #include <HYDROData_Zone.h>
 
@@ -350,6 +351,28 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
       setFillingColor( aFillingColor, false, false );
       setBorderColor( aBorderColor, false, false );
     }
+    else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ShapesGroup) ) )
+    {
+      Handle(HYDROData_ShapesGroup) aShapesGroup =
+        Handle(HYDROData_ShapesGroup)::DownCast( myObject );
+
+      TopTools_SequenceOfShape aShapes;
+      aShapesGroup->GetShapes( aShapes );
+
+      BRepBuilderAPI_MakeWire aMakeWire;
+
+      for ( int i = 1, n = aShapes.Length(); i <= n; ++i )
+      {
+        TopoDS_Edge anEdge = TopoDS::Edge( aShapes.Value( i ) );
+        aMakeWire.Add( anEdge );
+      }
+
+      aMakeWire.Build();
+      TopoDS_Wire aResWire = aMakeWire.Wire();
+
+      setWire( aResWire, false, false );  
+      setBorderColor( Qt::red, false, false );
+    }
   }
  
   if ( myShape.IsNull() || !isVisible() )
index 4733af2b1f46a4306084e77328098519443b5c38..48bf198941b2d9b7610f211575bbc5b5376cb81e 100644 (file)
@@ -68,6 +68,8 @@
 // encoding instead of default 'System'
 #define USE_LATIN1_ENCODING
 
+// #define DEB_GROUPS 1
+
 QString HYDROGUI_Tool::ToQString( const TCollection_AsciiString& src )
 {
 #ifdef USE_LATIN1_ENCODING
@@ -227,7 +229,12 @@ bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& the
          anObjectKind == KIND_STREAM ||
          anObjectKind == KIND_CHANNEL ||
          anObjectKind == KIND_DIGUE ||
-         anObjectKind == KIND_DUMMY_3D )
+         anObjectKind == KIND_DUMMY_3D
+#ifdef DEB_GROUPS
+         || anObjectKind == KIND_SHAPES_GROUP ||
+         anObjectKind == KIND_SPLITTED_GROUP
+#endif
+         )
     {
       return true;
     }
index 021ef5948d57cebecd4338271a0acc3a6ae2527b..b0e13dd5a40720f464c7c8c11ac701bade557695 100644 (file)
       <source>CASE_REGIONS</source>
       <translation>Regions</translation>
     </message>
+    <message>
+      <source>CASE_SPLITTED_GROUPS</source>
+      <translation>Splitted groups</translation>
+    </message>
     <message>
       <source>FILE_CAN_NOT_BE_IMPORTED</source>
       <translation>The file '%1' can not be imported: format *.%2 is not supported.</translation>