Rangedlabeltheme, When to use a rangedlabeltheme class – Pitney Bowes MapXtreme User Manual

Page 279

Advertising
background image

Chapter 14: Using Themes and Legends

RangedLabelTheme

MapXtreme v7.1

286

Developer Guide

Custom Ranges

If none of the distribution methods meet your needs, you can create custom ranges using the
method DistributionMethod.CustomRanges,. See the code example in the MapXtreme Developer
Reference Help under the MapInfo.Thematics.RangedTheme.Recompute method.

VB example:

Public Shared Sub MapInfo_Mapping_Thematics_RangedTheme(ByVal map As Map)
‘ Create a ranged theme.
Dim lyr As FeatureLayer = CType(map.Layers(0), FeatureLayer)
Dim theme As MapInfo.Mapping.Thematics.RangedTheme = New _

MapInfo.Mapping.Thematics.RangedTheme(lyr, “Pop_1990/Area(obj,_
'sq mi')”, “PopDensity”, 5,DistributionMethod.EqualCountPerRange)

‘ Add the ranged theme to the layer.
lyr.Modifiers.Append(theme)
End Sub

RangedLabelTheme

This class creates a range theme in which labels are drawn with a range style. For a more detailed
discussion of ranged themes, see the section

RangedTheme

.

When To Use a RangedLabelTheme Class

Ranged label themes are useful when you want use the labels to convey information about what you
are labeling. For example, you could use a ranged label theme when labeling city or town
populations. The label of a city with a large population would have a larger font than the label of a
town with a small population.

VB example:

Public Shared Sub MapInfo_Mapping_Thematics_RangedLabelTheme(ByVal
labelSource As MapInfo.Mapping.LabelSource, ByVal columnExpr As _

String, ByVal themealias As String)

‘ Create new ranged label theme based on the label source of a
‘ LabelLayer already in the map. It will use 5 bins of equal range.
Dim rangedLabelTheme As RangedLabelTheme = New _

RangedLabelTheme(labelSource.Table, columnExpr, themealias, 5, _
DistributionMethod.EqualCountPerRange)

‘ Add the label modifier to the label layer.
Dim labelModifier As MapInfo.Mapping.LabelModifier = _

CType(rangedLabelTheme, MapInfo.Mapping.LabelModifier)

labelSource.Modifiers.Insert(0, labelModifier)

End Sub

Advertising