WMSLayer.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/ws/ogc/wms/WMSLayer.h
22 
23  \brief A layer with reference to a WMS Layer.
24 */
25 
26 #ifndef __TERRALIB_WS_OGC_WMSLAYER_H
27 #define __TERRALIB_WS_OGC_WMSLAYER_H
28 
29 //TerraLib
30 
31 #include "../../../../maptools/AbstractLayer.h"
32 #include "Config.h"
33 
34 #include "../client/DataTypes.h"
35 
36 namespace te
37 {
38  namespace ws
39  {
40  namespace ogc
41  {
42  namespace wms
43  {
44 
45  /*!
46  \class WMSLayer
47 
48  \brief A layer with reference to a WMS Layer.
49  */
51  {
52 
53  public:
54 
55  /*!
56  \brief It initializes a new layer.
57 
58  \param parent The parent layer (NULL if it has no parent).
59  */
60  WMSLayer(te::map::AbstractLayer* parent = 0);
61 
62  /*!
63  \brief It initializes a new layer.
64 
65  \param id The layer id.
66  \param parent The parent layer (NULL if it has no parent).
67  */
68  WMSLayer(const std::string& id, te::map::AbstractLayer* parent = 0);
69 
70  /*!
71  \brief It initializes a new Layer.
72 
73  \param id The layer id.
74  \param title The title is a brief description about the layer.
75  \param parent The parent layer (NULL if it has no parent).
76  */
77  WMSLayer(const std::string& id, const std::string& title, te::map::AbstractLayer* parent = 0);
78 
79  /*! \brief Destructor. */
80  ~WMSLayer();
81 
82  virtual std::auto_ptr<te::map::LayerSchema> getSchema() const;
83 
84  std::auto_ptr<te::da::DataSet> getData(te::common::TraverseType travType = te::common::FORWARDONLY,
85  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
86 
87  std::auto_ptr<te::da::DataSet> getData(const std::string& propertyName,
88  const te::gm::Envelope* e,
91  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
92 
93  std::auto_ptr<te::da::DataSet> getData(const std::string& propertyName,
94  const te::gm::Geometry* g,
97  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
98 
99  std::auto_ptr<te::da::DataSet> getData(te::da::Expression* restriction,
101  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
102 
103  std::auto_ptr<te::da::DataSet> getData(const te::da::ObjectIdSet* oids,
105  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
106 
107  bool isValid() const;
108 
109  void draw(te::map::Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
110 
111  const std::string& getType() const;
112 
113  const std::string& getDataSourceId() const;
114 
115  void setDataSourceId(const std::string& datadourceId);
116 
117  const std::string& getRendererType() const;
118 
119  void setRendererType(const std::string& rendererType);
120 
121  te::ws::ogc::wms::WMSGetMapRequest getRequest() const;
122 
123  void setGetMapRequest(const te::ws::ogc::wms::WMSGetMapRequest& getMapRequest);
124 
125  /*!
126  \brief It gets a WMS GetMap response with the image on a buffer.
127  The request will be based on WMSGetMapRequest setted to this WMSLayer.
128 
129  \return WMSGetMapResponse with the image, size and format.
130  */
131  const te::ws::ogc::wms::WMSGetMapResponse getMap() const;
132 
133  private:
134 
135  std::string m_datasourceId; //!< The DataSource associated to this layer.
136  std::string m_rendererType; //!< A pointer to the internal renderer used to paint this layer.
138 
139  mutable std::auto_ptr<te::map::LayerSchema> m_schema; //!< The WMS layer schema.
140 
141  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
142  };
143 
144  typedef boost::intrusive_ptr<WMSLayer> WMSLayerPtr;
145  }
146  }
147  }
148 }
149 
150 #endif // __TERRALIB_WS_OGC_WMSLAYER_H
This is the base class for layers.
Definition: AbstractLayer.h:76
te::ws::ogc::wms::WMSGetMapRequest m_getMapRequest
Definition: WMSLayer.h:137
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:127
std::string m_datasourceId
The DataSource associated to this layer.
Definition: WMSLayer.h:135
This is an abstract class that models a query expression.
Definition: Expression.h:47
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
Configuration flags for the Terrralib WS OGC WMS DATA ACCESS module.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
Definition: WMSLayer.h:136
URI C++ Library.
The WMSGetMapResponse WMS 1.3.0 struct.
Definition: DataTypes.h:316
A layer with reference to a WMS Layer.
Definition: WMSLayer.h:50
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
std::auto_ptr< te::map::LayerSchema > m_schema
The WMS layer schema.
Definition: WMSLayer.h:139
#define TEOGCWMSDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:71
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:92
boost::intrusive_ptr< WMSLayer > WMSLayerPtr
Definition: WMSLayer.h:144
static const std::string sm_type
A static data member used in the implementation of getType method.
Definition: WMSLayer.h:141
The WMSGetMapRequest WMS 1.3.0 struct.
Definition: DataTypes.h:286