LayerRenderer.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 LayerRenderer.h
22 
23  \brief It renders the objects associated to a Layer.
24  */
25 
26 #ifndef __TERRALIB_GRAPH_INTERNAL_LAYERRENDERER_H
27 #define __TERRALIB_GRAPH_INTERNAL_LAYERRENDERER_H
28 
29 // TerraLib
30 #include "../../maptools/AbstractRenderer.h"
31 #include "../Config.h"
32 
33 
34 namespace te
35 {
36 // Forward declarations
37  namespace gm { class Envelope; }
38 
39  namespace map
40  {
41  class AbstractLayer;
42  class Canvas;
43  }
44 
45  namespace graph
46  {
47  //forward declaration
48  class AbstractGraph;
49 
50  /*!
51  \class LayerRenderer
52 
53  \brief It renders the objects associated to a Layer.
54 
55  \sa Layer, AbstractRenderer, Canvas
56  */
58  {
59  public:
60 
61  /** @name Initializer Methods
62  * Methods related to instantiation and destruction.
63  */
64  //@{
65 
66  /*! Constructor */
67  LayerRenderer();
68 
69  /*! \brief Destructor. */
70  ~LayerRenderer();
71 
72  //@}
73 
74  /** @name Implementation of Pure Virtual Methods from AbstractLayer
75  * Every subclass must implent this interface.
76  */
77  //@{
78 
79  /*!
80  \brief It draws the layer geographic objects in the given canvas using the informed SRS.
81 
82  The informed bounding box (bbox) is used to constraint the Layer objects to be drawn.
83  The bbox coordinates must be in the Spatial Reference System given by srid.
84 
85  \param layer The layer to be rendered.
86  \param canvas The canvas were the layer objects will be drawn.
87  \param bbox The interest area to render the map.
88  \param srid The SRS to be used to draw the layer objects.
89  */
90  virtual void draw(te::map::AbstractLayer* layer, te::map::Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
91 
92  //@}
93 
94  protected:
95 
96  /*! \brief Verify if the graph layer has a geometry to define the vertexs elements. */
97  int checkVertexGeometryProperty(te::graph::AbstractGraph* g);
98 
99  /*! \brief Verify if the graph layer has a geometry to define the edges elements. */
100  int checkEdgeGeometryProperty(te::graph::AbstractGraph* g);
101 
102  /*! \brief Configs the canvas with default values for line styles. */
103  void configDefaultLine(te::map::Canvas* canvas);
104 
105  /*! \brief Configs the canvas with default values for point styles. */
106  void configDefaultPoint(te::map::Canvas* canvas);
107 
108  /*! \brief Configs the canvas with default values for point styles. */
109  void configLoopPoint(te::map::Canvas* canvas);
110 
111  void drawDataSourceGraph(te::graph::AbstractGraph* g, te::map::Canvas* canvas, const te::gm::Envelope& bbox);
112 
113  void drawMemoryGraph(te::graph::AbstractGraph* g, te::map::Canvas* canvas, const te::gm::Envelope& bbox, int srid);
114 
115  private:
116 
117  /** @name Copy Constructor and Assignment Operator
118  * Copy constructor and assignment operator not allowed.
119  */
120  //@{
121 
122  /*!
123  \brief Copy constructor not allowed.
124 
125  \param rhs The right-hand-side copy that would be used to copy from.
126  */
127  LayerRenderer(const LayerRenderer& rhs);
128 
129  /*!
130  \brief Assignment operator not allowed.
131 
132  \param rhs The right-hand-side copy that would be used to copy from.
133 
134  \return A reference to this object.
135  */
136  LayerRenderer& operator=(const LayerRenderer& rhs);
137 
138  //@}
139  };
140 
141  } // end namespace graph
142 } // end namespace te
143 
144 #endif // __TERRALIB_GRAPH_INTERNAL_LAYERRENDERER_H
145 
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178
This is the base class for layers.
Definition: AbstractLayer.h:76
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:55
URI C++ Library.
It renders the objects associated to a Layer.
Definition: LayerRenderer.h:57
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:92
It renders the objects associated to a layer.