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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the<br />

$layerClassName = $layer->GetFeatureClassName();<br />

$selectionString = $selection->GenerateFilter(<br />

$layer, $layerClassName);<br />

// Get the feature resource for the selected layer<br />

$layerFeatureId = $layer->GetFeature<strong>Source</strong>Id();<br />

$layerFeatureResource = new<br />

MgResourceIdentifier($layerFeatureId);<br />

// Apply the filter to the feature resource for the<br />

// selected layer. This returns<br />

// an MgFeatureReader of all the selected features.<br />

$queryOptions->SetFilter($selectionString);<br />

$featureReader = $featureService->SelectFeatures(<br />

$layerFeatureResource, $layerClassName, $queryOptions);<br />

// Process each item in the MgFeatureReader, displaying<br />

// owner name and address<br />

while ($featureReader->ReadNext())<br />

{<br />

$val = $featureReader->GetString('NAME') . ', ' .<br />

$featureReader->GetString('RPROPAD');<br />

echo $val . '';<br />

}<br />

}<br />

}<br />

}<br />

else<br />

echo 'No selected layers';<br />

Example: Listing Selected Parcels (DWF Viewer)<br />

The steps for listing the selected parcels for the DWF Viewer are nearly the<br />

same as for the AJAX Viewer. The major difference is you must pass the<br />

selection information from the Viewer to your page.<br />

One method to do this is to create a JavaScript function, then call this function<br />

from the Viewer using an Invoke Script command. In an HTML page that<br />

includes an embedded Viewer, add the following JavaScript function:<br />

Working With the Active Selection | 49

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

Saved successfully!

Ooh no, something went wrong!