Ejemplo n.º 1
0
        public MainForm(string[] userData, int user, LoadingThread loadingThread)
        {
            this.UserData = userData;
            User          = user;

            this.loadingThread = loadingThread;

            this.Initialize();
        }
Ejemplo n.º 2
0
        public MainForm(string[] userData, int user, LoadingThread loadingThread)
        {
            this.UserData = userData;
            User = user;

            this.loadingThread = loadingThread;

            this.Initialize();
        }
Ejemplo n.º 3
0
        public StreetSelectBox(MapDisplay map, LoadingThread thr, IconType type, MapDragButton button, MainForm parent)
        {
            this.map         = map;
            this.graphThread = thr;
            this.type        = type;
            this.button      = button;
            this.Enabled     = false;

            this.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            this.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            this.AutoCompleteCustomSource = new AutoCompleteStringCollection();

            loadNames();

            // If this control was created before the graph was fully loaded,
            // The names aren't initialized so initialize all names.
            parent.GraphLoaded += (object o, EventArgs ea) => { loadNames(); };
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LoadingThread thread = new LoadingThread("input.osm.pbf");
            StartForm startForm = new StartForm();
            startForm.MapFileChosen += (object o, FileNameEventArgs fnea) => { thread = new LoadingThread(fnea.FileName); };
            Application.Run(startForm);
            if(startForm.Gebruiker > -1)
            {
                if (startForm.newUser)
                    Application.Run(new HelpForm());

                MainForm mainForm = new MainForm(startForm.UserData,
                                                 startForm.Gebruiker,
                                                 thread);
                Application.Run(mainForm);
            }
            thread.Abort();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LoadingThread thread = new LoadingThread("input.osm.pbf");
            StartForm startForm = new StartForm();
            startForm.MapFileChosen += (object o, FileNameEventArgs fnea) => { thread = new LoadingThread(fnea.FileName); };
            Application.Run(startForm);
            if(startForm.Gebruiker > -1)
            {
                if (startForm.newUser)
                    Application.Run(new HelpForm());

                MainForm mainForm = new MainForm(startForm.UserData,
                                                 startForm.Gebruiker,
                                                 thread);
                Application.Run(mainForm);
            }
            thread.Abort();
        }
Ejemplo n.º 6
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.º 7
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.º 8
0
        public StreetSelectBox(MapDisplay map, LoadingThread thr, IconType type, MapDragButton button, MainForm parent)
        {
            this.map = map;
            this.graphThread = thr;
            this.type = type;
            this.button = button;
            this.Enabled = false;

            this.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            this.AutoCompleteSource = AutoCompleteSource.CustomSource;
            this.AutoCompleteCustomSource = new AutoCompleteStringCollection();

            loadNames();

            // If this control was created before the graph was fully loaded,
            // The names aren't initialized so initialize all names.
            parent.GraphLoaded += (object o, EventArgs ea) => { loadNames(); };
        }