1 // File: ModuleBase_FilterLinearEdge.cpp
2 // Created: 10 Dec 2014
3 // Author: Natalia ERMOLAEVA
6 #include "ModuleBase_FilterLinearEdge.h"
7 #include "ModuleBase_IWorkshop.h"
9 #include <ModelAPI_Session.h>
10 #include <ModelAPI_Document.h>
11 #include <ModelAPI_ResultConstruction.h>
13 #include <AIS_InteractiveObject.hxx>
14 #include <AIS_Shape.hxx>
16 #include <StdSelect_BRepOwner.hxx>
18 #include <GeomAPI_Edge.h>
20 #include <BRep_Tool.hxx>
22 #include <TopoDS_Edge.hxx>
23 #include <Geom_Curve.hxx>
26 IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterLinearEdge, SelectMgr_Filter);
27 IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterLinearEdge, SelectMgr_Filter);
30 Standard_Boolean ModuleBase_FilterLinearEdge::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
32 Standard_Boolean isOk = ModuleBase_Filter::IsOk(theOwner);
33 if (isOk && theOwner->HasSelectable()) {
34 Handle(AIS_InteractiveObject) anAIS =
35 Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
36 if (!anAIS.IsNull()) {
37 Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
39 const TopoDS_Shape& aShape = aShapeAIS->Shape();
40 if (aShape.ShapeType() == TopAbs_EDGE) {
41 std::shared_ptr<GeomAPI_Edge> anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge());
42 anEdge->setImpl(new TopoDS_Shape(aShape));
44 isOk = anEdge->isLine();
49 return Standard_False;