public void GeographyWorksWithTwoDimensions() { GeographyPoint geographyPoint = LiteralUtils.ParseGeography("POINT(10 30)") as GeographyPoint; geographyPoint.Latitude.ShouldBe(30.0); geographyPoint.Longitude.ShouldBe(10.0); }
public void GeometryWorksWithTwoDimensions() { GeometryPoint geometryPoint = LiteralUtils.ParseGeometry("POINT(10 30)") as GeometryPoint; geometryPoint.X.ShouldBe(10.0); geometryPoint.Y.ShouldBe(30.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> /// <param name="reason">The detailed reason of parsing error.</param> /// <returns>True if succeeds, false if not.</returns> private static bool TryUriStringToGeometry(string text, out Geometry targetValue, out string reason) { reason = null; 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 e) { targetValue = default(Geometry); reason = e.Message; return(false); } }
/// <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> /// <param name="parsingFailureReasonException">The detailed reason of parsing error.</param> /// <returns>True if succeeds, false if not.</returns> private static bool TryUriStringToGeometry(string text, out Geometry targetValue, out UriLiteralParsingException parsingFailureReasonException) { parsingFailureReasonException = null; if (!UriParserHelper.TryRemoveLiteralPrefix(ExpressionConstants.LiteralPrefixGeometry, ref text)) { targetValue = default(Geometry); return(false); } if (!UriParserHelper.TryRemoveQuotes(ref text)) { targetValue = default(Geometry); return(false); } try { targetValue = LiteralUtils.ParseGeometry(text); return(true); } catch (ParseErrorException e) { targetValue = default(Geometry); parsingFailureReasonException = new UriLiteralParsingException(e.Message); return(false); } }
public void GeographyWorksWithTwoDimensions() { GeographyPoint geographyPoint = LiteralUtils.ParseGeography("POINT(10 30)") as GeographyPoint; Assert.Equal(30.0, geographyPoint.Latitude); Assert.Equal(10.0, geographyPoint.Longitude); Assert.Null(geographyPoint.Z); Assert.Null(geographyPoint.M); }
public void GeometryWorksWithTwoDimensions() { GeometryPoint geometryPoint = LiteralUtils.ParseGeometry("POINT(10 30)") as GeometryPoint; Assert.Equal(10.0, geometryPoint.X); Assert.Equal(30.0, geometryPoint.Y); Assert.Null(geometryPoint.Z); Assert.Null(geometryPoint.M); }