Ejemplo n.º 1
0
        static WknMultiPoint ParseMultiPoint(byte[] wkb, ref int pos)
        {
            if (wkb[pos] != 1)
            {
                throw new Exception("Sorry, only Little Endian format is supported");
            }
            var type = BitConverter.ToUInt32(wkb, pos + 1);

            if (type != (uint)WknGeometryType.WknMultiPoint)
            {
                throw new Exception("Invalid object type");
            }
            var nbPoints = BitConverter.ToUInt32(wkb, pos + 5);

            pos += 9;

            var points = new WknPoint[nbPoints];

            for (var i = 0; i < nbPoints; ++i)
            {
                points[i] = ParsePoint(wkb, ref pos);
            }

            return(new WknMultiPoint(points));
        }
Ejemplo n.º 2
0
 static void AppendPoint(BinaryWriter wrt, WknPoint point)
 {
     wrt.Write(LittleEndian);
     wrt.Write((uint)WknGeometryType.WknPoint);
     wrt.Write(point.P.X);
     wrt.Write(point.P.Y);
 }