Salome HOME
Correction for hydro_test
[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 //#define _DEVDEBUG_
28 #include "HYDRO_trace.hxx"
29 #include <HYDROData_PolylineXY.h>
30 %End
31
32 %ConvertToSubClassCode
33     switch ( sipCpp->GetKind() )
34     {
35       case KIND_POLYLINEXY:
36         sipClass = sipClass_HYDROData_PolylineXY;
37         break;
38
39       default:
40         // We don't recognise the type.
41         sipClass = NULL;
42     }
43 %End
44
45 public:      
46
47   /**
48    * Returns default wire color for new polyline.
49    */
50   static QColor DefaultWireColor() const;
51
52   /**
53    * Returns the presentation of polyline section in Qt maner.
54    */
55   static void BuildPainterPath( QPainterPath&                       thePath,
56                                 const SectionType&                  theType,
57                                 const bool&                         theIsClosed,
58                                 const NCollection_Sequence<gp_XYZ>& thePoints );
59
60   /**
61    * Returns flag indicating that polyline can be edited or not.
62    */
63   virtual bool IsEditable() const;
64
65   
66 public:
67
68   /**
69    * Imports shape from IOR.
70    * \param theIOR the IOR of Geom object
71    * \return \c true if shape has been successfully imported
72    */
73   bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
74
75   /**
76    * Stores the study entry of the imported GEOM object.
77    * \param theEntry GEOM object entry
78    */
79   void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
80
81   /**
82    * Returns the imported GEOM object entry.
83    */
84   TCollection_AsciiString GetGeomObjectEntry() const;
85
86
87 public:
88
89   /**
90    * Returns true if polyline is closed
91    * \param theIsSimpleCheck flag indicating the type of checking
92    *        - if true then all wires checked on closures
93    *        - if false then for positive result polyline should consist of
94    *          only one wire and which must be closed
95    */
96   bool IsClosed( const bool theIsSimpleCheck = true ) const;
97
98    /**
99    * Returns the distance beetwen first and point with index thePointIndex
100    * at the section with index theSectionIndex. -1 is returned if error is occurred.
101    */
102   double GetDistance( const int theSectionIndex,
103                       const int thePointIndex ) const;
104
105   /**
106    * Adds new one section.
107    * \param theSectName name of the section
108    * \param theSectionType type of section
109    * \param theIsClosed flag indicates closures of section
110    */
111   void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames /Out/,
112                     NCollection_Sequence<HYDROData_IPolyline::SectionType>& theSectTypes /Out/,
113                     NCollection_Sequence<bool>& theSectClosures /Out/ ) const;
114
115   /**
116    * Replaces point for section with index "theSectionIndex".
117    * \param theSectionIndex index of section
118    * \param thePoints new points
119    */
120   void SetPoints( const int         theSectionIndex,
121                   const HYDROData_IPolyline::PointsList& thePoints );
122
123   /**
124    * Returns the painter path.
125    * Note: currently only the first section of the polyline data is taken into account.
126    * \return polyline painter path.
127    */
128   virtual QPainterPath GetPainterPath() const;
129
130   /**
131    * import polylines from .shp or .xyz files
132    */
133   static HYDROData_SequenceOfObjects ImportShapesFromFile( const QString& theFileName );
134 //  [HYDROData_SequenceOfObjects ( const QString& )];
135 //  %MethodCode
136 //    QString aString(*a0);
137 //    Py_BEGIN_ALLOW_THREADS
138 //    sipRes = HYDROData_PolylineXY::ImportShapesFromFile( aString );
139 //    Py_END_ALLOW_THREADS
140 //  %End
141
142   static bool ExportShapeXY( HYDROData_Document theDocument,
143                              const QString& aFileName,
144                              const NCollection_Sequence<opencascade::handle<HYDROData_PolylineXY> >& aPolyXYSeq)
145                     [ void ( opencascade::handle<HYDROData_Document>,
146                              const QString&,
147                              const NCollection_Sequence<opencascade::handle<HYDROData_PolylineXY> >&,
148                              QStringList& ) ];
149   %MethodCode
150     Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
151     QString aFileName(*a1);
152     QStringList aNonExpList;
153     DEBTRACE(" --- 0");
154     if ( !aDoc.IsNull() )
155     {
156         DEBTRACE("before HYDROData_PolylineXY::ExportShapeXY");
157         Py_BEGIN_ALLOW_THREADS
158         HYDROData_PolylineXY::ExportShapeXY( aDoc, aFileName, *a2, aNonExpList );
159         Py_END_ALLOW_THREADS
160         DEBTRACE("after");
161     }
162     bool ret = (aNonExpList.size() == 0);
163     sipRes = ret;
164   %End
165
166 protected:
167
168   /**
169    * Creates new object in the internal data structure. Use higher level objects 
170    * to create objects with real content.
171    */
172   HYDROData_PolylineXY();
173
174   /**
175    * Destructs properties of the object and object itself, removes it from the document.
176    */
177   ~HYDROData_PolylineXY();
178 };
179
180