Pitney Bowes MapXtreme User Manual

Page 212

Advertising
background image

Chapter 10: Creating Expressions

Expression Examples

MapXtreme v7.1

219

Developer Guide

MapInfo.Engine.Session.Current.Catalog.Search("uscty_1k", si)

' Set the map view to show search results

MapInfo.Engine.Session.Current.MapFactory(0).SetView(fc.Envelope)

' Set the view of the first map.

' Add results to selection.
MapInfo.Engine.Session.Current.Selections.DefaultSelection.Add(fc)
End Sub

For more information on the Feature class and search methods, see

Features and Feature

Collections

.

Thematic Expression Example

A pie theme is an object theme that draws a pie chart based on the numeric value of the theme's
expression. The expression for the theme is made up of three columns: Pop_Native",
"Pop_Asian","Pop_Other".

VB example:

Public Shared Sub MapInfo_Mapping_Thematics_PieTheme(ByVal _

map As Map)

' Load a map based on one table

map.Load(New MapTableLoader("world.tab"))
Dim lyr As FeatureLayer = CType(map.Layers("world"), FeatureLayer)

' Create a new pie theme

Dim pieTheme As MapInfo.Mapping.Thematics.PieTheme = New _

MapInfo.Mapping.Thematics.PieTheme(map, lyr.Table, "Pop_Native", _
"Pop_Asian", "Pop_Other")

' Create an object theme layer based on that pie theme

Dim thmLayer As ObjectThemeLayer = New ObjectThemeLayer("World _

Pop Growth Rate", Nothing, pieTheme)

'Add object theme to the map's layer collection.

map.Layers.Add(thmLayer)

End Sub

For more information on themes, see

Chapter 14: Using Themes and Legends

.

Label Expression Example using Date and Time

Expressions are properties of a label modifier which you use to modify the default properties used to
make a label. The expression in the code example says to display the label in this form:
Date/Time: <date and time>.

VB example:

Public Shared Sub MapInfo_Mapping_OverrideLabelModifier(ByVal _

modifier As OverrideLabelModifier)

Advertising