27 #include "../../../geometry/Envelope.h"
28 #include "../../../geometry/serialization/xml/Serializer.h"
29 #include "../../../xml/Reader.h"
30 #include "../../../xml/Writer.h"
31 #include "../../Band.h"
32 #include "../../BandProperty.h"
33 #include "../../Grid.h"
34 #include "../../Raster.h"
43 #include <boost/lexical_cast.hpp>
55 std::string k = reader.
getAttr(0);
56 std::string v = reader.
getAttr(1);
74 std::map<std::string, std::string>::const_iterator it = rinfo.begin();
75 std::map<std::string, std::string>::const_iterator itend = rinfo.end();
92 std::fstream ostr(fileName.c_str(), std::ios_base::out);
112 writer.
writeAttribute(
"xmlns:xlink",
"http://www.w3.org/1999/xlink");
113 writer.
writeAttribute(
"xmlns:xsd",
"http://www.w3.org/2001/XMLSchema-instance");
114 writer.
writeAttribute(
"xmlns",
"http://www.terralib.org/schemas/raster");
115 writer.
writeAttribute(
"xsd:schemaLocation",
"http://www.terralib.org/schemas/raster C:/Users/gribeiro/Documents/terralib5/trunk/myschemas/terralib/raster/raster.xsd");
130 std::map<std::string, std::string> rinfo = raster->
getInfo();
142 double* geo =
new double[6];
169 std::auto_ptr<te::gm::Envelope> e(
ReadExtent(reader));
245 std::vector<te::rst::BandProperty*> bands;
unsigned int getNumberOfRows() const
Returns the grid number of rows.
virtual std::map< std::string, std::string > getInfo() const =0
It returns additional information about the raster.
std::size_t m_idx
The band index.
virtual boost::int32_t getElementValueAsInt32() const
It returns the element data value in the case of VALUE node.
virtual void writeStartElement(const std::string &qName)
This class models a XML reader object.
virtual void writeStartDocument(const std::string &encoding, const std::string &standalone)
TERASTEREXPORT te::rst::Grid * ReadGrid(te::xml::Reader &reader)
A raster band description.
int getSRID() const
Returns the grid spatial reference system identifier.
int m_nblocksx
The number of blocks in x.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
This class models a XML writer object.
int m_nblocksy
The number of blocks in y.
virtual void writeAttribute(const std::string &attName, const std::string &value)
void setGeoreference(const te::gm::Coord2D &ulLocation, int srid, double resX, double resY)
Sets the information needed to georeference the grid.
int m_type
The data type of the elements in the band.
TERASTEREXPORT void ReadRasterInfo(std::map< std::string, std::string > &rinfo, te::xml::Reader &reader)
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
TERASTEREXPORT double * ReadGeoTransform(te::xml::Reader &reader)
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
virtual boost::int32_t getAttrAsInt32(const std::string &name) const
It returns the attribute value in the case of an element node with valid attributes.
TERASTEREXPORT te::rst::BandProperty * ReadBandProperty(te::xml::Reader &reader)
TERASTEREXPORT void SaveRasterInfo(std::map< std::string, std::string > &rinfo, te::xml::Writer &writer)
virtual void writeElement(const std::string &qName, const std::string &value)
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
Auxiliary classes and functions to read geometry information from a XML document. ...
const double * getGeoreference() const
Returns a list of 6 coefficients describing an affine transformation to georeference a grid...
BandProperty * getProperty()
Returns the band property.
int m_blkw
Block width (pixels).
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
TEGEOMEXPORT std::auto_ptr< te::gm::Envelope > ReadExtent(te::xml::Reader &reader)
TEDATAACCESSEXPORT void Save(const std::string &fileName)
unsigned int getNumberOfColumns() const
Returns the grid number of columns.
virtual void writeEndElement(const std::string &qName)
Grid * getGrid()
It returns the raster grid.
virtual std::string getAttr(const std::string &name) const =0
It returns the attribute value in the case of an element node with valid attributes.
const std::string & getName() const
Returns the raster name.
virtual NodeType getNodeType() const =0
It return the type of node read.
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
TERASTEREXPORT std::vector< te::rst::BandProperty * > ReadBandPropertyVector(te::xml::Reader &reader)
virtual double getAttrAsDouble(const std::string &name) const
It returns the attribute value in the case of an element node with valid attributes.
int m_blkh
Block height (pixels).
A rectified grid is the spatial support for raster data.
virtual bool next()=0
It gets the next event to be read.
TEGEOMEXPORT void SaveExtent(const te::gm::Envelope &e, te::xml::Writer &writer)