/// <summary> /// Updates the marker shape. /// </summary> private void UpdateMarkerShape() { if (this.Marker.Shape != null) { ((AbstractMarker)this.Marker.Shape).OnPositionChanged -= Marker_OnPositionChanged; ((AbstractMarker)this.Marker.Shape).OnSelectionChanged -= Marker_OnSelectionChanged; this.Marker.Shape = null; } AbstractMarker marker = null; // Reference Transmitter if (this.RFDevice.Id == 0) { marker = new CircleMarker(this.mcMapControl, this.Marker, GetToolTip()); //shape.OnPositionChanged += Shape_OnPositionChanged; //this.Marker.Shape = shape; //return; } // Receiver if (this.RFDevice.Id < 0) { marker = new RectangleMarker(this.mcMapControl, this.Marker, GetToolTip()); //shape.OnPositionChanged += Shape_OnPositionChanged; //this.Marker.Shape = shape; //return; } // Last but not least all other are transmitters ... if (this.RFDevice.Id > 0) { marker = new TriangleMarker(this.mcMapControl, this.Marker, GetToolTip()); //shape.OnPositionChanged += Shape_OnPositionChanged; //this.Marker.Shape = shape; } #if DEBUG if (this.RFDevice.Id == 42) { marker = new DiamondMarker(this.mcMapControl, this.Marker, GetToolTip()); } #endif marker.OnPositionChanged += Marker_OnPositionChanged; marker.OnSelectionChanged += Marker_OnSelectionChanged; this.Marker.Shape = marker; // Das können wir direkt mal aktualisieren da es ja noch nicht gesetzt wurde ... UpdateYaw(); UpdatePitch(); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { int markerStyle, markerSize; bool shouldApplyBorderColor; Color markerColor; Int32.TryParse(values[0].ToString(), out markerStyle); Int32.TryParse(values[1].ToString(), out markerSize); bool.TryParse(values[2].ToString(), out shouldApplyBorderColor); var color = (Colour)values[3]; markerColor = Color.FromRgb(color.R, color.G, color.B); if (markerStyle == 0) return null; IPointMarker marker = null; switch (markerStyle) { case 1: marker = new SquarePointMarker(); break; case 2: marker = new DiamondMarker(); break; case 3: marker = new TriangleMarker(); break; case 4: marker = new EllipsePointMarker(); break; case 5: marker = new RightTriangleMarker(); break; case 6: marker = new LeftTriangleMarker(); break; } if (marker != null) { marker.Height = (markerSize + 3) * 2; marker.Width = (markerSize + 3) * 2; marker.Fill = markerColor; marker.Stroke = shouldApplyBorderColor ? Colors.Black : Colors.Transparent; marker.StrokeThickness = shouldApplyBorderColor ? 1 : 0; return marker; } return null; }