public IGeometry CreateAsHighLevelGeometry([NotNull] IGeometry geometrySchema) { IGeometry result = GeometryFactory.CreateEmptyGeometry(geometrySchema); AddGeometries(LowLevelGeometries, result); return(result); }
public IGeometry CreateAsHighLevelGeometry(esriGeometryType resultGeometyType) { IGeometry result = GeometryFactory.CreateEmptyGeometry(resultGeometyType); AddGeometries(LowLevelGeometries, result); return(result); }
private static IGeometry GetClipped([NotNull] IGeometry shape, [NotNull] IEnvelope clipperEnvelope) { var polygon = shape as IPolygon; if (polygon != null) { // implements workarounds for QueryClipped issues on polygons return(GeometryUtils.GetClippedPolygon(polygon, clipperEnvelope)); } IGeometry clipped = GeometryFactory.CreateEmptyGeometry(shape); ((ITopologicalOperator)shape).QueryClipped(clipperEnvelope, clipped); return(clipped); }
private IGeometry GetClippedGeometry([NotNull] IGeometry geometry, [NotNull] IBox clipperBox) { _envelopeTemplate.PutCoords(clipperBox.Min.X, clipperBox.Min.Y, clipperBox.Max.X, clipperBox.Max.Y); var polygon = geometry as IPolygon; if (polygon != null) { // implements workarounds for QueryClipped issues on polygons return(GeometryUtils.GetClippedPolygon(polygon, _envelopeTemplate)); } IGeometry clipped = GeometryFactory.CreateEmptyGeometry(geometry); ((ITopologicalOperator)geometry).QueryClipped(_envelopeTemplate, clipped); return(clipped); }
private static IPolyline GetTargetSegmentsAlong( [NotNull] IPolyline targetPolyline, [NotNull] IPolyline alongPolyline, double originalTolerance) { // NOTE: The targetPolyline must be simplified i.e. the adjacent parts should be merged. var exactDifferences = (IGeometryCollection)GeometryFactory.CreateEmptyGeometry(alongPolyline); foreach (IPath differencePath in GeometryUtils.GetPaths(alongPolyline)) { IPath targetPath = GetUniqueTargetPathRunningAlong( targetPolyline, differencePath, originalTolerance); // NOTE: Sometimes, especially with non-linear segments and non-micro-resolution, this logic does not work because // the difference between non-linear geometries can look extremely weird (i.e. incorrect multiparts) // See CanReshapeAlongNonLinearSegmentsPolygonCircleWithMinimumTolerance() in GeometryReshaperTest if (targetPath == null) { _msg.DebugFormat( "Unable to use exact target geometry, because no unique target path found running along {0}. The standard difference (using minimum tolerance) is used instead.", GeometryUtils.ToString(differencePath)); return(alongPolyline); } Assert.NotNull(targetPath, "No target part found when searching with the difference part"); IGeometry exactDifferencePart; if (targetPath.IsClosed) { if (differencePath.IsClosed) { exactDifferencePart = GeometryFactory.Clone(targetPath); } else { IRing targetRing = GeometryFactory.CreateRing(targetPath); exactDifferencePart = GetRingSubcurveAlong(targetRing, differencePath); } } else { exactDifferencePart = SegmentReplacementUtils.GetSegmentsBetween( differencePath.FromPoint, differencePath.ToPoint, targetPath); } exactDifferences.AddGeometry(exactDifferencePart); } var result = (IPolyline)exactDifferences; GeometryUtils.Simplify(result, true, true); return(result); }