51
51
using namespace osgEarth ::Drivers;
52
52
using namespace osgEarthUtil ::Controls2;
53
53
54
+ #define MOVE_OFFSET 0.05
54
55
55
56
// static const char * const sIdent = "$Id: plugin.cpp 9327 2008-09-14 11:18:44Z jef $";
56
57
static const QString sName = QObject::tr( " Globe" );
@@ -318,16 +319,15 @@ void GlobePlugin::setupControls()
318
319
moveHControls->setPosition ( 5 , 35 );
319
320
320
321
osgEarthUtil::EarthManipulator* manip = dynamic_cast <osgEarthUtil::EarthManipulator*>(viewer.getCameraManipulator ());
321
-
322
322
// Move Left
323
323
osg::Image* moveLeftImg = osgDB::readImageFile ( imgDir + " /move-left.png" );
324
324
ImageControl* moveLeft = new NavigationControl ( moveLeftImg );
325
- moveLeft->addEventHandler ( new PanControlHandler ( manip, -0.05 , 0 ) );
325
+ moveLeft->addEventHandler ( new PanControlHandler ( manip, -MOVE_OFFSET , 0 ) );
326
326
327
327
// Move Right
328
328
osg::Image* moveRightImg = osgDB::readImageFile ( imgDir + " /move-right.png" );
329
329
ImageControl* moveRight = new NavigationControl ( moveRightImg );
330
- moveRight->addEventHandler ( new PanControlHandler ( manip, 0.05 , 0 ) );
330
+ moveRight->addEventHandler ( new PanControlHandler ( manip, MOVE_OFFSET , 0 ) );
331
331
332
332
// Move Reset
333
333
osg::Image* moveResetImg = osgDB::readImageFile ( imgDir + " /move-reset.png" );
@@ -348,12 +348,12 @@ void GlobePlugin::setupControls()
348
348
// Move Up
349
349
osg::Image* moveUpImg = osgDB::readImageFile ( imgDir + " /move-up.png" );
350
350
ImageControl* moveUp = new NavigationControl ( moveUpImg );
351
- moveUp->addEventHandler ( new PanControlHandler ( manip, 0 , - 0.05 ) );
351
+ moveUp->addEventHandler ( new PanControlHandler ( manip, 0 , MOVE_OFFSET ) );
352
352
353
353
// Move Down
354
354
osg::Image* moveDownImg = osgDB::readImageFile ( imgDir + " /move-down.png" );
355
355
ImageControl* moveDown = new NavigationControl ( moveDownImg );
356
- moveDown->addEventHandler ( new PanControlHandler ( manip, 0 , 0.05 ) );
356
+ moveDown->addEventHandler ( new PanControlHandler ( manip, 0 , -MOVE_OFFSET ) );
357
357
358
358
// add controls to moveControls group
359
359
moveHControls->addControl ( moveLeft );
@@ -378,12 +378,12 @@ void GlobePlugin::setupControls()
378
378
// Rotate CCW
379
379
osg::Image* rotateCCWImg = osgDB::readImageFile ( imgDir + " /rotate-ccw.png" );
380
380
ImageControl* rotateCCW = new NavigationControl ( rotateCCWImg );
381
- rotateCCW->addEventHandler ( new RotateControlHandler ( manip, 0.05 , 0 ) );
381
+ rotateCCW->addEventHandler ( new RotateControlHandler ( manip, MOVE_OFFSET , 0 ) );
382
382
383
383
// Rotate CW
384
384
osg::Image* rotateCWImg = osgDB::readImageFile ( imgDir + " /rotate-cw.png" );
385
385
ImageControl* rotateCW = new NavigationControl ( rotateCWImg );
386
- rotateCW->addEventHandler ( new RotateControlHandler ( manip, -0.05 , 0 ) );
386
+ rotateCW->addEventHandler ( new RotateControlHandler ( manip, -MOVE_OFFSET , 0 ) );
387
387
388
388
// Rotate Reset
389
389
osg::Image* rotateResetImg = osgDB::readImageFile ( imgDir + " /rotate-reset.png" );
@@ -411,12 +411,12 @@ void GlobePlugin::setupControls()
411
411
// tilt Up
412
412
osg::Image* tiltUpImg = osgDB::readImageFile ( imgDir + " /tilt-up.png" );
413
413
ImageControl* tiltUp = new NavigationControl ( tiltUpImg );
414
- tiltUp->addEventHandler ( new RotateControlHandler ( manip, 0 , 0.05 ) );
414
+ tiltUp->addEventHandler ( new RotateControlHandler ( manip, 0 , MOVE_OFFSET ) );
415
415
416
416
// tilt Down
417
417
osg::Image* tiltDownImg = osgDB::readImageFile ( imgDir + " /tilt-down.png" );
418
418
ImageControl* tiltDown = new NavigationControl ( tiltDownImg );
419
- tiltDown->addEventHandler ( new RotateControlHandler ( manip, 0 , -0.05 ) );
419
+ tiltDown->addEventHandler ( new RotateControlHandler ( manip, 0 , -MOVE_OFFSET ) );
420
420
421
421
// add controls to tiltControls group
422
422
tiltControls->addControl ( tiltUp );
@@ -438,12 +438,12 @@ void GlobePlugin::setupControls()
438
438
// Zoom In
439
439
osg::Image* zoomInImg = osgDB::readImageFile ( imgDir + " /zoom-in.png" );
440
440
ImageControl* zoomIn = new NavigationControl ( zoomInImg );
441
- zoomIn->addEventHandler ( new ZoomControlHandler ( manip, 0 , -0.05 ) );
441
+ zoomIn->addEventHandler ( new ZoomControlHandler ( manip, 0 , -MOVE_OFFSET ) );
442
442
443
443
// Zoom Out
444
444
osg::Image* zoomOutImg = osgDB::readImageFile ( imgDir + " /zoom-out.png" );
445
445
ImageControl* zoomOut = new NavigationControl ( zoomOutImg );
446
- zoomOut->addEventHandler ( new ZoomControlHandler ( manip, 0 , 0.05 ) );
446
+ zoomOut->addEventHandler ( new ZoomControlHandler ( manip, 0 , MOVE_OFFSET ) );
447
447
448
448
// Zoom Reset
449
449
osg::Image* zoomResetImg = osgDB::readImageFile ( imgDir + " /zoom-reset.png" );
@@ -578,6 +578,8 @@ void GlobePlugin::copyFolder(QString sourceFolder, QString destFolder)
578
578
}
579
579
}
580
580
581
+ // ----------
582
+
581
583
bool FlyToExtentHandler::handle ( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
582
584
{
583
585
if ( ea.getEventType () == ea.KEYDOWN && ea.getKey () == ' 1' )
@@ -589,7 +591,10 @@ bool FlyToExtentHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIAct
589
591
return false ;
590
592
}
591
593
592
- bool NavigationControl::handle ( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, ControlContext& cx )
594
+ // ----------
595
+
596
+ bool
597
+ NavigationControl::handle ( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, ControlContext& cx )
593
598
{
594
599
switch ( ea.getEventType () )
595
600
{
@@ -671,46 +676,46 @@ bool KeyboardControlHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GU
671
676
// move map
672
677
if (ea.getKey () == ' 4' )
673
678
{
674
- _manip->pan ( -0.05 , 0 );
679
+ _manip->pan ( -MOVE_OFFSET , 0 );
675
680
}
676
681
if (ea.getKey () == ' 6' )
677
682
{
678
- _manip->pan ( 0.05 , 0 );
683
+ _manip->pan ( MOVE_OFFSET , 0 );
679
684
}
680
685
if (ea.getKey () == ' 2' )
681
686
{
682
- _manip->pan ( 0 , 0.05 );
687
+ _manip->pan ( 0 , MOVE_OFFSET );
683
688
}
684
689
if (ea.getKey () == ' 8' )
685
690
{
686
- _manip->pan ( 0 , -0.05 );
691
+ _manip->pan ( 0 , -MOVE_OFFSET );
687
692
}
688
693
// rotate
689
694
if (ea.getKey () == ' /' )
690
695
{
691
- _manip->rotate ( 0.05 , 0 );
696
+ _manip->rotate ( MOVE_OFFSET , 0 );
692
697
}
693
698
if (ea.getKey () == ' *' )
694
699
{
695
- _manip->rotate ( -0.05 , 0 );
700
+ _manip->rotate ( -MOVE_OFFSET , 0 );
696
701
}
697
702
// tilt
698
703
if ( ea.getKey () == ' 9' )
699
704
{
700
- _manip->rotate ( 0 , 0.05 );
705
+ _manip->rotate ( 0 , MOVE_OFFSET );
701
706
}
702
707
if (ea.getKey () == ' 3' )
703
708
{
704
- _manip->rotate ( 0 , -0.05 );
709
+ _manip->rotate ( 0 , -MOVE_OFFSET );
705
710
}
706
711
// zoom
707
712
if (ea.getKey () == ' -' )
708
713
{
709
- _manip->zoom ( 0 , 0.05 );
714
+ _manip->zoom ( 0 , MOVE_OFFSET );
710
715
}
711
716
if (ea.getKey () == ' +' )
712
717
{
713
- _manip->zoom ( 0 , -0.05 );
718
+ _manip->zoom ( 0 , -MOVE_OFFSET );
714
719
}
715
720
// reset
716
721
if (ea.getKey () == ' 5' )
0 commit comments