27 #include "../../../../common/Translator.h"
28 #include "../../../../dataaccess/datasource/DataSourceInfoManager.h"
29 #include "../../../../maptools/DataSetLayer.h"
30 #include "../../../../se/RasterSymbolizer.h"
31 #include "../../../../se/Style.h"
32 #include "../../../../se/Utils.h"
33 #include "../../Exception.h"
41 #include <QtGui/QMenu>
42 #include <QtGui/QWidget>
64 if(role == Qt::DecorationRole)
65 return QVariant(QIcon::fromTheme(
"dataset-layer"));
67 if(role == Qt::DisplayRole)
68 return QVariant(QString::fromStdString(m_layer->getTitle()));
70 if(role == Qt::CheckStateRole)
71 return QVariant(m_layer->getVisibility() ==
te::map::VISIBLE ? Qt::Checked : Qt::Unchecked);
73 if(role == Qt::ToolTipRole)
74 return buildToolTip();
86 return (((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0);
91 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
96 if(m_layer->getStyle() && children().empty())
98 const std::vector<te::se::Rule*>& rules = m_layer->getStyle()->getRules();
100 for(std::size_t i = 0; i != rules.size(); ++i)
104 if(m_layer->getStyle())
112 if(m_layer->getGrouping() && !hasGroupingItem())
115 if(m_layer->getChart() && !hasChartItem())
116 new ChartItem(m_layer->getChart(),
this);
121 return ((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0;
126 if(role == Qt::CheckStateRole)
128 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt());
130 if(checkState == Qt::Checked)
132 else if(checkState == Qt::Unchecked)
135 m_layer->updateVisibilityOfAncestors();
150 return "DATASET_LAYER_ITEM";
155 GroupingItem* groupingItem = findChild<GroupingItem*>();
157 return groupingItem != 0;
162 ChartItem* chartItem = findChild<ChartItem*>();
164 return chartItem != 0;
177 const std::string&
id = m_layer->getDataSourceId();
179 const std::map<std::string, std::string>& connInfo = info->getConnInfo();
184 std::map<std::string, std::string>::const_iterator it;
185 for(it = connInfo.begin(); it != connInfo.end(); ++it)
187 toolTip += it->first.c_str();
189 toolTip += it->second.c_str();
191 if(i != connInfo.size())
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
A layer with reference to a dataset.
bool canFetchMore() const
const std::string getItemType() const
It returns the item type: "DATASET_LAYER_ITEM".
QString buildToolTip() const
A class that represents a legend item of a layer in a LayerTreeModel.
Qt::ItemFlags flags() const
bool hasChartItem() const
te::map::AbstractLayerPtr getLayer() const
DataSetLayerItem(const te::map::AbstractLayerPtr &l, QObject *parent=0)
The class that represents a dataset layer item in a LayerTreeModel.
QVariant data(int column, int role) const
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
QMenu * getMenu(QWidget *parent=0) const
bool hasColorMapItem() const
A class that represents a grouping of a layer in a LayerTreeModel.
A class that represents a color map of rastersymbolizer of a layer in a LayerTreeModel.
te::se::ColorMap * getColorMap() const
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
The class that represents an item in a LayerTreeModel.
te::map::DataSetLayerPtr m_layer
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
A class that represents a chart of a layer in a LayerTreeModel.
bool hasGroupingItem() const
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr