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){
87 planeNode_->delete_subtree( );
91 emit updateViewProxy( );
98 void QtPlaneSelect::slotMouseEvent(QMouseEvent* event)
101 unsigned int height = glState.viewport_height();
104 if (event->button() == Qt::RightButton){
107 planeNode_->delete_subtree( );
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:
176 planeNode_->delete_subtree( );
180 emit updateViewProxy( );
182 emit( signalTriggerCut( ) );
196 void QtPlaneSelect::setPlaneAndSize(
const ACG::Vec3d& _sourcePoint3D,
const ACG::Vec3d& _target2D)
199 ACG::Vec3d source2D = glState.project( _sourcePoint3D );
216 normal =
cross( rightvec, leftvec );
221 plane_.setPlane(sourcePoint3Df,normald);
223 planeNode_->update();
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
double sceneRadius()
Returns the current scene radius from the active examiner widget.
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
osg::Vec3f cross(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
picks faces (should be implemented for all nodes)