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 <terralib/kernel/TeBox.h>
43 #include <terralib/kernel/TeDatabaseFactoryParams.h>
44 #include <terralib/kernel/TeDecoderDatabase.h>
45 #include <terralib/kernel/TeProjection.h>
46 #include <terralib/kernel/TeTable.h>
47 #include <terralib/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();
std::complex< double > m_valuesOffset
Offset is the values (real and imaginary) to add to grid values for this sample dimension, default is 0.
An structure to represent a color tuple.
int m_blkh
Block height (pixels).
short c1
gray, red, cyan or hue.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
An atomic property like an integer or double.
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.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
TeAttrDataType Convert2T4GeomType(te::gm::GeomType type)
te::gm::GeomType Convert2T5GeomType(TeAttrDataType type)
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.
int m_nblocksy
The number of blocks in y.
std::vector< ColorEntry > m_palette
The color palette.
A rectified grid is the spatial support for raster data.
int m_blkw
Block width (pixels).
Utilitary functions for dealing with TerraLib 5 and 4.x conversion.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
#define TR_COMMON(message)
It marks a string in order to get translated. This is the mark used in the Common module of TerraLib...
A raster band description.
A class that models the description of a dataset.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
TeAttrDataType Convert2T4(int type)
It converts a Terralib 5 data type to Terralib 4.x data type.
int m_nblocksx
The number of blocks in x.
The type for arbitrary precison numbers, like numeric(p, q).
An Envelope defines a 2D rectangular region.
short c2
green, magenta, or lightness.
short c3
blue, yellow, or saturation.