Catfood.Shapefile.ShapePoint.ShapePoint C# (CSharp) Method

ShapePoint() protected method

A Shapefile Point Shape
Thrown if shapeData is null Thrown if an error occurs parsing shapeData
protected ShapePoint ( int recordNumber, StringDictionary metadata, IDataRecord dataRecord, byte shapeData ) : System
recordNumber int The record number in the Shapefile
metadata System.Collections.Specialized.StringDictionary Metadata about the shape
dataRecord IDataRecord IDataRecord associated with the metadata
shapeData byte The shape record as a byte array
return System
        protected internal ShapePoint(int recordNumber, StringDictionary metadata, IDataRecord dataRecord, byte[] shapeData)
            : base(ShapeType.Point, recordNumber, metadata, dataRecord)
        {
            // metadata is validated by the base class
            if (shapeData == null)
            {
                throw new ArgumentNullException("shapeData");
            }

            // Note, shapeData includes an 8 byte header so positions below are +8
            // Position     Field       Value   Type        Number  Order
            // Byte 0       Shape Type  1       Integer     1       Little
            // Byte 4       X           X       Double      1       Little
            // Byte 12      Y           Y       Double      1       Little

            // validation - shapedata should be 8 + 4 + 8 + 8 = 28 bytes long
            if (shapeData.Length != 28)
            {
                throw new InvalidOperationException("Invalid shape data");
            }

            _point = new PointD(EndianBitConverter.ToDouble(shapeData, 12, ProvidedOrder.Little),
                EndianBitConverter.ToDouble(shapeData, 20, ProvidedOrder.Little));
        }
ShapePoint