World's Object class. More...

Inheritance diagram for WObject:

Public Member Functions

 WObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool addToWorld=true)
 create the object and automatically put this into the world More...
 
virtual ~WObject ()
 destroy the Object and drop it from the world More...
 
QColor color () const
 return the color of this object More...
 
void drawLocalAxes (bool d)
 Sets whether the object local frame of reference should be drawn or not. More...
 
bool isInvisible () const
 return if it is invisible More...
 
const QString & label () const
 Returns the text label to render along with the object. More...
 
const QColor & labelColor () const
 Returns the color of the label. More...
 
const wVectorlabelPosition () const
 Returns the label position relative to this object. More...
 
bool labelShown () const
 Returns whether the label is shown or not. More...
 
bool localAxesDrawn () const
 Returns true if the local frame of refecence of the object should be drawn. More...
 
const wMatrixmatrix () const
 return a reference to the transformation matrix More...
 
QString name () const
 Return the name of this object. More...
 
virtual void postUpdate ()
 postUpdate the WObject this method is called at each step of the world just after the physic update More...
 
virtual void preUpdate ()
 preUpdate the WObject this method is called at each step of the world just before the physic update More...
 
void setAlpha (int alpha)
 set the value of alpha channel (the transparency) More...
 
void setColor (QColor c)
 Set the color to use on rendering. More...
 
void setInvisible (bool b)
 set invisibility More...
 
void setLabel (QString label)
 Sets a text label to render along with the object. More...
 
void setLabel (QString label, wVector pos)
 Sets a text label to render along with the object and its position. More...
 
void setLabel (QString label, wVector pos, QColor color)
 Sets a text label to render along with the object and its position and color. More...
 
void setLabelColor (const QColor &color)
 Sets the color of the label. More...
 
void setLabelPosition (const wVector &pos)
 Sets the label position relative to this object. More...
 
void setMatrix (const wMatrix &newm)
 set a new matrix More...
 
void setPosition (const wVector &newpos)
 set the position specified in global coordinate frame More...
 
void setPosition (real x, real y, real z)
 set the position specified in global coordinate frame More...
 
void setTexture (QString textureName)
 Set the texture to use for this WObject when rendered. More...
 
void setUseColorTextureOfOwner (bool b)
 set if the object will be rendered with the color and texture of our owner (if we have one) More...
 
void showLabel (bool show)
 Sets whether to show the label or not. More...
 
QString texture () const
 Return the texture name. More...
 
bool useColorTextureOfOwner () const
 if true, we will use color and texture of our owner (if we have one) More...
 
Worldworld ()
 Return the world. More...
 
const Worldworld () const
 Return the world (const version) More...
 
- Public Member Functions inherited from Ownable
 Ownable ()
 Constructor. More...
 
virtual ~Ownable ()
 Destructor. More...
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one. More...
 
Ownableowner () const
 Returns the owner of this object. More...
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object. More...
 

Protected Member Functions

virtual void changedMatrix ()
 virtual function called when the transformation matrix change More...
 

Protected Attributes

QColor colorv
 Color, it contains also alpha channel. More...
 
bool invisible
 if TRUE it will not renderized More...
 
QColor labelcol
 The color of the label. More...
 
bool labeldrawn
 Whether the label should be rendered or not. More...
 
wVector labelpos
 The position of the label in the object frame of reference. More...
 
QString labelv
 The text label of the object. More...
 
bool localFrameOfReferenceDrawn
 If true, the local frame of reference of the object is drawn. More...
 
QString namev
 Name of the WObject. More...
 
QString texturev
 Texture name. More...
 
wMatrix tm
 Trasformation matrix. More...
 
bool usecolortextureofowner
 if true, we will use color and texture of our owner (if we have one). More...
 
Worldworldv
 World. More...
 

Additional Inherited Members

- Public Types inherited from Ownable
typedef QList< OwnedOwnedList
 The type for the list of owned objects. More...
 

Detailed Description

World's Object class.

represent abstract object insertable into the World

Definition at line 39 of file wobject.h.

Constructor & Destructor Documentation

WObject ( World world,
QString  name = "unamed",
const wMatrix tm = wMatrix::identity(),
bool  addToWorld = true 
)

create the object and automatically put this into the world

Parameters
worldthe world where object lives
namethe name of the object
tmrotation and position in global coordinate frame
addToWorldif true the object is added to the world, if false it is not. This parameter should be set to false when this constructor is called by the constructor of a subclass because otherwise RTTI in this moment (e.g. in RenderWorld) identifies the newly added object as a WObject instead of the actual type (as the subclasses have not been constructed yet when the object is added to the world)

Definition at line 25 of file wobject.cpp.

References WObject::colorv, WObject::invisible, WObject::labelcol, WObject::labeldrawn, WObject::labelpos, WObject::labelv, WObject::localFrameOfReferenceDrawn, WObject::name(), WObject::namev, WObject::texturev, WObject::tm, WObject::usecolortextureofowner, and WObject::worldv.

~WObject ( )
virtual

destroy the Object and drop it from the world

Definition at line 43 of file wobject.cpp.

References WObject::worldv.

Member Function Documentation

void changedMatrix ( )
protectedvirtual

virtual function called when the transformation matrix change

Reimplemented in PhyMarXbot, PhyEpuck, PhyMarXbot, PhyKhepera, and PhyObject.

Definition at line 178 of file wobject.cpp.

Referenced by WObject::setMatrix(), and WObject::setPosition().

void drawLocalAxes ( bool  d)

Sets whether the object local frame of reference should be drawn or not.

By default the local frame of reference is not drawn. Note that some objects don't support drawing the local frame of reference. The X axis is drawn in red, the Y in green and the Z in blue.

Parameters
dif true the local frame of reference should be drawn

Definition at line 122 of file wobject.cpp.

References WObject::localFrameOfReferenceDrawn.

Referenced by RenderWorld::draw().

bool isInvisible ( ) const

return if it is invisible

Definition at line 114 of file wobject.cpp.

References WObject::invisible.

Referenced by RenderWorld::draw().

const QString & label ( ) const

Returns the text label to render along with the object.

Returns
the label to show

Definition at line 143 of file wobject.cpp.

References WObject::labelv.

Referenced by WObject::setLabel().

const QColor & labelColor ( ) const

Returns the color of the label.

Returns
the color of the label

Definition at line 163 of file wobject.cpp.

References WObject::labelcol.

const wVector & labelPosition ( ) const

Returns the label position relative to this object.

Returns
the label position in the object frame of reference

Definition at line 153 of file wobject.cpp.

References WObject::labelpos.

bool labelShown ( ) const

Returns whether the label is shown or not.

Returns
true if the label is shown

Definition at line 173 of file wobject.cpp.

References WObject::labeldrawn.

Referenced by RenderWorld::draw().

bool localAxesDrawn ( ) const

Returns true if the local frame of refecence of the object should be drawn.

Returns
true if the local frame of reference should be drawn

Definition at line 126 of file wobject.cpp.

References WObject::localFrameOfReferenceDrawn.

Referenced by RenderWorld::draw().

QString name ( ) const

Return the name of this object.

Definition at line 69 of file wobject.cpp.

References WObject::namev.

Referenced by World::getObject(), and WObject::WObject().

void postUpdate ( )
virtual

postUpdate the WObject this method is called at each step of the world just after the physic update

Reimplemented in PhyMarXbot, PhyEpuck, PhyKhepera, and PhyMarXbot.

Definition at line 105 of file wobject.cpp.

void preUpdate ( )
virtual

preUpdate the WObject this method is called at each step of the world just before the physic update

Reimplemented in PhyMarXbot, PhyEpuck, PhyKhepera, and PhyMarXbot.

Definition at line 101 of file wobject.cpp.

void setAlpha ( int  alpha)

set the value of alpha channel (the transparency)

Definition at line 85 of file wobject.cpp.

References WObject::colorv.

Referenced by RenderWorld::draw().

void setColor ( QColor  c)

Set the color to use on rendering.

When the texture is setted, then the color is behind the texture. To display the object with only color set the texture to "none" - setTexture("none")

Definition at line 81 of file wobject.cpp.

References WObject::colorv.

Referenced by PhyEpuck::PhyEpuck(), PhyKhepera::PhyKhepera(), PhyMarXbot::PhyMarXbot(), PhyMarXbot::setDrawFrontMarker(), PhyKhepera::setDrawFrontMarker(), PhyEpuck::setDrawFrontMarker(), and SingleIRGraphic::SingleIRGraphic().

void setInvisible ( bool  b)

set invisibility

Invisible means that the object will be never rendered on widgets

Definition at line 118 of file wobject.cpp.

References WObject::invisible.

void setLabel ( QString  label)

Sets a text label to render along with the object.

Parameters
labelthe label to show

Definition at line 131 of file wobject.cpp.

References WObject::label(), and WObject::labelv.

void setLabel ( QString  label,
wVector  pos 
)

Sets a text label to render along with the object and its position.

Parameters
labelthe label to show
posthe position of the label in the object frame of reference
void setLabel ( QString  label,
wVector  pos,
QColor  color 
)

Sets a text label to render along with the object and its position and color.

Parameters
labelthe label to show
posthe position of the label in the object frame of reference
colorthe color of the label

Definition at line 136 of file wobject.cpp.

References WObject::color(), WObject::label(), WObject::labelcol, WObject::labelpos, and WObject::labelv.

void setLabelColor ( const QColor &  color)

Sets the color of the label.

Parameters
colorthe color of the label

Definition at line 158 of file wobject.cpp.

References WObject::color(), and WObject::labelcol.

void setLabelPosition ( const wVector pos)

Sets the label position relative to this object.

Parameters
posthe label position in the object frame of reference

Definition at line 148 of file wobject.cpp.

References WObject::labelpos.

void setPosition ( const wVector newpos)

set the position specified in global coordinate frame

Definition at line 51 of file wobject.cpp.

References WObject::changedMatrix(), and WObject::tm.

void setPosition ( real  x,
real  y,
real  z 
)

set the position specified in global coordinate frame

Definition at line 56 of file wobject.cpp.

References WObject::changedMatrix(), and WObject::tm.

void setTexture ( QString  textureName)

Set the texture to use for this WObject when rendered.

Definition at line 73 of file wobject.cpp.

References WObject::texturev.

Referenced by PhyMarXbot::setDrawFrontMarker(), PhyKhepera::setDrawFrontMarker(), PhyEpuck::setDrawFrontMarker(), and SingleIRGraphic::SingleIRGraphic().

void setUseColorTextureOfOwner ( bool  b)

set if the object will be rendered with the color and texture of our owner (if we have one)

Definition at line 97 of file wobject.cpp.

References WObject::usecolortextureofowner.

Referenced by PhyMarXbot::PhyMarXbot(), PhyMarXbot::setDrawFrontMarker(), PhyKhepera::setDrawFrontMarker(), PhyEpuck::setDrawFrontMarker(), PhyMarXbot::setLedColors(), PhyEpuck::setLedColors(), and SingleIRGraphic::SingleIRGraphic().

void showLabel ( bool  show)

Sets whether to show the label or not.

Parameters
showif true shows the label

Definition at line 168 of file wobject.cpp.

References WObject::labeldrawn.

Referenced by RenderWorld::draw().

QString texture ( ) const

Return the texture name.

Definition at line 77 of file wobject.cpp.

References WObject::texturev.

Referenced by RenderWObjectContainer::setupColorTexture().

bool useColorTextureOfOwner ( ) const

if true, we will use color and texture of our owner (if we have one)

Definition at line 93 of file wobject.cpp.

References WObject::usecolortextureofowner.

Referenced by PhyCylinder::graphicalRepresentationNeedsUpdate(), RenderWObjectContainer::setupColorTexture(), and RenderPhyCylinder::updateRepresentation().

const World * world ( ) const

Return the world (const version)

Definition at line 65 of file wobject.cpp.

References WObject::worldv.

Member Data Documentation

bool invisible
protected

if TRUE it will not renderized

Definition at line 201 of file wobject.h.

Referenced by WObject::isInvisible(), WObject::setInvisible(), and WObject::WObject().

QColor labelcol
protected

The color of the label.

Definition at line 211 of file wobject.h.

Referenced by WObject::labelColor(), WObject::setLabel(), WObject::setLabelColor(), and WObject::WObject().

bool labeldrawn
protected

Whether the label should be rendered or not.

Definition at line 213 of file wobject.h.

Referenced by WObject::labelShown(), WObject::showLabel(), and WObject::WObject().

wVector labelpos
protected

The position of the label in the object frame of reference.

Definition at line 209 of file wobject.h.

Referenced by WObject::labelPosition(), WObject::setLabel(), WObject::setLabelPosition(), and WObject::WObject().

QString labelv
protected

The text label of the object.

Definition at line 207 of file wobject.h.

Referenced by WObject::label(), WObject::setLabel(), and WObject::WObject().

bool localFrameOfReferenceDrawn
protected

If true, the local frame of reference of the object is drawn.

Definition at line 205 of file wobject.h.

Referenced by WObject::drawLocalAxes(), WObject::localAxesDrawn(), and WObject::WObject().

QString namev
protected

Name of the WObject.

Definition at line 195 of file wobject.h.

Referenced by WObject::name(), and WObject::WObject().

QString texturev
protected

Texture name.

Definition at line 197 of file wobject.h.

Referenced by WObject::setTexture(), WObject::texture(), and WObject::WObject().

bool usecolortextureofowner
protected

if true, we will use color and texture of our owner (if we have one).

True by default

Definition at line 203 of file wobject.h.

Referenced by WObject::setUseColorTextureOfOwner(), WObject::useColorTextureOfOwner(), and WObject::WObject().

World* worldv
protected

World.

Definition at line 191 of file wobject.h.

Referenced by WObject::WObject(), WObject::world(), and WObject::~WObject().


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