/usr/include/osgEarthQt/Actions is in libosgearth-dev 2.5.0+dfsg-2+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2013 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTHQT_ACTIONS_H
#define OSGEARTHQT_ACTIONS_H 1
#include <osgEarthQt/Common>
#include <list>
namespace osgEarth { namespace QtGui
{
class DataManager;
/**
* Base class for an Action, which is a (potentially reversible) operation
* handled by the ActionManager.
*/
class OSGEARTHQT_EXPORT Action : public osg::Referenced
{
public:
virtual bool doAction( void* sender, DataManager* manager ) =0;
void cancel() {
_canceled = true; }
bool isOK() const {
return _message.empty(); }
bool isCanceled() const {
return _canceled; }
bool isCheckpoint() const {
return _checkpoint; }
bool setError( const std::string& message ) {
_message = message;
return false; }
virtual bool isReversible() const {
return false; }
ViewVector& getViews() {
return _views; }
protected:
Action()
: _canceled(false), _checkpoint(true) { }
Action(ViewVector& views)
: _views(views), _canceled(false), _checkpoint(true) { }
virtual ~Action() { }
ViewVector _views;
bool _canceled;
bool _checkpoint;
std::string _message;
};
/**
* An action that can be undone.
*/
class OSGEARTHQT_EXPORT ReversibleAction : public Action
{
public:
virtual bool undoAction( void* sender, DataManager* app ) =0;
bool isReversible() const {
return true; }
protected:
ReversibleAction() : Action() { _checkpoint = true; }
ReversibleAction(ViewVector& views) : Action(views) { _checkpoint = true; }
virtual ~ReversibleAction() { }
};
/**
* Callback that fires before or after the ActionManager runs an Action.
*/
class OSGEARTHQT_EXPORT ActionCallback : public osg::Referenced
{
public:
virtual void operator()( void* sender, Action* action ) { }
protected:
ActionCallback() { }
virtual ~ActionCallback() { }
};
/**
* Interface for an Action Manager, an object that can run Actions, fire callbacks,
* and maintain an undo stack.
*/
class OSGEARTHQT_EXPORT ActionManager
{
public:
virtual void addBeforeActionCallback( ActionCallback* cb ) =0;
virtual void addAfterActionCallback( ActionCallback* cb ) =0;
virtual bool doAction( void* sender, Action* action, bool reversible =true ) =0;
virtual bool undoAction() =0;
virtual bool canUndo() const =0;
virtual void clearUndoActions() =0;
virtual ReversibleAction* getNextUndoAction() const =0;
virtual ~ActionManager() { }
};
} }
#endif // OSGEARTHQT_ACTIONS_H
|