Пример #1
0
        /// <summary>
        /// set bool value to true or false denping the given variables, true is for paint and falae is not paint
        /// </summary>
        /// <param name="access">Gives acces to the class VisueelModel in VisueelModel</param>
        /// <param name="factor">The value of zoom from the MapView</param>
        /// <param name="screenHeight">Screenheight of the map from the Mapvieuw file</param>
        /// <param name="b">Gives acces to the the Class Changes in VisueelModel</param>
        /// <param name="start">strat coordinate of the mouse from MapView</param>
        /// <param name="end">end coordinate of the mouse from MapView</param>
        /// <param name="stations">Only if a new set of names is filled in by the user, this bool turns to true</param>
        /// <param name="map">Gives the connection to the MapView</param>
        public void Valuenode(VisualModel access, int factor, int screenHeight, Changes b, Point start, Point end, bool stations, MapView map)
        {
            Point shift = b.Movemap(start, end);

            toshiftX += shift.X;
            toshifty += shift.Y;

            foreach (VisueelNode v in access.nodes)
            {
                if ((v.point.X - toshiftX) > 0 && (v.point.X - toshiftX) < (screenHeight) && (v.point.Y - toshifty) > 0 && (v.point.Y - toshifty) < (screenHeight))
                {
                    Switching(v, factor, map);
                }
                else
                {
                    v.paint = false;
                }
            }

            foreach (VisualLink v in access.links)
            {
                if (v.v.paint || v.u.paint)
                {
                    map.links.Add(v);
                }
            }

            foreach (VLogicalLink v in access.connections)
            {
                if (v.v.paint || v.u.paint)
                {
                    map.logicallinks.Add(v);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// helping method valuenode
        /// </summary>
        /// <param name="v">Gives acces to the class VisueelNode</param>
        /// <param name="zoom">is the value of the zoom from MapView</param>
        /// <param name="map">Givves acces to MapView file</param>
        public void Switching(VisueelNode v, int zoom, MapView map)
        {
            switch (zoom)
            {
            case 1:
                v.priorityLinks = (v.numberOfLinks < 8) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 2:
                v.priorityLinks = (v.numberOfLinks < 7) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 3:
                v.priorityLinks = (v.numberOfLinks < 6) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 4:
                v.priorityLinks = (v.numberOfLinks < 5) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 5:
                v.priorityLinks = (v.numberOfLinks < 4) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 6:
                v.priorityLinks = (v.numberOfLinks < 3) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 7:
                v.priorityLinks = (v.numberOfLinks < 2) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            case 8:
                v.priorityLinks = (v.numberOfLinks < 1) ? false : true;
                v.paint         = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;

            default:
                v.paint = true;
                if (v.paint)
                {
                    map.nodes.Add(v);
                }
                break;
            }

            if (v.name_id == map.station1)
            {
                v.priorityLinks = true;
            }

            if (v.name_id == map.station2)
            {
                v.priorityLinks = true;
            }
        }
Пример #3
0
        /// <summary>
        /// is responsible for corectly colloring all nodes
        /// </summary>
        /// <param name="screenHeight">Screenheight of the map from the Mapvieuw file</param>
        /// <param name="factor">The value of the zoom from the Mapview</param>
        /// <param name="startMouse">strat coordinate of the mouse from MapView</param>
        /// <param name="endMouse">end coordinate of the mouse from MapView</param>
        /// <param name="s">List of Nodes on the route the user entered, comming from Form1</param>
        /// <param name="stationNames">Only if a new set of names is filled in by the user, this bool turns to true</param>
        /// <param name="map">Gives the connection to the MapView</param>
        public void Visualcontrol(int screenHeight, int factor, Point startMouse, Point endMouse, List <Node> s, bool stationNames, MapView map)
        {
            if (stationNames)
            {
                Colorchange();

                foreach (VisueelNode v in access.nodes)
                {
                    if (s[0].stationName == v.name_id)
                    {
                        v.priorityLinks = true;
                        map.station1    = s[0].stationName;
                    }


                    if (s[s.Count - 1].stationName == v.name_id)
                    {
                        v.priorityLinks = true;
                        map.station2    = s[s.Count - 1].stationName;
                    }
                }

                foreach (VisualLink v in access.links)
                {
                    v.kleur = Color.Gray;
                }

                foreach (VisueelNode v in access.nodes)
                {
                    foreach (Node n in s)
                    {
                        if (v.name_id == n.stationName)
                        {
                            v.Color = Color.Orange;
                        }
                    }
                }

                foreach (VLogicalLink v in access.connections)
                {
                    string firstName, lastName;

                    for (int n = 0; n < s.Count; n++)
                    {
                        firstName = s[n].stationName;

                        for (int m = 0; m < s.Count; m++)
                        {
                            lastName = s[m].stationName;

                            if (firstName == v.v.name_id && lastName == v.u.name_id)
                            {
                                for (int i = 0; i < v.nodes.Count; i++)
                                {
                                    v.nodes[i].Color = Color.Orange;
                                }

                                for (int i = 0; i < v.links.Count; i++)
                                {
                                    v.links[i].kleur = Color.Orange;
                                }
                            }
                        }
                    }
                }

                foreach (VisualLink m in access.links)
                {
                    if (m.v.Color == Color.Orange && m.u.Color == Color.Orange && !m.v.dummynode && !m.u.dummynode)
                    {
                        m.kleur = Color.Orange;
                    }
                }
            }

            l.Valuenode(access, factor, screenHeight, b, startMouse, endMouse, stationNames, map);
        }