/// <summary> /// Creates a new map rectangle structure with the specified location and size. /// </summary> /// <param name="location">The rectangle location.</param> /// <param name="size">The rectangle size.</param> public MapRectangle(MapPoint location, MapSize size) { this.Left = location.X; this.Top = location.Y; this.Right = location.X + size.Width; this.Bottom = location.Y - size.Height; }
/// <summary> /// Creates a new circular map marker instance. /// </summary> /// <param name="location">The marker location as longitude and latitude in degrees.</param> public MapBulletMarker(MapPoint location) : base(location) { }
/// <summary> /// Creates a new point map shape. /// </summary> /// <param name="metadata">The map metadata.</param> /// <param name="point">The map point.</param> public MapShapePoint(MapMetadata metadata, MapPoint point) : base(MapShapeType.Point, metadata) { this.point = point; }
/// <summary> /// Creates a new point map shape. /// </summary> /// <param name="point">The map point.</param> public MapShapePoint(MapPoint point) : base(MapShapeType.Point) { this.point = point; }
/// <summary> /// Creates a new map marker instance at the specified location. /// </summary> /// <param name="location">The marker location as longitude and latitude in degrees.</param> public MapMarker(MapPoint location) { this.location = location; }
/// <summary> /// Creates a new map marker instance at the default location. /// </summary> public MapMarker() { this.location = default(MapPoint); }
/// <summary> /// An event handler called when the marker coordinates have changed. /// </summary> /// <param name="oldLocation">The old coordinates.</param> /// <param name="newLocation">The new coordinates.</param> protected virtual void OnLocationChanged(MapPoint oldLocation, MapPoint newLocation) { // If the coordinates have not changed, do nothing. if (oldLocation == newLocation) return; // Raise the event. if (this.LocationChanged != null) this.LocationChanged(this, new MapMarkerChangedEventArgs(this)); }
/// <summary> /// Converts the specified map point to the float screen coordinates, depending on the current map bounds and scale. /// </summary> /// <param name="point">The map point.</param> /// <returns>The screen coordinates point.</returns> private PointF ConvertF(MapPoint point) { return new PointF( (float)((point.X - this.mapBounds.Left) * this.mapScale.Width), (float)((this.mapBounds.Top - point.Y) * this.mapScale.Height) ); }
/// <summary> /// Converts the specified map point to the integer screen coordinates, depending on the current map bounds and scale. /// </summary> /// <param name="point">The map point.</param> /// <returns>The screen coordinates point.</returns> private Point Convert(MapPoint point) { return new Point( (int)Math.Round((point.X - this.mapBounds.Left) * this.mapScale.Width), (int)Math.Round((this.mapBounds.Top - point.Y) * this.mapScale.Height) ); }