Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new AllstartsLogo and starts it.
        /// </summary>
        private void StartLoadingLogo()
        {
            logo = new AllstarsLogo(true);
            int w = Math.Min(this.Width, this.Height) / 10;

            logo.Size     = new Size(w, w);
            logo.Location = new Point(1, 1);
            this.Controls.Add(logo);
            logo.Start();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Control that draws the map and updates the tiles.
        /// </summary>
        public MapDisplay(int x, int y, int width, int height, LoadingThread thr)
        {
            this.Location       = new Point(x, y);
            this.Width          = width;
            this.Height         = height;
            this.bounds         = new BBox(5.16130, 52.06070, 5.19430, 52.09410);
            this.DoubleBuffered = true;

            this.updateStatusDelegate     = new UpdateStatusDelegate(UpdateStatus);
            this.updateRouteStatsDelegate = new UpdateRouteStatsDelegate(UpdateRouteStats);
            this.startLogoDelegate        = new StartLogoDelegate(StartLoadingLogo);
            this.stopLogoDelegate         = new StopLogoDelegate(StopLoadingLogo);

            this.updateThread = new Thread(new ThreadStart(this.UpdateTiles));
            this.MouseClick  += (object o, MouseEventArgs mea) => { OnClick(o, new MouseMapDragEventArgs(null, mea.Button, mea.Clicks,
                                                                                                         mea.X, mea.Y, mea.Delta)); };
            this.MouseDoubleClick += OnDoubleClick;
            this.Paint            += OnPaint;
            this.Resize           += OnResize;
            this.MouseDown        += OnMouseDown;
            this.MouseUp          += OnMouseUp;
            this.MouseMove        += OnMouseMove;
            this.Disposed         += (object o, EventArgs ea) => { updateThread.Abort(); };

            // Thread that loads the graph.
            loadingThread = thr;

            // Checks whether the graph is loaded so the mapdisplay can start loading tiles.
            loadingTimer          = new System.Windows.Forms.Timer();
            loadingTimer.Interval = 100;
            loadingTimer.Tick    += (object o, EventArgs ea) => { DoUpdate(); };
            loadingTimer.Start();


            logo          = new AllstarsLogo(true);
            logo.Location = Point.Empty;
            logo.Width    = this.Width;
            logo.Height   = this.Height;
            this.Controls.Add(logo);
            logo.Start();


            LinkLabel creditLabel = new LinkLabel();

            creditLabel.Text         = "© OpenStreetMap contributors";
            creditLabel.LinkArea     = new LinkArea(2, 13);
            creditLabel.LinkClicked += (object o, LinkLabelLinkClickedEventArgs ea) => { System.Diagnostics.Process.Start("http://www.openstreetmap.org/copyright/en"); };
            creditLabel.Anchor       = (AnchorStyles.Right | AnchorStyles.Bottom);
            creditLabel.Size         = creditLabel.PreferredSize;
            creditLabel.Location     = new Point(this.Width - creditLabel.Width - 1, this.Height - creditLabel.Height - 1);
            this.Controls.Add(creditLabel);

            statLabel          = new Label();
            statLabel.AutoSize = true;
            statLabel.Resize  += (object o, EventArgs ea) => { statLabel.Location = new Point(this.Width - 1 - statLabel.Size.Width, 1); };
            statLabel.Anchor   = (AnchorStyles.Right | AnchorStyles.Top);
            statLabel.Font     = new Font("Microsoft Sans Serif", 11);
            this.Controls.Add(statLabel);


            myVehicles      = new List <MyVehicle>();
            icons           = new List <MapIcon>();
            streetSelection = new List <Curve>();

            tiles       = new List <List <Bitmap> >();
            tileCorners = new List <List <Point> >();
            tiles.Add(new List <Bitmap>());
            tileCorners.Add(new List <Point>());
            tileIndex = 0;

            tileIndexes = new List <SortedList <int, SortedList <int, int> > >();
            tileIndexes.Add(new SortedList <int, SortedList <int, int> >());

            zoomWidth  = new List <double>();
            zoomHeight = new List <double>();


            this.Disposed += (sender, e) =>
            {
                logo.StillLoading = false;
            };


            // Set linecaps for the pens.
            footPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            bikePen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            carPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            busPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            otherPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new AllstartsLogo and starts it.
 /// </summary>
 private void StartLoadingLogo()
 {
     logo = new AllstarsLogo(true);
     int w = Math.Min(this.Width, this.Height) / 10;
     logo.Size = new Size(w, w);
     logo.Location = new Point(1, 1);
     this.Controls.Add(logo);
     logo.Start();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Control that draws the map and updates the tiles.
        /// </summary>
        public MapDisplay(int x, int y, int width, int height, LoadingThread thr)
        {
            this.Location = new Point(x, y);
            this.Width = width;
            this.Height = height;
            this.bounds = new BBox(5.16130, 52.06070, 5.19430, 52.09410);
            this.DoubleBuffered = true;

            this.updateStatusDelegate = new UpdateStatusDelegate(UpdateStatus);
            this.updateRouteStatsDelegate = new UpdateRouteStatsDelegate(UpdateRouteStats);
            this.startLogoDelegate = new StartLogoDelegate(StartLoadingLogo);
            this.stopLogoDelegate = new StopLogoDelegate(StopLoadingLogo);

            this.updateThread = new Thread(new ThreadStart(this.UpdateTiles));
            this.MouseClick += (object o, MouseEventArgs mea) => { OnClick(o, new MouseMapDragEventArgs(null, mea.Button, mea.Clicks,
                                                                                                        mea.X, mea.Y, mea.Delta)); };
            this.MouseDoubleClick += OnDoubleClick;
            this.Paint += OnPaint;
            this.Resize += OnResize;
            this.MouseDown += OnMouseDown;
            this.MouseUp += OnMouseUp;
            this.MouseMove += OnMouseMove;
            this.Disposed += (object o, EventArgs ea) => { updateThread.Abort(); };

            // Thread that loads the graph.
            loadingThread = thr;

            // Checks whether the graph is loaded so the mapdisplay can start loading tiles.
            loadingTimer = new System.Windows.Forms.Timer();
            loadingTimer.Interval = 100;
            loadingTimer.Tick += (object o, EventArgs ea) => { DoUpdate(); };
            loadingTimer.Start();

            logo = new AllstarsLogo(true);
            logo.Location = Point.Empty;
            logo.Width = this.Width;
            logo.Height = this.Height;
            this.Controls.Add(logo);
            logo.Start();

            LinkLabel creditLabel = new LinkLabel();
            creditLabel.Text = "© OpenStreetMap contributors";
            creditLabel.LinkArea = new LinkArea(2, 13);
            creditLabel.LinkClicked += (object o, LinkLabelLinkClickedEventArgs ea) => { System.Diagnostics.Process.Start("http://www.openstreetmap.org/copyright/en"); };
            creditLabel.Anchor = (AnchorStyles.Right | AnchorStyles.Bottom);
            creditLabel.Size = creditLabel.PreferredSize;
            creditLabel.Location = new Point(this.Width - creditLabel.Width - 1, this.Height - creditLabel.Height - 1);
            this.Controls.Add(creditLabel);

            statLabel = new Label();
            statLabel.AutoSize = true;
            statLabel.Resize += (object o, EventArgs ea) => { statLabel.Location = new Point(this.Width - 1 - statLabel.Size.Width, 1); };
            statLabel.Anchor = (AnchorStyles.Right | AnchorStyles.Top);
            statLabel.Font = new Font("Microsoft Sans Serif", 11);
            this.Controls.Add(statLabel);

            myVehicles = new List<MyVehicle>();
            icons = new List<MapIcon>();
            streetSelection = new List<Curve>();

            tiles = new List<List<Bitmap>>();
            tileCorners = new List<List<Point>>();
            tiles.Add(new List<Bitmap>());
            tileCorners.Add(new List<Point>());
            tileIndex = 0;

            tileIndexes = new List<SortedList<int, SortedList<int, int>>>();
            tileIndexes.Add(new SortedList<int, SortedList<int, int>>());

            zoomWidth = new List<double>();
            zoomHeight = new List<double>();

            this.Disposed += (sender, e) =>
            {
                logo.StillLoading = false;
            };

            // Set linecaps for the pens.
            footPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            bikePen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            carPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            busPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            otherPen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
        }