Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchBase.cpp
index 4113c3cba83fbab23eed59174fbd7e08d98cb4a3..997a96b1217e16b3d1e5dd55e0b530e7b589eac8 100644 (file)
@@ -5,6 +5,7 @@
 #include <PartSet_OperationSketchBase.h>
 
 #include <SketchPlugin_Feature.h>
+#include <ModelAPI_Object.h>
 
 #include <V3d_View.hxx>
 
@@ -29,9 +30,28 @@ boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
 {
   boost::shared_ptr<SketchPlugin_Feature> aFeature = 
                               boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
+  if (!aFeature) { // if it is reference to a object feature
+    boost::shared_ptr<ModelAPI_Object> anObj = 
+      boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
+    if (anObj) 
+      aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(anObj->featureRef());
+  }
   return aFeature->preview();
 }
 
+std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
+                                                     PartSet_OperationSketchBase::preview() const
+{
+  return std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >();
+}
+
+std::list<int> PartSet_OperationSketchBase::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+{
+  std::list<int> aModes;
+  aModes.push_back(TopAbs_VERTEX);
+  aModes.push_back(TopAbs_EDGE);
+  return aModes;
+}
 boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature()
 {
   boost::shared_ptr<ModelAPI_Feature> aFeature = ModuleBase_Operation::createFeature();
@@ -40,14 +60,14 @@ boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature()
 }
 
 
-void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView)
+void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
+                                               const std::list<XGUI_ViewerPrs>& theSelected)
 {
 }
 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
                                                 const std::list<XGUI_ViewerPrs>& theSelected)
 {
 }
-void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<XGUI_ViewerPrs>& theSelected)
+void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
 {
 }