private void SetSelectedLine(Line l)
        {
            bool change = selectedLine != l;

            if (change)
            {
                selectedLine = l;
                PictureBox1.SetSelectedLine(l);
                PictureBox1.Invalidate();
                lineBox.Enabled = l != null;
                if (l != null)
                {
                    numLatA.Value   = (decimal)l.A.latitude;
                    numLatB.Value   = (decimal)l.B.latitude;
                    numLatO.Value   = (decimal)l.O.latitude;
                    numLongA.Value  = (decimal)l.A.longitude;
                    numLongB.Value  = (decimal)l.B.longitude;
                    numLongO.Value  = (decimal)l.O.longitude;
                    fldLineTyp.Text = ((LineType)l.Type).ToString();
                }
                else
                {
                    numLatA.Value   = 0;
                    numLatB.Value   = 0;
                    numLatO.Value   = 0;
                    numLongA.Value  = 0;
                    numLongB.Value  = 0;
                    numLongO.Value  = 0;
                    fldLineTyp.Text = "";
                }
            }
        }
        private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            fldCursorX.Text = e.X.ToString();
            fldCursorY.Text = e.Y.ToString();
            if (c != null)
            {
                double latitude  = c.YtoLatitude(e.Y);
                double longitude = c.XtoLongitude(e.X);
                fldLatitude.Text  = latitude.ToString();
                fldLongitude.Text = longitude.ToString();
                if (activeLine != null)
                {
                    PictureBox1.SetSelectedLine(null);
                    #region activeLine != null
                    switch (ap)
                    {
                    case ActivePoint.A:
                    {
                        Point a = Factory.newGPSPoint(longitude, latitude, 0);
                        Point b = Factory.newGPSPoint(a.longitude, a.latitude, a.altitude);
                        Point o = Factory.newGPSPoint(a.longitude, a.latitude, a.altitude);
                        activeLine.A = a;
                        activeLine.B = b;
                        activeLine.O = o;
                        PictureBox1.Invalidate();
                        break;
                    }

                    case ActivePoint.B:
                    {
                        Point b = Factory.newGPSPoint(longitude, latitude, 0);
                        Point o = Factory.newGPSPoint(b.longitude, b.latitude, b.altitude);
                        activeLine.B = b;
                        activeLine.O = o;
                        PictureBox1.Invalidate();
                        break;
                    }

                    case ActivePoint.O:
                    {
                        Point o = Factory.newGPSPoint(longitude, latitude, 0);
                        activeLine.O = o;
                        PictureBox1.Invalidate();
                        break;
                    }

                    case ActivePoint.NONE:
                    {
                        break;
                    }
                    }
                    #endregion
                }
                else
                {
                    bool Line = false;
                    lock (activeParcour)
                    {
                        foreach (Line l in activeParcour.Line)
                        {
                            int    startX       = c.getStartX(l);
                            int    startY       = c.getStartY(l);
                            int    endX         = c.getEndX(l);
                            int    endY         = c.getEndY(l);
                            int    midX         = startX + (endX - startX) / 2;
                            int    midY         = startY + (endY - startY) / 2;
                            int    orientationX = c.getOrientationX(l);
                            int    orientationY = c.getOrientationY(l);
                            Vector mousePos     = new Vector(e.X, e.Y, 0);
                            if (Vector.Abs(Vector.MinDistance(new Vector(startX, startY, 0), new Vector(endX, endY, 0), mousePos)) < 3 ||
                                Vector.Abs(Vector.MinDistance(new Vector(midX, midY, 0), new Vector(orientationX, orientationY, 0), mousePos)) < 3)
                            {
                                SetHoverLine(l);
                                Line = true;
                                break;
                            }
                        }
                    }
                    if (!Line)
                    {
                        SetHoverLine(null);
                    }
                }
            }
        }