osgEarth 2.1.1
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

osgEarth::Util::EarthManipulator::Settings Class Reference

Inheritance diagram for osgEarth::Util::EarthManipulator::Settings:
Collaboration diagram for osgEarth::Util::EarthManipulator::Settings:

List of all members.

Public Member Functions

 Settings ()
 Settings (const Settings &rhs)
void bindMouse (ActionType action, int button_mask, int modkey_mask=0L, const ActionOptions &options=ActionOptions())
void bindMouseClick (ActionType action, int button_mask, int modkey_mask=0L, const ActionOptions &options=ActionOptions())
void bindMouseDoubleClick (ActionType action, int button_mask, int modkey_mask=0L, const ActionOptions &options=ActionOptions())
void bindKey (ActionType action, int key, int modkey_mask=0L, const ActionOptions &options=ActionOptions())
void bindScroll (ActionType action, int scrolling_motion, int modkey_mask=0L, const ActionOptions &options=ActionOptions())
void setMouseSensitivity (double value)
double getMouseSensitivity () const
void setKeyboardSensitivity (double value)
double getKeyboardSensitivity () const
void setScrollSensitivity (double value)
double getScrollSensitivity () const
void setSingleAxisRotation (bool value)
bool getSingleAxisRotation () const
void setThrowingEnabled (bool value)
bool getThrowingEnabled () const
void setLockAzimuthWhilePanning (bool value)
bool getLockAzimuthWhilePanning () const
void setMinMaxPitch (double min_pitch, double max_pitch)
double getMinPitch () const
double getMaxPitch () const
double getMaxXOffset () const
double getMaxYOffset () const
double getMinDistance () const
double getMaxDistance () const
void setMinMaxDistance (double min_distance, double max_distance)
void setMaxOffset (double max_x_offset, double max_y_offset)
TetherMode getTetherMode () const
void setTetherMode (TetherMode tether_mode)
void setArcViewpointTransitions (bool value)
bool getArcViewpointTransitions () const
void setAutoViewpointDurationEnabled (bool value)
bool getAutoViewpointDurationEnabled () const
void setAutoViewpointDurationLimits (double minSeconds, double maxSeconds)
void getAutoViewpointDurationLimits (double &out_minSeconds, double &out_maxSeconds) const

Private Types

typedef std::pair< InputSpec,
Action
ActionBinding
typedef std::map< InputSpec,
Action
ActionBindings

Private Member Functions

const ActiongetAction (int event_type, int input_mask, int modkey_mask) const
void expandSpec (const InputSpec &input, InputSpecs &output) const
void bind (const InputSpec &spec, const Action &action)

Private Attributes

ActionBindings _bindings
bool _single_axis_rotation
bool _throwing
bool _lock_azim_while_panning
double _mouse_sens
double _keyboard_sens
double _scroll_sens
double _min_pitch
double _max_pitch
double _max_x_offset
double _max_y_offset
double _min_distance
double _max_distance
TetherMode _tether_mode
bool _arc_viewpoints
bool _auto_vp_duration
double _min_vp_duration_s
double _max_vp_duration_s

Friends

class EarthManipulator

Detailed Description

Definition at line 183 of file EarthManipulator.


Member Typedef Documentation

Definition at line 461 of file EarthManipulator.

Definition at line 463 of file EarthManipulator.


Constructor & Destructor Documentation

EarthManipulator::Settings::Settings ( )

Definition at line 198 of file EarthManipulator.cpp.

                                   :
_single_axis_rotation( false ),
_throwing( false ),
_lock_azim_while_panning( true ),
_mouse_sens( 1.0 ),
_keyboard_sens( 1.0 ),
_scroll_sens( 1.0 ),
_min_pitch( -89.9 ),
_max_pitch( -10.0 ),
_max_x_offset( 0.0 ),
_max_y_offset( 0.0 ),
_min_distance( 0.001 ),
_max_distance( DBL_MAX ),
_tether_mode( TETHER_CENTER ),
_arc_viewpoints( false ),
_auto_vp_duration( false ),
_min_vp_duration_s( 3.0 ),
_max_vp_duration_s( 8.0 )
{
    //NOP
}
EarthManipulator::Settings::Settings ( const Settings rhs)

Definition at line 220 of file EarthManipulator.cpp.

                                                                        :
_bindings( rhs._bindings ),
_single_axis_rotation( rhs._single_axis_rotation ),
_throwing( rhs._throwing ),
_lock_azim_while_panning( rhs._lock_azim_while_panning ),
_mouse_sens( rhs._mouse_sens ),
_keyboard_sens( rhs._keyboard_sens ),
_scroll_sens( rhs._scroll_sens ),
_min_pitch( rhs._min_pitch ),
_max_pitch( rhs._max_pitch ),
_max_x_offset( rhs._max_x_offset ),
_max_y_offset( rhs._max_y_offset ),
_min_distance( rhs._min_distance ),
_max_distance( rhs._max_distance ),
_tether_mode( rhs._tether_mode ),
_arc_viewpoints( rhs._arc_viewpoints ),
_auto_vp_duration( rhs._auto_vp_duration ),
_min_vp_duration_s( rhs._min_vp_duration_s ),
_max_vp_duration_s( rhs._max_vp_duration_s )
{
    //NOP
}

Member Function Documentation

void EarthManipulator::Settings::bind ( const InputSpec spec,
const Action action 
) [private]

Definition at line 284 of file EarthManipulator.cpp.

{
    InputSpecs specs;
    expandSpec( spec, specs );
    for( InputSpecs::const_iterator i = specs.begin(); i != specs.end(); i++ )
    {
        _bindings[*i] = action; //ActionBinding(*i, action);
    }
        //_bindings.push_back( ActionBinding( *i, action ) );
}
void EarthManipulator::Settings::bindKey ( ActionType  action,
int  key,
int  modkey_mask = 0L,
const ActionOptions options = ActionOptions() 
)

Assigns a bevahior to the action of depressing a key.

Parameters:
actionThe EarthManipulator::ActionType value to which to bind this key input specification.
keyA osgGA::GUIEventAdapter::KeySymbol value
modkey_mask(default = 0L) A mask of osgGA::GUIEventAdapter::ModKeyMask values defining a modifier key combination to associate with the action.
optionsAction options. Valid options are: OPTION_CONTINUOUS

Definition at line 326 of file EarthManipulator.cpp.

{
    bind(
        InputSpec( osgGA::GUIEventAdapter::KEYDOWN, key, modkey_mask ),
        Action( action, options ) );
}
void EarthManipulator::Settings::bindMouse ( ActionType  action,
int  button_mask,
int  modkey_mask = 0L,
const ActionOptions options = ActionOptions() 
)

Assigns behavior to the action of dragging the mouse while depressing one or more mouse buttons and modifier keys.

Parameters:
actionThe EarthManipulator::ActionType value to which to bind this mouse input specification.
button_maskMask of osgGA::GUIEventAdapter::MouseButtonMask values
modkey_mask(default = 0L) A mask of osgGA::GUIEventAdapter::ModKeyMask values defining a modifier key combination to associate with the action.
optionsAction options. Valid options are: OPTION_CONTINUOUS, OPTION_SCALE_X, OPTION_SCALE_Y

Definition at line 296 of file EarthManipulator.cpp.

{
    bind(
        InputSpec( osgGA::GUIEventAdapter::DRAG, button_mask, modkey_mask ),
        Action( actionType, options ) );
}
void EarthManipulator::Settings::bindMouseClick ( ActionType  action,
int  button_mask,
int  modkey_mask = 0L,
const ActionOptions options = ActionOptions() 
)

Assigns a bevahior to the action of clicking one or more mouse buttons.

Parameters:
actionThe EarthManipulator::ActionType value to which to bind this mouse click input specification.
button_maskMask of osgGA::GUIEventAdapter::MouseButtonMask values
modkey_mask(default = 0L) A mask of osgGA::GUIEventAdapter::ModKeyMask values defining a modifier key combination to associate with the action.
optionsAction options. Valid options are: OPTION_GOTO_RANGE_FACTOR, OPTION_DURATION

Definition at line 306 of file EarthManipulator.cpp.

{
    bind(
        InputSpec( EVENT_MOUSE_CLICK, button_mask, modkey_mask ),
        Action( action, options ) );
}
void EarthManipulator::Settings::bindMouseDoubleClick ( ActionType  action,
int  button_mask,
int  modkey_mask = 0L,
const ActionOptions options = ActionOptions() 
)

Assigns a bevahior to the action of double-clicking one or more mouse buttons.

Parameters:
actionThe EarthManipulator::ActionType value to which to bind this double-click input specification.
button_maskMask of osgGA::GUIEventAdapter::MouseButtonMask values
modkey_mask(default = 0L) A mask of osgGA::GUIEventAdapter::ModKeyMask values defining a modifier key combination to associate with the action.
optionsAction options. Valid options are: OPTION_GOTO_RANGE_FACTOR, OPTION_DURATION

Definition at line 316 of file EarthManipulator.cpp.

{
    bind(
        InputSpec( EVENT_MOUSE_DOUBLE_CLICK, button_mask, modkey_mask ),
        Action( action, options ) );
}
void EarthManipulator::Settings::bindScroll ( ActionType  action,
int  scrolling_motion,
int  modkey_mask = 0L,
const ActionOptions options = ActionOptions() 
)

Assigns a bevahior to operation of the mouse's scroll wheel.

Parameters:
actionThe EarthManipulator::ActionType value to which to bind this scroll input specification.
scrolling_motionA osgGA::GUIEventAdapter::ScrollingMotion value
modkey_mask(default = 0L) A mask of osgGA::GUIEventAdapter::ModKeyMask values defining a modifier key combination to associate with the action.
optionsAction options. Valid options are: OPTION_SCALE_Y

Definition at line 336 of file EarthManipulator.cpp.

{
    bind(
        InputSpec ( osgGA::GUIEventAdapter::SCROLL, scrolling_motion, modkey_mask ),
        Action( action, options ) );
}
void EarthManipulator::Settings::expandSpec ( const InputSpec input,
InputSpecs output 
) const [private]

Definition at line 247 of file EarthManipulator.cpp.

{
    int e = input._event_type;
    int i = input._input_mask;
    int m = input._modkey_mask;

    if ( HASMODKEY(m, osgGA::GUIEventAdapter::MODKEY_CTRL) )
    {
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_LEFT_CTRL ), output );
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_RIGHT_CTRL ), output );
    }
    else if ( HASMODKEY(m, osgGA::GUIEventAdapter::MODKEY_ALT) )
    {
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_LEFT_ALT ), output );
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_RIGHT_ALT ), output );
    }
    else if ( HASMODKEY(m, osgGA::GUIEventAdapter::MODKEY_SHIFT) )
    {
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_LEFT_SHIFT ), output );
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_RIGHT_SHIFT ), output );
    }
    else if ( HASMODKEY(m, osgGA::GUIEventAdapter::MODKEY_META) )
    {
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_LEFT_META ), output );
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_RIGHT_META ), output );
    }
    else if ( HASMODKEY(m, osgGA::GUIEventAdapter::MODKEY_HYPER) )
    {
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_LEFT_HYPER ), output );
        expandSpec( InputSpec( e, i, m & ~osgGA::GUIEventAdapter::MODKEY_RIGHT_HYPER ), output );
    }

    //Always add the input so if we are dealing with a windowing system like QT that just sends MODKEY_CTRL it will still work.
    output.push_back( input );
}
const EarthManipulator::Action & EarthManipulator::Settings::getAction ( int  event_type,
int  input_mask,
int  modkey_mask 
) const [private]

Definition at line 345 of file EarthManipulator.cpp.

{
    InputSpec spec( event_type, input_mask, modkey_mask );
    ActionBindings::const_iterator i = _bindings.find(spec);
    return i != _bindings.end() ? i->second : NullAction;
    //for( ActionBindings::const_iterator i = _bindings.begin(); i != _bindings.end(); i++ )
    //    if ( i->first == spec )
    //        return i->second;
    //return NullAction;
}
bool osgEarth::Util::EarthManipulator::Settings::getArcViewpointTransitions ( ) const [inline]

Definition at line 445 of file EarthManipulator.

{ return _arc_viewpoints; }
bool osgEarth::Util::EarthManipulator::Settings::getAutoViewpointDurationEnabled ( ) const [inline]

Definition at line 449 of file EarthManipulator.

{ return _auto_vp_duration; }
void osgEarth::Util::EarthManipulator::Settings::getAutoViewpointDurationLimits ( double &  out_minSeconds,
double &  out_maxSeconds 
) const [inline]

Definition at line 452 of file EarthManipulator.

                                                                                                        {
                out_minSeconds = _min_vp_duration_s;
                out_maxSeconds = _max_vp_duration_s;
            }
double osgEarth::Util::EarthManipulator::Settings::getKeyboardSensitivity ( ) const [inline]

Gets the keyboard action sensitivity scale factor. Default = 1.0.

