This class implements an IlvLabel
adapted to map applications.
More...
#include <ilviews/maps/graphics/maplabel.h>
Public Member Functions | |
IlvMapLabel (IlvDisplay *display, const IlvPoint &anchor, const IlvPoint &offset, IlvPosition position, IlvDim maxLabelLength, const char *label, IlvPalette *palette=0) | |
Initializes a new IlvMapLabel instance. More... | |
virtual void | drawMinimizedRect (IlvPort *dst, const IlvRect &minimizedRect) const |
Draws the map label in its minimized form. More... | |
IlvPoint | getAnchor () const |
Returns the anchor point of this label. More... | |
IlvDim | getMaxLabelLength () const |
Returns the maximum length of this label. More... | |
IlvPoint | getOffset () const |
Returns the offset of this label. More... | |
IlvPosition | getPosition () const |
Returns the position of this label. More... | |
void | setAttachment (const IlvPoint &anchor, const IlvPoint &offset, IlvPosition position) |
Specifies the position of the label. More... | |
void | setMaxLabelLength (IlvDim length) |
Sets the maximum length of this label in the manager coordinate system. More... | |
Static Public Member Functions | |
static IlvDim | GetLength (IlvDisplay *display, IlvDim height, const char *label, IlvPalette *palette=0) |
Computes the length of a label if it is displayed with a specified height. More... | |
This class implements an IlvLabel
adapted to map applications.
Library: ilvmaps
This class is a special version of the Rogue Wave Views IlvLabel
class. It has been adapted to fit the needs of map applications.
A map label is displayed with a fixed size font specified by its palette, but by a zoom factor inferior to its display limit in text form. Consequently, the map label appears on the screen as a rectangle at first and becomes readable as text after zooming.
The position of a map label is specified relative to an anchored point and to an offset in pixels relative to this anchored point. Therefore, the distance from the anchor point is independent of the zoom factor.
IlvMapLabel::IlvMapLabel | ( | IlvDisplay * | display, |
const IlvPoint & | anchor, | ||
const IlvPoint & | offset, | ||
IlvPosition | position, | ||
IlvDim | maxLabelLength, | ||
const char * | label, | ||
IlvPalette * | palette = 0 |
||
) |
Initializes a new IlvMapLabel
instance.
The location at which the label is drawn is the translation of anchor by the offset offset. The offset allows you, for example, to specify that a label is drawn below a particular point (the summit of a mountain for example). However, the distance between the point and the label is maintained when the view is zoomed in.
display | The display of the map label. |
anchor | The anchor point of the map label in the manager coordinate system. |
offset | The offset specified in pixels. |
position | The position of the label relative to the translated anchor. |
maxLabelLength | The maximum label length in the manager coordinate system. If the length of the string to display exceeds this size, the map label draws itself in a minimized mode. |
label | The label to be displayed. |
palette | The palette to draw this label. If not specified, this label is drawn using the default palette from its display. |
|
virtual |
Draws the map label in its minimized form.
This method is called to display the map label in its minimized form. By default, it draws a filled rectangle.
dst | The destination port on which the label is drawn. |
minimizedRect | The rectangle in which the minimized label should be drawn. |
IlvPoint IlvMapLabel::getAnchor | ( | ) | const |
Returns the anchor point of this label.
|
static |
Computes the length of a label if it is displayed with a specified height.
display | The display on which label is to be displayed. |
height | The height of the label. |
label | The label to be displayed. |
palette | The palette with which the label is to be drawn. |
IlvDim IlvMapLabel::getMaxLabelLength | ( | ) | const |
Returns the maximum length of this label.
IlvPoint IlvMapLabel::getOffset | ( | ) | const |
Returns the offset of this label.
IlvPosition IlvMapLabel::getPosition | ( | ) | const |
Returns the position of this label.
void IlvMapLabel::setAttachment | ( | const IlvPoint & | anchor, |
const IlvPoint & | offset, | ||
IlvPosition | position | ||
) |
Specifies the position of the label.
The location at which the label is drawn is the translation of anchor by the offset offset. The offset allows you, for example, to specify that a label is drawn below a particular point (the summit of a mountain for example). However, the distance between the point and the label is maintained when the view is zoomed in.
anchor | The anchor point of the map label in the manager coordinate system. |
offset | The offset specified in pixels. |
position | The position of the label relative to the translated anchor. |
void IlvMapLabel::setMaxLabelLength | ( | IlvDim | length | ) |
Sets the maximum length of this label in the manager coordinate system.
For example, if you want to display a label that will not exceed 10km when displayed on your map, you can use the following code:
length | The maximum length of this label. |