You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
C
54 lines
1.7 KiB
C
|
1 month ago
|
|
||
|
|
#ifndef _OPMARKUPRECTANGLE_H
|
||
|
|
#define _OPMARKUPRECTANGLE_H
|
||
|
|
|
||
|
|
#include "OpConstructRectangle.h"
|
||
|
|
|
||
|
|
//! The OpMarkupMouse class inserts a 2D rectange into a markup layer. If a markup layer is already active then the operator will use that layer otherwise the operator will create a new, unamed layer.
|
||
|
|
/*!
|
||
|
|
HOpMarkupMouse implements three mouse event methods defined on the base class and maps the event information
|
||
|
|
to operator routines. This operation consists of the following steps:
|
||
|
|
<ol>
|
||
|
|
<li>Left Button Down: register corner of rectangle
|
||
|
|
<li>Left Button Down and Drag: create an appropriately sized rectangle in the contruction layer
|
||
|
|
<li>Left Button Up: depending on existence of an active markup layer it either opens the existing or creates a new markup layer and inserts appropraitely sized rectangle into it
|
||
|
|
</ol>
|
||
|
|
More Detailed Description: see event methods
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace OSGView
|
||
|
|
{
|
||
|
|
|
||
|
|
class OpMarkupMouse : public OBaseOperator
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
OpMarkupMouse();
|
||
|
|
OpMarkupMouse(osgViewer::Viewer* pViewer);
|
||
|
|
virtual ~OpMarkupMouse();
|
||
|
|
|
||
|
|
/*!
|
||
|
|
\returns A pointer to a character string denoting the name of the operator which is 'Markup Rectangle'.
|
||
|
|
*/
|
||
|
|
virtual const char * GetName() {return "OpMarkupMouse";}
|
||
|
|
|
||
|
|
void ShowMouse(int px, int py);
|
||
|
|
|
||
|
|
const osg::Vec2i& GetMousePos() { return m_pt; }
|
||
|
|
|
||
|
|
virtual int OnMouseMove(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
|
||
|
|
protected:
|
||
|
|
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
|
||
|
|
|
||
|
|
private:
|
||
|
|
osg::Switch* GetChild(const char* name, osg::Group* pGroup);
|
||
|
|
osg::Switch* CrateMouse();
|
||
|
|
|
||
|
|
osg::Switch* m_markup;
|
||
|
|
osg::MatrixTransform* m_translate;
|
||
|
|
osg::Vec2i m_pt;
|
||
|
|
};
|
||
|
|
|
||
|
|
} //end namespace
|
||
|
|
|
||
|
|
|
||
|
|
#endif
|