Give V3d_view to the operation to calculate correctly a projection to sketch plane.
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationDescription.h>
#include <PartSet_Listener.h>
-#include <PartSet_Tools.h>
#include <ModuleBase_Operation.h>
myWorkshop->operationMgr()->currentOperation());
if (aPreviewOp)
{
- gp_Pnt aPnt = PartSet_Tools::ConvertClickToPoint(theEvent->pos(),
- myWorkshop->viewer()->activeView());
- aPreviewOp->mousePressed(aPnt, theEvent);
+ aPreviewOp->mousePressed(theEvent, myWorkshop->viewer()->activeView());
}
}
myWorkshop->operationMgr()->currentOperation());
if (aPreviewOp)
{
- gp_Pnt aPnt = PartSet_Tools::ConvertClickToPoint(theEvent->pos(),
- myWorkshop->viewer()->activeView());
- aPreviewOp->mouseReleased(aPnt, theEvent);
+ aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer()->activeView());
}
}
myWorkshop->operationMgr()->currentOperation());
if (aPreviewOp)
{
- gp_Pnt aPnt = PartSet_Tools::ConvertClickToPoint(theEvent->pos(),
- myWorkshop->viewer()->activeView());
- aPreviewOp->mouseMoved(aPnt, theEvent);
+ aPreviewOp->mouseMoved(theEvent, myWorkshop->viewer()->activeView());
}
}
#include <SketchPlugin_Line.h>
+#include <V3d_View.hxx>
+
#ifdef _DEBUG
#include <QDebug>
#endif
setFeature(theFeature);
}
-void PartSet_OperationEditLine::mousePressed(const gp_Pnt& thePoint, QMouseEvent* theEvent)
+void PartSet_OperationEditLine::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView)
{
if (!(theEvent->buttons() & Qt::LeftButton))
return;
- myCurPressed = thePoint;
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
+ myCurPressed = aPoint;
}
-void PartSet_OperationEditLine::mouseMoved(const gp_Pnt& thePoint, QMouseEvent* theEvent)
+void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
{
if (!(theEvent->buttons() & Qt::LeftButton))
return;
PartSet_Tools::ConvertTo2D(myCurPressed, mySketch, aCurX, aCurY);
double aX, anY;
- PartSet_Tools::ConvertTo2D(thePoint, mySketch, aX, anY);
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
+ PartSet_Tools::ConvertTo2D(aPoint, mySketch, aX, anY);
double aDeltaX = aX - aCurX;
double aDeltaY = anY - aCurY;
moveLinePoint(aDeltaX, aDeltaY, LINE_ATTR_START);
moveLinePoint(aDeltaX, aDeltaY, LINE_ATTR_END);
- myCurPressed = thePoint;
+ myCurPressed = aPoint;
}
void PartSet_OperationEditLine::setSelected(boost::shared_ptr<ModelAPI_Feature> theFeature,
/// Processes the mouse pressed in the point
/// \param thePoint a point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mousePressed(const gp_Pnt& thePoint, QMouseEvent* theEvent);
+ virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Gives the current mouse point in the viewer
/// \param thePoint a point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mouseMoved(const gp_Pnt& thePoint, QMouseEvent* theEvent);
+ virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Gives the current selected objects to be processed by the operation
/// \param theFeature the selected feature
#include <SketchPlugin_Feature.h>
+#include <V3d_View.hxx>
+
#ifdef _DEBUG
#include <QDebug>
#endif
emit featureConstructed(aFeature, FM_Activation);
return aFeature;
}
+
+
+void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView)
+{
+}
+void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView)
+{
+}
+void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+{
+}
#include <ModuleBase_Operation.h>
#include <QObject>
+class Handle_V3d_View;
class QMouseEvent;
-
class GeomAPI_Shape;
/*!
/// Processes the mouse pressed in the point
/// \param thePoint a point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mousePressed(const gp_Pnt& thePoint, QMouseEvent* theEvent) {};
+ virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Processes the mouse release in the point
/// \param thePoint a point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mouseReleased(const gp_Pnt& thePoint, QMouseEvent* theEvent) {};
+ virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Processes the mouse move in the point
/// \param thePoint a 3D point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mouseMoved(const gp_Pnt& thePoint, QMouseEvent* theEvent) {};
+ virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Processes the key pressed in the view
/// \param theKey a key value
#include <SketchPlugin_Line.h>
+#include <V3d_View.hxx>
+
#ifdef _DEBUG
#include <QDebug>
#endif
+#include <QMouseEvent>
+
using namespace std;
PartSet_OperationSketchLine::PartSet_OperationSketchLine(const QString& theId,
myInitPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
}
-void PartSet_OperationSketchLine::mouseReleased(const gp_Pnt& thePoint, QMouseEvent* /*theEvent*/)
+void PartSet_OperationSketchLine::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView)
{
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
switch (myPointSelectionMode)
{
case SM_FirstPoint: {
- setLinePoint(thePoint, LINE_ATTR_START);
+ setLinePoint(aPoint, LINE_ATTR_START);
myPointSelectionMode = SM_SecondPoint;
}
break;
case SM_SecondPoint: {
- setLinePoint(thePoint, LINE_ATTR_END);
+ setLinePoint(aPoint, LINE_ATTR_END);
commit();
emit featureConstructed(feature(), FM_Deactivation);
emit launchOperation(PartSet_OperationSketchLine::Type(), feature());
}
}
-void PartSet_OperationSketchLine::mouseMoved(const gp_Pnt& thePoint, QMouseEvent* /*theEvent*/)
+void PartSet_OperationSketchLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
{
switch (myPointSelectionMode)
{
case SM_SecondPoint:
- setLinePoint(thePoint, LINE_ATTR_END);
- break;
+ {
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
+ setLinePoint(aPoint, LINE_ATTR_END);
+ }
+ break;
default:
break;
}
/// Gives the current selected objects to be processed by the operation
/// \param thePoint a point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mouseReleased(const gp_Pnt& thePoint, QMouseEvent* theEvent);
+ virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Gives the current mouse point in the viewer
/// \param thePoint a point clicked in the viewer
/// \param theEvent the mouse event
- virtual void mouseMoved(const gp_Pnt& thePoint, QMouseEvent* theEvent);
+ virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
/// Processes the key pressed in the view
/// \param theKey a key value
virtual void keyReleased(const int theKey);