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 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/cellspace/Plugin.cpp
22 
23  \brief Plugin implementation for the Cellular Spaces 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 "CreateCellLayerAction.h"
33 #include "Plugin.h"
34 
35 // QT
36 #include <QMenu>
37 #include <QMenuBar>
38 
40  : te::plugin::Plugin(pluginInfo), m_cellSpaceMenu(0)
41 {
42 }
43 
45 {
46 }
47 
49 {
50  if(m_initialized)
51  return;
52 
53  TE_LOG_TRACE(TE_TR("TerraLib Qt Cellular Spaces Plugin startup!"));
54 
55 // add plugin menu
56  QMenu* pluginMenu = te::qt::af::ApplicationController::getInstance().getMenu("Processing");
57  m_cellSpaceMenu = new QMenu(pluginMenu);
58 
59  // Insert action before plugin manager action
60  QAction* pluginsSeparator = te::qt::af::ApplicationController::getInstance().findAction("ManagePluginsSeparator");
61 
62  pluginMenu->insertMenu(pluginsSeparator, m_cellSpaceMenu);
63 
64  m_cellSpaceMenu->setTitle(TE_TR("Cellular Spaces"));
65  m_cellSpaceMenu->setIcon(QIcon::fromTheme("cellspace"));
66 
67  // register actions
68  registerActions();
69 
70 // add pop up menu
71  m_popupAction = new QAction(m_cellSpaceMenu);
72  m_popupAction->setText(TE_TR("Cellular Spaces"));
73 
74  m_initialized = true;
75 }
76 
78 {
79  if(!m_initialized)
80  return;
81 
82 // remove menu
83  delete m_cellSpaceMenu;
84 
85  // unregister actions
86  unRegisterActions();
87 
88  TE_LOG_TRACE(TE_TR("TerraLib Qt Cellular Spaces Plugin shutdown!"));
89 
90  m_initialized = false;
91 }
92 
94 {
95  m_createCellLayer = new te::qt::plugins::cellspace::CreateCellLayerAction(m_cellSpaceMenu);
96 }
97 
99 {
100  delete m_createCellLayer;
101 }
102 
#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:137
Plugin implementation for the SA Qt Plugin widget.
void startup()
Do nothing! Just set plugin as started.
Definition: Plugin.cpp:48
void unRegisterActions()
Function used to unregister all raster processing actions.
Definition: Plugin.cpp:98
This class register the contrast action into Cellular Space Plugin.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:347
~Plugin()
Virtual destructor.
Definition: Plugin.cpp:44
#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.
void shutdown()
Do nothing! Just set plugin as stopped.
Definition: Plugin.cpp:77
void registerActions()
Function used to register all raster processing actions.
Definition: Plugin.cpp:93
The basic information about a plugin.
Definition: PluginInfo.h:61
Plugin(const te::plugin::PluginInfo &pluginInfo)
Definition: Plugin.cpp:39