Utility class for IlvTimeScale
.
More...
#include <ilviews/graphics/timescale.h>
Public Member Functions | |
IlvTimeScalePaintContext (const IlvTimeScale *tscale) | |
Constructor. More... | |
IlvTimeScalePaintContext (const IlvTimeScalePaintContext &) | |
Copy constructor. | |
IlvTimeScalePaintContext (IlDate visibleTime, IlvDuration duration, IlDouble XTranslation=0.0, IlDouble XZoomFactor=1.0, IlvFont *font=0) | |
Constructor. More... | |
IlvFont * | getFont () const |
Gets the font used to paint the labels of the time scale. More... | |
IlvDuration | getVisibleDuration () const |
Returns the duration of the time interval painted by the scale. More... | |
IlDate | getVisibleTime () const |
Returns the beginning of the time interval displayed by the scale. More... | |
IlDouble | getXTranslation () const |
Returns the horizontal translation used while painting the time scale. More... | |
IlDouble | getXZoomFactor () const |
Returns the horizontal zoom factor used while painting the time scale. More... | |
IlDouble | inverseTransform (IlDouble x) const |
Inverse transforms a horizontal coordinate. More... | |
void | setFont (IlvFont *font) |
Sets the font used to paint the labels of the time scale. More... | |
void | setVisibleDuration (IlvDuration duration) |
Sets the duration of the time interval painted by the scale. More... | |
void | setVisibleTime (IlDate time) |
Sets the beginning of the time interval painted by the scale. More... | |
void | setXTranslation (IlDouble translation) |
Sets the horizontal translation used while painting the time scale. More... | |
void | setXZoomFactor (IlDouble factor) |
Sets the horizontal zoom factor used while painting the time scale. More... | |
IlDouble | transform (IlDouble x) const |
Transforms a horizontal coordinate. More... | |
Utility class for IlvTimeScale
.
Library: views
A IlvTimeScalePaintContext
defines the context in which the time scale paints.
It defines the following parameters required for painting the time scale:
getVisibleTime()
, setVisibleTime()
, getVisibleDuration()
, and setVisibleDuration()
to get or to set the visible time interval. getXTranslation()
, setXTranslation()
, getXZoomFactor()
, and setXZoomFactor()
to get or to set the horizontal translation and the horizontal zoom factor. setFont()
and getFont()
to get and to set the font. The font is optional in a IlvTimeScalePaintContext
. If getFont()
returns 0
the time scale paints the time scale rows by using the fonts set for the time scale rows. The IlvTimeScalePaintContext
is generally used by the method IlvTimeScale::draw()
. The time scale has a cached IlvTimeScalePaintContext
that can be retrieved by calling IlvTimeScale::getPaintContext()
. It is the paint context used to paint the time scale when the IlvTimeScale::draw()
method is called.
IlvTimeScalePaintContext::IlvTimeScalePaintContext | ( | IlDate | visibleTime, |
IlvDuration | duration, | ||
IlDouble | XTranslation = 0.0 , |
||
IlDouble | XZoomFactor = 1.0 , |
||
IlvFont * | font = 0 |
||
) |
Constructor.
Initializes a new IlvTimeScalePaintContext
for the specified visible interval, the transformation, the zoom factor, and the font.
visibleTime | The begin of the visible time interval to be painted. |
duration | The duration of the visible time interval to be painted. |
XTranslation | The horizontal translation used to paint the time scale. |
XZoomFactor | The horizontal zoom factor used to paint the time scale. |
font | The font used to paint the labels of the time scale. |
IlvTimeScalePaintContext::IlvTimeScalePaintContext | ( | const IlvTimeScale * | tscale | ) |
Constructor.
Creates a new IlvTimeScalePaintContext
by copying parameters (duration, zoom factor and horizontal translation) from an existing IlvTimeScale
.
tscale | The existing time scale to copy from. |
IlvFont* IlvTimeScalePaintContext::getFont | ( | ) | const |
IlvDuration IlvTimeScalePaintContext::getVisibleDuration | ( | ) | const |
Returns the duration of the time interval painted by the scale.
setVisibleDuration()
IlDate IlvTimeScalePaintContext::getVisibleTime | ( | ) | const |
Returns the beginning of the time interval displayed by the scale.
setVisibleTime()
IlDouble IlvTimeScalePaintContext::getXTranslation | ( | ) | const |
Returns the horizontal translation used while painting the time scale.
transform()
inverseTransform()
IlDouble IlvTimeScalePaintContext::getXZoomFactor | ( | ) | const |
Returns the horizontal zoom factor used while painting the time scale.
transform()
inverseTransform()
Inverse transforms a horizontal coordinate.
The value is transformed as follows:
(x - XTranslation) / XZoomFactor
x | The coordinate to be inverse transformed. |
void IlvTimeScalePaintContext::setFont | ( | IlvFont * | font | ) |
Sets the font used to paint the labels of the time scale.
This parameter can be 0
. In this case the font parameter in the context is ignored. The fonts defined for the time scale rows are used instead.
font | The font. |
void IlvTimeScalePaintContext::setVisibleDuration | ( | IlvDuration | duration | ) |
Sets the duration of the time interval painted by the scale.
duration | The new duration value. |
getVisibleDuration()
void IlvTimeScalePaintContext::setVisibleTime | ( | IlDate | time | ) |
Sets the beginning of the time interval painted by the scale.
This function adjusts the horizontal translation so that the specified date appears at the beginning of the painted time scale.
time | The new time value. |
getVisibleTime()
void IlvTimeScalePaintContext::setXTranslation | ( | IlDouble | translation | ) |
Sets the horizontal translation used while painting the time scale.
translation | The new horizontal translation. |
transform()
inverseTransform()
void IlvTimeScalePaintContext::setXZoomFactor | ( | IlDouble | factor | ) |
Sets the horizontal zoom factor used while painting the time scale.
factor | The new horizontal zoom factor, which cannot be 0.0 . |
transform()
inverseTransform()
Transforms a horizontal coordinate.
The value is transformed as follows:
x * XZoomFactor + XTranslation
x | The coordinate to be transformed. |