]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Python API for HYDROData_Polyline. Plus some minor changes.
authoradv <adv@opencascade.com>
Fri, 6 Sep 2013 07:27:20 +0000 (07:27 +0000)
committeradv <adv@opencascade.com>
Fri, 6 Sep 2013 07:27:20 +0000 (07:27 +0000)
src/HYDROPy/HYDROData.sip
src/HYDROPy/HYDROData_Document.sip
src/HYDROPy/HYDROData_Object.sip
src/HYDROPy/HYDROData_Polyline.sip [new file with mode: 0644]
src/HYDROPy/HYDROPy.vcproj

index 9bb7e82fddb2bdc01b46dbd9dad63a0a25380873..16016f2a3c2269076be90f6883676458d0d66d5f 100644 (file)
@@ -53,9 +53,9 @@ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 %Import QtGui/QtGuimod.sip
 
 %Include HYDROData_Object.sip
-%Include HYDROData_Bathymetry.sip
 %Include HYDROData_Image.sip
-
+%Include HYDROData_Polyline.sip
+%Include HYDROData_Bathymetry.sip
 
 %Include HYDROData_Document.sip
 
index 9c4779fff7f9a0a7a0b30540b8b180ac75ed450a..4c2bfae199b2f2e65a7558fbde89b2a2a0c6ce68 100644 (file)
@@ -62,14 +62,19 @@ class HYDROData_Document
 
     switch( theObject->GetKind() )
     {
-      case KIND_BATHYMETRY:
+      case KIND_IMAGE:
       {
-        aRes = new HYDROData_Bathymetry( *dynamic_cast<HYDROData_Bathymetry*>( theObject ) );
+        aRes = new HYDROData_Image( *dynamic_cast<HYDROData_Image*>( theObject ) );
         break;
       }
-      case KIND_IMAGE:
+      case KIND_POLYLINE:
       {
-        aRes = new HYDROData_Image( *dynamic_cast<HYDROData_Image*>( theObject ) );
+        aRes = new HYDROData_Polyline( *dynamic_cast<HYDROData_Polyline*>( theObject ) );
+        break;
+      }
+      case KIND_BATHYMETRY:
+      {
+        aRes = new HYDROData_Bathymetry( *dynamic_cast<HYDROData_Bathymetry*>( theObject ) );
         break;
       }
     }
index feb7aca2297ea58fea49ff4b6f2907b8fe5dc5ea..ba45f00f2ddde692c2d10d10b6954814c45de272 100644 (file)
@@ -41,6 +41,10 @@ class HYDROData_Object
         sipClass = sipClass_HYDROData_Image;
         break;
 
+      case KIND_POLYLINE:
+        sipClass = sipClass_HYDROData_Polyline;
+        break;
+
       case KIND_BATHYMETRY:
         sipClass = sipClass_HYDROData_Bathymetry;
         break;
@@ -55,22 +59,6 @@ class HYDROData_Object
     }
 %End
 
-public:
-  /**
-   * Visual state data.
-   */
-  struct VisualState
-  {
-    bool Visibility;
-    double Transparency;
-    double ZValue;
-
-    VisualState();
-  };
-  
-  typedef QMap        < int, HYDROData_Object::VisualState > ViewId2VisualStateMap;
-  typedef QMapIterator< int, HYDROData_Object::VisualState > ViewId2VisualStateMapIterator;
-
 public:
 
   /**
@@ -88,21 +76,6 @@ public:
    */
   void SetName(const QString& theName);
 
-  /**
-   * Returns the object visibility state for the view with specified id.
-   * \param theViewId view id
-   * \returns visibility state
-   */
-  bool IsVisible( const int theViewId ) const;
-
-  /**
-   * Sets the object visibility state for the view with specified id.
-   * \param theViewId view id
-   * \param theVal visibility state
-   */
-  void SetVisible( const int theViewId,
-                   const bool theVal );
-
   /**
    * Checks is object exists in the data structure.
    * \returns true is object is not exists in the data model
diff --git a/src/HYDROPy/HYDROData_Polyline.sip b/src/HYDROPy/HYDROData_Polyline.sip
new file mode 100644 (file)
index 0000000..f3b5c58
--- /dev/null
@@ -0,0 +1,127 @@
+// 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_Polyline.h>
+%End
+
+struct PolylineSection
+{
+%TypeHeaderCode
+#include <HYDROData_Polyline.h>
+%End
+
+  enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
+
+  PolylineSection();
+  
+  SectionType                 myType;
+  bool                        myIsClosed;
+  QList<double>               myCoords;
+
+  QString                     mySectionName
+  {
+    %GetCode
+        sipPy = PyString_FromString( TCollection_AsciiString( sipCpp->mySectionName ).ToCString() );
+    %End
+
+    %SetCode
+        char* ptr;
+
+        if ( ( ptr = PyString_AsString( sipPy ) ) == NULL )
+        {
+          sipErr = 1;
+        }
+        else
+        {
+          sipCpp->mySectionName = TCollection_ExtendedString( ptr );
+        }
+    %End
+  };
+};
+
+class HYDROData_Polyline : HYDROData_Object
+{
+
+%ConvertToSubClassCode
+    if ( !Handle(HYDROData_Polyline)::DownCast( sipCpp ).IsNull() )
+      sipClass = sipClass_HYDROData_Polyline;
+    else
+      sipClass = NULL;
+%End
+
+public:
+
+  const ObjectKind          GetKind() const;
+
+public:      
+
+  /**
+   * Replace current polyline data by new sections list
+   * \param theSections the sections list
+   */
+  void setPolylineData( const QList<PolylineSection>& theSections );
+
+  /**
+   * Return polyline data
+   * \return polyline section list
+   */
+  QList<PolylineSection> getPolylineData();
+   
+  /**
+   * Return polyline dimension
+   * \return polyline dimension (2 or 3)
+   */
+  int getDimension() const;
+
+  /**
+   * Set polyline dimension (2 or 3)
+   * \param theDimension the polyline dimension
+   */
+  void setDimension( int theDimension );
+
+  /**
+   * Remove all sections from polyline
+   */
+  void removeAll();
+
+
+  /**
+   * Returns the painter path. The painter path is construct by lines
+   */
+  QPainterPath painterPath();
+
+protected:
+
+  /**
+   * Creates new object in the internal data structure. Use higher level objects 
+   * to create objects with real content.
+   */
+  HYDROData_Polyline();
+
+  /**
+   * Destructs properties of the object and object itself, removes it from the document.
+   */
+  ~HYDROData_Polyline();
+};
+
+
index 71b1051d52eb1c179b7ab58f383066f003433738..1b1f85599e35e7d96ce2edf23dad06eba44246b1 100644 (file)
                                RelativePath=".\HYDROData_Object.sip"
                                >
                        </File>
+                       <File
+                               RelativePath=".\HYDROData_Polyline.sip"
+                               >
+                       </File>
                </Filter>
                <Filter
                        Name="Header Files"