コード例 #1
0
ファイル: LASPointTest.cs プロジェクト: GEO-IASS/libLAS
        public void PointValid()
        {
            LASPoint pointB = new LASPoint();
            pointB.X = 23.0;

            Assert.IsTrue(point.IsValid());
            Assert.IsTrue(pointB.IsValid());
        }
コード例 #2
0
ファイル: LASWriter.cs プロジェクト: folsom-labs/libLAS-old
        /// <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;
            }
        }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
ファイル: LASReader.cs プロジェクト: GeospatialDaryl/libLAS
        /// <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;
            }
        }
コード例 #5
0
        /// <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);
            }
        }
コード例 #6
0
        /// <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);
            }
        }
コード例 #7
0
ファイル: LASPointTest.cs プロジェクト: GEO-IASS/libLAS
        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));
        }
コード例 #8
0
ファイル: WriteLAS.cs プロジェクト: GeospatialDaryl/libLAS
        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();
        }
コード例 #9
0
        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;
            }
        }
コード例 #10
0
ファイル: LASWriter.cs プロジェクト: GeospatialDaryl/libLAS
        /// <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;
            }
        }
コード例 #11
0
ファイル: LASPointTest.cs プロジェクト: GEO-IASS/libLAS
        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);
        }
コード例 #12
0
ファイル: LASPoint.cs プロジェクト: abellgithub/libLAS
 /// <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;
     }
 }
コード例 #13
0
ファイル: LASReader.cs プロジェクト: abellgithub/libLAS
        /// <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;
            }
        }
コード例 #14
0
ファイル: LASReader.cs プロジェクト: abellgithub/libLAS
        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;
            }
        }