27 #include "../../../common/SystemApplicationSettings.h" 28 #include "../../../common/Exception.h" 29 #include "../../../core/translator/Translator.h" 30 #include "../../../dataaccess/dataset/DataSetType.h" 31 #include "../../../dataaccess/datasource/DataSource.h" 32 #include "../../../dataaccess/datasource/DataSourceFactory.h" 33 #include "../../../dataaccess/datasource/DataSourceInfoManager.h" 34 #include "../../../dataaccess/datasource/DataSourceManager.h" 35 #include "../../../dataaccess/utils/Utils.h" 36 #include "../../../maptools/Utils.h" 37 #include "../../../raster/Grid.h" 38 #include "../../../raster/Interpolator.h" 39 #include "../layer/utils/DataSet2Layer.h" 43 #include <boost/uuid/random_generator.hpp> 44 #include <boost/uuid/uuid_io.hpp> 47 #include <QMessageBox> 48 #include <QApplication> 56 static boost::uuids::basic_random_generator<boost::mt19937> gen;
58 boost::uuids::uuid valU = gen();
59 std::string
id = boost::uuids::to_string(valU);
64 std::vector<std::string> dsNames = ds->getDataSetNames();
65 assert(!dsNames.empty());
69 dsInfoPtr->setConnInfo(connInfo);
71 dsInfoPtr->setTitle(dsNames[0]);
72 dsInfoPtr->setAccessDriver(driverName);
73 dsInfoPtr->setType(driverName);
81 dsPtr->setId(dsInfoPtr->getId());
100 const std::string& connInfo)
107 const std::map<std::string, std::string>& connInfo)
111 static boost::uuids::basic_random_generator<boost::mt19937> gen;
113 boost::uuids::uuid valU = gen();
114 std::string
id = boost::uuids::to_string(valU);
117 std::string connStr(
"file://");
119 std::map<std::string, std::string>::const_iterator it = connInfo.begin();
120 std::map<std::string, std::string>::const_iterator itend = connInfo.end();
126 if (it->first ==
"URI" || it->first ==
"SOURCE")
128 connStr += it->second;
137 connStr += it->first +
"=" + it->second +
"&";
145 std::vector<std::string> dsNames = ds->getDataSetNames();
146 assert(!dsNames.empty());
150 dsInfoPtr->setConnInfo(connStr);
151 dsInfoPtr->setId(
id);
152 dsInfoPtr->setTitle(dsNames[0]);
153 dsInfoPtr->setAccessDriver(driverName);
154 dsInfoPtr->setType(driverName);
162 dsPtr->setId(dsInfoPtr->getId());
175 layer = ds2l(dsType);
186 reprojectedBBOX.
transform(displaySRID, layer->getSRID());
190 std::unique_ptr<te::da::DataSet>
ds(layer->getData());
192 std::unique_ptr<te::rst::Raster> inputRst =
ds->getRaster(rpos);
197 int w = (
int)endGrid.
x - (
int)startGrid.
x;
198 int h = (
int)startGrid.
y - (
int)endGrid.
y;
207 QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::instance()->organizationName(), QApplication::instance()->applicationName());
209 int interpolatorValue = settings.value(
"raster_config/default_interpolator",
211 int level = settings.value(
"raster_config/default_level",
214 bool question = settings.value(
"raster_config/default_question",
217 bool option = settings.value(
"raster_config/default_option",
225 int addMultiResolution = QMessageBox::question(
nullptr, toolName,
226 TE_TR(
"Would you like to add multi resolution on output layer?"),
227 QMessageBox::Yes | QMessageBox::No);
229 if(addMultiResolution == QMessageBox::Yes)
237 QMessageBox::warning(
nullptr, toolName,
TE_TR(
"Error creating multi resolution."));
240 QMessageBox::information(
nullptr,
TE_TR(
"Information"),
TE_TR(
"Multi resolution created."));
252 QMessageBox::warning(
nullptr, toolName,
TE_TR(
"Error creating multi resolution."));
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
virtual bool createMultiResolution(const unsigned int levels, const InterpolationMethod interpMethod)=0
Create a sub-sampled multi-resolution pyramid.
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
An utility struct for representing 2D coordinates.
static te::dt::Date ds(2010, 01, 01)
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
#define TE_TR(message)
It marks a string in order to get translated.
InterpolationMethod
Allowed interpolation methods.
InterpolationMethod Method
Allowed interpolation methods.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
Utility functions for the data access module.
A class for representing an Uniform Resource Identifier (URI).
te::map::DataSetLayerPtr createLayer(te::da::DataSourcePtr source, te::da::DataSetTypePtr &dataset)
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
TEMAPEXPORT te::rst::Raster * GetExtentRaster(te::rst::Raster *raster, int w, int h, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid)
A class that represents a data source component.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr