protected internal Worker(CascadedPolygonUnion tool, IList geoms, int start, int end)
 {
     this.tool  = tool;
     this.geoms = geoms;
     this.start = start;
     this.end   = end;
 }
Beispiel #2
0
        ///<summary>
        /// Gets the union of the input geometries.
        /// If no input geometries were provided, a POINT EMPTY is returned.
        ///</summary>
        ///<returns>a Geometry containing the union</returns>
        /// <returns>an empty GEOMETRYCOLLECTION if no geometries were provided in the input</returns>
        public IGeometry Union()
        {
            if (_geomFact == null)
            {
                return(null);
            }

            IGeometry unionPoints = null;

            if (_points.Count > 0)
            {
                IGeometry ptGeom =
                    _geomFact.BuildGeometry(convertPoints(_points).ToList());
                unionPoints = UnionNoOpt(ptGeom);
            }

            IGeometry unionLines = null;

            if (_lines.Count > 0)
            {
                IGeometry lineGeom = _geomFact.BuildGeometry(convertLineStrings(_lines).ToList());
                unionLines = UnionNoOpt(lineGeom);
            }

            IGeometry unionPolygons = null;

            if (_polygons.Count > 0)
            {
                unionPolygons = CascadedPolygonUnion.Union(_polygons);
            }

            /**
             * Performing two unions is somewhat inefficient,
             * but is mitigated by unioning lines and points first
             */
            IGeometry unionLA = UnionWithNull(unionLines, unionPolygons);
            IGeometry union   = null;

            if (unionPoints == null)
            {
                union = unionLA;
            }
            else if (unionLA == null)
            {
                union = unionPoints;
            }
            else
            {
                union = PointGeometryUnion.Union((IPoint)unionPoints, unionLA);
            }

            if (union == null)
            {
                return(_geomFact.CreateGeometryCollection(null));
            }

            return(union);
        }
        public static IGeometry Union(ICollection polys)
        {
            var op = new CascadedPolygonUnion(polys);

            return(op.Union());
        }
 public static IGeometry Union(ICollection polys)
 {
     var op = new CascadedPolygonUnion(polys);
     return op.Union();
 }
 protected internal Worker(CascadedPolygonUnion tool, IList geoms, int start, int end)
 {
     this.tool = tool;
     this.geoms = geoms;
     this.start = start;
     this.end = end;
 }