if(f.IsNull())
return Standard_False;
- BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
-
- TopLoc_Location L;
- Handle(Geom_Surface) C = BRep_Tool::Surface(f, L);
- Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(C->Transformed(L.Transformation()));
+ BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
+
+ Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(f);
Standard_Real u, v;
ElSLib::Parameters(Pl->Pln(), gp_Pnt(myP.X(), myP.Y(), 0.0), u, v);
}
+Handle(Geom_Plane) HYDROData_LCM_FaceClassifier::GetPlane(const TopoDS_Face& F)
+{
+ TopLoc_Location L;
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F, L);
+ Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(S->Transformed(L.Transformation()));
+ return Pl;
+}
+
void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints,
std::vector<std::set <QString> >& theTypes,
std::vector<NCollection_Map<TopoDS_Face> >* theFaces) const
Bnd_Box2d B;
const TopoDS_Face& F = TopoDS::Face(aFaces(i));
BRepTools::AddUVBounds(F, B);
- aTreeFiller.Add(i, B);
+
+ //convert 2d space of planar face to the 3d space of given points
+ //this is more faster way then getting of bnd3d of faces and project them on plane...
+ Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(F);
+ gp_Trsf RT;
+ RT.SetTransformation(Pl->Position());
+ RT.Invert();
+ double xmin, ymin, xmax, ymax;
+ B.Get(xmin, ymin, xmax, ymax);
+ gp_Pnt MinP(xmin, ymin, 0), MaxP(xmax, ymax, 0);
+ MinP.Transform(RT);
+ MaxP.Transform(RT);
+ gp_Pnt2d MinPT(MinP.X(), MinP.Y());
+ gp_Pnt2d MaxPT(MaxP.X(), MaxP.Y());
+ Bnd_Box2d NB;
+ NB.Update(MinPT.X(), MinPT.Y(), MaxPT.X(), MaxPT.Y() );
+
+ aTreeFiller.Add(i, NB);
BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 0 );
aMapF2Class2d.Add(F, aClass2d);
fclass2dpointers.push_back(aClass2d);
class BRepTopAdaptor_FClass2d;
class HYDROData_LandCoverMap;
+class Handle(Geom_Plane);
typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HYDROData_FaceClassifier_BndBoxTree;
std::vector<std::set <QString> >& theTypes,
std::vector<NCollection_Map <TopoDS_Face> >* theFaces) const;
+ static Handle(Geom_Plane) GetPlane(const TopoDS_Face& F);
+
private:
const HYDROData_LandCoverMap* const myLCM;