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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDRODATA_LCM_FACECLASSIFIER_H
20 #define HYDRODATA_LCM_FACECLASSIFIER_H
22 #include <HYDROData.h>
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>
34 class BRepTopAdaptor_FClass2d;
35 class HYDROData_LandCoverMap;
36 class Handle(Geom_Plane);
38 typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HYDROData_FaceClassifier_BndBoxTree;
40 class HYDROData_FaceClassifier_BndBoxTreeSelector : public HYDROData_FaceClassifier_BndBoxTree::Selector
43 HYDROData_FaceClassifier_BndBoxTreeSelector(const NCollection_IndexedDataMap<TopoDS_Face, BRepTopAdaptor_FClass2d*>& theMapOfShape)
44 : HYDROData_FaceClassifier_BndBoxTreeSelector::Selector(), myMapF2Class2d (theMapOfShape)
47 Standard_Boolean Reject (const Bnd_Box2d& theBox) const
49 return (theBox.IsOut (myP));
52 Standard_Boolean Accept (const Standard_Integer& theObj);
54 const NCollection_List<TopoDS_Face>& GetResFaces () const
59 const TopoDS_Face& GetFirstFace() const
61 if (!myResFaces.IsEmpty())
62 return myResFaces.First();
67 void SetCurrentPoint (const gp_Pnt2d& theP)
73 HYDROData_FaceClassifier_BndBoxTreeSelector(const HYDROData_FaceClassifier_BndBoxTreeSelector& );
74 HYDROData_FaceClassifier_BndBoxTreeSelector& operator=(const HYDROData_FaceClassifier_BndBoxTreeSelector& );
77 const NCollection_IndexedDataMap<TopoDS_Face, BRepTopAdaptor_FClass2d*>& myMapF2Class2d;
79 NCollection_List<TopoDS_Face> myResFaces;
82 class HYDRODATA_EXPORT HYDROData_LCM_FaceClassifier
87 HYDROData_LCM_FaceClassifier(const HYDROData_LandCoverMap* const theLCM) : myLCM(theLCM)
90 ~HYDROData_LCM_FaceClassifier()
93 void Classify( const std::vector<gp_XY>& thePoints,
94 std::vector<std::set <QString> >& theTypes,
95 std::vector<NCollection_Map <TopoDS_Face> >* theFaces) const;
97 static Handle(Geom_Plane) GetPlane(const TopoDS_Face& F);
101 const HYDROData_LandCoverMap* const myLCM;