27 #include "../../../../common/Config.h"
28 #include "../../../../common/Translator.h"
29 #include "../../../../common/Logger.h"
31 #include "../../../../dataaccess/dataset/DataSetType.h"
32 #include "../../../../dataaccess/datasource/DataSourceInfoManager.h"
33 #include "../../../../dataaccess/datasource/DataSourceManager.h"
35 #include "../../../../dataaccess/datasource/DataSourceCapabilities.h"
36 #include "../../../../maptools/AbstractLayer.h"
37 #include "../../../widgets/datasource/core/DataSourceTypeManager.h"
38 #include "../../../widgets/layer/utils/DataSet2Layer.h"
39 #include "../../../widgets/Utils.h"
41 #include "../../../af/ApplicationController.h"
42 #include "../../../af/Project.h"
43 #include "../../../af/Utils.h"
44 #include "../../../af/events/LayerEvents.h"
48 #include "../../../../cellspace/CellSpaceOperations.h"
51 #include <boost/uuid/random_generator.hpp>
52 #include <boost/uuid/uuid_io.hpp>
53 #include <boost/filesystem.hpp>
57 #include <QFileDialog>
60 #include <QMessageBox>
64 std::list<te::da::DataSetTypePtr> res;
68 std::vector<std::string> dsets = ds->getDataSetNames();
70 std::vector<std::string>::iterator it;
72 for(it = dsets.begin(); it != dsets.end(); ++it)
80 std::list<te::map::AbstractLayerPtr> res;
107 m_initialized =
true;
113 if(act != 0 && mnu != 0)
115 QWidget* parent = act->parentWidget();
116 m_openFile =
new QAction(QIcon::fromTheme(
"file-raster"), tr(
"Raster File..."), parent);
117 m_openFile->setObjectName(
"Project.Add Layer.Raster File");
118 mnu->insertAction(act, m_openFile);
123 connect (m_openFile, SIGNAL(triggered()), SLOT(openFileDialog()));
137 m_initialized =
false;
152 QStringList fileNames = QFileDialog::getOpenFileNames(
157 if(fileNames.isEmpty())
160 QFileInfo info(fileNames.value(0));
164 std::list<te::map::AbstractLayerPtr> layers;
166 for(QStringList::iterator it = fileNames.begin(); it != fileNames.end(); ++it)
170 ds->setAccessDriver(
"GDAL");
172 std::map<std::string, std::string> dsinfo;
173 dsinfo[
"URI"] = it->toLatin1().data();
175 ds->setConnInfo(dsinfo);
177 ds->setDescription(
"A single raster file");
179 boost::uuids::basic_random_generator<boost::mt19937> gen;
180 boost::uuids::uuid u = gen();
181 std::string
id = boost::uuids::to_string(u);
185 boost::filesystem::path mpath(it->toStdString());
187 std::string fileBaseName = mpath.stem().string();
189 ds->setTitle(fileBaseName);
205 if(selectedLayers.size() == 1 && selectedLayers.front()->getType() ==
"FOLDERLAYER")
206 parentLayer = selectedLayers.front();
208 std::list<te::map::AbstractLayerPtr>::iterator it;
209 for(it = layers.begin(); it != layers.end(); ++it)
#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.
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
Plugin(const te::plugin::PluginInfo &pluginInfo)
void startup()
Do nothing! Just set plugin as started.
void GetLayers(const te::da::DataSourceInfoPtr &info, std::list< te::map::AbstractLayerPtr > &layers)
#define TE_TR(message)
It marks a string in order to get translated.
#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.
Plugin implementation for the GDAL data source widget.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
~Plugin()
Virtual destructor.
void shutdown()
Do nothing! Just set plugin as stopped.
This class models the concept of a project for the TerraLib Application Framework.
A class that represents a data source component.
The basic information about a plugin.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::list< te::da::DataSetTypePtr > GetDataSetsInfo(const te::da::DataSourceInfoPtr &info)
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr