27 #include "../common/Exception.h" 28 #include "../common/StringUtils.h" 29 #include "../core/encoding/CharEncoding.h" 30 #include "../core/translator/Translator.h" 31 #include "../core/uri/URI.h" 32 #include "../core/uri/Utils.h" 33 #include "../dataaccess/dataset/DataSetType.h" 34 #include "../datatype/NumericProperty.h" 35 #include "../datatype/Property.h" 36 #include "../datatype/StringProperty.h" 37 #include "../geometry/Enums.h" 38 #include "../geometry/Envelope.h" 39 #include "../geometry/GeometryProperty.h" 40 #include "../raster/BandProperty.h" 41 #include "../raster/Grid.h" 42 #include "../raster/RasterProperty.h" 46 #include <terralib4/kernel/TeBox.h> 47 #include <terralib4/kernel/TeDatabaseFactoryParams.h> 48 #include <terralib4/kernel/TeDecoderDatabase.h> 49 #include <terralib4/kernel/TeProjection.h> 50 #include <terralib4/kernel/TeTable.h> 51 #include <terralib4/kernel/TeRasterParams.h> 54 #include <boost/lexical_cast.hpp> 58 std::string* defaultValue = attRep.defaultValue_.empty() ? 0 :
new std::string(attRep.defaultValue_);
60 bool isRequired = !attRep.null_;
62 std::string attrRepNameUtf8 =
Convert2Utf8(attRep.name_);
70 if(attRep.numChar_ == 0)
114 case TePOLYGONSETTYPE:
141 std::map<std::string, std::string>::const_iterator it = kvp.begin();
142 std::map<std::string, std::string>::const_iterator itend = kvp.end();
144 std::unique_ptr<TeDatabaseFactoryParams> fparams(
new TeDatabaseFactoryParams());
191 case TePOLYGONSETTYPE:
232 case TePOLYGONSETTYPE:
274 case TeUNSIGNEDSHORT:
328 return TeUNSIGNEDINT;
353 return TePOLYGONTYPE;
356 return TePOINTSETTYPE;
359 return TeLINESETTYPE;
362 return TePOLYGONSETTYPE;
371 std::unique_ptr<te::gm::Envelope> env(
new te::gm::Envelope(box.x1(), box.y1(), box.x2(), box.y2()));
378 TeAttributeList attrList = table.attributeList();
384 for(std::size_t i = 0; i < attrList.size(); ++i)
386 TeAttributeRep attr = attrList[i].rep_;
390 newDst->add(prop.release());
400 unsigned int ncols = rparams.ncols_;
401 unsigned int nrows = rparams.nlines_;
402 std::unique_ptr<te::gm::Envelope> mbr(
Convert2T5(rparams.boundingBox()));
404 int srid = rparams.projection()->epsgCode();
409 std::unique_ptr<te::rst::Grid> grid(
new te::rst::Grid(ncols, nrows, rparams.resx_, rparams.resy_, cord, srid));
411 rproperty->set(grid.release());
413 std::vector<te::rst::BandProperty::ColorEntry> palette;
414 if(rparams.photometric_[0] == TeRasterParams::TePallete)
416 std::size_t size = rparams.lutr_.size();
418 for(std::size_t j = 0; j < size; ++j)
421 c.
c1 = rparams.lutr_[j];
422 c.
c2 = rparams.lutg_[j];
423 c.
c3 = rparams.lutb_[j];
424 palette.push_back(c);
428 for(
int i = 0; i != rparams.nBands(); ++i)
432 bp->
m_blkh = rparams.blockHeight_;
433 bp->
m_blkw = rparams.blockWidth_;
438 bp->
m_palette.assign(palette.begin(), palette.end());
446 return rproperty.release();
451 bool isDotSeparator =
false;
458 std::string key =
"Control Panel\\International";
459 std::string sepDecimal =
"sDecimal";
460 std::string sepDecimalResult =
"";
462 if (RegOpenKeyExA(HKEY_CURRENT_USER, key.c_str(), 0, KEY_READ, &hk) == ERROR_SUCCESS)
467 if (RegQueryValueExA(hk, sepDecimal.c_str(), NULL, &Type, (LPBYTE)buf, &DataSize) == ERROR_SUCCESS)
468 sepDecimalResult = buf;
472 if (sepDecimalResult ==
".")
473 isDotSeparator =
true;
478 std::replace(value.begin(), value.end(),
',',
'.');
484 std::map<TeGeomRep, int> auxMap;
486 for (std::size_t i = 0; i < geoms.size(); ++i)
488 TeGeomRep geomRep = geoms[i]->elemType();
490 std::map<TeGeomRep, int>::iterator it = auxMap.find(geomRep);
492 if (it != auxMap.end())
498 if (auxMap.size() > 1)
501 TeGeomRep geomRep = auxMap.begin()->first;
502 if (auxMap.begin()->second == 1)
TeAttrDataType Convert2T4GeomType(te::gm::GeomType type)
std::unique_ptr< TeDatabaseFactoryParams > Convert2T4DatabaseParams(const std::string &dsInfo)
It converts a data source information to a TerraLib 4.x database params.
std::string path() const
Retrieving the path.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
An atomic property like an integer or double.
std::vector< ColorEntry > m_palette
The color palette.
TETERRALIB4EXPORT std::string Convert2Utf8(const std::string &str)
A raster band description.
A class that models the description of a dataset.
int m_nblocksx
The number of blocks in x.
int m_nblocksy
The number of blocks in y.
te::gm::GeomType GetCollection(TeGeomRep rep)
std::string password() const
Retrieving the password information.
bool isValid() const
Return if the given URI is valid or not.
An utility struct for representing 2D coordinates.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
#define TE_TR(message)
It marks a string in order to get translated.
static std::string fromUTF8(const std::string &src)
Convert a string in UTF-8 to the current locale encoding.
std::string ReplaceSpecialChars(const std::string &str, bool &changed)
It replace special characters of a string.
std::string query() const
Retrieving the query.
std::unique_ptr< te::dt::Property > Convert2T5(const TeAttributeRep &attRep)
It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
te::gm::GeomType Convert2T5GeomType(TeAttrDataType type)
An Envelope defines a 2D rectangular region.
int m_blkw
Block width (pixels).
static te::dt::TimeDuration dt(20, 30, 50, 11)
te::gm::GeomType GetMinimalRepresentation(const std::vector< TeGeometry * > &geoms)
std::string host() const
Retrieving the host.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
TETERRALIB4EXPORT std::string Convert2Latin1(const std::string &str)
void CheckDecimalSeparator(std::string &value)
A class for representing an Uniform Resource Identifier (URI).
short c1
gray, red, cyan or hue.
This file contains utility functions used to manipulate data from a URI.
TECOREEXPORT std::map< std::string, std::string > Expand(const std::string &query_str)
Split a query string into its components.
static std::string toUTF8(const std::string &src)
Convert a string from a current locale encoding to UTF-8.
short c3
blue, yellow, or saturation.
An structure to represent a color tuple.
std::complex< double > m_valuesOffset
Offset is the values (real and imaginary) to add to grid values for this sample dimension, default is 0.
int m_blkh
Block height (pixels).
TeAttrDataType Convert2T4(int type)
It converts a Terralib 5 data type to Terralib 4.x data type.
A rectified grid is the spatial support for raster data.
short c2
green, magenta, or lightness.
std::string user() const
Retrieving the user information.