Inviwo  0.9.10.1
Inviwo documentation
inviwo::TFEditorPrimitive Class Referenceabstract
+ Inheritance diagram for inviwo::TFEditorPrimitive:

Public Types

enum  ItemType {
  TFEditorUnknownPrimitiveType = 30, TFEditorControlPointType, TFControlPointConnectionType, TFEditorIsovalueType,
  Number_of_InviwoWidgetGraphicsItemTypes
}
 

Public Member Functions

 TFEditorPrimitive (TFPrimitive &primitive, QGraphicsScene *scene=nullptr, const vec2 &pos=vec2(), double size=14.0)
 
TFPrimitivegetPrimitive ()
 
const TFPrimitivegetPrimitive () const
 
void setPosition (double pos)
 
double getPosition () const
 
void setColor (const vec4 &color)
 
void setColor (const vec3 &color)
 
void setAlpha (float alpha)
 
const vec4 & getColor () const
 
void setTFPosition (const dvec2 &tfpos)
 
virtual const QPointF & getCurrentPos () const
 
void setSize (double s)
 
double getSize () const
 
void setHovered (bool hover)
 
void beginMouseDrag ()
 
void stopMouseDrag ()
 
- Public Member Functions inherited from inviwo::Observable< TFEditorPrimitiveObserver >
 Observable (const Observable< TFEditorPrimitiveObserver > &other)
 
 Observable (Observable< TFEditorPrimitiveObserver > &&other)
 
Observable< TFEditorPrimitiveObserver > & operator= (const Observable< TFEditorPrimitiveObserver > &other)
 
Observable< TFEditorPrimitiveObserver > & operator= (Observable< TFEditorPrimitiveObserver > &&other)
 
void addObserver (TFEditorPrimitiveObserver *observer)
 
void removeObserver (TFEditorPrimitiveObserver *observer)
 
virtual void startBlockingNotifications () override final
 
virtual void stopBlockingNotifications () override final
 

Protected Member Functions

virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget) override
 
virtual QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event) override
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 
virtual void paintPrimitive (QPainter *painter)=0
 
virtual QPointF prepareItemPositionChange (const QPointF &pos)
 
virtual void onItemPositionChange (const vec2 &)
 
virtual void onItemSceneHasChanged ()
 
- Protected Member Functions inherited from inviwo::Observable< TFEditorPrimitiveObserver >
void forEachObserver (C callback)
 
- Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
 
void removeObservationHelper (Observer *observer)
 

Protected Attributes

int defaultZValue_ = 10
 
double size_
 
bool isEditingPoint_
 
QPointF currentPos_
 position within scene rect (not normalized)
 
bool hovered_
 
TFPrimitivedata_
 

Friends

IVW_MODULE_QTWIDGETS_API bool operator== (const TFEditorPrimitive &lhs, const TFEditorPrimitive &rhs)
 
IVW_MODULE_QTWIDGETS_API bool operator< (const TFEditorPrimitive &lhs, const TFEditorPrimitive &rhs)
 

Constructor & Destructor Documentation

◆ TFEditorPrimitive()

inviwo::TFEditorPrimitive::TFEditorPrimitive ( TFPrimitive primitive,
QGraphicsScene *  scene = nullptr,
const vec2 &  pos = vec2(),
double  size = 14.0 
)

Constructs a TransferFunction editor primitive. The graphics item is positioned at the primitive location (scalar value and opacity) within the scene. The graphical representation should thus be centered around (0,0) in local coordinates.

Parameters
primitivepointer to the primitive
sceneitem will be added to this QGraphicsScene
posnormalized position of primitive (scalar value and opacity)
sizebase size of primitive

Member Function Documentation

◆ onItemPositionChange()

virtual void inviwo::TFEditorPrimitive::onItemPositionChange ( const vec2 &  )
inlineprotectedvirtual

gets called in itemChange() after a position change of the item. The position is already adjusted to lie within the scene bounding box and normalized.

Parameters
newPosnew, normalized position of the primitive

◆ onItemSceneHasChanged()

virtual void inviwo::TFEditorPrimitive::onItemSceneHasChanged ( )
inlineprotectedvirtual

gets called in itemChange() when a scene change has happend

◆ paint()

void inviwo::TFEditorPrimitive::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options,
QWidget *  widget 
)
overrideprotectedvirtual

paints the primitive and the label if visible. Pen and brush are set up prior calling paintPrimitive() reflecting primitive color and selection.

◆ paintPrimitive()

virtual void inviwo::TFEditorPrimitive::paintPrimitive ( QPainter *  painter)
protectedpure virtual

draws the primitive. Gets called from within paint()

Parameters
painterpainter for drawing the object, pen and brush are set up to match primitive color and selection status

◆ prepareItemPositionChange()

virtual QPointF inviwo::TFEditorPrimitive::prepareItemPositionChange ( const QPointF &  pos)
inlineprotectedvirtual

Allows to adjust the position prior updating the graphicsitem position, e.g. when the movement of a TF point is restricted ("restrict" or "push"). This function is called in itemChange() before calling onItemPositionChange.

Parameters
poscandidate for new position (in scene coords)
Returns
modified position which is used instead of pos

◆ setTFPosition()

void inviwo::TFEditorPrimitive::setTFPosition ( const dvec2 &  tfpos)

set the position of the primitive using normalized coordinates within the transfer function.

Parameters
tfposnormalized position [0,1] corresponding to scalar value and opacity

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