[mapguide-users] How to debug layer selection troubles?
Nico Alberti
nico at langhirano.it
Mon Jul 23 11:22:26 EDT 2007
Hi all,
I am tweaking with the Ajax mapviewer code, trying to insert on the
Task Area, some forms from whom the user can select features from the
layers in the map.
While I was able to do this with a polyline, I am not able to do the
same with a polygon layer. As you can imagine the code is almost
identical, but in the latter, no feature is selected.
I would appreciate that someone would look at my code, but most of all
I would like to know how do you deal with script debugging in the
hidden scriptFrame. How do you usually debug scripts in that frame?
However here is my code. Thanks for any help you will provide and
sorry form my bad English.
--------
<?php
include '../Constants.php';
try
{
$queryOptions = new MgFeatureQueryOptions();
$queryOptions->SetFilter("MACROBACIN='" . $_POST['NomeBacino'] . "'");
$mgSessionId=$_POST['SESSION'];
$configFilePath="../../webconfig.ini";
MgInitializeWebTier ($configFilePath);
$userInfo = new MgUserInformation($mgSessionId);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);
$resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
$featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);
$baciniResId = new
MgResourceIdentifier("Library://BPMS/dati/Data/bacini.FeatureSource");
$featureReader = $featureService->SelectFeatures($baciniResId,
"bacini", $queryOptions);
$mapName=urlencode('Mappa');
$map = new MgMap();
$map->Open($resourceService, $mapName);
$layer = $map->GetLayers()->GetItem("bacini");
$selection = new MgSelection($map);
$selection->AddFeatures($layer, $featureReader, 0);
$selectionXml = $selection->ToXml();
} catch(MgException $e) {
echo $e->GetMessage();
echo $e->GetDetails();
}
?>
<script language="javascript">
function OnPageLoad()
{
selectionXml = '<?php echo $selectionXml; ?>';
parent.SetSelectionXML(selectionXml);
parent.ExecuteCommand(9); //Zoom to Layer
}
</script>
<body onLoad="OnPageLoad()">
</body>
</html>
--------
--
Ciao
Nico
More information about the mapguide-users
mailing list