Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// if there is no data file, this mothod will create a new file
        /// </summary>
        /// <param name="data">Links the DataModel file</param>
        private void MakeDataForDisk(DataModel data)
        {
            access = (new Parsing(data)).GetModel(true);

            if (Directory.Exists(filepath))
            {
                Files.Writing_disk(access, FileMode.Open, filepath);
            }
            else
            {
                Files.Writing_disk(access, FileMode.Create, filepath);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// writing to the disk
 /// </summary>
 /// <param name="l">Gives acces to the class VisueelModel</param>
 /// <param name="fm">writing to existing files or creating a new file when not available</param>
 /// <param name="path">Is the path where the files is saved</param>
 public static void Writing_disk(VisualModel l, FileMode fm, string path)
 {
     try
     {
         using (Stream str = File.Open(path, fm))
         {
             var formater = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
             formater.Serialize(str, l);
         }
     }
     catch
     {
         MessageBox.Show("File coudn't be opened", "Error", MessageBoxButtons.OK);
     }
 }