30 #include "../core/enum/Enums.h"
31 #include "../core/property/Properties.h"
32 #include "../core/property/SharedProperties.h"
33 #include "../../maptools/CanvasConfigurer.h"
34 #include "../../se/Symbolizer.h"
35 #include "../../se/Style.h"
36 #include "../../se/Rule.h"
66 if((!canvas) || (!utils))
72 drawBackground(context);
74 drawLegend(canvas, utils);
91 double x1 = m_box.getLowerLeftX() + m_borderDisplacement;
92 double y1 = m_box.getUpperRightY() - m_borderDisplacement - htxt;
98 const std::vector<te::se::Symbolizer*>& symbolizers = m_rule->getSymbolizers();
100 if(symbolizers.empty())
105 std::size_t nSymbolizers = symbolizers.size();
107 for(std::size_t j = 0; j < nSymbolizers; ++j)
116 te::gm::Envelope box(x1, y1 - m_displacementBetweenTitleAndSymbols - (m_displacementBetweenSymbols * j),
117 x1 + m_symbolsize, y1 - m_displacementBetweenTitleAndSymbols - (m_displacementBetweenSymbols * j) - m_symbolsize);
124 std::string* nameRule =
const_cast<std::string*
>(m_rule->getName());
125 std::string n = symb->
getName();
129 name = nameRule->c_str();
135 name =
"Legend_" + convert.str();
172 if(!m_layer->getStyle())
176 std::size_t nRules = m_layer->getStyle()->getRules().size();
178 for(std::size_t i = 0; i < nRules; ++i)
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
virtual te::se::Rule * getRule()
virtual void setPixmap(te::color::RGBAColor **pixmap)
Stores pixmap generated after drawing.
void setColor(const std::string &hexColor)
It sets the color using a two hexadecimal RGB-encoded color.
virtual void textBoundingBox(double &w, double &h, std::string txt)
A method that calculates the height and width of a text.
virtual void drawLegend(te::map::Canvas *canvas, Utils *utils)
A Symbolizer describes how a feature is to appear on a map.
virtual void visitDependent(ContextItem context)
visit and if necessary redraw
virtual void drawRectW(te::gm::Envelope box)
Draw a rectangle in world coordinates (mm).
te::color::RGBAColor m_fontColor
virtual void drawText(int x, int y, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
It draws a text.
void setPointSize(int point)
Sets point size of the font.
EnumType * m_type
type of the MVC component
virtual void refreshRule()
virtual void setTextUnderline(bool b)=0
It sets the text underline flag.
static Enums & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
virtual Utils * getUtils()
const std::string & getName() const
te::gm::Envelope m_box
bounding rectangle
virtual te::map::AbstractLayerPtr getLayer()
Class that represents a "Model" part of Map MVC component. Its coordinate system is the same of scene...
virtual void setTextColor(const te::color::RGBAColor &color)=0
It sets the text drawing color.
virtual te::map::Canvas * getCanvas()
Return canvas.
Class that represents a "Model" part of Map MVC component. Its coordinate system is the same of scene...
virtual void setTextStrikeOut(bool b)=0
It sets the text strike out flag.
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...
double m_ury
Upper right corner y-coordinate.
virtual te::color::RGBAColor ** getImageW(te::gm::Envelope boxmm)
Returns a pointer RGBA colors that representing an image.
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
virtual void draw(ContextItem context)
Drawing method of the MVC component.
std::string convert(const path &v)
URI path to string.
virtual void configCanvas(te::gm::Envelope box, bool resize=true, bool applyZoom=true)
Sets the viewport and window of the canvas. The viewport is only changed if the resize parameter is t...
virtual ~LegendChildModel()
virtual void setRule(te::se::Rule *rule)
Utility class with functions to manipulate the canvas and conversion between projections.
virtual bool isResizeCanvas()
Returns whether the canvas should or should not be resized.
virtual void setTextPointSize(double size)=0
It sets the text point Size.