]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Get the gepmetry objects method added.
authoradv <adv@opencascade.com>
Mon, 11 Nov 2013 05:03:26 +0000 (05:03 +0000)
committeradv <adv@opencascade.com>
Mon, 11 Nov 2013 05:03:26 +0000 (05:03 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_Tool.cxx
src/HYDROData/HYDROData_Tool.h
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_Tool.h

index 764d3cd1e70ef9bbee2a176bb65c40cdda0f0746..0561d47e1d01cad1d95936428c1f67bf6f99d837 100644 (file)
@@ -130,11 +130,7 @@ void HYDROData_CalculationCase::SplitGeometryObjects()
 
 bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
 {
-  if ( theObject.IsNull() )
-    return false;
-  
-  if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) &&
-       !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) )
+  if ( !HYDROData_Tool::IsGeometryObject( theObject ) )
     return false; // Wrong type of object
 
   if ( HasReference( theObject, DataTag_GeometryObject ) )
index 8c05efa2c76e06080484797edf185ff42c7195ce..c217725ab2e48741aef2f8397b07306ed75da90d 100644 (file)
@@ -1,8 +1,10 @@
 
 #include "HYDROData_Tool.h"
 
+#include "HYDROData_ArtificialObject.h"
 #include "HYDROData_Image.h"
 #include "HYDROData_Iterator.h"
+#include "HYDROData_NaturalObject.h"
 
 #include <QFile>
 #include <QStringList>
@@ -150,3 +152,11 @@ HYDROData_SequenceOfObjects HYDROData_Tool::FindObjectsByNames( const Handle(HYD
   return aResSeq;
 }
 
+bool HYDROData_Tool::IsGeometryObject( const Handle(HYDROData_Entity)& theObject )
+{
+  if ( theObject.IsNull() )
+    return false;
+  
+  return theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) ||
+         theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) );
+}
index 04835c87ea0f3fba014aec73f3e32adae583f5bb..5b550ca2b5bf502c51fc83b9693ea6136b858183 100644 (file)
@@ -59,6 +59,14 @@ public:
   static HYDROData_SequenceOfObjects    FindObjectsByNames( const Handle(HYDROData_Document)& theDoc,
                                                             const QStringList&                theNames,
                                                             const ObjectKind                  theObjectKind = KIND_UNKNOWN );
+
+  /**
+   * \brief Checks the type of object.
+   * \param theObject object to check
+   * \return true if object is geometry object
+   */
+  static bool                           IsGeometryObject( const Handle(HYDROData_Entity)& theObject );
+
 };
 
 inline bool ValuesEquals( const double& theFirst, const double& theSecond )
index 6fa0a831763a9d609337a80d3af710112010d522..cf877cb3e48c558a1c6a2c62be45478803877077 100644 (file)
@@ -298,6 +298,24 @@ Handle(HYDROData_Entity) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theM
   return NULL;
 }
 
+HYDROData_SequenceOfObjects HYDROGUI_Tool::GetGeometryObjects( 
+  const Handle(HYDROData_Document)& theDoc )
+{
+  HYDROData_SequenceOfObjects aResSeq;
+
+  HYDROData_Iterator anIter( theDoc );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    Handle(HYDROData_Entity) anObj = anIter.Current();
+    if ( !HYDROData_Tool::IsGeometryObject( anObj ) )
+      continue;
+
+    aResSeq.Append( anObj );
+  }
+  
+  return aResSeq;
+}
+
 ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule )
 {
   HYDROGUI_DataModel* aModel = theModule->getDataModel();
index 1874513a871a2a6302b32b4c9b9644e94e2786ce..56d1035ab06db1242d1f816499165a7a2cfc79cb 100644 (file)
@@ -148,6 +148,13 @@ public:
    */
   static Handle(HYDROData_Entity) GetSelectedObject( HYDROGUI_Module* theModule );
 
+  /**
+   * \brief Get the geometry data objects from document.
+   * \param theDoc document
+   * \return sequence of data objects
+   */
+  static HYDROData_SequenceOfObjects GetGeometryObjects( const Handle(HYDROData_Document)& theDoc );
+
   /**
    * \brief Get kind of objects the selected partition contains.
    * \param theModule module