Gmlfeaturecollection, Workspacepersistence and workspaceloader – Pitney Bowes MapXtreme User Manual

Page 477

Advertising
background image

Appendix B: Customizing MapXtreme

Customizable Classes

MapXtreme v7.1

484

Developer Guide

StyleRepository styleRepository = Session.Current.StyleRepository;
LineStyleRepository lineStyleRepository =

styleRepository.LineStyleRepository;

lineStyleRepository.Reload("C:\MyData\MyLineStyles.PEN");

VectorPointStyleRepository

The VectorPointStyleRepository class is used to iterate through all current vector symbols and
allows you to add new vector symbols from a specified file. In order to create your own version of the
symbol set, you need to use the Symbol Maker MapBasic application. Once your vector symbol set
is changed you use the Reload() method to read the symbol set into the repository. The following
sample code demonstrates reloading the collection of SimpleVectorPointStyles from an FNT file in
the “C:\MyData” directory.

using MapInfo.Styles;

StyleRepository styleRepository = Session.Current.StyleRepository;
VectorPointStyleRepository vecPointStyleRepository =

styleRepository.VectorPointStyleRepository;

vecPointStyleRepository.Reload("C:\MyData\MyVectorSymbols.FNT");

GmlFeatureCollection

The GmlFeatureCollection class is used to import features from an XML file. You can add Features
to a map by creating a FeatureCollection object and constructing FeatureObjects to add to it. Then
you can insert the FeatureCollection into a table.

WorkSpacePersistence and WorkSpaceLoader

The WorkSpaceLoader can be subclassed so that the persistence file being used can hold extra
information saved from the application. The developer can have the application write any information
that they would like saved into the persistence XML file by adding it under the UserData node. When
the WorkSpacePersistence class writes the persistence file and there is some content in this node,
the content is automatically written to the file. The WorkSpaceLoader class or some derived version
of the class reads in all the data including what is a child of the UserData node. The following code
shows an example of this.

using MapInfo.Persistence;

class myWorkSpaceLoader : WorkSpaceLoader
{

public myWorkSpaceLoader(string fileName): base(fileName)
{

// empty

}
override public void Load()
{

// called parent Load() method.
base.Load();

Advertising