Signals | Public Member Functions | Private Member Functions | Private Attributes | Friends
ArenaElement Class Reference

#include <arenaelement.h>

List of all members.

Signals

void modified (ArenaElement *element)
void posChanged (ArenaElement *element, QPoint pos)
void rotationChanged (ArenaElement *element, int rotation)

Public Member Functions

bool isFloor () const
 Convenience method returning true iff. this is a floor element.
bool isItem () const
 Convenience method returning true iff. this is an item element (freely movable)
bool isMountableItem () const
 Convenience method returning true iff. this is a mountable-item element.
bool isWall () const
 Convenience method returning true iff. this is a wall element.
int itemMountPoint () const
QPointF itemOffset () const
 Returns the item's offset from the grid point with 0 <= x,y <= 1 ( (0,0) is bottom left)
void load (const QDomElement &node) throw (XmlLoadingException)
 Deserializes this element from XML.
QPoint pos () const
 Returns the position in arena coordinates.
int rotation () const
 Returns the rotation in degrees.
void save (QXmlStreamWriter &writer)
 Serializes this element in XML.
void saveWorld (QXmlStreamWriter &writer)
 Writes .world format-compliant XML.
void saveWorldSdf (QXmlStreamWriter &writer)
void setArena (Arena *arena)
 Called from Arena::addElement()
void setItemMountPoint (int mountPoint)
 See itemMountPoint(). Use -1 to set index to "unspecified".
void setItemOffset (const QPointF &offset)
 See itemOffset()
void setPos (QPoint pos)
 Sets the position in arena coordinates.
void setRotation (int rotation)
 Sets the rotation in degrees.
ArenaElementType const * type () const

Private Member Functions

 ArenaElement (const ArenaElementType *const type, int id)
 Only meant for use by ArenaElementType::createInstance()

Private Attributes

Arenam_arena
 Arena this element currently belongs to (exactly one)
const int m_instanceId
 Unique ID set by ArenaElementType.
int m_itemMountPoint
QPointF m_itemOffset
 See itemOffset()
QPoint m_pos
int m_rotation
 rotation in degrees (only multiples of 90 degrees)
const ArenaElementType *const m_type

Friends

class ArenaElementType

Detailed Description

Definition at line 14 of file arenaelement.h.


Constructor & Destructor Documentation

ArenaElement::ArenaElement ( const ArenaElementType *const  type,
int  id 
) [explicit, private]

Only meant for use by ArenaElementType::createInstance()

Definition at line 11 of file arenaelement.cpp.


Member Function Documentation

bool ArenaElement::isFloor ( ) const

Convenience method returning true iff. this is a floor element.

Definition at line 24 of file arenaelement.cpp.

bool ArenaElement::isItem ( ) const

Convenience method returning true iff. this is an item element (freely movable)

Definition at line 34 of file arenaelement.cpp.

Convenience method returning true iff. this is a mountable-item element.

Definition at line 29 of file arenaelement.cpp.

bool ArenaElement::isWall ( ) const

Convenience method returning true iff. this is a wall element.

Definition at line 19 of file arenaelement.cpp.

int ArenaElement::itemMountPoint ( ) const [inline]

For MountableItemType elements, this returns the index of the item mount point the item is attached to. If no such index was specified and for all other elements, this method returns -1.

Definition at line 62 of file arenaelement.h.

QPointF ArenaElement::itemOffset ( ) const [inline]

Returns the item's offset from the grid point with 0 <= x,y <= 1 ( (0,0) is bottom left)

Definition at line 55 of file arenaelement.h.

void ArenaElement::load ( const QDomElement &  node) throw (XmlLoadingException)

Deserializes this element from XML.

Definition at line 74 of file arenaelement.cpp.

void ArenaElement::modified ( ArenaElement element) [signal]

Signal emitted when any property of this element changed

Parameters:
rotationRotation in degrees.
QPoint ArenaElement::pos ( ) const [inline]

Returns the position in arena coordinates.

Definition at line 22 of file arenaelement.h.

void ArenaElement::posChanged ( ArenaElement element,
QPoint  pos 
) [signal]

Signal emitted when the element is moved

Parameters:
posNew position.
int ArenaElement::rotation ( ) const [inline]

Returns the rotation in degrees.

Definition at line 26 of file arenaelement.h.

void ArenaElement::rotationChanged ( ArenaElement element,
int  rotation 
) [signal]

Signal emitted when the element is rotated.

Parameters:
rotationRotation in degrees.
void ArenaElement::save ( QXmlStreamWriter &  writer)

Serializes this element in XML.

Definition at line 108 of file arenaelement.cpp.

void ArenaElement::saveWorld ( QXmlStreamWriter &  writer)

Writes .world format-compliant XML.

TODO: mass?

Definition at line 126 of file arenaelement.cpp.

void ArenaElement::saveWorldSdf ( QXmlStreamWriter &  writer)

Definition at line 208 of file arenaelement.cpp.

void ArenaElement::setArena ( Arena arena) [inline]

Called from Arena::addElement()

Definition at line 39 of file arenaelement.h.

void ArenaElement::setItemMountPoint ( int  mountPoint)

See itemMountPoint(). Use -1 to set index to "unspecified".

Definition at line 68 of file arenaelement.cpp.

void ArenaElement::setItemOffset ( const QPointF &  offset)

See itemOffset()

Definition at line 49 of file arenaelement.cpp.

void ArenaElement::setPos ( QPoint  pos)

Sets the position in arena coordinates.

Definition at line 39 of file arenaelement.cpp.

void ArenaElement::setRotation ( int  rotation)

Sets the rotation in degrees.

Definition at line 55 of file arenaelement.cpp.

ArenaElementType const* ArenaElement::type ( ) const [inline]

Returns a pointer to a global ArenaElementType instance that is the same for all objects of the same type

Definition at line 43 of file arenaelement.h.


Friends And Related Function Documentation

friend class ArenaElementType [friend]

Definition at line 18 of file arenaelement.h.


Member Data Documentation

Arena this element currently belongs to (exactly one)

Definition at line 83 of file arenaelement.h.

const int ArenaElement::m_instanceId [private]

Unique ID set by ArenaElementType.

Definition at line 95 of file arenaelement.h.

Item mount point this element is attached to. Only applies to MountableItemType elements. -1 indicates that no index has been specified.

Definition at line 93 of file arenaelement.h.

QPointF ArenaElement::m_itemOffset [private]

See itemOffset()

Definition at line 88 of file arenaelement.h.

QPoint ArenaElement::m_pos [private]

Definition at line 86 of file arenaelement.h.

int ArenaElement::m_rotation [private]

rotation in degrees (only multiples of 90 degrees)

Definition at line 90 of file arenaelement.h.

const ArenaElementType* const ArenaElement::m_type [private]

Definition at line 85 of file arenaelement.h.


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


hector_nist_arena_designer
Author(s): Johannes Simon, Stefan Kohlbrecher
autogenerated on Mon Oct 6 2014 00:26:31