/// <summary> /// Create graphic object for route. /// </summary> /// <param name="route">Source route.</param> /// <returns>Graphic object for route.</returns> public static RouteGraphicObject Create(Route route) { RouteGraphicObject graphic = null; // Calculate route color. System.Drawing.Color oldColor = route.Color; Color color = Color.FromArgb(DefaultAlphaValue, oldColor.R, oldColor.G, oldColor.B); // Create route symbol. RouteLineSymbol simpleLineSymbol = new RouteLineSymbol(); graphic = new RouteGraphicObject(route); graphic.Attributes.Add(SymbologyContext.IS_LOCKED_ATTRIBUTE_NAME, route.IsLocked); graphic.Attributes.Add(SymbologyContext.FILL_ATTRIBUTE_NAME, new SolidColorBrush(color)); graphic.Symbol = simpleLineSymbol; graphic._SetPolyline(); return graphic; }
/// <summary> /// React on route property changed. /// </summary> /// <param name="sender">Ignored.</param> /// <param name="e">Route property changed event args.</param> private void _RoutePropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == Route.PropertyNameColor) { Color color = Color.FromArgb(DefaultAlphaValue, _route.Color.R, _route.Color.G, _route.Color.B); Attributes[SymbologyContext.FILL_ATTRIBUTE_NAME] = new SolidColorBrush(color); RouteLineSymbol simpleLineSymbol = new RouteLineSymbol(); Symbol = simpleLineSymbol; } else if (e.PropertyName == Route.PropertyNameIsVisible) { _SetPolyline(); } else if (e.PropertyName.Equals(Route.PropertyNameIsLocked, StringComparison.OrdinalIgnoreCase)) { Attributes[SymbologyContext.IS_LOCKED_ATTRIBUTE_NAME] = _route.IsLocked; Symbol = new RouteLineSymbol(); } }