src/terralib/maptools/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 
31  : m_srid(TE_UNKNOWN_SRS),
32  m_hAlign(te::map::Center),
33  m_vAlign(te::map::Center)
34 {
35 }
36 
38 
39 std::list<te::map::AbstractLayerPtr> te::map::MapDisplay::getLayerList() const
40 {
41  return m_layerList;
42 }
43 
44 void te::map::MapDisplay::setLayerList(const std::list<te::map::AbstractLayerPtr>& layers)
45 {
46  m_layerList = layers;
47 }
48 
50 {
51  return m_hAlign;
52 }
53 
55 {
56  return m_vAlign;
57 }
58 
60 {
61  m_hAlign = h;
62  m_vAlign = v;
63 }
64 
66 {
67  return m_extent;
68 }
69 
71 {
72  m_extent = e;
73 }
74 
76 {
77  return m_srid;
78 }
79 
80 void te::map::MapDisplay::setSRID(const int& srid, bool doRefresh)
81 {
82  if(m_srid == srid)
83  return;
84 
85  if(m_srid != TE_UNKNOWN_SRS && srid != TE_UNKNOWN_SRS && m_extent.isValid())
86  m_extent.transform(m_srid, srid);
87 
88  m_srid = srid;
89 
90  if(m_extent.isValid())
91  setExtent(m_extent, doRefresh);
92 }
te::map::AlignType m_hAlign
The display horizontal align.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
virtual std::list< AbstractLayerPtr > getLayerList() const
virtual ~MapDisplay()
Virtual destructor.
te::map::AlignType m_vAlign
The display vertical align.
virtual te::map::AlignType getHAlign() const
It returns the MapDisplay current horizontal align.
virtual void setExtent(te::gm::Envelope &e, bool doRefresh=true)
It sets the world visible area and refreshes the contents in the map display.
AlignType
This enum contains values to control the alignment of components (like Canvas and MapDisplay)...
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.
MapDisplay()
It initializes a new MapDisplay.
An Envelope defines a 2D rectangular region.
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
URI C++ Library.
Definition: Attributes.h:37
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
int m_srid
The display SRS.
te::gm::Envelope m_extent
The display extent.
std::list< te::map::AbstractLayerPtr > m_layerList
The layer list to be displayed.
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...
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
bool isValid() const
It tells if the rectangle is valid or not.
virtual te::map::AlignType getVAlign() const
It returns the MapDisplay current vertical align.