[mapguide-users] select objects on multiple layers
Willem Schwarte
willem at giskit.nl
Tue Jun 6 10:06:56 EDT 2006
Ok, sorry, I think I have got it... changed code to this:
$filter = "CRE03 = '00000030UP-BBW' AND
(HYPERLINK = 's199' OR HYPERLINK = 's132')";
$opts = new MgFeatureQueryOptions();
$opts->SetFilter($filter);
$sel = new MgSelection($map);
$layers = $map->GetLayers();
for ($i = 0; $i < $layers->GetCount(); $i++)
{
$firstLoop = 1;
$layer = $layers->GetItem($i);
if ($layer)
{
$featureClassName =
$layer->GetFeatureClassName();
$srcId = new
MgResourceIdentifier($layer->GetFeatureSourceId());
$features =
$featureService->SelectFeatures($srcId, $featureClassName, $opts);
$hasResult =
$features->ReadNext();
if($hasResult)
{
do
{
$sel->AddFeatureIdInt32($layer, $featureClassName,
$features->GetInt32('FeatId'));
}
while($features->ReadNext());
}else
{
echo "no results";
}
} // endif
} // next $i
$selText = StrEscape($sel->ToXml(), true);
?>
<a href="#" onClick="CellClicked('<?=$selText;?>');">Click to select
objects</a>
<?
________________________________
Van: Willem Schwarte [mailto:willem at giskit.nl]
Verzonden: dinsdag 6 juni 2006 15:53
Aan: users at mapguide.osgeo.org
Onderwerp: [mapguide-users] select objects on multiple layers
Hi ,
I now use this code to generate a link with xml to select objects found
on the layers in a map:
$filter = "CRE03 = '00000030UP-BBW' AND
(HYPERLINK = 's199' OR HYPERLINK = 's132')";
$opts = new MgFeatureQueryOptions();
$opts->SetFilter($filter);
$layers = $map->GetLayers();
for ($i = 0; $i < $layers->GetCount(); $i++)
{
$firstLoop = 1;
$layer = $layers->GetItem($i);
if ($layer)
{
$featureClassName =
$layer->GetFeatureClassName();
$srcId = new
MgResourceIdentifier($layer->GetFeatureSourceId());
$features =
$featureService->SelectFeatures($srcId, $featureClassName, $opts);
$hasResult =
$features->ReadNext();
if($hasResult)
{
$sel = new
MgSelection($map);
do
{
$sel->AddFeatureIdInt32($layer, $featureClassName,
$features->GetInt32('FeatId'));
}
while($features->ReadNext());
$selText = StrEscape($sel->ToXml(), true);
?>
<a href="#" onClick="CellClicked('<?=$selText;?>');">Click to select
objects</a>
<?
}else
{
echo "no results";
}
} // endif
} // next $i
Now I will e.g. get 2 links. What I really want to achieve is that 1 XML
string is created so if I click on the link, all objects on all layers
will be selected.
Is this at all possible?
Willem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20060606/b4eca133/attachment.html
More information about the Mapguide-users
mailing list