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));
}