cherish
|
An OpenSceneGraph events that were passed from Qt's interface - GLWidget. Event handler is where all the mouse events are processed. Examples: sketching, canvas position editing, polygon drawing, deletion of entities. The EventHandler, after the mouse info extracted, then sends according signals to the UserScene, which, in turn, register the scene changed through the undo/redo commands. Note, some of the keyboard event are processed through the GLWidget and are not passed to the event handler. However, all the mouses events are meant to be passed and processed to the EventHandler. More...
#include <EventHandler.h>
Public Member Functions | |
EventHandler (GLWidget *widget, RootScene *scene, cher::MOUSE_MODE mode=cher::SELECT_ENTITY) | |
virtual bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | setMode (cher::MOUSE_MODE mode) |
cher::MOUSE_MODE | getMode () const |
Protected Member Functions | |
void | doEraseStroke (entity::Stroke *stroke, int first, int last, cher::EVENT event=cher::EVENT_DRAGGED) |
void | doSelectEntity (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
template<typename T1 , typename T2 > | |
void | doSelectCanvas (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doSketch (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doSketchPolygon (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doSketchLineSegment (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doDeleteEntity (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doEditCanvas (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doEditCanvasOffset (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doEditCanvasRotate (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Vec3f alongAxis, osg::Vec3f rotAxis) |
void | doCanvasClone (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doCanvasSeparate (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
template<typename T1 , typename T2 > | |
void | doEditPhotoPush (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doEditEntitiesMove (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doEditEntitiesScale (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doEditEntitiesRotate (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doIdleMouse (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doHoverWire (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doHoverPoint (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doDragPoint (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doCameraEye (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doCameraCenter (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doCameraFocal (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doPhotoScaleModelPlane (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | doPhotoScaleBookmark (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
entity::Stroke * | getStroke (const StrokeIntersector::Intersection &result) |
template<typename EntityType > | |
EntityType * | getEntity2D (const Entity2DIntersector< entity::Entity2D >::Intersection &result) |
entity::Canvas * | getCanvas (const osgUtil::LineSegmentIntersector::Intersection &result) |
entity::Photo * | getPhoto (const osgUtil::LineSegmentIntersector::Intersection &result) |
entity::Polygon * | getPolygon (const osgUtil::LineSegmentIntersector::Intersection &result) |
entity::DraggableWire * | getDraggableWire (const PolyLineIntersector::Intersection &result) |
entity::BookmarkTool * | getBookmarkTool (const PolyLineIntersector::Intersection &result) |
int | getSelectedPoint (const PointIntersector::Intersection &result) |
template<typename T > | |
cher::MOUSE_MODE | getMouseModeFromName (const T &result, cher::MOUSE_MODE mode_default) const |
cher::MOUSE_MODE | getMouseModeFromEvent (cher::MOUSE_MODE mode, const osgGA::GUIEventAdapter &ea) |
template<typename TypeIntersection , typename TypeIntersector > | |
bool | getIntersection (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, unsigned int mask, TypeIntersection &resultIntersection) |
bool | getRaytraceCanvasIntersection (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, double &u, double &v) |
bool | getRaytraceNormalProjection (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Vec3f &XC) |
bool | getRaytracePlaneIntersection (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Vec3f &axis, osg::Vec3f &P) |
template<typename TResult , typename TIntersector > | |
bool | setCanvasMouseMode (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, cher::MOUSE_MODE modeDefault, bool selected=true) |
template<typename TResult , typename TIntersector > | |
std::tuple< bool, TResult > | setSVMMouseMode (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, cher::MOUSE_MODE modeDefault) |
void | setDrawableColorFromMode (osg::Drawable *draw) |
void | updateWireGeometry (const PolyLineIntersector::Intersection &intersection) |
void | updatePointGeometry (const PointIntersector::Intersection &intersection) |
void | updateDragPointGeometry (const std::tuple< double, double, bool > &intersection, const osgGA::GUIEventAdapter &ea) |
void | finishAll () |
Protected Attributes | |
GLWidget * | m_glWidget |
cher::MOUSE_MODE | m_mode |
osg::observer_ptr< RootScene > | m_scene |
osg::observer_ptr< entity::DraggableWire > | m_selection |
osg::observer_ptr< entity::EditableWire > | m_selection2 |
osg::observer_ptr< entity::BookmarkTool > | m_tool |
An OpenSceneGraph events that were passed from Qt's interface - GLWidget. Event handler is where all the mouse events are processed. Examples: sketching, canvas position editing, polygon drawing, deletion of entities. The EventHandler, after the mouse info extracted, then sends according signals to the UserScene, which, in turn, register the scene changed through the undo/redo commands. Note, some of the keyboard event are processed through the GLWidget and are not passed to the event handler. However, all the mouses events are meant to be passed and processed to the EventHandler.
|
protected |
A method for setting up camera center position when editing entity::CamPoseData
|
protected |
A method for setting up camera eye position when editing entity::CamPoseData
|
protected |
A method for setting up camera focal size when editing entity::CamPoseData
|
protected |
A method to create a new canvas by clonning operation. The clonning is done by dragging and locating the new position along a canvas normal. The cloned content does not include entity::Photo.
|
protected |
A method to create a new canvas which has the same rotation matrix as the original, but in contrary to the clonning operation, it does not copy any canvas content.
|
protected |
A method to delete an entity from a current canvas by performing a drag within the entity's proximity.
|
protected |
A method for point dragging related to entity::SVMData. VirtualPlaneIntersector is used.
|
protected |
A method to perform canvas editing: offset or rotation.
|
protected |
A sub-method for canvas editing to perform offset.
|
protected |
A method to move a set of entities within a canvas.
|
protected |
A method to rotate a set of entities within a canvas.
|
protected |
A method to scale a set of entities within a canvas.
|
protected |
This method is in developemt.
|
protected |
This method must not used. It is in development.
|
protected |
A method for point hovering over entity::SVMData. PointIntersector is used.
|
protected |
A method for hover mode over entity::SVMData. PolyLineIntersector and PointIntersector are used.
|
protected |
A method to chose a bookmark tool from 3D scene or bookmark widget.
|
protected |
A method that suggests a user to select a plane where model is located. (Photo re-scale procedure).
|
protected |
A method to perform canvas selection by using their pickables.
|
protected |
A method to perform a selection of an entity or a group of entities within a current canvas.
|
protected |
Method to process events for stroke sketching: left button push indicates beginning of a stroke, and left button release indicates an end of the stroke.
|
protected |
Method to process events for line segment drawing.
|
protected |
Method to process events for polygon drawing: left mouse click indicates a new point, right mouse click or double click indicates polygon completion.
|
protected |
A method which is called whenever it is necessary to shut the current mode's operation. E.g., for sketching, it would mean forcing a mouse release imitation and completion of a current stroke. This might be necessary for various reasons. The most common one is when the raytracer cannot obtain a 3D intersection with a virtual plane because the current camera view is located too sharp towards the canvas plane where the sketching is going on. Most of the modes that rely on mouse click - drag - release, most likely use this method.
|
protected |
A method to obtain bookmark tool from intersection result.
|
protected |
A method to obtain entity::Canvas type from intersection result.
|
protected |
A method to obtain entity::DraggableWire type from intersection result.
|
protected |
A template method to obtain intersection given an intersector type as a template.
mask | is used when only certain parts of scene graph should be taken into account by an intersector. For example, when doing a selection of geometries within a canvas, all the other canvas geometries are excluded from the intersector search. |
resultIntersection | is the intersection result. |
|
protected |
A method to update a provided mouse mode based on the current mouse event. Normally, it is used to determine whether a drag event is happening or not.
mode | is the input mouse mode |
|
protected |
A method to update a mouse mode based on type of geometry caught in an intersection. This method is mainly used when we deal with a entity::SelectedGroup within a canvas. I.e., a group of geomtries that were selected by a user, and that group is now modifyable by methods of rotation within the canvas, scaling within the canvas, moving within the canvas, etc.
result | is the intersection result, e.g. frame for scaling or geometry for rotation, etc. |
mode_default | is the default mode which is returned in case if the intersection results do not contain any known componenents, or if they are empty. |
|
protected |
A method to obtain entity::Photo type from intersection result.
|
protected |
A method to obtain entity::Polygon type from intersection result.
|
protected |
A convinience method to calculate intersection point between a raytrace and a current canvas virtual plane. The result intersection is returned in canvas local coordinates. As an example, this method is used for sketching on a entity::Canvas surface. The result intersection point (u, v) is passed to a entity::UserScene::addStroke() in order to draw a stroke.
u | is the result local U coordinate, |
v | is the result local V coordinate. |
|
protected |
A convinience method to obtain a 3D point-intersection between a raytrace and a canvas' normal.
XC | is the returned 3D point |
|
protected |
A convinience method to obtain a 3D intersection between a raycast and a plane which passes through a given axis. The center of a plane is considered to be a 3D center of a current canvas.
axis | is a vector through which the plane passes. |
P | is the returned 3D location. |
|
protected |
A method to obtain a selected point index of an entity::DraggableWire type from intersection result.
|
protected |
A method to obtain entity::Stroke type from intersection result.
|
virtual |
A method that handles all the events pass from GLWidget.
|
protected |
A method that defines the mouse mode depending on location of mouse over a canvas frame. Used in entity select, entity move, entity scale, entity rotate, etc. modes.
|
protected |
A method to set colors of canvas frame drawables to:
|
protected |
A pointer on a current GLWidget; used to make sure the mouse mode is set up within GUI (i.e., cursor change).
|
protected |
A current mouse mode which dictates what actions are performed based on mouse events.
|
protected |
A pointer on a scene; ofter used to extract scene elements such as current canvas.