Web control architecture – Pitney Bowes MapXtreme User Manual

Page 83

Advertising
background image

Chapter 5: Web Applications, Controls, and Tools

Web Control Architecture

MapXtreme v7.1

83

Developer Guide

Web Control Architecture

The MapXtreme Web control architecture follows the ASP.NET model for creating Web applications.
The general architecture is a Model-View-Controller (MVC) design pattern, in which the web
application represents the Model, the web page (HTML, JavaScript) represents the View, and the
MapXtreme Server that responds to requests for information represents the Controller.

The user interacts with the web application through web controls and tools that capture data and
send instructions and commands to the server which processes and returns the information.

In MapXtreme, controls and tools are rendered when the web page is rendered at initialization time.
After initialization time, when a tool is used, only the map image is rendered. These JavaScript-
enabled tools are an improvement over the pre-v6.5 web controls that performed a full page
postback with every tool operation.

MapXtreme controls provide the following behaviors and functionality:

A background map is loaded via a pre-defined workspace. At design time, set the MapControl
MapAlias property to the map alias of the map defined in the preloaded workspace. At runtime,
the corresponding map is loaded into the MapControl, ready for users to interact with it using
map tools.

The first time a page is rendered, Page_Load and Page_Unload are called. Page_Load
initializes the state of the application, either to a default state for a new session, or restores state
if the session is not new. Page_Unload stores the state of any changes, in anticipation of another
request.

The StateManager is implemented in an application as a class, and an instance of that class is
put in the MapXtreme Session. SaveState and RestoreState methods are called from this object.
The SaveState and RestoreState methods are called every time a tool is used. If Manual mode is
used for state management, a StateManager class instance must be in the session.
(MapInfo.Engine.Session.State is set to Manual in your Web.config file.) For more on state
management, see

State Management

.

Error processing is done in the global_asax.cs/.vb file in the application_error event handler. See

Error Management

.

Events are handled through client-side JavaScript commands that send a request to the server.
A server-side command class does server-side processing. See

Event Handling

.

ZoomBarTool

Allows you to zoom a map to a series of preset levels between 500 and
12,500 map units.

ZoomInTool

Allows you to zoom a map by either a single click or by selecting a
rectangular area

ZoomOutTool

Allows you to draw a rectangle representing the view to zoom out of the
map.

InfoTool Sample Web
Application

An example of an InfoTool is included in the sample Web applications. It
demonstrates how to create and use a customized map tool based on
the MapXtreme Web control architecture.

Advertising