public IGeometry Union() { PointLocator locater = new PointLocator(); // use a set to eliminate duplicates, as required for union #if Goletas HashSet<ICoordinate> exteriorCoords = new HashSet<ICoordinate>(); #else TreeSet exteriorCoords = new TreeSet(); #endif foreach (IPoint point in PointExtracter.GetPoints(_pointGeom)) { ICoordinate coord = point.Coordinate; Locations loc = locater.Locate(coord, _otherGeom); if (loc == Locations.Exterior) { exteriorCoords.Add(coord); } } // if no points are in exterior, return the other geom if (exteriorCoords.Count == 0) { return _otherGeom; } // make a puntal geometry of appropriate size IGeometry ptComp = null; ICoordinateSequence coords = _geomFact.CoordinateSequenceFactory.Create(exteriorCoords.ToArray()); ptComp = coords.Count == 1 ? (IGeometry)_geomFact.CreatePoint(coords.GetCoordinate(0)) : _geomFact.CreateMultiPoint(coords); // add point component to the other geometry return GeometryCombiner.Combine(ptComp, _otherGeom); }
/// <summary> /// /// </summary> /// <param name="op"></param> /// <param name="geometryFactory"></param> /// <param name="ptLocator"></param> public LineBuilder(OverlayOp op, IGeometryFactory geometryFactory, PointLocator ptLocator) { this.op = op; this.geometryFactory = geometryFactory; this.ptLocator = ptLocator; }