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

A class that represents one logical layer in map. More...

#include <maplayer.h>

Inheritance diagram for Updraft::Core::MapLayer:
Collaboration diagram for Updraft::Core::MapLayer:

List of all members.

Public Slots

void setVisibility (bool value)=0
 Displays/hides the map layer.

Signals

void checked (bool value, MapLayerInterface *sender)
 Emited when the map layer is checked or unchecked (before it is displayed or hidden).
void contextMenuRequested (QPoint pos, MapLayerInterface *sender)
 Emited when a context menu is requested on this map layer.

Public Member Functions

 MapLayer (const QString &title)
 ~MapLayer ()
void connectSignalChecked (const QObject *receiver, const char *method)
 Connects the checkbox signal to a given slot.
void connectSignalContextMenuRequested (const QObject *receiver, const char *method)
 Connects the context menu signal to a given slot.
void connectSlotSetVisibility (const QObject *sender, const char *method)
 Connects the given signal to the slot that sets visibility of this map layer.
void connectCheckedToVisibility ()
 A convenience method that connects the checked signal of this map layer.
void setId (const QByteArray &id)
 Sets the identification of the map layer.
QByteArray getId ()
 Returns this map layer's id.
void setTitle (const QString &title)
 Sets the title of this map layer.
QTreeWidgetItem * getTreeItem ()
 Returns the root tree item that represents this map layer.
void setDisabled (bool disabled)
 Disables or enables the map layer.
void setChecked (bool value)
 Checks or unchecks the map layer's check-box.
void setCheckable (bool value)
 Enables or disables the checkability of the map layer's check-box.
void inserted (MapLayerGroup *parent)
 Sets the parent map layer group of this map layer.
void setFilePath (const QString &path)
 Sets the file path of the file associated to this layer to the given string.
QAction * getDeleteAction ()
 Returns pointer to the action that deletes the associated file.
QByteArray saveState ()
 Save the state (check state and expanded state) of this layer.
bool restoreState (const QByteArray &state)
 Restore the previsously saved state.

Protected Member Functions

void emitChecked (bool value)
 Emits the checked signal.
void emitContextMenuRequested (const QPoint &pos)
 Emits the context menu request signal.
 MapLayer (QTreeWidgetItem *item)

Protected Attributes

QByteArray id
 Identificiation of the map layer, used in saving and restoring state.
QAction * deleteAction
 Action for getDeleteAction.
QString deleteFilePath
 File path for delete action.
QTreeWidgetItem * treeItem
 Tree item representing this map layer.
bool ownsTreeItem
 If this is true, then the treeItem is deleted together with the mapLayer.
MapLayerGroupparent
 Parent map layer group.

Private Slots

void deleteActionSlot ()
 The slot that is executed by the delete action.

Detailed Description

A class that represents one logical layer in map.

Map layer in osgEarth can be of different types, and this class encapsulates all of the types, and creates a common interface. The type of the map layer determines which value of the union Layer is valid.


Constructor & Destructor Documentation

Updraft::Core::MapLayer::MapLayer ( const QString &  title) [explicit]
Updraft::Core::MapLayer::MapLayer ( QTreeWidgetItem *  item) [explicit, protected]

Member Function Documentation

void Updraft::Core::MapLayer::checked ( bool  value,
MapLayerInterface sender 
) [signal]

Emited when the map layer is checked or unchecked (before it is displayed or hidden).

Parameters:
valueWhether the layer was checked
senderThe pointer to this object

A convenience method that connects the checked signal of this map layer.

directly to its visiblity toggling slot.

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::connectSignalChecked ( const QObject *  receiver,
const char *  method 
) [virtual]

Connects the checkbox signal to a given slot.

Parameters:
receiverThe object on which the slot should be called
methodThe slot that should be called

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::connectSignalContextMenuRequested ( const QObject *  receiver,
const char *  method 
) [virtual]

Connects the context menu signal to a given slot.

Parameters:
receiverThe object on which the slot should be called
methodThe slot that should be called

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::connectSlotSetVisibility ( const QObject *  sender,
const char *  method 
) [virtual]

