I am trying to display annotations for single features. I know it is possible to display annotations for layers, and for that entire map, but I would like to display them based on a SINGLE selected feature. example:-
I have a layer called A that is visible on the map, so all the features in it are visible. now I select a feature, and want to display the annotation for that paricular feature not the whole layer, how is this possible ? in my code I am doing this but for the entire layer, but I want it for a single feature any ideas ?
here is my code which is a method that displays annotations for STRUCTURE features
public static void ToggleXyLabelVisibility(IApplication application,ISchematicLayer layer, ISchematicFeature slctdFtr =null) { var doc = application.Document as IMxDocument; if (doc != null) { // display annotation for the entire layer if no features are selected if (slctdFtr == null) { var compLayer = layer as ICompositeLayer; if (compLayer != null) { for (int i = 0; i < compLayer.Count; i++) { var geoflay = compLayer.Layer as IGeoFeatureLayer; if (geoflay != null) { for (int j = 0; j < geoflay.AnnotationProperties.Count; j++) { var annotationProperties = geoflay.AnnotationProperties; IElementCollection col1; IElementCollection col2; IAnnotateLayerProperties properties; annotationProperties.QueryItem(j, out properties, out col1, out col2); if (string.Equals(properties.Class, Locationlabel, StringComparison.CurrentCultureIgnoreCase)) { properties.DisplayAnnotation = !properties.DisplayAnnotation; } } } } } } // if features are selected, then display it for those selected features only else { // CODE GOES HERE WHICH I CANT FIGURE OUT HOW TO DO } doc.ActiveView.Refresh(); } }
أكثر...
I have a layer called A that is visible on the map, so all the features in it are visible. now I select a feature, and want to display the annotation for that paricular feature not the whole layer, how is this possible ? in my code I am doing this but for the entire layer, but I want it for a single feature any ideas ?
here is my code which is a method that displays annotations for STRUCTURE features
public static void ToggleXyLabelVisibility(IApplication application,ISchematicLayer layer, ISchematicFeature slctdFtr =null) { var doc = application.Document as IMxDocument; if (doc != null) { // display annotation for the entire layer if no features are selected if (slctdFtr == null) { var compLayer = layer as ICompositeLayer; if (compLayer != null) { for (int i = 0; i < compLayer.Count; i++) { var geoflay = compLayer.Layer as IGeoFeatureLayer; if (geoflay != null) { for (int j = 0; j < geoflay.AnnotationProperties.Count; j++) { var annotationProperties = geoflay.AnnotationProperties; IElementCollection col1; IElementCollection col2; IAnnotateLayerProperties properties; annotationProperties.QueryItem(j, out properties, out col1, out col2); if (string.Equals(properties.Class, Locationlabel, StringComparison.CurrentCultureIgnoreCase)) { properties.DisplayAnnotation = !properties.DisplayAnnotation; } } } } } } // if features are selected, then display it for those selected features only else { // CODE GOES HERE WHICH I CANT FIGURE OUT HOW TO DO } doc.ActiveView.Refresh(); } }
أكثر...