Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
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 length, const char *label, IlvPalette *palette=0) | |
Initializes a new IlvMapLabel . | |
IlvPoint | getAnchor () const |
Returns the anchor point of this label. | |
IlvDim | getMaxLabelLength () const |
Returns the maximum length of this label. | |
IlvPoint | getOffset () const |
Returns the offset of this label. | |
IlvPosition | getPosition () const |
Returns the position of this label. | |
void | setAttachment (const IlvPoint &anchor, const IlvPoint &offset, IlvPosition position) |
Specifies the position of the label. | |
void | 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: . | |
Static Public Member Functions | |
static IlvDim | GetLength (IlvDisplay *display, IlvDim height, const char *label, IlvPalette *palette=0) |
Computes the length of label as if it is displayed with the specified height. | |
Protected Member Functions | |
virtual void | drawMinimizedRect (IlvPort *dst, const IlvRect &minimizedRect) const |
Draws the map label in its minimized form. |
This class implements an IlvLabel
adapted to map applications.
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.
Library: ilvmaps
IlvMapLabel::IlvMapLabel | ( | IlvDisplay * | display, | |
const IlvPoint & | anchor, | |||
const IlvPoint & | offset, | |||
IlvPosition | position, | |||
IlvDim | length, | |||
const char * | label, | |||
IlvPalette * | palette = 0 | |||
) |
Initializes a new IlvMapLabel
.
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 void IlvMapLabel::drawMinimizedRect | ( | IlvPort * | dst, | |
const IlvRect & | minimizedRect | |||
) | const [protected, 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.
port | The 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 IlvDim IlvMapLabel::GetLength | ( | IlvDisplay * | display, | |
IlvDim | height, | |||
const char * | label, | |||
IlvPalette * | palette = 0 | |||
) | [static] |
Computes the length of label as if it is displayed with the 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:
.
IlvUnitConverter* converter = mapInfo->getUnitConverter(); IlDouble maxLengthMeters = converter->toMeters(10000); IlvDim maxLength = (IlvDim) mapInfo->getAdapter()->toViews(maxLengthMeteres); mapLabel->setMaxLabelLength(maxLength);
length | The maximum length of this label. |
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.