WMSLayerItem.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 #include "WMSLayerItem.h"
21 
22 
24  : QTreeWidgetItem(parent)
25 {
26  m_layer = rootLayer;
27 
28  std::string nameValue = m_layer.m_title.empty() ? m_layer.m_name : m_layer.m_title;
29 
30  this->setText(0, QString(nameValue.c_str()));
31  this->setText(1, QString(m_layer.m_abstract.c_str()));
32 
33 
34  this->setFlags(this->flags() | Qt::ItemIsSelectable);
35 
36  for(size_t i = 0; i < m_layer.m_layers.size(); i++)
37  {
38  WMSLayerItem* child = new WMSLayerItem(m_layer.m_layers[i]);
39  this->addChild(child);
40  }
41 
42  this->buildDefaultRequest();
43 }
44 
46 
47 {
48  m_layer = layer;
49 
50  std::string nameValue = m_layer.m_title.empty() ? m_layer.m_name : m_layer.m_title;
51 
52  this->setText(0, QString(nameValue.c_str()));
53  this->setText(1, QString(m_layer.m_abstract.c_str()));
54 
55 
56  this->setFlags(this->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
57  this->setCheckState(0, Qt::Unchecked);
58 
59  for(size_t i = 0; i < m_layer.m_layers.size(); i++)
60  {
61  WMSLayerItem* child = new WMSLayerItem(m_layer.m_layers[i]);
62  this->addChild(child);
63  }
64 
65  this->buildDefaultRequest();
66 }
67 
69 
71 {
72  return m_layer;
73 }
74 
76 {
77  return m_request;
78 }
79 
81 {
83 }
84 
86 {
88 
89  m_request.m_layers.push_back(m_layer.m_name);
90 
91  if(m_layer.m_styles.size() > 0)
92  {
93  m_request.m_styles.push_back(m_layer.m_styles[0].m_name);
94  }
95 
96  m_request.m_srs = "EPSG:4326";
97 
99  bbox.m_crs = m_request.m_srs;
104 
105  m_request.m_boundingBox = bbox;
106 }
const te::ws::ogc::wms::Layer & getLayer() const
te::ws::ogc::wms::Layer m_layer
Definition: WMSLayerItem.h:78
QTreeWidgetItem extension to WMS Layers.
te::ws::ogc::wms::WMSGetMapRequest m_request
Definition: WMSLayerItem.h:80
The Layer WMS 1.3.0 struct.
void setRequest(const te::ws::ogc::wms::WMSGetMapRequest &request)
The WMSLayerItem class is an extension of QTreeWidgetItem to handle WMS Layer creation.
Definition: WMSLayerItem.h:56
GeographicBoundingBox m_geoBoundingBox
WMSLayerItem(const te::ws::ogc::wms::Layer &rootLayer, QTreeWidget *parent)
The WMSGetMapRequest WMS 1.3.0 struct.
The BoundingBox WMS 1.3.0 struct.
const te::ws::ogc::wms::WMSGetMapRequest & getRequest() const