rwlogo

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
IlvMapLabel Class Reference

This class implements an IlvLabel adapted to map applications. More...

#include <ilviews/maps/graphics/maplabel.h>

Inheritance diagram for IlvMapLabel:
IlvLabel IlvSimpleGraphic IlvGraphic

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. 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.
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:
More...
 

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. More...
 

Protected Member Functions

virtual void drawMinimizedRect (IlvPort *dst, const IlvRect &minimizedRect) const
 Draws the map label in its minimized form. More...
 

Detailed Description

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

Constructor & Destructor Documentation

IlvMapLabel::IlvMapLabel ( IlvDisplay display,
const IlvPoint anchor,
const IlvPoint offset,
IlvPosition  position,
IlvDim  maxLabelLength,
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.

Parameters
displayThe display of the map label.
anchorThe anchor point of the map label in the manager coordinate system.
offsetThe offset specified in pixels.
positionThe position of the label relative to the translated anchor.
maxLabelLengthThe 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.
labelThe label to be displayed.
paletteThe palette to draw this label. If not specified, this label is drawn using the default palette from its display.
See Also
IlvPosition

Member Function Documentation

virtual void IlvMapLabel::drawMinimizedRect ( IlvPort dst,
const IlvRect minimizedRect 
) const
protectedvirtual

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.

Parameters
dstThe destination port on which the label is drawn.
minimizedRectThe rectangle in which the minimized label should be drawn.
IlvPoint IlvMapLabel::getAnchor ( ) const

Returns the anchor point of this label.

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.

Parameters
displayThe display on which label is to be displayed.
heightThe height of the label.
labelThe label to be displayed.
paletteThe palette with which the label is to be drawn.
Returns
The length of the label.
IlvDim IlvMapLabel::getMaxLabelLength ( ) const

Returns the maximum length of this label.

Returns
The maximum length of this label.
IlvPoint IlvMapLabel::getOffset ( ) const

Returns the offset of this label.

Returns
The offset of this label.
IlvPosition IlvMapLabel::getPosition ( ) const

Returns the position of this label.

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.

Parameters
anchorThe anchor point of the map label in the manager coordinate system.
offsetThe offset specified in pixels.
positionThe 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);
Parameters
lengthThe maximum length of this label.

© Copyright 2015, 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.