]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Python scripting is done forcalculation Regions (Feature #13).
authoradv <adv@opencascade.com>
Mon, 23 Sep 2013 13:02:05 +0000 (13:02 +0000)
committeradv <adv@opencascade.com>
Mon, 23 Sep 2013 13:02:05 +0000 (13:02 +0000)
src/HYDROData/HYDROData_Calculation.cxx
src/HYDROPy/HYDROData.sip
src/HYDROPy/HYDROData_Document.sip
src/HYDROPy/HYDROData_Domain.sip [new file with mode: 0644]
src/HYDROPy/HYDROData_Object.sip
src/HYDROPy/HYDROData_Region.sip [new file with mode: 0644]
src/HYDROPy/HYDROData_Zone.sip
src/HYDROPy/HYDROPy.vcproj

index f11513cc9b4f5965f2722919ca708a4f15312019..9514bcbd5945ca2f2df3295d0979e1f327c3b410 100644 (file)
@@ -60,10 +60,10 @@ QStringList HYDROData_Calculation::DumpToPython( MapOfTreatedObjects& theTreated
   anIter.Init( aZones );
   for ( ; anIter.More(); anIter.Next() )
   {
-    Handle(HYDROData_Zone) aSplittedZone =
-      Handle(HYDROData_Zone)::DownCast( anIter.Value() );
-    if ( !aSplittedZone.IsNull() )
-      setPythonReferenceObject( theTreatedObjects, aResList, aSplittedZone, "AddRegion" );
+    Handle(HYDROData_Region) aRegion =
+      Handle(HYDROData_Region)::DownCast( anIter.Value() );
+    if ( !aRegion.IsNull() )
+      setPythonReferenceObject( theTreatedObjects, aResList, aRegion, "AddRegion" );
   }
 
   return aResList;
index 1ef50c1e8e3ccc0ca21e2fc72f83d2b4bec1f3fe..51f6775df4ddfdd5759628e637b672704ffe3622 100644 (file)
@@ -56,6 +56,7 @@ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 %Include HYDROData_Image.sip
 %Include HYDROData_Polyline.sip
 %Include HYDROData_Bathymetry.sip
+%Include HYDROData_Domain.sip
 %Include HYDROData_Zone.sip
 %Include HYDROData_Calculation.sip
 
index a53cada0558e1f1b900d7985d73a6702439293d2..e79e16d57bf4a30e85c59e058acede435534ee7b 100644 (file)
@@ -87,6 +87,11 @@ class HYDROData_Document
         aRes = new HYDROData_Zone( *dynamic_cast<HYDROData_Zone*>( theObject ) );
         break;
       }
+      case KIND_REGION:
+      {
+        aRes = new HYDROData_Region( *dynamic_cast<HYDROData_Region*>( theObject ) );
+        break;
+      }
     }
     
     return aRes;
diff --git a/src/HYDROPy/HYDROData_Domain.sip b/src/HYDROPy/HYDROData_Domain.sip
new file mode 100644 (file)
index 0000000..79f7012
--- /dev/null
@@ -0,0 +1,161 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%ExportedHeaderCode
+#include <HYDROData_Domain.h>
+%End
+
+class HYDROData_Domain : HYDROData_Object
+{
+
+%TypeHeaderCode
+#include <HYDROData_Domain.h>
+%End
+
+%ConvertToSubClassCode
+    // HYDROData_Object sub-classes provide a unique kind ID.
+    switch ( sipCpp->GetKind() )
+    {
+      case KIND_REGION:
+        sipClass = sipClass_HYDROData_Region;
+        break;
+
+      case KIND_ZONE:
+        sipClass = sipClass_HYDROData_Zone;
+        break;
+
+      case KIND_UNKNOWN:
+        sipClass = sipClass_HYDROData_Object;
+        break;
+
+      default:
+        // We don't recognise the type.
+        sipClass = NULL;
+    }
+%End
+
+public:      
+
+  /**
+   * Sets filling color for zone.
+   */
+  void SetFillingColor( const QColor& theColor );
+
+  /**
+   * Returns filling color of zone.
+   */
+  QColor GetFillingColor() const;
+
+  /**
+   * Sets border color for zone.
+   */
+  void SetBorderColor( const QColor& theColor );
+
+  /**
+   * Returns border color of zone.
+   */
+  QColor GetBorderColor() const;
+
+  /**
+   * Returns number of bathymetry objects for zone.
+   */
+  int NbBathymetries() const;
+
+  /**
+   * Add reference bathymetry object for zone.
+   */
+  void AddBathymetry( HYDROData_Bathymetry theBathymetry ) [void (const Handle_HYDROData_Bathymetry&)];
+  %MethodCode
+
+    Handle(HYDROData_Bathymetry) aRefBath =
+      Handle(HYDROData_Bathymetry)::DownCast( createHandle( a0 ) );
+    if ( !aRefBath.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipSelfWasArg ? sipCpp->HYDROData_Domain::AddBathymetry( aRefBath ) : 
+                      sipCpp->AddBathymetry( aRefBath );
+      Py_END_ALLOW_THREADS
+    }
+
+  %End
+
+  /**
+   * Change reference bathymetry object with given index for zone.
+   */
+  void SetBathymetry( const int            theIndex, 
+                      HYDROData_Bathymetry theBathymetry ) [void (const int, const Handle_HYDROData_Bathymetry&)];
+  %MethodCode
+
+    Handle(HYDROData_Bathymetry) aRefBath =
+      Handle(HYDROData_Bathymetry)::DownCast( createHandle( a1 ) );
+    if ( !aRefBath.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipSelfWasArg ? sipCpp->HYDROData_Domain::SetBathymetry( a0, aRefBath ) : 
+                      sipCpp->SetBathymetry( a0, aRefBath );
+      Py_END_ALLOW_THREADS
+    }
+
+  %End
+
+  /**
+   * Returns reference bathymetry object of zone by it index.
+   */
+  HYDROData_Bathymetry GetBathymetry( const int theIndex ) const [Handle_HYDROData_Bathymetry (const int)];
+  %MethodCode
+
+    Handle(HYDROData_Bathymetry) aRefBath;
+    
+    Py_BEGIN_ALLOW_THREADS
+    aRefBath = sipSelfWasArg ? sipCpp->HYDROData_Domain::GetBathymetry( a0 ) : 
+                               sipCpp->GetBathymetry( a0 );
+    Py_END_ALLOW_THREADS
+    
+    sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath );
+  
+  %End
+
+  /**
+   * Returns list of all reference bathymetry objects of zone.
+   */
+  //HYDROData_SequenceOfObjects GetBathymetries() const;
+
+  /**
+   * Clear list of bathymetry objects of zone.
+   */
+  void RemoveBathymetries();
+
+protected:
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_Domain();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_Domain();
+};
+
+
index 5cec249f104ea2187d69f8a909e344a3f4a63ca9..1d67675dd6e7791121d7d116d5389df865f3105a 100644 (file)
@@ -34,6 +34,7 @@ const ObjectKind KIND_VISUAL_STATE;
 const ObjectKind KIND_BATHYMETRY;
 const ObjectKind KIND_CALCULATION;
 const ObjectKind KIND_ZONE;
+const ObjectKind KIND_REGION;
 
 class HYDROData_Object
 {
@@ -65,6 +66,10 @@ class HYDROData_Object
         sipClass = sipClass_HYDROData_Zone;
         break;
 
+      case KIND_REGION:
+        sipClass = sipClass_HYDROData_Region;
+        break;
+
       case KIND_UNKNOWN:
         sipClass = sipClass_HYDROData_Object;
         break;
diff --git a/src/HYDROPy/HYDROData_Region.sip b/src/HYDROPy/HYDROData_Region.sip
new file mode 100644 (file)
index 0000000..3199acc
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%ExportedHeaderCode
+#include <HYDROData_Region.h>
+%End
+
+class HYDROData_Region : HYDROData_Domain
+{
+
+%TypeHeaderCode
+#include <HYDROData_Region.h>
+%End
+
+%ConvertToSubClassCode
+    if ( !Handle(HYDROData_Region)::DownCast( sipCpp ).IsNull() )
+      sipClass = sipClass_HYDROData_Region;
+    else
+      sipClass = NULL;
+%End
+
+public:
+
+  const ObjectKind          GetKind() const;
+
+protected:
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_Region();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_Region();
+};
+
+
index 892ef0aa2e847edf229fd07a49cb7147c8012f23..c7c4bb7e7818cd75367ec5a300b96de705bc26ee 100644 (file)
@@ -24,7 +24,7 @@
 #include <HYDROData_Zone.h>
 %End
 
-class HYDROData_Zone : HYDROData_Object
+class HYDROData_Zone : HYDROData_Domain
 {
 
 %TypeHeaderCode
@@ -44,26 +44,6 @@ public:
 
 public:      
 
-  /**
-   * Sets filling color for zone.
-   */
-  void SetFillingColor( const QColor& theColor );
-
-  /**
-   * Returns filling color of zone.
-   */
-  QColor GetFillingColor() const;
-
-  /**
-   * Sets border color for zone.
-   */
-  void SetBorderColor( const QColor& theColor );
-
-  /**
-   * Returns border color of zone.
-   */
-  QColor GetBorderColor() const;
-
   /**
    * Sets reference polyline object for zone.
    */
@@ -104,75 +84,6 @@ public:
    */
   void RemovePolyline();
 
-  /**
-   * Returns number of bathymetry objects for zone.
-   */
-  int NbBathymetries() const;
-
-  /**
-   * Add reference bathymetry object for zone.
-   */
-  void AddBathymetry( HYDROData_Bathymetry theBathymetry ) [void (const Handle_HYDROData_Bathymetry&)];
-  %MethodCode
-
-    Handle(HYDROData_Bathymetry) aRefBath =
-      Handle(HYDROData_Bathymetry)::DownCast( createHandle( a0 ) );
-    if ( !aRefBath.IsNull() )
-    {
-      Py_BEGIN_ALLOW_THREADS
-      sipSelfWasArg ? sipCpp->HYDROData_Zone::AddBathymetry( aRefBath ) : 
-                      sipCpp->AddBathymetry( aRefBath );
-      Py_END_ALLOW_THREADS
-    }
-
-  %End
-
-  /**
-   * Change reference bathymetry object with given index for zone.
-   */
-  void SetBathymetry( const int            theIndex, 
-                      HYDROData_Bathymetry theBathymetry ) [void (const int, const Handle_HYDROData_Bathymetry&)];
-  %MethodCode
-
-    Handle(HYDROData_Bathymetry) aRefBath =
-      Handle(HYDROData_Bathymetry)::DownCast( createHandle( a1 ) );
-    if ( !aRefBath.IsNull() )
-    {
-      Py_BEGIN_ALLOW_THREADS
-      sipSelfWasArg ? sipCpp->HYDROData_Zone::SetBathymetry( a0, aRefBath ) : 
-                      sipCpp->SetBathymetry( a0, aRefBath );
-      Py_END_ALLOW_THREADS
-    }
-
-  %End
-
-  /**
-   * Returns reference bathymetry object of zone by it index.
-   */
-  HYDROData_Bathymetry GetBathymetry( const int theIndex ) const [Handle_HYDROData_Bathymetry (const int)];
-  %MethodCode
-
-    Handle(HYDROData_Bathymetry) aRefBath;
-    
-    Py_BEGIN_ALLOW_THREADS
-    aRefBath = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetBathymetry( a0 ) : 
-                               sipCpp->GetBathymetry( a0 );
-    Py_END_ALLOW_THREADS
-    
-    sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath );
-  
-  %End
-
-  /**
-   * Returns list of all reference bathymetry objects of zone.
-   */
-  //HYDROData_SequenceOfObjects GetBathymetries() const;
-
-  /**
-   * Clear list of bathymetry objects of zone.
-   */
-  void RemoveBathymetries();
-
   /**
    * Returns the painter path. The painter path is construct by polyline
    */
index ba703b69a23016ea738c445a6598c2aaa125fb56..bb69aa65aed2ce2216257cf38231668b0a34145b 100644 (file)
                                RelativePath=".\HYDROData_Document.sip"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Domain.sip"
+                               >
+                       </File>
                        <File
                                RelativePath=".\HYDROData_Image.sip"
                                >
                                RelativePath=".\HYDROData_Polyline.sip"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Region.sip"
+                               >
+                       </File>
                        <File
                                RelativePath=".\HYDROData_Zone.sip"
                                >