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(
"trajectory-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->hasChildren();
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 "TRAJECTORY_LAYER_ITEM";
138 return groupingItem != 0;
145 return chartItem != 0;
QMenu * getMenu(QWidget *parent=0) const
TrajectoryLayerItem(const te::map::AbstractLayerPtr &l, QObject *parent=0)
te::map::AbstractLayerPtr getLayer() const
te::st::TrajectoryDataSetLayerPtr m_layer
bool hasGroupingItem() const
bool hasChartItem() const
bool canFetchMore() const
A layer with reference to a dataset that contains trajectories.
const std::string getItemType() const
It returns the item type.
Qt::ItemFlags flags() const
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
QVariant data(int column, int role) const