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


C# Path.AddPoints方法代码示例

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


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

示例1: Main

        static void Main()
        {
            // Create a new point
            var pointA = new Point3D() { X = 1, Y = 2, Z = 3 };

            // Call static override ToString()
            Console.WriteLine("Base point O:");
            Console.WriteLine(Point3D.BasePoint);

            Console.WriteLine("---------");
            // Calculate distance bw point and basePoint(X=0, Y=0, Z=0)
            var distance = Distance.CalculateDistance(pointA, Point3D.BasePoint);
            Console.WriteLine("Distance between pointA {0} and pointB {1} \nis {2}", pointA, Point3D.BasePoint, distance);

            // Add some points
            Path storage = new Path();
            for (int i = 1; i < 8; i++)
            {
                storage.AddPoints(new Point3D() { X = i, Y = i + 3, Z = i * 2 });
            }

            PathStorage.SavePath(storage, "..//..//Common/sample.txt"); // saving points to file "sample.txt"
            Console.WriteLine("Stored points:");
            PathStorage.LoadPath("..//..//Common/sample.txt"); // read the points
        }
开发者ID:deskuuu,项目名称:TelerikAcademy,代码行数:25,代码来源:TestUp.cs

示例2: Main

        static void Main()
        {
            Point3D p = Point3D.StartPoint;
            Point3D q = new Point3D(1, 2, 3);
            System.Console.WriteLine("Distance: {0:F4}", DistanceCalculator.Calculate(p, q));

            Path path = new Path();
            path.AddPoints(p, q);
            System.Console.WriteLine(path);

            PathStorage.Save(path, "firstPath");
            System.Console.WriteLine(PathStorage.Load("firstPath"));
            System.Console.WriteLine(PathStorage.Load("somePath"));
        }
开发者ID:RuzmanovDev,项目名称:TelerikAcademy,代码行数:14,代码来源:Test.cs

示例3: LoadPath

 public static Path LoadPath()
 {
     StreamReader fileReader = new StreamReader("input.txt");
     string path = null;
     using (fileReader)
     {
         path = fileReader.ReadToEnd();
     }
     if (path != null)
     {
         Path newPath = new Path();
         newPath.AddPoints(path);
         return newPath;
     }
     else
     {
         throw new NullReferenceException("The file is empty");
     }
 }
开发者ID:Nikolai-Aleksiev,项目名称:Telerik-Academy-HomeWorks,代码行数:19,代码来源:PointsStorage.cs

示例4: LoadPath

    public static List<Path> LoadPath()
    {
        List<Path> paths = new List<Path>();
        try
        {
            StreamReader reader = new StreamReader("Storage.txt");
            using (reader)
            {
                string line = reader.ReadLine();
                while (line!=null)
                {
                    string[] arr = line.Split(' ');
                    Path pa = new Path();
                    foreach (string st in arr)
                    {
                        if (st!=string.Empty)
                        {
                            int x = (int)(st[0] - 48);
                            int y = (int)(st[2] - 48);
                            int z = (int)(st[4] - 48);
                            pa.AddPoints(new Point3D(x, y, z));
                        }
                    }
                    paths.Add(pa);
                    line = reader.ReadLine();

                }
            }
        }
        catch (IOException io)
        {
            Console.WriteLine("Error!" + io.Message);
        }
        catch
        {
            Console.WriteLine("Unknown error!");
        }
        return paths;
    }
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:39,代码来源:PathStorage.cs

示例5: Main

 static void Main()
 {
     Path newPath = new Path();
     string path = "(1 2 3), (3 4 5), (8 9 10)";
     newPath.AddPoints(path);
     point3D newPoint = new point3D(13, 22, 4);
     newPath.AddPoint(newPoint);
     PointsStorage.SavePath(newPath);
     Path loadedPath = PointsStorage.LoadPath();
     foreach (var item in loadedPath.Points)
     {
         Console.WriteLine(item);
     }
 }
开发者ID:Nikolai-Aleksiev,项目名称:Telerik-Academy-HomeWorks,代码行数:14,代码来源:Point3DTest.cs


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