Commit 2bbcdb91 authored by John Biddiscombe's avatar John Biddiscombe

ENH:InteractorStyle Flight for Win32. #ifdef around platform sensitive code

parent 7fe2984f
This diff is collapsed.
/*=========================================================================
Program: Visualization Toolkit
Module: vtkInteractorStyleFlight.h
Language: C++
Date: $Date$
Version: $Revision$
Thanks: Thanks to John Biddiscombe of the Rutherford Appleton Laboratory
who developed this class.
Copyright (c) 1993-2000 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
of any contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
* Modified source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
// .NAME vtkInteractorStyleFlight - provides flight motion routines
//
// .SECTION Description
// Left mouse button press produces forward motion.
// Right mouse button press produces reverse motion.
// Moving mouse during motion steers user in desired direction.
// Keyboard controls are:
// Left/Right/Up/Down Arrows for steering direction
// 'A' forward, 'Z' reverse motion
// Ctrl Key causes sidestep instead of steering in mouse and key modes
// Shift key is accelerator in mouse and key modes
// Ctrl and Shift together causes Roll in mouse and key modes
//
// Stationary 'look' can be achieved by holding both mouse buttons down
// and steering with the mouse.
// Stationary 'look' can also be achieved by holding 'Z' (or 'A') and
// steering with mouse in orward (or reverse) motion mode.
// By default, one "step" of motion corresponds to 1/250th of the diagonal
// of bounding box of visible actors, '+' and '-' keys allow user to
// increase or decrease step size.
#ifndef __vtkInteractorStyleFlight_h
#define __vtkInteractorStyleFlight_h
#include "vtkInteractorStyle.h"
class VTK_EXPORT vtkInteractorStyleFlight : public vtkInteractorStyle
{
public:
static vtkInteractorStyleFlight *New();
vtkTypeMacro(vtkInteractorStyleFlight,vtkInteractorStyle);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Concrete implementation of Mouse event bindings for flight
virtual void OnRightButtonDown (int ctrl, int shift, int X, int Y);
virtual void OnRightButtonUp (int ctrl, int shift, int X, int Y);
virtual void OnMiddleButtonDown(int ctrl, int shift, int X, int Y);
virtual void OnMiddleButtonUp (int ctrl, int shift, int X, int Y);
virtual void OnLeftButtonDown (int ctrl, int shift, int X, int Y);
virtual void OnLeftButtonUp (int ctrl, int shift, int X, int Y);
virtual void OnMouseMove (int ctrl, int shift, int X, int Y);
// Description:
// Concrete implementation of Keyboard event bindings for flight
virtual void OnChar (int ctrl, int shift, char keycode, int repeatcount);
virtual void OnKeyDown(int ctrl, int shift, char keycode, int repeatcount);
virtual void OnKeyUp (int ctrl, int shift, char keycode, int repeatcount);
// Description:
// Mouse and key events set correct motion states, OnTimer performs the motion
virtual void OnTimer(void);
// Description:
// Set the basic unit step size : by default 1/250 of bounding diagonal
vtkSetMacro(MotionStepSize,double);
vtkGetMacro(MotionStepSize,double);
// Description:
// Set acceleration factor when shift key is applied : default 10
vtkSetMacro(MotionAccelerationFactor,double);
vtkGetMacro(MotionAccelerationFactor,double);
// Description:
// Set the basic angular unit for turning : default 1 degree
vtkSetMacro(AngleStepSize,double);
vtkGetMacro(AngleStepSize,double);
// Description:
// Set angular acceleration when shift key is applied : default 5
vtkSetMacro(AngleAccelerationFactor,double);
vtkGetMacro(AngleAccelerationFactor,double);
protected:
vtkInteractorStyleFlight();
~vtkInteractorStyleFlight();
vtkInteractorStyleFlight(const vtkInteractorStyleFlight&) {};
void operator=(const vtkInteractorStyleFlight&) {};
//
// Description:
// Routines used internally for computing motion and steering
void DoTimerStart(void);
void DoTimerStop(void);
void UpdateMouseSteering(int x, int y);
void FlyByMouse(void);
void FlyByKey(void);
void ComputeLRVector(double vector[3]);
void MotionAlongVector(double vector[3], double amount);
void SetupMotionVars(void);
//
//
unsigned char KeysDown;
int Flying, Reversing;
int TimerRunning;
double OldX, OldY, x2, y2;
double DiagonalLength;
double MotionStepSize, MotionUserScale, MotionAccelerationFactor;
double AngleStepSize, AngleAccelerationFactor;
double YawAngle, PitchAngle;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment