Simply3DScan
WriterAsc.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
2 using System.IO;
3 using SharedObjects;
4 
5 namespace PointWriter
6 {
7  // Example:
8  //178 56 456
9 
13  public class WriterAsc : IPointWriter
14  {
18  private readonly List<ColorPoint3D> points = new List<ColorPoint3D>();
19 
24  [LogException]
25  public void AddPoint(ColorPoint3D point)
26  {
27  this.points.Add(point);
28  }
29 
34  [Log]
35  [LogException]
36  public void Write(string fileName)
37  {
38  System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
39  customCulture.NumberFormat.NumberDecimalSeparator = ".";
40  System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
41  StreamWriter streamWriter = new StreamWriter(fileName);
42  foreach (ColorPoint3D point in this.points)
43  {
44  //todo color?
45  streamWriter.WriteLine("{0} {1} {2}", (float)point.X, (float)point.Y, (float)point.Z);
46  }
47  streamWriter.Close();
48  }
49  }
50 }
double Z
Gets or sets the z.
Definition: ColorPoint3D.cs:30
double Y
Gets or sets the y.
Definition: ColorPoint3D.cs:23
double X
Gets or sets the x.
Definition: ColorPoint3D.cs:16
void AddPoint(ColorPoint3D point)
Adds the point.
Definition: WriterAsc.cs:25
Interface for writing points to file
Definition: IPointWriter.cs:8
Write Points to Asc file
Definition: WriterAsc.cs:13
void Write(string fileName)
Writes to specified file name.
Definition: WriterAsc.cs:36