AbstractMapDisplay.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 terralib/maptools/AbstractMapDisplay.h
22 
23  \brief It defines the concept of a map display responsible for controlling how a set of layers are displayed.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTMAPDISPLAY_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTMAPDISPLAY_H
28 
29 // TerraLib
30 #include "AbstractLayer.h"
31 #include "Enums.h"
32 
33 // STL
34 #include <list>
35 
36 // Boost
37 #include <boost/noncopyable.hpp>
38 
39 namespace te
40 {
41  namespace map
42  {
43  /*!
44  \class AbstractMapDisplay
45 
46  \brief It defines the concept of a map display responsible for controlling how a set of layers are displayed.
47 
48  \ingroup map
49 
50  \sa AbstractLayer, MapDisplay
51  */
52  class TEMAPEXPORT AbstractMapDisplay : public boost::noncopyable
53  {
54  public:
55 
56  /*! \brief It initializes a new MapDisplay. */
57  AbstractMapDisplay():m_cancel(false) { }
58 
59  /*! \brief Virtual destructor. */
60  virtual ~AbstractMapDisplay() { }
61 
62  /** @name Map Display Virtual Methods
63  * Methods to configure the MapDisplay.
64  */
65  //@{
66 
67  /*!
68  \brief It sets the layer list to be showed in the Map Display.
69 
70  \param layers The layer list.
71  */
72  virtual void setLayerList(const std::list<te::map::AbstractLayerPtr>& layers) = 0;
73 
74  /*!
75  \brief It returns the MapDisplay current horizontal align.
76 
77  \return The MapDisplay current horizontal align.
78  */
79  virtual te::map::AlignType getHAlign() const = 0;
80 
81  /*!
82  \brief It returns the MapDisplay current vertical align.
83 
84  \return The MapDisplay current vertical align.
85  */
86  virtual te::map::AlignType getVAlign() const = 0;
87 
88  /*!
89  \brief It will set the align rendering of objects into the map display. Just successive drawings will be affected by this modification.
90 
91  \param h The new horizontal align.
92  \param v The new vertical align.
93 
94  \note It will not automatically redraw the objects, you must explicit call the setExtent method.
95  */
96  virtual void setAlign(te::map::AlignType h, te::map::AlignType v) = 0;
97 
98  /*!
99  \brief It returns the world extent showned by the MapDisplay.
100 
101  \return The world extent showned by the MapDisplay or NULL if none is set.
102 
103  \note The extent coordinates are in the Map Display SRS.
104  */
105  virtual const te::gm::Envelope& getExtent() const = 0;
106 
107  /*!
108  \brief It sets the world visible area and refreshes the contents in the map display.
109 
110  If the given area is not proportional to the device width and height,
111  the MapDisplay will change it in order to preserve the aspect ratio.
112 
113  \param e The world visible area.
114  \param doRefresh If true the display will refresh its contents.
115 
116  \pre The world coordinates must be in the map display SRS.
117  */
118  virtual void setExtent(te::gm::Envelope& e, bool doRefresh = true) = 0;
119 
120  /*!
121  \brief It return the Spatial Reference System used by the Map Display.
122 
123  \return The Spatial Reference System used by the Map Display.
124  */
125  virtual int getSRID() const = 0;
126 
127  /*!
128  \brief It sets a new Spatial Reference System to be used by the Map Display.
129 
130  It will also convert the current envelope coordinates to the new SRS. This may
131  cause changes to the world visible area. In this case, the extent will be updated and
132  new internal transformation function will be calculated.
133 
134  \param srid The new Spatial Reference System to be used by the Map Display.
135  \param doRefresh If true the display will refresh its contents.
136  */
137  virtual void setSRID(const int& srid, bool doRefresh = true) = 0;
138 
139  /*! \brief It updates the contents in the map display. */
140  virtual void refresh(bool redraw = false) = 0;
141 
142  /*!
143  \brief It returns the MapDisplay current width in pixels.
144 
145  \return The MapDisplay current width in pixels.
146  */
147  virtual unsigned int getWidth() const = 0;
148 
149  /*!
150  \brief It returns the MapDisplay current height in pixels.
151 
152  \return The MapDisplay current height in pixels.
153  */
154  virtual unsigned int getHeight() const = 0;
155 
156  /*!
157  \brief It returns the MapDisplay current width in millimeters.
158 
159  \return The MapDisplay current width in millimeters.
160  */
161  virtual double getWidthMM() const = 0;
162 
163  /*!
164  \brief It returns the MapDisplay current height in millimeters.
165 
166  \return The MapDisplay current height in millimeters.
167  */
168  virtual double getHeightMM() const = 0;
169 
170  protected:
171 
172  bool m_cancel;
173 
174 
175  //@}
176  };
177 
178  } // end namespace map
179 } // end namespace te
180 
181 #endif // __TERRALIB_MAPTOOLS_INTERNAL_ABSTRACTMAPDISPLAY_H
It defines the concept of a map display responsible for controlling how a set of layers are displayed...
This is the base class for Layers.
virtual ~AbstractMapDisplay()
Virtual destructor.
AlignType
This enum contains values to control the alignment of components (like Canvas and MapDisplay)...
Definition: Enums.h:125
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
AbstractMapDisplay()
It initializes a new MapDisplay.