1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_FilterLinearEdge.cpp
4 // Created: 10 Dec 2014
5 // Author: Natalia ERMOLAEVA
8 #include "ModuleBase_FilterLinearEdge.h"
9 #include "ModuleBase_IWorkshop.h"
11 #include <ModelAPI_Session.h>
12 #include <ModelAPI_Document.h>
13 #include <ModelAPI_ResultConstruction.h>
15 #include <AIS_InteractiveObject.hxx>
16 #include <AIS_Shape.hxx>
18 #include <StdSelect_BRepOwner.hxx>
20 #include <GeomAPI_Edge.h>
22 #include <BRep_Tool.hxx>
24 #include <TopoDS_Edge.hxx>
25 #include <Geom_Curve.hxx>
28 IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterLinearEdge, SelectMgr_Filter);
29 IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterLinearEdge, SelectMgr_Filter);
32 Standard_Boolean ModuleBase_FilterLinearEdge::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
34 Standard_Boolean isOk = ModuleBase_Filter::IsOk(theOwner);
35 if (isOk && theOwner->HasSelectable()) {
36 Handle(AIS_InteractiveObject) anAIS =
37 Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
38 if (!anAIS.IsNull()) {
39 Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
41 const TopoDS_Shape& aShape = aShapeAIS->Shape();
42 if (aShape.ShapeType() == TopAbs_EDGE) {
43 std::shared_ptr<GeomAPI_Edge> anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge());
44 anEdge->setImpl(new TopoDS_Shape(aShape));
46 isOk = anEdge->isLine();
51 return Standard_False;