Salome HOME
Merge branch 'BR_H2018_2' of https://codev-tuleap.cea.fr/plugins/git/salome/hydro...
[modules/hydro.git] / src / HYDROData / HYDROData_SplitToZonesTool.h
index 28413ef7ca122a4c7e41129b142efbcb3a4fba9d..b4e092eb87402a0704d875eba352d34f29ab248c 100644 (file)
@@ -1,14 +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 HYDROData_SplitToZonesTool_H
 #define HYDROData_SplitToZonesTool_H
 
-#include <HYDROData_Object.h>
+#ifdef WIN32
+  #pragma warning ( disable: 4251 )
+#endif
 
+#include <HYDROData_Object.h>
+#include <HYDROData_Transform.h>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Compound.hxx>
 #include <TopoDS_Face.hxx>
-
+#include <TopTools_ShapeMapHasher.hxx>
+#include <NCollection_IndexedMap.hxx>
+#include <TopTools_IndexedDataMapOfShapeShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
 #include <QStringList>
+#include <NCollection_DataMap.hxx>
 
-class Handle(HYDROData_PolylineXY);
+class HYDROData_PolylineXY;
 
 /**
  * \class HYDROData_SplitToZonesTool
@@ -24,7 +52,8 @@ public:
     {
       Data_None,
       Data_Zone,
-      Data_Edge
+      Data_Edge,
+      Data_IntEdge
     };
 
     TopoDS_Shape    Shape;
@@ -48,24 +77,53 @@ public:
   };
 
   typedef QList        <SplitData> SplitDataList;
-  typedef QListIterator<SplitData> SplitDataListIterator;
+  typedef QListIterator<SplitData> SplitDataListIterator;  
+  typedef NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
+  typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
+  typedef NCollection_IndexedDataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
+  typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
+  typedef NCollection_IndexedDataMap<TopoDS_Shape,  QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
+  typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
+  #undef _NCollection_MapHasher
 
 public:
 
   static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList,
                                     const HYDROData_SequenceOfObjects&  theGroupsList,
-                                    const Handle(HYDROData_PolylineXY)& thePolyline );
+                                    const Handle(HYDROData_PolylineXY)& thePolyline,
+                                    const HYDROData_SequenceOfObjects& InterPolys );
 
-private:
+  static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList );
+
+  static void AddInternalEdges(HYDROData_DataMapOfShapeListOfShape& DM,
+                               const HYDROData_SequenceOfObjects& thePolylines,
+                               NCollection_DataMap<TopoDS_Shape, Handle(HYDROData_PolylineXY), TopTools_ShapeMapHasher>* OutNE);
 
-  static bool                SplitTwoData( const SplitData& theData1,
-                                           const SplitData& theData2,
-                                           SplitData& theData1Subtracted,
-                                           SplitData& theData2Subtracted,
-                                           SplitData& theDataIntersected );
+  static void CutFaceByEdges(const TopoDS_Face& in, 
+                             TopTools_ListOfShape& out, 
+                             const HYDROData_SequenceOfObjects& thePolylines,
+                             NCollection_DataMap<TopoDS_Shape, Handle(HYDROData_PolylineXY), TopTools_ShapeMapHasher>* OutNE,
+                             TopTools_IndexedDataMapOfShapeListOfShape* OutOrSh2M);
 
-  static SplitDataList       ExtractSeparateData( const SplitData& theData );
+  static int CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW,
+                        TopTools_ListOfShape& outShs,
+                        bool OutShapeAsRes,
+                        TopTools_IndexedDataMapOfShapeShape* OutNE2OE,
+                        TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH);
 
+  static void SetFileNames(const QString& theNameBefore, const QString& theNameAfter);
+
+private:
+
+  /**
+   * Split input faces.
+   */
+  static bool SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool);
 };
 
+#ifdef WIN32
+  #pragma warning ( default: 4251 )
+#endif
+
+
 #endif