27 #include "../common/Exception.h"
28 #include "../common/Translator.h"
29 #include "../dataaccess/dataset/DataSetType.h"
30 #include "../datatype/NumericProperty.h"
31 #include "../datatype/Property.h"
32 #include "../datatype/StringProperty.h"
33 #include "../geometry/Enums.h"
34 #include "../geometry/Envelope.h"
35 #include "../geometry/GeometryProperty.h"
36 #include "../raster/BandProperty.h"
37 #include "../raster/Grid.h"
38 #include "../raster/RasterProperty.h"
42 #include <terralib4/kernel/TeBox.h>
43 #include <terralib4/kernel/TeDatabaseFactoryParams.h>
44 #include <terralib4/kernel/TeDecoderDatabase.h>
45 #include <terralib4/kernel/TeProjection.h>
46 #include <terralib4/kernel/TeTable.h>
47 #include <terralib4/kernel/TeRasterParams.h>
50 #include <boost/lexical_cast.hpp>
54 std::string* defaultValue = attRep.defaultValue_.empty() ? 0 :
new std::string(attRep.defaultValue_);
56 bool isRequired = !attRep.null_;
61 if(attRep.numChar_ == 0)
79 return std::auto_ptr<te::dt::Property>(
new te::dt::NumericProperty(attRep.name_, 0, 0, isRequired, defaultValue));
105 case TePOLYGONSETTYPE:
129 std::auto_ptr<TeDatabaseFactoryParams> fparams(
new TeDatabaseFactoryParams());
131 fparams->dbms_name_ = dsInfo.at(
"T4_DRIVER");
132 fparams->database_ = dsInfo.at(
"T4_DB_NAME");
133 fparams->host_ = dsInfo.at(
"T4_HOST");
135 fparams->user_ = dsInfo.at(
"T4_USER");
136 fparams->password_ = dsInfo.at(
"T4_PASSWORD");
174 case TePOLYGONSETTYPE:
215 case TePOLYGONSETTYPE:
257 case TeUNSIGNEDSHORT:
311 return TeUNSIGNEDINT;
336 return TePOLYGONTYPE;
339 return TePOINTSETTYPE;
342 return TeLINESETTYPE;
345 return TePOLYGONSETTYPE;
354 std::auto_ptr<te::gm::Envelope> env(
new te::gm::Envelope(box.x1(), box.y1(), box.x2(), box.y2()));
361 TeAttributeList attrList = table.attributeList();
365 for(std::size_t i = 0; i < attrList.size(); ++i)
367 TeAttributeRep attr = attrList[i].rep_;
371 newDst->add(prop.release());
381 unsigned int ncols = rparams.ncols_;
382 unsigned int nrows = rparams.nlines_;
383 std::auto_ptr<te::gm::Envelope> mbr(
Convert2T5(rparams.box()));
385 std::auto_ptr<te::rst::Grid> grid(
new te::rst::Grid(ncols, nrows, mbr.release(), rparams.projection()->epsgCode()));
387 rproperty->set(grid.release());
389 std::vector<te::rst::BandProperty::ColorEntry> palette;
390 if(rparams.photometric_[0] == TeRasterParams::TePallete)
392 std::size_t size = rparams.lutr_.size();
394 for(std::size_t j = 0; j < size; ++j)
397 c.
c1 = rparams.lutr_[j];
398 c.
c2 = rparams.lutg_[j];
399 c.
c3 = rparams.lutb_[j];
400 palette.push_back(c);
404 for(
int i = 0; i != rparams.nBands(); ++i)
408 bp->
m_blkh = rparams.blockHeight_;
409 bp->
m_blkw = rparams.blockWidth_;
414 bp->
m_palette.assign(palette.begin(), palette.end());
422 return rproperty.release();
TeAttrDataType Convert2T4GeomType(te::gm::GeomType type)
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.
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.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
#define TE_TR(message)
It marks a string in order to get translated.
std::auto_ptr< te::dt::Property > Convert2T5(const TeAttributeRep &attRep)
It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
std::auto_ptr< TeDatabaseFactoryParams > Convert2T4DatabaseParams(const std::map< std::string, std::string > &dsInfo)
It converts a data source information to a TerraLib 4.x database params.
The type for arbitrary precison numbers, like numeric(p, q).
te::gm::GeomType Convert2T5GeomType(TeAttrDataType type)
An Envelope defines a 2D rectangular region.
int m_blkw
Block width (pixels).
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. ...
short c1
gray, red, cyan or hue.
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.
Utilitary functions for dealing with TerraLib 5 and 4.x conversion.
short c2
green, magenta, or lightness.