All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MapDisplay.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/MapDisplay.cpp
22 
23  \brief The map display controls how a set of layers are displayed.
24 */
25 
26 // TerraLib
27 #include "../srs/Config.h"
28 #include "MapDisplay.h"
29 
32  m_srid(TE_UNKNOWN_SRS),
33  m_hAlign(te::map::Center),
34  m_vAlign(te::map::Center)
35 {
36 }
37 
39 {
40 }
41 
42 void te::map::MapDisplay::setLayerList(const std::list<te::map::AbstractLayerPtr>& layers)
43 {
44  m_layerList = layers;
45 }
46 
48 {
49  return m_hAlign;
50 }
51 
53 {
54  return m_vAlign;
55 }
56 
58 {
59  m_hAlign = h;
60  m_vAlign = v;
61 }
62 
64 {
65  return m_extent;
66 }
67 
69 {
70  m_extent = e;
71 }
72 
74 {
75  return m_srid;
76 }
77 
78 void te::map::MapDisplay::setSRID(const int& srid, bool doRefresh)
79 {
80  if(m_srid == srid)
81  return;
82 
83  if(m_srid != TE_UNKNOWN_SRS && srid != TE_UNKNOWN_SRS && m_extent.isValid())
84  m_extent.transform(m_srid, srid);
85 
86  m_srid = srid;
87 
88  if(m_extent.isValid())
89  setExtent(m_extent, doRefresh);
90 }
It defines the concept of a map display responsible for controlling how a set of layers are displayed...
virtual ~MapDisplay()
Virtual destructor.
Definition: MapDisplay.cpp:38
virtual te::map::AlignType getHAlign() const
It returns the MapDisplay current horizontal align.
Definition: MapDisplay.cpp:47
virtual void setExtent(te::gm::Envelope &e, bool doRefresh=true)
It sets the world visible area and refreshes the contents in the map display.
Definition: MapDisplay.cpp:68
AlignType
This enum contains values to control the alignment of components (like Canvas and MapDisplay)...
Definition: Enums.h:124
The map display controls how a set of layers are displayed.
virtual void setLayerList(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the layer list to be showed in the Map Display.
Definition: MapDisplay.cpp:42
MapDisplay()
It initializes a new MapDisplay.
Definition: MapDisplay.cpp:30
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
Definition: Config.h:44
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display.
Definition: MapDisplay.cpp:78
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
Definition: MapDisplay.cpp:73
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
Definition: MapDisplay.cpp:63
virtual void setAlign(te::map::AlignType h, te::map::AlignType v)
It will set the align rendering of objects into the map display. Just successive drawings will be aff...
Definition: MapDisplay.cpp:57
virtual te::map::AlignType getVAlign() const
It returns the MapDisplay current vertical align.
Definition: MapDisplay.cpp:52