Map Class Reference

A map showing the railroad model. More...

#include <map.h>

List of all members.

Public Slots

void zoomIn ()
void zoomOut ()
void fitView ()
void scaleDefault ()

Signals

void mapSetVisible (bool)
 Emitted if the map change its visibility.
void mapClosed ()
 Emitted if the map is closed.

Public Member Functions

 Map (QWidget *parent=0)
 Create a Map derived from QGraphicsView.
 Map (QGraphicsScene *scene, QWidget *parent=0)
void setName (const QString &name)
 Set the map name as defined by the user.
QString name ()
void addItem (QGraphicsItem *item)

Protected Member Functions

void closeEvent (QCloseEvent *event)
void wheelEvent (QWheelEvent *event)
void scaleView (qreal scaleFactor)
void scaleView (qreal scaleFactor, const QPoint &pos)

Private Attributes

QString _name
 The user friendly name.
QGraphicsScene * _scene
 The QGraphicsScene for drawing the rails.


Detailed Description

A map showing the railroad model.

Implement a map to represent a railroad model with a QGraphicsScene. It allow the user to interact with the shuntings and the signals

Definition at line 27 of file map.h.


Constructor & Destructor Documentation

Map::Map ( QWidget *  parent = 0  ) 

Create a Map derived from QGraphicsView.

Definition at line 4 of file map.cpp.

References _name, and _scene.

Map::Map ( QGraphicsScene *  scene,
QWidget *  parent = 0 
)

Definition at line 12 of file map.cpp.


Member Function Documentation

void Map::setName ( const QString &  name  ) 

Set the map name as defined by the user.

Parameters:
name A name, could be whatever the user want, and should not bu unique
See also:
name()

Definition at line 17 of file map.cpp.

References _name.

Referenced by Win::addMap(), and Win::open().

QString Map::name (  ) 

Returns:
The map name as defined by the user
See also:
setName()

Definition at line 22 of file map.cpp.

References _name.

Referenced by Win::addMap(), and Win::save().

void Map::addItem ( QGraphicsItem *  item  ) 

Parameters:
item Item to add on the map
See also:
item.h

Definition at line 28 of file map.cpp.

Referenced by Win::open().

void Map::mapSetVisible ( bool   )  [signal]

Emitted if the map change its visibility.

Referenced by closeEvent().

void Map::mapClosed (  )  [signal]

Emitted if the map is closed.

Referenced by closeEvent().

void Map::zoomIn (  )  [slot]

Zoom in on the map

See also:
zoomOut(), fitView(), scaleDefault()

Definition at line 33 of file map.cpp.

References scaleView().

void Map::zoomOut (  )  [slot]

Zoom out on the map

See also:
zoomIn(), fitView(), scaleDefault()

Definition at line 38 of file map.cpp.

References scaleView().

void Map::fitView (  )  [slot]

Fit the view to the avalaible space

See also:
zoomOut(), zoomIn(), scaleDefault()

Definition at line 48 of file map.cpp.

void Map::scaleDefault (  )  [slot]

Restore the default scale

See also:
zoomOut(), zoomIn(), fitView()

Definition at line 43 of file map.cpp.

void Map::closeEvent ( QCloseEvent *  event  )  [protected]

Reimplemented, handle close event

See also:
win.h

Definition at line 73 of file map.cpp.

References mapClosed(), and mapSetVisible().

void Map::wheelEvent ( QWheelEvent *  event  )  [protected]

Reimplemented to handle zoom

See also:
zoomOut(), zoomIn()

Definition at line 53 of file map.cpp.

References scaleView().

void Map::scaleView ( qreal  scaleFactor  )  [protected]

Set the zoom factor to scaleFactor

Parameters:
scaleFactor The zoom factor

Definition at line 58 of file map.cpp.

Referenced by scaleView(), wheelEvent(), zoomIn(), and zoomOut().

void Map::scaleView ( qreal  scaleFactor,
const QPoint &  pos 
) [protected]

Definition at line 67 of file map.cpp.

References scaleView().


Member Data Documentation

QString Map::_name [private]

The user friendly name.

Definition at line 102 of file map.h.

Referenced by Map(), name(), and setName().

QGraphicsScene* Map::_scene [private]

The QGraphicsScene for drawing the rails.

Definition at line 105 of file map.h.

Referenced by Map().


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

Generated on Sun Jun 22 23:46:29 2008 for OrK by  doxygen 1.5.6