Using the mapxtreme web controls – Pitney Bowes MapXtreme User Manual

Page 86

Advertising
background image

Chapter 5: Web Applications, Controls, and Tools

Using the MapXtreme Web Controls

MapXtreme v7.1

86

Developer Guide

2. The tool’s ClientInteraction property called RectInteraction collects the screen coordinates that

define the rectangle. RectInteraction is defined in Interaction.js.

3. The tool’s ClientCommand property MapCommand creates a URL request and assigns it to the

MapControl’s image.src property. ClientCommand is defined in Command.js. The URL request
looks like:
MapController.ashx?Command=Zoom&Width=300&Height=300&ZoomLevel=1200&Po
ints=1,50,100&MapAlias=Map1

4. The URL request is sent to the server.

5. The MapController receives the request and invokes the MapControlModel. The MapController

derives from System.Web.IHttpHandler.

6. The MapControlModel parses the URL request and invokes the ZoomInCommand class.

7. The ZoomInCommand gets the map from the MapFactory and carries out the operation to zoom

in on the map. The map image is updated to reflect the new view.

8. The map image is exported to an image, and written to the HTTP response as a stream, and

returned to the client.

Using the MapXtreme Web Controls

To use the MapXtreme Web controls in your web application:

1. Do one of the following:

a. Create a MapXtreme web application from Visual Studio File > New Project and choose the

MapXtreme Web Application template. The MapControl, LayerControl and map navigation
tools are built in.

b. Open one of the sample web applications and modify it for your needs.
c. Drag and drop what you need onto the web form from the MapXtreme Web 7.x.x toolbox in

Visual Studio.

d. Create a MapXtreme web application from Visual Studio File > New Project and choose the

generic ASP.NET Web Application template

1

.

2. In your application’s Web.config file, specify the path and name of a workspace that contains

map layers for pre-loading into the MapControl. This is necessary regardless of which choice
you made in step1.
The Web.config file for the template and samples contains a path to the default location of the
installed sample data, as shown below:

<configuration>

<appSettings>

1.

In this situation, you will notice that the MapXtreme web controls and tools display red X’s in the Designer
instead of their icons. To display the icons properly, copy the MapXtremeWebResources folder from one of
the MapXtreme sample applications and paste it into your project where your Web.config and default.aspx
files are located. Close and re-open the web page to see the icons. To avoid this manual step. choose
option "a" instead.

Advertising