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.

Introduction<br />

Digitizing<br />

Redlining<br />

This chapter describes digitizing (capturing the user’s clicks on the map and<br />

converting the locations to map coordinates) and redlining (drawing items<br />

such as lines or rectangles on the map in response to the user’s clicks).<br />

The Viewer API has a number of functions for digitizing user input. For an<br />

example of how these can be used, see task_pane_digitizing.php in the<br />

digitizing_features directory in the Developer <strong>Guide</strong> samples.<br />

In this example, if the user clicks the button to digitize a point<br />

<br />

the script calls the JavaScript function<br />

function DigitizePoint() {<br />

parent.parent.mapFrame.DigitizePoint(OnPointDigitized);<br />

}<br />

which in turn calls the DigitzePoint() method of the Viewer API in the map<br />

frame. It also passes the name of a callback function, OnPointDigitized, which<br />

is defined in the current script. DigizitzePoint() calls this function after it<br />

has digitized the point and passes it the digitized coordinates of the point.<br />

You can use this callback function to process the digitized coordinates as you<br />

wish. In this example, the script simply displays them in the task pane.<br />

function OnPointDigitized(point) {<br />

ShowResults("X: " + point.X + ", Y: " + point.Y);<br />

}<br />

There are three main steps involved in redlining:<br />

1 Pass the digitized coordinates from the client to the server.<br />

2 Create a temporary feature source. This will be used to draw the lines on.<br />

3 Create a layer to display that temporary feature source.<br />

90 | Chapter 6 Digitizing and Redlining

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

Saved successfully!

Ooh no, something went wrong!