public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapBubble ?? throw new Exception("Map item must be MapBubble."); if (Location == null || Location.Length != 2) { throw new Exception("Location must be double array with 2 elements."); } mapItem.Location = MapContext.CreateCoordPoint(Location[0], Location[1]); mapItem.Argument = Argument; if (Value.HasValue) { mapItem.Value = Value.Value; } if (Size.HasValue) { mapItem.Size = Size.Value; } if (Group.HasValue) { mapItem.Group = Group.Value; } if (MarkerType.HasValue) { mapItem.MarkerType = MarkerType.Value; } }
public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapEllipse ?? throw new Exception("Map item must be MapEllipse."); if (Location == null || Location.Length != 2) { throw new Exception("Location must be double array with 2 elements."); } mapItem.Location = MapContext.CreateCoordPoint(Location[0], Location[1]); mapItem.Height = Height; mapItem.Width = Width; }
public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapPolygon ?? throw new Exception("Map item must be MapPolygon."); if (Points == null || Points.Length <= 1) { throw new Exception("Points are not properly defined."); } foreach (double[] point in Points) { if (point == null || point.Length != 2) { throw new Exception("Point is not property defined. Must be double array with 2 elements."); } mapItem.Points.Add(MapContext.CreateCoordPoint(point[0], point[1])); } if (Image != null || !string.IsNullOrWhiteSpace(ImageFile)) { if (Image != null) { mapItem.Image.Source = Image; } else if (!string.IsNullOrWhiteSpace(ImageFile)) { var imageFile = Project.Current.MapPath(ImageFile); if (string.IsNullOrWhiteSpace(imageFile) || !File.Exists(ImageFile)) { throw new Exception($"Cannot find file: {ImageFile}"); } mapItem.Image.Source = Image.FromFile(ImageFile); } if (ImageTransparency.HasValue) { mapItem.Image.Transparency = ImageTransparency.Value; } } }
public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapLine ?? throw new Exception("Map item must be MapLine."); if (Point1 == null || Point1.Length != 2) { throw new Exception("Point1 must be double array with 2 elements."); } if (Point2 == null || Point2.Length != 2) { throw new Exception("Point2 must be double array with 2 elements."); } mapItem.Point1 = MapContext.CreateCoordPoint(Point1[0], Point1[1]); mapItem.Point2 = MapContext.CreateCoordPoint(Point2[0], Point2[1]); mapItem.IsGeodesic = Geodesic; }
public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapDot ?? throw new Exception("Map item must be MapDot."); if (Location == null || Location.Length != 2) { throw new Exception("Location must be double array with 2 elements."); } mapItem.Location = MapContext.CreateCoordPoint(Location[0], Location[1]); if (Size.HasValue) { mapItem.Size = Size.Value; } if (ShapeKind.HasValue) { mapItem.ShapeKind = ShapeKind.Value; } }
public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapPolyline ?? throw new Exception("Map item must be MapPolyline."); if (Points == null || Points.Length <= 1) { throw new Exception("Points are not properly defined."); } foreach (double[] point in Points) { if (point == null || point.Length != 2) { throw new Exception("Point is not property defined. Must be double array with 2 elements."); } mapItem.Points.Add(MapContext.CreateCoordPoint(point[0], point[1])); } mapItem.IsGeodesic = Geodesic; }
public override void ConfigureMapItem(MapItem item) { base.ConfigureMapItem(item); var mapItem = item as MapPointer ?? throw new Exception("Map item must be MapPointer."); if (Location == null || Location.Length != 2) { throw new Exception("Location must be double array with 2 elements."); } mapItem.Location = MapContext.CreateCoordPoint(Location[0], Location[1]); mapItem.Text = Text; mapItem.BackgroundDrawingMode = DrawBackground ? ElementState.All : ElementState.None; var fillColor = Utils.ColorFromString(FillColor); if (fillColor != Color.Empty) { mapItem.Fill = fillColor; } var font = Utils.StringToFont(Font, out Color textColor); if (font != null) { mapItem.Font = font; } if (textColor != Color.Empty) { mapItem.TextColor = textColor; } if (Image != null) { mapItem.Image = Image; } if (ImageIndex.HasValue) { mapItem.ImageIndex = ImageIndex.Value; } if (!string.IsNullOrWhiteSpace(ImageFilename)) { var imagePath = Project.Current.MapPath(ImageFilename); if (string.IsNullOrWhiteSpace(imagePath) || !System.IO.File.Exists(imagePath)) { throw new Exception($"Cannot find image: '{imagePath}'."); } var bmp = new Bitmap(imagePath); mapItem.Image = bmp; } if (TextAlignment.HasValue) { mapItem.TextAlignment = TextAlignment.Value; } if (TextPadding.HasValue) { mapItem.TextPadding = TextPadding.Value; } if (Transparency.HasValue) { mapItem.Transparency = Transparency.Value; } }