14.01.2013 Views

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Maps<br />

A map (MgMap object) is created from a map definition resource. The map<br />

definition contains basic information about the map, including things like<br />

■ the coordinate system used in the map<br />

■ the initial map extents<br />

■ references to the layer definitions for layers in the map<br />

When the MgMap object is created, it is initialized with data from the map<br />

definition. As a user interacts with the map, the MgMap may change, but the<br />

map definition does not.<br />

The map is saved in the session repository so it is available to all pages in the<br />

same session. You cannot save a map in the library repository.<br />

Map creation is handled by the Viewers. When a Viewer first loads, it creates<br />

a map in the session repository. The map name is taken from the map<br />

definition name. For example, if a web layout references a map definition<br />

named Sheboygan.MapDefinition, then the Viewer will create a map named<br />

Sheboygan.Map.<br />

If your application does not use a Viewer, you can create the map and store<br />

it in the repository yourself. To do this, your page must<br />

■ Create an MgMap object.<br />

■ Initialize the MgMap object from a map definition.<br />

■ Assign a name to the MgMap object.<br />

■ Save the map in the session repository.<br />

For example, the following section of code creates an MgMap object named<br />

Sheboygan.Map, based on Sheboygan.MapDefinition.<br />

20 | Chapter 1 Introduction

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!