27 #include "../common/progress/TaskProgress.h" 
   28 #include "../common/STLUtils.h" 
   29 #include "../common/Translator.h" 
   30 #include "../dataaccess/utils/Utils.h" 
   31 #include "../geometry/Envelope.h" 
   32 #include "../geometry/Utils.h" 
   33 #include "../maptools/Canvas.h" 
   34 #include "../maptools/CanvasConfigurer.h" 
   35 #include "../maptools/RasterTransform.h" 
   36 #include "../maptools/RasterTransformConfigurer.h" 
   37 #include "../raster/Grid.h" 
   38 #include "../raster/RasterProperty.h" 
   39 #include "../raster/RasterSummary.h" 
   40 #include "../raster/RasterSummaryManager.h" 
   41 #include "../raster/Utils.h" 
   42 #include "../se/CoverageStyle.h" 
   43 #include "../se/ImageOutline.h" 
   44 #include "../se/RasterSymbolizer.h" 
   45 #include "../se/Rule.h" 
   46 #include "../se/Utils.h" 
   47 #include "../srs/Config.h" 
   48 #include "../srs/Converter.h" 
   54 #include <boost/format.hpp> 
   55 #include <boost/lexical_cast.hpp> 
   75     throw Exception(
TE_TR(
"The requested box is invalid!"));
 
   84     throw Exception(
TE_TR(
"Wrong type render type for this layer!"));
 
   86   draw(wmsLayer, canvas, bbox, srid);
 
   98   else if(layer->
getSRID() != srid)
 
  100     throw Exception(
TE_TR(
"The layer or map has no valid SRID!"));
 
  110   std::auto_ptr<te::map::LayerSchema> schema(layer->
getSchema());
 
  111   assert(schema.get());
 
  124       throw Exception((boost::format(
TE_TR(
"Could not create a default coverage style for the layer %1%!")) % layer->
getTitle()).str());
 
  132     throw Exception(
TE_TR(
"The layer style is not a Coverage Style!"));
 
  141   if(dataset.get() == 0)
 
  142     throw Exception((boost::format(
TE_TR(
"Could not retrieve the WMS data from the layer %1%!")) % layer->
getTitle()).str());
 
  147   std::auto_ptr<te::rst::Raster> raster(dataset->getRaster(rpos));
 
  148   if(dataset.get() == 0)
 
  149     throw Exception((boost::format(
TE_TR(
"Could not retrieve the WMS data from the layer %1%!")) % layer->
getTitle()).str());
 
  152   drawRaster(layer->
getTitle(), raster.get(), canvas, ibbox, layer->
getSRID(), bbox, srid, cs);
 
  166   std::auto_ptr<te::rst::Grid> gridCanvas(
new te::rst::Grid(static_cast<unsigned int>(canvas->
getWidth()), static_cast<unsigned int>(canvas->
getHeight()), gmbr, srid));
 
  177     const std::complex<double>* cmin = rsMin->at(0).m_minVal;
 
  178     const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
 
  179     double min = cmin->real();
 
  180     double max = cmax->real();
 
  182     rasterTransform.setLinearTransfParameters(min, max, 0, 255);
 
  186     rasterTransform.setLinearTransfParameters(0, 255, 0, 255);
 
  190   std::size_t nRules = style->
getRules().size();
 
  196   const std::vector<te::se::Symbolizer*>& symbolizers = rule->
getSymbolizers();
 
  197   assert(!symbolizers.empty());
 
  201   assert(rasterSymbolizer);
 
  215   bool needRemap = 
false;
 
  220   std::string message = 
TE_TR(
"Drawing the WMS layer");
 
  221   !layerTitle.empty() ? message += 
" " + layerTitle + 
". " : message += 
"...";
 
  238     converter->setSourceSRID(srid);
 
  239     converter->setTargetSRID(bboxSRID);
 
  243   for(
unsigned int r = 0; r < gridCanvas->getNumberOfRows(); ++r)
 
  245     for(
unsigned int c = 0; c < gridCanvas->getNumberOfColumns(); ++c)
 
  250         converter->convert(inputGeo.
x, inputGeo.
y, inputGeo.
x, inputGeo.
y);
 
  262            color = rasterTransform.apply(x, y);
 
  295   if(rasterSymbolizer->getImageOutline() == 0)
 
  299   te::se::Symbolizer* outlineSymbolizer = rasterSymbolizer->getImageOutline()->getSymbolizer();
 
  300   if(outlineSymbolizer == 0)
 
  305   cc.
config(outlineSymbolizer);
 
  311     geom->setSRID(bboxSRID);
 
  312     geom->transform(srid);
 
  315   canvas->
draw(geom.get());
 
A layer with reference to a WMS Layer. 
 
It renders the data associated to a WMS layer. 
 
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data. 
 
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
 
std::auto_ptr< te::map::LayerSchema > getSchema() const 
It returns the layer schema. 
 
bool intersects(const Envelope &rhs) const 
It returns true if the envelopes "spatially intersects". 
 
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
 
This is the base class for layers. 
 
virtual const te::gm::Envelope & getExtent() const 
It returns the Layer extent (or minimum bounding box). 
 
virtual const std::string & getTitle() const 
It returns the layer title. 
 
unsigned int getNumberOfColumns() const 
Returns the raster number of columns. 
 
A Symbolizer describes how a feature is to appear on a map. 
 
std::auto_ptr< te::da::DataSet > getData(te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const 
It gets the dataset identified by the layer name. 
 
virtual int getHeight() const =0
It returns the canvas height. 
 
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
 
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties. 
 
This class can be used to inform the progress of a task. 
 
virtual int getWidth() const =0
It returns the canvas width. 
 
An utility struct for representing 2D coordinates. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
void geoToGrid(const double &x, const double &y, double &col, double &row) const 
Get the grid point associated to a spatial location. 
 
Rule * getRule(std::size_t i) const 
 
const std::vector< Rule * > & getRules() const 
 
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers. 
 
A layer with reference to a WMS Layer. 
 
An exception class for the TerraLib WMS module. 
 
static RasterSummaryManager & getInstance()
It returns a reference to the singleton instance. 
 
TERASTEREXPORT int Round(double val)
Round a double value to a integer value. 
 
An Envelope defines a 2D rectangular region. 
 
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib. 
 
An abstract class for raster data strucutures. 
 
unsigned int getNumberOfRows() const 
Returns the raster number of rows. 
 
virtual te::se::Style * getStyle() const 
It returns the Style associated to the layer. 
 
void setWidth(const std::size_t &width)
 
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster. 
 
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector. 
 
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
 
virtual void drawImage(char *src, std::size_t size, ImageType t)=0
It draws the src image over the canvas. 
 
Grid * getGrid()
It returns the raster grid. 
 
void draw(te::map::AbstractLayer *layer, te::map::Canvas *canvas, const te::gm::Envelope &bbox, int srid)
It draws the layer geographic objects in the given canvas using the SRS informed. ...
 
const std::vector< Symbolizer * > & getSymbolizers() const 
 
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
 
A canvas is an abstraction of a drawing area. 
 
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
 
virtual void setStyle(te::se::Style *style)
It sets the Style associated to the layer. 
 
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color. 
 
virtual int getSRID() const 
It returns the Spatial Reference System ID associated to the Layer. 
 
void drawRaster(const std::string &layerTitle, te::rst::Raster *raster, te::map::Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid, te::se::CoverageStyle *style)
 
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. 
 
A rectified grid is the spatial support for raster data. 
 
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one. 
 
virtual int getBandDataType(std::size_t i) const =0
Returns the data type in a particular band (or dimension). 
 
virtual void draw(const te::gm::Geometry *geom)=0
It draws the geometry on canvas. 
 
bool isValid() const 
It tells if the rectangle is valid or not. 
 
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope. 
 
void setHeight(const std::size_t &height)