Salome HOME
add python method HYDROData_PolylineXY.ImportShapesFromFile('name')
[modules/hydro.git] / src / HYDROPy / HYDROData_PolylineXY.sip
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 %ExportedHeaderCode
20 #include <HYDROData_PolylineXY.h>
21 %End
22
23 class HYDROData_PolylineXY : public HYDROData_IPolyline
24 {
25
26 %TypeHeaderCode
27 #include <HYDROData_PolylineXY.h>
28 %End
29
30 %ConvertToSubClassCode
31     switch ( sipCpp->GetKind() )
32     {
33       case KIND_POLYLINEXY:
34         sipClass = sipClass_HYDROData_PolylineXY;
35         break;
36
37       default:
38         // We don't recognise the type.
39         sipClass = NULL;
40     }
41 %End
42
43 public:      
44
45   /**
46    * Returns default wire color for new polyline.
47    */
48   static QColor DefaultWireColor() const;
49
50   /**
51    * Returns the presentation of polyline section in Qt maner.
52    */
53   static void BuildPainterPath( QPainterPath&                       thePath,
54                                 const SectionType&                  theType,
55                                 const bool&                         theIsClosed,
56                                 const NCollection_Sequence<gp_XYZ>& thePoints );
57
58   /**
59    * Returns flag indicating that polyline can be edited or not.
60    */
61   virtual bool IsEditable() const;
62
63   
64 public:
65
66   /**
67    * Imports shape from IOR.
68    * \param theIOR the IOR of Geom object
69    * \return \c true if shape has been successfully imported
70    */
71   bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
72
73   /**
74    * Stores the study entry of the imported GEOM object.
75    * \param theEntry GEOM object entry
76    */
77   void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
78
79   /**
80    * Returns the imported GEOM object entry.
81    */
82   TCollection_AsciiString GetGeomObjectEntry() const;
83
84
85 public:
86
87   /**
88    * Returns true if polyline is closed
89    * \param theIsSimpleCheck flag indicating the type of checking
90    *        - if true then all wires checked on closures
91    *        - if false then for positive result polyline should consist of
92    *          only one wire and which must be closed
93    */
94   bool IsClosed( const bool theIsSimpleCheck = true ) const;
95
96    /**
97    * Returns the distance beetwen first and point with index thePointIndex
98    * at the section with index theSectionIndex. -1 is returned if error is occurred.
99    */
100   double GetDistance( const int theSectionIndex,
101                       const int thePointIndex ) const;
102
103   /**
104    * Adds new one section.
105    * \param theSectName name of the section
106    * \param theSectionType type of section
107    * \param theIsClosed flag indicates closures of section
108    */
109   void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames /Out/,
110                     NCollection_Sequence<HYDROData_IPolyline::SectionType>& theSectTypes /Out/,
111                     NCollection_Sequence<bool>& theSectClosures /Out/ ) const;
112
113   /**
114    * Replaces point for section with index "theSectionIndex".
115    * \param theSectionIndex index of section
116    * \param thePoints new points
117    */
118   void SetPoints( const int         theSectionIndex,
119                   const HYDROData_IPolyline::PointsList& thePoints );
120
121   /**
122    * Returns the painter path.
123    * Note: currently only the first section of the polyline data is taken into account.
124    * \return polyline painter path.
125    */
126   virtual QPainterPath GetPainterPath() const;
127
128   /**
129    * import polylines from .shp or .xyz files
130    */
131   static bool ImportShapesFromFile( const QString& theFileName /In/ )
132   [bool ( const QString& )];
133   %MethodCode
134     QString aString(*a0);
135     Py_BEGIN_ALLOW_THREADS
136     sipRes = HYDROData_PolylineXY::ImportShapesFromFile( aString );
137     Py_END_ALLOW_THREADS
138   %End
139
140
141 protected:
142
143   /**
144    * Creates new object in the internal data structure. Use higher level objects 
145    * to create objects with real content.
146    */
147   HYDROData_PolylineXY();
148
149   /**
150    * Destructs properties of the object and object itself, removes it from the document.
151    */
152   ~HYDROData_PolylineXY();
153 };
154
155