A specialization of QTreeView for manipulate layers. More...
#include <LayerItemView.h>
Signals | |
Qt signals | |
Signals emitted by LayerItemView | |
| void | doubleClicked (te::map::AbstractLayerPtr layer) |
| Emited when user double clicks over an AbstractLayer. More... | |
| void | styleDoubleClicked (te::map::AbstractLayerPtr layer) |
| Emited when user double clicks over an Style. More... | |
| void | ruleDoubleClicked (te::map::AbstractLayerPtr layer, te::se::Rule *rule) |
| Emited when user double clicks over an Rule. More... | |
| void | visibilityChanged () |
| Emited when some item changes its visibility. More... | |
| void | styleVisibilityChanged (te::map::AbstractLayerPtr layer) |
| Emited when some style item changes its visibility. More... | |
| void | selectedLayersChanged (const std::list< te::map::AbstractLayerPtr > &layers) |
| Emited when the selection changes. More... | |
| void | layerOrderChanged () |
| Emited when the order of the layers has changed. More... | |
Public Member Functions | |
Initializer Methods | |
Methods related to instantiation and destruction. | |
| LayerItemView (QWidget *parent=0) | |
| Constructor. More... | |
| ~LayerItemView () | |
| Destructor. More... | |
Tree manipulation Methods | |
Methods related insertions and recovery of layers in the tree. | |
| void | addLayers (const std::list< te::map::AbstractLayerPtr > &layers, const QModelIndex &idx, const std::string &idxPath="./") |
| Add the layers to the model. More... | |
| void | setLayers (const std::list< te::map::AbstractLayerPtr > &layers) |
| Sets the list of layers. Old layers in the tree are then removed. More... | |
| std::list< te::map::AbstractLayerPtr > | getAllLayers () const |
| Returs all layers in the tree including folders. More... | |
| std::list< te::map::AbstractLayerPtr > | getVisibleLayers () const |
| Returns just the visible layers. No folder layers are returned. More... | |
| std::list< te::qt::widgets::TreeItem * > | getSelectedItems () const |
| Returns a list of TreeItem that are selected. More... | |
| void | addFolder (const std::string &name, const QModelIndex &idx) |
| Adds a folder layer to the model. More... | |
| void | updateChart (const QModelIndex &idx) |
| Updates the chart item of the element. More... | |
| void | updateLegend (te::map::AbstractLayer *l) |
| updateLegend More... | |
Popup Menu manipulation Methods | |
Methods related to manipulation of the popup menus. | |
| void | addNoLayerAction (QAction *act) |
| Adds the action to the popup menu presented when there is no layers selected. More... | |
| void | addAllLayerAction (QAction *act) |
| Adds the action to the popup menu presented for all kinds of selected items. More... | |
| void | addVectorLayerAction (QAction *act) |
| Adds the action to the popup menu presented when the selected layer has vector representation. More... | |
| void | addRasterLayerAction (QAction *act) |
| Adds the action to the popup menu presented when the selected layer has raster representation. More... | |
| void | addTabularLayerAction (QAction *act) |
| Adds the action to the popup menu presented when the selected layer has tabular representation. More... | |
| void | addFolderLayerAction (QAction *act) |
| Adds the action to the popup menu presented when the selected item is a folder. More... | |
| void | addMultipleSelectionAction (QAction *act) |
| Adds the action to the popup menu presented when there is multiple items selected. More... | |
| void | addInvalidLayerAction (QAction *act) |
| Adds the action to the popup menu presented when the selected layer is invalid. More... | |
| QModelIndex | findLayerIndex (QAbstractItemModel *model, const QModelIndex &parent, te::map::AbstractLayer *l) |
| Return the QModelIndex of the Layer in the Tree. More... | |
Remove Methods | |
Methods related to layers removal. | |
| void | removeItems (const QModelIndexList &idxs) |
| Removes the items in the list. More... | |
| void | removeSelectedItems () |
| Removes the items that are selected. More... | |
Tree Customization Methods | |
Methods used to change the tree behavior. These methods can be used for change the Tree presentation and popup menus. You can used delegates to change presentation behavior, and use QObject to handle popup menus. | |
| void | removeDelegate (QStyledItemDelegate *d) |
| Removes the delegate from the tree. More... | |
| void | setMenuEventHandler (QObject *obj) |
| Updates the popup event handler. More... | |
| QObject * | getMenuEventHandler () const |
| Rerturns the current popup handler being used. More... | |
| void | removeMenuEventHandler (QObject *handler) |
| Removes the menu handler. More... | |
Protected Member Functions | |
Qt Reimplemented Methods | |
Methods that are reimplemented of the QTreeView class. | |
| void | selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) |
| void | dropEvent (QDropEvent *event) |
| void | mouseDoubleClickEvent (QMouseEvent *event) |
Protected Attributes | |
| LayerViewMenuManager * | m_mnuMger |
| Default popup handler. More... | |
| LayerItemModel * | m_model |
| Model to be used. More... | |
| QObject * | m_outterFilter |
| Popup handler defined outside the tree. More... | |
A specialization of QTreeView for manipulate layers.
This is a component used to manipulate layers in a visual way. You can add, remove, reparent items, changes its visibility, add folders and some other operations over a set of layers. It can be feeded by the LayersSelector or projects of TerraLib-5.
Definition at line 78 of file LayerItemView.h.
| te::qt::widgets::LayerItemView::LayerItemView | ( | QWidget * | parent = 0 | ) |
Constructor.
| parent | Used by Qt for memory release. |
Definition at line 32 of file LayerItemView.cpp.
References m_mnuMger, m_model, styleVisibilityChanged(), visibilityChanged(), and ~LayerItemView().
|
default |
Destructor.
Referenced by LayerItemView().
| void te::qt::widgets::LayerItemView::addAllLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented for all kinds of selected items.
| act | Action to be added. |
Definition at line 178 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), te::qt::widgets::LayerViewMenuManager::ALL_LAYERS, and m_mnuMger.
Referenced by TerraView::addPopUpMenu().
| void te::qt::widgets::LayerItemView::addFolder | ( | const std::string & | name, |
| const QModelIndex & | idx | ||
| ) |
Adds a folder layer to the model.
| name | Name of the folder. |
| idx | Index of the parent, where the new folder must be inserted in. |
Definition at line 99 of file LayerItemView.cpp.
References te::qt::widgets::LayerItemModel::addFolder(), Expand(), and m_model.
Referenced by TerraView::onAddFolderLayerTriggered().
| void te::qt::widgets::LayerItemView::addFolderLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when the selected item is a folder.
| act | Action to be added. |
Definition at line 198 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), te::qt::widgets::LayerViewMenuManager::FOLDER_LAYER, and m_mnuMger.
Referenced by TerraView::addPopUpMenu().
| void te::qt::widgets::LayerItemView::addInvalidLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when the selected layer is invalid.
| act | Action to be added. |
Definition at line 208 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), te::qt::widgets::LayerViewMenuManager::INVALID_LAYERS, and m_mnuMger.
Referenced by TerraView::addPopUpMenu().
| void te::qt::widgets::LayerItemView::addLayers | ( | const std::list< te::map::AbstractLayerPtr > & | layers, |
| const QModelIndex & | idx, | ||
| const std::string & | idxPath = "./" |
||
| ) |
Add the layers to the model.
| layers | The list of layers to be added. |
| idx | The index of the parent item wich the must be insert. |
| idxPath | Unused. |
Definition at line 60 of file LayerItemView.cpp.
References te::qt::widgets::LayerItemModel::addLayers(), Expand(), and m_model.
Referenced by TerraView::onAddDataSetLayerTriggered(), TerraView::onAddQueryLayerTriggered(), TerraView::onAddTabularLayerTriggered(), te::qt::af::LayerExplorer::onApplicationTriggered(), te::qt::plugins::edit::ToolBar::onCreateLayerActivated(), TerraView::onLayerDuplicateLayerTriggered(), TerraView::onLinkTriggered(), and TerraView::onQueryLayerCreateLayer().
| void te::qt::widgets::LayerItemView::addMultipleSelectionAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when there is multiple items selected.
| act | Action to be added. |
Definition at line 203 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), m_mnuMger, and te::qt::widgets::LayerViewMenuManager::MULTI_LAYERS.
Referenced by TerraView::addPopUpMenu().
| void te::qt::widgets::LayerItemView::addNoLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when there is no layers selected.
| act | Action to be added. |
Definition at line 173 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), m_mnuMger, and te::qt::widgets::LayerViewMenuManager::NO_LAYERS.
Referenced by TerraView::addPopUpMenu().
| void te::qt::widgets::LayerItemView::addRasterLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when the selected layer has raster representation.
| act | Action to be added. |
Definition at line 188 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), m_mnuMger, and te::qt::widgets::LayerViewMenuManager::RASTER_LAYER.
Referenced by TerraView::addPopUpMenu(), and te::qt::af::LayerExplorer::onApplicationTriggered().
| void te::qt::widgets::LayerItemView::addTabularLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when the selected layer has tabular representation.
| act | Action to be added. |
Definition at line 193 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), m_mnuMger, and te::qt::widgets::LayerViewMenuManager::TABULAR_LAYER.
Referenced by TerraView::addPopUpMenu().
| void te::qt::widgets::LayerItemView::addVectorLayerAction | ( | QAction * | act | ) |
Adds the action to the popup menu presented when the selected layer has vector representation.
| act | Action to be added. |
Definition at line 183 of file LayerItemView.cpp.
References te::qt::widgets::LayerViewMenuManager::addAction(), m_mnuMger, and te::qt::widgets::LayerViewMenuManager::VECTOR_LAYER.
Referenced by TerraView::addPopUpMenu().
|
signal |
Emited when user double clicks over an AbstractLayer.
| layer | The layer that receives mouse double click event. |
Referenced by mouseDoubleClickEvent().
|
protected |
Definition at line 282 of file LayerItemView.cpp.
References layerOrderChanged().
| QModelIndex te::qt::widgets::LayerItemView::findLayerIndex | ( | QAbstractItemModel * | model, |
| const QModelIndex & | parent, | ||
| te::map::AbstractLayer * | l | ||
| ) |
Return the QModelIndex of the Layer in the Tree.
| model | The item model. |
| parent | The parent of the index. |
| l | The layer. |
Definition at line 316 of file LayerItemView.cpp.
References te::qt::widgets::TreeItem::getType().
Referenced by updateLegend().
| std::list< te::map::AbstractLayerPtr > te::qt::widgets::LayerItemView::getAllLayers | ( | ) | const |
Returs all layers in the tree including folders.
This method must be called when we need to store the list of layers.
Definition at line 75 of file LayerItemView.cpp.
References te::qt::widgets::LayerItemModel::getAllLayers(), and m_model.
Referenced by te::qt::plugins::tv::TimeViewerDockWidget::onApplyButtonClicked(), TerraView::onSaveProjectTriggered(), and te::qt::plugins::tv::TimeViewerDockWidget::~TimeViewerDockWidget().
| QObject * te::qt::widgets::LayerItemView::getMenuEventHandler | ( | ) | const |
Rerturns the current popup handler being used.
Definition at line 254 of file LayerItemView.cpp.
References m_mnuMger, and m_outterFilter.
| std::list< te::qt::widgets::TreeItem * > te::qt::widgets::LayerItemView::getSelectedItems | ( | ) | const |
Returns a list of TreeItem that are selected.
Definition at line 85 of file LayerItemView.cpp.
Referenced by GetSelectedLayersOnly(), te::qt::widgets::GetSelectedLayersOnly(), te::qt::af::BaseApplication::onCheckSelectedLayerTriggered(), te::qt::af::BaseApplication::onClearSelectedLayerTriggered(), te::qt::af::BaseApplication::onLayerRemoveTriggered(), te::qt::af::BaseApplication::onLayerRenameTriggered(), and TerraView::onUpdateLayerDataSourceTriggered().
| std::list< te::map::AbstractLayerPtr > te::qt::widgets::LayerItemView::getVisibleLayers | ( | ) | const |
Returns just the visible layers. No folder layers are returned.
Definition at line 80 of file LayerItemView.cpp.
References te::qt::widgets::LayerItemModel::getVisibleLayers(), and m_model.
|
signal |
Emited when the order of the layers has changed.
Referenced by dropEvent().
|
protected |
Definition at line 289 of file LayerItemView.cpp.
References doubleClicked(), te::qt::widgets::LayerItem::getLayer(), te::qt::widgets::TreeItem::getParent(), te::qt::widgets::TreeItem::getType(), ruleDoubleClicked(), and styleDoubleClicked().
| void te::qt::widgets::LayerItemView::removeDelegate | ( | QStyledItemDelegate * | d | ) |
Removes the delegate from the tree.
| d | Delegate to be removed. |
Definition at line 224 of file LayerItemView.cpp.
References te::common::Decorator< T >::removeDecorator().
Referenced by te::qt::plugins::edit::Plugin::onUpdateDelegate(), te::qt::plugins::wfs::Plugin::updateDelegate(), te::qt::plugins::wms::Plugin::updateDelegate(), te::ws::ogc::wms::qtplugin::Plugin::updateDelegate(), and te::qt::plugins::st::Plugin::updateDelegate().
| void te::qt::widgets::LayerItemView::removeItems | ( | const QModelIndexList & | idxs | ) |
Removes the items in the list.
| idxs | List of indexes of items to be removed. |
Definition at line 213 of file LayerItemView.cpp.
References m_model, and te::qt::widgets::LayerItemModel::removeItems().
Referenced by removeSelectedItems(), te::qt::plugins::wfs::Plugin::shutdown(), te::qt::plugins::wms::Plugin::shutdown(), te::ws::ogc::wms::qtplugin::Plugin::shutdown(), te::qt::plugins::st::Plugin::shutdown(), updateChart(), and updateLegend().
| void te::qt::widgets::LayerItemView::removeMenuEventHandler | ( | QObject * | handler | ) |
Removes the menu handler.
Removes the menu handler from the tree.
| handler | The handler to be removed. |
Definition at line 259 of file LayerItemView.cpp.
References m_outterFilter, te::common::Decorator< T >::removeDecorator(), and setMenuEventHandler().
| void te::qt::widgets::LayerItemView::removeSelectedItems | ( | ) |
Removes the items that are selected.
Definition at line 219 of file LayerItemView.cpp.
References removeItems().
Referenced by te::qt::af::BaseApplication::onLayerRemoveTriggered().
|
signal |
Emited when user double clicks over an Rule.
| layer | The layer and Rule that receives mouse double click event. |
Referenced by mouseDoubleClickEvent().
|
signal |
Emited when the selection changes.
| layers | The current selected layers. |
Referenced by selectionChanged().
|
protected |
Definition at line 275 of file LayerItemView.cpp.
References te::qt::widgets::GetSelectedLayersOnly(), and selectedLayersChanged().
| void te::qt::widgets::LayerItemView::setLayers | ( | const std::list< te::map::AbstractLayerPtr > & | layers | ) |
Sets the list of layers. Old layers in the tree are then removed.
| layers | The new list of layers. |
Definition at line 70 of file LayerItemView.cpp.
References m_model, and te::qt::widgets::LayerItemModel::setLayers().
Referenced by main(), te::qt::plugins::tv::TimeViewerDockWidget::onApplyButtonClicked(), TerraView::openProject(), TerraView::resetComponents(), and te::qt::plugins::tv::TimeViewerDockWidget::~TimeViewerDockWidget().
| void te::qt::widgets::LayerItemView::setMenuEventHandler | ( | QObject * | obj | ) |
Updates the popup event handler.
This is used for change the popup menus. If you want to change the popup management try to use this function. You can change all menu handling or a specific type of item.
| obj | The new menu event handler. |
Definition at line 238 of file LayerItemView.cpp.
References m_mnuMger, and m_outterFilter.
Referenced by removeMenuEventHandler().
|
signal |
Emited when user double clicks over an Style.
| layer | The layer that receives mouse double click event. |
Referenced by mouseDoubleClickEvent().
|
signal |
Emited when some style item changes its visibility.
Referenced by LayerItemView().
| void te::qt::widgets::LayerItemView::updateChart | ( | const QModelIndex & | idx | ) |
Updates the chart item of the element.
| idx | Index of the layer to add chart. |
Definition at line 109 of file LayerItemView.cpp.
References te::qt::widgets::TreeItem::getChildren(), te::qt::widgets::TreeItem::getPosition(), te::qt::widgets::LayerItemModel::insertRows(), m_model, and removeItems().
Referenced by TerraView::onLayerChartTriggered().
| void te::qt::widgets::LayerItemView::updateLegend | ( | te::map::AbstractLayer * | l | ) |
updateLegend
| l |
Definition at line 138 of file LayerItemView.cpp.
References findLayerIndex(), te::qt::widgets::TreeItem::getChildren(), te::qt::widgets::TreeItem::getPosition(), te::qt::widgets::LayerItemModel::insertRows(), m_model, removeItems(), and te::qt::widgets::LayerItem::updateLegend().
Referenced by TerraView::onLayerGroupingTriggered(), and te::qt::af::StyleExplorer::styleChanged().
|
signal |
Emited when some item changes its visibility.
Referenced by LayerItemView().
|
protected |
Default popup handler.
Definition at line 349 of file LayerItemView.h.
Referenced by addAllLayerAction(), addFolderLayerAction(), addInvalidLayerAction(), addMultipleSelectionAction(), addNoLayerAction(), addRasterLayerAction(), addTabularLayerAction(), addVectorLayerAction(), getMenuEventHandler(), LayerItemView(), and setMenuEventHandler().
|
protected |
Model to be used.
Definition at line 348 of file LayerItemView.h.
Referenced by addFolder(), addLayers(), getAllLayers(), getVisibleLayers(), LayerItemView(), removeItems(), setLayers(), updateChart(), and updateLegend().
|
protected |
Popup handler defined outside the tree.
Definition at line 350 of file LayerItemView.h.
Referenced by getMenuEventHandler(), removeMenuEventHandler(), and setMenuEventHandler().