Definition at line 337 of file EarthManipulator.

{ return _keyboard_sens; }
bool osgEarth::Util::EarthManipulator::Settings::getLockAzimuthWhilePanning ( ) const [inline]

Gets true if the manipulator should lock in a camera heading when performing panning operations (i.e. changing the focal point.)

Definition at line 395 of file EarthManipulator.

double osgEarth::Util::EarthManipulator::Settings::getMaxDistance ( ) const [inline]

Gets the maximum distance from the focal point in world coordinates

Definition at line 423 of file EarthManipulator.

{return _max_distance; }
double osgEarth::Util::EarthManipulator::Settings::getMaxPitch ( ) const [inline]

Gets the maximum allowable local pitch, in degrees.

Definition at line 411 of file EarthManipulator.

{ return _max_pitch; }        
double osgEarth::Util::EarthManipulator::Settings::getMaxXOffset ( ) const [inline]

Gets the max x offset in world coordates

Definition at line 414 of file EarthManipulator.

{ return _max_x_offset; }
double osgEarth::Util::EarthManipulator::Settings::getMaxYOffset ( ) const [inline]

Gets the max y offset in world coordates

Definition at line 417 of file EarthManipulator.

{ return _max_y_offset; }
double osgEarth::Util::EarthManipulator::Settings::getMinDistance ( ) const [inline]

Gets the minimum distance from the focal point in world coordinates

Definition at line 420 of file EarthManipulator.

{return _min_distance; }
double osgEarth::Util::EarthManipulator::Settings::getMinPitch ( ) const [inline]

Gets the minimum allowable local pitch, in degrees.

Definition at line 408 of file EarthManipulator.

{ return _min_pitch; }
double osgEarth::Util::EarthManipulator::Settings::getMouseSensitivity ( ) const [inline]

Gets the overall mouse sensitivity scale factor. Default = 1.0.

Definition at line 320 of file EarthManipulator.

{ return _mouse_sens; }
double osgEarth::Util::EarthManipulator::Settings::getScrollSensitivity ( ) const [inline]

Gets the scroll wheel sensetivity scale factor. Default = 1.0.

Definition at line 354 of file EarthManipulator.

{ return _scroll_sens; }
bool osgEarth::Util::EarthManipulator::Settings::getSingleAxisRotation ( ) const [inline]

Gets whether simultaneous control over pitch and azimuth is disabled. Default = false.

Definition at line 371 of file EarthManipulator.

TetherMode osgEarth::Util::EarthManipulator::Settings::getTetherMode ( ) const [inline]

Gets the TetherMode

Definition at line 436 of file EarthManipulator.

{ return _tether_mode; }
bool osgEarth::Util::EarthManipulator::Settings::getThrowingEnabled ( ) const [inline]

Gets whether to allow motion to continue when the user releases the mouse button while still dragging the mouse.

Definition at line 383 of file EarthManipulator.

{ return _throwing; }
void EarthManipulator::Settings::setArcViewpointTransitions ( bool  value)

Whether a setViewpoint transition whould "arc"

Definition at line 378 of file EarthManipulator.cpp.

{
    _arc_viewpoints = value;
}
void EarthManipulator::Settings::setAutoViewpointDurationEnabled ( bool  value)

Activates auto-duration for transitioned viewpoints.

Definition at line 384 of file EarthManipulator.cpp.

{
    _auto_vp_duration = value;
}
void EarthManipulator::Settings::setAutoViewpointDurationLimits ( double  minSeconds,
double  maxSeconds 
)

Definition at line 390 of file EarthManipulator.cpp.

{
    _min_vp_duration_s = osg::clampAbove( minSeconds, 0.0 );
    _max_vp_duration_s = osg::clampAbove( maxSeconds, _min_vp_duration_s );
}
void osgEarth::Util::EarthManipulator::Settings::setKeyboardSensitivity ( double  value) [inline]

Sets the keyboard action sensitivity factor. This applies to navigation actions that are bound to keyboard events. For example, you may bind the LEFT arrow to the ACTION_PAN_LEFT action; this factor adjusts how much panning will occur during each frame that the key is depressed.

Parameters:
valueA scale factor to apply to keyboard-controller navigation. 1.0 = default; < 1.0 = less sensitive; > 1.0 = more sensitive.

Definition at line 332 of file EarthManipulator.

