public void GetGeometry() { SqlGeometry polygonGeometry; WebLinearRing linearRing; WebPolygon polygon; linearRing = new WebLinearRing(); linearRing.Points = new List <WebPoint>(); linearRing.Points.Add(new WebPoint(2, 2)); linearRing.Points.Add(new WebPoint(4, 1)); linearRing.Points.Add(new WebPoint(5, 4)); linearRing.Points.Add(new WebPoint(2, 2)); polygon = new WebPolygon(); polygon.LinearRings = new List <WebLinearRing>(); polygon.LinearRings.Add(linearRing); polygonGeometry = polygon.GetGeometry(); Assert.IsNotNull(polygonGeometry); }
/// <summary> /// Test if point is located inside polygon. /// Currently only two dimensions are handled. /// </summary> /// <param name="polygon">This polygon.</param> /// <param name='point'>Point.</param> /// <returns>True if point is located inside polygon.</returns> public static Boolean IsPointInsideGeometry(this WebPolygon polygon, WebPoint point) { return(polygon.GetGeometry().STContains(point.GetGeometry()).Value); }