All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Layer.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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 Layer.h
22 
23  \brief A Layer is a reference to a virtual dataset with/without geometric attributes.
24 */
25 
26 #ifndef __TERRALIB_GRAPH_INTERNAL_LAYER_H
27 #define __TERRALIB_GRAPH_INTERNAL_LAYER_H
28 
29 // TerraLib
30 #include "../../maptools/AbstractLayer.h"
31 #include "../Config.h"
32 
33 
34 // STL
35 #include <memory>
36 
37 namespace te
38 {
39  namespace gm { class Envelope; }
40 
41  namespace map
42  {
43  class AbstractLayer;
44  class Canvas;
45  }
46 
47  namespace se { class Style; }
48 
49  namespace graph
50  {
51 // Forward declarations
52  class AbstractGraph;
53  class LayerRenderer;
54 
55  /*!
56  \class Layer
57 
58  \brief A Layer is a reference to a virtual dataset with/without geometric attributes.
59 
60  A Layer is the result of a query in a given DataSource.
61 
62  \sa AbstractLayer
63  */
65  {
66  public:
67 
68  /*!
69  \brief It initializes a new Layer.
70 
71  \param id The layer id.
72  \param title The title is a brief description about the layer, that can be used by an application to show a meaninfull label to the user.
73  \param parent The parent Layer (or NULL if it has no parent).
74 
75  \note If parent is informed, it will take the ownership of the new layer.
76  */
77  Layer(const std::string& id, const std::string& title, AbstractLayer* parent = 0);
78 
79  /*! \brief Destructor. */
80  ~Layer();
81 
82  /*!
83  \brief It returns the layer type.
84 
85  \return The layer type.
86  */
87  virtual const std::string& getType() const;
88 
89  /*!
90  \brief It returns true if the layer can be drawn, otherwise, it returns false.
91 
92  This method can be used to check if the data referenced by the layer is available (accessible), or not.
93 
94  \return True, if the layer can be drawn, otherwise, it returns false.
95  */
96  virtual bool isValid() const;
97 
98  /*!
99  \brief It draws the layer geographic objects in the given canvas using the informed SRS.
100 
101  The informed bounding box can be used to constraint the layer objects to be drawn.
102 
103  The bbox coordinates must be in the same Spatial Reference System given by srid.
104 
105  \param canvas The canvas were the layer objects will be drawn.
106  \param bbox The interest area to render the map.
107  \param srid The SRS to be used to draw the layer objects.
108  */
109  virtual void draw(te::map::Canvas* canvas, const te::gm::Envelope& bbox, int srid) ;
110 
111  /*!
112  \brief It returns the graph associated to the layer.
113 
114  \return the graph associated to the layer.
115  */
116  te::graph::AbstractGraph* getGraph() const;
117 
118  /*!
119  \brief It sets the graph associated to the layer.
120 
121  \param ds The graph associated to the layer.
122  */
123  void setGraph(te::graph::AbstractGraph* ds);
124 
125  /*!
126  \brief It returns the renderer used to paint this layer.
127 
128  \return The renderer used to paint this layer.
129  */
130  LayerRenderer* getRenderer() const;
131 
132  /*!
133  \brief It sets the renderer used to paint this layer.
134 
135  \param renderer The renderer to be used to paint this layer.
136 
137  \note The Layer will take the ownership of the given renderer.
138  */
139  void setRenderer(LayerRenderer* renderer);
140 
141  public:
142 
143  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
144 
145  private:
146 
147 // int m_srid; //!< The layer SRS.
148  std::auto_ptr<te::gm::Envelope> m_mbr; //!< The Layer bounding box.
149  std::auto_ptr<te::se::Style> m_style; //!< The style to be applied to the geographic objects in the layer.
150  std::auto_ptr<LayerRenderer> m_renderer; //!< A pointer to the internal renderer used to paint this layer.
151  te::graph::AbstractGraph* m_graph; //!< The graph associated to this Layer.
152  };
153 
154  } // end namespace graph
155 } // end namespace te
156 
157 #endif // __TERRALIB_GRAPH_INTERNAL_LAYER_H
158 
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:56
std::auto_ptr< LayerRenderer > m_renderer
A pointer to the internal renderer used to paint this layer.
Definition: Layer.h:150
static const std::string sm_type
A static data member used in the implementation of getType method.
Definition: Layer.h:143
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:216
std::auto_ptr< te::gm::Envelope > m_mbr
The Layer bounding box.
Definition: Layer.h:148
This is the base class for layers.
Definition: AbstractLayer.h:76
te::graph::AbstractGraph * m_graph
The graph associated to this Layer.
Definition: Layer.h:151
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:91
A Layer is a reference to a virtual dataset with/without geometric attributes.
Definition: Layer.h:64
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
std::auto_ptr< te::se::Style > m_style
The style to be applied to the geographic objects in the layer.
Definition: Layer.h:149
It renders the objects associated to a Layer.
Definition: LayerRenderer.h:54