]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
It is a filters implementation to be set in the XML file.
authornds <natalia.donis@opencascade.com>
Wed, 10 Dec 2014 11:24:17 +0000 (14:24 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 10 Dec 2014 11:24:17 +0000 (14:24 +0300)
Check for a linear edge selection

src/ModuleBase/ModuleBase_FilterLinearEdge.cpp

index 76712c0a7607996bdc75aef0991f166b21be11e1..b101cdbf427ac38491074b76946815765b666f79 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <StdSelect_BRepOwner.hxx>
 
+#include <GeomAPI_Edge.h>
+
 #include <BRep_Tool.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
@@ -29,21 +31,19 @@ Standard_Boolean ModuleBase_FilterLinearEdge::IsOk(const Handle(SelectMgr_Entity
 {
   Standard_Boolean isOk = ModuleBase_Filter::IsOk(theOwner);
   if (isOk && theOwner->HasSelectable()) {
-    Handle(AIS_InteractiveObject) aAisObj = 
+    Handle(AIS_InteractiveObject) anAIS = 
       Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
-    if (!aAisObj.IsNull()) {
-      std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
-      aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
-      //ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
-
-
-      /*foreach (QString aType, myTypes) {
-        if (aType.toLower() == "construction") {
-          ResultConstructionPtr aConstr = 
-            std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
-          return (aConstr != NULL);
-        } // ToDo: Process other types of objects
-      }*/
+    if (!anAIS.IsNull()) {
+      Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
+      if (aShapeAIS) {
+        const TopoDS_Shape& aShape = aShapeAIS->Shape();
+        if (aShape.ShapeType()  == TopAbs_EDGE) {
+          std::shared_ptr<GeomAPI_Edge> anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge());
+          anEdge->setImpl(new TopoDS_Shape(aShape));
+
+          isOk = anEdge->isLine();
+        }
+      }
     }
   }
   return Standard_False;