27 #include "../../../BuildConfig.h"
28 #include "../../../addressgeocoding/qt/MainWindowDialog.h"
29 #include "../../../common/Config.h"
30 #include "../../../common/Translator.h"
31 #include "../../../common/Logger.h"
32 #include "../../af/ApplicationController.h"
33 #include "../../af/events/LayerEvents.h"
34 #include "../../af/Project.h"
35 #include "../../af/Utils.h"
38 #if defined(TERRALIB_APACHE_LOG4CXX_ENABLED) && defined(TERRALIB_LOGGER_ENABLED)
40 #include <log4cxx/basicconfigurator.h>
41 #include <log4cxx/consoleappender.h>
42 #include <log4cxx/fileappender.h>
43 #include <log4cxx/helpers/pool.h>
44 #include <log4cxx/helpers/transcoder.h>
45 #include <log4cxx/logger.h>
46 #include <log4cxx/logmanager.h>
47 #include <log4cxx/logstring.h>
48 #include <log4cxx/patternlayout.h>
49 #include <log4cxx/rollingfileappender.h>
50 #include <log4cxx/simplelayout.h>
55 #include <QtCore/QObject>
58 #include <QMessageBox>
79 m_action =
new QAction(pluginMenu);
80 m_action->setText(
"Address Geocoding...");
81 m_action->setIcon(QIcon::fromTheme(
"addressgeocoding-icon"));
82 m_action->setObjectName(
"Processing.Address Geocoding");
84 connect(m_action, SIGNAL(triggered(
bool)),
this, SLOT(onActionActivated(
bool)));
88 pluginMenu->insertAction(pluginsSeparator, m_action);
92 path +=
"/log/terralib_addressgeocoding.log";
94 #if defined(TERRALIB_APACHE_LOG4CXX_ENABLED) && defined(TERRALIB_LOGGER_ENABLED)
95 std::string layout =
"%d{ISO8601} [%t] %-5p %c - %m%n";
96 log4cxx::LogString lString(layout.begin(), layout.end());
98 log4cxx::FileAppender* fileAppender =
new log4cxx::RollingFileAppender(log4cxx::LayoutPtr(
new log4cxx::PatternLayout(lString)),
101 log4cxx::helpers::Pool p;
102 fileAppender->activateOptions(p);
104 log4cxx::BasicConfigurator::configure(log4cxx::AppenderPtr(fileAppender));
105 log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getDebug());
107 log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(
"addressgeocoding");
108 logger->setAdditivity(
false);
109 logger->addAppender(fileAppender);
114 m_initialized =
true;
125 #if defined(TERRALIB_APACHE_LOG4CXX_ENABLED) && defined(TERRALIB_LOGGER_ENABLED)
126 log4cxx::LogManager::shutdown();
131 m_initialized =
false;
147 if(dlg.exec() != QDialog::Accepted)
155 int reply = QMessageBox::question(0, tr(
"Address Geocoding Result"), tr(
"The operation was concluded successfully. Would you like to add the layer to the project?"), QMessageBox::No, QMessageBox::Yes);
157 if(prj && reply == QMessageBox::Yes)
167 std::list<te::map::AbstractLayerPtr> list;
#define TE_LOG_TRACE(msg)
Use this tag in order to log a message to a specified logger with the TRACE level.
This event signals that a new layer was created.
std::list< te::map::AbstractLayerPtr > getLayers()
Get the list of layers from app.
void startup()
Do nothing! Just set plugin as started.
#define TE_TR(message)
It marks a string in order to get translated.
std::list< te::map::AbstractLayerPtr > getAllLayers(bool invalid=true)
It gets all the layers (single and folder layers) of the project.
#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...
TEQTAFEXPORT void AddActionToCustomToolbars(QAction *act)
Check QSettings for existance of act and adds it if necessary.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
std::list< te::map::AbstractLayerPtr > getSingleLayers(bool invalid=true)
It gets all the single layers of the project.
Plugin implementation for the SA Qt Plugin widget.
Plugin(const te::plugin::PluginInfo &pluginInfo)
bool decode(std::string &s)
Decode the pct-encoded (hex) sequences, if any, return success.
void unRegisterActions()
Function used to unregister all addressgeocoding actions.
This class models the concept of a project for the TerraLib Application Framework.
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used.
te::map::AbstractLayerPtr getLayer()
Get the generated layer.
void onActionActivated(bool checked)
Slot function used when a action was selected.
~Plugin()
Virtual destructor.
The basic information about a plugin.
void shutdown()
Do nothing! Just set plugin as stopped.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr