Dear all:
I wrote a function like this :
internal static void SelectFeatureToScreen(string layerName, string
filter)
{
AcMapMap currentMap = AcMapMap.GetCurrentMap();
AcMapFeatureService featureService =
AcMapServiceFactory.GetService(MgServiceType.FeatureService) as
AcMapFeatureService;
MgLayerCollection layers = currentMap.GetLayers();
AcMapLayer layer = layers.GetItem(layerName) as AcMapLayer;
MgFeatureQueryOptions query = new MgFeatureQueryOptions();
query.SetFilter(filter);
MgFeatureReader featureReader = layer.SelectFeatures(query);
MgSelectionBase selection = new MgSelectionBase(currentMap);
selection.AddFeatures(layer, featureReader, 0);
currentMap.SetFeatureSelection(selection, true);
currentMap.HilightFeature(HighlightMode.Glow, selection);
}
after execute this code, I expected to see some feature highlighted on
screen, but none.
I traced and found that featureReader indeed had rows I query,
but seemed not converted to selection.
Can anyone give me a clue to solve this problem ? thx a lot...
yapin 2007/07/25