public void PointValid() { LASPoint pointB = new LASPoint(); pointB.X = 23.0; Assert.IsTrue(point.IsValid()); Assert.IsTrue(pointB.IsValid()); }
/// <summary> /// Write a new point in the LAS file /// </summary> /// <param name="point">LASPoint to write in the file</param> public void WritePoint(LASPoint point) { LASError error = NativeMethods.LASWriter_WritePoint(hwriter, point.GetPointer()); if ((Int32)error != 0) { LASException e = new LASException("Exception in Set Writer WritePoint."); throw e; } }
/// <summary> /// Compare 2 LASPoint to be equal /// </summary> /// <param name="lasPoint">LASPoint object</param> /// <returns>true if lasPoint is equals to the instance.</returns> public bool Equals(LASPoint lasPoint) { if (X == lasPoint.X && Y == lasPoint.Y && Z == lasPoint.Z) { return(true); } else { return(false); } }
/// <summary> /// Reads the next available point on the LASReaderH instance. /// </summary> /// <returns>true if we have next point</returns> public bool GetNextPoint() { IntPtr pointer = CAPI.LASReader_GetNextPoint(hReader); if (IntPtr.Zero != pointer) { laspoint = new LASPoint(pointer); return true; } else { return false; } }
/// <summary> /// Reads the next available point on the LASReaderH instance. /// </summary> /// <returns>true if we have next point</returns> public bool GetNextPoint() { IntPtr pointer = CAPI.LASReader_GetNextPoint(hReader); if (IntPtr.Zero != pointer) { laspoint = new LASPoint(pointer); return(true); } else { return(false); } }
/// <summary> /// Reads the next available point on the LASReaderH instance. /// </summary> /// <returns>true if we have next point</returns> public bool GetNextPoint() { IntPtr tmphPoint = NativeMethods.LASReader_GetNextPoint(hReader); if (IntPtr.Zero != tmphPoint) { hPoint = tmphPoint; point = new LASPoint(hPoint, false); return(true); } else { return(false); } }
public void SetPointCoordinates() { LASPoint pointB = new LASPoint(); pointB.X = 23.0; Assert.AreEqual(pointB.X, 23.0); Assert.IsFalse(point.Equals(pointB)); pointB.X = 0.0; point.X = 0.0; Assert.IsTrue(point.Equals(point)); pointB.X = 1.123; pointB.Y = 2.456; pointB.Z = 3.789; LASPoint pointC = new LASPoint(); pointC.X = 1.123; pointC.Y = 2.456; pointC.Z = 3.789; Assert.IsTrue(pointC.Equals(pointB)); }
static void Main(string[] args) { try { string filename = @".\test.las"; LASHeader hdr = new LASHeader(); hdr.VersionMajor = 1; hdr.VersionMinor = 1; hdr.DataFormatId = (byte)LASHeader.PointFormat.ePointFormat1; hdr.PointRecordsCount = 1000; // should be corrected automatically by writer LASWriter laswriter = new LASWriter(filename, hdr, LASReadWriteMode.LASModeWrite); LASPoint p=new LASPoint(); p.X = 10; p.Y = 20; p.Z = 30; laswriter.WritePoint(p); //File.Delete(filename); } catch (LASException e) { Console.WriteLine("\nLASException! Msg: {0}", e.Message); } catch (SystemException e) { Console.WriteLine("\nException! Msg: {0}", e.Message); } catch { Console.WriteLine("Unknown exception caught"); } Console.WriteLine("End of file"); Console.Read(); }
protected virtual void Dispose(bool disposing) { if (disposing) { // free managed resources if (point != null) { point.Dispose(); point = null; } } // free native resources if there are any. if (hReader != IntPtr.Zero) { NativeMethods.LASReader_Destroy(hReader); hReader = IntPtr.Zero; } if (hPoint != IntPtr.Zero) { NativeMethods.LASPoint_Destroy(hPoint); hPoint = IntPtr.Zero; } }
/// <summary> /// Write a new point in the LAS file /// </summary> /// <param name="point">LASPoint to write in the file</param> public void WritePoint(LASPoint point) { LASError error = CAPI.LASWriter_WritePoint(hwriter, point.GetPointer()); if ((Int32)error != 0) { LASException e = new LASException("Exception in Set Writer WritePoint."); throw e; } }
public void ScanFlags() { byte zeros = 0; LASPoint pointS = new LASPoint(); Assert.AreEqual(pointS.ScanFlags, zeros); pointS.ReturnNumber = 3; pointS.NumberOfReturns = 7; pointS.ScanDirection = 0; pointS.FlightLineEdge = 1; string expected = "10111011"; byte bits = pointS.ScanFlags; Assert.AreEqual(Convert.ToString(pointS.ScanFlags, 2), (expected)); LASPoint pointN; pointN = pointS.Copy(); Assert.AreEqual(pointN.ScanFlags, pointS.ScanFlags); }
/// <summary> /// Compare 2 LASPoint to be equal /// </summary> /// <param name="lasPoint">LASPoint object</param> /// <returns>true if lasPoint is equals to the instance.</returns> public bool Equals(LASPoint lasPoint) { if (X == lasPoint.X && Y == lasPoint.Y && Z == lasPoint.Z) { return true; } else { return false; } }
/// <summary> /// Reads the next available point on the LASReaderH instance. /// </summary> /// <returns>true if we have next point</returns> public bool GetNextPoint() { IntPtr tmphPoint = NativeMethods.LASReader_GetNextPoint(hReader); if (IntPtr.Zero != tmphPoint) { hPoint = tmphPoint; point = new LASPoint(hPoint, false); return true; } else { return false; } }
protected virtual void Dispose(bool disposing) { if (disposing) { // free managed resources if (point != null) { point.Dispose(); point = null; } } // free native resources if there are any. if (hReader != IntPtr.Zero) { NativeMethods.LASReader_Destroy(hReader); hReader = IntPtr.Zero; } if(hPoint != IntPtr.Zero) { NativeMethods.LASPoint_Destroy(hPoint); hPoint = IntPtr.Zero; } }