27 #include "../../../../common/Config.h" 28 #include "../../../../core/logger/Logger.h" 29 #include "../../../../core/translator/Translator.h" 30 #include "../../../../srs/Config.h" 31 #include "../../../../dataaccess/dataset/DataSetType.h" 32 #include "../../../../dataaccess/datasource/DataSourceInfoManager.h" 33 #include "../../../../dataaccess/datasource/DataSourceManager.h" 34 #include "../../../../dataaccess/utils/Utils.h" 35 #include "../../../../maptools/AbstractLayer.h" 36 #include "../../../widgets/canvas/MultiThreadMapDisplay.h" 37 #include "../../../widgets/datasource/core/DataSourceTypeManager.h" 38 #include "../../../widgets/layer/explorer/LayerItemView.h" 39 #include "../../../widgets/Utils.h" 40 #include "../../../af/ApplicationController.h" 41 #include "../../../af/BaseApplication.h" 42 #include "../../../af/Utils.h" 43 #include "../../../af/events/ApplicationEvents.h" 50 #include <ogrsf_frmts.h> 55 #include <QApplication> 56 #include <QFileDialog> 58 #include <QMessageBox> 63 if(type.compare(
"ESRI Shapefile") == 0)
64 return QObject::tr(
"ESRI Shapefile (*.shp *.SHP)");
65 else if(type.compare(
"MapInfo File") == 0)
66 return QObject::tr(
"MapInfo File (*.mif *.MIF)");
67 else if(type.compare(
"DGN") == 0)
68 return QObject::tr(
"DGN File (*.dgn *.DGN)");
69 else if(type.compare(
"CSV") == 0)
70 return QObject::tr(
"CSV File (*.csv *.CSV)");
71 else if(type.compare(
"GML") == 0)
72 return QObject::tr(
"GML File (*.gml *.GML)");
73 else if(type.compare(
"KML") == 0)
74 return QObject::tr(
"KML File (*.kml *.KML)");
75 else if(type.compare(
"GeoJSON") == 0)
76 return QObject::tr(
"GeoJSON File (*.geojson *.GEOJSON)");
77 else if(type.compare(
"DXF") == 0)
78 return QObject::tr(
"DXF File (*.dxf *.DXF)");
86 GDALDriverManager mger;
88 int count = mger.GetDriverCount();
90 for(
int i=0; i<count; i++)
92 std::string dName = mger.GetDriver(i)->GetDescription();
106 te::core::CppPlugin(pluginInfo),
107 m_showWindow(nullptr),
108 m_handlerLayerExplorer(nullptr),
109 m_handlerMapDisplay(nullptr)
134 m_showWindow =
new QAction(QIcon::fromTheme(
"file-vector"), tr(
"Vector File..."),
this);
135 m_showWindow->setToolTip(tr(
"Add new vector file as a layer."));
136 m_showWindow->setObjectName(
"Project.Add Layer.Vector File");
190 if(fileNames.isEmpty())
193 QFileInfo
info(fileNames.value(0));
197 std::list<te::map::AbstractLayerPtr> layers;
void startup()
This method will be called by applications to startup some plugin's functionality.
te::qt::plugins::ogr::GeoFileDragAndDropHandler * m_handlerMapDisplay
QString GetFileExtensionName(const std::string &type)
QList< QAction * > m_actions
void shutdown()
This method will be called by applicatons to shutdown plugin's functionality.
Basic information about a plugin.
void CreateLayers(QStringList fileNames, std::list< te::map::AbstractLayerPtr > &layers)
#define TE_TR(message)
It marks a string in order to get translated.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
te::qt::widgets::LayerItemView * getLayerExplorer()
Utility functions for the data access module.
QString GetSupportedFiles()
#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...
Plugin(const te::core::PluginInfo &pluginInfo)
const PluginInfo & info() const
It returns the PluginInfo of the CppPlugin.
A class used to handle geofile drag and drop events.
te::qt::widgets::MapDisplay * getMapDisplay()
#define TE_LOG_TRACE(message)
Use this tag in order to log a message to the TerraLib default logger with the TRACE level...
te::qt::plugins::ogr::GeoFileDragAndDropHandler * m_handlerLayerExplorer
Plugin implementation for the OGR data source widget.
void triggered(te::qt::af::evt::Event *e)