QString aBCName = GetObjPyName();
- //Handle(HYDROData_IAltitudeObject) aRefAltitude = GetAltitudeObject();
- //setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefAltitude, "SetAltitudeObject" );
-
Handle(HYDROData_PolylineXY) aRefPolyline = GetPolyline();
setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
+ int nType = GetBoundaryType();
+ aResList << QString( "%1.SetBoundaryType(%2)" ).arg(aBCName).arg(nType);
+
aResList << QString( "" );
aResList << QString( "%1.Update()" ).arg( aBCName );
aResList << QString( "%1.AddGeometryGroup( %2 )" ).arg( aCalculName ).arg( aGroupName );
}
+ HYDROData_SequenceOfObjects aBPolygons = GetBoundaryPolygons();
+ for (int i = 1; i <= aBPolygons.Size(); i++ )
+ {
+ Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( aBPolygons(i) );
+ setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBCPoly, "AddBoundaryPolygon" );
+ }
+ aResList << QString( "" );
+
Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
UpdateView(module, theEntities);
if (theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All) //if other flag = > no need to show this messagebox
SUIT_MessageBox::information(module->getApp()->desktop(),
- tr( "IMPORT_POLYLINE" ), "Contour of the polygon(s) have been imported as polyline(s)");
+ tr( "IMPORT_POLYLINE" ), tr ("POLYGON_IMPORTED_AS_POLYLINE"));
}
else
{
- QString aMess = "Cannot import content of this file as polyline;\n";
+ QString aMess;
+ if (theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType::ImportShapeType_Polygon)
+ aMess += tr ("POLYLINE_IMPORT_FAILED_AS_POLYGON") + ";\n";
+ else
+ aMess += tr ("POLYLINE_IMPORT_FAILED_AS_POLYLINE") + ";\n";
+
if (aStat == -1)
- aMess += "Cannot open SHP file";
+ aMess += tr ("CANT_OPEN_SHP");
else if (aStat == -2)
- aMess += "Cannot open SHX file";
+ aMess += tr ("CANT_OPEN_SHX");
else
- aMess += "The shape type of file is " + anImporter.GetShapeTypeName(aShapeTypeOfFile);
+ aMess += tr ("SHAPE_TYPE_IS") + anImporter.GetShapeTypeName(aShapeTypeOfFile);
SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), aMess);
}
importedEntities.Append(theEntities);
<source>NO_ONE_POLYLINE_IMPORTED</source>
<translation>Polyline cannot be read from seleted file</translation>
</message>
+
+ <message>
+ <source>POLYLINE_IMPORT_FAILED_AS_POLYGON</source>
+ <translation>Cannot import content of this file as polygon</translation>
+ </message>
+ <message>
+ <source>POLYLINE_IMPORT_FAILED_AS_POLYLINE</source>
+ <translation>Cannot import content of this file as polyline</translation>
+ </message>
+ <message>
+ <source>POLYGON_IMPORTED_AS_POLYLINE</source>
+ <translation>Contour of the polygon(s) have been imported as polyline(s)</translation>
+ </message>
+ <message>
+ <source>CANT_OPEN_SHP</source>
+ <translation>Cannot open SHP file</translation>
+ </message>
+ <message>
+ <source>CANT_OPEN_SHX</source>
+ <translation>Cannot open SHX file</translation>
+ </message>
+ <message>
+ <source>SHAPE_TYPE_IS</source>
+ <translation>The shape type of file is </translation>
+ </message>
+
+
<message>
<source>BAD_IMPORTED_POLYLINE_FILES</source>
<translation>The data from following files cannot be completely imported:
sipHYDROPyHYDROData_Stream.cc
sipHYDROPyHYDROData_StricklerTable.cc
sipHYDROPyHYDROData_Zone.cc
+ sipHYDROPyHYDROData_BCPolygon.cc
sipHYDROPyNCollection_Sequence0100gp_XY.cc
sipHYDROPyNCollection_Sequence0100gp_XYZ.cc
sipHYDROPyNCollection_Sequence0100HYDROData_IPolylineSectionType.cc
%Include HYDROData_StreamAltitude.sip
%Include HYDROData_StricklerTable.sip
%Include HYDROData_Zone.sip
-
+%Include HYDROData_BCPolygon.sip
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// 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, or (at your option) any later version.
+//
+// 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_BCPolygon.h>
+%End
+
+class HYDROData_BCPolygon : public HYDROData_Object
+{
+
+%TypeHeaderCode
+#include <HYDROData_BCPolygon.h>
+%End
+
+%ConvertToSubClassCode
+ switch ( sipCpp->GetKind() )
+ {
+ case KIND_BC_POLYGON:
+ sipClass = sipClass_HYDROData_BCPolygon;
+ break;
+
+ default:
+ // We don't recognise the type.
+ sipClass = NULL;
+ }
+%End
+
+public:
+
+ /**
+ * Sets reference polyline object for boundary polygon.
+ */
+ void SetPolyline( HYDROData_PolylineXY thePolyline ) [void (const opencascade::handle<HYDROData_PolylineXY>&)];
+ %MethodCode
+
+ Handle(HYDROData_PolylineXY) aRefPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
+ if ( !aRefPolyline.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_BCPolygon::SetPolyline( aRefPolyline ) :
+ sipCpp->SetPolyline( aRefPolyline );
+ Py_END_ALLOW_THREADS
+ }
+
+ %End
+
+ /**
+ * Returns reference polyline object of boundary polygon.
+ */
+ HYDROData_PolylineXY GetPolyline() const [opencascade::handle<HYDROData_PolylineXY> ()];
+ %MethodCode
+
+ Handle(HYDROData_PolylineXY) aRefPolyline;
+
+ Py_BEGIN_ALLOW_THREADS
+ aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_BCPolygon::GetPolyline() :
+ sipCpp->GetPolyline();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_PolylineXY*)createPointer( aRefPolyline );
+
+ %End
+
+ /**
+ * Remove reference polyline object of boundary polygon.
+ */
+ void RemovePolyline();
+
+ /**
+ * Set boundary type for boundary polygon.
+ */
+ void SetBoundaryType( int ) const;
+
+ /**
+ * Get boundary type for boundary polygon.
+ */
+ int GetBoundaryType() const;
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_BCPolygon();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_BCPolygon();
+};
+
+
*/
void RemoveGeometryGroups();
+
+ /**
+ * Add new boundary polygon to calculation case.
+ */
+ bool AddBoundaryPolygon( HYDROData_BCPolygon theObject ) [bool ( const opencascade::handle<HYDROData_BCPolygon>& )];
+ %MethodCode
+ Handle(HYDROData_BCPolygon) aRef =
+ Handle(HYDROData_BCPolygon)::DownCast( createHandle( a0 ) );
+ if ( !aRef.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddBoundaryPolygon( aRef ):
+ sipCpp->AddBoundaryPolygon( aRef );
+ Py_END_ALLOW_THREADS
+ }
+ %End
+
+ /**
+ * Returns all boundary polygons of calculation case.
+ */
+ HYDROData_SequenceOfObjects GetBoundaryPolygons() const;
+
+ /**
+ * Removes boundary polygon from calculation case.
+ */
+ void RemoveBoundaryPolygon( HYDROData_BCPolygon theObject )
+ [void ( const opencascade::handle<HYDROData_BCPolygon>& )];
+ %MethodCode
+ Handle(HYDROData_BCPolygon) aRef =
+ Handle(HYDROData_BCPolygon)::DownCast( createHandle( a0 ) );
+ if ( !aRef.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ if ( sipSelfWasArg ) {
+ sipCpp->HYDROData_CalculationCase::RemoveBoundaryPolygon( aRef );
+ } else {
+ sipCpp->RemoveBoundaryPolygon( aRef );
+ }
+ Py_END_ALLOW_THREADS
+ }
+ %End
/**
* Sets reference boundary polyline object for calculation case.
aRes = new HYDROData_ImmersibleZone( *dynamic_cast<HYDROData_ImmersibleZone*>( theObject ) );
break;
}
+ case KIND_BC_POLYGON:
+ {
+ aRes = new HYDROData_BCPolygon( *dynamic_cast<HYDROData_BCPolygon*>( theObject ) );
+ break;
+ }
case KIND_RIVER:
{
aRes = new HYDROData_River( *dynamic_cast<HYDROData_River*>( theObject ) );
const ObjectKind KIND_OBSTACLE_ALTITUDE;
const ObjectKind KIND_STRICKLER_TABLE;
const ObjectKind KIND_LAND_COVER_MAP;
+const ObjectKind KIND_BC_POLYGON;
class HYDROData_Entity
{
sipClass = sipClass_HYDROData_LandCoverMap;
break;
+ case KIND_BC_POLYGON:
+ sipClass = sipClass_HYDROData_BCPolygon;
+ break;
+
case KIND_UNKNOWN:
sipClass = sipClass_HYDROData_Entity;
break;
sipClass = sipClass_HYDROData_Stream;
break;
+ case KIND_BC_POLYGON:
+ sipClass = sipClass_HYDROData_BCPolygon;
+ break;
+
case KIND_UNKNOWN:
sipClass = sipClass_HYDROData_Entity;
break;