当前位置: 首页>>代码示例>>C#>>正文


C# Path.AddPoint方法代码示例

本文整理汇总了C#中Path.AddPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Path.AddPoint方法的具体用法?C# Path.AddPoint怎么用?C# Path.AddPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path.AddPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main()
    {
        Point3D firstPoint = new Point3D(1, 2, 3);
        Point3D secondPoint = new Point3D(10, 20, 30);
        Point3D thirdPoint = new Point3D(40, 50, 60);

        double distanceBetweenPoints = Distance3D.CalcDistance(firstPoint, secondPoint);
        Console.WriteLine(distanceBetweenPoints);

        Path pathOne = new Path();
        pathOne.AddPoint(firstPoint);
        pathOne.AddPoint(secondPoint);
        pathOne.AddPoint(thirdPoint);

        Path pathTwo = new Path();
        pathTwo.AddPoint(thirdPoint);
        pathTwo.AddPoint(firstPoint);
        pathTwo.AddPoint(secondPoint);

        PathStorage.SavePath(pathOne);
        PathStorage.SavePath(pathTwo);

        List<Path> pathList = PathStorage.LoadPath();
        foreach (var point in pathList)
        {
            Console.WriteLine("Path loaded!");
        }
    }
开发者ID:powerslider,项目名称:TelerikAcademyHomeworks,代码行数:28,代码来源:TestProgram.cs

示例2: Main

    static void Main(string[] args)
    {
        Console.WriteLine("# Testing distance");

        Console.WriteLine("Distance: {0}", Distance.Calc(new Point3D(1, 2, 13), Point3D.Zero));

        Console.WriteLine("# Testing path");
        Point3D firstPoint = new Point3D(1,2,3);
        Point3D secondPoint = new Point3D(2,4,2);
        Point3D thirdPoint = new Point3D(3,4,5);
        Path firstPath = new Path();
        firstPath.AddPoint(firstPoint);
        firstPath.AddPoint(secondPoint);
        firstPath.AddPoint(thirdPoint);
        PathStorage.Write(firstPath);
        List<Path> pathList = PathStorage.Read();
        foreach (var path in pathList)
        {
            Console.WriteLine("-----Path Start-------");
            foreach (var pointers in path.Points)
            {
                Console.WriteLine("{0}", pointers);
            }

            Console.WriteLine("-----Path End-------");
        }

        //Point3D point = new Point3D(1,2,3);
        //Console.WriteLine("The coordinates of the point are: ({0},{1},{2})", point.X, point.Y, point.Z);
    }
开发者ID:pepakam,项目名称:TelerikAcademy,代码行数:30,代码来源:Program.cs

示例3: Main

        static void Main(string[] args)
        {
            Point3D firstPoint = new Point3D(3, 4, 5);

            // Testing ToString
            Console.WriteLine(firstPoint);

            Point3D secondPoint = new Point3D(2, 3, 4);
            Point3D thirdPoint = new Point3D(6, 7, 8);

            Path firstPath = new Path();
            firstPath.AddPoint(firstPoint);
            firstPath.AddPoint(secondPoint);
            firstPath.AddPoint(thirdPoint);

            Path secondPath = new Path();
            Point3D fourthPoint = new Point3D(20, 21, 22);
            Point3D fifthPoint = new Point3D(23, 24, 25);
            Point3D sixthPoint = new Point3D(26, 27, 28);
            Point3D seventhPoint = new Point3D(29, 30, 31);

            secondPath.AddPoint(fourthPoint);
            secondPath.AddPoint(fifthPoint);
            secondPath.AddPoint(sixthPoint);
            secondPath.AddPoint(seventhPoint);

            //double distance = Distance.CalculateDistance(firstPoint, secondPoint);

            //Console.WriteLine(distance);

            //PathStorage.SaveToFile(firstPath);
            //PathStorage.SaveToFile(secondPath);

            //PathStorage.LoadFromFile();
        }
开发者ID:rnikiforova,项目名称:TelerikAcademy,代码行数:35,代码来源:Program.cs

示例4: Main

    static void Main()
    {
        Point3D point = new Point3D(1, 2, 3);
        Point3D pointTwo = new Point3D(3, 4, 5);
        //Console.WriteLine(Distance3D.DistanceCalc(point, pointTwo));
        //Console.WriteLine(point);
        //Console.WriteLine(Point3D.Zero);
        Console.WriteLine(Point3D.zero);

        Path firstPath = new Path();
        firstPath.AddPoint(pointTwo);
        firstPath.AddPoint(point);
        firstPath.AddPoint(pointTwo);

        PathStorage.SavePath(firstPath);
        List<Path> pathList = PathStorage.LoadPath();
        foreach (var path in pathList)
        {
            Console.WriteLine("-----Path Start-------");
            foreach (var pointers in path.Paths)
            {
                Console.WriteLine(pointers);
            }
            Console.WriteLine("-----Path End-------");

        }

        //foreach (var item in firstPath.Paths)
        //{
        //    Console.WriteLine(item);
        //}
    }
开发者ID:Jarolim,项目名称:HomeWork,代码行数:32,代码来源:Program.cs

示例5: Main

 static void Main()
 {
     //Task 1 test
     Console.WriteLine("Task 1 test:");
     Point3D justPoint = new Point3D();
     Console.WriteLine(justPoint.ToString());
     justPoint = new Point3D(1, 2, 3);
     Console.WriteLine(justPoint.ToString());
     Console.WriteLine();
     Console.WriteLine("Task 2 test:");
     //Task 2 test
     justPoint = Point3D.Point0;
     Console.WriteLine(justPoint.ToString());
     Console.WriteLine();
     Console.WriteLine("Task 3 test:");
     //Task 3 test
     Point3D otherPoint = new Point3D(1, 2, 3);
     Console.WriteLine(Space3D.CalculateDistance(justPoint, otherPoint));
     Console.WriteLine();
     Console.WriteLine("Task 4 test:");
     //Task 4 test
     Path firstPath = new Path();
     firstPath.AddPoint(justPoint);
     firstPath.AddPoint(otherPoint);
     Path secondPath = new Path();
     secondPath.AddPoint(11, 22, 33);
     secondPath.AddPoint(77, 88, 99);
     secondPath.AddPoint(55, 31, 73);
     PathStorage.AddPath(firstPath);
     PathStorage.AddPath(secondPath);
     Console.WriteLine(PathStorage.PrintAllPaths());
     PathStorage.LoadFromFile("3Dpaths.txt");
     //PathStorage.SaveToFile("result.txt");
     Console.WriteLine(PathStorage.PrintAllPaths());
 }
开发者ID:KirilToshev,项目名称:Projects,代码行数:35,代码来源:Point3DTest.cs

示例6: Main

 private static void Main()
 {
     Point3D point = new Point3D(2, 4, 6);
     Point3D pointTwo = new Point3D(8, 5, 3);
     Console.WriteLine("First point:");
     Console.WriteLine(point.ToString());
     Console.WriteLine();
     Console.WriteLine("Second point:");
     Console.WriteLine(pointTwo.ToString());
     Console.WriteLine();
     Console.WriteLine("Distance:");
     Console.WriteLine(DistanceTwo3DPoints.CalcDistance(point, pointTwo));
     Console.WriteLine();
     Console.WriteLine("Center of coordinate system:");
     Console.WriteLine(Point3D.zero.ToString());
     Console.WriteLine();
     Console.WriteLine("Writing in file \"Paths.txt\" first point, second point, first point again!");
     Path firstPath = new Path();
     firstPath.AddPoint(pointTwo);
     firstPath.AddPoint(point);
     firstPath.AddPoint(pointTwo);
     PathStorage.SavePath(firstPath);
     Console.WriteLine("File is saved");
     Console.WriteLine();
     Console.WriteLine("Loading points from file \"Paths.txt\"");
     List<Path> pathList = PathStorage.LoadPath();
     foreach (var path in pathList)
     {
         foreach (var pointers in path.Paths)
         {
             Console.WriteLine(pointers);
         }
     }
 }
开发者ID:kancho-kanchev,项目名称:Telerik,代码行数:34,代码来源:00.Point3dProject.cs

示例7: PathStoreTest

        public void PathStoreTest()
        {
            Path pathTest = new Path();
            pathTest.AddPoint(new Point3D(1, 1, 1));
            pathTest.AddPoint(new Point3D(2, 2, 2));

            Assert.AreEqual(2, pathTest.AllPoints.Count);
        }
开发者ID:HansS,项目名称:TelerikAcademy-homework,代码行数:8,代码来源:UnitTest1.cs

示例8: Main

    static void Main()
    {
        Path path = new Path();
        path.AddPoint(new Point3D(1, 2, 4));
        path.AddPoint(new Point3D(3, 8, 12));
        path.AddPoint(new Point3D(0, -1, 3));
        path.AddPoint(new Point3D(-3, 2, 0));

        PathStorage.SavePath(path);
        PathStorage.LoadPath();

        path.PrintPathList();
    }
开发者ID:Nikolay-D,项目名称:TelerikSchoolAcademy,代码行数:13,代码来源:SaveAndLoad3DPoints(Main).cs

示例9: Main

 static void Main()
 {
     Path path = new Path();
     path.AddPoint(new Point(1, 2, 3));
     path.AddPoint(Point.CoordStart);
     path.AddPoint(new Point(4, 5, 6));
     path.AddPoint(new Point(7, 8, 9));
     path.AddPoint(new Point(11, 12, 13));
     Console.WriteLine(path.ToString());
     string filePath = @"..\..\save.txt";
     PathStorage.SavePath(filePath, path);
     Path pathLoad = PathStorage.LoadPath(filePath);
     Console.WriteLine(pathLoad.ToString());
 }
开发者ID:NasC0,项目名称:Telerik_Homework,代码行数:14,代码来源:PathTest.cs

示例10: Main

        static void Main()
        {
            Point3D point = new Point3D(1, 2, 3);

            Console.WriteLine(point);
            Console.WriteLine(Point3D.PointZero);
            Console.WriteLine();

            var distance = CalculateDistanceBetweenTwoPoints.CalculateDistance(point, Point3D.PointZero);

            var path = new Path();
            for (int i = 0; i < 10; i++)
            {
                path.AddPoint(new Point3D() { X = i, Y = i * 2, Z = i + 3 });
            }

            string filePath = @"../../path.txt";

            PathStorage.SavePath(path, filePath);

            var fromFile = PathStorage.LoadPath(filePath);

            foreach (var p in fromFile)
            {
                Console.WriteLine(point);
            }
        }
开发者ID:antonpopov,项目名称:Object-Oriented-Programming,代码行数:27,代码来源:ESpaceMain.cs

示例11: Load

    // load file
    public static Path Load()
    {
        Path currentPath = new Path();
        using(reader)
        {
            string line = reader.ReadLine();
            while (line != null)
            {
                string[] num = line.Split(' ');

                Point3D currentPoint = new Point3D()
                {
                    X = double.Parse(num[0]),
                    Y = double.Parse(num[1]),
                    Z = double.Parse(num[2])
                };

                currentPath.AddPoint();

                line = reader.ReadLine();
            }
        }

        return currentPath;
    }
开发者ID:Hri100v,项目名称:Telerik-Academy,代码行数:26,代码来源:PathStorage.cs

示例12: LoadPoint

    // Loading the points from file
    public static void LoadPoint()
    {
        StreamReader loadPath = new StreamReader(savedPaths);
        Path loadedPath = new Path();

        using (loadPath)
        {
            string line = loadPath.ReadLine();
            while (line != null)
            {
                string[] currentLine = line.Split(new char[] { ' ', ',', '=' }, StringSplitOptions.RemoveEmptyEntries);

                Point3D currentPath = new Point3D(int.Parse(currentLine[1]),
                                                  int.Parse(currentLine[3]),
                                                  int.Parse(currentLine[5]));
                loadedPath.AddPoint(currentPath);

                line = loadPath.ReadLine();
            }
        }

        // Printing
        foreach (var path in loadedPath.PathList)
        {
            Console.WriteLine(path);
        }
    }
开发者ID:unbelt,项目名称:Telerik,代码行数:28,代码来源:PathStorage.cs

示例13: LoadPath

    public static List<Path> LoadPath()
    {
        Path loadedPath = new Path();
        List<Path> allPaths = new List<Path>();
        StreamReader reader = new StreamReader("SavedPaths.txt");
        using (reader)
        {
            string line = reader.ReadLine();
            while (line != null)
            {
                if (line != "-")
                {
                    Point3D point = new Point3D();
                    string[] pointCoords = line.Split(',');
                    point.X = int.Parse(pointCoords[0]);
                    point.Y = int.Parse(pointCoords[1]);
                    point.Z = int.Parse(pointCoords[2]);
                    loadedPath.AddPoint(point);

                    line = reader.ReadLine();
                }
                else
                {
                    loadedPath.ClearPath();
                }
                allPaths.Add(loadedPath);
            }
        }
        return allPaths;
    }
开发者ID:powerslider,项目名称:TelerikAcademyHomeworks,代码行数:30,代码来源:PathStorage.cs

示例14: LoadPathOfFile

    public static Path LoadPathOfFile(string fileName)
    {
        Path path = new Path();

        using (StreamReader sr = new StreamReader(fileName))
        {
            string input = sr.ReadToEnd();

            string pattern = "{([\\d,.]+), ([\\d,.]+), ([\\d,.]+)}";

            var reg = new Regex(pattern);
            var matchs = reg.Matches(input);

            if (matchs.Count <= 0)
            {
                throw new ApplicationException("Invalid data in file " + fileName);
            }

            foreach (Match match in matchs)
            {
                double x = double.Parse(match.Groups[1].Value);
                double y = double.Parse(match.Groups[2].Value);
                double z = double.Parse(match.Groups[3].Value);

                Point p = new Point(x, y, z);
                path.AddPoint(p);
            }
        }

        return path;
    }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:31,代码来源:Storage.cs

示例15: LoadPath

 public static List<Path> LoadPath()
 {
     Path loadPath = new Path();
     List<Path> pathsLoaded = new List<Path>();
     using (StreamReader reader = new StreamReader(@"../../PathLoads.txt"))
     {
         string line = reader.ReadLine();
         while (line != null)
         {
             if (line != "-")
             {
                 Point3D point = new Point3D();
                 string[] points = line.Split(',');
                 point.pointX = int.Parse(points[0]);
                 point.pointY = int.Parse(points[1]);
                 point.pointZ = int.Parse(points[2]);
                 loadPath.AddPoint(point);
             }
             else
             {
                 pathsLoaded.Add(loadPath);
                 loadPath = new Path();
             }
             line = reader.ReadLine();
         }
     }
     return pathsLoaded;
 }
开发者ID:veselaparvanova,项目名称:MyTelerikProjectsAndHomeworks,代码行数:28,代码来源:PathStorage.cs


注:本文中的Path.AddPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。