Salome HOME
GetStricklerCoefficientForPoints() py wrapper p.2
[modules/hydro.git] / src / HYDROData / HYDROData_LCM_FaceClassifier.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDRODATA_LCM_FACECLASSIFIER_H
20 #define HYDRODATA_LCM_FACECLASSIFIER_H
21
22 #include <HYDROData.h>
23 #include <vector>
24 #include <set>
25 #include <QString>
26
27 #include "Bnd_Box2d.hxx" 
28 #include <NCollection_UBTree.hxx>
29 #include <NCollection_List.hxx>
30 #include <NCollection_IndexedDataMap.hxx>
31 #include <TopoDS_Face.hxx>
32 #include <NCollection_Map.hxx>
33
34 class BRepTopAdaptor_FClass2d;
35 class HYDROData_LandCoverMap;
36
37 typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HYDROData_FaceClassifier_BndBoxTree;
38
39 class HYDROData_FaceClassifier_BndBoxTreeSelector : public HYDROData_FaceClassifier_BndBoxTree::Selector
40 {
41 public:
42   HYDROData_FaceClassifier_BndBoxTreeSelector(const NCollection_IndexedDataMap<TopoDS_Face, BRepTopAdaptor_FClass2d*>& theMapOfShape)
43     : HYDROData_FaceClassifier_BndBoxTreeSelector::Selector(), myMapF2Class2d (theMapOfShape)
44   {}
45
46   Standard_Boolean Reject (const Bnd_Box2d& theBox) const
47   {
48     return (theBox.IsOut (myP));
49   }
50
51   Standard_Boolean Accept (const Standard_Integer& theObj);
52
53   const NCollection_List<TopoDS_Face>& GetResFaces () const 
54   { 
55     return myResFaces;
56   }
57
58   const TopoDS_Face& GetFirstFace() const 
59   { 
60     if (!myResFaces.IsEmpty())
61       return myResFaces.First();
62     else
63       TopoDS_Face();
64   }
65
66   void SetCurrentPoint (const gp_Pnt2d& theP) 
67   { 
68     myP = theP;
69   }
70
71 private:
72   HYDROData_FaceClassifier_BndBoxTreeSelector(const HYDROData_FaceClassifier_BndBoxTreeSelector& );
73   HYDROData_FaceClassifier_BndBoxTreeSelector& operator=(const HYDROData_FaceClassifier_BndBoxTreeSelector& );
74
75 private:
76   const NCollection_IndexedDataMap<TopoDS_Face, BRepTopAdaptor_FClass2d*>& myMapF2Class2d;
77   gp_Pnt2d myP;
78   NCollection_List<TopoDS_Face> myResFaces;
79 };
80
81 class HYDRODATA_EXPORT HYDROData_LCM_FaceClassifier
82 {
83
84 public:
85
86   HYDROData_LCM_FaceClassifier(const HYDROData_LandCoverMap* const theLCM) : myLCM(theLCM)
87   {};
88
89   ~HYDROData_LCM_FaceClassifier()
90   {};
91
92   void Classify( const std::vector<gp_XY>& thePoints, 
93     std::vector<std::set <QString> >& theTypes, 
94     std::vector<NCollection_Map <TopoDS_Face> >* theFaces) const;
95
96
97 private:
98   const HYDROData_LandCoverMap* const myLCM;
99
100 };
101
102
103 #endif