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"
64 if(role == Qt::DecorationRole)
66 if(m_layer->isValid())
67 return QVariant(QIcon::fromTheme(
"dataset-layer"));
69 return QVariant(QIcon::fromTheme(
"dataset-layer-invalid"));
72 if(role == Qt::DisplayRole)
73 return QVariant(QString::fromStdString(m_layer->getTitle()));
75 if(role == Qt::CheckStateRole)
76 return QVariant(m_layer->getVisibility() ==
te::map::VISIBLE ? Qt::Checked : Qt::Unchecked);
78 if(role == Qt::ToolTipRole)
79 return buildToolTip();
91 return (((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0);
96 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
101 if(m_layer->getStyle() && children().empty())
103 const std::vector<te::se::Rule*>& rules = m_layer->getStyle()->getRules();
105 for(std::size_t i = 0; i != rules.size(); ++i)
109 if(m_layer->getStyle())
117 if(m_layer->getGrouping() && !hasGroupingItem())
120 if(m_layer->getChart() && !hasChartItem())
121 new ChartItem(m_layer->getChart(),
this);
126 return ((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0;
131 if(role == Qt::CheckStateRole)
133 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt());
135 if(checkState == Qt::Checked)
137 else if(checkState == Qt::Unchecked)
140 m_layer->updateVisibilityOfAncestors();
155 return "DATASET_LAYER_ITEM";
160 GroupingItem* groupingItem = findChild<GroupingItem*>();
162 return groupingItem != 0;
167 ChartItem* chartItem = findChild<ChartItem*>();
169 return chartItem != 0;
181 if(!m_layer->isValid())
182 return tr(
"Invalid Layer");
187 toolTip += tr(
"DataSet") +
": " + m_layer->getDataSetName().c_str() +
"\n";
190 const std::string&
id = m_layer->getDataSourceId();
192 const std::map<std::string, std::string>& connInfo = info->getConnInfo();
194 toolTip += tr(
"Connection Info") +
":\n";
197 std::map<std::string, std::string>::const_iterator it;
198 for(it = connInfo.begin(); it != connInfo.end(); ++it)
200 toolTip += it->first.c_str();
202 toolTip += it->second.c_str();
204 if(i != connInfo.size())
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
The class that represents a dataset layer item in a LayerTreeModel.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
A class that represents a chart of a layer in a LayerTreeModel.
te::se::ColorMap * getColorMap() const
A layer with reference to a dataset.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
A class that represents a color map of rastersymbolizer of a layer in a LayerTreeModel.