LoadPath() public static méthode

public static LoadPath ( ) : Path
Résultat Path
Exemple #1
0
        static void Main()
        {
            //Printing BasePoint
            Console.Write("Starting Point: ");
            Console.WriteLine(Point3D.BasePoint);

            // Testing EucledeanDistance
            Point3D randomPoint = new Point3D(2.65, 4.56, 8.26);
            double distance = Distance.EucledeanDistance(Point3D.BasePoint, randomPoint);
            Console.WriteLine("Distance between {0} and {1} = {2:F2}", Point3D.BasePoint, randomPoint, distance);

            // Testing Path storage
            // Uncomment this code to test Path Saving
            //Path testPath = new Path();
            //testPath.AddPoint(Point3D.BasePoint);
            //testPath.AddPoint(randomPoint);
            //testPath.AddPoint(new Point3D(4.3, -2.2, 6.25));

            //PathStorage.SavePath(testPath);

            Console.WriteLine(new String('-', 30));
            Console.WriteLine("Printing Loaded Path:");
            Path loadedPath = PathStorage.LoadPath();
            loadedPath.PrintPath();

        }
        public static void CreatePoint()
        {
            Console.WriteLine("Examplary points");
            Point3D pointInput1 = new Point3D(-7, -4, 3);
            Point3D pointInput2 = new Point3D(17, 6, 2.5);

            Console.WriteLine("Point A:");
            Console.WriteLine(pointInput1);
            Console.WriteLine("Point B:");
            Console.WriteLine(pointInput2);
            double distance = DistanceCalculation.Distance(pointInput1, pointInput2);

            Console.WriteLine("The distance between point A and point B is:");
            Console.WriteLine(distance);
            string filePath = "../../Paths.txt";

            List <Path> listOfPaths = new List <Path>();

            while (true)
            {
                Console.WriteLine("Do you want to create a new path:");
                string input = Console.ReadLine();
                if (input == "Yes")
                {
                    Path newPath = new Path();
                    newPath.PointsCollection = newPath.AddPath();
                    listOfPaths.Add(newPath);

                    PathStorage.SavePath(filePath, listOfPaths);
                }
                else
                {
                    break;
                }
            }

            Console.WriteLine("The text files paths.txt is in the folder called \"Structure\".");

            // The paths from the text file are here:
            List <Path> listOfRecordedPaths = PathStorage.LoadPath(filePath);
        }