Path: blob/master/modules/viz/src/vtk/vtkVizInteractorStyle.hpp
16358 views
/*M///////////////////////////////////////////////////////////////////////////////////////1//2// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.3//4// By downloading, copying, installing or using the software you agree to this license.5// If you do not agree to this license, do not download, install,6// copy or use the software.7//8//9// License Agreement10// For Open Source Computer Vision Library11//12// Copyright (C) 2013, OpenCV Foundation, all rights reserved.13// Third party copyrights are property of their respective owners.14//15// Redistribution and use in source and binary forms, with or without modification,16// are permitted provided that the following conditions are met:17//18// * Redistribution's of source code must retain the above copyright notice,19// this list of conditions and the following disclaimer.20//21// * Redistribution's in binary form must reproduce the above copyright notice,22// this list of conditions and the following disclaimer in the documentation23// and/or other materials provided with the distribution.24//25// * The name of the copyright holders may not be used to endorse or promote products26// derived from this software without specific prior written permission.27//28// This software is provided by the copyright holders and contributors "as is" and29// any express or implied warranties, including, but not limited to, the implied30// warranties of merchantability and fitness for a particular purpose are disclaimed.31// In no event shall the Intel Corporation or contributors be liable for any direct,32// indirect, incidental, special, exemplary, or consequential damages33// (including, but not limited to, procurement of substitute goods or services;34// loss of use, data, or profits; or business interruption) however caused35// and on any theory of liability, whether in contract, strict liability,36// or tort (including negligence or otherwise) arising in any way out of37// the use of this software, even if advised of the possibility of such damage.38//39// Authors:40// * Ozan Tonkal, [email protected]41// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com42//43//M*/4445#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__46#define __OPENCV_VIZ_INTERACTOR_STYLE_H__4748#include <vtkInteractorStyle.h>4950namespace cv51{52namespace viz53{54class vtkVizInteractorStyle : public vtkInteractorStyle55{56public:57static vtkVizInteractorStyle *New();58vtkTypeMacro(vtkVizInteractorStyle, vtkInteractorStyle)59void PrintSelf(ostream& os, vtkIndent indent);6061virtual void OnChar();62virtual void OnKeyDown();63virtual void OnKeyUp();6465virtual void OnMouseMove();66virtual void OnLeftButtonDown();67virtual void OnLeftButtonUp();68virtual void OnMiddleButtonDown();69virtual void OnMiddleButtonUp();70virtual void OnRightButtonDown();71virtual void OnRightButtonUp();72virtual void OnMouseWheelForward();73virtual void OnMouseWheelBackward();74virtual void OnTimer();7576virtual void Rotate();77virtual void Spin();78virtual void Pan();79virtual void Dolly();8081vtkSetMacro(FlyMode,bool)82vtkGetMacro(FlyMode,bool)838485vtkSetMacro(MotionFactor, double)86vtkGetMacro(MotionFactor, double)8788void registerMouseCallback(void (*callback)(const MouseEvent&, void*), void* cookie = 0);89void registerKeyboardCallback(void (*callback)(const KeyboardEvent&, void*), void * cookie = 0);9091void setWidgetActorMap(const Ptr<WidgetActorMap>& actors) { widget_actor_map_ = actors; }92void saveScreenshot(const String &file);93void exportScene(const String &file);94void exportScene();95void changePointsSize(float delta);96void setRepresentationToPoints();97void printCameraParams();98void toggleFullScreen();99void resetViewerPose();100void toggleStereo();101void printHelp();102103// Set the basic unit step size : by default 1/250 of bounding diagonal104vtkSetMacro(MotionStepSize,double)105vtkGetMacro(MotionStepSize,double)106107// Set acceleration factor when shift key is applied : default 10108vtkSetMacro(MotionAccelerationFactor,double)109vtkGetMacro(MotionAccelerationFactor,double)110111// Set the basic angular unit for turning : default 1 degree112vtkSetMacro(AngleStepSize,double)113vtkGetMacro(AngleStepSize,double)114115private:116Ptr<WidgetActorMap> widget_actor_map_;117118Vec2i win_size_;119Vec2i win_pos_;120Vec2i max_win_size_;121122void zoomIn();123void zoomOut();124125protected:126vtkVizInteractorStyle();127~vtkVizInteractorStyle();128129virtual void Dolly(double factor);130131void Fly();132void FlyByMouse();133void FlyByKey();134void SetupMotionVars();135void MotionAlongVector(const Vec3d& vector, double amount, vtkCamera* cam);136137private:138vtkVizInteractorStyle(const vtkVizInteractorStyle&);139vtkVizInteractorStyle& operator=(const vtkVizInteractorStyle&);140141//! True for red-blue colors, false for magenta-green.142bool stereo_anaglyph_redblue_;143144void (*keyboardCallback_)(const KeyboardEvent&, void*);145void *keyboard_callback_cookie_;146147void (*mouseCallback_)(const MouseEvent&, void*);148void *mouse_callback_cookie_;149150bool FlyMode;151double MotionFactor;152153int getModifiers();154155// from fly156unsigned char KeysDown;157double DiagonalLength;158double MotionStepSize;159double MotionUserScale;160double MotionAccelerationFactor;161double AngleStepSize;162double DeltaYaw;163double DeltaPitch;164};165} // end namespace viz166} // end namespace cv167168#endif169170171