Hello Vinh,
Ok, let me explain the code more detailed.
List<string> featureIds = new List<string>();
featureIds.Add("15");
featureIds.Add("24");
featureIds.Add("60");
worldLayer.Open();
Collection<Feature> features = worldLayer.QueryTools.GetFeaturesByIds(featureIds, new string[] { "CNTRY_NAME" });
worldLayer.Close();
foreach (Feature feature in features)
{
highlightLayer.InternalFeatures.Add(feature.Id, feature);
}
This part just randomly pick up three features and added them into highlightLayer, so you can just choose any features you want, the id is the feature record number, so you can use
worldLayer.FeatureSource.GetCount();
to know how many feature you have then choose any number inside this range.
And for the return column value "CNTRY_NAME", it's not used in this sample, so you can choose return
Collection<Feature> features = worldLayer.QueryTools.GetFeaturesByIds(featureIds, ReturningColumnsType.AllColumns );
or
Collection<Feature> features = worldLayer.QueryTools.GetFeaturesByIds(featureIds, ReturningColumnsType.NoColumns );
or any columns you may use.
Then when the button click, we will find the highlightLayer and get it's boundingbox depends on the features you added into it, zoom to that boundingbox, that's all this sample want to do.
LayerOverlay dynamicOverlay = (LayerOverlay)Map1.CustomOverlays["DynamicOverlay"];
InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["HighlightLayer"];
if (highlightLayer.InternalFeatures.Count > 0)
{
highlightLayer.Open();
Map1.CurrentExtent = highlightLayer.GetBoundingBox();
highlightLayer.Close();
}
Please feel free to let me know your queries.
Regards,
Gary