Developer Documentation

TypeCamera.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 #pragma once
43
44 #include <QObject>
45 #include <QMenu>
46 #include <QAction>
47
48 #include <OpenFlipper/common/Types.hh>
49 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
50 #include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
51 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
52 #include <OpenFlipper/BasePlugin/TypeInterface.hh>
53 #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
54
55 #include <ObjectTypes/Camera/Camera.hh>
56
57 class TypeCameraPlugin : public QObject, BaseInterface, LoadSaveInterface, LoggingInterface, TypeInterface, ContextMenuInterface
58 {
59 Q_OBJECT
60 Q_INTERFACES(BaseInterface)
61 Q_INTERFACES(LoadSaveInterface)
62 Q_INTERFACES(LoggingInterface)
63 Q_INTERFACES(TypeInterface)
64 Q_INTERFACES(ContextMenuInterface)
65
66 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-TypeCamera")
67
68 signals:
69 // Logging interface
70 void log(Logtype _type, QString _message);
71 void log(QString _message);
72
73 // LoadSave Interface
74 void emptyObjectAdded( int _id );
75
76 // ContextMenuInterface
77 void addContextMenuItem(QAction* _action , ContextMenuType _type);
78 void addContextMenuItem(QAction* _action , DataType _objectType , ContextMenuType _type );
79
80 private slots:
81
82 void noguiSupported( ) {} ;
83
84 // BaseInterface
85 void pluginsInitialized();
86
87 // ContextMenuInterface
88 void slotUpdateContextMenu( int _objectId );
89
90 public :
91
92 ~TypeCameraPlugin() {};
93 TypeCameraPlugin();
94
95 QString name() { return (QString("TypeCamera")); };
96 QString description( ) { return (QString(tr("Register Camera type"))); };
97
98 bool registerType();
99
100 public slots:
101
102 // Base Interface
103 QString version() { return QString("1.0"); };
104
105 // Type Interface
106 int addEmpty();
107 DataType supportedType() { return DATA_CAMERA; };
108
109 private slots:
110 void contextMenuClicked(QAction* _contextAction);
111
112 private:
113
114 QMenu* contextMenu_;
115 QAction* showFrustumAction_;
116
117 };
ContextMenuInterface
Interface class for creating custom context menus.
Definition: ContextMenuInterface.hh:85
TypeCameraPlugin::supportedType
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: TypeCamera.hh:107
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
LoadSaveInterface
Interface for all plugins which want to Load or Save files and create Objects.
Definition: LoadSaveInterface.hh:59
TypeCameraPlugin::name
QString name()
Return a name for the plugin.
Definition: TypeCamera.hh:95
TypeCameraPlugin::addEmpty
int addEmpty()
Create an empty object.
Definition: TypeCamera.cc:142
LoggingInterface.hh
TypeCameraPlugin
Definition: TypeCamera.hh:57
TypeInterface
Interface class for type definitions.
Definition: TypeInterface.hh:63
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
DATA_CAMERA
#define DATA_CAMERA
Definition: Camera.hh:67
BaseInterface.hh
ContextMenuInterface.hh
LoadSaveInterface.hh
TypeCameraPlugin::pluginsInitialized
void pluginsInitialized()
Initialize Plugin step 2.
Definition: TypeCamera.cc:62
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
TypeCameraPlugin::slotUpdateContextMenu
void slotUpdateContextMenu(int _objectId)
Definition: TypeCamera.cc:84
TypeInterface.hh
Types.hh
DataType
Predefined datatypes.
Definition: DataTypes.hh:83
TypeCameraPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: TypeCamera.hh:96
Camera.hh
ContextMenuType
ContextMenuType
Definition: ContextMenuInterface.hh:56