Mapfactory, Map mapfactory – Pitney Bowes MapXtreme User Manual

Page 241

Advertising
background image

Chapter 12: Adding Mapping Capability to Your Applications

Base Mapping Classes

MapXtreme v7.1

248

Developer Guide

Example Use of MapExport

If you are using a MapControl, you must clone the map prior to exporting it, as shown in the example
below:

VB example:

Public Shared Sub MapInfo_Mapping_MapExport(ByVal mapControl1 As
MapControl)
’must clone since map is coming from mapcontrol and is linked to it via
the HWND
Dim NewMap As Map = CType(mapControl1.Map.Clone(), Map)
Dim exportObject As MapExport = New MapExport(NewMap)
exportObject.ExportSize = New MapInfo.Mapping.ExportSize(2931, 4104)
exportObject.Format = ExportFormat.Gif
exportObject.Export("C:\Temp\ExportImage.gif")
End Sub

Map

The Map class contains everything that you can put in a map. A Map object is placed in a
MapControl object for a desktop application or attached to a MapExport object for a web application.

A Map has the following properties:

Bounds

Center

Zoom

Scale

Size

Rotation

DisplayTransform

DisplayCoordSys

Each Map has a Layers collection, which holds all the layers that comprise the map (see

Layers

),

and a single Adornment collection, which contains all of the map’s adornments. Adornments include
Legends, Titles, and Scalebars (see

Legends Overview

).

MapFactory

The MapFactory class contains the objects used to create maps from Geosets, workspaces, and
lists of tables. MapFactory also functions as a container of, and tracks, the collection of all maps
created in a particular session.

Example Use of MapFactory

This example creates an empty map 300 by 300 pixels in size using the CreateEmptyMap method of
MapFactory.

' Create a new map

Advertising