#include <HYDROData_Tool.h>
#include <HYDROData_BCPolygon.h>
#include <HYDROData_BoundaryPolygonTools.h>
+#include <HYDROData_SplitToZonesTool.h>
#ifdef WIN32
#pragma warning ( disable: 4251 )
static void SplitEdgesByBoundaryPolygons( const HYDROData_SplitToZonesTool::SplitDataList& anEdgesList,
const HYDROData_SequenceOfObjects& aBoundaryPolygons,
- NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape>& ObjToRes)
+ NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>& ObjToRes,
+ HYDROData_SplitToZonesTool::SplitDataList& outBoundaryPolygonEdgesList)
{
//perform boundary condition polygons on EdgesList
TopTools_SequenceOfShape CutTools;
+ NCollection_DataMap<TopoDS_Shape, QString, TopTools_ShapeMapHasher> BPolyToName;
+
ObjToRes.Clear();
HYDROData_SplitToZonesTool::SplitDataListIterator anIter(anEdgesList);
for (int i=1; i<=aBoundaryPolygons.Size();i++)
TopoDS_Shape aPolyTopShape = aBCPoly->GetTopShape();
int bType = aBCPoly->GetBoundaryType();
if (bType == 1)
+ {
CutTools.Append(aPolyTopShape);
+ QString bp_name = aBCPoly->GetName();
+ BPolyToName.Bind(aPolyTopShape, bp_name);
+ }
}
while( anIter.hasNext() )
ObjToRes.Add(aSplitData.Shape, TopoDS_Shape());
}
- HYDROData_BoundaryPolygonTools::CutTool(CutTools, ObjToRes);
+ NCollection_IndexedDataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> BPFaceToCutEdges;
+ HYDROData_BoundaryPolygonTools::CutTool(CutTools, ObjToRes, BPFaceToCutEdges);
+ //
+ for (int i = 1; i <= CutTools.Length(); i++ )
+ {
+ TopoDS_Shape F = CutTools(i);
+ const QString* name = BPolyToName.Seek(F);
+ const TopTools_MapOfShape* EdgesIn = BPFaceToCutEdges.Seek(F); // EdgesIn : edges inside boudnary polygon F
+ if (name && EdgesIn)
+ {
+ TopTools_MapIteratorOfMapOfShape it(*EdgesIn);
+ for (;it.More();it.Next())
+ {
+ TopoDS_Edge E = TopoDS::Edge(it.Value());
+ if (!E.IsNull())
+ {
+ HYDROData_SplitToZonesTool::SplitData SD(HYDROData_SplitToZonesTool::SplitData::Data_Edge, E, *name);
+ outBoundaryPolygonEdgesList.append(SD);
+ }
+ }
+ }
+ }
}
static void PerformEdgeReplInZones(const HYDROData_SplitToZonesTool::SplitDataList& ZoneList,
- const NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape>& ObjToRes,
+ const NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>& ObjToRes,
HYDROData_SplitToZonesTool::SplitDataList& outZoneList)
{
HYDROData_SplitToZonesTool::SplitDataListIterator it( ZoneList );
{
TopoDS_Shape K = ObjToRes.FindKey(i);
TopoDS_Shape V = ObjToRes.FindFromIndex(i);
+ if (V.IsNull())
+ continue;
if (V.ShapeType() != TopAbs_EDGE && V.ShapeType() != TopAbs_WIRE && V.ShapeType() != TopAbs_COMPOUND)
continue;
if (V.ShapeType() == TopAbs_COMPOUND)
}
static void CreateNewEdgeList( const HYDROData_SplitToZonesTool::SplitDataList& theEdges,
- const NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape>& ObjToRes,
+ const NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>& ObjToRes,
HYDROData_SplitToZonesTool::SplitDataList& newEdges)
{
HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theEdges );
//split edges by boundary polygons
HYDROData_SequenceOfObjects aBoundaryPolygons = GetBoundaryPolygons();
//edge to splitted edge (compound of edges or original edge)
- NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape> ObjToRes;
+ NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> ObjToRes;
//split edge list by BP
- SplitEdgesByBoundaryPolygons(anEdgesList, aBoundaryPolygons, ObjToRes);
+ HYDROData_SplitToZonesTool::SplitDataList outBoundaryPolygonEdgesList; //new groups - for each BP of type 1 (cut) create a group of edges which are inside of this BP
+ SplitEdgesByBoundaryPolygons(anEdgesList, aBoundaryPolygons, ObjToRes, outBoundaryPolygonEdgesList);
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);
+ //
+ newEdgesList1.append(outBoundaryPolygonEdgesList); //append new list of groups
//filter out edges list by include&selection tools
FilterEdgesByIncludeSelectionBoundaryPolygons(newEdgesList1,aBoundaryPolygons,newEdgesList2);
else
{
DEBTRACE("aZoneInterpolator == NULL");
- aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+ aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint, theMethod );
}
}
}