/// <summary> /// Updates the specified style to a specified overlay. /// </summary> private static void UpdateCustomLabelingStyle(LayerOverlay overlay, Dictionary <string, string> styles) { float minSize = 0, maxSize = 0; if (float.TryParse(styles["minSize"], out minSize) && float.TryParse(styles["maxSize"], out maxSize)) { foreach (ShapeFileFeatureLayer item in overlay.Layers) { CustomTextStyle customLabelStyle = item.ZoomLevelSet.ZoomLevel10.DefaultTextStyle as CustomTextStyle; customLabelStyle.MinFontSize = minSize; customLabelStyle.MaxFontSize = maxSize; } } }
/// <summary> /// Gets the labeling style applied to a specified overlay with customized labeling style. /// </summary> public static Dictionary <string, object> GetCustomLabelingStyle(LayerOverlay overlay) { Dictionary <string, object> styles = new Dictionary <string, object>(); ShapeFileFeatureLayer layer = overlay.Layers[0] as ShapeFileFeatureLayer; CustomTextStyle customLabelStyle = layer.ZoomLevelSet.ZoomLevel10.DefaultTextStyle as CustomTextStyle; if (customLabelStyle != null) { styles.Add("minSize", customLabelStyle.MinFontSize.ToString()); styles.Add("maxSize", customLabelStyle.MaxFontSize.ToString()); } return(styles); }