AnnotationObject Class Reference

Collaboration diagram for AnnotationObject:
Collaboration graph
[legend]

List of all members.

Public Slots

void frameChanged (int)
 Recompute our position and visibility for the given frame and redraw.
void updateAnimation ()
 Recompute our position and visibility because our animation was changed.

Signals

void objectSelected (int)
 Let the manager know that we have been selected by the user.
void rowSelected (int)
 Let the view know which row has been selected.
void animationChanged (int row, int frame)
 Let the model know that the animation state has changed.

Public Member Functions

 AnnotationObject (int frameNum, FrameRange frameRange, QPointF initialPos, QString description="None", int type=0, QGraphicsItem *parent=0)
 Create a new Annotation Object with a default description and type.
 ~AnnotationObject ()
 Destroy this Annotation Object, and destroy all of it's vertices.
void addVertex (int index, AnnotationObjectVertex *v)
 Insert a new vertex into the store at the given index.
void insertVertexAtPoint (QPointF point)
 Add a vertex to this object at the given point.
void removeVertex (QPointF point)
 Remove the top most vertex of this object at the given point.
void showSelected ()
 Highlight this object.
void showDeselected ()
 Dehighlight this object.
QRectF boundingRect () const
 Get the bounding rectangle of this object, given by the bounding rect of it's polygon.
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Draw this object on the screen.
int getId () const
 Get the Unique ID of this object.
QString getDescription () const
 Get the user specified description of this object.
int getType () const
 Get the user specified type of this object.
QColor getColor () const
 Get the randomly assigned color of this object.
QPointF getCenter () const
 Compute the center point of this object.
void setDescription (QString description)
 Set the description of this object.
void setType (int type)
 Set the type of this object.
ObjectAnimation::FrameState getFrameState (int fnum)
 Get the interpolated frame state for a given frame.
ObjectAnimationgetAnimation ()
 Get a pointer to our member animation.
QList< AnnotationObjectVertex * > * getVertices ()
 Get a pointer to the vertices structure.
AnimationModelgetAnimationModel ()
 Get a pointer to the animation model.
void constructAnimationContextMenu (QPoint globalPos, int row, int column)
 Ask our ObjectAnimation member to construct a context menu.
int getCurrentFrameNum ()
void selectVertex (AnnotationObjectVertex *vertex)
 Tell the animation view that a vertex has been selected.
QPainterPath shape () const
 Return the actual shape of the polygon for hit detection.
void pubPrepareGeometryChange ()
 Allow vertices to prepare the object for a geometry change.
void setLastClick (const QModelIndex &index)
 Store the index of the last click in the animation model - used for drag and drop.
void setOpacity (int opacity)
 Set the user selectable opacity for this object.
QVector< QMap< int, QPointF > > renderAnimation ()
 Render this object's keyframed/relative animation out to an absolute structure.
std::map< int,
ObjectAnimation::FrameState
getVertexStates (int fnum)
 Get all of the interpolated vertex states for a given frame number.
void setVertices (std::map< int, ObjectAnimation::FrameState > VertexFrames)
 Reset all of the objects vertices to these values.
void setKeyframe (int frameNum, QPointF pos, bool visible)
 Set a new keyframe.
void forceId (int id)
 Force the id of this object - this should really only be done when loading from XML.
AnnotationObjectVertexgetVertexById (int id)
 Get a vertex by it's index.
void clearAnimation ()
 Clear all keypoints from the animation.

Protected Member Functions

void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 Select the object when the user clicks on it.

Detailed Description

Definition at line 87 of file AnnotationObject.qt.H.


Constructor & Destructor Documentation

AnnotationObject::AnnotationObject ( int  frameNum,
FrameRange  frameRange,
QPointF  initialPos,
QString  description = "None",
int  type = 0,
QGraphicsItem *  parent = 0 
)

Create a new Annotation Object with a default description and type.

Definition at line 202 of file AnnotationObject.qt.C.

References addVertex(), animationChanged(), ObjectAnimation::getFrameRange(), and showDeselected().

AnnotationObject::~AnnotationObject (  ) 

Destroy this Annotation Object, and destroy all of it's vertices.

Definition at line 248 of file AnnotationObject.qt.C.


Member Function Documentation

void AnnotationObject::addVertex ( int  index,
AnnotationObjectVertex v 
)

Insert a new vertex into the store at the given index.

Definition at line 267 of file AnnotationObject.qt.C.

References animationChanged(), AnimationModel::animationChanged(), AnimationModel::beginInsertRow(), and AnimationModel::endInsertRow().

Referenced by AnnotationObject(), insertVertexAtPoint(), and setVertices().

void AnnotationObject::animationChanged ( int  row,
int  frame 
) [signal]

Let the model know that the animation state has changed.

Referenced by addVertex(), AnnotationObject(), and mouseReleaseEvent().

QRectF AnnotationObject::boundingRect (  )  const

Get the bounding rectangle of this object, given by the bounding rect of it's polygon.

Definition at line 435 of file AnnotationObject.qt.C.

void AnnotationObject::clearAnimation (  ) 

Clear all keypoints from the animation.

Definition at line 704 of file AnnotationObject.qt.C.

References ObjectAnimation::clear().

void AnnotationObject::constructAnimationContextMenu ( QPoint  globalPos,
int  row,
int  column 
)

Ask our ObjectAnimation member to construct a context menu.

Definition at line 589 of file AnnotationObject.qt.C.

References ObjectAnimation::constructContextMenu(), and frameChanged().

void AnnotationObject::forceId ( int  id  ) 

Force the id of this object - this should really only be done when loading from XML.

Definition at line 259 of file AnnotationObject.qt.C.

void AnnotationObject::frameChanged ( int  frameNum  )  [slot]

Recompute our position and visibility for the given frame and redraw.

Definition at line 516 of file AnnotationObject.qt.C.

References AnimationModel::animationChanged(), and ObjectAnimation::getFrameState().

Referenced by MainWindow::addObject(), constructAnimationContextMenu(), and updateAnimation().

ObjectAnimation* AnnotationObject::getAnimation (  )  [inline]
AnimationModel * AnnotationObject::getAnimationModel (  ) 

Get a pointer to the animation model.

Definition at line 610 of file AnnotationObject.qt.C.

QPointF AnnotationObject::getCenter (  )  const

Compute the center point of this object.

Definition at line 374 of file AnnotationObject.qt.C.

QColor AnnotationObject::getColor (  )  const [inline]

Get the randomly assigned color of this object.

Definition at line 137 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectVertex::AnnotationObjectVertex().

QString AnnotationObject::getDescription (  )  const [inline]

Get the user specified description of this object.

Definition at line 131 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectManager::data().

ObjectAnimation::FrameState AnnotationObject::getFrameState ( int  fnum  )  [inline]

Get the interpolated frame state for a given frame.

Definition at line 149 of file AnnotationObject.qt.H.

References ObjectAnimation::getFrameState().

int AnnotationObject::getId (  )  const [inline]

Get the Unique ID of this object.

This ID is auto-incremented by a static counter for each created object.

Definition at line 128 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectManager::data().

int AnnotationObject::getType (  )  const [inline]

Get the user specified type of this object.

Definition at line 134 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectManager::data().

AnnotationObjectVertex* AnnotationObject::getVertexById ( int  id  )  [inline]

Get a vertex by it's index.

Definition at line 206 of file AnnotationObject.qt.H.

std::map< int, ObjectAnimation::FrameState > AnnotationObject::getVertexStates ( int  fnum  ) 

Get all of the interpolated vertex states for a given frame number.

Definition at line 680 of file AnnotationObject.qt.C.

References ObjectAnimation::getFrameState().

QList<AnnotationObjectVertex*>* AnnotationObject::getVertices (  )  [inline]

Get a pointer to the vertices structure.

Definition at line 155 of file AnnotationObject.qt.H.

void AnnotationObject::insertVertexAtPoint ( QPointF  point  ) 

Add a vertex to this object at the given point.

Definition at line 309 of file AnnotationObject.qt.C.

References addVertex(), and ObjectAnimation::getFrameRange().

void AnnotationObject::mousePressEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Select the object when the user clicks on it.

Definition at line 575 of file AnnotationObject.qt.C.

References AnimationModel::animationChanged(), objectSelected(), and rowSelected().

void AnnotationObject::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Create a new keyframe with the new position of the object when moved by the mouse and select this object

Definition at line 554 of file AnnotationObject.qt.C.

References animationChanged(), ObjectAnimation::getFrameState(), and ObjectAnimation::setPosition().

void AnnotationObject::objectSelected ( int   )  [signal]

Let the manager know that we have been selected by the user.

Referenced by mousePressEvent(), and selectVertex().

void AnnotationObject::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)

Draw this object on the screen.

The paint function goes clockwise through each of the vertices in itsVertices, and constructs a QPolygon from their positions. This polygon is then drawn on the screen using a fill brush with itsColor, and a thick white line pen.

Definition at line 458 of file AnnotationObject.qt.C.

void AnnotationObject::pubPrepareGeometryChange (  )  [inline]

Allow vertices to prepare the object for a geometry change.

When vertices are moved, they need to tell their parent object that the bounding box has been modified so things can be drawn correclty. This is called at the end of a vertex' mouseReleaseEvent to save a bit on processing power.

Definition at line 178 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectVertex::mouseReleaseEvent().

void AnnotationObject::removeVertex ( QPointF  point  ) 

Remove the top most vertex of this object at the given point.

Definition at line 347 of file AnnotationObject.qt.C.

References AnimationModel::beginRemoveRow(), and AnimationModel::endRemoveRow().

QVector< QMap< int, QPointF > > AnnotationObject::renderAnimation (  ) 

Render this object's keyframed/relative animation out to an absolute structure.

The returned result of this method is a vector, which contains an entry for each vertex of the object. Each of these entries is a Map, which maps framenumbers to absolute vertex positions at that framenumber. Some vertices may not have entries for every frame because they were made invisible.

Definition at line 654 of file AnnotationObject.qt.C.

References ObjectAnimation::getFrameRange(), and ObjectAnimation::getFrameState().

void AnnotationObject::rowSelected ( int   )  [signal]

Let the view know which row has been selected.

Referenced by mousePressEvent(), and selectVertex().

void AnnotationObject::selectVertex ( AnnotationObjectVertex vertex  ) 

Tell the animation view that a vertex has been selected.

This will then highlight the proper row in the view so that users can have some feedback about what they're editing

Definition at line 617 of file AnnotationObject.qt.C.

References AnimationModel::animationChanged(), ASSERT, objectSelected(), and rowSelected().

Referenced by AnnotationObjectVertex::mousePressEvent().

void AnnotationObject::setDescription ( QString  description  )  [inline]

Set the description of this object.

Definition at line 143 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectManager::setData().

void AnnotationObject::setKeyframe ( int  frameNum,
QPointF  pos,
bool  visible 
)

Set a new keyframe.

Definition at line 542 of file AnnotationObject.qt.C.

References ObjectAnimation::setPosition().

void AnnotationObject::setLastClick ( const QModelIndex &  index  )  [inline]

Store the index of the last click in the animation model - used for drag and drop.

Definition at line 181 of file AnnotationObject.qt.H.

void AnnotationObject::setOpacity ( int  opacity  )  [inline]

Set the user selectable opacity for this object.

Definition at line 184 of file AnnotationObject.qt.H.

void AnnotationObject::setType ( int  type  )  [inline]

Set the type of this object.

Definition at line 146 of file AnnotationObject.qt.H.

Referenced by AnnotationObjectManager::setData().

void AnnotationObject::setVertices ( std::map< int, ObjectAnimation::FrameState VertexFrames  ) 
QPainterPath AnnotationObject::shape (  )  const

Return the actual shape of the polygon for hit detection.

Definition at line 646 of file AnnotationObject.qt.C.

void AnnotationObject::showDeselected (  ) 

Dehighlight this object.

Definition at line 504 of file AnnotationObject.qt.C.

Referenced by AnnotationObject().

void AnnotationObject::showSelected (  ) 

Highlight this object.

Definition at line 490 of file AnnotationObject.qt.C.

void AnnotationObject::updateAnimation (  )  [slot]

Recompute our position and visibility because our animation was changed.

Definition at line 548 of file AnnotationObject.qt.C.

References frameChanged().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:06 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3