Ejemplo n.º 1
0
        private object ParseMultiPoint(WktTokenQueue tokens)
        {
            tokens.Dequeue("MULTIPOINT");
            var dimensions = ParseDimensions(tokens);

            if (tokens.NextTokenIs("EMPTY"))
            {
                tokens.Dequeue();
                return(_shapeConverter.ToMultiPoint(new CoordinateInfo[0]));
            }

            tokens.Dequeue(WktTokenType.LeftParenthesis);


            var points = new List <CoordinateInfo> {
                ParseMultiPointCoordinate(tokens, dimensions)
            };

            while (tokens.NextTokenIs(WktTokenType.Comma))
            {
                tokens.Dequeue();
                points.Add(ParseMultiPointCoordinate(tokens, dimensions));
            }

            tokens.Dequeue(WktTokenType.RightParenthesis);

            return(_shapeConverter.ToMultiPoint(points.ToArray()));
        }
        private bool TryParseMultiPoint(RavenJObject obj, out object result)
        {
            RavenJToken coord;

            if (obj.TryGetValue("coordinates", out coord))
            {
                var coordinates = coord as RavenJArray;
                CoordinateInfo[] co;
                if (coordinates != null && TryParseCoordinateArray(coordinates, out co))
                {
                    result = _shapeConverter.ToMultiPoint(co);
                    return(true);
                }
            }
            result = null;
            return(false);
        }