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.

For example, see task_pane_redlining.php in the digitizing_features<br />

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

Passing Coordinates<br />

The digitizing functions in the Viewer API provide us with the digitized<br />

coordinates on the client, but we usually need to pass them to a server side<br />

script. This can be done by having the callback function fill in the fields of a<br />

hidden form, and then submit the form. The form then passes the variables<br />

to a server-side script. For example, the callback function could be:<br />

function OnLineDigitized(line) {<br />

// Send the Javascript variables to 'draw_line.php',<br />

// via the hidden form defined below<br />

document.getElementById("x0").value = line.Point(0).X;<br />

document.getElementById("y0").value = line.Point(0).Y;<br />

document.getElementById("x1").value = line.Point(1).X;<br />

document.getElementById("y1").value = line.Point(1).Y;<br />

var sessionId = "";<br />

document.getElementById("session_id").value = sessionId;<br />

}<br />

document.myform.submit();<br />

That function fills out and submits this form:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Passing Coordinates | 91

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

Saved successfully!

Ooh no, something went wrong!