{ _keyboard_sens = value; }
void osgEarth::Util::EarthManipulator::Settings::setLockAzimuthWhilePanning ( bool  value) [inline]

Sets whether to lock in a camera heading when performing panning operations (i.e., changing the focal point).

Definition at line 389 of file EarthManipulator.

void EarthManipulator::Settings::setMaxOffset ( double  max_x_offset,
double  max_y_offset 
)

Sets the maximum allowable offsets for the x and y camera offsets in world coordinates

Definition at line 364 of file EarthManipulator.cpp.

{
        _max_x_offset = max_x_offset;
        _max_y_offset = max_y_offset;
}
void EarthManipulator::Settings::setMinMaxDistance ( double  min_distance,
double  max_distance 
)

Sets the min and max distance from the focal point in world coordiantes

Definition at line 371 of file EarthManipulator.cpp.

{
        _min_distance = min_distance;
        _max_distance = max_distance;
}
void EarthManipulator::Settings::setMinMaxPitch ( double  min_pitch,
double  max_pitch 
)

Sets the minimum and maximum allowable local camera pitch, in degrees.

By "local" we mean relative to the tangent plane passing through the focal point on the surface of the terrain.

Defaults are: Min = -90, Max = -10.

Definition at line 357 of file EarthManipulator.cpp.

{
    _min_pitch = osg::clampBetween( min_pitch, -89.9, 89.0 );
    _max_pitch = osg::clampBetween( max_pitch, min_pitch, 89.0 );
}
void osgEarth::Util::EarthManipulator::Settings::setMouseSensitivity ( double  value) [inline]

Sets an overall mouse sensitivity factor.

Parameters:
valueA scale factor to apply to mouse readings. 1.0 = default; < 1.0 = less sensitive; > 1.0 = more sensitive.

Definition at line 315 of file EarthManipulator.

{ _mouse_sens = value; }
void osgEarth::Util::EarthManipulator::Settings::setScrollSensitivity ( double  value) [inline]

Sets the scroll-wheel sensitivity factor. This applies to navigation actions that are bound to scrolling events. For example, you may bind the scroll wheel to the ACTION_ZOOM_IN action; this factor adjusts how much zooming will occur each time you click the scroll wheel.

Parameters:
valueA scale factor to apply to scroll-wheel-controlled navigation. 1.0 = default; < 1.0 = less sensitive; > 1.0 = more sensitive.

Definition at line 349 of file EarthManipulator.

{ _scroll_sens = value; }
void osgEarth::Util::EarthManipulator::Settings::setSingleAxisRotation ( bool  value) [inline]

When set to true, prevents simultaneous control of pitch and azimuth.

Usually you can alter pitch and azimuth at the same time. When this flag is set, you can only control one at a time - if you start slewing the azimuth of the camera, the pitch stays locked until you stop moving and then start slewing the pitch.

Default = false.

Definition at line 365 of file EarthManipulator.

{ _single_axis_rotation = value; }
void osgEarth::Util::EarthManipulator::Settings::setTetherMode ( TetherMode  tether_mode) [inline]

Sets the TetherMode

Definition at line 441 of file EarthManipulator.

{ _tether_mode = tether_mode; }
void osgEarth::Util::EarthManipulator::Settings::setThrowingEnabled ( bool  value) [inline]

Setting this to True lets motion continue when the user releases the mouse button while still dragging. Default = false.

Definition at line 377 of file EarthManipulator.

{ _throwing = value; }

Friends And Related Function Documentation

friend class EarthManipulator [friend]

Definition at line 459 of file EarthManipulator.


Member Data Documentation

Definition at line 491 of file EarthManipulator.

Definition at line 492 of file EarthManipulator.

Definition at line 474 of file EarthManipulator.

Definition at line 479 of file EarthManipulator.

Definition at line 477 of file EarthManipulator.

Definition at line 488 of file EarthManipulator.

Definition at line 482 of file EarthManipulator.

Definition at line 493 of file EarthManipulator.

Definition at line 484 of file EarthManipulator.

Definition at line 485 of file EarthManipulator.

Definition at line 487 of file EarthManipulator.

Definition at line 481 of file EarthManipulator.

Definition at line 493 of file EarthManipulator.

Definition at line 478 of file EarthManipulator.

Definition at line 480 of file EarthManipulator.

Definition at line 475 of file EarthManipulator.

Definition at line 490 of file EarthManipulator.

Definition at line 476 of file EarthManipulator.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines