From c16caee6b6e61dffbc739dce6639215b24a459d3 Mon Sep 17 00:00:00 2001 From: isn Date: Mon, 20 Aug 2018 19:41:58 +0300 Subject: [PATCH] refs #1813 ... lot 14 combined commit : parts : 1 - 16 Signed-off-by: isn --- src/HYDROData/CMakeLists.txt | 4 + src/HYDROData/HYDROData_BCPolygon.cxx | 168 +++++++++++++++ src/HYDROData/HYDROData_BCPolygon.h | 141 +++++++++++++ .../HYDROData_BoundaryPolygonTools.cxx | 170 +++++++++++++++ .../HYDROData_BoundaryPolygonTools.h | 46 ++++ src/HYDROData/HYDROData_CalculationCase.cxx | 196 +++++++++++++++++- src/HYDROData/HYDROData_CalculationCase.h | 8 + src/HYDROData/HYDROData_Document.cxx | 1 + src/HYDROData/HYDROData_Entity.cxx | 3 + src/HYDROData/HYDROData_Entity.h | 3 +- src/HYDROData/HYDROData_ImmersibleZone.cxx | 135 +----------- src/HYDROData/HYDROData_Iterator.cxx | 3 +- src/HYDROData/HYDROData_ShapeFile.cxx | 15 +- src/HYDROData/HYDROData_ShapeFile.h | 10 +- src/HYDROData/HYDROData_Tool.cxx | 148 ++++++++++++- src/HYDROData/HYDROData_Tool.h | 7 + src/HYDROGUI/CMakeLists.txt | 6 + src/HYDROGUI/HYDROGUI_CalculationDlg.cxx | 145 +++++++++++++ src/HYDROGUI/HYDROGUI_CalculationDlg.h | 23 ++ src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 118 ++++++++++- src/HYDROGUI/HYDROGUI_CalculationOp.h | 6 + src/HYDROGUI/HYDROGUI_DataModel.cxx | 31 ++- src/HYDROGUI/HYDROGUI_DataObject.cxx | 14 ++ src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.cxx | 142 +++++++++++++ src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.h | 49 +++++ src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx | 61 +++--- src/HYDROGUI/HYDROGUI_ImportPolylineOp.h | 11 +- src/HYDROGUI/HYDROGUI_Module.cxx | 11 +- src/HYDROGUI/HYDROGUI_Operations.cxx | 13 ++ src/HYDROGUI/HYDROGUI_Operations.h | 6 +- .../HYDROGUI_SetBoundaryTypePolygonDlg.cxx | 94 +++++++++ .../HYDROGUI_SetBoundaryTypePolygonDlg.h | 42 ++++ .../HYDROGUI_SetBoundaryTypePolygonOp.cxx | 85 ++++++++ .../HYDROGUI_SetBoundaryTypePolygonOp.h | 51 +++++ src/HYDROGUI/HYDROGUI_Shape.cxx | 30 +++ src/HYDROGUI/HYDROGUI_Tool2.cxx | 1 + src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx | 24 +++ src/HYDROGUI/resources/HYDROGUI_images.ts | 24 ++- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 63 ++++++ src/HYDROGUI/resources/icon_bc_import.png | Bin 0 -> 642 bytes .../resources/icon_bc_polygon_type_1.png | Bin 0 -> 472 bytes .../resources/icon_bc_polygon_type_2.png | Bin 0 -> 528 bytes .../resources/icon_bc_polygon_type_3.png | Bin 0 -> 546 bytes .../resources/icon_bc_polygon_type_undef.png | Bin 0 -> 350 bytes 44 files changed, 1928 insertions(+), 180 deletions(-) create mode 100644 src/HYDROData/HYDROData_BCPolygon.cxx create mode 100644 src/HYDROData/HYDROData_BCPolygon.h create mode 100644 src/HYDROData/HYDROData_BoundaryPolygonTools.cxx create mode 100644 src/HYDROData/HYDROData_BoundaryPolygonTools.h create mode 100644 src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.h create mode 100644 src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.cxx create mode 100644 src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.h create mode 100644 src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.h create mode 100644 src/HYDROGUI/resources/icon_bc_import.png create mode 100644 src/HYDROGUI/resources/icon_bc_polygon_type_1.png create mode 100644 src/HYDROGUI/resources/icon_bc_polygon_type_2.png create mode 100644 src/HYDROGUI/resources/icon_bc_polygon_type_3.png create mode 100644 src/HYDROGUI/resources/icon_bc_polygon_type_undef.png diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt index d82add81..94a55cc6 100644 --- a/src/HYDROData/CMakeLists.txt +++ b/src/HYDROData/CMakeLists.txt @@ -64,6 +64,8 @@ set(PROJECT_HEADERS HYDROData_LandCoverMap.h HYDROData_LCM_FaceClassifier.h HYDROData_DTM.h + HYDROData_BCPolygon.h + HYDROData_BoundaryPolygonTools.h ) set(PROJECT_SOURCES @@ -126,6 +128,8 @@ set(PROJECT_SOURCES HYDROData_LandCoverMap.cxx HYDROData_LCM_FaceClassifier.cxx HYDROData_DTM.cxx + HYDROData_BCPolygon.cxx + HYDROData_BoundaryPolygonTools.cxx ) SET( ECW_INCLUDES $ENV{ECWLIB_ROOT_DIR}/include ) diff --git a/src/HYDROData/HYDROData_BCPolygon.cxx b/src/HYDROData/HYDROData_BCPolygon.cxx new file mode 100644 index 00000000..9276a119 --- /dev/null +++ b/src/HYDROData/HYDROData_BCPolygon.cxx @@ -0,0 +1,168 @@ +// 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 +// + +#include "HYDROData_BCPolygon.h" + +//#include "HYDROData_IAltitudeObject.h" +#include "HYDROData_Document.h" +//#include "HYDROData_ShapesGroup.h" +#include "HYDROData_PolylineXY.h" +#include "HYDROData_ShapesTool.h" + +#include +#include +#include +#include + +#include + +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(HYDROData_BCPolygon,HYDROData_Object) + + +HYDROData_BCPolygon::HYDROData_BCPolygon() +: HYDROData_Object( Geom_2d ) +{ +} + +HYDROData_BCPolygon::~HYDROData_BCPolygon() +{ +} + +QStringList HYDROData_BCPolygon::DumpToPython( const QString& thePyScriptPath, + MapOfTreatedObjects& theTreatedObjects ) const +{ + QStringList aResList = dumpObjectCreation( theTreatedObjects ); + + 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" ); + + aResList << QString( "" ); + + aResList << QString( "%1.Update()" ).arg( aBCName ); + aResList << QString( "" ); + + return aResList; +} + +HYDROData_SequenceOfObjects HYDROData_BCPolygon::GetAllReferenceObjects() const +{ + HYDROData_SequenceOfObjects aResSeq = HYDROData_Object::GetAllReferenceObjects(); + + Handle(HYDROData_PolylineXY) aRefPolyline = GetPolyline(); + if ( !aRefPolyline.IsNull() ) + aResSeq.Append( aRefPolyline ); + + return aResSeq; +} + +int HYDROData_BCPolygon::GetBoundaryType() const +{ + Handle(TDataStd_Integer) aBoundaryTypeAttr; + + int aBoundaryTypeVal = 0; //default + if( myLab.FindAttribute(TDataStd_Integer::GetID(), aBoundaryTypeAttr ) ) + aBoundaryTypeVal = aBoundaryTypeAttr->Get(); + return aBoundaryTypeVal; +} + +void HYDROData_BCPolygon::SetBoundaryType( int theBoundaryType ) const +{ + TDataStd_Integer::Set( myLab, theBoundaryType ); +} + +void HYDROData_BCPolygon::Update() +{ + HYDROData_Object::Update(); + SetTopShape( generateTopShape() ); +} + +void HYDROData_BCPolygon::Update(const TopoDS_Shape& theTopShape) +{ + HYDROData_Object::Update(); + SetTopShape( theTopShape); +} + +bool HYDROData_BCPolygon::IsHas2dPrs() const +{ + return true; +} + +TopoDS_Shape HYDROData_BCPolygon::generateTopShape() const +{ + return generateTopShape( GetPolyline() ); +} + +TopoDS_Shape HYDROData_BCPolygon::generateTopShape( const Handle(HYDROData_PolylineXY)& aPolyline ) +{ + return HYDROData_Tool::PolyXY2Face(aPolyline); +} + +TopoDS_Shape HYDROData_BCPolygon::GetShape3D() const +{ + return GetTopShape(); +} + +QColor HYDROData_BCPolygon::DefaultFillingColor() const +{ + int aBT = GetBoundaryType(); + QColor aFC; + if (aBT == 1) + aFC = QColor( Qt::blue ); + else if (aBT == 2) + aFC = QColor( Qt::darkGreen ); + else if (aBT == 3) + aFC = QColor( Qt::darkYellow ); + else + aFC = QColor( Qt::red ); + //aFC.setAlpha(175); + return aFC; +} + +QColor HYDROData_BCPolygon::DefaultBorderColor() const +{ + return QColor( Qt::black ); +} + +void HYDROData_BCPolygon::SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline ) +{ + if( IsEqual( GetPolyline(), thePolyline ) ) + return; + + SetReferenceObject( thePolyline, DataTag_Polyline ); + Changed( Geom_2d ); +} + +Handle(HYDROData_PolylineXY) HYDROData_BCPolygon::GetPolyline() const +{ + return Handle(HYDROData_PolylineXY)::DownCast( + GetReferenceObject( DataTag_Polyline ) ); +} + +void HYDROData_BCPolygon::RemovePolyline() +{ + ClearReferenceObjects( DataTag_Polyline ); + Changed( Geom_2d ); +} diff --git a/src/HYDROData/HYDROData_BCPolygon.h b/src/HYDROData/HYDROData_BCPolygon.h new file mode 100644 index 00000000..efaf01b9 --- /dev/null +++ b/src/HYDROData/HYDROData_BCPolygon.h @@ -0,0 +1,141 @@ +// 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 +// + +#ifndef HYDROData_BCPolygon_HeaderFile +#define HYDROData_BCPolygon_HeaderFile + +#include + +class HYDROData_PolylineXY; + +/**\class HYDROData_BCPolygon + * \brief + * + */ +class HYDROData_BCPolygon : public HYDROData_Object +{ +protected: + /** + * Enumeration of tags corresponding to the persistent object parameters. + */ + enum DataTag + { + DataTag_First = HYDROData_Object::DataTag_First + 100, + DataTag_Polyline, ///< reference polyline + DataTag_BoundaryType ///< boundary type: cutting(1), bounding(2), selection(3) +}; + +public: + DEFINE_STANDARD_RTTIEXT(HYDROData_BCPolygon, HYDROData_Object); + + /** + * Returns the kind of this object. Must be redefined in all objects of known type. + */ + HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_BC_POLYGON;} + + /** + * Dump object to Python script representation. + */ + HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath, + MapOfTreatedObjects& theTreatedObjects ) const; + + /** + * Returns the list of all reference objects of this object. + */ + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const; + + /** + * Update the object. + * Call this method whenever you made changes for object data. + */ + HYDRODATA_EXPORT virtual void Update(); + + /** + * Update the object with new top shape. + * Call this method whenever you made changes for object data. + */ + HYDRODATA_EXPORT void Update(const TopoDS_Shape& theTopShape); + + /** + * Checks that object has 2D presentation. Reimlemented to retun true. + */ + HYDRODATA_EXPORT virtual bool IsHas2dPrs() const; + + /** + * Returns the 3d shape of the object. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const; + + /** + * Returns default filling color for new zone. + */ + HYDRODATA_EXPORT virtual QColor DefaultFillingColor() const; + + /** + * Returns default border color for new zone. + */ + HYDRODATA_EXPORT virtual QColor DefaultBorderColor() const; + + /** + * Sets reference polyline object for zone. + */ + HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline ); + + /** + * Returns reference polyline object of zone. + */ + HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetPolyline() const; + + /** + * Remove reference polyline object of zone. + */ + HYDRODATA_EXPORT virtual void RemovePolyline(); + + HYDRODATA_EXPORT TopoDS_Shape generateTopShape() const; + + HYDRODATA_EXPORT static TopoDS_Shape generateTopShape( const Handle(HYDROData_PolylineXY)& ); + + HYDRODATA_EXPORT int GetBoundaryType() const; + + HYDRODATA_EXPORT void SetBoundaryType( int ) const; + + +private: + + /** + * Create all necessary child group objects. + */ + //HYDRODATA_EXPORT void createGroupObjects(); + +protected: + + friend class HYDROData_Iterator; + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDRODATA_EXPORT HYDROData_BCPolygon(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + virtual HYDRODATA_EXPORT ~HYDROData_BCPolygon(); +}; + +#endif diff --git a/src/HYDROData/HYDROData_BoundaryPolygonTools.cxx b/src/HYDROData/HYDROData_BoundaryPolygonTools.cxx new file mode 100644 index 00000000..0f40c366 --- /dev/null +++ b/src/HYDROData/HYDROData_BoundaryPolygonTools.cxx @@ -0,0 +1,170 @@ +// 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 +// + +#include +#include + +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +#include + +static bool FindInterBySection(const TopoDS_Face& IncF, TopoDS_Shape poly) +{ + if (IncF.IsNull()) + return false; + //make cmp from edges of Inc_sh + TopTools_IndexedMapOfShape IncToolsE; + TopExp::MapShapes(IncF, TopAbs_EDGE, IncToolsE); + BRep_Builder BB; + TopoDS_Compound aToolCmp; + BB.MakeCompound(aToolCmp); + for (int i=1; i<= IncToolsE.Extent();i++) + BB.Add(aToolCmp, IncToolsE(i)); + // + //perform bsection - poly vs aToolCmp + BOPAlgo_Section aBOP; + aBOP.AddArgument(poly); + aBOP.AddArgument(aToolCmp); + aBOP.SetRunParallel(true); + + aBOP.Perform(); + //aBOP.GetReport()); + +//#if OCC_VERSION_LARGE > 0x07020000 +// if (aBOP.HasErrors()) +// return false; +//#endif + + const TopoDS_Shape& aRes=aBOP.Shape(); + if (aRes.IsNull()) + return false; + + bool IsInter = false; + TopTools_IndexedMapOfShape aShVE; + TopExp::MapShapes(aRes, TopAbs_VERTEX, aShVE); + if (aShVE.IsEmpty()) + { + TopExp::MapShapes(aRes, TopAbs_EDGE, aShVE); + if (!aShVE.IsEmpty()) + IsInter = true; + } + else + IsInter = true; + return IsInter; +} + +bool HYDROData_BoundaryPolygonTools::CutTool( const TopTools_SequenceOfShape& CutTools, + NCollection_IndexedDataMap& ObjToRes ) +{ + TopTools_IndexedMapOfShape EdgesTools; + for (int i =1; i<=CutTools.Length();i++) + { + const TopoDS_Shape& CSH = CutTools(i); + TopExp::MapShapes(CSH, TopAbs_EDGE, EdgesTools); + } + // + BRep_Builder BB; + TopoDS_Compound aToolCmp; + BB.MakeCompound(aToolCmp); + for (int i=1; i<= EdgesTools.Extent();i++) + BB.Add(aToolCmp, EdgesTools(i)); + // + for (int i = 1; i <= ObjToRes.Extent(); i++ ) + { + const TopoDS_Shape& Obj = ObjToRes.FindKey(i); + Standard_Real aTol; + if (!Obj.IsNull()) + { + aTol = Precision::Confusion(); + BOPAlgo_BOP aBOP; + // + aBOP.AddArgument(Obj); + aBOP.AddTool(aToolCmp); + aBOP.SetOperation(BOPAlgo_CUT); + aBOP.SetRunParallel(true); + + aBOP.Perform(); + +#if OCC_VERSION_LARGE > 0x07020000 + if (aBOP.HasErrors()) + return false; +#endif + + const TopoDS_Shape& aRes=aBOP.Shape(); + ObjToRes.ChangeFromKey(Obj) = aRes; + } + } + return true; +} + + +bool HYDROData_BoundaryPolygonTools::IncludeTool( const TopTools_SequenceOfShape& IncludeTools, + TopoDS_Shape Obj) +{ + TopExp_Explorer exp(Obj, TopAbs_VERTEX); + if (!exp.More()) + return false; + TopoDS_Vertex aV = TopoDS::Vertex(exp.Current()); + gp_Pnt aP = BRep_Tool::Pnt(aV); + for (int i=1; i<=IncludeTools.Size(); i++) + { + TopoDS_Face IncF = TopoDS::Face(IncludeTools(i)); + bool IsInter = FindInterBySection(IncF, Obj); + if (IsInter) + return false; + // + gp_XY aP2d(aP.X(), aP.Y()); + TopAbs_State aState = HYDROData_Tool::ComputePointState(aP2d, IncF); + if (aState != TopAbs_IN) + return false; + } + return true; +} + +bool HYDROData_BoundaryPolygonTools::SelectionTool( const TopTools_SequenceOfShape& SelectionTool, + TopoDS_Shape Obj) +{ + for (int i=1; i<=SelectionTool.Size(); i++) + { + TopoDS_Face IncF = TopoDS::Face(SelectionTool(i)); + bool IsInter = FindInterBySection(IncF, Obj); + if (!IsInter) + return false; + } + return true; +} + + diff --git a/src/HYDROData/HYDROData_BoundaryPolygonTools.h b/src/HYDROData/HYDROData_BoundaryPolygonTools.h new file mode 100644 index 00000000..70f4d60c --- /dev/null +++ b/src/HYDROData/HYDROData_BoundaryPolygonTools.h @@ -0,0 +1,46 @@ +// 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 +// + +#ifndef HYDROData_BoundaryPolygonTools_HeaderFile +#define HYDROData_BoundaryPolygonTools_HeaderFile + +#include "HYDROData.h" +#include +#include + + +class TopoDS_Shape; + +class HYDRODATA_EXPORT HYDROData_BoundaryPolygonTools { + +public: + + static bool CutTool( const TopTools_SequenceOfShape& CutTools, + NCollection_IndexedDataMap& ObjToRes ); + + static bool IncludeTool( const TopTools_SequenceOfShape& IncludeTools, + TopoDS_Shape Obj); + + static bool SelectionTool( const TopTools_SequenceOfShape& SelectionTool, + TopoDS_Shape Obj) ; + +}; + +#endif + + diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 7a18f687..12aca20d 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -30,6 +30,9 @@ #include "HYDROData_Region.h" #include "HYDROData_Tool.h" #include "HYDROData_GeomTool.h" +#include +#include +#include #ifdef WIN32 #pragma warning ( disable: 4251 ) @@ -52,6 +55,8 @@ #include #include #include +#include +#include #include @@ -270,6 +275,142 @@ HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() return aResSeq; } +static void FilterEdgesByIncludeSelectionBoundaryPolygons( const HYDROData_SplitToZonesTool::SplitDataList& anEdgesList, + HYDROData_SequenceOfObjects aBoundaryPolygons, + HYDROData_SplitToZonesTool::SplitDataList& outEdgesList) +{ + //perform boundary condition polygons on EdgesList + TopTools_SequenceOfShape IncTools, SelectionTools; + HYDROData_SplitToZonesTool::SplitDataListIterator anIter(anEdgesList); + for (int i=1; i<=aBoundaryPolygons.Size();i++) + { + Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( aBoundaryPolygons(i)); + TopoDS_Shape aPolyTopShape = aBCPoly->GetTopShape(); + int bType = aBCPoly->GetBoundaryType(); + if (bType == 2) + IncTools.Append(aPolyTopShape); + else if (bType == 3) + SelectionTools.Append(aPolyTopShape); + } + + while( anIter.hasNext() ) + { + const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); + if ( aSplitData.ObjectNames.isEmpty() || aSplitData.Shape.IsNull() ) + continue; + if (aSplitData.Shape.ShapeType() != TopAbs_EDGE) + continue; + if (HYDROData_BoundaryPolygonTools::IncludeTool(IncTools, aSplitData.Shape) && HYDROData_BoundaryPolygonTools::SelectionTool(SelectionTools, aSplitData.Shape)) + outEdgesList.append(aSplitData); + } +} + + +static void SplitEdgesByBoundaryPolygons( const HYDROData_SplitToZonesTool::SplitDataList& anEdgesList, + const HYDROData_SequenceOfObjects& aBoundaryPolygons, + NCollection_IndexedDataMap& ObjToRes) +{ + //perform boundary condition polygons on EdgesList + TopTools_SequenceOfShape CutTools; + ObjToRes.Clear(); + HYDROData_SplitToZonesTool::SplitDataListIterator anIter(anEdgesList); + for (int i=1; i<=aBoundaryPolygons.Size();i++) + { + Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( aBoundaryPolygons(i)); + TopoDS_Shape aPolyTopShape = aBCPoly->GetTopShape(); + int bType = aBCPoly->GetBoundaryType(); + if (bType == 1) + CutTools.Append(aPolyTopShape); + } + + while( anIter.hasNext() ) + { + const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); + if ( aSplitData.ObjectNames.isEmpty() || aSplitData.Shape.IsNull() ) + continue; + if (aSplitData.Shape.ShapeType() != TopAbs_EDGE) + continue; + ObjToRes.Add(aSplitData.Shape, TopoDS_Shape()); + } + + HYDROData_BoundaryPolygonTools::CutTool(CutTools, ObjToRes); +} + + +static void PerformEdgeReplInZones(const HYDROData_SplitToZonesTool::SplitDataList& ZoneList, + const NCollection_IndexedDataMap& ObjToRes, + HYDROData_SplitToZonesTool::SplitDataList& outZoneList) +{ + HYDROData_SplitToZonesTool::SplitDataListIterator it( ZoneList ); + BRepTools_ReShape reshaper; + for (;it.hasNext();) + { + const HYDROData_SplitToZonesTool::SplitData& aSplitData = it.next(); + if ( aSplitData.ObjectNames.isEmpty() || aSplitData.Shape.IsNull() ) + continue; + + TopoDS_Shape mS = aSplitData.Shape; + for (int i=1; i<=ObjToRes.Extent();i++) + { + TopoDS_Shape K = ObjToRes.FindKey(i); + TopoDS_Shape V = ObjToRes.FindFromIndex(i); + if (V.ShapeType() != TopAbs_EDGE && V.ShapeType() != TopAbs_WIRE && V.ShapeType() != TopAbs_COMPOUND) + continue; + if (V.ShapeType() == TopAbs_COMPOUND) + { + TopExp_Explorer exp(V, TopAbs_EDGE); + TopTools_ListOfShape lE; + for (;exp.More();exp.Next()) + lE.Append(exp.Current()); + if (lE.Extent() == 1) + V = lE.First(); + else if (lE.Extent() > 1) + { + BRepLib_MakeWire MW; + MW.Add(lE); + if (MW.IsDone()) + V = MW.Wire(); + else + continue; + } + else + continue; + } + reshaper.Replace(K, V); + } + TopoDS_Shape nS = reshaper.Apply(mS); + HYDROData_SplitToZonesTool::SplitData aNS(aSplitData.Type, nS, aSplitData.ObjectNames); + outZoneList.append(aNS); + } +} + +static void CreateNewEdgeList( const HYDROData_SplitToZonesTool::SplitDataList& theEdges, + const NCollection_IndexedDataMap& ObjToRes, + HYDROData_SplitToZonesTool::SplitDataList& newEdges) +{ + HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theEdges ); + while( anIter.hasNext() ) + { + const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); + if ( aSplitData.ObjectNames.isEmpty() || aSplitData.Shape.IsNull() ) + continue; + + const TopoDS_Shape* aDivShape = ObjToRes.Seek(aSplitData.Shape); + if (aDivShape) + { + TopExp_Explorer exp(*aDivShape, TopAbs_EDGE); + for (;exp.More();exp.Next()) + { + HYDROData_SplitToZonesTool::SplitData anNewSData(aSplitData.Type, exp.Current(), aSplitData.ObjectNames); + newEdges.append(anNewSData); + } + } + else + newEdges.append(aSplitData); + } +} + + void HYDROData_CalculationCase::Update() { HYDROData_Entity::Update(); @@ -309,17 +450,34 @@ void HYDROData_CalculationCase::Update() } } + // + //split edges by boundary polygons + HYDROData_SequenceOfObjects aBoundaryPolygons = GetBoundaryPolygons(); + //edge to splitted edge (compound of edges or original edge) + NCollection_IndexedDataMap ObjToRes; + //split edge list by BP + SplitEdgesByBoundaryPolygons(anEdgesList, aBoundaryPolygons, ObjToRes); + HYDROData_SplitToZonesTool::SplitDataList aNewZonesList; + //replace splitted edges in zone list (faces) + PerformEdgeReplInZones(aZonesList, ObjToRes, aNewZonesList); + // + //create new edges list based on splitting info from ObjToRes + HYDROData_SplitToZonesTool::SplitDataList newEdgesList1,newEdgesList2; + CreateNewEdgeList(anEdgesList, ObjToRes, newEdgesList1); + //filter out edges list by include&selection tools + FilterEdgesByIncludeSelectionBoundaryPolygons(newEdgesList1,aBoundaryPolygons,newEdgesList2); + switch( GetAssignmentMode() ) { case MANUAL: - CreateRegionsDef( aDocument, aZonesList ); + CreateRegionsDef( aDocument,aNewZonesList ); break; case AUTOMATIC: - CreateRegionsAuto( aDocument, aZonesList ); + CreateRegionsAuto( aDocument,aNewZonesList ); break; } - CreateEdgeGroupsDef( aDocument, anEdgesList ); + CreateEdgeGroupsDef( aDocument, newEdgesList2 ); } void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Document)& theDoc, @@ -459,7 +617,7 @@ void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Docu if ( aSplitGroup.IsNull() ) continue; - aSplitGroup->AddShape( aSplitData.Shape ); + aSplitGroup->AddShape( aSplitData.Shape ); TopTools_SequenceOfShape theShapes; aSplitGroup->GetShapes(theShapes); @@ -1486,5 +1644,35 @@ void HYDROData_CalculationCase::RemoveInterPolyObject( const Handle(HYDROData_Po Changed( Geom_2d ); } +bool HYDROData_CalculationCase::AddBoundaryPolygon( const Handle(HYDROData_BCPolygon)& theBCPolygon ) +{ + HYDROData_CalculationCase::DataTag aDataTag = DataTag_BCPolygon; + + if ( HasReference( theBCPolygon, aDataTag ) ) + return false; + + AddReferenceObject( theBCPolygon, aDataTag ); + + Changed( Geom_2d ); + + return true; +} + +HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetBoundaryPolygons() const +{ + return GetReferenceObjects( DataTag_BCPolygon ); +} + +void HYDROData_CalculationCase::RemoveBoundaryPolygon( const Handle(HYDROData_BCPolygon)& theBCPolygon ) +{ + if ( theBCPolygon.IsNull() ) + return; + + RemoveReferenceObject( theBCPolygon->Label(), DataTag_BCPolygon ); + + Changed( Geom_2d ); +} + + diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index ad8a5609..f5aefb1b 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -54,6 +54,7 @@ class HYDROData_SplitShapesGroup; class HYDROData_Document; class HYDROData_StricklerTable; class HYDROData_LandCoverMap; +class HYDROData_BCPolygon; /**\class HYDROData_CalculationCase * \brief Calculation case is defined by selection of Geometry objects with or without �Zone of water�. @@ -94,6 +95,7 @@ public: DataTag_AssignmentMode, ///< assignment mode DataTag_StricklerTable, ///< reference Strickler table DataTag_InterPoly, ///< intersection polyline + DataTag_BCPolygon, ///< reference boundary polygons DataTag_LandCover_Obsolete, ///< reference land covers DataTag_CustomLandCoverRules_Obsolete, ///< custom rules for land covers priority @@ -277,6 +279,12 @@ public: HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetInterPolyObjects() const; + HYDRODATA_EXPORT virtual bool AddBoundaryPolygon( const Handle(HYDROData_BCPolygon)& theBCPolygon ); + + HYDRODATA_EXPORT virtual void RemoveBoundaryPolygon( const Handle(HYDROData_BCPolygon)& theBCPolygon ); + + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetBoundaryPolygons() const; + /** * Exports the calculation case data (shell and groups) to GEOM module. * \param theStudyId the id of the study where the GEOM module should be used for export diff --git a/src/HYDROData/HYDROData_Document.cxx b/src/HYDROData/HYDROData_Document.cxx index 34fb5356..c892dcd8 100644 --- a/src/HYDROData/HYDROData_Document.cxx +++ b/src/HYDROData/HYDROData_Document.cxx @@ -334,6 +334,7 @@ bool HYDROData_Document::DumpToPython( const QString& thePyScriptPath, aRes = aRes && dumpPartitionToPython( aFile, thePyScriptPath, theIsMultiFile, aTreatedObjects, KIND_DIGUE ); aRes = aRes && dumpPartitionToPython( aFile, thePyScriptPath, theIsMultiFile, aTreatedObjects, KIND_OBSTACLE ); aRes = aRes && dumpPartitionToPython( aFile, thePyScriptPath, theIsMultiFile, aTreatedObjects, KIND_LAND_COVER_MAP ); + aRes = aRes && dumpPartitionToPython( aFile, thePyScriptPath, theIsMultiFile, aTreatedObjects, KIND_BC_POLYGON ); aRes = aRes && dumpPartitionToPython( aFile, thePyScriptPath, theIsMultiFile, aTreatedObjects, KIND_CALCULATION ); // Dump code to close python fuction diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index e052c425..94c4921a 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -148,6 +148,8 @@ QString HYDROData_Entity::Type( ObjectKind theKind ) return "Land_cover_map"; case KIND_DTM: return "DTM"; + case KIND_BC_POLYGON: + return "Boundary Polygon"; } return ""; } @@ -783,6 +785,7 @@ QString HYDROData_Entity::getPyTypeID() const case KIND_LAND_COVER_OBSOLETE: return ""; case KIND_CHANNEL_ALTITUDE: return "KIND_CHANNEL_ALTITUDE"; case KIND_LAND_COVER_MAP: return "KIND_LAND_COVER_MAP"; + case KIND_BC_POLYGON: return "KIND_BC_POLYGON"; default: return "KIND_UNKNOWN"; ///! Unrecognized object } } diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 91843863..bba4f693 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -76,7 +76,8 @@ const ObjectKind KIND_LAND_COVER_OBSOLETE = 27; const ObjectKind KIND_CHANNEL_ALTITUDE = 28; const ObjectKind KIND_LAND_COVER_MAP = 29; const ObjectKind KIND_DTM = 30; -const ObjectKind KIND_LAST = KIND_DTM+1; +const ObjectKind KIND_BC_POLYGON = 31; +const ObjectKind KIND_LAST = KIND_BC_POLYGON+1; class MapOfTreatedObjects : public QMap { diff --git a/src/HYDROData/HYDROData_ImmersibleZone.cxx b/src/HYDROData/HYDROData_ImmersibleZone.cxx index 6d0ed150..0c08bffb 100644 --- a/src/HYDROData/HYDROData_ImmersibleZone.cxx +++ b/src/HYDROData/HYDROData_ImmersibleZone.cxx @@ -24,7 +24,7 @@ #include "HYDROData_PolylineXY.h" #include "HYDROData_ShapesTool.h" -#include +#include #include #include @@ -34,13 +34,11 @@ #include #include -#include -#include -#include #include #include + #include #include @@ -123,134 +121,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape() const TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_PolylineXY)& aPolyline ) { - //DEBTRACE("generateTopShape"); - TopoDS_Face aResultFace = TopoDS_Face(); // --- result: default = null face - - if (!aPolyline.IsNull()) - { - TopoDS_Shape aPolylineShape = aPolyline->GetShape(); -#ifdef DEB_IMZ - std::string brepName = "imz.brep"; - BRepTools::Write(aPolylineShape, brepName.c_str()); -#endif - TopTools_ListOfShape aWiresList; - - if (!aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE) - { - // --- only one wire: try to make a face - //DEBTRACE("one wire: try to build a face"); - const TopoDS_Wire& aPolylineWire = TopoDS::Wire(aPolylineShape); - if (!aPolylineWire.IsNull()) - { - BRepBuilderAPI_MakeFace aMakeFace(aPolylineWire, Standard_True); - aMakeFace.Build(); - if (aMakeFace.IsDone()) - { - //DEBTRACE(" a face with the only wire given"); - aResultFace = aMakeFace.Face(); - } - } - } - else - { - // --- a list of wires ? inventory of wires and edges - Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape; - Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape; - TopExp_Explorer anExp(aPolylineShape, TopAbs_WIRE); - //DEBTRACE("list of wires ?"); - for (; anExp.More(); anExp.Next()) - { - if (!anExp.Current().IsNull()) - { - const TopoDS_Wire& aWire = TopoDS::Wire(anExp.Current()); - aWiresList.Append(aWire); - //DEBTRACE(" append wire"); - TopExp_Explorer it2(aWire, TopAbs_EDGE); - for (; it2.More(); it2.Next()) - aSeqEdges->Append(it2.Current()); - } - } - if (aWiresList.IsEmpty()) - return aResultFace; // --- no wires: null result - - if (aSeqEdges->Length() > 1) - { - //DEBTRACE("try to connect all the edges together, build a unique wire and a face"); - // --- try to create one wire by connecting edges with a distance tolerance (no necessity of sharing points) - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, 1E-5, Standard_False, aSeqWires); - - if (aSeqWires->Length() == 1) - { - // --- one wire: try to make a face - const TopoDS_Wire& aPolylineWire = TopoDS::Wire(aSeqWires->Value(1)); - if (!aPolylineWire.IsNull()) - { - BRepBuilderAPI_MakeFace aMakeFace(aPolylineWire, Standard_True); - aMakeFace.Build(); - if (aMakeFace.IsDone()) - { - //DEBTRACE(" a face from all the wires connected"); - aResultFace = aMakeFace.Face(); - } - } - } - } - - if (aResultFace.IsNull()) - { - //DEBTRACE("try to make a face with the first wire of the list and other wires as restrictions"); - // --- try to make a face with the first wire of the list and other wires as restrictions - BRepAlgo_FaceRestrictor aFR; - TopoDS_Face aRefFace; - TopoDS_Shape aS = aWiresList.First(); - BRepBuilderAPI_MakeFace aMakeFace(TopoDS::Wire(aWiresList.First()), Standard_True); - aMakeFace.Build(); - if (aMakeFace.IsDone()) - { - //DEBTRACE(" a face with first wire"); - aRefFace = aMakeFace.Face(); - } - if (!aRefFace.IsNull()) - { - aFR.Init(aRefFace, Standard_False, Standard_True); - TopTools_ListIteratorOfListOfShape anIt(aWiresList); - for (; anIt.More(); anIt.Next()) - { - TopoDS_Wire& aWire = TopoDS::Wire(anIt.Value()); - if (aWire.IsNull()) - continue; - aFR.Add(aWire); - } - aFR.Perform(); - if (aFR.IsDone()) - { - for (; aFR.More(); aFR.Next()) - { - //DEBTRACE(" a restricted face"); - aResultFace = aFR.Current(); - break; - } - } - } - } - } - } - - if (aResultFace.IsNull()) - return aResultFace; - - //DEBTRACE("check the face"); - BRepCheck_Analyzer anAnalyzer(aResultFace); - if (anAnalyzer.IsValid() && aResultFace.ShapeType() == TopAbs_FACE) - { - //DEBTRACE("face OK"); - return aResultFace; - } - else - { - //DEBTRACE("bad face"); - } - return TopoDS_Face(); + return HYDROData_Tool::PolyXY2Face(aPolyline); } void HYDROData_ImmersibleZone::createGroupObjects() diff --git a/src/HYDROData/HYDROData_Iterator.cxx b/src/HYDROData/HYDROData_Iterator.cxx index 3277b3f5..46212c31 100644 --- a/src/HYDROData/HYDROData_Iterator.cxx +++ b/src/HYDROData/HYDROData_Iterator.cxx @@ -45,7 +45,7 @@ #include "HYDROData_Zone.h" #include "HYDROData_StricklerTable.h" #include "HYDROData_DTM.h" - +#include "HYDROData_BCPolygon.h" #include #include @@ -162,6 +162,7 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel ) case KIND_CHANNEL_ALTITUDE: aResult = new HYDROData_ChannelAltitude(); break; case KIND_LAND_COVER_MAP: aResult = new HYDROData_LandCoverMap(); break; case KIND_DTM: aResult = new HYDROData_DTM(); break; + case KIND_BC_POLYGON: aResult = new HYDROData_BCPolygon(); break; default: break; } diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 2a38a86d..eef771c3 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -706,7 +706,7 @@ void HYDROData_ShapeFile::GetFreeIndices(std::vector& theAllowedIndexes, QS } int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, const QString& theFileName, - NCollection_Sequence& theEntities, int& theShapeTypeOfFile) + NCollection_Sequence& theEntities, int& theShapeTypeOfFile, ImportShapeType theShapeTypesToImport) { //Free(); int aStat = TryOpenShapeFile(theFileName); @@ -728,7 +728,12 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, if (!Parse(aHSHP, HYDROData_ShapeFile::ShapeType_Polyline, theShapeTypeOfFile)) return 0; - if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23) + + int sh_type = aHSHP->nShapeType; + + if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || + theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline) + && (sh_type == 3 || sh_type == 23)) { size_t anObjsSize = mySHPObjects.size(); GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName); @@ -739,7 +744,8 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, } aStat = 1; } - else if (aHSHP->nShapeType == 13) + else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || + theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13) { anInd = 0; for (;anAllowedIndexes.size() < mySHPObjects.size();) @@ -760,7 +766,8 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, } aStat = 1; } - else if (aHSHP->nShapeType == 5) + else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || + theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polygon) && sh_type == 5) { //import polygon's contours as polylines size_t anObjsSize = mySHPObjects.size(); diff --git a/src/HYDROData/HYDROData_ShapeFile.h b/src/HYDROData/HYDROData_ShapeFile.h index 41f2200f..b546bd23 100644 --- a/src/HYDROData/HYDROData_ShapeFile.h +++ b/src/HYDROData/HYDROData_ShapeFile.h @@ -63,6 +63,13 @@ enum DBF_FieldType DBF_FieldType_Invalid }; +enum ImportShapeType +{ + ImportShapeType_Polyline, + ImportShapeType_Polyline3D, + ImportShapeType_Polygon, + ImportShapeType_All +}; struct DBF_AttrValue { @@ -130,7 +137,8 @@ public: int theInd, NCollection_Sequence& theEntities); HYDRODATA_EXPORT int ImportPolylines(Handle(HYDROData_Document) theDocument, const QString& theFileName, - NCollection_Sequence& theEntities, int& theShapeTypeOfFile); + NCollection_Sequence& theEntities, int& theShapeTypeOfFile, + ImportShapeType theShapeTypesToImport); HYDRODATA_EXPORT QString GetShapeTypeName(int theType); diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 750b8973..cc142d0c 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -46,8 +47,6 @@ #include #include -#include -#include #include #include #include @@ -55,6 +54,20 @@ #include #include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + + static int aMaxNameId = INT_MAX; static int aMaxColorNb = 92000; void HYDROData_Tool::WriteStringsToFile( QFile& theFile, @@ -495,6 +508,137 @@ TopoDS_Shape HYDROData_Tool::RebuildCmp(const TopoDS_Shape& in) } +TopoDS_Shape HYDROData_Tool::PolyXY2Face( const Handle(HYDROData_PolylineXY)& aPolyline ) +{ + //DEBTRACE("generateTopShape"); + TopoDS_Face aResultFace = TopoDS_Face(); // --- result: default = null face + + if (!aPolyline.IsNull()) + { + TopoDS_Shape aPolylineShape = aPolyline->GetShape(); +#ifdef DEB_IMZ + std::string brepName = "imz.brep"; + BRepTools::Write(aPolylineShape, brepName.c_str()); +#endif + TopTools_ListOfShape aWiresList; + + if (!aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE) + { + // --- only one wire: try to make a face + //DEBTRACE("one wire: try to build a face"); + const TopoDS_Wire& aPolylineWire = TopoDS::Wire(aPolylineShape); + if (!aPolylineWire.IsNull()) + { + BRepBuilderAPI_MakeFace aMakeFace(aPolylineWire, Standard_True); + aMakeFace.Build(); + if (aMakeFace.IsDone()) + { + //DEBTRACE(" a face with the only wire given"); + aResultFace = aMakeFace.Face(); + } + } + } + else + { + // --- a list of wires ? inventory of wires and edges + Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape; + Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape; + TopExp_Explorer anExp(aPolylineShape, TopAbs_WIRE); + //DEBTRACE("list of wires ?"); + for (; anExp.More(); anExp.Next()) + { + if (!anExp.Current().IsNull()) + { + const TopoDS_Wire& aWire = TopoDS::Wire(anExp.Current()); + aWiresList.Append(aWire); + //DEBTRACE(" append wire"); + TopExp_Explorer it2(aWire, TopAbs_EDGE); + for (; it2.More(); it2.Next()) + aSeqEdges->Append(it2.Current()); + } + } + if (aWiresList.IsEmpty()) + return aResultFace; // --- no wires: null result + + if (aSeqEdges->Length() > 1) + { + //DEBTRACE("try to connect all the edges together, build a unique wire and a face"); + // --- try to create one wire by connecting edges with a distance tolerance (no necessity of sharing points) + ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, 1E-5, Standard_False, aSeqWires); + + if (aSeqWires->Length() == 1) + { + // --- one wire: try to make a face + const TopoDS_Wire& aPolylineWire = TopoDS::Wire(aSeqWires->Value(1)); + if (!aPolylineWire.IsNull()) + { + BRepBuilderAPI_MakeFace aMakeFace(aPolylineWire, Standard_True); + aMakeFace.Build(); + if (aMakeFace.IsDone()) + { + //DEBTRACE(" a face from all the wires connected"); + aResultFace = aMakeFace.Face(); + } + } + } + } + + if (aResultFace.IsNull()) + { + //DEBTRACE("try to make a face with the first wire of the list and other wires as restrictions"); + // --- try to make a face with the first wire of the list and other wires as restrictions + BRepAlgo_FaceRestrictor aFR; + TopoDS_Face aRefFace; + TopoDS_Shape aS = aWiresList.First(); + BRepBuilderAPI_MakeFace aMakeFace(TopoDS::Wire(aWiresList.First()), Standard_True); + aMakeFace.Build(); + if (aMakeFace.IsDone()) + { + //DEBTRACE(" a face with first wire"); + aRefFace = aMakeFace.Face(); + } + if (!aRefFace.IsNull()) + { + aFR.Init(aRefFace, Standard_False, Standard_True); + TopTools_ListIteratorOfListOfShape anIt(aWiresList); + for (; anIt.More(); anIt.Next()) + { + TopoDS_Wire& aWire = TopoDS::Wire(anIt.Value()); + if (aWire.IsNull()) + continue; + aFR.Add(aWire); + } + aFR.Perform(); + if (aFR.IsDone()) + { + for (; aFR.More(); aFR.Next()) + { + //DEBTRACE(" a restricted face"); + aResultFace = aFR.Current(); + break; + } + } + } + } + } + } + + if (aResultFace.IsNull()) + return aResultFace; + + //DEBTRACE("check the face"); + BRepCheck_Analyzer anAnalyzer(aResultFace); + if (anAnalyzer.IsValid() && aResultFace.ShapeType() == TopAbs_FACE) + { + //DEBTRACE("face OK"); + return aResultFace; + } + else + { + //DEBTRACE("bad face"); + } + return TopoDS_Face(); +} std::ostream& operator<<( std::ostream& theStream, const QString& theText ) { diff --git a/src/HYDROData/HYDROData_Tool.h b/src/HYDROData/HYDROData_Tool.h index d1f6dbdf..82e49366 100644 --- a/src/HYDROData/HYDROData_Tool.h +++ b/src/HYDROData/HYDROData_Tool.h @@ -23,7 +23,11 @@ #include #include #include +#include +#include + +class HYDROData_PolylineXY; class HYDROData_Document; class HYDROData_Entity; class HYDROData_SequenceOfObjects; @@ -137,6 +141,9 @@ public: Rebuilds shape container (like compound/compsolid/shell) which contains faces (shared or nonshared with each other) */ static TopoDS_Shape RebuildCmp(const TopoDS_Shape& in); + + static TopoDS_Shape PolyXY2Face(const Handle(HYDROData_PolylineXY)& aPolyline); + }; inline bool ValuesEquals( const double& theFirst, const double& theSecond ) diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index ae491956..5d7211b2 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -41,6 +41,7 @@ set(PROJECT_HEADERS HYDROGUI_ImportLandCoverMapOp.h HYDROGUI_ImportLandCoverMapDlg.h HYDROGUI_ImportPolylineOp.h + HYDROGUI_ImportBCPolygonOp.h HYDROGUI_ImportSinusXOp.h HYDROGUI_ExportSinusXOp.h HYDROGUI_ExportSinusXDlg.h @@ -154,6 +155,8 @@ set(PROJECT_HEADERS HYDROGUI_ZoneSetColorOp.h HYDROGUI_PolyAttrDlg.h HYDROGUI_ShowAttrPolyOp.h + HYDROGUI_SetBoundaryTypePolygonOp.h + HYDROGUI_SetBoundaryTypePolygonDlg.h ) QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS}) @@ -199,6 +202,7 @@ set(PROJECT_SOURCES HYDROGUI_ImportSinusXOp.cxx HYDROGUI_ExportSinusXOp.cxx HYDROGUI_ExportSinusXDlg.cxx + HYDROGUI_ImportBCPolygonOp.cxx HYDROGUI_ExportLandCoverMapDlg.cxx HYDROGUI_InputPanel.cxx HYDROGUI_LandCoverArgsFilter.cxx @@ -310,6 +314,8 @@ set(PROJECT_SOURCES HYDROGUI_ZoneSetColorOp.cxx HYDROGUI_PolyAttrDlg.cxx HYDROGUI_ShowAttrPolyOp.cxx + HYDROGUI_SetBoundaryTypePolygonOp.cxx + HYDROGUI_SetBoundaryTypePolygonDlg.cxx ) add_definitions( diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index 1133fcb1..b5c783d8 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -71,6 +71,8 @@ HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, co { addPage( createObjectsPage() ); addPage( createGroupsPage() ); + addPage( createBoundaryPolygonsPage() ); + addPage( createLandCoverMapPage() ); addPage( createZonesPage() ); } @@ -309,6 +311,85 @@ QWizardPage* HYDROGUI_CalculationDlg::createGroupsPage() { return aPage; } +QWizardPage* HYDROGUI_CalculationDlg::createBoundaryPolygonsPage() { + QWizardPage* aPage = new QWizardPage( mainFrame() ); + QFrame* aFrame = new QFrame( aPage ); + + myBoundaryPolygons = new QListWidget( aPage ); + myBoundaryPolygons->setSelectionMode( QListWidget::ExtendedSelection ); + myBoundaryPolygons->setEditTriggers( QListWidget::NoEditTriggers ); + myBoundaryPolygons->setViewMode( QListWidget::ListMode ); + myBoundaryPolygons->setSortingEnabled( true ); + + myISBoundaryPolygons = new QListWidget( aPage ); + myISBoundaryPolygons->setSelectionMode( QListWidget::ExtendedSelection ); + myISBoundaryPolygons->setEditTriggers( QListWidget::NoEditTriggers ); + myISBoundaryPolygons->setViewMode( QListWidget::ListMode ); + myISBoundaryPolygons->setSortingEnabled( true ); + + myAvailableBoundaryPolygons = new QListWidget( aPage ); + myAvailableBoundaryPolygons->setSelectionMode( QListWidget::ExtendedSelection ); + myAvailableBoundaryPolygons->setEditTriggers( QListWidget::NoEditTriggers ); + myAvailableBoundaryPolygons->setViewMode( QListWidget::ListMode ); + myAvailableBoundaryPolygons->setSortingEnabled( true ); + + //connect( myGroups, SIGNAL( itemSelectionChanged() ), + // SIGNAL( groupsSelected() ) ); //TODO + + QFrame* aBPFrame = new QFrame( aPage ); + QGridLayout* aBPLayout = new QGridLayout( aBPFrame ); + aBPLayout->setMargin( 5 ); + aBPLayout->setSpacing( 5 ); + aBPFrame->setLayout( aBPLayout ); + + QFrame* aBtnsFrame = new QFrame( aBPFrame ); + QVBoxLayout* aBtnsLayout = new QVBoxLayout( aBtnsFrame ); + aBtnsLayout->setMargin( 5 ); + aBtnsLayout->setSpacing( 5 ); + aBtnsFrame->setLayout( aBtnsLayout ); + QPushButton* anAddBtn = new QPushButton( tr("INCLUDE"), aBtnsFrame ); + QPushButton* aRemoveBtn = new QPushButton( tr("EXCLUDE"), aBtnsFrame ); + + // Fill the butons frame with two buttons + aBtnsLayout->addWidget( anAddBtn ); + aBtnsLayout->addWidget( aRemoveBtn ); + aBtnsLayout->addStretch( 1 ); + + QLabel* anIncludedLabelCut = new QLabel( tr( "INCLUDED_BOUNDARY_POLYGONS_CUT" ), aBPFrame ); + + QLabel* anAvailableLabel = new QLabel( tr( "AVAILABLE_BOUNDARY_POLYGONS" ), aBPFrame ); + + QLabel* anIncludedLabelIS = new QLabel( tr( "INCLUDED_BOUNDARY_POLYGONS_INCSEL" ) ); + + // Fill the objects frame with two lists, two labels and with buttons frame + aBPLayout->addWidget( anAvailableLabel, 0, 0, Qt::AlignHCenter ); + aBPLayout->addWidget( anIncludedLabelCut, 0, 2, Qt::AlignHCenter ); + + aBPLayout->addWidget( myAvailableBoundaryPolygons, 1, 0, 3, 1 ); + aBPLayout->addWidget( aBtnsFrame, 1, 1, Qt::AlignHCenter ); + aBPLayout->addWidget( myBoundaryPolygons, 1, 2 ); + + aBPLayout->addWidget( anIncludedLabelIS, 2, 2 ); + + aBPLayout->addWidget( myISBoundaryPolygons, 3, 2 ); + + + // Fill the page + QGridLayout* aPageLayout = new QGridLayout( aPage ); + aPageLayout->setMargin( 5 ); + aPageLayout->setSpacing( 5 ); + aPageLayout->setVerticalSpacing( 10 ); + aPageLayout->addWidget( aBPFrame, 0, 0 ); + + aPage->setLayout( aPageLayout ); + + connect( anAddBtn, SIGNAL( clicked() ), SIGNAL( addBoundaryPolygons() ) ); + connect( aRemoveBtn, SIGNAL( clicked() ), SIGNAL( removeBoundaryPolygons() ) ); + + return aPage; +} + + QWizardPage* HYDROGUI_CalculationDlg::createLandCoverMapPage() { QWizardPage* aPage = new QWizardPage( mainFrame() ); QFrame* aFrame = new QFrame( aPage ); @@ -731,6 +812,70 @@ void HYDROGUI_CalculationDlg::excludeGroups( const QStringList& theObjects ) moveItems( myGroups, myAvailableGroups, theObjects ); } +/// + +void HYDROGUI_CalculationDlg::setAvailableBoundaryPolygons( const QStringList& theBoundaryPolygons, + const QVector& theTypes ) +{ + myAvailableBoundaryPolygons->clear(); + myBoundaryPolygons->clear(); + myISBoundaryPolygons->clear(); + QString iconStr; + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + int i = 0; + foreach( QString aBP, theBoundaryPolygons ) + { + int aBT = theTypes[i]; + i++; + if (aBT == 1) + iconStr = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE1_ICO").toLatin1()); + else if (aBT == 2) + iconStr = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE2_ICO").toLatin1()); + else if (aBT == 3) + iconStr = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE3_ICO").toLatin1()); + else + continue; + QPixmap aPM = aResMgr->loadPixmap( "HYDRO", iconStr ); + QListWidgetItem* item = new QListWidgetItem(QIcon(aPM), aBP); + myAvailableBoundaryPolygons->addItem(item); + } +} + +QStringList HYDROGUI_CalculationDlg::getSelectedBoundaryPolygons() const +{ + return getSelected( myBoundaryPolygons ); +} + +QStringList HYDROGUI_CalculationDlg::getSelectedISBoundaryPolygons() const +{ + return getSelected( myISBoundaryPolygons ); +} + +QStringList HYDROGUI_CalculationDlg::getSelectedAvailableBoundaryPolygons() const +{ + return getSelected( myAvailableBoundaryPolygons ); +} + +void HYDROGUI_CalculationDlg::includeBoundaryPolygons( const QStringList& theObjects ) +{ + moveItems( myAvailableBoundaryPolygons, myBoundaryPolygons, theObjects ); +} + +void HYDROGUI_CalculationDlg::includeISBoundaryPolygons( const QStringList& theObjects ) +{ + moveItems( myAvailableBoundaryPolygons, myISBoundaryPolygons, theObjects ); +} + +void HYDROGUI_CalculationDlg::excludeBoundaryPolygons( const QStringList& theObjects ) +{ + moveItems( myBoundaryPolygons, myAvailableBoundaryPolygons, theObjects ); +} + +void HYDROGUI_CalculationDlg::excludeISBoundaryPolygons( const QStringList& theObjects ) +{ + moveItems( myISBoundaryPolygons, myAvailableBoundaryPolygons, theObjects ); +} + /** Get creation mode. @param theMode the mode diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.h b/src/HYDROGUI/HYDROGUI_CalculationDlg.h index 6b5a4463..2866b623 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.h +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.h @@ -69,10 +69,15 @@ public: QStringList getSelectedAvailableGeomObjects() const; QStringList getSelectedGroups() const; QStringList getSelectedAvailableGroups() const; + QStringList getSelectedBoundaryPolygons() const; + QStringList getSelectedISBoundaryPolygons() const; + QStringList getSelectedAvailableBoundaryPolygons() const; HYDROGUI_Zone* getCurrentZone() const; void setAvailableGroups( const QStringList& ); + void setAvailableBoundaryPolygons( const QStringList&, const QVector& ); + void setEditZonesEnabled( const bool theIsEnabled ); HYDROData_ListOfRules getRules() const; @@ -85,6 +90,14 @@ public slots: void excludeGeomObjects( const QStringList& theObjects ); void includeGroups( const QStringList& theObjects ); void excludeGroups( const QStringList& theObjects ); + + void includeBoundaryPolygons( const QStringList& theObjects ); + void includeISBoundaryPolygons( const QStringList& theObjects ); + + void excludeBoundaryPolygons( const QStringList& theObjects ); + void excludeISBoundaryPolygons( const QStringList& theObjects ); + + void onEmptyName(); void onAlreadyExists( QString theName ); void refreshZonesBrowser(); @@ -122,6 +135,9 @@ signals: void removeGroups(); void groupsSelected(); + void addBoundaryPolygons(); + void removeBoundaryPolygons(); + void boundarySelected( const QString & theObjName ); void setMergeType( int theMergeType, QString& theBathymetryName ); void createRegion( const QList& theZonesList ); @@ -146,6 +162,8 @@ private: QWizardPage* createObjectsPage(); QWizardPage* createGroupsPage(); + QWizardPage* createBoundaryPolygonsPage(); + QWizardPage* createLandCoverMapPage(); QWizardPage* createZonesPage(); @@ -169,6 +187,11 @@ private: QListWidget* myAvailableGroups; QListWidget* myGroups; + QListWidget* myAvailableBoundaryPolygons; + QListWidget* myBoundaryPolygons; + QListWidget* myISBoundaryPolygons; + + HYDROGUI_DataBrowser* myBrowser; Handle(HYDROData_CalculationCase) myEditedObject; QComboBox* myBathymetryChoice; diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 092c97bf..739df20f 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -247,6 +248,9 @@ HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const connect( aPanel, SIGNAL( addGroups() ), SLOT( onAddGroups() ) ); connect( aPanel, SIGNAL( removeGroups() ), SLOT( onRemoveGroups() ) ); + connect( aPanel, SIGNAL( addBoundaryPolygons() ), SLOT( onAddBoundaryPolygons() ) ); + connect( aPanel, SIGNAL( removeBoundaryPolygons() ), SLOT( onRemoveBoundaryPolygons() ) ); + connect( aPanel, SIGNAL( orderChanged( bool& ) ), SLOT( onOrderChanged( bool& ) ) ); connect( aPanel, SIGNAL( ruleChanged( bool& ) ), SLOT( onRuleChanged( bool& ) ) ); @@ -816,6 +820,10 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) setAvailableGroups(); } else if( theIndex==2 ) + { + setAvailableBoundaryPolygons(); + } + else if( theIndex==3 ) { // Land cover map panel HYDROGUI_CalculationDlg* aPanel = @@ -920,7 +928,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) closePreview( false ); createPreview( true ); } - else if( theIndex==3 ) + else if( theIndex==4 ) { HYDROGUI_CalculationDlg* aPanel = ::qobject_cast( inputPanel() ); @@ -1013,7 +1021,7 @@ void HYDROGUI_CalculationOp::onHideZones( const int theIndex ) closePreview( false ); createPreview( false ); } - if( theIndex==2 ) + if( theIndex==3 ) { setLandCoverMapVisible( true ); @@ -1023,7 +1031,7 @@ void HYDROGUI_CalculationOp::onHideZones( const int theIndex ) // Hide zones setZonesVisible( false ); } - else if( theIndex==3 ) + else if( theIndex==4 ) { AssignDefaultZonesColors(); @@ -1439,6 +1447,110 @@ void HYDROGUI_CalculationOp::onRemoveGroups() aPanel->excludeGroups( aSelectedList ); } + +void HYDROGUI_CalculationOp::setAvailableBoundaryPolygons() +{ + HYDROGUI_CalculationDlg* aPanel = ::qobject_cast( inputPanel() ); + + HYDROData_Iterator anIter( doc(), KIND_BC_POLYGON ); + Handle(HYDROData_BCPolygon) aBCP; + QStringList aNames; + QVector aTypes; + for (;anIter.More(); anIter.Next()) + { + aBCP = Handle(HYDROData_BCPolygon)::DownCast( anIter.Current() ); + aNames.append(aBCP->GetName()); + aTypes.append(aBCP->GetBoundaryType()); + } + HYDROData_SequenceOfObjects aBCPSeq = myEditedObject->GetBoundaryPolygons(); + + QStringList aListCut, aListIS; + for (int i=1; i<=aBCPSeq.Size();i++) + { + int type = Handle(HYDROData_BCPolygon)::DownCast(aBCPSeq(i))->GetBoundaryType(); + if (type == 1) + aListCut << aBCPSeq(i)->GetName(); + else if (type == 2 || type == 3) + aListIS << aBCPSeq(i)->GetName(); + } + + aPanel->setAvailableBoundaryPolygons( aNames, aTypes ); + aPanel->includeBoundaryPolygons( aListCut ); + aPanel->includeISBoundaryPolygons( aListIS ); +} + +void HYDROGUI_CalculationOp::onRemoveBoundaryPolygons() +{ + HYDROGUI_CalculationDlg* aPanel = + ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return; + + QStringList aSelectedListCut = aPanel->getSelectedBoundaryPolygons(); + QStringList aSelectedListIS = aPanel->getSelectedISBoundaryPolygons(); + + if ( aSelectedListCut.isEmpty() && aSelectedListIS.isEmpty() ) + return; + + for (int i = 0; i < aSelectedListCut.length(); i++) + { + Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedListCut.at(i) ) ); + if ( aBCPoly.IsNull() ) + continue; + myEditedObject->RemoveBoundaryPolygon( aBCPoly ); + } + + for (int i = 0; i < aSelectedListIS.length(); i++) + { + Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedListIS.at(i) ) ); + if ( aBCPoly.IsNull() ) + continue; + myEditedObject->RemoveBoundaryPolygon( aBCPoly ); + } + + aPanel->excludeBoundaryPolygons( aSelectedListCut ); + aPanel->excludeISBoundaryPolygons( aSelectedListIS ); +} + + +void HYDROGUI_CalculationOp::onAddBoundaryPolygons() +{ + HYDROGUI_CalculationDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return; + + QStringList aSelectedList = aPanel->getSelectedAvailableBoundaryPolygons(); + if ( aSelectedList.isEmpty()) + return; + + QStringList anAddedListCut, anAddedListIS; + for (int i = 0; i < aSelectedList.length(); i++) + { + Handle(HYDROData_BCPolygon) aBCPoly = Handle(HYDROData_BCPolygon)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at( i ) ) ); + if ( aBCPoly.IsNull() ) + continue; + + if ( myEditedObject->AddBoundaryPolygon( aBCPoly ) ) + { + QString aName = aBCPoly->GetName(); + int type = aBCPoly->GetBoundaryType(); + if (type == 1) + anAddedListCut.append(aName); + else if (type == 2 || type == 3) + anAddedListIS.append(aName); + } + + } + + if ( !anAddedListCut.isEmpty() ) + aPanel->includeBoundaryPolygons(anAddedListCut); + if ( !anAddedListIS.isEmpty() ) + aPanel->includeISBoundaryPolygons(anAddedListIS); +} + void HYDROGUI_CalculationOp::onChangeMode( int theMode ) { HYDROGUI_CalculationDlg* aPanel = diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.h b/src/HYDROGUI/HYDROGUI_CalculationOp.h index 2f46cb39..8eb18c14 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.h @@ -54,6 +54,8 @@ protected: void setAvailableGroups(); + void setAvailableBoundaryPolygons(); + protected slots: /** @@ -80,6 +82,10 @@ protected slots: */ void onRemoveGroups(); + void onAddBoundaryPolygons(); + + void onRemoveBoundaryPolygons(); + /** * Set the given bathymetry/type merge type to the current zone. */ diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 63d4252c..fc303d0c 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -294,6 +295,9 @@ void HYDROGUI_DataModel::update( const int theStudyId ) // OBSTACLES LightApp_DataObject* anObstaclesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_OBSTACLE ).toLatin1() ) ); + //BC Polygons + LightApp_DataObject* aBCPolygonRootObj = createObject( aNewRootObj, tr( partitionName( KIND_BC_POLYGON ).toLatin1() ) ); + // STRICKLER TABLES LightApp_DataObject* aStricklerTablesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_STRICKLER_TABLE ).toLatin1() ) ); @@ -472,6 +476,16 @@ void HYDROGUI_DataModel::update( const int theStudyId ) obj = createObject( aVisualStateRootObj, aVisualStateObj ); } + break; + } + case KIND_BC_POLYGON: + { + Handle(HYDROData_BCPolygon) aBCPolygonObj = + Handle(HYDROData_BCPolygon)::DownCast( anObj ); + if( !aBCPolygonObj.IsNull() ) { + obj = createObject( aBCPolygonRootObj, aBCPolygonObj ); + } + break; } } @@ -794,6 +808,7 @@ QString HYDROGUI_DataModel::partitionName( const ObjectKind theObjectKind ) case KIND_STRICKLER_TABLE: return "STRICKLER_TABLES"; case KIND_LAND_COVER_MAP: return "LAND_COVER_MAPS"; case KIND_REGION: return "REGIONS"; + case KIND_BC_POLYGON: return "BOUNDARY_POLYGONS"; default: break; } return QString(); @@ -817,7 +832,8 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* aKind == KIND_SHAPES_GROUP || aKind == KIND_SPLIT_GROUP || aKind == KIND_ZONE || aKind == KIND_IMMERSIBLE_ZONE || aKind == KIND_REGION || aKind == KIND_BATHYMETRY || aKind == KIND_OBSTACLE || aKind == KIND_STREAM || aKind == KIND_CHANNEL || - aKind == KIND_DIGUE || aKind == KIND_DUMMY_3D || aKind == KIND_LAND_COVER_MAP; + aKind == KIND_DIGUE || aKind == KIND_DUMMY_3D || aKind == KIND_LAND_COVER_MAP || + aKind == KIND_BC_POLYGON; if ( !visibility ) { Handle(HYDROData_Profile) aProfObj = Handle(HYDROData_Profile)::DownCast( theModelObject ); @@ -1172,7 +1188,18 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, HYDROData_SequenceOfObjects aPolylines = aLandCoverMapObj->GetPolylines(); buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );*/ } - + else if ( anObjectKind == KIND_BC_POLYGON ) + { + Handle(HYDROData_BCPolygon) aBCObj = + Handle(HYDROData_BCPolygon)::DownCast( aDataObj ); + + LightApp_DataObject* aPolylineSect = + createObject( aGuiObj, tr( "BC_POLYGON_POLYLINE" ), aGuiObj->entry() ); + + Handle(HYDROData_PolylineXY) aPolyline = aBCObj->GetPolyline(); + if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() ) + createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false ); + } HYDROGUI_Module* aModule = dynamic_cast( module() ); if( aModule ) aModule->enableLCMActions(); diff --git a/src/HYDROGUI/HYDROGUI_DataObject.cxx b/src/HYDROGUI/HYDROGUI_DataObject.cxx index a616edec..f68c26e6 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.cxx +++ b/src/HYDROGUI/HYDROGUI_DataObject.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -198,6 +199,19 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const painter.end(); return qpmD; } + else if (anObjectKind == KIND_BC_POLYGON) + { + Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( aDataObject ); + int aBT = aBCObj->GetBoundaryType(); + if (aBT == 1) + anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE1_ICO").toLatin1()); + else if (aBT == 2) + anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE2_ICO").toLatin1()); + else if (aBT == 3) + anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE3_ICO").toLatin1()); + else + anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE_UNDEF_ICO").toLatin1()); + } else anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() ); } diff --git a/src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.cxx b/src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.cxx new file mode 100644 index 00000000..8d0c6156 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.cxx @@ -0,0 +1,142 @@ +// 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 +// + +#include "HYDROGUI_ImportBCPolygonOp.h" + +#include "HYDROGUI_DataModel.h" +#include "HYDROGUI_Module.h" +#include "HYDROGUI_UpdateFlags.h" +#include "HYDROGUI_Tool2.h" +#include + +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include + + +HYDROGUI_ImportBCPolygonOp::HYDROGUI_ImportBCPolygonOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ) +{ + setName( tr( "IMPORT_BC_POLYGON" ) ); +} + +HYDROGUI_ImportBCPolygonOp::~HYDROGUI_ImportBCPolygonOp() +{ +} + +void HYDROGUI_ImportBCPolygonOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true ); + myFileDlg->setWindowTitle( getName() ); + myFileDlg->setFileMode( SUIT_FileDlg::ExistingFiles ); + myFileDlg->setNameFilter( tr("BC_POLYGON_FILTER") ); + + connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); + connect( myFileDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); + + myFileDlg->exec(); +} + + +bool HYDROGUI_ImportBCPolygonOp::processApply( int& theUpdateFlags, QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) +{ + if ( !myFileDlg ) + { + //abort(); + return false; + } + + QStringList aFileNames = myFileDlg->selectedFiles(); + + QApplication::setOverrideCursor( Qt::WaitCursor ); + //startDocOperation(); + + NCollection_Sequence importedEnts = + HYDROGUI_ImportPolylineOp::ImportPolyOp(aFileNames, doc(), module(), + HYDROData_ShapeFile::ImportShapeType_Polygon); + + for (int i=1;i<=importedEnts.Size();i++ ) + { + Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast(importedEnts(i)); + if (aPolylineXY.IsNull()) + continue; + TopoDS_Shape aTopSh = HYDROData_BCPolygon::generateTopShape(aPolylineXY); + if (aTopSh.IsNull()) + continue; + + //get boundary type from DBF + QStringList aDBFTableList; + aPolylineXY->GetDBFInfo(aDBFTableList); + QVector aDBFTable = aDBFTableList.toVector(); + int nbs = aDBFTable.size(); + QString aBTypeStr; + for (int i = 0; i < nbs / 2; i++) + if (aDBFTable[i] == "type") + { + aBTypeStr = aDBFTable[nbs / 2 + i]; + break; + } + + int aBTypeVal = 0; + bool Ok = false; + aBTypeVal = aBTypeStr.toInt(&Ok); + if (!Ok) + aBTypeVal = 0; + + QString aPolyXYName = aPolylineXY->GetName(); + Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( doc()->CreateObject( KIND_BC_POLYGON ) ); + aBCObj->SetName( "BP_" + aPolyXYName ); + aBCObj->SetBoundaryType(aBTypeVal); + + aBCObj->SetFillingColor( aBCObj->DefaultFillingColor() ); + aBCObj->SetBorderColor( aBCObj->DefaultBorderColor() ); + aBCObj->SetPolyline( aPolylineXY ); + aBCObj->Update(aTopSh); + + module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aBCObj, true ); + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aBCObj ); + theBrowseObjectsEntries.append( anEntry ); + module()->setIsToUpdate( aBCObj ); + } + + if (!aFileNames.empty()) + { + //commitDocOperation(); + //commit(); + //module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init | UF_OCCViewer ); + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init; + } + //else + // abort(); + + QApplication::restoreOverrideCursor(); + return true; +} diff --git a/src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.h b/src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.h new file mode 100644 index 00000000..60bb1c98 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ImportBCPolygonOp.h @@ -0,0 +1,49 @@ +// 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 +// + +#ifndef HYDROGUI_IMPORTBCPOLYGON_H +#define HYDROGUI_IMPORTBCPOLYGON_H + +#include "HYDROGUI_Operation.h" +#include + +#include + +class SUIT_FileDlg; +class HYDROData_Entity; + +class HYDROGUI_ImportBCPolygonOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_ImportBCPolygonOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_ImportBCPolygonOp(); + +protected: + virtual void startOperation(); + // virtual void onApply(); + virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ); + void UpdateView( NCollection_Sequence& anEntities); + +private: + SUIT_FileDlg* myFileDlg; +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index 257352f1..95c1a1bc 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -66,19 +66,11 @@ void HYDROGUI_ImportPolylineOp::startOperation() myFileDlg->exec(); } -void HYDROGUI_ImportPolylineOp::onApply() +NCollection_Sequence HYDROGUI_ImportPolylineOp::ImportPolyOp( + const QStringList& aFileNames, Handle(HYDROData_Document) theDocument, + HYDROGUI_Module* module, HYDROData_ShapeFile::ImportShapeType theShapeTypesToImport) { - if ( !myFileDlg ) - { - abort(); - return; - } - - QStringList aFileNames = myFileDlg->selectedFiles(); - - QApplication::setOverrideCursor( Qt::WaitCursor ); - startDocOperation(); - + NCollection_Sequence importedEntities; foreach (QString aFileName, aFileNames) { if ( aFileName.isEmpty() ) @@ -91,7 +83,8 @@ void HYDROGUI_ImportPolylineOp::onApply() HYDROData_ShapeFile anImporter; NCollection_Sequence theEntities; int aShapeTypeOfFile = -1; - int aStat = anImporter.ImportPolylines(doc(), aFileName, theEntities, aShapeTypeOfFile ); + int aStat = anImporter.ImportPolylines(theDocument, aFileName, theEntities, + aShapeTypeOfFile, theShapeTypesToImport ); if (aStat == 1 || aStat == 2) { //try to import DBF @@ -116,7 +109,7 @@ void HYDROGUI_ImportPolylineOp::onApply() } if (indNameAttrFound != -1) - bUseNameAttrFound = SUIT_MessageBox::question( module()->getApp()->desktop(), + bUseNameAttrFound = SUIT_MessageBox::question( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), tr( "IMPORT_POLYLINE_USE_NAME_ATTR" ), QMessageBox::Yes | QMessageBox::No, @@ -167,12 +160,13 @@ void HYDROGUI_ImportPolylineOp::onApply() } } if (aStat == 1) - UpdateView(theEntities); + UpdateView(module, theEntities); else if (aStat == 2) { - UpdateView(theEntities); - SUIT_MessageBox::information(module()->getApp()->desktop(), - tr( "IMPORT_POLYLINE" ), "Contour of the polygon(s) have been imported as polyline(s)"); + 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)"); } else { @@ -183,10 +177,29 @@ void HYDROGUI_ImportPolylineOp::onApply() aMess += "Cannot open SHX file"; else aMess += "The shape type of file is " + anImporter.GetShapeTypeName(aShapeTypeOfFile); - SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), aMess); + SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), aMess); } + importedEntities.Append(theEntities); } } + return importedEntities; +} + +void HYDROGUI_ImportPolylineOp::onApply() +{ + if ( !myFileDlg ) + { + abort(); + return; + } + + QStringList aFileNames = myFileDlg->selectedFiles(); + + QApplication::setOverrideCursor( Qt::WaitCursor ); + startDocOperation(); + + ImportPolyOp(aFileNames, doc(), module(), HYDROData_ShapeFile::ImportShapeType_All); + if (!aFileNames.empty()) { commitDocOperation(); @@ -199,16 +212,16 @@ void HYDROGUI_ImportPolylineOp::onApply() QApplication::restoreOverrideCursor(); } -void HYDROGUI_ImportPolylineOp::UpdateView( NCollection_Sequence& anEntities) +void HYDROGUI_ImportPolylineOp::UpdateView( HYDROGUI_Module* module, NCollection_Sequence& anEntities) { - size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() ); + size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module ); if ( anActiveViewId == 0 ) - anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() ); + anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module ); for (int i = 1; i <= anEntities.Size() ; i++) { anEntities(i)->Update(); - module()->setObjectVisible( anActiveViewId, anEntities(i), true ); - module()->setIsToUpdate( anEntities(i) ); + module->setObjectVisible( anActiveViewId, anEntities(i), true ); + module->setIsToUpdate( anEntities(i) ); } } diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h index 23cb0b87..695bff4d 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h @@ -23,6 +23,7 @@ #include #include +#include class SUIT_FileDlg; class HYDROData_Entity; @@ -33,12 +34,20 @@ class HYDROGUI_ImportPolylineOp : public HYDROGUI_Operation public: HYDROGUI_ImportPolylineOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_ImportPolylineOp(); + static NCollection_Sequence ImportPolyOp(const QStringList& aFileNames, + Handle(HYDROData_Document) theDocument, + HYDROGUI_Module* module, + HYDROData_ShapeFile::ImportShapeType theShapeTypesToImport); + protected: + virtual void startOperation(); virtual void onApply(); - void UpdateView( NCollection_Sequence& anEntities); + + static void UpdateView( HYDROGUI_Module* module, NCollection_Sequence& anEntities); private: SUIT_FileDlg* myFileDlg; diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index d51503a4..f9bdea57 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -397,6 +397,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, bool anIsObjectCanBeColored = false; bool isRoot = false; bool isStreamHasBottom = false; + bool anIsBCPolygon = false; SUIT_SelectionMgr* aSelectionMgr = getApp()->selectionMgr(); SUIT_DataOwnerPtrList anOwners; @@ -511,6 +512,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsStricklerTable = true; else if( anObjectKind == KIND_LAND_COVER_MAP ) anIsLandCoverMap = true; + else if (anObjectKind == KIND_BC_POLYGON) + anIsBCPolygon = true; else if( anObjectKind == KIND_STREAM ) { anIsStream = true; @@ -589,6 +592,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, case KIND_VISUAL_STATE: theMenu->addAction( action( SaveVisualStateId ) ); break; + case KIND_BC_POLYGON: + theMenu->addAction( action( ImportBCPolygonId ) ); + break; } theMenu->addSeparator(); } @@ -752,6 +758,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, } else if (anIsZone) theMenu->addAction( action( ZoneSetColorId ) ); + else if (anIsBCPolygon) + theMenu->addAction( action( SetBoundaryTypePolygonId ) ); if ( anIsStream || anIsChannel || anIsDigue || anIsObstacle ) { @@ -801,7 +809,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsImmersibleZone || anIsZone || anIsRegion || anIsBathymetry || anIsObstacle || anIsStream || anIsChannel || anIsDigue || anIsDummyObject3D || - anIsValidProfile || anIsGroup || anIsLandCoverMap ) + anIsValidProfile || anIsGroup || anIsLandCoverMap || + anIsBCPolygon) { if( anIsHiddenInSelection ) theMenu->addAction( action( ShowId ) ); diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index b5d318aa..82402e07 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -59,6 +59,7 @@ #include "HYDROGUI_RiverBottomOp.h" #include "HYDROGUI_ProfileInterpolateOp.h" #include "HYDROGUI_RecognizeContoursOp.h" +#include #include "HYDROGUI_SubmersibleOp.h" #include "HYDROGUI_StricklerTableOp.h" #include "HYDROGUI_DuplicateOp.h" @@ -76,6 +77,7 @@ #include "HYDROGUI_PolylineStyleOp.h" #include "HYDROGUI_ZoneSetColorOp.h" #include +#include #include #include #include @@ -145,6 +147,8 @@ void HYDROGUI_Module::createActions() createAction( ExportSinusXId, "EXPORT_SINUSX", "EXPORT_SINUSX_ICO" ); createAction( ImportLandCoverMapId, "IMPORT_LANDCOVER_MAP", "IMPORT_LANDCOVER_MAP_ICO" ); + createAction( ImportBCPolygonId, "IMPORT_BC_POLYGON", "IMPORT_BC_POLYGON_ICO" ); + createAction( CreatePolylineId, "CREATE_POLYLINE", "CREATE_POLYLINE_ICO" ); createAction( EditPolylineId, "EDIT_POLYLINE", "EDIT_POLYLINE_ICO" ); @@ -254,6 +258,7 @@ void HYDROGUI_Module::createActions() createAction( RegenerateRegionColorsId, "REGENERATE_REGION_COLORS" ); createAction( ZoneSetColorId, "ZONE_SET_COLOR" ); createAction( ShowHideArrows, "SHOW_HIDE_ARROWS" ); + createAction( SetBoundaryTypePolygonId, "SET_BOUNDARY_TYPE_POLYGON" ); } void HYDROGUI_Module::createMenus() @@ -348,6 +353,8 @@ void HYDROGUI_Module::createToolbars() createTool( ExportSinusXId, aToolBar ); createTool( ImportLandCoverMapId, aToolBar ); + createTool( ImportBCPolygonId, aToolBar ); + createTool( ImportBathymetryId, aToolBar ); createTool( CreatePolylineId, aToolBar ); createTool( CreatePolyline3DId, aToolBar ); @@ -621,6 +628,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case ExportSinusXId: anOp = new HYDROGUI_ExportSinusXOp( aModule ); break; + case ImportBCPolygonId: + anOp = new HYDROGUI_ImportBCPolygonOp( aModule ); + break; case ObserveImageId: anOp = new HYDROGUI_ObserveImageOp( aModule ); break; @@ -803,6 +813,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case ShowAttrPolylinesId: anOp = new HYDROGUI_ShowAttrPolyOp( aModule ); break; + case SetBoundaryTypePolygonId: + anOp = new HYDROGUI_SetBoundaryTypePolygonOp( aModule ); + break; case LandCoverScalarMapModeOnId: case LandCoverScalarMapModeOffId: anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId ); diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index 42e9ab9d..e17c2d28 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -114,7 +114,8 @@ enum OperationId ImportPolylineId, ImportSinusXId, ExportSinusXId, - + ImportBCPolygonId, + ExportToShapeFileID, ImportLandCoverMapId, @@ -148,7 +149,8 @@ enum OperationId BathymetryRescaleDefaultId, RegenerateRegionColorsId, ShowHideArrows, - ZoneSetColorId + ZoneSetColorId, + SetBoundaryTypePolygonId }; #endif diff --git a/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.cxx b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.cxx new file mode 100644 index 00000000..826beb29 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.cxx @@ -0,0 +1,94 @@ +// 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 +// + +#include "HYDROGUI_SetBoundaryTypePolygonDlg.h" +#include +#include +#include +#include +#include +#include +#include +#include + +HYDROGUI_SetBoundaryTypePolygonDlg::HYDROGUI_SetBoundaryTypePolygonDlg( QWidget* theParent, int theType ) + : QDialog( theParent ) +{ + QVBoxLayout* aMainLayout = new QVBoxLayout( this ); + aMainLayout->setMargin( 5 ); + aMainLayout->setSpacing( 5 ); + + QFrame* aBTFrame = new QFrame( this ); + QLabel* aBoundaryLabel = new QLabel( tr( "BOUNDARY_TYPE" ), aBTFrame ); + myBTBox = new QComboBox( aBTFrame ); + myBTBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QStringList Types; + Types << QObject::tr( QString("HYDRO_BC_POLYGON_TYPE1_ICO").toLatin1()) << + QObject::tr( QString("HYDRO_BC_POLYGON_TYPE2_ICO").toLatin1()) << + QObject::tr( QString("HYDRO_BC_POLYGON_TYPE3_ICO").toLatin1()); + + myBTBox->addItem(QIcon( aResMgr->loadPixmap( "HYDRO", Types[0])), tr( "CUT_TOOL" )); + myBTBox->addItem(QIcon( aResMgr->loadPixmap( "HYDRO", Types[1])), tr( "INCLUDE_TOOL" )); + myBTBox->addItem(QIcon( aResMgr->loadPixmap( "HYDRO", Types[2])), tr( "SELECTION_TOOL" )); + + if (theType != 1 && theType != 2 && theType != 3) + theType = -1; + myBTBox->setCurrentIndex(theType - 1); + + QBoxLayout* aColorLayout = new QHBoxLayout( aBTFrame ); + aColorLayout->setMargin( 10 ); + aColorLayout->setSpacing( 5 ); + aColorLayout->addWidget( aBoundaryLabel ); + aColorLayout->addWidget( myBTBox ); + + aMainLayout->addWidget( aBTFrame ); + + // Buttons + QPushButton* anOkButton = new QPushButton( tr( "OK" ), this ); + anOkButton->setDefault( true ); + QPushButton* aCancelButton = new QPushButton( tr( "CANCEL" ), this ); + aCancelButton->setAutoDefault( true ); + + QHBoxLayout* aButtonsLayout = new QHBoxLayout; + aButtonsLayout->setMargin( 5 ); + aButtonsLayout->setSpacing( 5 ); + aButtonsLayout->addWidget( anOkButton ); + aButtonsLayout->addStretch(); + aButtonsLayout->addWidget( aCancelButton ); + + aMainLayout->addStretch(); + aMainLayout->addLayout( aButtonsLayout ); + + setLayout( aMainLayout ); + + connect( anOkButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( aCancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +int HYDROGUI_SetBoundaryTypePolygonDlg::GetCurrentType() +{ + return myBTBox->currentIndex(); +} + +HYDROGUI_SetBoundaryTypePolygonDlg::~HYDROGUI_SetBoundaryTypePolygonDlg() +{ +} + + diff --git a/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.h b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.h new file mode 100644 index 00000000..c8820bec --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonDlg.h @@ -0,0 +1,42 @@ +// 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 +// + +#ifndef HYDROGUI_SETBOUNDARYTYPEPOLYGONDLG_H +#define HYDROGUI_SETBOUNDARYTYPEPOLYGONDLG_H + +#include +#include + +class HYDROGUI_SetBoundaryTypePolygonDlg : public QDialog +{ + Q_OBJECT + +public: + + HYDROGUI_SetBoundaryTypePolygonDlg( QWidget* theParent, int theType ); + + virtual ~HYDROGUI_SetBoundaryTypePolygonDlg(); + + int GetCurrentType(); + +private: + + QComboBox* myBTBox; +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.cxx b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.cxx new file mode 100644 index 00000000..eba26626 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.cxx @@ -0,0 +1,85 @@ +// 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 +// + +#include "HYDROGUI_SetBoundaryTypePolygonOp.h" + +#include "HYDROGUI_DataModel.h" +#include "HYDROGUI_Module.h" + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +HYDROGUI_SetBoundaryTypePolygonOp::HYDROGUI_SetBoundaryTypePolygonOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ), + mySetBTDlg( 0 ) +{ + setName( tr( "SET_BOUNDARY_TYPE_POLYGON" ) ); +} + +HYDROGUI_SetBoundaryTypePolygonOp::~HYDROGUI_SetBoundaryTypePolygonOp() +{ +} + +void HYDROGUI_SetBoundaryTypePolygonOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects(module()); + myBCP = Handle(HYDROData_BCPolygon)::DownCast(aSeq(1)); + + int bType = myBCP->GetBoundaryType(); + + mySetBTDlg = new HYDROGUI_SetBoundaryTypePolygonDlg( module()->getApp()->desktop(), bType ); + mySetBTDlg->setModal( true ); + mySetBTDlg->setWindowTitle(getName()); + + // Connect the dialog to operation slots + connect( mySetBTDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); + connect( mySetBTDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); + + mySetBTDlg->exec(); +} + + bool HYDROGUI_SetBoundaryTypePolygonOp::processApply( int& theUpdateFlags, + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) +{ + if ( !mySetBTDlg ) + return false; + + int aType = mySetBTDlg->GetCurrentType(); + + myBCP->SetBoundaryType( aType + 1 ); + myBCP->SetFillingColor( myBCP->DefaultFillingColor() ); + myBCP->SetBorderColor( myBCP->DefaultBorderColor() ); + + module()->setIsToUpdate( myBCP ); + + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced; + + return true; +} diff --git a/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.h b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.h new file mode 100644 index 00000000..7b4d2a8a --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SetBoundaryTypePolygonOp.h @@ -0,0 +1,51 @@ +// 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 +// + +#ifndef HYDROGUI_SETBOUNDARYTYPEPOLYGONOP_H +#define HYDROGUI_SETBOUNDARYTYPEPOLYGONOP_H + +#include "HYDROGUI_Operation.h" +#include + +class HYDROData_BCPolygon; +class HYDROGUI_SetBoundaryTypePolygonDlg; + +class HYDROGUI_SetBoundaryTypePolygonOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_SetBoundaryTypePolygonOp( HYDROGUI_Module* theModule ); + + virtual ~HYDROGUI_SetBoundaryTypePolygonOp(); + + bool processApply( int& theUpdateFlags, + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ); + +protected: + virtual void startOperation(); + +private: + + HYDROGUI_SetBoundaryTypePolygonDlg* mySetBTDlg; + + Handle(HYDROData_BCPolygon) myBCP; +}; + +#endif \ No newline at end of file diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 36df440a..27568465 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -303,6 +304,35 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, setShape( aCompound, false, false ); } + else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_BCPolygon) ) ) + { + Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( myObject ); + + TopoDS_Shape aBCShape = aBCObj->GetTopShape(); + if ( !aBCShape.IsNull() ) + { + if ( aBCShape.ShapeType() == TopAbs_FACE ) + { + TopoDS_Face aBCFace = TopoDS::Face( aBCShape ); + setFace( aBCFace, false, false, "" ); + } + else + { + myTopoShape = aBCShape; + myDisplayMode = AIS_Shaded; + buildShape(); + updateShape( false, false ); + } + } + + QColor aFillingColor = aBCObj->GetFillingColor(); + QColor aBorderColor = aBCObj->GetBorderColor(); + aFillingColor.setAlpha(175); + + setFillingColor( aFillingColor, false, false ); + setBorderColor( aBorderColor, false, false ); + } + } if ( myShapes.empty() || !isVisible() ) diff --git a/src/HYDROGUI/HYDROGUI_Tool2.cxx b/src/HYDROGUI/HYDROGUI_Tool2.cxx index 3dda8c6b..a7b684ff 100644 --- a/src/HYDROGUI/HYDROGUI_Tool2.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool2.cxx @@ -110,6 +110,7 @@ bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& the anObjectKind == KIND_DIGUE || anObjectKind == KIND_DUMMY_3D || anObjectKind == KIND_BATHYMETRY || + anObjectKind == KIND_BC_POLYGON || anObjectKind == KIND_LAND_COVER_MAP #ifdef DEB_GROUPS || anObjectKind == KIND_SHAPES_GROUP || diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx index af8b9bf8..487cc470 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsShape.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -261,6 +262,29 @@ void HYDROGUI_VTKPrsShape::buildShape() //setFillingColor( aFillingColor, false, false ); //setBorderColor( aBorderColor, false, false ); } + else if ( anObject->IsKind( STANDARD_TYPE(HYDROData_BCPolygon) ) ) + { + Handle(HYDROData_BCPolygon) aBCObj = + Handle(HYDROData_BCPolygon)::DownCast( anObject ); + + TopoDS_Shape aBCShape = aBCObj->GetTopShape(); + if ( !aBCShape.IsNull() ) + { + if ( aBCShape.ShapeType() == TopAbs_FACE ) + { + TopoDS_Face aFace = TopoDS::Face( aBCShape ); + setFace( aFace, false, false ); + } + else + { + myTopoShape = aBCShape; + } + } + + QColor aFillingColor = aBCObj->GetFillingColor(); + QColor aBorderColor = aBCObj->GetBorderColor(); + } + } } diff --git a/src/HYDROGUI/resources/HYDROGUI_images.ts b/src/HYDROGUI/resources/HYDROGUI_images.ts index 4a080b60..c2d89248 100644 --- a/src/HYDROGUI/resources/HYDROGUI_images.ts +++ b/src/HYDROGUI/resources/HYDROGUI_images.ts @@ -58,7 +58,22 @@ HYDRO_SUBMERSIBLE16_ICO icon_sumb_16.png - + + HYDRO_BC_POLYGON_TYPE1_ICO + icon_bc_polygon_type_1.png + + + HYDRO_BC_POLYGON_TYPE2_ICO + icon_bc_polygon_type_2.png + + + HYDRO_BC_POLYGON_TYPE3_ICO + icon_bc_polygon_type_3.png + + + HYDRO_BC_POLYGON_TYPE_UNDEF_ICO + icon_bc_polygon_type_undef.png + @@ -615,5 +630,10 @@ BATHYMETRY_RESCALE_DEFAULT_ICO icon_bathymetry_rescale_default.png - + + + IMPORT_BC_POLYGON_ICO + icon_bc_import.png + + diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 0ba175c3..ebe6fe75 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -99,6 +99,10 @@ NATURAL_OBJECTS NATURAL OBJECTS + + BOUNDARY_POLYGONS + BOUNDARY POLYGONS + BATHYMETRY_FILTER Bathymetry files (*.xyz);;ASC files (*.asc);;All files (*.* *) @@ -334,6 +338,18 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) INCLUDED_GROUPS Included groups + + INCLUDED_BOUNDARY_POLYGONS_CUT + Included boundary polygons (cut tools) + + + INCLUDED_BOUNDARY_POLYGONS_INCSEL + Included boundary polygons (include/selection tools) + + + AVAILABLE_BOUNDARY_POLYGONS + Available boundary polygons + LIMITS Limits @@ -1027,6 +1043,10 @@ Would you like to remove all references from the image? DSK_IMPORT_SINUSX Import from SinusX + + DSK_IMPORT_BC_POLYGON + Import boundary polygons from SHP file + DSK_EXPORT_SINUSX Export to SinusX @@ -1356,6 +1376,10 @@ Would you like to remove all references from the image? MEN_IMPORT_BATHYMETRY Import bathymetry + + MEN_IMPORT_BC_POLYGON + Import boundary polygons + MEN_EDIT_IMPORTED_BATHYMETRY Edit imported bathymetry @@ -1552,6 +1576,10 @@ Would you like to remove all references from the image? MEN_ZONE_SET_COLOR Set color + + MEN_SET_BOUNDARY_TYPE_POLYGON + Set boundary type + STB_CREATE_CALCULATION Create calculation case @@ -3617,4 +3645,39 @@ Polyline should consist from one not closed curve. + + HYDROGUI_ImportBCPolygonOp + + BC_POLYGON_FILTER + Shape files (*.shp) + + + + HYDROGUI_SetBoundaryTypePolygonOp + + SET_BOUNDARY_TYPE_POLYGON + Set Boundary Type + + + + HYDROGUI_SetBoundaryTypePolygonDlg + + BOUNDARY_TYPE + Boundary Type: + + + CUT_TOOL + Cut Tool + + + INCLUDE_TOOL + Include Tool + + + SELECTION_TOOL + Selection tool + + + + diff --git a/src/HYDROGUI/resources/icon_bc_import.png b/src/HYDROGUI/resources/icon_bc_import.png new file mode 100644 index 0000000000000000000000000000000000000000..7485db13d968448a211200213e925050abb25fe7 GIT binary patch literal 642 zcmV-|0)737P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^MlX|MGF00HtzL_t(IPj%5hXcJ)^#_{KlCTjj^bucZ) zAuYi{MWik|2!h~Lmx5r?#YLf@i#il+1s7d(2%Q8G5f#M6L2&U;hk^(ati`IRP$}9r zR(smgXzu*}j=MByJopU16+G^^yOsuLn~SZV+37wFZ8MXbXD$JzY$7o3ABFDSI6B-%V3NrFD1qr!E|q3 zn_mPJ#}=ib+$Oj!!do#F2A$Lw6-M6^n842{?BkOaTtgR}rZ784VQEwwF6?CS4NSpG zJS<_>3MOzF8?A&uTNsMNQig>|9Kmxu#!XzraVx0c9j?H39*)8vkZ+u-6lAdvd(a)t zt`)pO4Ko@@Unle}D(H#Be=Cm^T@-N83VtI%UAq$8D&d44F#mJ0QFt{D;2tU~1%p|i zpzR#!XzC%qZEr4Nv4c*W!#IB6qZRmA*5NgCVYuC~*Qw$@3Q^dOT*7V4p@uq^tl%{U z)Zsn}3w9?x=FgbMG1$&IoJZ9{@bL?LrJ-CWTse9g7WAhUnV0b$r_jd2B+lR~;(}T9 zT0uWDgx`h*C(`rG_F9wJ20MZ2!5F;ACFHDN28RfHVZqt#II~^s9VDABF@rJ|V3)YJ cJW_Q203iac!r6jJ+W-In07*qoM6N<$f|(c(q5uE@ literal 0 HcmV?d00001 diff --git a/src/HYDROGUI/resources/icon_bc_polygon_type_1.png b/src/HYDROGUI/resources/icon_bc_polygon_type_1.png new file mode 100644 index 0000000000000000000000000000000000000000..99f3b22e3e22102928965a468ca5100e93d167c1 GIT binary patch literal 472 zcmV;}0Vn>6P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^MlX|MGF00BrzL_t(IPpy+7Q$j%$g>Rr)2qec~!WaAj z2Eq#lhanIMM1BCy5QrrC0R{tsU@#B}Fhd{^{TbQ_2BN`0SkKva_PIOyW*o=x4Ri0F zbKc(F#hh~q)^r(|f(cUz$o!V=BG%w09`v>Us(P2%FbW= zsOQo87SzfB6#Oz5-oUl*nf1T{uoy^}OGE9r&=oU>Z3pvA#-o0HKomkP$H~~>fw8eD zMP^IT2ag~LP{>T42@9S!i*79P!s>vIJS!HwDi&w4$P23j8uIM_CEzb3+{oic2!}Y2 zMP67Pa4(NPL|!AWgpFLrq0BFUjc3)D(6qo&o-8De00a0)atL=arku3zq@lKWNYS?V zJh?y~0I!ONML09J%`bC(2fm)N0%~9k!Z<&{HEO&$2`C%Inf&ta?CcX-q5Z`NIO$0M O0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^MlX|MGF00DqWL_t(IPmPl=PXj>^#V2sVP*x!bX@b23 z1Rg{aNI)PkReS+LDlVZ3rpXEf0)aq4Qh}(btUy#C`2a{H;>3x{3Pi>6-rnqW7fPVX zFWLF?=5}VbQkG?eSd)Tl@C+s(2P4n}>5u%#u%-j1p!|hTkVTq6JO~npa=v;dTgz?P zP7dU<(T1-d#K$113&7x)87Smx?MOtPzziVhD8Mn|EtgZ}cAXXn_Ux~H2v1W*V=w?y zwR8O#i!hh%q;zm#bPSnLRh8Y~oBMLhwV9D=?{j)|{wjM1!lM z(F}zyQKSJrw7^a6w`N^6`CkP%10LRho4WIVE3mKy{BBkJ4mP5gHQWd_t_45DejxUP zDlW5 literal 0 HcmV?d00001 diff --git a/src/HYDROGUI/resources/icon_bc_polygon_type_3.png b/src/HYDROGUI/resources/icon_bc_polygon_type_3.png new file mode 100644 index 0000000000000000000000000000000000000000..4bb0549987acf2a4882e069a73bebbf3062201a0 GIT binary patch literal 546 zcmV+-0^R+IP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^MlX|MGF00ELoL_t(IPmPnWO9NpX#=l`o`ko5vZYGr$)718(`O*e)bN8RWSm1`S5EubdMas^51MnqIYtUY+r^f+zn}cR1Q1Fz&tp+@1y-@bl zGvt6r#X;3Ea@Gl$0TxD};sh+IXId1n1~@Z~X~-Cuorg9TP`Ctw$I}4fn|de>^_V53 zn>bK|on;0voY%Z&T>t<807*qoM6N<$g1GPFbpQYW literal 0 HcmV?d00001 diff --git a/src/HYDROGUI/resources/icon_bc_polygon_type_undef.png b/src/HYDROGUI/resources/icon_bc_polygon_type_undef.png new file mode 100644 index 0000000000000000000000000000000000000000..66b3daa9367bdc8c40b883a2daffae5b07a29b18 GIT binary patch literal 350 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33 zJwr2>%=KS^iq3huIEGmGubsS6@Q?wIYpg*}`(h8rnSFsq4qRMZ$2>h*pY(MZ|GzDC z!qWOj!z0y6YimwVdgR1md9HE;J9`0}u!JN3A0xZs2YCl|^``G^K3DhID1lGNMekVH zx?^@tXQLJ7`b<~P2;l9#soGfbeCw9%fD^$DtdE^E-%3@@oyWB1o6&-)6Pa>CGdH)s z)Mv7fckIsi{iieX-o}ocWbgmF{0g}(+>0mo>a%h33qGt^w)9hiVeUMi-z;Y|g!KYS pZMokWs@2Wm)>x_5yT7==|JXdvU2`4oHvxUd;OXk;vd$@?2>=Kce+mEq literal 0 HcmV?d00001 -- 2.39.2