All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Plugin.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/plugins/rp/Plugin.cpp
22 
23  \brief Plugin implementation for the RP Qt Plugin widget.
24 */
25 
26 // TerraLib
27 #include "../../../common/Config.h"
28 #include "../../../common/Translator.h"
29 #include "../../../common/Logger.h"
30 #include "../../af/ApplicationController.h"
31 #include "../../af/events/LayerEvents.h"
32 #include "Plugin.h"
33 
34 #ifdef TE_QT_PLUGIN_RP_HAVE_ARITHMETICOP
35  #include "ArithmeticOpAction.h"
36 #endif
37 
38 #ifdef TE_QT_PLUGIN_RP_HAVE_CLASSIFIER
39  #include "ClassifierAction.h"
40 #endif
41 
42 #ifdef TE_QT_PLUGIN_RP_HAVE_CLIPPING
43  #include "ClippingAction.h"
44 #endif
45 
46 #ifdef TE_QT_PLUGIN_RP_HAVE_COLORTRANSFORM
47  #include "ColorTransformAction.h"
48 #endif
49 
50 #ifdef TE_QT_PLUGIN_RP_HAVE_CONTRAST
51  #include "ContrastAction.h"
52 #endif
53 
54 #ifdef TE_QT_PLUGIN_RP_HAVE_FILTER
55  #include "FilterAction.h"
56 #endif
57 
58 #ifdef TE_QT_PLUGIN_RP_HAVE_FUSION
59  #include "FusionAction.h"
60 #endif
61 
62 #ifdef TE_QT_PLUGIN_RP_HAVE_MIXTUREMODEL
63  #include "MixtureModelAction.h"
64 #endif
65 
66 #ifdef TE_QT_PLUGIN_RP_HAVE_MOSAIC
67  #include "MosaicAction.h"
68 #endif
69 
70 #ifdef TE_QT_PLUGIN_RP_HAVE_SEGMENTER
71  #include "SegmenterAction.h"
72 #endif
73 
74 #ifdef TE_QT_PLUGIN_RP_HAVE_REGISTER
75  #include "RegisterAction.h"
76 #endif
77 
78 #ifdef TE_QT_PLUGIN_RP_HAVE_VECTORIZATION
79  #include "VectorizationAction.h"
80 #endif
81 
82 // QT
83 #include <QMenu>
84 #include <QMenuBar>
85 
87  : te::plugin::Plugin(pluginInfo), m_rpMenu(0)
88 {
89 }
90 
92 {
93 }
94 
96 {
97  if(m_initialized)
98  return;
99 
100 // it initializes the Translator support for the TerraLib RP Qt Plugin
101  //TE_ADD_TEXT_DOMAIN(TE_QT_PLUGIN_RP_TEXT_DOMAIN, TE_QT_PLUGIN_RP_TEXT_DOMAIN_DIR, "UTF-8");
102 
103  TE_LOG_TRACE(TE_TR("TerraLib Qt RP Plugin startup!"));
104 
105 // add plugin menu
106  m_rpMenu = te::qt::af::ApplicationController::getInstance().getMenu("RP");
107 
108  m_rpMenu->setTitle(TE_TR("Raster Processing"));
109 
110 // add pop up menu
111  m_popupAction = new QAction(m_rpMenu);
112  m_popupAction->setText(TE_TR("Raster Processing"));
113 
114  //add to application layer tree pop up menu
115  //te::qt::af::evt::LayerPopUpAddAction evt(m_popupAction, "RASTER_LAYER_ITEM", 2 /*UNIQUE_ITEM_SELECTED*/);
116  //te::qt::af::ApplicationController::getInstance().broadcast(&evt);
117 
118  m_rpPopupMenu = new QMenu(m_rpMenu);
119  m_popupAction->setMenu(m_rpPopupMenu);
120 
121 // register actions
122  registerActions();
123 
124  m_initialized = true;
125 }
126 
128 {
129  if(!m_initialized)
130  return;
131 
132 //remove from application layer tree pop up menu
133  //te::qt::af::evt::LayerPopUpRemoveAction evt(m_popupAction);
134  //te::qt::af::ApplicationController::getInstance().broadcast(&evt);
135 
136 // remove menu
137  delete m_rpMenu;
138 
139 // unregister actions
140  unRegisterActions();
141 
142  TE_LOG_TRACE(TE_TR("TerraLib Qt RP Plugin shutdown!"));
143 
144  m_initialized = false;
145 }
146 
148 {
149 #ifdef TE_QT_PLUGIN_RP_HAVE_ARITHMETICOP
150  m_arithmeticOp = new te::qt::plugins::rp::ArithmeticOpAction(m_rpMenu, m_rpPopupMenu);
151 #endif
152 
153 #ifdef TE_QT_PLUGIN_RP_HAVE_CLASSIFIER
154  m_classifier = new te::qt::plugins::rp::ClassifierAction(m_rpMenu, m_rpPopupMenu);
155 #endif
156 
157 #ifdef TE_QT_PLUGIN_RP_HAVE_CLIPPING
158  m_clipping = new te::qt::plugins::rp::ClippingAction(m_rpMenu, m_rpPopupMenu);
159 #endif
160 
161 #ifdef TE_QT_PLUGIN_RP_HAVE_COLORTRANSFORM
162  m_colorTrans = new te::qt::plugins::rp::ColorTransformAction(m_rpMenu, m_rpPopupMenu);
163 #endif
164 
165 #ifdef TE_QT_PLUGIN_RP_HAVE_CONTRAST
166  m_contrast = new te::qt::plugins::rp::ContrastAction(m_rpMenu, m_rpPopupMenu);
167 #endif
168 
169 #ifdef TE_QT_PLUGIN_RP_HAVE_FILTER
170  m_filter = new te::qt::plugins::rp::FilterAction(m_rpMenu, m_rpPopupMenu);
171 #endif
172 
173 #ifdef TE_QT_PLUGIN_RP_HAVE_FUSION
174  m_fusion = new te::qt::plugins::rp::FusionAction(m_rpMenu, m_rpPopupMenu);
175 #endif
176 
177 #ifdef TE_QT_PLUGIN_RP_HAVE_MIXTUREMODEL
178  m_mixtureModel = new te::qt::plugins::rp::MixtureModelAction(m_rpMenu, m_rpPopupMenu);
179 #endif
180 
181  #ifdef TE_QT_PLUGIN_RP_HAVE_MOSAIC
182  m_mosaic = new te::qt::plugins::rp::MosaicAction(m_rpMenu, m_rpPopupMenu);
183 #endif
184 
185 #ifdef TE_QT_PLUGIN_RP_HAVE_REGISTER
186  m_register = new te::qt::plugins::rp::RegisterAction(m_rpMenu, m_rpPopupMenu);
187 #endif
188 
189 #ifdef TE_QT_PLUGIN_RP_HAVE_SEGMENTER
190  m_segmenter = new te::qt::plugins::rp::SegmenterAction(m_rpMenu, m_rpPopupMenu);
191 #endif
192 
193 #ifdef TE_QT_PLUGIN_RP_HAVE_VECTORIZATION
194  m_vector = new te::qt::plugins::rp::VectorizationAction(m_rpMenu, m_rpPopupMenu);
195 #endif
196 }
197 
199 {
200 #ifdef TE_QT_PLUGIN_RP_HAVE_ARITHMETICOP
201  delete m_arithmeticOp;
202 #endif
203 
204 #ifdef TE_QT_PLUGIN_RP_HAVE_CLASSIFIER
205  delete m_classifier;
206 #endif
207 
208 #ifdef TE_QT_PLUGIN_RP_HAVE_CLIPPING
209  delete m_clipping;
210 #endif
211 
212 #ifdef TE_QT_PLUGIN_RP_HAVE_COLORTRANSFORM
213  delete m_colorTrans;
214 #endif
215 
216 #ifdef TE_QT_PLUGIN_RP_HAVE_CONTRAST
217  delete m_contrast;
218 #endif
219 
220 #ifdef TE_QT_PLUGIN_RP_HAVE_FILTER
221  delete m_filter;
222 #endif
223 
224 #ifdef TE_QT_PLUGIN_RP_HAVE_FUSION
225  delete m_fusion;
226 #endif
227 
228 #ifdef TE_QT_PLUGIN_RP_HAVE_MIXTUREMODEL
229  delete m_mixtureModel;
230 #endif
231 
232  #ifdef TE_QT_PLUGIN_RP_HAVE_MOSAIC
233  delete m_mosaic;
234 #endif
235 
236 #ifdef TE_QT_PLUGIN_RP_HAVE_REGISTER
237  delete m_register;
238 #endif
239 
240 #ifdef TE_QT_PLUGIN_RP_HAVE_SEGMENTER
241  delete m_segmenter;
242 #endif
243 
244 #ifdef TE_QT_PLUGIN_RP_HAVE_VECTORIZATION
245  delete m_vector;
246 #endif
247 }
248 
#define TE_LOG_TRACE(msg)
Use this tag in order to log a message to a specified logger with the TRACE level.
Definition: Logger.h:136
This file defines the mixture model class.
This file defines the Filter class.
This class register the arithmeticOp action into RP Plugin.
void unRegisterActions()
Function used to unregister all raster processing actions.
Definition: Plugin.cpp:198
This file defines the Segmenter class.
This file defines the Fusion class.
This file defines the Clipping class.
void startup()
Do nothing! Just set plugin as started.
Definition: Plugin.cpp:95
This class register the Segmenter action into RP Plugin.
Plugin implementation for the RP Qt Plugin widget.
This class register the register action into RP Plugin.
This file defines the Classifier class.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:345
This file defines the Mosaic class.
This class register the contrast action into RP Plugin.
This file defines the Contrast class.
#define PLUGIN_CALL_BACK_IMPL(PLUGIN_CLASS_NAME)
This macro should be used by C++ plugins in order to declare the exportable/callable DLL function...
Definition: Config.h:57
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
This class register the classifier action into RP Plugin.
This class register the mixture model action into RP Plugin.
Plugin(const te::plugin::PluginInfo &pluginInfo)
Definition: Plugin.cpp:86
~Plugin()
Virtual destructor.
Definition: Plugin.cpp:91
This class register the fusion action into RP Plugin.
Definition: FusionAction.h:47
This class register the mosaic action into RP Plugin.
Definition: MosaicAction.h:47
This class register the Clipping action into RP Plugin.
This class register the filter action into RP Plugin.
Definition: FilterAction.h:47
This file defines the ColorTransform class.
This class register the colorTransform action into RP Plugin.
The basic information about a plugin.
Definition: PluginInfo.h:61
This file defines the register action class.
This file defines the ArithmeticOp class.
void registerActions()
Function used to register all raster processing actions.
Definition: Plugin.cpp:147
void shutdown()
Do nothing! Just set plugin as stopped.
Definition: Plugin.cpp:127