arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TFItem Class Reference

#include <TFItem.h>

Inheritance diagram for TFItem:

PolygonEdit CanvasItemIF CompositeItem gutz::Counted TFBoxItem List of all members.

Detailed Description

TFItem, generic base class, see TFItemSTD for some concrete example implementations.

This is the generic tf item that the TFView will see, for the most part all external interactions are through the TFItemVec. TFItems are the bridge between simianlib TFElements and the QT interface. An items behavior should be defined by the Element they represent, the Item's role is to comunicate changes to element and display them from the element. You should endevor to make sure "behavior" resides in the simianlib Element and only "interaction" and "display" stuff live in the Item.

Definition at line 54 of file TFItem.h.

Public Member Functions

 TFItem (QCanvas *canvas, TFEltSP elt)
 construct

virtual ~TFItem ()
TFEltSP getElt () const
 transfer function element that we own

void setElt (TFEltSP elt)
void setAxisX (int elm)
 which TF axies are we visualizing??? could be exteded to 3D...

int getAxisX () const
void setAxisY (int elm)
int getAxisY () const
tfVec2 getTFPosCA (int i)
 get/set Pos in TF element for the Current Axies

void setTFPosCA (int i, tfVec2 pos)
 setTFPosCA

void update ()
 checks if anything in the TFElement changed if it has, calls updateDef()

bool deleteMe () const
 indicate to parents or pointers that we need to be removed

virtual tfMat3 getXform () const
 get the transformation

virtual tfMat3 getInvXform () const
virtual tfVec2 xform (tfVec2 pt) const
 transform a point (tf -> canvas)

virtual STF::tfSType xformX (STF::tfSType x) const
virtual STF::tfSType xformY (STF::tfSType y) const
virtual tfVec2 invXform (tfVec2 pt) const
 inverse transform (canvas -> tf)

virtual STF::tfSType invXformX (STF::tfSType x) const
virtual STF::tfSType invXformY (STF::tfSType y) const
tfVec2 getBorder () const
 set the border space around tf, in pixels (canvas space)

void setBorder (tfVec2 b)
tfVec2 getScale () const
 set the scale factor to go from [0-1] tf space to "canvas space" and the inverse of that, ie.

tfVec2 getInvScale () const
void setScale (tfVec2 scales)
 setScale

virtual void setPoints (QPointArray p)
 Set Points.

QPointArray areaPoints () const
 Area points.

virtual void childUpdate (CanvasItemBase *child)
 TODO: as far as I can tell child update is unused!!

virtual void childMovedBy (CanvasItemBase *child, gutz::vec3d dv)
 child Moveby (relative motion)

virtual void childMoved (CanvasItemBase *child, gutz::vec3d last, gutz::vec3d point)
 child moved (absolute modtion)

virtual void moveBy (double dx, double dy)
virtual void moveBy (gutz::vec3d dv)
 this (incrmentaly) translates each node by differential vec "dv"

virtual void setSelected (bool yes)
 is it selected? (currently being modified) bool isSelected() declared in QCanvasItem

virtual void setActive (bool yes)
 has it been selected and modifiable as a group? bool isActive() declared in QCanvasItem

bool getUpdateLinks () const
 do you want this object to update other objects that are linked to it?

void setUpdateLinks (bool yes)

Protected Member Functions

virtual void updateDef ()
 called by update, for subclasses

void setTransform ()
 set Transform

virtual void drawShape (QPainter &p)
 Draw Shape.

void nukePoints ()
 Nuke Points.

void nukeEdges ()
 Nuke Edges.

int getEdgeIndex (CanvasItemBase *ptr)
 returns -1 if not an edge/node respectively

int getNodeIndex (CanvasItemBase *ptr)
 node index

void updatePen ()
virtual void _incCount ()
 gutz::Counted interface, increment reference count by one.

virtual void _decCount ()
 gutz::Counted interface, decrement reference count by one.

virtual int _getCount () const
 gutz::Counted interface, get the current reference count.


Protected Attributes

TFEltSP _elt
tfVec2 _scale
tfVec2 _invScale
tfVec2 _border
tfMat3 _xform
tfMat3 _invXform
int _axisX
int _axisY
int _lastEltMod
int _lastElmMod
 id for last elt mod

bool _done
 id for last element mod

NodeItemVec _points
EdgeItemVec _edges
CompositeItem * _comp
bool _updateLinks

Friends

class SmartPtr
class SmartPtrRef


Constructor & Destructor Documentation

TFItem::TFItem (  QCanvas *  canvas,
TFEltSP  elt
) 
 

construct

elt

Definition at line 36 of file TFItem.cpp.

References _elt, _lastElmMod, _lastEltMod, TFEltSP::getChangeID(), height, gutz::SmartPtrRef< TFElement >::isNull(), setTransform(), STF::tfSType, and width.

virtual TFItem::~TFItem (   )  [inline, virtual]
 

Definition at line 58 of file TFItem.h.

References _elt.


Member Function Documentation

virtual void gutz::Counted::_decCount (   )  [inline, protected, virtual, inherited]
 

gutz::Counted interface, decrement reference count by one.

Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Sometimes you need to call this though, see the documentation for gutz::SmartPtr

Definition at line 54 of file smartptr.h.

Referenced by TFImage::clear(), NrroImage::fBlendOverRGBA(), and Nrro::updateMinMax().

virtual int gutz::Counted::_getCount (   )  const [inline, protected, virtual, inherited]
 

gutz::Counted interface, get the current reference count.

Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr.

Definition at line 58 of file smartptr.h.

virtual void gutz::Counted::_incCount (   )  [inline, protected, virtual, inherited]
 

gutz::Counted interface, increment reference count by one.

Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Sometimes you need to call this though, see the documentation for gutz::SmartPtr

Definition at line 48 of file smartptr.h.

Referenced by TFImage::clear(), NrroImage::fBlendOverRGBA(), and Nrro::updateMinMax().

QPointArray PolygonEdit::areaPoints (   )  const [virtual, inherited]
 

Area points.

Implements CanvasItemIF.

Definition at line 360 of file CanvasItems.cpp.

References PolygonEdit::_points, x, and y.

virtual void PolygonEdit::childMoved (  CanvasItemBase *  child,
gutz::vec3d  last,
gutz::vec3d  point
)  [inline, virtual, inherited]
 

child moved (absolute modtion)

Implements CompositeItem.

Reimplemented in TFBoxItem.

Definition at line 260 of file commonQt/canvas/CanvasItems.h.

virtual void PolygonEdit::childMovedBy (  CanvasItemBase *  child,
gutz::vec3d  dv
)  [inline, virtual, inherited]
 

child Moveby (relative motion)

Implements CompositeItem.

Reimplemented in TFBoxItem.

Definition at line 258 of file commonQt/canvas/CanvasItems.h.

virtual void PolygonEdit::childUpdate (  CanvasItemBase *  child  )  [inline, virtual, inherited]
 

TODO: as far as I can tell child update is unused!!

Implements CompositeItem.

Reimplemented in TFBoxItem.

Definition at line 256 of file commonQt/canvas/CanvasItems.h.

bool TFItem::deleteMe (   )  const [inline]
 

indicate to parents or pointers that we need to be removed

Definition at line 81 of file TFItem.h.

References _done.

void PolygonEdit::drawShape (  QPainter &  p  )  [protected, virtual, inherited]
 

Draw Shape.

Implements CanvasItemIF.

Definition at line 417 of file CanvasItems.cpp.

int TFItem::getAxisX (   )  const [inline]
 

Definition at line 67 of file TFItem.h.

References _axisX.

int TFItem::getAxisY (   )  const [inline]
 

Definition at line 69 of file TFItem.h.

References _axisY.

tfVec2 TFItem::getBorder (   )  const [inline]
 

set the border space around tf, in pixels (canvas space)

Definition at line 98 of file TFItem.h.

References _border, and tfVec2.

int PolygonEdit::getEdgeIndex (  CanvasItemBase *  ptr  )  [protected, inherited]
 

returns -1 if not an edge/node respectively

Definition at line 424 of file CanvasItems.cpp.

References PolygonEdit::_edges.

Referenced by TFBoxItem::childMoved(), and TFBoxItem::childMovedBy().

TFEltSP TFItem::getElt (   )  const [inline]
 

transfer function element that we own

Definition at line 61 of file TFItem.h.

References _elt.

tfVec2 TFItem::getInvScale (   )  const [inline]
 

Definition at line 105 of file TFItem.h.

References _invScale, and tfVec2.

virtual tfMat3 TFItem::getInvXform (   )  const [inline, virtual]
 

Definition at line 85 of file TFItem.h.

References _invXform, and tfMat3.

int PolygonEdit::getNodeIndex (  CanvasItemBase *  ptr  )  [protected, inherited]
 

node index

Definition at line 435 of file CanvasItems.cpp.

References PolygonEdit::_points.

Referenced by TFBoxItem::childMoved(), and TFBoxItem::childMovedBy().

tfVec2 TFItem::getScale (   )  const [inline]
 

set the scale factor to go from [0-1] tf space to "canvas space" and the inverse of that, ie.

scale should probably just be the canvas width and height.

Definition at line 104 of file TFItem.h.

References _scale, and tfVec2.

tfVec2 TFItem::getTFPosCA (  int  i  ) 
 

get/set Pos in TF element for the Current Axies

get tf element

make sure we are good

get position

get elements that correspond to current axes

Definition at line 70 of file TFItem.cpp.

References _axisX, _axisY, _elt, TFElement::getPos(), TFElement::getPosVec(), gutz::SmartPtrRef< TFElement >::getPtr(), tfVec2, and tfVec2_bad.

bool CanvasItemIF::getUpdateLinks (   )  const [inline, inherited]
 

do you want this object to update other objects that are linked to it?

Definition at line 117 of file commonQt/canvas/CanvasItems.h.

References CanvasItemIF::_updateLinks.

virtual tfMat3 TFItem::getXform (   )  const [inline, virtual]
 

get the transformation

Definition at line 84 of file TFItem.h.

References _xform, and tfMat3.

virtual tfVec2 TFItem::invXform (  tfVec2  pt  )  const [inline, virtual]
 

inverse transform (canvas -> tf)

Definition at line 93 of file TFItem.h.

References _invXform, tfVec2, and gutz::mat3< STF::tfSType >::tpoint().

virtual STF::tfSType TFItem::invXformX (  STF::tfSType  x  )  const [inline, virtual]
 

Definition at line 94 of file TFItem.h.

References _invXform, and x.

Referenced by TFBoxItem::setTFLeft(), and TFBoxItem::setTFRight().

virtual STF::tfSType TFItem::invXformY (  STF::tfSType  y  )  const [inline, virtual]
 

Definition at line 95 of file TFItem.h.

References _invXform, and y.

Referenced by TFBoxItem::setTFBottom(), and TFBoxItem::setTFTop().

void PolygonEdit::moveBy (  gutz::vec3d  dv  )  [virtual, inherited]
 

this (incrmentaly) translates each node by differential vec "dv"

Definition at line 446 of file CanvasItems.cpp.

References PolygonEdit::_points.

virtual void PolygonEdit::moveBy (  double  dx,
double  dy
)  [inline, virtual, inherited]
 

Definition at line 262 of file commonQt/canvas/CanvasItems.h.

void PolygonEdit::nukeEdges (   )  [protected, inherited]
 

Nuke Edges.

Definition at line 406 of file CanvasItems.cpp.

References PolygonEdit::_edges, and EdgeItemVec.

Referenced by PolygonEdit::setPoints(), and PolygonEdit::~PolygonEdit().

void PolygonEdit::nukePoints (   )  [protected, inherited]
 

Nuke Points.

Definition at line 395 of file CanvasItems.cpp.

References PolygonEdit::_points, and NodeItemVec.

Referenced by PolygonEdit::setPoints(), and PolygonEdit::~PolygonEdit().

void CanvasItemIF::setActive (  bool  yes  )  [virtual, inherited]
 

has it been selected and modifiable as a group? bool isActive() declared in QCanvasItem

Definition at line 68 of file CanvasItems.cpp.

void TFItem::setAxisX (  int  elm  )  [inline]
 

which TF axies are we visualizing??? could be exteded to 3D...

later

Definition at line 66 of file TFItem.h.

References _axisX.

void TFItem::setAxisY (  int  elm  )  [inline]
 

Definition at line 68 of file TFItem.h.

References _axisY.

void TFItem::setBorder (  tfVec2  b  )  [inline]
 

Definition at line 99 of file TFItem.h.

References _border, and setTransform().

void TFItem::setElt (  TFEltSP  elt  )  [inline]
 

Definition at line 62 of file TFItem.h.

References _elt.

void PolygonEdit::setPoints (  QPointArray  p  )  [virtual, inherited]
 

Set Points.

create nodes

create points

Definition at line 374 of file CanvasItems.cpp.

References PolygonEdit::_edges, PolygonEdit::_points, EdgeItemSP, NodeItemSP, PolygonEdit::nukeEdges(), and PolygonEdit::nukePoints().

Referenced by TFView::TFView().

void TFItem::setScale (  tfVec2  scales  ) 
 

setScale

Definition at line 102 of file TFItem.cpp.

References _invScale, _scale, setTransform(), gutz::vec2< tfSType >::x, and gutz::vec2< tfSType >::y.

void CanvasItemIF::setSelected (  bool  yes  )  [virtual, inherited]
 

is it selected? (currently being modified) bool isSelected() declared in QCanvasItem

Definition at line 61 of file CanvasItems.cpp.

void TFItem::setTFPosCA (  int  i,
tfVec2  pos
) 
 

setTFPosCA

get tf element

make sure we are good

Definition at line 86 of file TFItem.cpp.

References _axisX, _axisY, _elt, TFElement::getPos(), TFElement::getPosVec(), gutz::SmartPtrRef< TFElement >::getPtr(), TFElement::setPos(), gutz::vec2< tfSType >::x, and gutz::vec2< tfSType >::y.

void TFItem::setTransform (   )  [protected]
 

set Transform

set to identity

TODO: looks like the mat3 inverse is fucked up, shouldn't need a transpose, need to fix this!

Definition at line 112 of file TFItem.cpp.

References _border, _invXform, _scale, _xform, gutz::mat3< STF::tfSType >::eye(), gutz::mat3< STF::tfSType >::inv(), scale, gutz::vec2< tfSType >::x, and gutz::vec2< tfSType >::y.

Referenced by setBorder(), setScale(), TFItem(), and update().

void CanvasItemIF::setUpdateLinks (  bool  yes  )  [inline, inherited]
 

Definition at line 118 of file commonQt/canvas/CanvasItems.h.

References CanvasItemIF::_updateLinks.

void TFItem::update (   ) 
 

checks if anything in the TFElement changed if it has, calls updateDef()

Definition at line 56 of file TFItem.cpp.

References _elt, _lastElmMod, _lastEltMod, TFEltSP::getChangeID(), gutz::SmartPtrRef< TFElement >::isNull(), setTransform(), and updateDef().

virtual void TFItem::updateDef (   )  [inline, protected, virtual]
 

called by update, for subclasses

Reimplemented in TFBoxItem.

Definition at line 110 of file TFItem.h.

Referenced by update().

void CanvasItemIF::updatePen (   )  [protected, inherited]
 

virtual tfVec2 TFItem::xform (  tfVec2  pt  )  const [inline, virtual]
 

transform a point (tf -> canvas)

Definition at line 88 of file TFItem.h.

References _xform, tfVec2, and gutz::mat3< STF::tfSType >::tpoint().

virtual STF::tfSType TFItem::xformX (  STF::tfSType  x  )  const [inline, virtual]
 

Definition at line 89 of file TFItem.h.

References _xform, and x.

Referenced by TFBoxItem::getTFLeft(), and TFBoxItem::getTFRight().

virtual STF::tfSType TFItem::xformY (  STF::tfSType  y  )  const [inline, virtual]
 

Definition at line 90 of file TFItem.h.

References _xform, and y.

Referenced by TFBoxItem::getTFBottom(), and TFBoxItem::getTFTop().


Friends And Related Function Documentation

friend class SmartPtr [friend, inherited]
 

Definition at line 40 of file smartptr.h.

Referenced by Nrro::NrroIter< T >::NrroIter().

friend class SmartPtrRef [friend, inherited]
 

Definition at line 41 of file smartptr.h.


Member Data Documentation

int TFItem::_axisX [protected]
 

Definition at line 123 of file TFItem.h.

Referenced by getAxisX(), TFBoxItem::getTFLeft(), getTFPosCA(), TFBoxItem::getTFRight(), setAxisX(), TFBoxItem::setTFLeft(), setTFPosCA(), and TFBoxItem::setTFRight().

int TFItem::_axisY [protected]
 

Definition at line 124 of file TFItem.h.

Referenced by getAxisY(), TFBoxItem::getTFBottom(), getTFPosCA(), TFBoxItem::getTFTop(), setAxisY(), TFBoxItem::setTFBottom(), setTFPosCA(), and TFBoxItem::setTFTop().

tfVec2 TFItem::_border [protected]
 

Definition at line 118 of file TFItem.h.

Referenced by getBorder(), setBorder(), and setTransform().

CompositeItem* CanvasItemIF::_comp [protected, inherited]
 

Definition at line 129 of file commonQt/canvas/CanvasItems.h.

Referenced by CanvasItemIF::CanvasItemIF(), NodeItem::moveBy(), and EdgeItem::moveBy().

bool TFItem::_done [protected]
 

id for last element mod

Definition at line 129 of file TFItem.h.

Referenced by deleteMe().

EdgeItemVec PolygonEdit::_edges [protected, inherited]
 

Definition at line 276 of file commonQt/canvas/CanvasItems.h.

Referenced by PolygonEdit::getEdgeIndex(), TFBoxItem::initBox(), PolygonEdit::nukeEdges(), and PolygonEdit::setPoints().

TFEltSP TFItem::_elt [protected]
 

Definition at line 112 of file TFItem.h.

Referenced by getElt(), getTFPosCA(), setElt(), setTFPosCA(), TFItem(), update(), and ~TFItem().

tfVec2 TFItem::_invScale [protected]
 

Definition at line 117 of file TFItem.h.

Referenced by getInvScale(), and setScale().

tfMat3 TFItem::_invXform [protected]
 

Definition at line 121 of file TFItem.h.

Referenced by getInvXform(), invXform(), invXformX(), invXformY(), and setTransform().

int TFItem::_lastElmMod [protected]
 

id for last elt mod

Definition at line 127 of file TFItem.h.

Referenced by TFItem(), and update().

int TFItem::_lastEltMod [protected]
 

Definition at line 126 of file TFItem.h.

Referenced by TFItem(), and update().

NodeItemVec PolygonEdit::_points [protected, inherited]
 

Definition at line 275 of file commonQt/canvas/CanvasItems.h.

Referenced by PolygonEdit::areaPoints(), PolygonEdit::getNodeIndex(), TFBoxItem::initBox(), PolygonEdit::moveBy(), PolygonEdit::nukePoints(), TFBoxItem::setBoxDims(), and PolygonEdit::setPoints().

tfVec2 TFItem::_scale [protected]
 

Definition at line 116 of file TFItem.h.

Referenced by getScale(), setScale(), and setTransform().

bool CanvasItemIF::_updateLinks [protected, inherited]
 

Definition at line 131 of file commonQt/canvas/CanvasItems.h.

Referenced by CanvasItemIF::CanvasItemIF(), CanvasItemIF::getUpdateLinks(), NodeItem::moveBy(), EdgeItem::moveBy(), NodeItem::setPoint(), and CanvasItemIF::setUpdateLinks().

tfMat3 TFItem::_xform [protected]
 

Definition at line 120 of file TFItem.h.

Referenced by getXform(), setTransform(), xform(), xformX(), and xformY().


The documentation for this class was generated from the following files:
Send questions, comments, and bug reports to:
jmk