int Velasquez::ResizeRotateCorner::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = ResizeRotateHoverPoint::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateAnchor(); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
int Velasquez::ResizeRotateHoverPoint::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = HoverPoint::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: resizeRotate((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); break;
        case 1: updateAnchor(); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
int Velasquez::HoverPoint::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: pressed((*reinterpret_cast< const QPointF(*)>(_a[1]))); break;
        case 1: pressed(); break;
        case 2: released((*reinterpret_cast< const QPointF(*)>(_a[1]))); break;
        case 3: released(); break;
        case 4: updateAnchor(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
hdStickyRectangleConnector::hdStickyRectangleConnector(hdIFigure *owner, hdPoint p):
	hdChopBoxConnector(owner)
{
	hdGeometry g;
	updateAnchor(0, p);
}
Exemple #5
0
int MyGlWindow::handle(int e)
{

	//int ret = Fl_Button::handle(e);
	//cout<<endl<<count++<<" ******** button "<<label()<<" receives ";
	switch(e)
	{
	case FL_FOCUS:
	case FL_UNFOCUS:
	case FL_KEYBOARD:
		return keyboard(e,Fl::event_key());
	case FL_WHEN_RELEASE:
		_pauseVideo = 1-pause_video->value();
		redraw();
		break;
	case FL_PUSH:
		
		_mousex = Fl::event_x();
		_mousey = Fl::event_y();
		
		if (_windowMode == MODE_3D_MAP) {
			_LUT.mouse_3d(Fl::event_button(),GLUT_DOWN,Fl::event_x(),Fl::event_y(),\
				fltk2gl_mousemodifier());
			if (fltk2gl_mousemodifier() == GLUT_ACTIVE_CTRL) {
				model_picking_3d(Fl::event_x(),Fl::event_y());
			} else if (fltk2gl_mousemodifier() == GLUT_ACTIVE_SHIFT) {
				_camera->came.getTranslation() = _LUT._viewer_3d.raycast(Fl::event_x(),WINDOW_HEIGHT-Fl::event_y());
				//_LUT._position = _camera->came.getTranslation();
				_sphere_viewer._target = _camera->came.getTranslation();
			}
		}
		else if (_windowMode == MODE_2D_MAP) {
			_LUT.mouse_3d_topview( Fl::event_button(),GLUT_DOWN,Fl::event_x(),Fl::event_y());
		} 
		else if (_windowMode == MODE_SPHERE) {
			_sphere_viewer.mouse(Fl::event_button(),GLUT_DOWN,Fl::event_x(),Fl::event_y(),fltk2gl_mousemodifier());
			if (fltk2gl_mousemodifier() == GLUT_ACTIVE_CTRL) {
				sphere_picking_3d(Fl::event_x(),Fl::event_y());
			}
		} 
		else if (_windowMode == MODE_VIDEO) {
			if (fltk2gl_mousemodifier() == GLUT_ACTIVE_CTRL) {
				video_picking_2d(Fl::event_x(),Fl::event_y());
			}
			if ( Fl::event_button() == FL_LEFT_MOUSE ) {
				if ( _adding_anchor ) {
					addAnchor( _mousex, _mousey, _calibrated_camera );
					_adding_anchor = false;
				}
				if ( _updating_anchor ) {
					updateAnchor(  _mousex, _mousey, _calibrated_camera );
					_updating_anchor = false;
				}
				
				if ( _removing_anchor ) {
					removeAnchor(  _mousex, _mousey, _calibrated_camera );
					_removing_anchor = false;
				}
			} else if (  Fl::event_button() == FL_RIGHT_MOUSE ) {
				LOG(LEVEL_INFO, "cancelled selection");
				_adding_anchor = false;
				_updating_anchor = false;
				_removing_anchor = false;
			}			
		}
		else if ( _windowMode == MODE_CALIBRATION ) { // let the user select points to create an anchor
			if ( Fl::event_button() == FL_LEFT_MOUSE ) {
				LOG(LEVEL_INFO, "selected (%d,%d)", _mousex, _mousey);
				if ( _adding_anchor ) {
					addAnchor( _mousex, _mousey, _calibrated_camera );
					_adding_anchor = false;
				}
				if ( _updating_anchor ) {
					updateAnchor(  _mousex, _mousey, _calibrated_camera );
					_updating_anchor = false;
				}

				if ( _removing_anchor ) {
					removeAnchor(  _mousex, _mousey, _calibrated_camera );
					_removing_anchor = false;
				}

			} else if (  Fl::event_button() == FL_RIGHT_MOUSE ) {
				LOG(LEVEL_INFO, "cancelled selection");
				_adding_anchor = false;
				_updating_anchor = false;
				_removing_anchor = false;
			}
		}
		else if ( _windowMode == MODE_ROTATIONS ) {
			_rotations_viewer.mouse(Fl::event_button(),GLUT_DOWN,Fl::event_x(),Fl::event_y(),fltk2gl_mousemodifier());
		}
		return 1;
	case FL_RELEASE:
	case FL_DRAG:
		if (_windowMode == MODE_3D_MAP) {
			_LUT.motion_3d(Fl::event_x(),Fl::event_y());
			if (fltk2gl_mousemodifier() == GLUT_ACTIVE_SHIFT) {
				
				if (e == FL_RELEASE) {
					// when released, compute the visible 3D features
					//_LUT.nframes = FRAMES_JUMP; // force the node jump
					_LUT.lookup( _camera->came.getTranslation(), MIN_SUBTENDED_ANGLE, 0.0, 0, 0);
				} else {
					// drag the camera position
					//double z = _camera->getTranslation()[2];
					_camera->came.setTranslation(_LUT._viewer_3d.raycast(Fl::event_x(),WINDOW_HEIGHT-Fl::event_y()));
					//_camera->setTranslation( Vec3d( _camera->getTranslation()[0], _camera->getTranslation()[1], z ) );
					//_LUT._position = _camera->came.getTranslation();
					_sphere_viewer._target = _camera->came.getTranslation();
				}
			} 
			redraw();
		} 
		else if (_windowMode == MODE_SPHERE) {
			_sphere_viewer.motion(Fl::event_x(),Fl::event_y(),4.0,400.0,4.0);
		}
		else if (_windowMode == MODE_2D_MAP) {
			_LUT.motion_3d_topview(Fl::event_x(),Fl::event_y());
		}
		else if ( _windowMode == MODE_ROTATIONS ) {
			_rotations_viewer.motion( Fl::event_x(),Fl::event_y(),4.0,400.0,4.0);
		}
		//redraw();
		return 1;
		//case FL_HIDE:
		//	 return 1;
	case FL_SHOW:
		show();
		return 1;
	default:
		return Fl_Widget::handle(e);
	}	
	return 1;
}
wxhdStickyRectangleConnector::wxhdStickyRectangleConnector(wxhdIFigure *owner, wxhdPoint p):
wxhdChopBoxConnector(owner)
{
	wxhdGeometry g;
	updateAnchor(p);
}