AbstractLayerRenderer.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/maptools/AbstractLayerRenderer.cpp
22 
23  \brief It renders the objects associated to an abstract layer. i.e. a generic renderer.
24 */
25 
26 // TerraLib
27 #include "../color/RGBAColor.h"
28 #include "../common/progress/TaskProgress.h"
29 #include "../common/Globals.h"
30 #include "../common/STLUtils.h"
31 #include "../core/translator/Translator.h"
32 #include "../dataaccess/dataset/DataSet.h"
33 #include "../dataaccess/dataset/DataSetType.h"
34 #include "../dataaccess/query/And.h"
35 #include "../dataaccess/query/EqualTo.h"
36 #include "../dataaccess/query/GreaterThanOrEqualTo.h"
37 #include "../dataaccess/query/LessThanOrEqualTo.h"
38 #include "../dataaccess/query/LiteralDouble.h"
39 #include "../dataaccess/query/LiteralEnvelope.h"
40 #include "../dataaccess/query/LiteralString.h"
41 #include "../dataaccess/query/PropertyName.h"
42 #include "../dataaccess/query/ST_Intersects.h"
43 #include "../dataaccess/utils/Utils.h"
44 #include "../fe/Filter.h"
45 #include "../fe/Utils.h"
46 #include "../geometry/Coord2D.h"
47 #include "../geometry/Envelope.h"
48 #include "../geometry/GeometryProperty.h"
49 #include "../geometry/Line.h"
50 #include "../geometry/MultiPolygon.h"
51 #include "../geometry/Polygon.h"
52 #include "../geometry/Utils.h"
53 #include "../raster/Raster.h"
54 #include "../raster/RasterProperty.h"
55 #include "../se/AnchorPoint.h"
56 #include "../se/CoverageStyle.h"
57 #include "../se/Displacement.h"
58 #include "../se/Fill.h"
59 #include "../se/FeatureTypeStyle.h"
60 #include "../se/Halo.h"
61 #include "../se/LabelPlacement.h"
62 #include "../se/LinePlacement.h"
63 #include "../se/ParameterValue.h"
64 #include "../se/PointPlacement.h"
65 #include "../se/Rule.h"
66 #include "../se/TextSymbolizer.h"
67 #include "../se/Utils.h"
68 #include "../srs/Config.h"
69 #include "AbstractLayer.h"
70 #include "AbstractLayerRenderer.h"
71 #include "Canvas.h"
72 #include "CanvasConfigurer.h"
73 #include "Chart.h"
74 #include "ChartRendererManager.h"
75 #include "Exception.h"
76 #include "Grouping.h"
77 #include "QueryEncoder.h"
78 #include "Utils.h"
79 
80 // Boost
81 #include <boost/format.hpp>
82 #include <boost/lexical_cast.hpp>
83 
84 // STL
85 #include <cassert>
86 #include <cstdlib>
87 #include <memory>
88 #include <utility>
89 
90 
91 
93  : m_index(0)
94 {
95 }
96 
98 
100  Canvas* canvas,
101  const te::gm::Envelope& bbox,
102  int srid,
103  const double& scale, bool* cancel)
104 {
105  if(!bbox.isValid())
106  throw Exception(TE_TR("The requested box is invalid!"));
107 
108  assert(layer);
109  assert(canvas);
110 
111  // Check if layer extent intersects the drawing area and so compute bounding box intersection
112  te::gm::Envelope reprojectedBBOX(bbox);
113 
114  if((layer->getSRID() != TE_UNKNOWN_SRS) && (srid != TE_UNKNOWN_SRS))
115  {
116  reprojectedBBOX.transform(srid, layer->getSRID());
117 
118  if(!reprojectedBBOX.isValid())
119  throw Exception(TE_TR("The reprojected box is invalid!"));
120  }
121  else if(layer->getSRID() != srid)
122  {
123  throw Exception(TE_TR("The layer or map don't have a valid SRID!"));
124  }
125 
126  // Adjust internal renderer transformer
127  m_transformer.setTransformationParameters(bbox.m_llx, bbox.m_lly, bbox.m_urx, bbox.m_ury, canvas->getWidth(), canvas->getHeight());
128 
129  canvas->setWindow(bbox.m_llx, bbox.m_lly, bbox.m_urx, bbox.m_ury);
130 
131  // Resets internal renderer state
132  reset();
133 
134  // Gets the layer schema
135  std::unique_ptr<LayerSchema> schema(layer->getSchema());
136  assert(schema.get());
137 
138  // Gets the name of the referenced spatial property
139  std::string spatialPropertyName = layer->getGeomPropertyName();
140 
141  if(schema->hasGeom())
142  {
143  te::gm::GeometryProperty* geometryProperty = nullptr;
144 
145  if(spatialPropertyName.empty())
146  geometryProperty = te::da::GetFirstGeomProperty(schema.get());
147  else
148  geometryProperty = dynamic_cast<te::gm::GeometryProperty*>(schema->getProperty(spatialPropertyName));
149 
150  assert(geometryProperty);
151 
152  // If the AbstractLayer has a grouping, do not consider the style.
153  Grouping* grouping = layer->getGrouping();
154  if(grouping && grouping->isVisible())
155  {
156  drawLayerGroupingMem(layer, geometryProperty->getName(), canvas, reprojectedBBOX, srid, scale, cancel);
157  return;
158  }
159 
160  // Gets the layer style
161  te::se::Style* style = layer->getStyle();
162  if(style == nullptr)
163  {
164  // Try create an appropriate style. i.e. a FeatureTypeStyle
165  style = te::se::CreateFeatureTypeStyle(geometryProperty->getGeometryType());
166 
167  if(style == nullptr)
168  throw Exception((boost::format(TE_TR("Could not create a default feature type style to the layer %1%.")) % layer->getTitle()).str());
169 
170  layer->setStyle(style);
171  }
172 
173  // Should I render this style?
174  te::se::FeatureTypeStyle* fts = dynamic_cast<te::se::FeatureTypeStyle*>(style);
175  if(fts == nullptr)
176  throw Exception(TE_TR("The layer style is not a Feature Type Style!"));
177 
178  drawLayerGeometries(layer, geometryProperty->getName(), fts, canvas, reprojectedBBOX, srid, scale, cancel);
179  }
180  else if(schema->hasRaster())
181  {
182  if (!reprojectedBBOX.intersects(layer->getExtent()))
183  return;
184 
185  te::rst::RasterProperty* rasterProperty = nullptr;
186 
187  if(spatialPropertyName.empty())
188  rasterProperty = te::da::GetFirstRasterProperty(schema.get());
189  else
190  rasterProperty = dynamic_cast<te::rst::RasterProperty*>(schema->getProperty(spatialPropertyName));
191 
192  assert(rasterProperty);
193 
194  // Get the layer style
195  te::se::Style* style = layer->getStyle();
196  if(style == nullptr)
197  {
198  // Try create an appropriate style. i.e. a CoverageStyle
199  style = te::se::CreateCoverageStyle(rasterProperty->getBandProperties());
200 
201  if(style == nullptr)
202  throw Exception((boost::format(TE_TR("Could not create a default coverage style to the layer %1%.")) % layer->getTitle()).str());
203 
204  layer->setStyle(style);
205  }
206 
207  // Should I render this style?
208  te::se::CoverageStyle* cs = dynamic_cast<te::se::CoverageStyle*>(style);
209  if(cs == nullptr)
210  throw Exception(TE_TR("The layer style is not a Coverage Style!"));
211 
212  // Retrieves the data
213  std::unique_ptr<te::rst::Raster> raster(te::map::GetRaster(layer));
214  if (raster.get() == nullptr)
215  throw Exception(TE_TR("Could not get the raster referenced by the layer!"));
216 
217  // Let's draw!
218  DrawRaster(raster.get(), canvas, reprojectedBBOX, layer->getSRID(), bbox, srid, cs, layer->getRasterContrast(), scale, cancel);
219  }
220  else
221  {
222  throw Exception(TE_TR("The layer don't have a geometry or raster property!"));
223  }
224 }
225 
227  const std::string& geomPropertyName,
229  Canvas* canvas,
230  const te::gm::Envelope& bbox,
231  int srid,
232  const double& scale, bool* cancel)
233 {
234  assert(!geomPropertyName.empty());
235 
236  // Creates a canvas configurer
237  CanvasConfigurer cc(canvas);
238 
239  // Number of rules defined on feature type style
240  std::size_t nRules = style->getRules().size();
241 
242  for(std::size_t i = 0; i < nRules; ++i) // for each <Rule>
243  {
244  // The current rule
245  te::se::Rule* rule = style->getRule(i);
246  assert(rule);
247 
248  // TODO: Should be verified the MinScaleDenominator and MaxScaleDenominator. Where will we put the current scale information? Method parameter?
249 
250  if (!(scale >= rule->getMinScaleDenominator() && scale < rule->getMaxScaleDenominator()))
251  {
252  continue;
253  }
254 
255  // Gets the rule filter
256  const te::fe::Filter* filter = rule->getFilter();
257 
258  // Let's retrieve the correct dataset
259  std::unique_ptr<te::da::DataSet> dataset;
260 
261  if(!filter)
262  {
263  try
264  {
265  // There isn't a Filter expression. Gets the data using only extent spatial restriction...
266  dataset = layer->getData(geomPropertyName, &bbox, te::gm::INTERSECTS);
267  }
268  catch(Exception& e)
269  {
270  throw e;
271  }
272  }
273  else
274  {
275  try
276  {
277  // Gets an enconder
278  te::map::QueryEncoder filter2Query;
279 
280  // Converts the Filter expression to a TerraLib Expression!
281  te::da::Expression* exp = filter2Query.getExpression(filter);
282  if(exp == nullptr)
283  throw Exception(TE_TR("Could not convert the OGC Filter expression to TerraLib expression!"));
284 
285  /* 1) Creating the final restriction. i.e. Filter expression + extent spatial restriction */
286 
287  // The extent spatial restriction
288  te::da::LiteralEnvelope* lenv = new te::da::LiteralEnvelope(bbox, layer->getSRID());
289  te::da::PropertyName* geometryPropertyName = new te::da::PropertyName(geomPropertyName);
290  te::da::ST_Intersects* intersects = new te::da::ST_Intersects(geometryPropertyName, lenv);
291 
292  // Combining the expressions (Filter expression + extent spatial restriction)
293  te::da::And* restriction = new te::da::And(exp, intersects);
294 
295  /* 2) Calling the layer query method to get the correct restricted data. */
296  dataset = layer->getData(restriction);
297  }
298  catch(std::exception& /*e*/)
299  {
300  throw Exception((boost::format(TE_TR("Could not retrieve the data set from the layer %1%.")) % layer->getTitle()).str());
301  }
302  }
303 
304  if(dataset.get() == nullptr)
305  throw Exception((boost::format(TE_TR("Could not retrieve the data set from the layer %1%.")) % layer->getTitle()).str());
306 
307  if(dataset->moveNext() == false)
308  continue;
309 
310  // Gets the set of symbolizers defined on current rule
311  const std::vector<te::se::Symbolizer*>& symbolizers = rule->getSymbolizers();
312 
313  // Builds task message; e.g. ("Drawing the layer Countries. Rule 1 of 3.")
314  std::string message = TE_TR("Drawing the layer");
315  message += " " + layer->getTitle() + ". ";
316  message += TE_TR("Rule");
317  message += " " + boost::lexical_cast<std::string>(i + 1) + " " + TE_TR("of") + " ";
318  message += boost::lexical_cast<std::string>(nRules) + ".";
319 
320  // Creates a draw task
322  task.setTotalSteps(0); // the bar shows a busy indicator instead of a percentage of steps
323 
324  // For while, first geometry property. TODO: get which geometry property the symbolizer references
325  std::size_t gpos = te::da::GetPropertyPos(dataset.get(), geomPropertyName);
326 
327  if(symbolizers.empty())
328  {
329  // The current rule do not have a symbolizer. Try creates a default based on first geometry of dataset.
330  std::unique_ptr<te::gm::Geometry> g(dataset->getGeometry(gpos));
331  assert(g.get());
332 
333  te::se::Symbolizer* symbolizer = te::se::CreateSymbolizer(g->getGeomTypeId());
334  assert(symbolizer);
335 
336  rule->push_back(symbolizer);
337 
338  dataset->moveFirst();
339  }
340 
341  std::size_t nSymbolizers = symbolizers.size();
342 
343  for(std::size_t j = 0; j < nSymbolizers; ++j) // for each <Symbolizer>
344  {
345  // The current symbolizer
346  te::se::Symbolizer* symb = symbolizers[j];
347 
348  // Let's config the canvas based on the current symbolizer
349  cc.config(symb);
350 
351  if (symb->getType() == "TextSymbolizer")
352  {
353  te::se::TextSymbolizer* ts = static_cast<te::se::TextSymbolizer*>(symb);
354 
355  drawDatSetTexts(dataset.get(), gpos, canvas, layer->getSRID(), srid, ts, cancel, &task);
356  }
357  else
358  {
359  // Let's draw! for each data set geometry...
360  if (j != nSymbolizers - 1)
361  drawDatSetGeometries(dataset.get(), gpos, canvas, layer->getSRID(), srid, nullptr, cancel, &task);
362  else
363  drawDatSetGeometries(dataset.get(), gpos, canvas, layer->getSRID(), srid, layer->getChart(), cancel, &task); // Here, produces the chart if exists
364  }
365 
366  // Prepares to draw the other symbolizer
367  dataset->moveFirst();
368 
369  } // end for each <Symbolizer>
370  } // end for each <Rule>
371 }
372 
374  const std::string& geomPropertyName,
375  Canvas* canvas,
376  const te::gm::Envelope& bbox,
377  int srid, bool* cancel)
378 {
379  assert(!geomPropertyName.empty());
380 
381  // Creates a canvas configurer
382  te::map::CanvasConfigurer cc(canvas);
383 
384  // The layer grouping
385  Grouping* grouping = layer->getGrouping();
386 
387  // The referenced property name
388  std::string propertyName = grouping->getPropertyName();
389  assert(!propertyName.empty());
390 
391  // The referenced property type
392  int propertyType = grouping->getPropertyType();
393 
394  // The grouping type
395  GroupingType type = grouping->getType();
396 
397  std::vector<te::se::Rule*> layerRules = layer->getStyle()->getRules();
398 
399  std::size_t nGroupItems = layerRules.size();
400 
401  // Builds the task message; e.g. ("Drawing the grouping of layer Countries.")
402  std::string message = TE_TR("Drawing the grouping of layer");
403  message += " " + layer->getTitle() + ".";
404 
405  // Creates the draw task
406  te::common::TaskProgress task(message, te::common::TaskProgress::DRAW, static_cast<int>(nGroupItems));
407 
408  for(std::size_t i = 0; i < nGroupItems; ++i) // for each rule
409  {
410  // The current group item
411  te::se::Rule* ruleItem = layerRules[i];
412 
413  /* 1) Creating te::da::Where object with the group item restriction expression + extent spatial restriction */
414 
415  te::da::PropertyName* groupingPropertyName = new te::da::PropertyName(propertyName);
416 
417  // Grouping item restriction
418  te::da::Expression* exp = nullptr;
419 
420  if(type == UNIQUE_VALUE)
421  {
422  std::string uniqueValue;
423 
424  te::fe::GetFilterUniqueValue(ruleItem->getFilter(), uniqueValue);
425 
426  te::da::LiteralString* value = new te::da::LiteralString(uniqueValue);
427  exp = new te::da::EqualTo(groupingPropertyName, value);
428  }
429  else
430  {
431  std::string lowerLimitStr;
432  std::string upperLimitStr;
433 
434  te::fe::GetFilterStepValues(ruleItem->getFilter(), lowerLimitStr, upperLimitStr);
435 
436  te::da::Expression* lowerValue = nullptr;
437  te::da::Expression* upperrValue = nullptr;
438 
439  switch(propertyType)
440  {
441  case te::dt::STRING_TYPE:
442  lowerValue = new te::da::LiteralString(lowerLimitStr);
443  upperrValue = new te::da::LiteralString(upperLimitStr);
444  break;
445 
446  default:
447  lowerValue = new te::da::LiteralDouble(boost::lexical_cast<double>(lowerLimitStr));
448  upperrValue = new te::da::LiteralDouble(boost::lexical_cast<double>(upperLimitStr));
449  }
450 
451  te::da::GreaterThanOrEqualTo* gte = new te::da::GreaterThanOrEqualTo(groupingPropertyName, lowerValue);
452  te::da::LessThanOrEqualTo* lte = new te::da::LessThanOrEqualTo(groupingPropertyName->clone(), upperrValue);
453 
454  exp = new te::da::And(gte, lte);
455  }
456 
457  // The extent spatial restriction
458  te::da::LiteralEnvelope* lenv = new te::da::LiteralEnvelope(bbox, layer->getSRID());
459  te::da::PropertyName* geometryPropertyName = new te::da::PropertyName(geomPropertyName);
460  te::da::ST_Intersects* intersects = new te::da::ST_Intersects(geometryPropertyName, lenv);
461 
462  // Combining the expressions (group item restriction expression + extent spatial restriction)
463  te::da::And* restriction = new te::da::And(exp, intersects);
464 
465  /* 2) Calling the layer query method to get the correct restricted data. */
466 
467  std::unique_ptr<te::da::DataSet> dataset;
468  try
469  {
470  dataset = layer->getData(restriction);
471  }
472  catch(std::exception& /*e*/)
473  {
474  continue; // TODO: deal the exceptions!
475  }
476 
477  if(dataset.get() == nullptr)
478  throw Exception((boost::format(TE_TR("Could not retrieve the data set from the layer %1%.")) % layer->getTitle()).str());
479 
480  if(dataset->moveNext() == false)
481  continue;
482 
483  // Gets the set of symbolizers defined on group item
484  const std::vector<te::se::Symbolizer*>& symbolizers = ruleItem->getSymbolizers();
485  std::size_t nSymbolizers = symbolizers.size();
486 
487  // For while, first geometry property. TODO: get which geometry property the symbolizer references
488  std::size_t gpos = te::da::GetPropertyPos(dataset.get(), geomPropertyName);
489 
490  for(std::size_t j = 0; j < nSymbolizers; ++j) // for each <Symbolizer>
491  {
492  // The current symbolizer
493  te::se::Symbolizer* symb = symbolizers[j];
494 
495  // Let's config the canvas based on the current symbolizer
496  cc.config(symb);
497 
498  if (symb->getType() == "TextSymbolizer")
499  {
500  te::se::TextSymbolizer* ts = static_cast<te::se::TextSymbolizer*>(symb);
501 
502  drawDatSetTexts(dataset.get(), gpos, canvas, layer->getSRID(), srid, ts, cancel, &task);
503  }
504  else
505  {
506  // Let's draw! for each data set geometry...
507  if (j != nSymbolizers - 1)
508  drawDatSetGeometries(dataset.get(), gpos, canvas, layer->getSRID(), srid, nullptr, cancel, &task);
509  else
510  drawDatSetGeometries(dataset.get(), gpos, canvas, layer->getSRID(), srid, layer->getChart(), cancel, &task); // Here, produces the chart if exists
511  }
512 
513  // Prepares to draw the other symbolizer
514  dataset->moveFirst();
515 
516  } // end for each <Symbolizer>
517 
518  if(!task.isActive())
519  return;
520 
521  task.pulse();
522 
523  } // end for each GroupItem
524 }
525 
527  const std::string& geomPropertyName,
528  Canvas* canvas,
529  const te::gm::Envelope& bbox,
530  int srid,
531  const double& scale, bool* cancel)
532 {
533  assert(!geomPropertyName.empty());
534 
535  if (!layer->getStyle() || layer->getStyle()->getRules().empty())
536  return;
537 
538  std::vector<te::se::Rule*> layerRules = layer->getStyle()->getRules();
539 
540  // Creates a canvas configurer
541  te::map::CanvasConfigurer cc(canvas);
542 
543  // The layer grouping
544  Grouping* grouping = layer->getGrouping();
545 
546  // The referenced property name
547  std::string propertyName = grouping->getPropertyName();
548  assert(!propertyName.empty());
549 
550  // The grouping type
551  GroupingType type = grouping->getType();
552 
553  // The grouping precision
554  const std::size_t& precision = grouping->getPrecision();
555 
556  // The grouping items
557 
558  // case UNIQUE_VALUE: for each rule, builds a map [item value] -> [rule]
559  std::map<std::string, te::se::Rule*> uniqueRuleMap;
560 
561  // case (NOT) UNIQUE_VALUE: for each rule, builds a map [(lower, upper)] -> [rule]
562  std::map<std::pair< double, double>, te::se::Rule* > othersRuleMap;
563 
564  for (std::size_t i = 0; i < layerRules.size(); ++i)
565  {
566  // The current group item
567  te::se::Rule* ruleItem = layerRules[i];
568 
569  if(type == UNIQUE_VALUE)
570  {
571  std::string uniqueValue;
572 
573  te::fe::GetFilterUniqueValue(ruleItem->getFilter(), uniqueValue);
574 
575  uniqueRuleMap[uniqueValue] = ruleItem;
576  }
577  else
578  {
579  std::string lowerLimitStr;
580  std::string upperLimitStr;
581 
582  te::fe::GetFilterStepValues(ruleItem->getFilter(), lowerLimitStr, upperLimitStr);
583 
584  double lowerLimit = atof(lowerLimitStr.c_str());
585  double upperLimit = atof(upperLimitStr.c_str());
586  std::pair<double, double> range(lowerLimit, upperLimit);
587 
588  othersRuleMap[range] = ruleItem;
589  }
590  }
591 
592  // Builds the task message; e.g. ("Drawing the grouping of layer Countries.")
593  std::string message = TE_TR("Drawing the grouping of layer");
594  message += " " + layer->getTitle() + ".";
595 
596  // Creates the draw task
597  // te::common::TaskProgress task(message, te::common::TaskProgress::DRAW);
598 
599  std::unique_ptr<te::da::DataSet> dataset;
600  try
601  {
602  dataset = layer->getData(geomPropertyName, &bbox, te::gm::INTERSECTS);
603  }
604  catch(std::exception& /*e*/)
605  {
606  return; // TODO: deal the exceptions!
607  }
608 
609  if(dataset.get() == nullptr)
610  throw Exception((boost::format(TE_TR("Could not retrieve the data set from the layer %1%.")) % layer->getTitle()).str());
611 
612  if(dataset->moveNext() == false)
613  return;
614 
615  // Gets the first geometry property
616  std::size_t gpos = te::da::GetPropertyPos(dataset.get(), geomPropertyName);
617 
618  // Gets the property position
619  std::unique_ptr<te::map::LayerSchema> dt(layer->getSchema());
620  std::size_t propertyPos = te::da::GetPropertyPos(dt.get(), propertyName);
621 
622  // Verifies if is necessary convert the data set geometries to the given srid
623  bool needRemap = false;
624  if((layer->getSRID() != TE_UNKNOWN_SRS) && (srid != TE_UNKNOWN_SRS) && (layer->getSRID() != srid))
625  needRemap = true;
626 
627  // The layer chart
628  Chart* chart = layer->getChart();
629 
630  do
631  {
632  te::se::Rule* rule = nullptr;
633 
634  // Finds the current data set item on group map
635  std::string value;
636 
637  if(dataset->isNull(propertyPos))
639  else
640  value = dataset->getAsString(propertyPos, static_cast<int>(precision));
641 
642  if(type == UNIQUE_VALUE)
643  {
644  std::map<std::string, te::se::Rule*>::const_iterator it = uniqueRuleMap.find(value);
645  if (it == uniqueRuleMap.end())
646  continue;
647 
648  rule = it->second;
649  }
650  else
651  {
652  double dvalue = atof(value.c_str());
653  std::map<std::pair< double, double>, te::se::Rule*>::const_iterator it;
654  for (it = othersRuleMap.begin(); it != othersRuleMap.end(); ++it)
655  {
656  if(dvalue >= it->first.first && dvalue < it->first.second)
657  break;
658  }
659 
660  if (it != othersRuleMap.end())
661  rule = it->second;
662 
663  //check if a rule was found for current value
664  if (!rule)
665  continue;
666  }
667 
668  //check if a rule is in the current scale
669  if (!(scale >= rule->getMinScaleDenominator() && scale < rule->getMaxScaleDenominator()))
670  continue;
671 
672  std::unique_ptr<te::gm::Geometry> geom;
673  try
674  {
675  geom = dataset->getGeometry(gpos);
676  if(geom.get() == nullptr)
677  continue;
678  }
679  catch(std::exception& /*e*/)
680  {
681  continue;
682  }
683 
684  std::vector<te::se::Symbolizer*> symbolizers = rule->getSymbolizers();
685 
686  // Gets the set of symbolizers defined on group item
687  std::size_t nSymbolizers = symbolizers.size();
688 
689  for(std::size_t j = 0; j < nSymbolizers; ++j) // for each <Symbolizer>
690  {
691  // The current symbolizer
692  te::se::Symbolizer* symb = symbolizers[j];
693 
694  // Let's config the canvas based on the current symbolizer
695  cc.config(symb);
696 
697  // If necessary, geometry remap
698  if(needRemap)
699  {
700  geom->setSRID(layer->getSRID());
701  geom->transform(srid);
702  }
703 
704  canvas->draw(geom.get());
705 
706  if(chart && j == nSymbolizers - 1)
707  buildChart(chart, dataset.get(), geom.get());
708  }
709 
710  if(cancel != nullptr && (*cancel))
711  return;
712 
713  } while(dataset->moveNext());
714 
715  // Let's draw the generated charts
716  for(std::size_t i = 0; i < m_chartCoordinates.size(); ++i)
717  {
718  canvas->drawImage(static_cast<int>(m_chartCoordinates[i].x),
719  static_cast<int>(m_chartCoordinates[i].y),
720  m_chartImages[i],
721  static_cast<int>(chart->getWidth()),
722  static_cast<int>(chart->getHeight()));
723 
725  }
726 
727  //text symbolizer
728  if (layer->getStyle())
729  {
730  if (!layer->getStyle()->getRules().empty())
731  {
732  // The current rule
733  te::se::Rule* rule = layer->getStyle()->getRules()[0];
734 
735  if (rule)
736  {
737  const std::vector<te::se::Symbolizer*>& symbolizers = rule->getSymbolizers();
738 
739  std::size_t nSymbolizers = symbolizers.size();
740 
741  for (std::size_t j = 0; j < nSymbolizers; ++j) // for each <Symbolizer>
742  {
743  // The current symbolizer
744  te::se::Symbolizer* symb = symbolizers[j];
745 
746  // Let's config the canvas based on the current symbolizer
747  if (symb->getType() == "TextSymbolizer")
748  {
749  cc.config(symb);
750 
751  te::se::TextSymbolizer* ts = static_cast<te::se::TextSymbolizer*>(symb);
752 
753  dataset->moveFirst();
754 
755  drawDatSetTexts(dataset.get(), gpos, canvas, layer->getSRID(), srid, ts, cancel, nullptr);
756  }
757  }
758  }
759  }
760  }
761 }
762 
763 void te::map::AbstractLayerRenderer::drawDatSetGeometries(te::da::DataSet* dataset, const std::size_t& gpos, Canvas* canvas,
764  int fromSRID, int toSRID,
765  Chart* chart, bool* cancel, te::common::TaskProgress* task)
766 {
767  assert(dataset);
768  assert(canvas);
769 
770  // Verify if is necessary convert the data set geometries to the given srid
771  bool needRemap = false;
772  if((fromSRID != TE_UNKNOWN_SRS) && (toSRID != TE_UNKNOWN_SRS) && (fromSRID != toSRID))
773  needRemap = true;
774 
775  do
776  {
777  if(task)
778  {
779  if(!task->isActive())
780  {
781  *cancel = true;
782  return;
783  }
784  }
785 
786  std::unique_ptr<te::gm::Geometry> geom;
787  try
788  {
789  geom = dataset->getGeometry(gpos);
790  if(geom.get() == nullptr)
791  continue;
792  }
793  catch(std::exception& /*e*/)
794  {
795  continue;
796  }
797 
798  // If necessary, geometry remap
799  if(needRemap)
800  {
801  geom->setSRID(fromSRID);
802  geom->transform(toSRID);
803  }
804 
805  canvas->draw(geom.get());
806 
807  if(chart)
808  buildChart(chart, dataset, geom.get());
809 
810  if(cancel != nullptr && (*cancel))
811  return;
812 
813  } while(dataset->moveNext()); // next geometry!
814 
815  // Let's draw the generated charts
816  for(std::size_t i = 0; i < m_chartCoordinates.size(); ++i)
817  {
818  canvas->drawImage(static_cast<int>(m_chartCoordinates[i].x),
819  static_cast<int>(m_chartCoordinates[i].y),
820  m_chartImages[i],
821  static_cast<int>(chart->getWidth()),
822  static_cast<int>(chart->getHeight()));
823 
825  }
826 }
827 
828 void te::map::AbstractLayerRenderer::drawDatSetTexts(te::da::DataSet* dataset, const std::size_t& gpos, Canvas* canvas, int fromSRID, int toSRID, te::se::TextSymbolizer* symb, bool* cancel, te::common::TaskProgress* task)
829 {
830  assert(dataset);
831  assert(canvas);
832  assert(symb);
833 
834  // Verify if is necessary convert the data set geometries to the given srid
835  bool needRemap = false;
836  if ((fromSRID != TE_UNKNOWN_SRS) && (toSRID != TE_UNKNOWN_SRS) && (fromSRID != toSRID))
837  needRemap = true;
838 
839  std::string propName = te::se::GetString(symb->getLabel());
840 
841  if (propName.empty())
842  return;
843 
844  int propIdx = te::da::GetPropertyIndex(dataset, propName);
845 
846  //rtree for text boxes
848 
849  do
850  {
851  if (task)
852  {
853  if (!task->isActive())
854  {
855  *cancel = true;
856  return;
857  }
858 
859  // update the draw task
860  task->pulse();
861  }
862 
863  std::unique_ptr<te::gm::Geometry> geom;
864  try
865  {
866  geom = dataset->getGeometry(gpos);
867  if (geom.get() == nullptr)
868  continue;
869  }
870  catch (std::exception& /*e*/)
871  {
872  continue;
873  }
874 
875  // If necessary, geometry remap
876  if (needRemap)
877  {
878  geom->setSRID(fromSRID);
879  geom->transform(toSRID);
880  }
881 
882  std::string label = dataset->getString(propIdx);
883 
884  if (label == "")
885  continue;
886 
887  //initial position
888  te::gm::Coord2D cCenter = geom->getCentroid();
889  double posX = cCenter.getX();
890  double posY = cCenter.getY();
891 
892  //rotation
893  float angle = 0.0;
894 
895  //displacement
896  double anchorX = 0.5;
897  double anchorY = 0.5;
898  int displacementX = 0;
899  int displacementY = 0;
900 
901  if (symb->getLabelPlacement())
902  {
903  if (symb->getLabelPlacement()->getPointPlacement())
904  {
906 
907  if (pp->getRotation())
908  angle = static_cast<float>(te::se::GetDouble(pp->getRotation()));
909 
910  if (pp->getAnchorPoint())
911  {
914  }
915 
916  if (pp->getDisplacement())
917  {
918  displacementX = te::se::GetInt(pp->getDisplacement()->getDisplacementX());
919  displacementY = te::se::GetInt(pp->getDisplacement()->getDisplacementY());
920  }
921  }
922 
923  if (symb->getLabelPlacement()->getLinePlacement())
924  {
925  //adjust centroid over the line
926  if (geom->getGeomTypeId() == te::gm::GeomType::MultiLineStringType ||
927  geom->getGeomTypeId() == te::gm::GeomType::LineStringType)
928  {
929  std::unique_ptr<te::gm::Point> point(new te::gm::Point(cCenter.x, cCenter.y, geom->getSRID()));
930  te::gm::Coord2D coordGeom, coordPoint;
931  te::gm::ClosestPoints(geom.get(), point.get(), coordGeom, coordPoint);
932 
933  posX = coordGeom.getX();
934  posY = coordGeom.getY();
935  }
936 
937  //adjust label over the line
938  if (symb->getLabelPlacement()->getLinePlacement()->isAligned())
939  {
940  te::gm::Coord2D coord(posX, posY);
941  std::unique_ptr<te::gm::Line> line(te::gm::GetIntersectionLine(geom.get(), coord));
942 
943  if (line.get())
944  {
945  te::gm::Coord2D cStart(line->getStartPoint()->getX(), line->getStartPoint()->getY());
946  te::gm::Coord2D cEnd(line->getEndPoint()->getX(), line->getEndPoint()->getY());
947  angle = static_cast<float>(te::gm::GetAngle(cStart, cEnd));
948  angle = -angle;
949 
950  //set perpendicular distance
952  {
954 
955  //rotate line
956  std::unique_ptr<te::gm::LineString> lineRotate(new te::gm::LineString(2, te::gm::LineStringType, geom->getSRID()));
957  te::gm::Coord2D centroidCoord(posX, posY);
958  te::gm::Rotate(centroidCoord, line.get(), 90., lineRotate.get());
959 
960  //adjust segment
961  std::unique_ptr<te::gm::Point> p0(dynamic_cast<te::gm::Point*>(lineRotate->intersection(line.get())));
962  std::unique_ptr<te::gm::Point> p1(lineRotate->getPointN(1));
963  te::gm::Coord2D c0, c1;
964  te::gm::AdjustSegment(p0.get(), p1.get(), dist, c0, c1);
965 
966  //set new point to start drawing text
967  posX = c1.getX();
968  posY = c1.getY();
969  }
970  }
971  }
972  }
973  }
974 
975  std::unique_ptr<te::gm::Polygon> poly(canvas->getTextBoundary(posX, posY, label, angle, anchorX, anchorY, displacementX, displacementY));
976 
977  te::gm::Envelope mbr(*poly->getMBR());
978 
979  //check rtree to avoid text overlay
980  std::vector<std::size_t> report;
981  rtree.search(mbr, report);
982 
983  if (report.empty())
984  {
985  canvas->drawText(posX, posY, label, angle, anchorX, anchorY, displacementX, displacementY);
986 
987  rtree.insert(mbr, 0);
988  }
989 
990  if (cancel != nullptr && (*cancel))
991  return;
992 
993  } while (dataset->moveNext()); // next geometry!
994 }
995 
997 {
998  if(!chart->isVisible())
999  return;
1000 
1001  // World coordinates
1002  std::unique_ptr<te::gm::Coord2D> worldCoord;
1003 
1004  // Try finds the geometry centroid
1005  switch(geom->getGeomTypeId())
1006  {
1007  case te::gm::PolygonType:
1008  {
1009  te::gm::Polygon* p = dynamic_cast<te::gm::Polygon*>(geom);
1010  worldCoord.reset(p->getCentroidCoord());
1011  }
1012  break;
1013 
1015  {
1016  te::gm::MultiPolygon* mp = dynamic_cast<te::gm::MultiPolygon*>(geom);
1017  worldCoord.reset(mp->getCentroidCoord());
1018  }
1019  break;
1020 
1021  default:
1022  break;
1023  }
1024 
1025  // Case not find, use the center of the MBR
1026  if(worldCoord.get() == nullptr)
1027  {
1028  const te::gm::Envelope* e = geom->getMBR();
1029  worldCoord.reset(new te::gm::Coord2D(e->getCenter().x, e->getCenter().y));
1030  }
1031 
1032  // Device coordinates
1033  double dx = 0.0; double dy = 0.0;
1034  m_transformer.world2Device(worldCoord->x, worldCoord->y, dx, dy);
1035 
1036  double dw = dx + chart->getWidth();
1037  double dh = dy + chart->getHeight();
1038 
1039  // Builds the chart envelope
1040  te::gm::Envelope chartEnvelope(dx, dy, dw, dh);
1041 
1042  if(chart->getAvoidConflicts())
1043  {
1044  // Search on rtree
1045  std::vector<std::size_t> report;
1046  m_rtree.search(chartEnvelope, report);
1047 
1048  if(!report.empty())
1049  return;
1050 
1051  // Here, no intersections considering the current chart envelope
1052  m_rtree.insert(chartEnvelope, ++m_index);
1053  }
1054 
1055  // Stores the chart coordinate
1056  m_chartCoordinates.push_back(te::gm::Coord2D(dx, dy));
1057 
1058  // Builds the chart image
1059  std::size_t width = 0;
1060  te::color::RGBAColor** rgba = ChartRendererManager::getInstance().render(chart, dataset, width);
1061  m_chartImages.push_back(rgba);
1062 }
1063 
1065 {
1066  m_index = 0;
1067  m_chartCoordinates.clear();
1068  m_chartImages.clear();
1069 }
A TextSymbolizer is used to render text labels according to various graphical parameters.
virtual std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:50
bool isAligned() const
Geometric property.
const ParameterValue * getDisplacementX() const
~AbstractLayerRenderer()
Destructor.
const AnchorPoint * getAnchorPoint() const
if(WIN32) add_definitions(-D_SCL_SECURE_NO_WARNINGS-DTEWCSDLL) endif() file(GLOB TERRALIB_SRC_FILES $
double y
y-coordinate.
Definition: Coord2D.h:114
const LabelPlacement * getLabelPlacement() const
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
It models the inequality operator less than or equal to (<=).
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
virtual void drawText(int x, int y, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0)=0
It draws a text.
Spatial intersects operator.
Definition: ST_Intersects.h:46
An exception class for the MapTools module.
This is the base class for layers.
Definition: AbstractLayer.h:77
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
int getPropertyType() const
It gets the property type whose values will be grouped.
Definition: Grouping.cpp:78
TESEEXPORT Symbolizer * CreateSymbolizer(const te::gm::GeomType &geomType)
Try creates an appropriate symbolizer based on given geometry type.
TEGEOMEXPORT bool Rotate(te::gm::Coord2D pr, te::gm::LineString *l, double angle, te::gm::LineString *lOut)
te::sam::rtree::Index< std::size_t, 8 > m_rtree
static te::dt::Date dx(2010, 12, 31)
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
virtual const std::string & getTitle() const
It returns the layer title.
double x
x-coordinate.
Definition: Coord2D.h:113
const Displacement * getDisplacement() const
A class that models the name of any property of an object.
Base exception class for plugin module.
const size_t getPrecision() const
It gets the precision used for the property values.
Definition: Grouping.cpp:99
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
const double & getMinScaleDenominator() const
Definition: Rule.cpp:123
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
A visitor that converts a OGC Filter Expression to TerraLib Expression.
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
Definition: CoverageStyle.h:45
This is the base class for Layers.
std::string getPropertyName() const
It gets the property name whose values will be grouped.
Definition: Grouping.cpp:67
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
void setTransformationParameters(const double &wllx, const double &wlly, const double &wurx, const double &wury, int deviceWidth, int deviceHeight)
It adjusts a new transformation function that maps between the spatial coordinate system of a feature...
TEGEOMEXPORT bool AdjustSegment(te::gm::Point *P0, te::gm::Point *P1, double d0, te::gm::Coord2D &P0out, te::gm::Coord2D &P1out)
virtual void drawDatSetGeometries(te::da::DataSet *dataset, const std::size_t &gpos, Canvas *canvas, int fromSRID, int toSRID, Chart *chart, bool *cancel, te::common::TaskProgress *task=0)
It draws the data set geometries in the given canvas using the informed SRS.
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
This is a singleton for managing chart renderer instance available in the system. ...
virtual te::gm::Polygon * getTextBoundary(int x, int y, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0)=0
It returns the text boundary (its enclose rectangle).
double m_urx
Upper right corner x-coordinate.
te::da::Expression * getExpression(const te::fe::Filter *f)
It converts the OGC Filter Expression to a TerraLib Expression.
It models the inequality operator greater than or equal to (>=).
TESEEXPORT double GetDouble(const te::se::ParameterValue *param)
It gets the parameter value as a double.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
double getY() const
It returns the y-coordinate.
Definition: Coord2D.h:108
const te::fe::Filter * getFilter() const
Definition: Rule.cpp:97
const ParameterValue * getRotation() const
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
void push_back(Symbolizer *s)
Definition: Rule.cpp:138
It renders the objects associated to an abstract layer. i.e. a generic renderer.
TEDATAACCESSEXPORT int GetPropertyIndex(te::da::DataSet *dataSet, const std::string propName)
bool isActive() const
Verify if the task is active.
Raster property.
Boolean logic operator: AND.
This is an abstract class that models a query expression.
virtual te::map::Chart * getChart() const
It returns the Chart associated to the Layer.
const ParameterValue * getDisplacementY() const
Expression * clone() const
It creates a new copy of this expression.
unsigned int line
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
Rule * getRule(std::size_t i) const
Definition: Style.cpp:105
const std::vector< Rule * > & getRules() const
Definition: Style.cpp:94
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
A PointPlacement specifies how a text label should be rendered relative to a geometric point...
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:57
virtual void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)=0
It sets the world (or window) coordinates area (supposing a cartesian reference system).
Coord2D getCenter() const
It returns the rectangle&#39;s center coordinate.
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers.
Definition: STLUtils.h:131
TEFEEXPORT void GetFilterStepValues(const te::fe::Filter *filter, std::string &valueMin, std::string &valueMax)
TEMAPEXPORT void DrawRaster(te::da::DataSetType *type, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid, te::se::CoverageStyle *style, te::map::RasterContrast *rc, const double &scale, bool *cancel)
std::vector< te::color::RGBAColor ** > m_chartImages
double m_llx
Lower left corner x-coordinate.
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
This class represents the informations needed to build map charts.
Definition: Chart.h:51
static T & getInstance()
It returns a reference to the singleton instance.
Definition: Singleton.h:126
A point with x and y coordinate values.
Definition: Point.h:50
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
An Envelope defines a 2D rectangular region.
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
virtual void buildChart(Chart *chart, te::da::DataSet *dataset, te::gm::Geometry *geom)
virtual te::se::Style * getStyle() const
It returns the Style associated to the layer.
virtual std::unique_ptr< LayerSchema > getSchema() const =0
It returns the layer schema.
std::size_t getHeight() const
Definition: Chart.cpp:146
bool isVisible() const
It gets the chart visibility.
Definition: Chart.cpp:191
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
static te::dt::TimeDuration dt(20, 30, 50, 11)
virtual int getHeight() const =0
It returns the canvas height.
A visitor that converts a OGC Filter Expression to TerraLib Expression.
Definition: QueryEncoder.h:53
te::gm::Polygon * p
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
virtual void drawImage(char *src, std::size_t size, ImageType t)=0
It draws the src image over the canvas.
const ParameterValue * getAnchorPointX() const
Definition: AnchorPoint.cpp:48
A filter is any valid predicate expression.
Definition: fe/Filter.h:55
A class that models a literal for double values.
Definition: LiteralDouble.h:43
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
This class represents the informations needed to build map charts.
Utility functions for the data access module.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual void drawDatSetTexts(te::da::DataSet *dataset, const std::size_t &gpos, Canvas *canvas, int fromSRID, int toSRID, te::se::TextSymbolizer *symb, bool *cancel, te::common::TaskProgress *task=0)
const std::vector< Symbolizer * > & getSymbolizers() const
Definition: Rule.cpp:158
double m_lly
Lower left corner y-coordinate.
TEGEOMEXPORT void ClosestPoints(te::gm::Geometry *geomA, te::gm::Geometry *geomB, te::gm::Coord2D &coordA, te::gm::Coord2D &coordB)
Compute the the closest points of two geometries.
virtual te::map::RasterContrast * getRasterContrast() const
It returns the raster contrast associated to the Layer.
virtual void drawLayerGrouping(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid, bool *cancel)
It draws the grouping of the abstract layer in the given canvas using the SRS informed.
TEGEOMEXPORT double GetAngle(te::gm::Coord2D coordA, te::gm::Coord2D coordB)
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
A dataset is the unit of information manipulated by the data access module of TerraLib.
A canvas is an abstraction of a drawing area.
bool isVisible() const
It gets the grouping visibility.
Definition: Grouping.cpp:129
virtual void draw(AbstractLayer *layer, Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the layer geographic objects in the given canvas using the SRS informed. ...
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
double getX() const
It returns the x-coordinate.
Definition: Coord2D.h:102
GroupingType
The grouping type associated to the layer.
const LinePlacement * getLinePlacement() const
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition: Rule.h:76
virtual std::unique_ptr< te::da::DataSet > getData(te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const =0
It gets the dataset identified by the layer name.
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
const ParameterValue * getLabel() const
virtual te::map::Grouping * getGrouping() const
It returns the Grouping associated to the Layer.
double m_ury
Upper right corner y-coordinate.
virtual void drawLayerGroupingMem(AbstractLayer *layer, const std::string &geomPropertyName, Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the grouping of the abstract layer in the given canvas using the SRS informed.
It models the comparison operator.
Definition: EqualTo.h:46
virtual const std::string & getType() const =0
It returns the symbolizer type.
Coord2D * getCentroidCoord() const
It returns the mathematical centroid for this surface as a coordinate.
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.
Definition: RGBAColor.h:57
TESEEXPORT int GetInt(const te::se::ParameterValue *param)
It gets the parameter value as an integer.
std::vector< te::gm::Coord2D > m_chartCoordinates
WorldDeviceTransformer m_transformer
const GroupingType getType() const
It gets the grouping type.
Definition: Grouping.cpp:89
bool getAvoidConflicts() const
Definition: Chart.cpp:206
A class that models a literal for Envelope values.
const ParameterValue * getAnchorPointY() const
Definition: AnchorPoint.cpp:59
virtual const std::string & getGeomPropertyName() const
const double & getMaxScaleDenominator() const
Definition: Rule.cpp:133
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
void world2Device(double &wx, double &wy) const
It transforms the coordinate wx and wy from world coordinates to device (canvas) coordinates without ...
This class contains the parameters needed for grouping the values of a Property.
std::vector< te::rst::BandProperty * > & getBandProperties()
Returns a reference to the list of bands definitions.
void config(const te::se::Symbolizer *symbolizer)
It configs the canvas based on given symbolizer.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
TEGEOMEXPORT te::gm::Line * GetIntersectionLine(te::gm::Geometry *geom, te::gm::Coord2D coord)
const PointPlacement * getPointPlacement() const
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
const ParameterValue * getPerpendicularOffset() const
Definition: LinePlacement.h:85
virtual void draw(const te::gm::Geometry *geom)=0
It draws the geometry on canvas.
TESEEXPORT std::string GetString(const te::se::ParameterValue *param)
It gets the parameter value as a string.
bool isValid() const
It tells if the rectangle is valid or not.
virtual void drawLayerGeometries(AbstractLayer *layer, const std::string &geomPropertyName, te::se::FeatureTypeStyle *style, Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the abstract layer in the given canvas using the SRS informed.
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
virtual int getWidth() const =0
It returns the canvas width.
Coord2D * getCentroidCoord() const
std::size_t getWidth() const
Definition: Chart.cpp:156
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
This class models a string Literal value.
Definition: LiteralString.h:46
static const std::string sm_nanStr
Not a number string value.
const std::string & getName() const
It returns the property name.
Definition: Property.h:127
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
TEFEEXPORT void GetFilterUniqueValue(const te::fe::Filter *filter, std::string &value)