50 #include "QtPlaneSelect.hh"
53 #include <ACG/Scenegraph/GlutPrimitiveNode.hh>
54 #define PLUGINFUNCTIONS_C
57 #include <ACG/QtWidgets/QtColorTranslator.hh>
73 QtPlaneSelect::~QtPlaneSelect( )
82 void QtPlaneSelect::slotKeyReleaseEvent(QKeyEvent* event)
84 if (event->key() == Qt::Key_Escape){
91 emit updateViewProxy( );
98 void QtPlaneSelect::slotMouseEvent(QMouseEvent* event)
104 if (event->button() == Qt::RightButton){
111 emit updateViewProxy( );
120 switch( event->type() )
122 case QEvent::MouseButtonPress:
126 if ( event->button() != Qt::LeftButton )
130 unsigned int node_idx, target_idx;
144 if ( planeNode_ == 0 ) {
148 setPlaneAndSize(sourcePoint3D,
ACG::Vec3d(event->pos().x(), height-
event->pos().y()-1.0, 0.0));
151 emit nodeVisChangedProxy(planeNode_->
id());
154 targetIdx_ = target_idx;
157 emit updateViewProxy( );
160 case QEvent::MouseMove:
164 setPlaneAndSize(sourcePoint3D,
ACG::Vec3d(event->pos().x(), height-
event->pos().y()-1.0, 0.0));
166 emit updateViewProxy( );
170 case QEvent::MouseButtonRelease:
180 emit updateViewProxy( );
182 emit( signalTriggerCut( ) );
196 void QtPlaneSelect::setPlaneAndSize(
const ACG::Vec3d& _sourcePoint3D,
const ACG::Vec3d& _target2D)
212 leftvec.normalize( );
214 rightvec.normalize( );
216 normal =
cross( rightvec, leftvec );
221 plane_.
setPlane(sourcePoint3Df,normald);
picks faces (should be implemented for all nodes)
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
osg::Vec3f cross(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
void show()
Show node: set status to Active.
void setSize(double _xDirection, double _yDirection)
Set plane size.
void update()
updates the plane before the next render call
void delete_subtree()
Delete the whole subtree of this node.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
double sceneRadius()
Returns the current scene radius from the active examiner widget.
void setPlane(const ACG::Vec3d &_position, const ACG::Vec3d &_xDirection, const ACG::Vec3d &)
Set plane.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
int viewport_height() const
get viewport height