Opening an mws: resolveresource(), Saving an mws: getresourcename(), Registering your implementation with mapxtreme – Pitney Bowes MapXtreme User Manual

Page 202: Setting preferences, Selection class

Advertising
background image

Chapter 9: Working with Core MapXtreme Classes

Selection Class

MapXtreme v7.1

209

Developer Guide

Opening an MWS: ResolveResource()

On opening and parsing an MWS containing named resources, the ResolveResource() function
returns the xmlNode corresponding to the name and type of the named resource.

For example, when parsing a named style for a WMS, you would pass NamedResourceType.Style
and XmlNode in the form of a string. ResourceResolver parses the parameters and returns a named
resource node in the form of an XmlNode.

Saving an MWS: GetResourceName()

When the MWS file is being saved, file parsed in memory will contain all the expanded nodes. To
write back the named Resources into the MWS file, you need to implement all flavors of
GetResourceName which takes objects of Table, Map, Style, and IMapLayer. These functions will
return the NamedResource node for the corresponding object. The saved MWS file contain the
entries of the named resources.

Registering Your Implementation with MapXtreme

To register your implementation of INamedResourceResolver with MapXtreme, you must set the
Session.Current.NamedResourceResolver property. Now MapXtreme will refer to your
implementation object when opening and saving MWS files.

Setting Preferences

If you only want to save a specific type of name resource and leave the others as is, you must set a
preference using PreferenceForNamedResource property available on the WorkspacePersistence
object. By default it is set to NameResourcePreference.All. You can set other values as well such as
NameResourcePreference.PreferNamedTables to save only Tables as named resources. To store
more than one resource as named resources use the OR operator. For example:

NameResourcePreference.PreferNamedTables |
NameResourcePreference.PreferNamedLayers.

For more information, see INamedResourceResolver in the Developer Reference.

Selection Class

A Selection is a collection of IResultSetFeatureCollection objects that holds lists of features. These
features are a subset of rows in a table. They could be property boundaries, street networks, cell
tower locations, or natural features such as rivers. They are typically drawn with special highlighting
when they display in a Map. There can only be one IResultSetFeatureCollection for a given table in
a Selection.

There can be more than one Selection in a ISession. The Selections collection contains all of the
selections in the application. There is always at least one selection, known as the DefaultSelection.

Advertising