27 #include "../../common/Translator.h"
28 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
29 #include "../../qt/widgets/layer/explorer/ColorMapItem.h"
30 #include "../../qt/widgets/layer/explorer/LegendItem.h"
31 #include "../../se/RasterSymbolizer.h"
32 #include "../../se/Style.h"
33 #include "../../se/Utils.h"
34 #include "../Exception.h"
45 :
te::qt::widgets::AbstractTreeItem(parent)
61 if(role == Qt::DecorationRole)
62 return QVariant(QIcon::fromTheme(
"datasource-wms"));
64 if(role == Qt::DisplayRole)
65 return QVariant(QString::fromStdString(m_layer->getTitle()));
67 if(role == Qt::CheckStateRole)
68 return QVariant(m_layer->getVisibility() ==
te::map::VISIBLE ? Qt::Checked : Qt::Unchecked);
70 if(role == Qt::ToolTipRole)
71 return buildToolTip();
83 return ((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty()));
88 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
93 if(m_layer->getStyle() && children().empty())
95 const std::vector<te::se::Rule*>& rules = m_layer->getStyle()->getRules();
97 for(std::size_t i = 0; i != rules.size(); ++i)
101 if(m_layer->getStyle())
112 return (m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty());
117 if(role == Qt::CheckStateRole)
119 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt());
121 if(checkState == Qt::Checked)
123 else if(checkState == Qt::Unchecked)
126 m_layer->updateVisibilityOfAncestors();
141 return "WMS_LAYER_ITEM";
154 const std::string&
id = m_layer->getDataSourceId();
156 const std::map<std::string, std::string>& connInfo = info->getConnInfo();
161 std::map<std::string, std::string>::const_iterator it;
162 for(it = connInfo.begin(); it != connInfo.end(); ++it)
164 toolTip += it->first.c_str();
166 toolTip += it->second.c_str();
168 if(i != connInfo.size())
QString buildToolTip() const
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
const std::string getItemType() const
It returns the item type: "WMS_LAYER_ITEM".
WMSLayerItem(const te::map::AbstractLayerPtr &l, QObject *parent=0)
A layer with reference to a WMS Layer.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
The class that represents a WMS layer item in a LayerTreeModel.
Qt::ItemFlags flags() const
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
QMenu * getMenu(QWidget *parent=0) const
bool canFetchMore() const
te::map::AbstractLayerPtr getLayer() const
QVariant data(int column, int role) const
te::se::ColorMap * getColorMap() const
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
bool hasColorMapItem() const
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr