Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Point3D firstPoint = new Point3D(4, 5, 6);
            firstPoint.PointX = 4;
            Point3D seconPoint = new Point3D(1, 1, 0);
            Point3D thirdPoint = new Point3D(3, 3, 1);

            Console.WriteLine(firstPoint.ToString());

            Console.WriteLine(firstPoint.PointZero);

            Console.WriteLine(DistanceBetweenTwoPoints.CalculateDistance(firstPoint, seconPoint));

            Path pathOne = new Path();
            pathOne.AddPoints(firstPoint);
            pathOne.AddPoints(seconPoint);
            pathOne.AddPoints(thirdPoint);

            PathStorage.SavePathInFile(pathOne);
            PathStorage.LoadPath();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Point3D firstPoint = new Point3D(4, 5, 6);

            firstPoint.PointX = 4;
            Point3D seconPoint = new Point3D(1, 1, 0);
            Point3D thirdPoint = new Point3D(3, 3, 1);

            Console.WriteLine(firstPoint.ToString());

            Console.WriteLine(firstPoint.PointZero);

            Console.WriteLine(DistanceBetweenTwoPoints.CalculateDistance(firstPoint, seconPoint));

            Path pathOne = new Path();

            pathOne.AddPoints(firstPoint);
            pathOne.AddPoints(seconPoint);
            pathOne.AddPoints(thirdPoint);


            PathStorage.SavePathInFile(pathOne);
            PathStorage.LoadPath();
        }
Ejemplo n.º 3
0
        public static void LoadPath()
        {
            Path        loadPath   = new Path();
            List <Path> loadedPath = new List <Path>();

            using (StreamReader reader = new StreamReader(@"../../PathssLoad.txt"))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    Point3D  pointsFromFile = new Point3D();
                    string[] points         = line.Split(',');

                    int    insex      = points[0].IndexOf(":", 1);
                    string removeText = points[0].Remove(0, insex + 1);
                    pointsFromFile.PointX = int.Parse(removeText);

                    insex                 = points[1].IndexOf(":", 1);
                    removeText            = points[1].Remove(0, insex + 1);
                    pointsFromFile.PointY = int.Parse(removeText);

                    insex                 = points[2].IndexOf(":", 1);
                    removeText            = points[2].Remove(0, insex + 1);
                    pointsFromFile.PointZ = int.Parse(removeText);
                    loadPath.AddPoints(pointsFromFile);


                    loadedPath.Add(loadPath);
                    loadPath = new Path();
                    line     = reader.ReadLine();
                }
            }
            foreach (var item in loadedPath)
            {
                item.PrintPoint();
            }
        }
Ejemplo n.º 4
0
        public static void LoadPath()
        {
            Path loadPath = new Path();
            List<Path> loadedPath = new List<Path>();
            using (StreamReader reader = new StreamReader(@"../../PathssLoad.txt"))
            {
                string line = reader.ReadLine();
                while (line != null)
                {

                    Point3D pointsFromFile = new Point3D();
                    string[] points = line.Split(',');

                    int insex = points[0].IndexOf(":", 1);
                    string removeText = points[0].Remove(0, insex + 1);
                    pointsFromFile.PointX = int.Parse(removeText);

                    insex = points[1].IndexOf(":", 1);
                    removeText = points[1].Remove(0, insex + 1);
                    pointsFromFile.PointY = int.Parse(removeText);

                    insex = points[2].IndexOf(":", 1);
                    removeText = points[2].Remove(0, insex + 1);
                    pointsFromFile.PointZ = int.Parse(removeText);
                    loadPath.AddPoints(pointsFromFile);

                    loadedPath.Add(loadPath);
                    loadPath = new Path();
                    line = reader.ReadLine();
                }
            }
            foreach (var item in loadedPath)
            {
                item.PrintPoint();
            }
        }