27 #include "../../../common/Translator.h"
28 #include "../../../se/Style.h"
29 #include "../../../qt/widgets/Exception.h"
30 #include "../../../qt/widgets/layer/explorer/ChartItem.h"
31 #include "../../../qt/widgets/layer/explorer/GroupingItem.h"
32 #include "../../../qt/widgets/layer/explorer/LegendItem.h"
40 :
te::qt::widgets::AbstractTreeItem(parent)
56 if(role == Qt::DecorationRole)
57 return QVariant(QIcon::fromTheme(
"timeseries-layer"));
59 if(role == Qt::DisplayRole)
60 return QVariant(QString::fromStdString(m_layer->getTitle()));
62 if(role == Qt::CheckStateRole)
63 return QVariant(m_layer->getVisibility() ==
te::map::VISIBLE ? Qt::Checked : Qt::Unchecked);
75 return (((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0);
80 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
85 if(m_layer->getStyle() && children().empty())
87 const std::vector<te::se::Rule*>& rules = m_layer->getStyle()->getRules();
89 for(std::size_t i = 0; i != rules.size(); ++i)
93 if(m_layer->getGrouping() && !hasGroupingItem())
96 if(m_layer->getChart() && !hasChartItem())
102 return ((m_layer->getStyle() != 0) && (!m_layer->getStyle()->getRules().empty())) || m_layer->getGrouping() != 0 || m_layer->getChart() != 0;
107 if(role == Qt::CheckStateRole)
109 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt());
111 if(checkState == Qt::Checked)
113 else if(checkState == Qt::Unchecked)
116 m_layer->updateVisibilityOfAncestors();
131 return "TimeSeries_LAYER_ITEM";
138 return groupingItem != 0;
145 return chartItem != 0;
QMenu * getMenu(QWidget *parent=0) const
te::map::AbstractLayerPtr getLayer() const
A layer with reference to a dataset that contains trajectories.
bool canFetchMore() const
const std::string getItemType() const
It returns the item type.
bool hasGroupingItem() const
Qt::ItemFlags flags() const
bool hasChartItem() const
TimeSeriesLayerItem(const te::map::AbstractLayerPtr &l, QObject *parent=0)
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::st::TimeSeriesDataSetLayerPtr m_layer
QVariant data(int column, int role) const