te::qt::widgets::LegendItem Class Reference

Represents a lengend in the tree structure. More...

#include <LegendItem.h>

Inheritance diagram for te::qt::widgets::LegendItem:
te::qt::widgets::TreeItem

Public Member Functions

void addChild (TreeItem *item)
 Adds a child to the item. The child is added to the end of the list. More...
 
TreeItemgetChild (const size_t &pos) const throw (te::common::Exception)
 Returns the child located at pos. More...
 
void getChildren (std::vector< TreeItem * > &items, const std::string &type) const
 Returns all children of a certain type. More...
 
size_t getChildrenCount (const std::string &type) const
 Returns the number of children. More...
 
QIcon getIcon () const
 Returns the image of the style as an icon. More...
 
TreeItemgetParent () const
 Returns the item parent. More...
 
int getPosition ()
 Returns the position of item in its parent's list of children. More...
 
virtual std::string getToolTip () const
 Returns the item tooltip (for information purposes). More...
 
std::string getType () const
 Returns the type of the item. More...
 
bool hasChildren () const
 Tells us if the item has children or not. More...
 
virtual void insertChild (TreeItem *item, const size_t &pos) throw (te::common::Exception)
 Inserts a child item at the desired position. More...
 
virtual VISIBLE isVisible () const
 Returns the visibilty state of the item. More...
 
void removeAllChilds ()
 Removes all children. More...
 
TreeItemremoveChild (const size_t &pos) throw (te::common::Exception)
 Removes the child located at pos from the children list. More...
 
void setParent (TreeItem *item)
 Updates the item parent. More...
 
virtual void setVisible (const VISIBLE &visible, const bool &updateAncestors=false, const bool &updateDescendents=false)
 Updates the visibilty state of the item. More...
 
void updateSymbol (const te::se::Rule *rule)
 updateSymbol More...
 
void updateSymbol (const std::vector< te::se::Symbolizer * > &symbolizers)
 
Instantiation Methods

Methods related to creation and destruction of the object.

 LegendItem (const te::se::Rule *rule)
 Constructor. More...
 
 LegendItem (const std::string &label, const std::vector< te::se::Symbolizer * > &symbolizers)
 Constructor. More...
 
 ~LegendItem ()
 Destructor. More...
 
Reimplementation of TreeItem

Methods reimplemented of the TreeItem class.

std::string getAsString () const
 Returns the label of the item to be presented in a Qt view. More...
 
Qt::ItemFlags flags ()
 Returns the flags to be used by the model. More...
 

Protected Attributes

std::unique_ptr< Queuem_children
 Queue of items (children). More...
 
QIcon m_icon
 Item icon. More...
 
std::string m_label
 Label for presenting in the Qt view. More...
 
TreeItemm_parent
 Pointer to the parent. More...
 
std::string m_type
 Item type. More...
 

Detailed Description

Represents a lengend in the tree structure.

Note
The type of the item is "LEGEND".

Definition at line 53 of file LegendItem.h.

Constructor & Destructor Documentation

te::qt::widgets::LegendItem::LegendItem ( const te::se::Rule rule)

Constructor.

Parameters
ruleThe Rule that defines the legend item.

Definition at line 107 of file LegendItem.cpp.

References te::se::Rule::getDescription(), GetIcon(), te::se::Rule::getName(), te::se::Description::getTitle(), m_icon, and m_label.

te::qt::widgets::LegendItem::LegendItem ( const std::string &  label,
const std::vector< te::se::Symbolizer * > &  symbolizers 
)

Constructor.

Parameters
labelThe label to be presented.
symbolizersList of symbolizers used to create the icon.

Definition at line 121 of file LegendItem.cpp.

References GetIcon(), m_icon, and ~LegendItem().

te::qt::widgets::LegendItem::~LegendItem ( )
default

Destructor.

Referenced by LegendItem().

Member Function Documentation

void te::qt::widgets::TreeItem::addChild ( TreeItem item)
inherited

Adds a child to the item. The child is added to the end of the list.

Parameters
itemThe child to be inserted.

Definition at line 44 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::m_children, and te::qt::widgets::TreeItem::setParent().

Referenced by AddRuleItems(), AddSliceItems(), GetFolder(), GetRootFolder(), te::qt::widgets::LayerItem::LayerItem(), te::qt::widgets::RuleItem::RuleItem(), and te::qt::widgets::LayerItem::updateLegend().

Qt::ItemFlags te::qt::widgets::LegendItem::flags ( )
virtual

Returns the flags to be used by the model.

Returns
Qt flags. By default itens are enabled, editable and selectable. If you want to change the flags reimplement this method in a subclass.

Reimplemented from te::qt::widgets::TreeItem.

Definition at line 135 of file LegendItem.cpp.

std::string te::qt::widgets::LegendItem::getAsString ( ) const
virtual

Returns the label of the item to be presented in a Qt view.

Returns
The item label, to be presented in a Qt view.

Implements te::qt::widgets::TreeItem.

Definition at line 130 of file LegendItem.cpp.

References m_label.

te::qt::widgets::TreeItem * te::qt::widgets::TreeItem::getChild ( const size_t &  pos) const
throw (te::common::Exception
)
inherited

Returns the child located at pos.

Parameters
posThe position of the desired child at the children list.
Returns
The child item located at pos.
Exceptions
Ifpos is greater or equal than the children list size, a te::common::Exception will be raised.

Definition at line 61 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::m_children.

Referenced by GetAllLayers(), GetVisibility(), GetVisibleLayers(), te::qt::widgets::LayerItemModel::index(), and te::qt::widgets::FolderItem::setVisible().

void te::qt::widgets::TreeItem::getChildren ( std::vector< TreeItem * > &  items,
const std::string &  type 
) const
inherited
size_t te::qt::widgets::TreeItem::getChildrenCount ( const std::string &  type) const
inherited

Returns the number of children.

The type, defines the type of children we want to considere in the operation. If an empty string is given as argument, all kinds of children will be considered.

Parameters
typeThe type of children we want to calculate the number.
Returns
Number of children of type type.

Definition at line 82 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::getChildren(), and te::qt::widgets::TreeItem::m_children.

Referenced by te::qt::widgets::LayerItemModel::addItems(), GetAllLayers(), GetVisibility(), GetVisibleLayers(), te::qt::widgets::TreeItem::hasChildren(), te::qt::widgets::LayerItemModel::index(), te::qt::widgets::LayerItemModel::rowCount(), and te::qt::widgets::FolderItem::setVisible().

QIcon te::qt::widgets::LegendItem::getIcon ( ) const

Returns the image of the style as an icon.

Returns
The style as an icon.

Definition at line 140 of file LegendItem.cpp.

References m_icon.

int te::qt::widgets::TreeItem::getPosition ( )
inherited
std::string te::qt::widgets::TreeItem::getToolTip ( ) const
virtualinherited

Returns the item tooltip (for information purposes).

Returns
The item tooltip.

Reimplemented in te::qt::widgets::LayerItem, te::qt::widgets::RuleItem, and te::qt::widgets::StyleItem.

Definition at line 134 of file qt/widgets/layer/explorer/TreeItem.cpp.

Referenced by te::qt::widgets::LayerItemModel::data().

bool te::qt::widgets::TreeItem::hasChildren ( ) const
inherited

Tells us if the item has children or not.

Returns
True if children list is not empty and false otherwise.

Definition at line 110 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::getChildrenCount().

Referenced by te::qt::widgets::LayerItemModel::addLayers().

void te::qt::widgets::TreeItem::insertChild ( TreeItem item,
const size_t &  pos 
)
throw (te::common::Exception
)
virtualinherited

Inserts a child item at the desired position.

