Exemplo n.º 1
0
        /// <summary>
        /// Returns the extent of the provided geometries
        /// </summary>
        /// <param name="geometries">The geometries to calculate the extent from.</param>
        /// <returns>The geometries extent. </returns>
        public static ILucidExtent CalculateExtent(params ILucidGeometry[] geometries)
        {
            ILucidExtent extentOut  = new LucidExtent();
            bool         initialSet = false;
            int          count      = 0;

            foreach (var geometry in geometries)
            {
                foreach (var point in geometry.Vertices)
                {
                    count++;
                    var x = point.X;
                    var y = point.Y;

                    if (!initialSet)
                    {
                        extentOut.XMax = extentOut.XMin = x;
                        extentOut.YMax = extentOut.YMin = y;

                        initialSet = true;
                    }
                    else
                    {
                        if (extentOut.XMin > x)
                        {
                            extentOut.XMin = x;
                        }

                        if (extentOut.XMax < x)
                        {
                            extentOut.XMax = x;
                        }

                        if (extentOut.YMin > y)
                        {
                            extentOut.YMin = y;
                        }

                        if (extentOut.YMax < y)
                        {
                            extentOut.YMax = y;
                        }
                    }
                }
            }

            if (count == 1)
            {
                extentOut = GeometryHelper.Buffer(extentOut, .5);
            }


            return(extentOut);
        }
Exemplo n.º 2
0
 public ILucidExtent Buffer(double bufferSize)
 {
     return(GeometryHelper.Buffer(this, bufferSize));
 }