From: isn Date: Thu, 26 Nov 2015 11:54:21 +0000 (+0300) Subject: refs #745 X-Git-Tag: v1.5~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4bb3a00b500407823acf36c46d868ef0e5ae3a1c;p=modules%2Fhydro.git refs #745 --- diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 51ca1b02..5f48cb2a 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -376,6 +376,8 @@ void HYDROData_ShapeFile::ReadSHPPolygon(SHPObject* anObj, int i, TopoDS_Face& F BRep_Builder BB; BB.MakeFace(F); + NCollection_Sequence > allEdges; + TopTools_SequenceOfShape aWires; for ( int i = 0 ; i < nParts ; i++ ) { @@ -386,9 +388,8 @@ void HYDROData_ShapeFile::ReadSHPPolygon(SHPObject* anObj, int i, TopoDS_Face& F EndIndex = anObj->panPartStart[i + 1]; else EndIndex = anObj->nVertices; - - TopoDS_Wire W; - BB.MakeWire(W); + + NCollection_Sequence EPerW; //First point is same as the last point int NbPnts = EndIndex - StartIndex - 1; @@ -416,11 +417,32 @@ void HYDROData_ShapeFile::ReadSHPPolygon(SHPObject* anObj, int i, TopoDS_Face& F E = BRepLib_MakeEdge(aTC, VPoints.First(), VPoints.Value(VPoints.Upper() - 1)).Edge(); //Add edge to wire //If SHP file is correct then the outer wire and the holes will have the correct orientations - BB.Add(W, E); + + EPerW.Append(E); } - //Wire must be closed anyway - W.Closed (BRep_Tool::IsClosed (W)); + allEdges.Append(EPerW); + } + + for (int i = 1; i <= allEdges.Size(); i++) + { + TopoDS_Wire W; + BB.MakeWire(W); + for (int j = 1; j <= allEdges(i).Size(); j++) + BB.Add(W, allEdges(i)(j)); + W.Closed (Standard_True); W.Orientation(TopAbs_FORWARD); + //check on the dummy face first + TopoDS_Face DF; + BB.MakeFace(DF); + BB.Add(DF, W); + BB.UpdateFace(DF, aPlaneSur, TopLoc_Location(), Precision::Confusion()); + // + BRepTopAdaptor_FClass2d FClass(DF, Precision::PConfusion()); + if ( i == 1 && FClass.PerformInfinitePoint() != TopAbs_OUT) + W.Reverse(); + if ( i > 1 && FClass.PerformInfinitePoint() != TopAbs_IN) + W.Reverse(); + // BB.Add(F, W); } diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png index e4ff0803..4f6daf9a 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png differ