Connects the given signal to the slot that sets visibility of this map layer.

Parameters:
senderThe object whose signal should be connected to the visibility toggling slot.
methodThe signal that should be connected

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::contextMenuRequested ( QPoint  pos,
MapLayerInterface sender 
) [signal]

Emited when a context menu is requested on this map layer.

Parameters:
posThe position where the context menu should appear.
senderPointer to this object.

The slot that is executed by the delete action.

This method deleted the associated file.

void Updraft::Core::MapLayer::emitChecked ( bool  value) [protected, virtual]

Emits the checked signal.

Called from MainWindow.

Parameters:
valueWhether the check-box was checked

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::emitContextMenuRequested ( const QPoint &  pos) [protected, virtual]

Emits the context menu request signal.

Parameters:
posThe position of the context menu.

Implements Updraft::MapLayerInterface.

Returns pointer to the action that deletes the associated file.

Returns:
The QAction that deletes the file associated to this map layer.

Implements Updraft::MapLayerInterface.

QByteArray Updraft::Core::MapLayer::getId ( ) [virtual]

Returns this map layer's id.

Returns:
The id in local 8-bit encoding. This is usually the title string.

Implements Updraft::MapLayerInterface.

QTreeWidgetItem * Updraft::Core::MapLayer::getTreeItem ( ) [virtual]

Returns the root tree item that represents this map layer.

Returns:
pointer to this layer's tree item.

Implements Updraft::MapLayerInterface.

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

Sets the parent map layer group of this map layer.

Parameters:
parentThe new parent group of this map layer.

Implements Updraft::MapLayerInterface.

Reimplemented in Updraft::Core::MapLayerGroup.

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

Restore the previsously saved state.

Parameters:
stateThe state that was previously obtained from the saveState() method.
See also:
saveState()

Implements Updraft::MapLayerInterface.

Reimplemented in Updraft::Core::MapLayerGroup.

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

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

Returns:
QByteArray with the saved state of this map layer.

Implements Updraft::MapLayerInterface.

Reimplemented in Updraft::Core::MapLayerGroup.

void Updraft::Core::MapLayer::setCheckable ( bool  value) [virtual]

Enables or disables the checkability of the map layer's check-box.

Parameters:
valueWhether the check-box should be checkable.

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::setChecked ( bool  value) [virtual]

Checks or unchecks the map layer's check-box.

Parameters:
valueThe new check state of the check-box.

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::setDisabled ( bool  disabled) [virtual]

Disables or enables the map layer.

Parameters:
disabledWhether the layer should be disabled.

Implements Updraft::MapLayerInterface.

Reimplemented in Updraft::Core::MapLayerGroup.

void Updraft::Core::MapLayer::setFilePath ( const QString &  path) [virtual]

Sets the file path of the file associated to this layer to the given string.

Parameters:
pathThe path to the associated file

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::setId ( const QByteArray &  id) [virtual]

Sets the identification of the map layer.

Parameters:
idThe id in the local 8bit encoding, identifying the map layer.

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::setTitle ( const QString &  title) [virtual]

Sets the title of this map layer.

Parameters:
titleThe new title to be set.

Implements Updraft::MapLayerInterface.

void Updraft::Core::MapLayer::setVisibility ( bool  value) [pure virtual, slot]

Displays/hides the map layer.

Parameters:
valueThe new state of visibility.

Implements Updraft::MapLayerInterface.

Implemented in Updraft::Core::MapLayerGroup, and Updraft::Core::NodeMapLayer.


Member Data Documentation

Action for getDeleteAction.

File path for delete action.

QByteArray Updraft::Core::MapLayer::id [protected]

Identificiation of the map layer, used in saving and restoring state.

by default the id is the title encoded to local 8bit encoding.

If this is true, then the treeItem is deleted together with the mapLayer.

This is only false for the top level group.

Parent map layer group.

Used when using operator delete on the layer. This is set by the parent group.

QTreeWidgetItem* Updraft::Core::MapLayer::treeItem [protected]

Tree item representing this map layer.


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