Example #1
0
 public static IEnumerable <Vector3d> LoadXYZFile(string fileName)
 {
     using (var filestream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite)) {
         using (var streamReader = new System.IO.StreamReader(filestream, System.Text.Encoding.UTF8, true, 128)) {
             while (!streamReader.EndOfStream)
             {
                 var line = streamReader.ReadLine();
                 yield return(XYZLoader.parseLine(line));
             }
         }
     }
 }
Example #2
0
    private void loadXYZFile()
    {
        var points = XYZLoader.LoadXYZFile(this.FileInfo.FullName).ToList();

        this.Center = new double[] {
            0.5d * (points.Max(p => p.x) + points.Min(p => p.x)),
            0.5d * (points.Max(p => p.z) + points.Min(p => p.z))
        };

        this.Points = points.Select(p => new Vector3((float)(p.x - this.Center[0]), (float)(p.y), (float)(p.z - this.Center[1]))).ToArray();

        this.findGroundPoint();
    }
Example #3
0
    private void loadPointFile()
    {
        this.Center = this.Metadata.center;
        this.Points = XYZLoader.LoadPointFile(this.FileInfo.FullName, this.Metadata);
        this.findGroundPoint();
        int shapeLength = this.Metadata.shape.Length / 2;

        if (this.Metadata.shape[0] == this.Metadata.shape[2 * (shapeLength - 1)] && this.Metadata.shape[1] == this.Metadata.shape[2 * (shapeLength - 1) + 1])
        {
            shapeLength--;
        }
        this.Shape = new Vector2[shapeLength];
        for (int i = 0; i < shapeLength; i++)
        {
            this.Shape[i] = new Vector2((float)(this.Metadata.shape[i * 2] - this.Center[0]), (float)(this.Metadata.shape[i * 2 + 1] - this.Center[1]));
        }
    }
Example #4
0
 private void processXYZFile(string filename)
 {
     foreach (var point in XYZLoader.LoadContinuous(filename))
     {
         foreach (var polygon in this.shapes.GetByPoint(point))
         {
             if (polygon.Contains(point))
             {
                 this.addPoint(polygon, point);
                 hits++;
             }
         }
         points++;
         if (points % 100 == 0 && (DateTime.Now - lastUpdate).TotalSeconds > 1)
         {
             this.printStatus();
         }
     }
     this.files++;
 }
Example #5
0
 public static Vector3[] LoadFile(string fileName)
 {
     return(File.ReadAllLines(fileName).Select(line => XYZLoader.parseLine(line)).ToArray());
 }