Updraft  1.0
Open source glider flight visualisation tool.
Updraft::Core::MapLayerGroup Class Reference

Map layer group used by plugins. More...

#include <maplayergroup.h>

Inheritance diagram for Updraft::Core::MapLayerGroup:
Collaboration diagram for Updraft::Core::MapLayerGroup:

List of all members.

Public Member Functions

 MapLayerGroup (const QString &title)
 Creates new map layer group.
 MapLayerGroup (QTreeWidgetItem *item)
 Create a new map layer group based on already existing tree item.
 ~MapLayerGroup ()
 Destroys MapLayerGroup Removes coresponding tree widget from GUI.
MapLayerGroupInterfacecreateMapLayerGroup (const QString &title, int pos=-1)
 Create a single empty map layer group and add it as a child of this.
MapLayerInterfacecreateMapLayer (osg::Node *layer, const QString &title, int pos=-1)
 Create a single map layer containing the node and add it as a child of this group.
void insertMapLayer (MapLayerInterface *layer, int pos=-1)
 Insert the map layer as a child of this group.
void removeMapLayer (MapLayerInterface *layer)
 Remove the map layer from this group, but don't delete it.
osg::Group * getNodeGroup ()
 Returns the osg group associated with this map layer group.
osgEarth::Util::ObjectPlacer * getObjectPlacer ()
 Returns the placer associated with the mapNode.
void setVisibility (bool value)
 Displays/hides the map layer.
bool isVisible ()
QByteArray saveState ()
 Save the state (check state and expanded state) of this layer (and possibly all children).
bool restoreState (const QByteArray &state)
 Restore the previsously saved state.

Private Member Functions

void addToScene (MapLayerGroup *group)
 Add the map layer to the osg group of the map layer group.
void removeFromScene (MapLayerGroup *group)
 Remove the layer from the osg group of the map layer group.
void inserted (Core::MapLayerGroup *parent)
 Sets the parent map layer group of this map layer.
void setDisabled (bool disabled)
 Disables or enables the map layer.
MapLayerInterfacecreateMapLayerNoInsert (osg::Node *mapLayer, const QString &title, int pos=-1)
 Add map layer without adding it to scene.

Private Attributes

QSet< MapLayerInterface * > mapLayers
osg::ref_ptr< osg::Group > nodeGroup
 Pointer to the subtree of the scene associated with this layer.

Detailed Description

Map layer group used by plugins.

This class encapsulates handling of the map layer group. It provides methods for creating and deleting layers and automatically adding to/deleting from the GUI.


Constructor & Destructor Documentation

Updraft::Core::MapLayerGroup::MapLayerGroup ( const QString &  title) [explicit]

Creates new map layer group.

For creating new instances use CoreInterface or for creating sub groups use MapLayerGroup::createMapLayerGroup.

Parameters:
titleDisplayed name of the widget.
Updraft::Core::MapLayerGroup::MapLayerGroup ( QTreeWidgetItem *  item) [explicit]

Create a new map layer group based on already existing tree item.

Destroys MapLayerGroup Removes coresponding tree widget from GUI.


Member Function Documentation

void Updraft::Core::MapLayerGroup::addToScene ( MapLayerGroup group) [private, virtual]

Add the map layer to the osg group of the map layer group.

Implements Updraft::MapLayerInterface.

MapLayerInterface * Updraft::Core::MapLayerGroup::createMapLayer ( osg::Node *  layer,
const QString &  title,
int  pos = -1 
) [virtual]

Create a single map layer containing the node and add it as a child of this group.

Returns:
The new layer.

Implements Updraft::MapLayerGroupInterface.

MapLayerGroupInterface * Updraft::Core::MapLayerGroup::createMapLayerGroup ( const QString &  title,
int  pos = -1 
) [virtual]

Create a single empty map layer group and add it as a child of this.

Returns:
The new group.

Implements Updraft::MapLayerGroupInterface.

MapLayerInterface * Updraft::Core::MapLayerGroup::createMapLayerNoInsert ( osg::Node *  layer,
const QString &  title,
int  pos = -1 
) [private, virtual]

Add map layer without adding it to scene.

Implements Updraft::MapLayerGroupInterface.

osg::Group * Updraft::Core::MapLayerGroup::getNodeGroup ( ) [virtual]

Returns the osg group associated with this map layer group.

Implements Updraft::MapLayerGroupInterface.

osgEarth::Util::ObjectPlacer * Updraft::Core::MapLayerGroup::getObjectPlacer ( ) [virtual]

Returns the placer associated with the mapNode.

Implements Updraft::MapLayerGroupInterface.

void Updraft::Core::MapLayerGroup::inserted ( Core::MapLayerGroup parent) [private, virtual]

Sets the parent map layer group of this map layer.

Parameters:
parentThe new parent group of this map layer.

Reimplemented from Updraft::Core::MapLayer.

void Updraft::Core::MapLayerGroup::insertMapLayer ( MapLayerInterface layer,
int  pos = -1 
) [virtual]

Insert the map layer as a child of this group.

Implements Updraft::MapLayerGroupInterface.

void Updraft::Core::MapLayerGroup::removeFromScene ( MapLayerGroup group) [private, virtual]

Remove the layer from the osg group of the map layer group.

Implements Updraft::MapLayerInterface.

Remove the map layer from this group, but don't delete it.

Ownership of the layer is transfered to caller of this method.

Implements Updraft::MapLayerGroupInterface.

bool Updraft::Core::MapLayerGroup::restoreState ( const QByteArray &  state) [virtual]

Restore the previsously saved state.

See also:
saveState()

Reimplemented from Updraft::Core::MapLayer.

QByteArray Updraft::Core::MapLayerGroup::saveState ( ) [virtual]

Save the state (check state and expanded state) of this layer (and possibly all children).

Note:
Format of the save is following: 1) For each child: a) Save child's id b) Save the child's data as QByteArray 3) Null QByteArray as a separator 4) Save this as MapLayer

Reimplemented from Updraft::Core::MapLayer.

void Updraft::Core::MapLayerGroup::setDisabled ( bool  disabled) [private, virtual]

Disables or enables the map layer.

Parameters:
disabledWhether the layer should be disabled.

Reimplemented from Updraft::Core::MapLayer.

void Updraft::Core::MapLayerGroup::setVisibility ( bool  value) [virtual]

Displays/hides the map layer.

Parameters:
valueThe new state of visibility.

Implements Updraft::Core::MapLayer.


Member Data Documentation

osg::ref_ptr<osg::Group> Updraft::Core::MapLayerGroup::nodeGroup [private]

Pointer to the subtree of the scene associated with this layer.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines