Exemplo n.º 1
0
        public BitmapImage GetTile(GeometryInfo GeoInfo, int x, int y, int zoom)
            {
            String key = zoom.ToString() + ',' + x.ToString() + ',' + y.ToString();
            if (PreLoadedTiles.ContainsKey(key))
                {
                // We already have the tile in our cache...
                Object TileContent = PreLoadedTiles [key];
                if ((TileContent == null)
                    || (TileContent.GetType () != typeof (BitmapImage)))
                    {
                    BitmapImage Tile = new BitmapImage();
                    MemoryStream TileStream = new MemoryStream((Byte[])TileContent);
                    Tile.BeginInit ();
                    Tile.StreamSource = (MemoryStream)TileStream;
                    Tile.EndInit ();
                    lock (PreLoadedTiles)
                        {
                        PreLoadedTiles [key] = Tile;
                        }
                    }
                return (BitmapImage) (PreLoadedTiles[key]);
                }
            TileDownLoadDescription DownLoadDescription = new TileDownLoadDescription ()
                {GeoInfo = GeoInfo, Key = key};
            if (GeoInfo.RunTileLoadingSynchron)
                {
                Download(DownLoadDescription);
                if (PreLoadedTiles.ContainsKey(key))
                    {
                    // We already have the tile in our cache...
                    Object TileContent = PreLoadedTiles[key];
                    if (TileContent.GetType() != typeof(BitmapImage))
                        {
                        BitmapImage Tile = new BitmapImage();
                        MemoryStream TileStream = new MemoryStream((Byte[])TileContent);
                        Tile.BeginInit();
                        Tile.StreamSource = (MemoryStream)TileStream;
                        Tile.EndInit();
                        lock (PreLoadedTiles)
                            {
                            PreLoadedTiles[key] = Tile;
                            }
                        }
                    return (BitmapImage)(PreLoadedTiles[key]);
                    }
                return null;
                }
            BackgroundWorker DownloadThread = new BackgroundWorker ();
            DownloadThread.RunWorkerCompleted += DownloadThread_RunWorkerCompleted;
            DownloadThread.DoWork += DownloadThread_DoWork;
            DownloadThread.RunWorkerAsync(DownLoadDescription);
            return null;
				
            }
Exemplo n.º 2
0
 /// <summary>
 /// Get the view position in the client area of the given latitude and
 /// longitude.
 /// </summary>
 /// <param name="Lat">The latitude</param>
 /// <param name="Lon">The longitude</param>
 /// <param name="x">The X position</param>
 /// <param name="y">The Y position</param>
 public static void LatLonToClientPos(GeometryInfo GeoInfo, double Lat, double Lon, out int x, out int y)
     {
     //CalcGeometry();
     x = (int) (GeoInfo.Width/2 + (int) ((Lon - GeoInfo.Lon)/GeoInfo.Scale));
     double ty = ((1.0 - Math.Log(Math.Tan(Lat*Math.PI/180.0) +
                                  1.0/Math.Cos(Lat*Math.PI/180.0))/Math.PI)/2.0*
                  Math.Pow(2.0, GeoInfo.ViewTileZoom));
     y = (int) (GeoInfo.ViewYTileYPos + (int) ((ty - GeoInfo.CentreTileNumY)*GeoInfo.ViewTileSizePixels));
     }
Exemplo n.º 3
0
        /// <summary>
        /// Get the latitude and longitude of a given position in the client
        /// area.
        /// </summary>
        /// <param name="x">The X position</param>
        /// <param name="y">The Y position</param>
        /// <param name="Lat">The latitude</param>
        /// <param name="Lon">The longitude</param>
        public static void ClientPosToLatLon(GeometryInfo GeoInfo, int x, int y, out double Lat, out double Lon)
            {
            //			CalcGeometry();

            if (GeoInfo.ViewTileSizePixels == 0)
                {
                // We can't calculate it!
                Lat = Lon = 0;
                return;
                }

            Lon = GeoInfo.Lon + GeoInfo.Scale*(x - GeoInfo.Width/2);

            double offset = (double) (y - GeoInfo.ViewYTileYPos)/GeoInfo.ViewTileSizePixels;
            double ty = GeoInfo.CentreTileNumY + offset;
            double n = Math.PI - ((2.0*Math.PI*ty)/Math.Pow(2.0, GeoInfo.ViewTileZoom));
            Lat = (180.0/Math.PI*Math.Atan(Math.Sinh(n)));
            }
Exemplo n.º 4
0
 /// <summary>
 /// Get the Lat/Lon bounds of the current display.
 /// </summary>
 /// <param name="Lat1"></param>
 /// <param name="Lon1"></param>
 /// <param name="Lat2"></param>
 /// <param name="Lon2"></param>
 public static void GetDisplayBounds(GeometryInfo GeoInfo, out double Lat1, out double Lon1, out double Lat2,
     out double Lon2)
     {
     ClientPosToLatLon(GeoInfo, 0, 0, out Lat1, out Lon1);
     ClientPosToLatLon(GeoInfo, (int) (GeoInfo.Width - 1), (int) (GeoInfo.Height - 1), out Lat2, out Lon2);
     }
Exemplo n.º 5
0
 public void FillDrawingHighLightning(GeometryInfo GeoInfo, DrawingContext Context, EntityInfo mHighlightedEntity)
     {
     try
         {
         // Highlight something if necessary...
         if (mHighlightedEntity != null)
             {
             Pen pen;
             int mx, my;
             switch (mHighlightedEntity.Type)
                 {
                     case EntityType.TypeIsMarker:
                         pen = new Pen(Brushes.Blue, 3);
                         LatLonToClientPos(GeoInfo, mHighlightedEntity.Marker.Lat, mHighlightedEntity.Marker.Lon,
                             out mx, out my);
                         Context.DrawEllipse(null, pen, new Point(mx - 6, my - 6), 13, 13);
                         break;
                     case EntityType.TypeIsTrackPoint:
                         pen = new Pen(Brushes.Orange, 2);
                         foreach (TrackPoint tp in mHighlightedEntity.DrawAbleTrack.Points)
                             {
                             if (tp.Time == mHighlightedEntity.Time)
                                 {
                                 LatLonToClientPos(GeoInfo, tp.Lat, tp.Lon, out mx, out my);
                                 Context.DrawEllipse(null, pen, new Point(mx - 4, my - 4), 9, 9);
                                 }
                             }
                         break;
                 }
             }
         }
     catch (Exception Excp)
         {
         MessageBox.Show("Drawing Exception: " + Excp.ToString());
         }
     }
Exemplo n.º 6
0
 public void DrawROIRectangle(GeometryInfo GeoInfo, DrawingContext Context, Rect RectToDraw)
     {
     Pen pen = new Pen(Brushes.Blue, 4);
     Context.DrawRectangle(null, pen, RectToDraw);
     }
Exemplo n.º 7
0
 public void FillDrawingTracks(GeometryInfo GeoInfo, DrawingContext Context, List<DrawAbleTrack> mTracks)
     {
     ThicknessConverter TCV = new ThicknessConverter();
     try
         {
         // Draw tracks...
         foreach (DrawAbleTrack t in mTracks)
             {
             int px = 0, py = 0; // Initialised only to pacify the compiler
             int tx, ty;
             bool first = true;
             foreach (TrackPoint p in t.Points)
                 {
                 LatLonToClientPos(GeoInfo, p.Lat, p.Lon, out tx, out ty);
                 if (!first)
                     {
                     System.Windows.Media.Pen ActuallyUsed = new System.Windows.Media.Pen
                         (t.PenToUse.Brush, GeoInfo.Width*t.PenToUse.Thickness/1500)
                         {
                         StartLineCap = PenLineCap.Round,
                         EndLineCap = PenLineCap.Round
                         };
                     Context.DrawLine(ActuallyUsed, new Point(px, py),
                         new Point(tx, ty));
                     }
                 px = tx;
                 py = ty;
                 first = false;
                 }
             }
         }
     catch (Exception Excp)
         {
         MessageBox.Show("Drawing Tracks Exception: " + Excp.ToString());
         }
     }
Exemplo n.º 8
0
 private void mTileManager_NewDataAvailable(GeometryInfo GeoInfo)
     {
     GeoInfo.RedrawRequired = true;
     if (NewDataAvailable != null)
         NewDataAvailable(GeoInfo);
     }
Exemplo n.º 9
0
 public BitmapSource CreateOSMPictureWithOverLoadsViaGeometryInfo(GeometryInfo GeoInfo,
     List<DrawAbleTrack> TracksToOverlay = null,
     List<Marker> MarkersToOverlay = null, DrawMarkerEvent DrawMarkerHandler = null)
     {
     GeoInfo.RunTileLoadingSynchron = true;
     DrawingVisual DrawingBoard = new DrawingVisual();
     Rect DrawingRect = new Rect(0, 0, GeoInfo.Width, GeoInfo.Height);
     DrawingContext Context = DrawingBoard.RenderOpen();
     FillDrawingBackGound(GeoInfo, Context);
     if (TracksToOverlay != null)
         FillDrawingTracks(GeoInfo, Context, TracksToOverlay);
     if (MarkersToOverlay != null)
         {
         MarkersToOverlay = OrderMarkerAccordingToTypeToDraw(MarkersToOverlay);
         FillDrawingMarker(GeoInfo, Context, MarkersToOverlay, DrawMarkerHandler);
         }
     Context.Close();
     RenderTargetBitmap DrawingBitmap = new RenderTargetBitmap
         ((int) (GeoInfo.Width*Basics.XDPIFactor), (int) (GeoInfo.Height*Basics.YDPIFactor),
             Basics.XDPIFactor*96, Basics.YDPIFactor*96, PixelFormats.Pbgra32);
     DrawingBitmap.Render(DrawingBoard);
     //Rect OriginalRect = DrawingBoard.Drawing.Bounds;
     //ImageBrush IMBrush = new ImageBrush();
     return (BitmapSource) BitmapFrame.Create(DrawingBitmap);
     }
Exemplo n.º 10
0
 public BitmapSource CreateOSMPictureWithOverLoadsViaMeasurement
     (double WestLonToDrawInDegree, double NorthLatToDrawInDegree,
         double EastLonToDrawInDegree, double SouthLatToDrawInDegree,
         int Width, int Height, GraphicSize RequestedGraphicSize)
     {
     GeometryInfo GeoInfo = new GeometryInfo();
     CalcGeometry(GeoInfo, Width, Height,
         WestLonToDrawInDegree, NorthLatToDrawInDegree,
         EastLonToDrawInDegree, SouthLatToDrawInDegree, RequestedGraphicSize);
     List<DrawAbleTrack> TrackList = new List<DrawAbleTrack>();
     LoadTracks(MapDataWrapper.Instance.GetAllTracks("OrtsTeil"), "OrtsTeil", TrackList, new Pen(Brushes.Blue, 3));
     LoadTracks(MapDataWrapper.Instance.GetAllTracks("Bezirk"), "Bezirk", TrackList, new Pen(Brushes.Red, 5));
     return CreateOSMPictureWithOverLoadsViaGeometryInfo(GeoInfo, TrackList);
     }
Exemplo n.º 11
0
 public BitmapSource CreateOSMPictureWithOverLoadsViaMeasurement(double WLaenge, double WBreite,
     int Width, int Height, int Scale)
     {
     GeometryInfo GeoInfo = new GeometryInfo();
     CalcGeometry(GeoInfo, Width, Height, WLaenge, WBreite, GetLinearScale(Scale));
     List<Marker> Markers = new List<Marker>();
     Marker LocationMarker = new Marker();
     LocationMarker.Lat = GeoInfo.Lat;
     LocationMarker.Lon = GeoInfo.Lon;
     Markers.Add(LocationMarker);
     List<DrawAbleTrack> TrackList = new List<DrawAbleTrack>();
     LoadTracks(MapDataWrapper.Instance.GetAllTracks("OrtsTeil"), "OrtsTeil", TrackList, new Pen(Brushes.Blue, 3));
     LoadTracks(MapDataWrapper.Instance.GetAllTracks("Bezirk"), "Bezirk", TrackList, new Pen(Brushes.Red, 5));
     return CreateOSMPictureWithOverLoadsViaGeometryInfo(GeoInfo, TrackList, Markers);
     }
Exemplo n.º 12
0
        public BitmapSource CreateOSMPictureWithOverLoadsViaKachel(MapKachel RootKachel,
            List<Marker> MarkersToOverlay, DrawMarkerEvent DrawMarkerHandler, GraphicSize RequestedGraphicSize)
            {
            GeometryInfo GeoInfo = new GeometryInfo();

            //MapBasics.Instance.DrawMarkerHandler = DrawMarkerHandler;
            CalcGeometry(GeoInfo, RootKachel.MapBitmapImage.Width, RootKachel.MapBitmapImage.Height,
                RootKachel.GeographicalTopLeft.X, RootKachel.GeographicalTopLeft.Y,
                RootKachel.GeographicalBottomRight.X, RootKachel.GeographicalBottomRight.Y, RequestedGraphicSize);
            List<DrawAbleTrack> Tracks = new List<DrawAbleTrack>();
            LoadTracks(MapDataWrapper.Instance.GetAllTracks("OrtsTeil"), "OrtsTeil", Tracks, new Pen(Brushes.Blue, 4));
            LoadTracks(MapDataWrapper.Instance.GetAllTracks("Bezirk"), "Bezirk", Tracks, new Pen(Brushes.Red, 7));
            MarkersToOverlay.AddRange(GetOrtsTeilDescriptionMarker(RootKachel));
            return CreateOSMPictureWithOverLoadsViaGeometryInfo(GeoInfo, Tracks,
                MarkersToOverlay, DrawMarkerHandler);
            }
Exemplo n.º 13
0
        public void FillDrawingBackGound(GeometryInfo GeoInfo, DrawingContext Context)
            {
            try
                {
                // Find where to draw the centre tile...
                int drawx, drawy;
                drawx = (int) (GeoInfo.Width/2 - ((double) GeoInfo.ViewTileSizePixels
                                                  *
                                                  ((GeoInfo.Lon - GeoInfo.CentreTileLonT)/
                                                   (GeoInfo.CentreTileLonB - GeoInfo.CentreTileLonT))));
                drawy = GeoInfo.ViewYTileYPos;

                int x = GeoInfo.CentreTileNumX;
                int y = GeoInfo.CentreTileNumY;

                // Move the position back to the top-leftmost tile we need to
                // draw...
                while (drawx >= 0)
                    {
                    drawx -= GeoInfo.ViewTileSizePixels;
                    x--;
                    }
                while (drawy >= 0)
                    {
                    drawy -= GeoInfo.ViewTileSizePixels;
                    y--;
                    }

                // Draw all the tiles...
                int curdrawx;
                int curx;
                while (drawy < GeoInfo.Height)
                    {
                    curdrawx = drawx;
                    curx = x;
                    while (curdrawx < GeoInfo.Width)
                        {
                        ImageSource img = TileManagerInstance.GetTile(GeoInfo, curx, y, GeoInfo.ViewTileZoom);
                        if (img != null)
                            Context.DrawImage(img, new Rect(curdrawx, drawy,
                                GeoInfo.ViewTileSizePixels + 1, GeoInfo.ViewTileSizePixels + 1));
                        curdrawx += GeoInfo.ViewTileSizePixels;
                        curx++;
                        }
                    drawy += GeoInfo.ViewTileSizePixels;
                    y++;
                    }
                }
            catch (Exception Excp)
                {
                MessageBox.Show("Drawing BackGround Exception: " + Excp.ToString());
                }
            }
Exemplo n.º 14
0
        public void CalcGeometry(GeometryInfo GeoInfo, double DrawingWidthInPixel, double DrawingHeightInPixel,
            double CenterLonToDrawInDegree, double CenterLatToDrawInDegree, double ScaleToDraw)
            {
            // We don't need to do anything if the information we already have
            // is valid for the current view...			
            if (DrawingWidthInPixel == GeoInfo.Width &&
                DrawingHeightInPixel == GeoInfo.Height &&
                CenterLatToDrawInDegree == GeoInfo.Lat &&
                CenterLonToDrawInDegree == GeoInfo.Lon &&
                ScaleToDraw == GeoInfo.Scale)
                return;

            GeoInfo.Width = (int) DrawingWidthInPixel;
            GeoInfo.Height = (int) DrawingHeightInPixel;
            GeoInfo.Lat = CenterLatToDrawInDegree;
            GeoInfo.Lon = CenterLonToDrawInDegree;
            GeoInfo.Scale = ScaleToDraw;

            // Figure out what tile zoom we want...
            // We want this many degrees longitude per tile...
            double LonPerTileWanted = 256*GeoInfo.Scale;
            // Meaning we want this many tiles across in total.
            int TilesNumWanted = (int) (360.0/LonPerTileWanted);
            // Which corresponds to this zoom level...
            int TileZoom = (int) (Math.Log(TilesNumWanted)/Math.Log(2));
            if (TileZoom > 18)
                TileZoom = 18;
            GeoInfo.ViewTileZoom = TileZoom;

            // Get the tile x/y at the centre of the view...
            GetTileXYFromLatLon(GeoInfo.Lat, GeoInfo.Lon, TileZoom, out GeoInfo.CentreTileNumX,
                out GeoInfo.CentreTileNumY);

            // Get the Lat Lon at the top left corner of that tile...
            double Lat, Lon;
            GetLatLonFromTileXY(GeoInfo.CentreTileNumX, GeoInfo.CentreTileNumY, TileZoom, out Lat, out Lon);
            GeoInfo.CentreTileLonT = Lon;

            // Get the Lat Lon at the bottom left corner as well...
            double Lat2, Lon2;
            GetLatLonFromTileXY(GeoInfo.CentreTileNumX + 1, GeoInfo.CentreTileNumY + 1, TileZoom, out Lat2, out Lon2);
            GeoInfo.CentreTileLonB = Lon2;

            // Calculate longitude degrees per tile...
            double LonPerTile = 360.0/(Math.Pow(2, TileZoom));

            // Calculate longitude degrees per pixel on the tile...
            double LonPerTilePixel = LonPerTile/256;

            // Calculate the size (pixels) that tiles will be scaled to
            // when drawn...
            GeoInfo.ViewTileSizePixels = (int) (256*LonPerTilePixel/GeoInfo.Scale);

            GeoInfo.ViewYTileYPos =
                (int) (GeoInfo.Height/2 - ((double) GeoInfo.ViewTileSizePixels*((GeoInfo.Lat - Lat)/(Lat2 - Lat))));
            }
Exemplo n.º 15
0
        public void CalcGeometry(GeometryInfo GeoInfo, double DrawingWidthInPixel, double DrawingHeightInPixel,
            double WestLonToDrawInDegree, double NorthLatToDrawInDegree, double EastLonToDrawInDegree,
            double SouthLatToDrawInDegree, GraphicSize RequestedGraphicSize)
            {
            switch (RequestedGraphicSize)
                {
                    case GraphicSize.A3:
                        DrawingWidthInPixel *= 1.5;
                        DrawingHeightInPixel *= 1.5;
                        break;
                    case GraphicSize.A2:
                        DrawingWidthInPixel *= 1.8;
                        DrawingHeightInPixel *= 1.8;
                        break;
                    case GraphicSize.A4:
                    case GraphicSize.Free:
                        break;
                    default:
                        break;
                }
            double CenterLonToDrawInDegree = (WestLonToDrawInDegree + EastLonToDrawInDegree)/2;
            double CenterLatToDrawInDegree = (NorthLatToDrawInDegree + SouthLatToDrawInDegree)/2;
            double WestEastDistanceInDegrees = EastLonToDrawInDegree - WestLonToDrawInDegree;
            double SouthNorthDistanceInDegrees = NorthLatToDrawInDegree - SouthLatToDrawInDegree;
            double WestEastDistanceInMeter = CalculateDistanceFromGeoPoints
                (CenterLatToDrawInDegree, EastLonToDrawInDegree, CenterLatToDrawInDegree, WestLonToDrawInDegree);
            double SouthNorthDistanceInMeter = CalculateDistanceFromGeoPoints
                (CenterLonToDrawInDegree, NorthLatToDrawInDegree, CenterLonToDrawInDegree, SouthLatToDrawInDegree);
            double WidthScaleToDraw = WestEastDistanceInDegrees/DrawingWidthInPixel; //Basics.XDPIFactor);
            double HeightScaleToDraw = SouthNorthDistanceInDegrees/DrawingHeightInPixel; //Basics.YDPIFactor);
            double ScaleToDraw = 0;
            double TargetAspectRatio = DrawingWidthInPixel/DrawingHeightInPixel;
            double SourceAspectRatio = WestEastDistanceInMeter/SouthNorthDistanceInMeter;
            if (TargetAspectRatio < SourceAspectRatio)
                ScaleToDraw = WidthScaleToDraw;
            else
                {
                double CalculatedWestEastDistanceInMeter = SouthNorthDistanceInMeter*TargetAspectRatio;
                double CalculatedWestEastDistanceInDegrees = WestEastDistanceInDegrees
                                                             /
                                                             (WestEastDistanceInMeter/CalculatedWestEastDistanceInMeter);
                ScaleToDraw = CalculatedWestEastDistanceInDegrees/DrawingWidthInPixel;
                }
            //ScaleToDraw = 0.00009;

            CalcGeometry(GeoInfo, DrawingWidthInPixel, DrawingHeightInPixel,
                CenterLonToDrawInDegree, CenterLatToDrawInDegree, ScaleToDraw);
            }
Exemplo n.º 16
0
        /// <summary>
        /// Get the 'entity' at the given client position.
        /// </summary>
        /// <param name="x">The client X position.</param>
        /// <param name="y">The client Y position.</param>
        /// <returns>An EntityInfo instance describing the entity.</returns>
        public EntityInfo GetEntityAtClientPos(GeometryInfo GeoInfo, int x, int y, List<Marker> mMarkers,
            List<DrawAbleTrack> mTracks, MouseUsage ActuallMouseBehavioir)
            {
            EntityInfo SelectedEntityInfo = new EntityInfo();
            SelectedEntityInfo.ActuallMouseBehavioir = ActuallMouseBehavioir;
            ClientPosToLatLon(GeoInfo, x, y, out SelectedEntityInfo.Lat, out SelectedEntityInfo.Lon);
            double Difference = GeoInfo.Scale*50;
//			Difference = 0.001;
            if ((ActuallMouseBehavioir == MouseUsage.DefaultMouseBehavioir)
                || (ActuallMouseBehavioir == MouseUsage.ChangeCenterAndMarkerWithNextClick)
                || (ActuallMouseBehavioir == MouseUsage.DefineMarkerAtClickedPosition))
                foreach (Marker StoredMarkers in mMarkers)
                    {
                    if ((Math.Abs(SelectedEntityInfo.Lat - StoredMarkers.Lat) < Difference)
                        && (Math.Abs(SelectedEntityInfo.Lon - StoredMarkers.Lon) < Difference))
                        {
                        SelectedEntityInfo.Marker = StoredMarkers;
                        SelectedEntityInfo.Type = EntityType.TypeIsMarker;
                        return SelectedEntityInfo;
                        }
                    }
            if (ActuallMouseBehavioir == MouseUsage.DefaultMouseBehavioir)
                foreach (DrawAbleTrack StoredTracks in mTracks)
                    {
                    foreach (TrackPoint PointInStoredTrack	 in StoredTracks.Points)
                        {
                        if ((Math.Abs(SelectedEntityInfo.Lat - PointInStoredTrack.Lat) < Difference)
                            && (Math.Abs(SelectedEntityInfo.Lon - PointInStoredTrack.Lon) < Difference))
                            {
                            SelectedEntityInfo.DrawAbleTrack = StoredTracks;
                            SelectedEntityInfo.Time = PointInStoredTrack.Time;
                            SelectedEntityInfo.Type = EntityType.TypeIsTrackPoint;
                            return SelectedEntityInfo;
                            }
                        }
                    }

            ClientPosToLatLon(GeoInfo, x, y, out SelectedEntityInfo.Lat, out SelectedEntityInfo.Lon);
            SelectedEntityInfo.Type = EntityType.TypeIsLatLon;
            return SelectedEntityInfo;
            }
Exemplo n.º 17
0
		void _mapBasic_NewDataAvailable(GeometryInfo GeoInfo)
			{
			}
Exemplo n.º 18
0
 public void FillDrawingMarker(GeometryInfo GeoInfo, DrawingContext Context,
     List<Marker> mMarkers, DrawMarkerEvent DrawMarkerHandler)
     {
     try
         {
         // Draw markers...
         foreach (Marker m in mMarkers)
             {
             m.Geometrie = GeoInfo;
             int mx, my;
             LatLonToClientPos(GeoInfo, m.Lat, m.Lon, out mx, out my);
             Point Position = new Point((double) mx, (double) my);
             if (DrawMarkerHandler != null)
                 DrawMarkerHandler(this, m, Context, Position);
             else
                 {
                 Pen pen = new Pen(Brushes.Red, 3);
                 Context.DrawEllipse(null, pen, new Point(mx - 3, my - 3), 7, 7);
                 }
             }
         }
     catch (Exception Excp)
         {
         MessageBox.Show("Drawing Marker Exception: " + Excp.ToString());
         }
     }