return true;
}
+
+void HYDROData_PolylineXY::ExportShapeXY(Handle(HYDROData_Document) theDocument,
+ const QString& aFileName,
+ const NCollection_Sequence<Handle(HYDROData_PolylineXY)>& aPolyXYSeq,
+ QStringList& aNonExpList)
+{
+ HYDROData_ShapeFile shp = HYDROData_ShapeFile();
+ NCollection_Sequence<Handle(HYDROData_Polyline3D)> emptySeq;
+ shp.Export(theDocument, aFileName, aPolyXYSeq, emptySeq, aNonExpList);
+}
#include "HYDROData_IPolyline.h"
#include <TopTools_HSequenceOfShape.hxx>
+#include <QString>
+#include <QStringList>
class QPainterPath;
class QTransform;
class TopoDS_Wire;
class gp_XYZ;
class gp_Pnt;
+class HYDROData_Document;
/**\class HYDROData_PolylineXY
* \brief Class that stores/retrieves information about the
HYDRODATA_EXPORT static bool ImportShapesFromFile( const QString& theFileName );
+ HYDRODATA_EXPORT static void ExportShapeXY(Handle(HYDROData_Document) theDocument,
+ const QString& aFileName,
+ const NCollection_Sequence<Handle(HYDROData_PolylineXY)>& aPolyXYSeq,
+ QStringList& aNonExpList);
+
protected:
/**
${PYTHON_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/src/HYDROData
+ ${PROJECT_SOURCE_DIR}/src/shapelib
)
# additional preprocessor / compiler flags
sipHYDROPyNCollection_Sequence0100HYDROData_IPolylineSectionType.cc
sipHYDROPyNCollection_Sequence0100TCollection_AsciiString.cc
sipHYDROPyNCollection_Sequence0600opencascadehandle0100HYDROData_Entity.cc
+ sipHYDROPyNCollection_Sequence0600opencascadehandle0100HYDROData_PolylineXY.cc
sipHYDROPyNCollection_Sequence1800.cc
sipHYDROPyNCollection_Sequence2400.cc
sipHYDROPyNCollection_Sequence2600.cc
{
%TypeHeaderCode
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
#include <HYDROData_PolylineXY.h>
%End
Py_END_ALLOW_THREADS
%End
+ static bool ExportShapeXY( HYDROData_Document theDocument,
+ const QString& aFileName,
+ const NCollection_Sequence<opencascade::handle<HYDROData_PolylineXY> >& aPolyXYSeq)
+ [ void ( opencascade::handle<HYDROData_Document>,
+ const QString&,
+ const NCollection_Sequence<opencascade::handle<HYDROData_PolylineXY> >&,
+ QStringList& ) ];
+ %MethodCode
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
+ QString aFileName(*a1);
+ QStringList aNonExpList;
+ DEBTRACE(" --- 0");
+ if ( !aDoc.IsNull() )
+ {
+ DEBTRACE("before HYDROData_PolylineXY::ExportShapeXY");
+ Py_BEGIN_ALLOW_THREADS
+ HYDROData_PolylineXY::ExportShapeXY( aDoc, aFileName, *a2, aNonExpList );
+ Py_END_ALLOW_THREADS
+ DEBTRACE("after");
+ }
+ bool ret = (aNonExpList.size() == 0);
+ sipRes = ret;
+ %End
protected:
};
typedef NCollection_Sequence<opencascade::handle<HYDROData_Entity>> HYDROData_SequenceOfObjects;
+
+%MappedType NCollection_Sequence<opencascade::handle<HYDROData_PolylineXY>>
+{
+%TypeHeaderCode
+#include <NCollection_Sequence.hxx>
+%End
+
+%ConvertFromTypeCode
+ // Create the list.
+ PyObject *l;
+
+ if ((l = PyList_New(sipCpp->Length())) == NULL)
+ return NULL;
+
+ // Set the list elements.
+ for (int i = 1; i <= sipCpp->Length(); ++i)
+ {
+ HYDROData_PolylineXY* aPntr = (HYDROData_PolylineXY*)createPointer(sipCpp->Value(i));
+
+ PyObject *tobj;
+
+ if ((tobj = sipConvertFromNewType(aPntr, sipFindType( aPntr->DynamicType()->Name() ), sipTransferObj)) == NULL)
+ {
+ Py_DECREF(l);
+ {
+ Handle(HYDROData_PolylineXY) anEnt( aPntr );
+ }
+
+ return NULL;
+ }
+
+ PyList_SET_ITEM(l, i - 1, tobj);
+ }
+
+ return l;
+%End
+
+%ConvertToTypeCode
+ SIP_SSIZE_T len;
+
+ // Check the type if that is all that is required.
+ if (sipIsErr == NULL)
+ {
+ if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
+ return 0;
+
+ for (SIP_SSIZE_T i = 0; i < len; ++i)
+ {
+ PyObject *itm = PySequence_ITEM(sipPy, i);
+ bool ok = (itm && sipCanConvertToType(itm, sipType_HYDROData_PolylineXY, SIP_NOT_NONE));
+
+ Py_XDECREF(itm);
+
+ if (!ok)
+ return 0;
+ }
+
+ return 1;
+ }
+
+ NCollection_Sequence<Handle(HYDROData_PolylineXY)> *aSeq =
+ new NCollection_Sequence<Handle(HYDROData_PolylineXY)>;
+ len = PySequence_Size(sipPy);
+
+ for (SIP_SSIZE_T i = 0; i < len; ++i)
+ {
+ PyObject *itm = PySequence_ITEM(sipPy, i);
+ int state;
+ HYDROData_PolylineXY *t =
+ reinterpret_cast<HYDROData_PolylineXY *>(sipConvertToType(itm, sipType_HYDROData_PolylineXY, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
+
+ Py_DECREF(itm);
+
+ if (*sipIsErr)
+ {
+ sipReleaseType(t, sipType_HYDROData_PolylineXY, state);
+
+ delete aSeq;
+ return 0;
+ }
+
+ Handle(HYDROData_PolylineXY) anEnt( t );
+ aSeq->Append( anEnt );
+
+ //sipReleaseType(t, sipType_HYDROData_PolylineXY, state);
+ }
+
+ *sipCppPtr = aSeq;
+
+ return sipGetState(sipTransferObj);
+%End
+};
\ No newline at end of file