/usr/include/rviz/tool.h is in librviz-dev 1.11.10+dfsg-1build1.
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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /*
* Copyright (c) 2012, Willow Garage, Inc.
* 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 the name of the Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 COPYRIGHT OWNER 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.
*/
#ifndef RVIZ_TOOL_H
#define RVIZ_TOOL_H
#include <QString>
#include <QIcon>
#include <QCursor>
#include <QObject>
#include "rviz/config.h"
class QMouseEvent;
class QKeyEvent;
namespace Ogre
{
class SceneManager;
}
namespace rviz
{
class DisplayContext;
class Property;
class RenderPanel;
class ViewportMouseEvent;
class Tool : public QObject
{
Q_OBJECT
public:
/** Default constructor. Pluginlib only instantiates classes via
* default constructors. Subclasses of Tool should shortcut_key_
* field in their constructors.
*
* Properties to appear in the Tool Properties panel are typically
* created in the constructor, as children of the property from
* getPropertyContainer(), which is set up in this Tool
* constructor. */
Tool();
virtual ~Tool();
/** Initialize the tool. Sets the DisplayContext and calls
* onInitialize(). */
void initialize( DisplayContext* context );
/** @brief Return the container for properties of this Tool. */
virtual Property* getPropertyContainer() const { return property_container_; }
char getShortcutKey() { return shortcut_key_; }
bool accessAllKeys() { return access_all_keys_; }
virtual void activate() = 0;
virtual void deactivate() = 0;
virtual void update(float wall_dt, float ros_dt) {}
enum {
Render = 1,
Finished = 2
};
/** Process a mouse event. This is the central function of all the
* tools, as it defines how the mouse is used. */
virtual int processMouseEvent( ViewportMouseEvent& event ) { return 0; }
/** Process a key event. Override if your tool should handle any
other keypresses than the tool shortcuts, which are handled
separately. */
virtual int processKeyEvent( QKeyEvent* event, RenderPanel* panel ) { return 0; }
QString getName() const { return name_; }
/** @brief Set the name of the tool.
*
* This is called by ToolManager during tool initialization. If you
* want a different name than it gives you, call this from
* onInitialize() (or thereafter). */
void setName( const QString& name );
/** @brief Set the description of the tool. This is called by
* ToolManager during tool initialization. */
QString getDescription() const { return description_; }
void setDescription( const QString& description );
/** @brief Return the class identifier which was used to create this
* instance. This version just returns whatever was set with
* setClassId(). */
virtual QString getClassId() const { return class_id_; }
/** @brief Set the class identifier used to create this instance.
* Typically this will be set by the factory object which created it. */
virtual void setClassId( const QString& class_id ) { class_id_ = class_id; }
/** @brief Load properties from the given Config.
*
* Most tools won't need to override this, because any child
* Properties of property_container_ are automatically loaded by
* this function. */
virtual void load( const Config& config );
/** @brief Save this entire tool into the given Config node.
*
* Most tools won't need to override this, because any child
* Properties of property_container_ are automatically saved by
* this function. */
virtual void save( Config config ) const;
/** @brief Set the toolbar icon for this tool (will also set its cursor). */
void setIcon( const QIcon& icon );
/** @brief Get the icon of this tool. */
const QIcon& getIcon() { return icon_; }
/** @brief Set the cursor for this tool. */
void setCursor( const QCursor& cursor );
/** @brief Get current cursor of this tool. */
const QCursor& getCursor() { return cursor_; }
void setStatus( const QString & message );
protected:
/** Override onInitialize to do any setup needed after the
DisplayContext has been set. This is called by
Tool::initialize(). The base implementation here does
nothing. */
virtual void onInitialize() {}
Ogre::SceneManager* scene_manager_;
DisplayContext* context_;
char shortcut_key_;
bool access_all_keys_;
QIcon icon_;
QCursor cursor_;
private:
QString class_id_;
Property* property_container_;
QString name_;
QString description_;
};
}
#endif
|