Curved labels, Adornments – Pitney Bowes MapXtreme User Manual

Page 250

Advertising
background image

Chapter 12: Adding Mapping Capability to Your Applications

Adornments

MapXtreme v7.1

257

Developer Guide

Dim map As Map = Session.Current.MapFactory.CreateEmptyMap(New _

Size(300, 300))

' Create a new feature layer that references the table and add it to the
map
Dim featureLayer As New FeatureLayer(table)
map.Layers.Add(featureLayer)

' Create a new label layer and add it to the map.
' Note that if you call MapInfo.Mapping.LayersBase.Add" method instead of
' MapInfo.Mapping.LayersBase.Insert method it will automatically position
the
' label layer before the feature layer

Dim labelLayer As New MapInfo.Mapping.LabelLayer()
map.Layers.Insert(0, labelLayer)

' Create a new label source that references the table
Dim source As New MapInfo.Mapping.LabelSource(table)

' Change its caption expression to be a specific column from the table
' called "State_Name"
source.DefaultLabelProperties.Caption = "State_Name"

' Append the label source to the label layer so that it shows on the map
labelLayer.Sources.Append(source)

Curved Labels

Curved labels are labels that follow the curve of a line. They enhance the appearance of map
features that are made up of lines, such as streets and rivers.

Curved labels are generated in the Workspace Manager by selecting the label layer, then selecting
Curve labels along segments in the Position tab. See

Curved Labels

.

To render curved labels via the API, use the ILayout interface and the UseRelativeOrientation
property. For labels to curve along the geometry, specify MapInfo.Text.RelativeOrientation.
FollowPath. See a code example in the Developer Reference under ILayout interface.

Adornments

The Adornments class is an unordered collection of a map’s adornments. An adornment is either a
Legend, a Title, a Scalebar, or some other user-defined object. Each map contains a single
Adornments Collection. Each adornment belongs to a single AdornmentControl.

To create your own adornment, derive a class from the IAdornment interface and the
AdornmentControl abstract class.

Advertising