Example #1
0
        public static LucidPolygon operator-(LucidPolygon first, LucidPolygon second)
        {
            throw new NotImplementedException();

            LucidPolygon intersection = null;

            if (!first.ExtentOverlaps(second))
            {
                return(null);
            }

            foreach (var segment in first.Vertices.SlidingWindow(2))
            {
                foreach (var secondSegment in second.Vertices.SlidingWindow(2))
                {
                    var point = GeometryHelper.LineIntersections(LucidLine.Create(segment), LucidLine.Create(secondSegment)).FirstOrDefault();
                    if (point != null)
                    {
                        if (intersection == null)
                        {
                            intersection = new LucidPolygon();
                        }

                        intersection += point;
                    }
                }
            }

            return(intersection);
        }
Example #2
0
        public static ILucidGeometry Create(string geometryJson)
        {
            if (geometryJson.Contains("\"x\""))
            {
                return(LucidPoint.Create(geometryJson));
            }
            if (geometryJson.Contains("\"xmax\""))
            {
                return(LucidExtent.Create(geometryJson));
            }
            if (geometryJson.Contains("\"paths\""))
            {
                return(LucidLine.Create(geometryJson));
            }
            if (geometryJson.Contains("\"rings\""))
            {
                return(LucidPolygon.Create(geometryJson));
            }

            throw new Exception($"Unrecognized geometry type {geometryJson}");
        }
Example #3
0
        /// <summary>
        /// Returns a circular buffer geometry for a point with the provided radius and vertex count.
        /// </summary>
        /// <param name="point">The point to buffer.</param>
        /// <param name="radius">The radius to buffer the point by.</param>
        /// <param name="edgeCount">The number of vertices, complexity, of the produced circular buffer.</param>
        /// <returns></returns>
        public static ILucidPolygon BufferPoint(IPoint point, double radius, int edgeCount = 24)
        {
            var path = CircularPathFromPoint(point, radius, edgeCount);

            return(LucidPolygon.Create(path.Vertices));
        }
Example #4
0
 public bool ExtentOverlaps(LucidPolygon other)
 {
     return(GeometryHelper.Intersects(this.AsExtent(), other.AsExtent()));
 }
Example #5
0
 public static LucidPolygon Create(Map geometry, LucidSpatialReference spatialReference = null)
 {
     return(LucidPolygon.Create(geometry.ToString(), spatialReference));
 }
Example #6
0
 public ILucidPolygon AsPolygon()
 {
     return(LucidPolygon.Create(Vertices, SpatialReference));
 }