Salome HOME
Fix Warning in NewGeom_Module.cpp
[modules/shaper.git] / src / ModuleBase / ModuleBase_ResultPrs.cpp
old mode 100644 (file)
new mode 100755 (executable)
index eb022a2..73a492d
@@ -5,21 +5,23 @@
 // Author:      Vitaly SMETANNIKOV
 
 #include "ModuleBase_ResultPrs.h"
+#include "ModuleBase_Tools.h"
 
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <GeomAPI_PlanarEdges.h>
 
 #include <BRep_Builder.hxx>
-#include <AIS_Drawer.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_PointAspect.hxx>
 #include <Prs3d_IsoAspect.hxx>
 #include <TopoDS_Builder.hxx>
 
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_ResultPrs, AIS_Shape);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, AIS_Shape);
+IMPLEMENT_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape);
+IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape);
 
 ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
-  : AIS_Shape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false)
+  : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false)
 {
   std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
   std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = 
@@ -31,7 +33,13 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
       myIsSketchMode = true;
     }
   }
-  Set(aShapePtr->impl<TopoDS_Shape>());
+  TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+  Set(aShape);
+  Handle(Prs3d_Drawer) aDrawer = Attributes();
+  if (aDrawer->HasOwnPointAspect()) 
+    aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
+  else
+    aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
 }
 
 
@@ -56,6 +64,9 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
   myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
   if (!myOriginalShape.IsNull()) {
     Set(myOriginalShape);
+
+    // change deviation coefficient to provide more precise circle
+    ModuleBase_Tools::setDefaultDeviationCoefficient(myOriginalShape, Attributes());
     AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
   }
 }
@@ -64,6 +75,10 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
 void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                             const Standard_Integer aMode)
 {
+  if (aMode > TopAbs_SHAPE)
+    // In order to avoid using custom selection modes
+    return;
+
   if (myIsSketchMode) {
     if (aMode == TopAbs_FACE) {
       BRep_Builder aBuilder;