The graphical representation of the MarXbot traction sensor. More...

Inheritance diagram for TractionSensorGraphic:

Public Member Functions

 TractionSensorGraphic (WObject *object, const wVector &offset, real radius, real scale=1.0, real maxLength=1.0, QString name="unamed")
 Constructor.
 
 ~TractionSensorGraphic ()
 Destructor.
 
void setVector (const wVector vector)
 Sets the vector to draw. The vector must be in the object frame of reference.
 
- Public Member Functions inherited from GraphicalWObject
 GraphicalWObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity())
 
WObjectattachedObject () const
 
void attachToObject (WObject *object, bool makeOwner=false, const wMatrix &displacement=wMatrix::identity())
 
QColor color () const
 
const wMatrixgetDisplacement () const
 
bool isInvisible ()
 
const wMatrixmatrix () const
 
QString name () const
 
 Ownable ()
 
const QList< Owned > & owned () const
 
Ownableowner () const
 
virtual void postUpdate ()
 
virtual void preUpdate ()
 
void setAlpha (int alpha)
 
void setColor (QColor c)
 
void setDisplacement (const wMatrix &displacement)
 
void setInvisible (bool b)
 
void setMatrix (const wMatrix &newm)
 
void setOwner (Ownable *owner, bool destroy=true)
 
void setPosition (const wVector &newpos)
 
void setPosition (real x, real y, real z)
 
void setTexture (QString textureName)
 
void setUseColorTextureOfOwner (bool b)
 
QString texture () const
 
void updateAndCalculateAABB (wVector &minPoint, wVector &maxPoint, const wMatrix tm)
 
void updateAndCalculateOBB (wVector &dimension, wVector &minPoint, wVector &maxPoint)
 
void updateAndRender (RenderWObject *renderer, QGLContext *gw)
 
void updateAndRenderAABB (RenderWObject *renderer, RenderWorld *gw)
 
bool useColorTextureOfOwner () const
 
 WObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool addToWorld=true)
 
Worldworld ()
 
const Worldworld () const
 
- Public Member Functions inherited from WObject
 WObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool addToWorld=true)
 
QColor color () const
 
bool isInvisible ()
 
const wMatrixmatrix () const
 
QString name () const
 
 Ownable ()
 
const QList< Owned > & owned () const
 
Ownableowner () const
 
void setAlpha (int alpha)
 
void setColor (QColor c)
 
void setInvisible (bool b)
 
void setMatrix (const wMatrix &newm)
 
void setOwner (Ownable *owner, bool destroy=true)
 
void setPosition (const wVector &newpos)
 
void setPosition (real x, real y, real z)
 
void setTexture (QString textureName)
 
void setUseColorTextureOfOwner (bool b)
 
QString texture () const
 
bool useColorTextureOfOwner () const
 
Worldworld ()
 
const Worldworld () const
 
- Public Member Functions inherited from Ownable
const QList< Owned > & owned () const
 
Ownableowner () const
 
void setOwner (Ownable *owner, bool destroy=true)
 

Protected Member Functions

virtual void render (RenderWObject *renderer, QGLContext *gw)
 Performs the actual drawing.
 
- Protected Member Functions inherited from GraphicalWObject
virtual void calculateAABB (wVector &minPoint, wVector &maxPoint, const wMatrix tm)
 
virtual void calculateOBB (wVector &dimension, wVector &minPoint, wVector &maxPoint)
 
virtual void changedMatrix ()
 
virtual void renderAABB (RenderWObject *renderer, RenderWorld *gw)
 
void updateMatrixFromAttachedObject ()
 

Protected Attributes

const real m_maxLength
 The maximum length of the vector.
 
WObject *const m_object
 The object to which this representation is attached.
 
const real m_radius
 The radius of the arrow. The length depends on the vector intensity.
 
const real m_scale
 The scaling factor for the vector length.
 
wVector m_vector
 The vector to represent.
 
QMutex m_vectorMutex
 The mutex protecting the m_vector vector.
 
- Protected Attributes inherited from GraphicalWObject
QColor colorv
 
bool invisible
 
QString namev
 
QString texturev
 
wMatrix tm
 
bool usecolortextureofowner
 
Worldworldv
 
- Protected Attributes inherited from WObject
QColor colorv
 
bool invisible
 
QString namev
 
QString texturev
 
wMatrix tm
 
bool usecolortextureofowner
 
Worldworldv
 

Additional Inherited Members

- Public Types inherited from GraphicalWObject
typedef QList< OwnedOwnedList
 

Detailed Description

The graphical representation of the MarXbot traction sensor.

The arrow is drawn as a cylinder with a cone on top

Definition at line 489 of file marxbotsensors.cpp.

Constructor & Destructor Documentation

TractionSensorGraphic ( WObject object,
const wVector &  offset,
real  radius,
real  scale = 1.0,
real  maxLength = 1.0,
QString  name = "unamed" 
)
inline

Constructor.

This also sets a default color for the piece and sets handPiece to be our owner. This draws an arrow representing a vector

Parameters
objectthe object to which this representation is attached. This must not be NULL
offsetthe offset relative to object. The arrow starts from the offset in the frame of reference of the object
radiusthe radius of the arrow. The length depends on the vector intensity
scalethe scaling factor for the vector length
maxLengththe maximum length of the vector. If the vector is longer than this, the arrow is drawn this length with a different color. This is the length BEFORE scaling
namethe name of this object

Definition at line 512 of file marxbotsensors.cpp.

References GraphicalWObject::attachToObject(), wMatrix::identity(), TractionSensorGraphic::m_object, GraphicalWObject::setTexture(), GraphicalWObject::setUseColorTextureOfOwner(), and wMatrix::w_pos.

~TractionSensorGraphic ( )
inline

Destructor.

Definition at line 534 of file marxbotsensors.cpp.

Member Function Documentation

virtual void render ( RenderWObject renderer,
QGLContext *  gw 
)
inlineprotectedvirtual
void setVector ( const wVector  vector)
inline

Sets the vector to draw. The vector must be in the object frame of reference.

This function is thread-safe

Parameters
vectorthe vector to draw. The vector must be in the object frame of reference

Definition at line 546 of file marxbotsensors.cpp.

References TractionSensorGraphic::m_vector, and TractionSensorGraphic::m_vectorMutex.

Referenced by MarXbotTractionSensor::update().

Member Data Documentation

const real m_maxLength
protected

The maximum length of the vector.

If the vector is longer than this, the arrow is drawn this length with a different color. This is the length BEFORE scaling

Definition at line 651 of file marxbotsensors.cpp.

Referenced by TractionSensorGraphic::render().

WObject* const m_object
protected

The object to which this representation is attached.

Definition at line 631 of file marxbotsensors.cpp.

Referenced by TractionSensorGraphic::TractionSensorGraphic().

const real m_radius
protected

The radius of the arrow. The length depends on the vector intensity.

Definition at line 637 of file marxbotsensors.cpp.

Referenced by TractionSensorGraphic::render().

const real m_scale
protected

The scaling factor for the vector length.

Definition at line 642 of file marxbotsensors.cpp.

Referenced by TractionSensorGraphic::render().

wVector m_vector
protected

The vector to represent.

The vector is in the object frame of reference

Definition at line 658 of file marxbotsensors.cpp.

Referenced by TractionSensorGraphic::render(), and TractionSensorGraphic::setVector().

QMutex m_vectorMutex
protected

The mutex protecting the m_vector vector.

The vector could be accessed by multiple threads concurrently, so we protect it with a mutex

Definition at line 666 of file marxbotsensors.cpp.

Referenced by TractionSensorGraphic::render(), and TractionSensorGraphic::setVector().


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