예제 #1
0
        /// <summary>
        /// Try to parse the given text to a Geometry object.
        /// </summary>
        /// <param name="text">Text to parse.</param>
        /// <param name="targetValue">Geometry to return.</param>
        /// <returns>True if succeeds, false if not.</returns>
        private static bool TryUriStringToGeometry(string text, out Geometry targetValue)
        {
            if (!TryRemoveLiteralPrefix(ExpressionConstants.LiteralPrefixGeometry, ref text))
            {
                targetValue = default(Geometry);
                return(false);
            }

            if (!TryRemoveQuotes(ref text))
            {
                targetValue = default(Geometry);
                return(false);
            }

            try
            {
                targetValue = LiteralUtils.ParseGeometry(text);
                return(true);
            }
            catch (ParseErrorException)
            {
                targetValue = default(Geometry);
                return(false);
            }
        }
예제 #2
0
 private static bool TryUriStringToGeometry(string text, out Geometry targetValue)
 {
     if (!TryRemoveLiteralPrefix("geometry", ref text))
     {
         targetValue = null;
         return(false);
     }
     if (!TryRemoveQuotes(ref text))
     {
         targetValue = null;
         return(false);
     }
     try
     {
         targetValue = LiteralUtils.ParseGeometry(text);
         return(true);
     }
     catch (ParseErrorException)
     {
         targetValue = null;
         return(false);
     }
 }