44 #include "QtPlaneSelect.hh" 47 #include <ACG/Scenegraph/GlutPrimitiveNode.hh> 48 #define PLUGINFUNCTIONS_C 51 #include <ACG/QtWidgets/QtColorTranslator.hh> 67 QtPlaneSelect::~QtPlaneSelect( )
76 void QtPlaneSelect::slotKeyReleaseEvent(QKeyEvent* event)
78 if (event->key() == Qt::Key_Escape){
81 planeNode_->delete_subtree( );
85 emit updateViewProxy( );
92 void QtPlaneSelect::slotMouseEvent(QMouseEvent* event)
95 unsigned int height = glState.viewport_height();
98 if (event->button() == Qt::RightButton){
101 planeNode_->delete_subtree( );
105 emit updateViewProxy( );
114 switch( event->type() )
116 case QEvent::MouseButtonPress:
120 if ( event->button() != Qt::LeftButton )
124 size_t node_idx, target_idx;
138 if ( planeNode_ == 0 ) {
142 setPlaneAndSize(sourcePoint3D,
ACG::Vec3d(event->pos().x(), height-
event->pos().y()-1.0, 0.0));
145 emit nodeVisChangedProxy(planeNode_->id());
148 targetIdx_ = target_idx;
151 emit updateViewProxy( );
154 case QEvent::MouseMove:
158 setPlaneAndSize(sourcePoint3D,
ACG::Vec3d(event->pos().x(), height-
event->pos().y()-1.0, 0.0));
160 emit updateViewProxy( );
164 case QEvent::MouseButtonRelease:
170 planeNode_->delete_subtree( );
174 emit updateViewProxy( );
176 emit( signalTriggerCut( ) );
190 void QtPlaneSelect::setPlaneAndSize(
const ACG::Vec3d& _sourcePoint3D,
const ACG::Vec3d& _target2D)
193 ACG::Vec3d source2D = glState.project( _sourcePoint3D );
210 normal = cross( rightvec, leftvec );
215 plane_.setPlane(sourcePoint3Df,normald);
217 planeNode_->update();
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
picks faces (should be implemented for all nodes)
double sceneRadius()
Returns the current scene radius from the active examiner widget.