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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <HYDROData_PolylineXY.h>
23 class HYDROData_PolylineXY : public HYDROData_IPolyline
28 #include "HYDRO_trace.hxx"
29 #include <HYDROData_PolylineXY.h>
32 %ConvertToSubClassCode
33 switch ( sipCpp->GetKind() )
36 sipClass = sipClass_HYDROData_PolylineXY;
40 // We don't recognise the type.
48 * Returns default wire color for new polyline.
50 static QColor DefaultWireColor() const;
53 * Returns the presentation of polyline section in Qt maner.
55 static void BuildPainterPath( QPainterPath& thePath,
56 const SectionType& theType,
57 const bool& theIsClosed,
58 const NCollection_Sequence<gp_XYZ>& thePoints );
61 * Returns flag indicating that polyline can be edited or not.
63 virtual bool IsEditable() const;
69 * Imports shape from IOR.
70 * \param theIOR the IOR of Geom object
71 * \return \c true if shape has been successfully imported
73 bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
76 * Stores the study entry of the imported GEOM object.
77 * \param theEntry GEOM object entry
79 void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
82 * Returns the imported GEOM object entry.
84 TCollection_AsciiString GetGeomObjectEntry() const;
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
96 bool IsClosed( const bool theIsSimpleCheck = true ) const;
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.
102 double GetDistance( const int theSectionIndex,
103 const int thePointIndex ) const;
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
111 void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames /Out/,
112 NCollection_Sequence<HYDROData_IPolyline::SectionType>& theSectTypes /Out/,
113 NCollection_Sequence<bool>& theSectClosures /Out/ ) const;
116 * Replaces point for section with index "theSectionIndex".
117 * \param theSectionIndex index of section
118 * \param thePoints new points
120 void SetPoints( const int theSectionIndex,
121 const HYDROData_IPolyline::PointsList& thePoints );
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.
128 virtual QPainterPath GetPainterPath() const;
131 * import polylines from .shp or .xyz files
133 static bool ImportShapesFromFile( const QString& theFileName /In/ )
134 [bool ( const QString& )];
136 QString aString(*a0);
137 Py_BEGIN_ALLOW_THREADS
138 sipRes = HYDROData_PolylineXY::ImportShapesFromFile( aString );
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>,
147 const NCollection_Sequence<opencascade::handle<HYDROData_PolylineXY> >&,
150 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
151 QString aFileName(*a1);
152 QStringList aNonExpList;
154 if ( !aDoc.IsNull() )
156 DEBTRACE("before HYDROData_PolylineXY::ExportShapeXY");
157 Py_BEGIN_ALLOW_THREADS
158 HYDROData_PolylineXY::ExportShapeXY( aDoc, aFileName, *a2, aNonExpList );
162 bool ret = (aNonExpList.size() == 0);
169 * Creates new object in the internal data structure. Use higher level objects
170 * to create objects with real content.
172 HYDROData_PolylineXY();
175 * Destructs properties of the object and object itself, removes it from the document.
177 ~HYDROData_PolylineXY();