LegendModel.h
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 LegendModel.h
22 
23  \brief Class that represents a "Model" part of Legend MVC component.
24  Its coordinate system is the same of scene (millimeters).
25  This is also son of ItemModelObservable, so it can become observable, and son of AbstractVisitor, so it can become visitor.
26  It is must visit the map, via te::layout::Visitable*, to get the layers.
27 
28  \ingroup layout
29 */
30 
31 #ifndef __TERRALIB_LAYOUT_INTERNAL_LEGEND_MODEL_H
32 #define __TERRALIB_LAYOUT_INTERNAL_LEGEND_MODEL_H
33 
34 // TerraLib
35 #include "../core/pattern/mvc/ItemModelObservable.h"
36 #include "../core/ContextItem.h"
37 #include "../core/pattern/derivativevisitor/AbstractVisitor.h"
38 #include "../../maptools/AbstractLayer.h"
39 #include "../../maptools/Canvas.h"
40 #include "../../maptools/Grouping.h"
41 #include "../core/Utils.h"
42 #include "../core/Font.h"
43 #include "../core/Config.h"
44 
45 // STL
46 #include <map>
47 
48 namespace te
49 {
50  namespace layout
51  {
52  /*!
53  \brief Class that represents a "Model" part of Legend MVC component.
54  Its coordinate system is the same of scene (millimeters).
55  This is also son of ItemModelObservable, so it can become observable, and son of AbstractVisitor, so it can become visitor.
56  It is must visit the map, via te::layout::Visitable*, to get the layers.
57 
58  \ingroup layout
59 
60  \sa te::layout::ItemModelObservable , te::layout::AbstractVisitor
61  */
63  {
64  public:
65 
66  /*!
67  \brief Constructor
68  */
69  LegendModel();
70 
71  /*!
72  \brief Destructor
73  */
74  virtual ~LegendModel();
75 
76  virtual void draw( ContextItem context );
77 
78  virtual Properties* getProperties() const;
79 
80  virtual void updateProperties(te::layout::Properties* properties);
81 
82  virtual void setBorderDisplacement(double value);
83 
84  virtual double getBorderDisplacement();
85 
86  virtual void setDisplacementBetweenSymbols(double value);
87 
88  virtual double getDisplacementBetweenSymbols();
89 
90  virtual void setDisplacementBetweenTitleAndSymbols(double value);
91 
92  virtual double getDisplacementBetweenTitleAndSymbols();
93 
94  virtual void setDisplacementBetweenSymbolAndText(double value);
95 
96  virtual double getDisplacementBetweenSymbolAndText();
97 
98  virtual double getSymbolSize();
99 
100  virtual void setSymbolSize(const double& value);
101 
102  virtual std::map<te::gm::Point*, std::string> getCoordChildren();
103 
104  virtual te::map::AbstractLayerPtr getLayer();
105 
106  virtual Font getFont();
107 
108  virtual te::color::RGBAColor getFontColor();
109 
110  private:
111 
112  virtual void drawGroupingLegend(te::map::Grouping* grouping, te::map::Canvas* canvas, Utils* utils);
113 
114  virtual void drawStyleLegend(te::se::Style* style, te::map::Canvas* canvas, Utils* utils);
115 
116  virtual void updateBox(ContextItem context);
117 
118  protected:
119 
120  virtual void visitDependent(ContextItem context);
121 
122  virtual void drawLegend(te::map::Canvas* canvas, Utils* utils);
123 
124  virtual void childrenFreeMemory();
125 
126  std::string m_mapName;
132  double m_symbolsize;
135  std::map<te::gm::Point*, std::string> m_coordChildren;
136  };
137  }
138 }
139 
140 #endif
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Definition: ContextItem.h:49
double m_displacementBetweenTitleAndSymbols
Definition: LegendModel.h:130
Class specifies a font.
Definition: Font.h:46
Class that represents a "Model" part of Legend MVC component. Its coordinate system is the same of sc...
Definition: LegendModel.h:62
Abstract class to represent a visitor. All classes representing a visitor must inherit from this clas...
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
std::map< te::gm::Point *, std::string > m_coordChildren
Definition: LegendModel.h:135
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:96
te::color::RGBAColor m_fontColor
Definition: LegendModel.h:134
Abstract class to represent an observable. "Model" part of MVC component. All classes representing th...
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
Definition: Properties.h:52
te::map::AbstractLayerPtr m_layer
Definition: LegendModel.h:127
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:59
URI C++ Library.
double m_displacementBetweenSymbolsAndText
Definition: LegendModel.h:131
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:91
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
double m_displacementBetweenSymbols
Definition: LegendModel.h:129
Utility class with functions to manipulate the canvas and conversion between projections.
Definition: Utils.h:61
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr