27 #include "../../../../common/Translator.h"
28 #include "../../../../maptools/QueryLayer.h"
29 #include "../../../../se/Style.h"
30 #include "../../Exception.h"
61 if(role == Qt::DecorationRole)
62 return QVariant(QIcon::fromTheme(
"query-layer"));
64 if(role == Qt::DisplayRole)
65 return QVariant(QString::fromUtf8(m_layer->getTitle().c_str()));
67 if(role == Qt::CheckStateRole)
68 return QVariant(m_layer->getVisibility() ==
te::map::VISIBLE ? Qt::Checked : Qt::Unchecked);
87 return (((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0);
92 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;;
97 if(m_layer->getStyle() && children().empty())
99 const std::vector<te::se::Rule*>& rules = m_layer->getStyle()->getRules();
101 for(std::size_t i = 0; i != rules.size(); ++i)
105 if(m_layer->getGrouping() && !hasGroupingItem())
108 if(m_layer->getChart() && !hasChartItem())
109 new ChartItem(m_layer->getChart(),
this);
114 return (m_layer->getStyle() != 0) && (m_layer->getStyle()->getRules().empty() ==
false);
119 if(role == Qt::CheckStateRole)
121 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt());
122 if(checkState == Qt::Checked)
124 else if(checkState == Qt::Unchecked)
127 m_layer->updateVisibilityOfAncestors();
142 return "QUERY_LAYER_ITEM";
147 GroupingItem* groupingItem = findChild<GroupingItem*>();
149 return groupingItem != 0;
154 ChartItem* chartItem = findChild<ChartItem*>();
156 return chartItem != 0;
A layer resulting from a query.
A class that represents a chart of a layer in a LayerTreeModel.
The class that represents a query layer item in a LayerTreeModel.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr