src/terralib/qt/plugins/mnt/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/mnt/Plugin.cpp
22 
23  \brief Plugin implementation for the MNT Qt Plugin widget.
24 */
25 
26 // TerraLib
27 #include "../../../common/Config.h"
28 #include "../../../core/translator/Translator.h"
29 #include "../../../core/logger/Logger.h"
30 #include "../../af/ApplicationController.h"
31 #include "../../af/Utils.h"
32 #include "CreateIsolinesAction.h"
33 #include "ImageGenerationAction.h"
34 #include "MNTGenerationAction.h"
35 #include "ShowValuesAction.h"
36 #include "SlopeAction.h"
37 #include "SmoothAction.h"
38 #include "TINGenerationAction.h"
39 #include "VolumeAction.h"
40 #include "ProfileAction.h"
41 
42 #include "Plugin.h"
43 
44 // QT
45 #include <QMenu>
46 #include <QMenuBar>
47 #include <QString>
48 
49 // STL
50 #include <string>
51 
52 
54 : te::core::CppPlugin(pluginInfo),
55 m_mntMenu(nullptr),
56 m_ISOGeneration(nullptr),
57 m_MNTGeneration(nullptr),
58 m_ImageGeneration(nullptr),
59 m_ShowValue(nullptr),
60 m_Slope(nullptr),
61 m_Smooth(nullptr),
62 m_TINGeneration(nullptr),
63 m_Volume(nullptr),
64 m_Profile(nullptr)
65 {
66 }
67 
69 
71 {
72  if(m_initialized)
73  return;
74 
75 // it initializes the Translator support for the TerraLib MNT Qt Plugin
76  TE_LOG_TRACE(TE_TR("TerraLib Qt DTM Plugin startup!"));
77 
78 // add plugin menu
79  QMenu* pluginMenu = te::qt::af::AppCtrlSingleton::getInstance().getMenu("Processing");
80  m_mntMenu = new QMenu(pluginMenu);
81  m_mntMenu->setIcon(QIcon::fromTheme("mnt-processing-icon"));
82 
83  // Insert action before plugin manager action
84  QAction* pluginsSeparator = te::qt::af::AppCtrlSingleton::getInstance().findAction("ManagePluginsSeparator");
85 
86  pluginMenu->insertMenu(pluginsSeparator, m_mntMenu);
87 
88  m_mntMenu->setTitle(tr("DTM Processing"));
89 
90 // register actions
92 
93  m_initialized = true;
94 
96 }
97 
99 {
100  if(!m_initialized)
101  return;
102 
103 // remove menu
104  delete m_mntMenu;
105 
106 // unregister actions
108 
109  TE_LOG_TRACE(TE_TR("TerraLib Qt DTM Plugin shutdown!"));
110 
111  m_initialized = false;
112 
113  te::qt::af::AppCtrlSingleton::getInstance().removeListener(this);
114 }
115 
117 {
121 
123  connect(m_MNTGeneration, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
125 
127  connect(m_ISOGeneration, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
129 
131  connect(m_Smooth, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
133 
135  connect(m_Slope, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
137 
139  connect(m_ImageGeneration, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
141 
143  connect(m_Volume, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
145 
147  connect(m_Profile, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
149 
151  connect(m_ShowValue, SIGNAL(triggered(te::qt::af::evt::Event*)), SIGNAL(triggered(te::qt::af::evt::Event*)));
153 }
154 
156 {
157  delete m_TINGeneration;
158  delete m_MNTGeneration;
159  delete m_ISOGeneration;
160  delete m_Slope;
161  delete m_Smooth;
162  delete m_ShowValue;
163  delete m_Volume;
164  delete m_Profile;
165 }
166 
168 
void startup()
This method will be called by applications to startup some plugin&#39;s functionality.
This file defines the Profile Generation class.
TEQTAFEXPORT void AddActionToCustomToolbars(te::qt::af::ApplicationController *appController, QAction *act)
Check QSettings for existance of act and adds it if necessary.
void shutdown()
This method will be called by applicatons to shutdown plugin&#39;s functionality.
A base class for application events.
Plugin implementation for the MNT Qt Plugin widget.
Basic information about a plugin.
void triggered(te::qt::af::evt::Event *e)
This class register the smooth action into MNT Plugin.
Definition: SmoothAction.h:47
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
This file defines the Slope Proccess.
This class register the regular grid generation action into MNT Plugin.
MNTGenerationAction * m_MNTGeneration
GRID Generation Action.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
This file defines the TIN Generation class.
This file defines the Smooth Isoline Proccess.
This file defines the Show MNT Values Proccess.
ImageGenerationAction * m_ImageGeneration
Image Generation Action.
URI C++ Library.
Definition: Attributes.h:37
This file defines the REgular Grid Generation class.
CreateIsolinesAction * m_ISOGeneration
Isoline Generation Action.
QMenu * m_mntMenu
MNT Main Menu registered.
#define TERRALIB_PLUGIN_CALL_BACK_IMPL(PLUGIN_CLASS_NAME)
This macro should be used by C++ plugins in order to declare the exportable/callable DLL function...
SmoothAction * m_Smooth
Smooth Isolines Action.
This class register the isolines generation action into MNT Plugin.
Definition: ProfileAction.h:52
This class register the isolines generation action into MNT Plugin.
Plugin(const te::core::PluginInfo &pluginInfo)
This class register the Triangular Grid generation action into MNT Plugin.
This class register the calculate volume action into MNT Plugin.
Definition: VolumeAction.h:51
This file defines the REgular Grid Generation class.
This file defines the Calculate Volume Proccess.
This class register the slope action into MNT Plugin.
Definition: SlopeAction.h:47
#define TE_LOG_TRACE(message)
Use this tag in order to log a message to the TerraLib default logger with the TRACE level...
Definition: Logger.h:293
This file defines the Isolines Generation class.
void registerActions()
Function used to register all raster processing actions.
TINGenerationAction * m_TINGeneration
TIN Generation Action.
This class register the image generation action into MNT Plugin.
This class register the show values action into MNT Plugin.
void unRegisterActions()
Function used to unregister all raster processing actions.
SlopeAction * m_Slope
Slope Generation Action.