Formatting a legend – Pitney Bowes MapXtreme User Manual

Page 286

Advertising
background image

Chapter 14: Using Themes and Legends

Legends Overview

MapXtreme v7.1

293

Developer Guide

When to Use a Cartographic Legend

A cartographic legend is very useful whenever you have a map that contains objects that represent
items on the map. For example, a map with landmarks requires a cartographic legend. Hospitals,
schools, churches, and airports would each be represented by a different symbol. The cartographic
legend provides a visual explanation of the different types of landmarks that are represented on the
map.

See the MapInfo.Mapping.Legends.Legend class in the Developer Reference for a code example
that demonstrates how to create a cartographic legend.

Formatting a Legend

The MapInfo.Mapping.Legends.LegendFormat class contains properties that control how frames
within a legend are drawn. You can control display properties such as alignment, the number of
legend frames per row or column, spacing between frames, and whether the legend size and frame
positions should be automatically adjusted.

The LegendFormat.FrameAlignment property is used in conjunction with the FramesPerRow for
horizontal alignment and FramesPerColumn for vertical alignment.

For example, if your legend contains 10 frames, and you set the FrameAlignment to Horizontal and
the FramesPerRow to 5, the legend will display two rows of frames with five frames in each row. If
you had 10 frames per row, the 10 frames would display in a single row 10 frames wide.

Similar behavior happens with vertical alignment. If you have 10 frames and you set the
FrameAlignment to Vertical and the FramesPerColumn to 5, you will end up with 5 rows of 2 frames
(5 rows in 2 columns). The frames were aligned vertically up to 5 frames per column. When
FramesPerColumn is set to 10, the legend would contain 10 rows of 1 frame each (10 frames per
column).

The default setting for FramesPerRow and FramesPerColumn is 0. The value used is the current
number of frames in the row or column as indicated by LegendFrameRows.Count or
LegendFrameColumns.Count properties.

Advertising