Parameters
itemThe child to be inserted.
posThe position of the child in the children list.
Exceptions
Ifpos is greater than the children list size, a te::common::Exception will be raised.

Reimplemented in te::qt::widgets::FolderItem.

Definition at line 51 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::m_children.

Referenced by te::qt::widgets::LayerItemModel::addFolder(), te::qt::widgets::LayerItemModel::addItems(), te::qt::widgets::LayerItemModel::addLayer(), te::qt::widgets::LayerItemModel::addLayers(), te::qt::widgets::FolderItem::insertChild(), and te::qt::widgets::LayerItem::updateChart().

te::qt::widgets::VISIBLE te::qt::widgets::TreeItem::isVisible ( ) const
virtualinherited
void te::qt::widgets::TreeItem::removeAllChilds ( )
inherited

Removes all children.

Definition at line 139 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::m_children.

Referenced by te::qt::widgets::StyleItem::updateStyle().

te::qt::widgets::TreeItem * te::qt::widgets::TreeItem::removeChild ( const size_t &  pos)
throw (te::common::Exception
)
inherited

Removes the child located at pos from the children list.

Parameters
posThe position of the desired child at the children list.
Returns
The removed item.
Exceptions
Ifpos is greater or equal than the children list size, a te::common::Exception will be raised.

Definition at line 74 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::m_children.

Referenced by te::qt::widgets::LayerItemModel::addItems(), and te::qt::widgets::LayerItemModel::removeRows().

void te::qt::widgets::TreeItem::setParent ( TreeItem item)
inherited

Updates the item parent.

Parameters
itemThe new parent.

Definition at line 39 of file qt/widgets/layer/explorer/TreeItem.cpp.

References te::qt::widgets::TreeItem::m_parent.

Referenced by te::qt::widgets::TreeItem::addChild(), and te::qt::widgets::LayerItem::~LayerItem().

void te::qt::widgets::TreeItem::setVisible ( const VISIBLE visible,
const bool updateAncestors = false,
const bool updateDescendents = false 
)
virtualinherited

Updates the visibilty state of the item.

Parameters
visibleThe new visibility state.
updateAncestorsUpdates also ancestors states.
updateDescendentsUpdates also descendents states.

Reimplemented in te::qt::widgets::RuleItem, te::qt::widgets::LayerItem, te::qt::widgets::ChartItem, and te::qt::widgets::FolderItem.

Definition at line 125 of file qt/widgets/layer/explorer/TreeItem.cpp.

Referenced by te::qt::af::BaseApplication::onCheckSelectedLayerTriggered(), te::qt::af::BaseApplication::onClearSelectedLayerTriggered(), te::qt::widgets::LayerItemModel::setData(), te::qt::widgets::FolderItem::setVisible(), and te::qt::widgets::LayerItem::setVisible().

void te::qt::widgets::LegendItem::updateSymbol ( const te::se::Rule rule)

updateSymbol

Parameters
symbolizers

Definition at line 145 of file LegendItem.cpp.

References GetIcon(), and m_icon.

void te::qt::widgets::LegendItem::updateSymbol ( const std::vector< te::se::Symbolizer * > &  symbolizers)

Definition at line 150 of file LegendItem.cpp.

References GetIcon(), and m_icon.

Member Data Documentation

QIcon te::qt::widgets::LegendItem::m_icon
protected

Item icon.

Definition at line 114 of file LegendItem.h.

Referenced by getIcon(), LegendItem(), and updateSymbol().

std::string te::qt::widgets::LegendItem::m_label
protected

Label for presenting in the Qt view.

Definition at line 113 of file LegendItem.h.

Referenced by getAsString(), and LegendItem().

std::string te::qt::widgets::TreeItem::m_type
protectedinherited

Item type.

Definition at line 236 of file qt/widgets/layer/explorer/TreeItem.h.

Referenced by te::qt::widgets::TreeItem::getType().


The documentation for this class was generated from the following files: