public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry inputGeometry, com.epl.geometry.SpatialReference sr, double distance, com.epl.geometry.OperatorOffset.JoinType joins, double bevelRatio, double flattenError, com.epl.geometry.ProgressTracker progressTracker ) { com.epl.geometry.SimpleGeometryCursor inputCursor = new com.epl.geometry.SimpleGeometryCursor(inputGeometry); com.epl.geometry.GeometryCursor outCursor = Execute(inputCursor, sr, distance, joins, bevelRatio, flattenError, progressTracker); return(outCursor.Next()); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom1, com.epl.geometry.Geometry geom2, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.Geometry[] geomArray = new com.epl.geometry.Geometry[] { geom1, geom2 }; com.epl.geometry.SimpleGeometryCursor inputGeometries = new com.epl.geometry.SimpleGeometryCursor(geomArray); com.epl.geometry.GeometryCursor outputCursor = Execute(inputGeometries, sr, progressTracker); return(outputCursor.Next()); }
/// <summary> /// Calculates a buffer polygon for each geometry at each of the /// corresponding specified distances. /// </summary> /// <remarks> /// Calculates a buffer polygon for each geometry at each of the /// corresponding specified distances. It is assumed that all geometries have /// the same spatial reference. There is an option to union the /// returned geometries. /// See OperatorBuffer. /// </remarks> /// <param name="geometries">An array of geometries to be buffered.</param> /// <param name="spatialReference">The spatial reference of the geometries.</param> /// <param name="distances">The corresponding distances for the input geometries to be buffered.</param> /// <param name="toUnionResults">TRUE if all geometries buffered at a given distance are to be unioned into a single polygon.</param> /// <returns>The buffer of the geometries.</returns> public static com.epl.geometry.Polygon[] Buffer(com.epl.geometry.Geometry[] geometries, com.epl.geometry.SpatialReference spatialReference, double[] distances, bool toUnionResults) { // initially assume distances are in unit of spatial reference double[] bufferDistances = distances; com.epl.geometry.OperatorBuffer op = (com.epl.geometry.OperatorBuffer)factory.GetOperator(com.epl.geometry.Operator.Type.Buffer); if (toUnionResults) { com.epl.geometry.SimpleGeometryCursor inputGeometriesCursor = new com.epl.geometry.SimpleGeometryCursor(geometries); com.epl.geometry.GeometryCursor result = op.Execute(inputGeometriesCursor, spatialReference, bufferDistances, toUnionResults, null); System.Collections.Generic.List <com.epl.geometry.Polygon> resultGeoms = new System.Collections.Generic.List <com.epl.geometry.Polygon>(); com.epl.geometry.Geometry g; while ((g = result.Next()) != null) { resultGeoms.Add((com.epl.geometry.Polygon)g); } com.epl.geometry.Polygon[] buffers = resultGeoms.ToArray(); return(buffers); } else { com.epl.geometry.Polygon[] buffers = new com.epl.geometry.Polygon[geometries.Length]; for (int i = 0; i < geometries.Length; i++) { buffers[i] = (com.epl.geometry.Polygon)op.Execute(geometries[i], spatialReference, bufferDistances[i], null); } return(buffers); } }
public static void TestGetXCorrectCR185697() { com.epl.geometry.OperatorFactoryLocal engine = com.epl.geometry.OperatorFactoryLocal.GetInstance(); com.epl.geometry.OperatorClip clipOp = (com.epl.geometry.OperatorClip)engine.GetOperator(com.epl.geometry.Operator.Type.Clip); com.epl.geometry.Polyline polylineCR = MakePolylineCR(); com.epl.geometry.SimpleGeometryCursor polylineCursCR = new com.epl.geometry.SimpleGeometryCursor(polylineCR); com.epl.geometry.SpatialReference gcsWGS84 = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.Envelope2D envelopeCR = new com.epl.geometry.Envelope2D(); envelopeCR.xmin = -180; envelopeCR.xmax = 180; envelopeCR.ymin = -90; envelopeCR.ymax = 90; // CR com.epl.geometry.Polyline clippedPolylineCR = (com.epl.geometry.Polyline)clipOp.Execute(polylineCR, envelopeCR, gcsWGS84, null); com.epl.geometry.Point pointResult = new com.epl.geometry.Point(); clippedPolylineCR.GetPointByVal(0, pointResult); NUnit.Framework.Assert.IsTrue(pointResult.GetX() == -180); clippedPolylineCR.GetPointByVal(1, pointResult); NUnit.Framework.Assert.IsTrue(pointResult.GetX() == -90); clippedPolylineCR.GetPointByVal(2, pointResult); NUnit.Framework.Assert.IsTrue(pointResult.GetX() == 0); clippedPolylineCR.GetPointByVal(3, pointResult); NUnit.Framework.Assert.IsTrue(pointResult.GetX() == 100); clippedPolylineCR.GetPointByVal(4, pointResult); NUnit.Framework.Assert.IsTrue(pointResult.GetX() == 170); clippedPolylineCR.GetPointByVal(5, pointResult); NUnit.Framework.Assert.IsTrue(pointResult.GetX() == 180); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry leftGeometry, com.epl.geometry.Geometry rightGeometry, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor leftGeomCurs = new com.epl.geometry.SimpleGeometryCursor(leftGeometry); com.epl.geometry.SimpleGeometryCursor rightGeomCurs = new com.epl.geometry.SimpleGeometryCursor(rightGeometry); com.epl.geometry.GeometryCursor geometryCursor = Execute(leftGeomCurs, rightGeomCurs, sr, progressTracker); return(geometryCursor.Next()); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry inputGeometry, com.epl.geometry.Geometry subtractor, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor inputGeomCurs = new com.epl.geometry.SimpleGeometryCursor(inputGeometry); com.epl.geometry.SimpleGeometryCursor subractorCurs = new com.epl.geometry.SimpleGeometryCursor(subtractor); com.epl.geometry.GeometryCursor geometryCursor = Execute(inputGeomCurs, subractorCurs, sr, progressTracker); return(geometryCursor.Next()); }
/// <summary>Constructs a new geometry by union an array of geometries.</summary> /// <remarks> /// Constructs a new geometry by union an array of geometries. All inputs /// must be of the same type of geometries and share one spatial reference. /// See OperatorUnion. /// </remarks> /// <param name="geometries">The geometries to union.</param> /// <param name="spatialReference">The spatial reference of the geometries.</param> /// <returns>The geometry object representing the resultant union.</returns> public static com.epl.geometry.Geometry Union(com.epl.geometry.Geometry[] geometries, com.epl.geometry.SpatialReference spatialReference) { com.epl.geometry.OperatorUnion op = (com.epl.geometry.OperatorUnion)factory.GetOperator(com.epl.geometry.Operator.Type.Union); com.epl.geometry.SimpleGeometryCursor inputGeometries = new com.epl.geometry.SimpleGeometryCursor(geometries); com.epl.geometry.GeometryCursor result = op.Execute(inputGeometries, spatialReference, null); return(result.Next()); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry inputGeometry, com.epl.geometry.SpatialReference sr, double distance, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor inputCursor = new com.epl.geometry.SimpleGeometryCursor(inputGeometry); double[] distances = new double[1]; distances[0] = distance; com.epl.geometry.GeometryCursor outputCursor = Execute(inputCursor, sr, distances, false, progressTracker); return(outputCursor.Next()); }
public static void TestUnion__() { com.epl.geometry.Point pt = new com.epl.geometry.Point(10, 20); com.epl.geometry.Point pt2 = new com.epl.geometry.Point(); pt2.SetXY(10, 10); com.epl.geometry.Envelope env1 = new com.epl.geometry.Envelope(10, 10, 30, 50); com.epl.geometry.Envelope env2 = new com.epl.geometry.Envelope(30, 10, 60, 50); com.epl.geometry.Geometry[] geomArray = new com.epl.geometry.Geometry[] { env1, env2 }; com.epl.geometry.SimpleGeometryCursor inputGeometries = new com.epl.geometry.SimpleGeometryCursor(geomArray); com.epl.geometry.OperatorUnion union = (com.epl.geometry.OperatorUnion)com.epl.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.epl.geometry.Operator.Type.Union); com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.GeometryCursor outputCursor = union.Execute(inputGeometries, sr, null); com.epl.geometry.Geometry result = outputCursor.Next(); }
/// <summary> /// Constructs the set-theoretic intersection between an array of geometries /// and another geometry. /// </summary> /// <remarks> /// Constructs the set-theoretic intersection between an array of geometries /// and another geometry. /// See OperatorIntersection (also for dimension specific intersection). /// </remarks> /// <param name="inputGeometries">An array of geometry objects.</param> /// <param name="geometry">The geometry object.</param> /// <returns>Any array of geometry objects showing the intersection.</returns> internal static com.epl.geometry.Geometry[] Intersect(com.epl.geometry.Geometry[] inputGeometries, com.epl.geometry.Geometry geometry, com.epl.geometry.SpatialReference spatialReference) { com.epl.geometry.OperatorIntersection op = (com.epl.geometry.OperatorIntersection)factory.GetOperator(com.epl.geometry.Operator.Type.Intersection); com.epl.geometry.SimpleGeometryCursor inputGeometriesCursor = new com.epl.geometry.SimpleGeometryCursor(inputGeometries); com.epl.geometry.SimpleGeometryCursor intersectorCursor = new com.epl.geometry.SimpleGeometryCursor(geometry); com.epl.geometry.GeometryCursor result = op.Execute(inputGeometriesCursor, intersectorCursor, spatialReference, null); System.Collections.Generic.List <com.epl.geometry.Geometry> resultGeoms = new System.Collections.Generic.List <com.epl.geometry.Geometry>(); com.epl.geometry.Geometry g; while ((g = result.Next()) != null) { resultGeoms.Add(g); } com.epl.geometry.Geometry[] resultarr = resultGeoms.ToArray(); return(resultarr); }
/// <summary>Calculates the convex hull.</summary> /// <remarks> /// Calculates the convex hull. /// See OperatorConvexHull /// </remarks> /// <param name="geometries">The input geometry array.</param> /// <param name="b_merge"> /// Put true if you want the convex hull of all the geometries in /// the array combined. Put false if you want the convex hull of /// each geometry in the array individually. /// </param> /// <returns> /// Returns an array of convex hulls. If b_merge is true, the result /// will be a one element array consisting of the merged convex hull. /// </returns> public static com.epl.geometry.Geometry[] ConvexHull(com.epl.geometry.Geometry[] geometries, bool b_merge) { com.epl.geometry.OperatorConvexHull op = (com.epl.geometry.OperatorConvexHull)factory.GetOperator(com.epl.geometry.Operator.Type.ConvexHull); com.epl.geometry.SimpleGeometryCursor simple_cursor = new com.epl.geometry.SimpleGeometryCursor(geometries); com.epl.geometry.GeometryCursor cursor = op.Execute(simple_cursor, b_merge, null); System.Collections.Generic.List <com.epl.geometry.Geometry> resultGeoms = new System.Collections.Generic.List <com.epl.geometry.Geometry>(); com.epl.geometry.Geometry g; while ((g = cursor.Next()) != null) { resultGeoms.Add(g); } com.epl.geometry.Geometry[] output = new com.epl.geometry.Geometry[resultGeoms.Count]; for (int i = 0; i < resultGeoms.Count; i++) { output[i] = resultGeoms[i]; } return(output); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry inputGeometry, double maxLength, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor inputCursor = new com.epl.geometry.SimpleGeometryCursor(inputGeometry); com.epl.geometry.GeometryCursor outputCursor = Execute(inputCursor, maxLength, progressTracker); return(outputCursor.Next()); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom, double maxDeviation, bool bRemoveDegenerateParts, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor inputGeomCurs = new com.epl.geometry.SimpleGeometryCursor(geom); com.epl.geometry.GeometryCursor geometryCursor = Execute(inputGeomCurs, maxDeviation, bRemoveDegenerateParts, progressTracker); return(geometryCursor.Next()); }
public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom, com.epl.geometry.Envelope2D envelope, com.epl.geometry.SpatialReference spatialRef, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor inputCursor = new com.epl.geometry.SimpleGeometryCursor(geom); com.epl.geometry.GeometryCursor outputCursor = Execute(inputCursor, envelope, spatialRef, progressTracker); return(outputCursor.Next()); }
public static void TestClipGeometries() { // RandomTest(); com.epl.geometry.OperatorFactoryLocal engine = com.epl.geometry.OperatorFactoryLocal.GetInstance(); com.epl.geometry.OperatorClip clipOp = (com.epl.geometry.OperatorClip)engine.GetOperator(com.epl.geometry.Operator.Type.Clip); com.epl.geometry.Polygon polygon = MakePolygon(); com.epl.geometry.SimpleGeometryCursor polygonCurs = new com.epl.geometry.SimpleGeometryCursor(polygon); com.epl.geometry.Polyline polyline = MakePolyline(); com.epl.geometry.SimpleGeometryCursor polylineCurs = new com.epl.geometry.SimpleGeometryCursor(polyline); com.epl.geometry.MultiPoint multipoint = MakeMultiPoint(); com.epl.geometry.SimpleGeometryCursor multipointCurs = new com.epl.geometry.SimpleGeometryCursor(multipoint); com.epl.geometry.Point point = MakePoint(); com.epl.geometry.SimpleGeometryCursor pointCurs = new com.epl.geometry.SimpleGeometryCursor(point); com.epl.geometry.SpatialReference spatialRef = com.epl.geometry.SpatialReference.Create(3857); com.epl.geometry.Envelope2D envelope = new com.epl.geometry.Envelope2D(); envelope.xmin = 0; envelope.xmax = 20; envelope.ymin = 5; envelope.ymax = 15; // Cursor implementation com.epl.geometry.GeometryCursor clipPolygonCurs = clipOp.Execute(polygonCurs, envelope, spatialRef, null); com.epl.geometry.Polygon clippedPolygon = (com.epl.geometry.Polygon)clipPolygonCurs.Next(); double area = clippedPolygon.CalculateArea2D(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 25) < 0.00001); // Single Geometry implementation clippedPolygon = (com.epl.geometry.Polygon)clipOp.Execute(polygon, envelope, spatialRef, null); area = clippedPolygon.CalculateArea2D(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 25) < 0.00001); // Cursor implementation com.epl.geometry.GeometryCursor clipPolylineCurs = clipOp.Execute(polylineCurs, envelope, spatialRef, null); com.epl.geometry.Polyline clippedPolyline = (com.epl.geometry.Polyline)clipPolylineCurs.Next(); double length = clippedPolyline.CalculateLength2D(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(length - 10 * System.Math.Sqrt(2.0)) < 1e-10); // Single Geometry implementation clippedPolyline = (com.epl.geometry.Polyline)clipOp.Execute(polyline, envelope, spatialRef, null); length = clippedPolyline.CalculateLength2D(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(length - 10 * System.Math.Sqrt(2.0)) < 1e-10); // Cursor implementation com.epl.geometry.GeometryCursor clipMulti_pointCurs = clipOp.Execute(multipointCurs, envelope, spatialRef, null); com.epl.geometry.MultiPoint clipped_multi_point = (com.epl.geometry.MultiPoint)clipMulti_pointCurs.Next(); int pointCount = clipped_multi_point.GetPointCount(); NUnit.Framework.Assert.IsTrue(pointCount == 2); // Cursor implementation com.epl.geometry.GeometryCursor clipPointCurs = clipOp.Execute(pointCurs, envelope, spatialRef, null); com.epl.geometry.Point clippedPoint = (com.epl.geometry.Point)clipPointCurs.Next(); NUnit.Framework.Assert.IsTrue(clippedPoint != null); // RandomTest(); com.epl.geometry.Polyline _poly = new com.epl.geometry.Polyline(); _poly.StartPath(2, 2); _poly.LineTo(0, 0); com.epl.geometry.Envelope2D _env = new com.epl.geometry.Envelope2D(); _env.SetCoords(2, 1, 5, 3); com.epl.geometry.Polyline _clippedPolyline = (com.epl.geometry.Polyline)clipOp.Execute(_poly, _env, spatialRef, null); NUnit.Framework.Assert.IsTrue(_clippedPolyline.IsEmpty()); { com.epl.geometry.Polygon poly = new com.epl.geometry.Polygon(); poly.AddEnvelope(new com.epl.geometry.Envelope2D(0, 0, 100, 100), false); poly.AddEnvelope(new com.epl.geometry.Envelope2D(5, 5, 95, 95), true); com.epl.geometry.Polygon clippedPoly = (com.epl.geometry.Polygon)clipOp.Execute(poly, new com.epl.geometry.Envelope2D(-10, -10, 110, 50), spatialRef, null); NUnit.Framework.Assert.IsTrue(clippedPoly.GetPathCount() == 1); NUnit.Framework.Assert.IsTrue(clippedPoly.GetPointCount() == 8); } }
// Reviewed vs. Feb 8 2011 public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom, com.epl.geometry.SpatialReference spatialRef, bool bForceSimplify, com.epl.geometry.ProgressTracker progressTracker) { com.epl.geometry.SimpleGeometryCursor inputCursor = new com.epl.geometry.SimpleGeometryCursor(geom); com.epl.geometry.GeometryCursor outputCursor = Execute(inputCursor, spatialRef, bForceSimplify, progressTracker); return(outputCursor.Next()); }
public override string Execute(com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.Geometry geometry) { com.epl.geometry.SimpleGeometryCursor gc = new com.epl.geometry.SimpleGeometryCursor(geometry); com.epl.geometry.JsonCursor cursor = new com.epl.geometry.OperatorExportToJsonCursor(spatialReference, gc); return(cursor.Next()); }