本文整理汇总了C#中Path.AddPointInList方法的典型用法代码示例。如果您正苦于以下问题:C# Path.AddPointInList方法的具体用法?C# Path.AddPointInList怎么用?C# Path.AddPointInList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path.AddPointInList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadPaths
// Load path Method
public static List<Path> LoadPaths()
{
Path newPath = new Path();
List<Path> listOfPaths = new List<Path>();
StreamReader reader = new StreamReader("../../LoadPoints.txt");
using (reader)
{
string line = reader.ReadLine();
while (line != null)
{
if (line != "end")
{
Point3D point = new Point3D();
string[] points = line.Split(',');
point.x = int.Parse(points[0]);
point.y = int.Parse(points[1]);
point.z = int.Parse(points[2]);
newPath.AddPointInList(point);
}
else
{
listOfPaths.Add(newPath);
newPath = new Path();
}
line = reader.ReadLine();
}
}
return listOfPaths;
}
示例2: Main
static void Main(string[] args)
{
Point3D a = new Point3D(1, 1, 1);
Point3D b = new Point3D(2, 2, 2);
//Console.WriteLine(PointDistance.Distance(a, b));
// Saving list of points in a text file
Path file = new Path();
file.AddPointInList(a);
file.AddPointInList(b);
PathStorage.SavePaths(file);
// Loading list of points from a text file
List<Path> listOfPaths = PathStorage.LoadPaths();
foreach (var path in listOfPaths)
{
Console.WriteLine("Point List:");
foreach (var point in path.ListOfPoints)
{
Console.WriteLine(point);
}
}
}