예제 #1
0
        public static ShapeContent ReadAnonymous(BinaryReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            var shapeTypeAsBytes = reader.ReadBytes(4);
            var shapeType        = EndianBitConverter.ToInt32LittleEndian(shapeTypeAsBytes);

            if (!Enum.IsDefined(typeof(ShapeType), shapeType))
            {
                throw new ShapeRecordContentException("The Shape Type field does not contain a known type of shape.");
            }

            var content = NullShapeContent.Instance;

            switch ((ShapeType)shapeType)
            {
            case ShapeType.NullShape:
                break;

            case ShapeType.Point:
                content = PointShapeContent.ReadAnonymousPointGeometry(reader);
                break;

            case ShapeType.PolyLineM:
                content = PolyLineMShapeContent.ReadAnonymousPolyLineMGeometry(reader);
                break;

            default:
                throw new ShapeRecordContentException($"The Shape Type {shapeType} is currently not suppported.");
            }

            return(content);
        }