public static void test1() { com.esri.core.geometry.Polyline polyline; polyline = makePolyline(); com.esri.core.geometry.MultiPathImpl polylineImpl = (com.esri.core.geometry.MultiPathImpl )polyline._getImpl(); com.esri.core.geometry.QuadTree quadtree = buildQuadTree_(polylineImpl); com.esri.core.geometry.Line queryline = new com.esri.core.geometry.Line(34, 9, 66 , 46); com.esri.core.geometry.QuadTree.QuadTreeIterator qtIter = quadtree.getIterator(); NUnit.Framework.Assert.IsTrue(qtIter.next() == -1); qtIter.resetIterator(queryline, 0.0); int element_handle = qtIter.next(); while (element_handle > 0) { int index = quadtree.getElement(element_handle); NUnit.Framework.Assert.IsTrue(index == 6 || index == 8 || index == 14); element_handle = qtIter.next(); } com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D (34, 9, 66, 46); com.esri.core.geometry.Polygon queryPolygon = new com.esri.core.geometry.Polygon( ); queryPolygon.addEnvelope(envelope, true); qtIter.resetIterator(queryline, 0.0); element_handle = qtIter.next(); while (element_handle > 0) { int index = quadtree.getElement(element_handle); NUnit.Framework.Assert.IsTrue(index == 6 || index == 8 || index == 14); element_handle = qtIter.next(); } }
public virtual void TestBufferPoint() { com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); com.esri.core.geometry.Point inputGeom = new com.esri.core.geometry.Point(12, 120); com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Buffer); com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Simplify); com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 40.0, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)result; int pathCount = poly.GetPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 1); int pointCount = poly.GetPointCount(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 100.0) < 10); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.QueryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 80) < 0.01 && System.Math.Abs(env2D.GetHeight() - 80) < 0.01); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 12) < 0.001 && System.Math.Abs(env2D.GetCenterY() - 120) < 0.001); com.esri.core.geometry.NonSimpleResult nsr = new com.esri.core.geometry.NonSimpleResult(); bool is_simple = simplify.IsSimpleAsFeature(result, sr, true, nsr, null); NUnit.Framework.Assert.IsTrue(is_simple); { result = buffer.Execute(inputGeom, sr, 0, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); NUnit.Framework.Assert.IsTrue(result.IsEmpty()); } { result = buffer.Execute(inputGeom, sr, -1, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); NUnit.Framework.Assert.IsTrue(result.IsEmpty()); } }
public static void Test1() { com.esri.core.geometry.Polyline polyline; polyline = MakePolyline(); com.esri.core.geometry.MultiPathImpl polylineImpl = (com.esri.core.geometry.MultiPathImpl)polyline._getImpl(); com.esri.core.geometry.QuadTree quadtree = BuildQuadTree_(polylineImpl); com.esri.core.geometry.Line queryline = new com.esri.core.geometry.Line(34, 9, 66, 46); com.esri.core.geometry.QuadTree.QuadTreeIterator qtIter = quadtree.GetIterator(); NUnit.Framework.Assert.IsTrue(qtIter.Next() == -1); qtIter.ResetIterator(queryline, 0.0); int element_handle = qtIter.Next(); while (element_handle > 0) { int index = quadtree.GetElement(element_handle); NUnit.Framework.Assert.IsTrue(index == 6 || index == 8 || index == 14); element_handle = qtIter.Next(); } com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(34, 9, 66, 46); com.esri.core.geometry.Polygon queryPolygon = new com.esri.core.geometry.Polygon(); queryPolygon.AddEnvelope(envelope, true); qtIter.ResetIterator(queryline, 0.0); element_handle = qtIter.Next(); while (element_handle > 0) { int index = quadtree.GetElement(element_handle); NUnit.Framework.Assert.IsTrue(index == 6 || index == 8 || index == 14); element_handle = qtIter.Next(); } }
public static void test2() { com.esri.core.geometry.MultiPoint multipoint = new com.esri.core.geometry.MultiPoint (); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { multipoint.add(i, j); } } com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D( ); multipoint.queryEnvelope2D(extent); com.esri.core.geometry.MultiPointImpl multipointImpl = (com.esri.core.geometry.MultiPointImpl )multipoint._getImpl(); com.esri.core.geometry.QuadTree quadtree = buildQuadTree_(multipointImpl); com.esri.core.geometry.QuadTree.QuadTreeIterator qtIter = quadtree.getIterator(); NUnit.Framework.Assert.IsTrue(qtIter.next() == -1); int count = 0; qtIter.resetIterator(extent, 0.0); while (qtIter.next() != -1) { count++; } NUnit.Framework.Assert.IsTrue(count == 10000); }
public static com.esri.core.geometry.QuadTree buildQuadTree(com.esri.core.geometry.MultiPath multipath) { com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D( ); multipath.queryEnvelope2D(extent); com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent , 8); int hint_index = -1; com.esri.core.geometry.SegmentIterator seg_iter = multipath.querySegmentIterator( ); while (seg_iter.nextPath()) { while (seg_iter.hasNextSegment()) { com.esri.core.geometry.Segment segment = seg_iter.nextSegment(); int index = seg_iter.getStartPointIndex(); com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D (); segment.queryEnvelope2D(boundingbox); hint_index = quadTree.insert(index, boundingbox, hint_index); } } return(quadTree); }
public static void testGetXCorrectCR185697() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal .getInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polyline polylineCR = makePolylineCR(); com.esri.core.geometry.SimpleGeometryCursor polylineCursCR = new com.esri.core.geometry.SimpleGeometryCursor (polylineCR); com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference .create(4326); com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D (); envelopeCR.xmin = -180; envelopeCR.xmax = 180; envelopeCR.ymin = -90; envelopeCR.ymax = 90; // CR com.esri.core.geometry.Polyline clippedPolylineCR = (com.esri.core.geometry.Polyline )clipOp.execute(polylineCR, envelopeCR, gcsWGS84, null); com.esri.core.geometry.Point pointResult = new com.esri.core.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 virtual void testEnvelope2D_corners() { com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(0, 1, 2, 3); NUnit.Framework.Assert.IsFalse(env.Equals(null)); NUnit.Framework.Assert.IsTrue(env.Equals((object)new com.esri.core.geometry.Envelope2D (0, 1, 2, 3))); com.esri.core.geometry.Point2D pt2D = env.getLowerLeft(); NUnit.Framework.Assert.IsTrue(pt2D.equals(com.esri.core.geometry.Point2D.construct (0, 1))); pt2D = env.getUpperLeft(); NUnit.Framework.Assert.IsTrue(pt2D.equals(com.esri.core.geometry.Point2D.construct (0, 3))); pt2D = env.getUpperRight(); NUnit.Framework.Assert.IsTrue(pt2D.equals(com.esri.core.geometry.Point2D.construct (2, 3))); pt2D = env.getLowerRight(); NUnit.Framework.Assert.IsTrue(pt2D.equals(com.esri.core.geometry.Point2D.construct (2, 1))); { com.esri.core.geometry.Point2D[] corners = new com.esri.core.geometry.Point2D[4]; env.queryCorners(corners); NUnit.Framework.Assert.IsTrue(corners[0].equals(com.esri.core.geometry.Point2D.construct (0, 1))); NUnit.Framework.Assert.IsTrue(corners[1].equals(com.esri.core.geometry.Point2D.construct (0, 3))); NUnit.Framework.Assert.IsTrue(corners[2].equals(com.esri.core.geometry.Point2D.construct (2, 3))); NUnit.Framework.Assert.IsTrue(corners[3].equals(com.esri.core.geometry.Point2D.construct (2, 1))); env.queryCorners(corners); NUnit.Framework.Assert.IsTrue(corners[0].equals(env.queryCorner(0))); NUnit.Framework.Assert.IsTrue(corners[1].equals(env.queryCorner(1))); NUnit.Framework.Assert.IsTrue(corners[2].equals(env.queryCorner(2))); NUnit.Framework.Assert.IsTrue(corners[3].equals(env.queryCorner(3))); } { com.esri.core.geometry.Point2D[] corners = new com.esri.core.geometry.Point2D[4]; env.queryCornersReversed(corners); NUnit.Framework.Assert.IsTrue(corners[0].equals(com.esri.core.geometry.Point2D.construct (0, 1))); NUnit.Framework.Assert.IsTrue(corners[1].equals(com.esri.core.geometry.Point2D.construct (2, 1))); NUnit.Framework.Assert.IsTrue(corners[2].equals(com.esri.core.geometry.Point2D.construct (2, 3))); NUnit.Framework.Assert.IsTrue(corners[3].equals(com.esri.core.geometry.Point2D.construct (0, 3))); env.queryCornersReversed(corners); NUnit.Framework.Assert.IsTrue(corners[0].equals(env.queryCorner(0))); NUnit.Framework.Assert.IsTrue(corners[1].equals(env.queryCorner(3))); NUnit.Framework.Assert.IsTrue(corners[2].equals(env.queryCorner(2))); NUnit.Framework.Assert.IsTrue(corners[3].equals(env.queryCorner(1))); } NUnit.Framework.Assert.IsTrue(env.getCenter().equals(com.esri.core.geometry.Point2D .construct(1, 2))); NUnit.Framework.Assert.IsFalse(env.containsExclusive(env.getUpperLeft())); NUnit.Framework.Assert.IsTrue(env.contains(env.getUpperLeft())); NUnit.Framework.Assert.IsTrue(env.containsExclusive(env.getCenter())); }
public static com.esri.core.geometry.Envelope makeEnvelope3() { com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(5, 5, 6, 6); com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(env ); return(envelope); }
public static void testClipIssue258243() { com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); poly1.startPath(21.476191371901479, 41.267022001907215); poly1.lineTo(59.669186665158051, 36.62700518555863); poly1.lineTo(20.498578117352313, 30.363180148246094); poly1.lineTo(18.342565836615044, 46.303295352085627); poly1.lineTo(17.869569458621626, 23.886816966894159); poly1.lineTo(19.835465558090434, 20); poly1.lineTo(18.83911285048551, 43.515995498114791); poly1.lineTo(20.864485260298004, 20.235921201027757); poly1.lineTo(18.976127544787012, 20); poly1.lineTo(34.290201277718218, 61.801369014954794); poly1.lineTo(20.734727419368866, 20); poly1.lineTo(18.545865698148113, 20); poly1.lineTo(19.730260558565515, 20); poly1.lineTo(19.924806216827005, 23.780315893949187); poly1.lineTo(21.675168105421452, 36.699924873001258); poly1.lineTo(22.500527828912158, 43.703424859922983); poly1.lineTo(42.009527116514818, 36.995486982256089); poly1.lineTo(24.469729873835782, 58.365871758247039); poly1.lineTo(24.573736036545878, 36.268390409195824); poly1.lineTo(22.726502169802746, 20); poly1.lineTo(23.925834885228145, 20); poly1.lineTo(25.495346880936729, 20); poly1.lineTo(23.320941499288317, 20); poly1.lineTo(24.05655665646276, 28.659578774758632); poly1.lineTo(23.205940789341135, 38.491506888710504); poly1.lineTo(21.472847203385509, 53.057228182018044); poly1.lineTo(25.04257681654104, 20); poly1.lineTo(25.880572351149542, 25.16102863979474); poly1.lineTo(26.756283333879658, 20); poly1.lineTo(21.476191371901479, 41.267022001907215); com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(24.269517325186033, 19.999998900000001, 57.305574253225409, 61.801370114954793 ); try { com.esri.core.geometry.Geometry output_geom = com.esri.core.geometry.OperatorClip .local().execute(poly1, env, com.esri.core.geometry.SpatialReference.create(4326 ), null); com.esri.core.geometry.Envelope envPoly = new com.esri.core.geometry.Envelope(); poly1.queryEnvelope(envPoly); com.esri.core.geometry.Envelope e = new com.esri.core.geometry.Envelope(env); e.intersect(envPoly); com.esri.core.geometry.Envelope clippedEnv = new com.esri.core.geometry.Envelope( ); output_geom.queryEnvelope(clippedEnv); NUnit.Framework.Assert.IsTrue(System.Math.abs(clippedEnv.getXMin() - e.getXMin()) < 1e-10 && System.Math.abs(clippedEnv.getYMin() - e.getYMin()) < 1e-10 && System.Math .abs(clippedEnv.getXMax() - e.getXMax()) < 1e-10 && System.Math.abs(clippedEnv.getYMax () - e.getYMax()) < 1e-10); } catch (System.Exception) { NUnit.Framework.Assert.IsTrue(false); } }
public virtual void testSerializeEnvelope2D() { try { java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream(); java.io.ObjectOutputStream oo = new java.io.ObjectOutputStream(streamOut); com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(1.213948734 , 2.213948734, 11.213948734, 12.213948734); oo.writeObject(env); java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut .toByteArray()); java.io.ObjectInputStream ii = new java.io.ObjectInputStream(streamIn); com.esri.core.geometry.Envelope2D envRes = (com.esri.core.geometry.Envelope2D)ii. readObject(); NUnit.Framework.Assert.IsTrue(envRes.Equals(env)); } catch (System.Exception) { fail("Envelope2D serialization failure"); } // try // { // FileOutputStream streamOut = new FileOutputStream( // "c:/temp/savedEnvelope2D.txt"); // ObjectOutputStream oo = new ObjectOutputStream(streamOut); // Envelope2D e = new Envelope2D(177.123, 188.234, 999.122, 888.999); // oo.writeObject(e); // } // catch(Exception ex) // { // fail("Envelope2D serialization failure"); // } try { java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization )).getResourceAsStream("savedEnvelope2D.txt"); java.io.ObjectInputStream ii = new java.io.ObjectInputStream(s); com.esri.core.geometry.Envelope2D e = (com.esri.core.geometry.Envelope2D)ii.readObject (); NUnit.Framework.Assert.IsTrue(e != null); NUnit.Framework.Assert.IsTrue(e.Equals(new com.esri.core.geometry.Envelope2D(177.123 , 188.234, 999.122, 888.999))); } catch (System.Exception) { fail("Envelope2D serialization failure"); } }
public virtual void testBufferPoint() { com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference .create(4326); com.esri.core.geometry.Point inputGeom = new com.esri.core.geometry.Point(12, 120 ); com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type .Buffer); com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type .Simplify); com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 40.0, null ); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)result; int pathCount = poly.getPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 1); int pointCount = poly.getPointCount(); NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 100.0) < 10); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.queryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 80) < 0.01 && System.Math .abs(env2D.getHeight() - 80) < 0.01); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 12) < 0.001 && System.Math.abs(env2D.getCenterY() - 120) < 0.001); com.esri.core.geometry.NonSimpleResult nsr = new com.esri.core.geometry.NonSimpleResult (); bool is_simple = simplify.isSimpleAsFeature(result, sr, true, nsr, null); NUnit.Framework.Assert.IsTrue(is_simple); { result = buffer.execute(inputGeom, sr, 0, null); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); NUnit.Framework.Assert.IsTrue(result.isEmpty()); } { result = buffer.execute(inputGeom, sr, -1, null); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); NUnit.Framework.Assert.IsTrue(result.isEmpty()); } }
public static void testArcObjectsFailureCR196492() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal .getInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.addEnvelope(new com.esri.core.geometry.Envelope2D(0, 0, 600, 600), false); polygon.startPath(30, 300); polygon.lineTo(20, 310); polygon.lineTo(10, 300); com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference .create(4326); com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D (10, 10, 500, 500); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp .execute(polygon, envelopeCR, gcsWGS84, null); NUnit.Framework.Assert.IsTrue(clippedPolygon.getPointCount() == 7); }
internal static com.esri.core.geometry.QuadTree buildQuadTree_(com.esri.core.geometry.MultiPointImpl multipointImpl) { com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D( ); multipointImpl.queryEnvelope2D(extent); com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent , 8); com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D (); com.esri.core.geometry.Point2D pt; for (int i = 0; i < multipointImpl.getPointCount(); i++) { pt = multipointImpl.getXY(i); boundingbox.setCoords(pt.x, pt.y, pt.x, pt.y); quadTree.insert(i, boundingbox, -1); } return(quadTree); }
public static void testClipOfCoinciding() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal .getInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D (); envelopeCR.xmin = -180; envelopeCR.xmax = 180; envelopeCR.ymin = -90; envelopeCR.ymax = 90; polygon.addEnvelope(envelopeCR, false); com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference .create(4326); // CR com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp .execute(polygon, envelopeCR, gcsWGS84, null); NUnit.Framework.Assert.IsTrue(clippedPolygon.getPathCount() == 1); NUnit.Framework.Assert.IsTrue(clippedPolygon.getPointCount() == 4); com.esri.core.geometry.OperatorDensifyByLength densifyOp = (com.esri.core.geometry.OperatorDensifyByLength )engine.getOperator(com.esri.core.geometry.Operator.Type.DensifyByLength); polygon.setEmpty(); polygon.addEnvelope(envelopeCR, false); polygon = (com.esri.core.geometry.Polygon)densifyOp.execute(polygon, 1, null); int pc = polygon.getPointCount(); int pathc = polygon.getPathCount(); NUnit.Framework.Assert.IsTrue(pc == 1080); NUnit.Framework.Assert.IsTrue(pathc == 1); clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.execute(polygon, envelopeCR , gcsWGS84, null); int _pathc = clippedPolygon.getPathCount(); int _pc = clippedPolygon.getPointCount(); NUnit.Framework.Assert.IsTrue(_pathc == 1); NUnit.Framework.Assert.IsTrue(_pc == pc); }
public static void Test2() { com.esri.core.geometry.MultiPoint multipoint = new com.esri.core.geometry.MultiPoint(); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { multipoint.Add(i, j); } } com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D(); multipoint.QueryEnvelope2D(extent); com.esri.core.geometry.MultiPointImpl multipointImpl = (com.esri.core.geometry.MultiPointImpl)multipoint._getImpl(); com.esri.core.geometry.QuadTree quadtree = BuildQuadTree_(multipointImpl); com.esri.core.geometry.QuadTree.QuadTreeIterator qtIter = quadtree.GetIterator(); NUnit.Framework.Assert.IsTrue(qtIter.Next() == -1); int count = 0; qtIter.ResetIterator(extent, 0.0); while (qtIter.Next() != -1) { count++; } NUnit.Framework.Assert.IsTrue(count == 10000); }
public static void TestEnvelope2Dintersector() { System.Collections.Generic.List<com.esri.core.geometry.Envelope2D> envelopes = new System.Collections.Generic.List<com.esri.core.geometry.Envelope2D>(0); com.esri.core.geometry.Envelope2D env0 = new com.esri.core.geometry.Envelope2D(2, 3, 4, 4); com.esri.core.geometry.Envelope2D env1 = new com.esri.core.geometry.Envelope2D(5, 13, 9, 15); com.esri.core.geometry.Envelope2D env2 = new com.esri.core.geometry.Envelope2D(6, 9, 11, 12); com.esri.core.geometry.Envelope2D env3 = new com.esri.core.geometry.Envelope2D(8, 10, 9, 17); com.esri.core.geometry.Envelope2D env4 = new com.esri.core.geometry.Envelope2D(11.001, 12, 14, 14); com.esri.core.geometry.Envelope2D env5 = new com.esri.core.geometry.Envelope2D(1, 3, 3, 4); com.esri.core.geometry.Envelope2D env6 = new com.esri.core.geometry.Envelope2D(0, 2, 5, 10); com.esri.core.geometry.Envelope2D env7 = new com.esri.core.geometry.Envelope2D(4, 7, 5, 10); com.esri.core.geometry.Envelope2D env8 = new com.esri.core.geometry.Envelope2D(3, 15, 15, 15); com.esri.core.geometry.Envelope2D env9 = new com.esri.core.geometry.Envelope2D(0, 9, 14, 9); com.esri.core.geometry.Envelope2D env10 = new com.esri.core.geometry.Envelope2D(0, 8.999, 14, 8.999); envelopes.Add(env0); envelopes.Add(env1); envelopes.Add(env2); envelopes.Add(env3); envelopes.Add(env4); envelopes.Add(env5); envelopes.Add(env6); envelopes.Add(env7); envelopes.Add(env8); envelopes.Add(env9); envelopes.Add(env10); com.esri.core.geometry.Envelope2DIntersectorImpl intersector = new com.esri.core.geometry.Envelope2DIntersectorImpl(); intersector.SetTolerance(0.001); intersector.StartConstruction(); for (int i = 0; i < envelopes.Count; i++) { intersector.AddEnvelope(i, envelopes[i]); } intersector.EndConstruction(); int count = 0; while (intersector.Next()) { int env_a = intersector.GetHandleA(); int env_b = intersector.GetHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(envelopes[env_a]); env.Inflate(0.001, 0.001); NUnit.Framework.Assert.IsTrue(env.IsIntersecting(envelopes[env_b])); } System.Diagnostics.Debug.Assert((count == 16)); com.esri.core.geometry.Envelope2DIntersectorImpl intersector2 = new com.esri.core.geometry.Envelope2DIntersectorImpl(); intersector2.SetTolerance(0.0); intersector2.StartConstruction(); for (int i_1 = 0; i_1 < envelopes.Count; i_1++) { intersector2.AddEnvelope(i_1, envelopes[i_1]); } intersector2.EndConstruction(); count = 0; while (intersector2.Next()) { int env_a = intersector2.GetHandleA(); int env_b = intersector2.GetHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.IsIntersecting(envelopes[env_b])); } System.Diagnostics.Debug.Assert((count == 13)); env0 = new com.esri.core.geometry.Envelope2D(0, 0, 0, 10); env1 = new com.esri.core.geometry.Envelope2D(0, 10, 10, 10); env2 = new com.esri.core.geometry.Envelope2D(10, 0, 10, 10); env3 = new com.esri.core.geometry.Envelope2D(0, 0, 10, 0); envelopes.Clear(); envelopes.Add(env0); envelopes.Add(env1); envelopes.Add(env2); envelopes.Add(env3); com.esri.core.geometry.Envelope2DIntersectorImpl intersector3 = new com.esri.core.geometry.Envelope2DIntersectorImpl(); intersector3.SetTolerance(0.001); intersector3.StartConstruction(); for (int i_2 = 0; i_2 < envelopes.Count; i_2++) { intersector3.AddEnvelope(i_2, envelopes[i_2]); } intersector3.EndConstruction(); count = 0; while (intersector3.Next()) { int env_a = intersector3.GetHandleA(); int env_b = intersector3.GetHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.IsIntersecting(envelopes[env_b])); } NUnit.Framework.Assert.IsTrue(count == 4); env0 = new com.esri.core.geometry.Envelope2D(0, 0, 0, 10); envelopes.Clear(); envelopes.Add(env0); envelopes.Add(env0); envelopes.Add(env0); envelopes.Add(env0); com.esri.core.geometry.Envelope2DIntersectorImpl intersector4 = new com.esri.core.geometry.Envelope2DIntersectorImpl(); intersector4.SetTolerance(0.001); intersector4.StartConstruction(); for (int i_3 = 0; i_3 < envelopes.Count; i_3++) { intersector4.AddEnvelope(i_3, envelopes[i_3]); } intersector4.EndConstruction(); count = 0; while (intersector4.Next()) { int env_a = intersector4.GetHandleA(); int env_b = intersector4.GetHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.IsIntersecting(envelopes[env_b])); } System.Diagnostics.Debug.Assert((count == 6)); env0 = new com.esri.core.geometry.Envelope2D(0, 10, 10, 10); envelopes.Clear(); envelopes.Add(env0); envelopes.Add(env0); envelopes.Add(env0); envelopes.Add(env0); com.esri.core.geometry.Envelope2DIntersectorImpl intersector5 = new com.esri.core.geometry.Envelope2DIntersectorImpl(); intersector5.SetTolerance(0.001); intersector5.StartConstruction(); for (int i_4 = 0; i_4 < envelopes.Count; i_4++) { intersector5.AddEnvelope(i_4, envelopes[i_4]); } intersector5.EndConstruction(); count = 0; while (intersector5.Next()) { int env_a = intersector5.GetHandleA(); int env_b = intersector5.GetHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.IsIntersecting(envelopes[env_b])); } NUnit.Framework.Assert.IsTrue(count == 6); }
internal virtual bool RgHelper(com.esri.core.geometry.RasterizedGeometry2D rg, com.esri.core.geometry.MultiPath mp) { com.esri.core.geometry.SegmentIterator iter = mp.QuerySegmentIterator(); while (iter.NextPath()) { while (iter.HasNextSegment()) { com.esri.core.geometry.Segment seg = iter.NextSegment(); int count = 20; for (int i = 0; i < count; i++) { double t = (1.0 * i / count); com.esri.core.geometry.Point2D pt = seg.GetCoord2D(t); com.esri.core.geometry.RasterizedGeometry2D.HitType hit = rg.QueryPointInGeometry(pt.x, pt.y); if (hit != com.esri.core.geometry.RasterizedGeometry2D.HitType.Border) { return false; } } } } if (mp.GetType() != com.esri.core.geometry.Geometry.Type.Polygon) { return true; } com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)mp; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); poly.QueryEnvelope2D(env); int count_1 = 100; for (int iy = 0; iy < count_1; iy++) { double ty = 1.0 * iy / count_1; double y = env.ymin * (1.0 - ty) + ty * env.ymax; for (int ix = 0; ix < count_1; ix++) { double tx = 1.0 * ix / count_1; double x = env.xmin * (1.0 - tx) + tx * env.xmax; com.esri.core.geometry.RasterizedGeometry2D.HitType hit = rg.QueryPointInGeometry(x, y); com.esri.core.geometry.PolygonUtils.PiPResult res = com.esri.core.geometry.PolygonUtils.IsPointInPolygon2D(poly, new com.esri.core.geometry.Point2D(x, y), 0); if (res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside) { bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border || hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Inside); if (!bgood) { return false; } } else { if (res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside) { bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border || hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Outside); if (!bgood) { return false; } } else { bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border); if (!bgood) { return false; } } } } } return true; }
public static void testRandom() { int passcount = 10; int figureSize = 100; int figureSize2 = 100; com.esri.core.geometry.Envelope extent1 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.Envelope extent2 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.Envelope extent3 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.Envelope extent4 = new com.esri.core.geometry.Envelope(); extent1.setCoords(-10000, 5000, 10000, 25000); // red extent2.setCoords(-10000, 2000, 10000, 8000); // blue extent3.setCoords(-10000, -8000, 10000, -2000); // blue extent4.setCoords(-10000, -25000, 10000, -5000); // red com.esri.core.geometry.RandomCoordinateGenerator generator1 = new com.esri.core.geometry.RandomCoordinateGenerator (System.Math.max(figureSize, 10000), extent1, 0.001); com.esri.core.geometry.RandomCoordinateGenerator generator2 = new com.esri.core.geometry.RandomCoordinateGenerator (System.Math.max(figureSize, 10000), extent2, 0.001); com.esri.core.geometry.RandomCoordinateGenerator generator3 = new com.esri.core.geometry.RandomCoordinateGenerator (System.Math.max(figureSize, 10000), extent3, 0.001); com.esri.core.geometry.RandomCoordinateGenerator generator4 = new com.esri.core.geometry.RandomCoordinateGenerator (System.Math.max(figureSize, 10000), extent4, 0.001); java.util.Random random = new java.util.Random(1982); int rand_max = 511; int qCount = 0; int eCount = 0; int bCount = 0; for (int c = 0; c < passcount; c++) { com.esri.core.geometry.Polygon polyRed = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Polygon polyBlue = new com.esri.core.geometry.Polygon(); int r = figureSize; if (r < 3) { continue; } com.esri.core.geometry.Point pt; for (int j = 0; j < r; j++) { int rand = random.nextInt(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator1.GetRandomCoord(); if (j == 0 || bRandomNew) { polyRed.startPath(pt); } else { polyRed.lineTo(pt); } } for (int j_1 = 0; j_1 < r; j_1++) { int rand = random.nextInt(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator4.GetRandomCoord(); if (j_1 == 0 || bRandomNew) { polyRed.startPath(pt); } else { polyRed.lineTo(pt); } } r = figureSize2; if (r < 3) { continue; } for (int j_2 = 0; j_2 < r; j_2++) { int rand = random.nextInt(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator2.GetRandomCoord(); if (j_2 == 0 || bRandomNew) { polyBlue.startPath(pt); } else { polyBlue.lineTo(pt); } } for (int j_3 = 0; j_3 < r; j_3++) { int rand = random.nextInt(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator3.GetRandomCoord(); if (j_3 == 0 || bRandomNew) { polyBlue.startPath(pt); } else { polyBlue.lineTo(pt); } } com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); // Quad_tree com.esri.core.geometry.QuadTree quadTree = buildQuadTree(polyBlue); com.esri.core.geometry.QuadTree.QuadTreeIterator iterator = quadTree.getIterator( ); com.esri.core.geometry.SegmentIteratorImpl _segIterRed = ((com.esri.core.geometry.MultiPathImpl )polyRed._getImpl()).querySegmentIterator(); while (_segIterRed.nextPath()) { while (_segIterRed.hasNextSegment()) { com.esri.core.geometry.Segment segmentRed = _segIterRed.nextSegment(); segmentRed.queryEnvelope2D(env); iterator.resetIterator(env, 0.001); while (iterator.next() != -1) { qCount++; } } } // Envelope_2D_intersector System.Collections.Generic.List <com.esri.core.geometry.Envelope2D> envelopes_red = new System.Collections.Generic.List <com.esri.core.geometry.Envelope2D>(); System.Collections.Generic.List <com.esri.core.geometry.Envelope2D> envelopes_blue = new System.Collections.Generic.List <com.esri.core.geometry.Envelope2D>(); com.esri.core.geometry.SegmentIterator segIterRed = polyRed.querySegmentIterator( ); while (segIterRed.nextPath()) { while (segIterRed.hasNextSegment()) { com.esri.core.geometry.Segment segment = segIterRed.nextSegment(); env = new com.esri.core.geometry.Envelope2D(); segment.queryEnvelope2D(env); envelopes_red.add(env); } } com.esri.core.geometry.SegmentIterator segIterBlue = polyBlue.querySegmentIterator (); while (segIterBlue.nextPath()) { while (segIterBlue.hasNextSegment()) { com.esri.core.geometry.Segment segment = segIterBlue.nextSegment(); env = new com.esri.core.geometry.Envelope2D(); segment.queryEnvelope2D(env); envelopes_blue.add(env); } } com.esri.core.geometry.Envelope2DIntersectorImpl intersector = new com.esri.core.geometry.Envelope2DIntersectorImpl (); intersector.setTolerance(0.001); intersector.startRedConstruction(); for (int i = 0; i < envelopes_red.Count; i++) { intersector.addRedEnvelope(i, envelopes_red[i]); } intersector.endRedConstruction(); intersector.startBlueConstruction(); for (int i_1 = 0; i_1 < envelopes_blue.Count; i_1++) { intersector.addBlueEnvelope(i_1, envelopes_blue[i_1]); } intersector.endBlueConstruction(); while (intersector.next()) { eCount++; } NUnit.Framework.Assert.IsTrue(qCount == eCount); } }
internal static com.esri.core.geometry.QuadTree BuildQuadTree_(com.esri.core.geometry.MultiPointImpl multipointImpl) { com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D(); multipointImpl.QueryEnvelope2D(extent); com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent, 8); com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.Point2D pt; for (int i = 0; i < multipointImpl.GetPointCount(); i++) { pt = multipointImpl.GetXY(i); boundingbox.SetCoords(pt.x, pt.y, pt.x, pt.y); quadTree.Insert(i, boundingbox, -1); } return quadTree; }
public static void TestClipOfCoinciding() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip)engine.GetOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D(); envelopeCR.xmin = -180; envelopeCR.xmax = 180; envelopeCR.ymin = -90; envelopeCR.ymax = 90; polygon.AddEnvelope(envelopeCR, false); com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference.Create(4326); // CR com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.Execute(polygon, envelopeCR, gcsWGS84, null); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetPathCount() == 1); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetPointCount() == 4); com.esri.core.geometry.OperatorDensifyByLength densifyOp = (com.esri.core.geometry.OperatorDensifyByLength)engine.GetOperator(com.esri.core.geometry.Operator.Type.DensifyByLength); polygon.SetEmpty(); polygon.AddEnvelope(envelopeCR, false); polygon = (com.esri.core.geometry.Polygon)densifyOp.Execute(polygon, 1, null); int pc = polygon.GetPointCount(); int pathc = polygon.GetPathCount(); NUnit.Framework.Assert.IsTrue(pc == 1080); NUnit.Framework.Assert.IsTrue(pathc == 1); clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.Execute(polygon, envelopeCR, gcsWGS84, null); int _pathc = clippedPolygon.GetPathCount(); int _pc = clippedPolygon.GetPointCount(); NUnit.Framework.Assert.IsTrue(_pathc == 1); NUnit.Framework.Assert.IsTrue(_pc == pc); }
public virtual void TestSelfIntersecting() { // Test that we do not fail if there is // self-intersection // OperatorFactoryLocal projEnv = // OperatorFactoryLocal.getInstance(); com.esri.core.geometry.OperatorIntersection operatorIntersection = (com.esri.core.geometry.OperatorIntersection)projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Intersection); com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env1 = new com.esri.core.geometry.Envelope2D(); env1.SetCoords(0, 0, 20, 30); poly1.AddEnvelope(env1, false); com.esri.core.geometry.Polygon poly2 = new com.esri.core.geometry.Polygon(); poly2.StartPath(0, 0); poly2.LineTo(10, 10); poly2.LineTo(0, 10); poly2.LineTo(10, 0); com.esri.core.geometry.Polygon res = (com.esri.core.geometry.Polygon)(operatorIntersection.Execute(poly1, poly2, sr, null)); }
public static void TestImportExportWktPolygon() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); // OperatorExportToWkt exporterWKT = // (OperatorExportToWkt)OperatorFactoryLocal.getInstance().getOperator(Operator.Type.ExportToWkt); com.esri.core.geometry.Polygon polygon; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); // Test Import from Polygon wktString = "Polygon ZM empty"; polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.IsEmpty()); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = "Polygon z (empty, (10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3), empty, (10 10 1, 12 12 1))"; polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); polygon.QueryEnvelope2D(envelope); NUnit.Framework.Assert.IsTrue(envelope.xmin == 10 && envelope.xmax == 20 && envelope.ymin == 10 && envelope.ymax == 20); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 8); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 3); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); wktString = "polygon ((35 10, 10 20, 15 40, 45 45, 35 10), (20 30, 35 35, 30 20, 20 30))"; com.esri.core.geometry.Polygon polygon2 = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon2 != null); }
public static void TestImportExportWktMultiPolygon() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.Polygon polygon; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from MultiPolygon wktString = "Multipolygon M empty"; polygon = (com.esri.core.geometry.Polygon)importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.IsEmpty()); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); polygon = (com.esri.core.geometry.Polygon)com.esri.core.geometry.GeometryEngine.GeometryFromWkt(wktString, 0, com.esri.core.geometry.Geometry.Type.Unknown); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.IsEmpty()); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON M EMPTY")); wktString = com.esri.core.geometry.GeometryEngine.GeometryToWkt(polygon, 0); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON M EMPTY")); wktString = "Multipolygon Z (empty, (empty, (10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3), empty, (10 10 1, 12 12 1)), empty, ((90 90 88, 60 90 7, 60 60 7), empty, (70 70 7, 80 80 7, 70 80 7, 70 70 7)), empty)"; polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); polygon.QueryEnvelope2D(envelope); NUnit.Framework.Assert.IsTrue(envelope.xmin == 10 && envelope.xmax == 90 && envelope.ymin == 10 && envelope.ymax == 90); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 5); // assertTrue(polygon.calculate_area_2D() > 0.0); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); double z = polygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, 0); NUnit.Framework.Assert.IsTrue(z == 5); // Test Export to WKT MultiPolygon wktString = exporterWKT.Execute(0, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z (((10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3, 12 12 3, 12 12 3), (10 10 1, 12 12 1, 10 10 1)), ((90 90 88, 60 90 7, 60 60 7, 90 90 88), (70 70 7, 70 80 7, 80 80 7, 70 70 7)))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } // Test import Polygon wktString = "POLYGON z (EMPTY, EMPTY, (10 10 5, 10 20 5, 20 20 5, 20 10 5), (12 12 3), EMPTY, (10 10 1, 12 12 1), EMPTY, (60 60 7, 60 90 7, 90 90 7, 60 60 7), EMPTY, (70 70 7, 70 80 7, 80 80 7), EMPTY)"; polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 5); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); // Test Export to WKT Polygon wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPolygon, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POLYGON Z ((10 10 5, 20 10 5, 20 20 5, 10 20 5, 10 10 5), (12 12 3, 12 12 3, 12 12 3), (10 10 1, 12 12 1, 10 10 1), (60 60 7, 60 90 7, 90 90 7, 60 60 7), (70 70 7, 70 80 7, 80 80 7, 70 70 7))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); env.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z); polygon.QueryEnvelope(env); wktString = exporterWKT.Execute(0, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POLYGON Z ((10 10 1, 90 10 7, 90 90 1, 10 90 7, 10 10 1))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPolygon, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z (((10 10 1, 90 10 7, 90 90 1, 10 90 7, 10 10 1)))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } env.SetEmpty(); wktString = exporterWKT.Execute(0, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POLYGON Z EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPolygon, env, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "MULTIPOLYGON (((5 10, 8 10, 10 10, 10 0, 0 0, 0 10, 2 10, 5 10)))"; // ring // is // oriented // clockwise polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.CalculateArea2D() > 0); wktString = "MULTIPOLYGON Z (((90 10 7, 10 10 1, 10 90 7, 90 90 1, 90 10 7)))"; // ring // is // oriented // clockwise polygon = (com.esri.core.geometry.Polygon)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Polygon, wktString, null)); NUnit.Framework.Assert.IsTrue(polygon != null); NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() == 4); NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == 1); NUnit.Framework.Assert.IsTrue(polygon.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(polygon.CalculateArea2D() > 0); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportMultiPolygon, polygon, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOLYGON Z (((90 10 7, 90 90 1, 10 90 7, 10 10 1, 90 10 7)))")); }
public static void TestImportExportWktMultiPoint() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.MultiPoint multipoint; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from Multi_point wktString = " MultiPoint ZM empty"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(multipoint != null); NUnit.Framework.Assert.IsTrue(multipoint.IsEmpty()); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ZM EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPoint, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POINT ZM EMPTY")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } multipoint = new com.esri.core.geometry.MultiPoint(); multipoint.Add(118.15114354234563, 33.82234433423462345); multipoint.Add(88, 88); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPrecision10, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ((118.1511435 33.82234433), (88 88))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } multipoint = new com.esri.core.geometry.MultiPoint(); multipoint.Add(88, 2); multipoint.Add(88, 88); wktString = exporterWKT.Execute(0, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ((88 2), (88 88))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "Multipoint zm (empty, empty, (10 88 88 33), (10 20 5 33), (20 20 5 33), (20 10 5 33), (12 12 3 33), empty, (10 10 1 33), (12 12 1 33), empty, (60 60 7 33), (60 90.1 7 33), (90 90 7 33), empty, (70 70 7 33), (70 80 7 33), (80 80 7 33), empty)"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(multipoint != null); multipoint.QueryEnvelope2D(envelope); // assertTrue(envelope.xmin == 10 && envelope.xmax == 90 && // envelope.ymin == 10 && Math.abs(envelope.ymax - 90.1) <= 0.001); NUnit.Framework.Assert.IsTrue(multipoint.GetPointCount() == 13); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = "Multipoint zm (10 88 88 33, 10 20 5 33, 20 20 5 33, 20 10 5 33, 12 12 3 33, 10 10 1 33, 12 12 1 33, 60 60 7 33, 60 90.1 7 33, 90 90 7 33, 70 70 7 33, 70 80 7 33, 80 80 7 33)"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(multipoint != null); // assertTrue(envelope.xmin == 10 && envelope.xmax == 90 && // envelope.ymin == 10 && ::fabs(envelope.ymax - 90.1) <= 0.001); NUnit.Framework.Assert.IsTrue(multipoint.GetPointCount() == 13); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPrecision15, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTIPOINT ZM ((10 88 88 33), (10 20 5 33), (20 20 5 33), (20 10 5 33), (12 12 3 33), (10 10 1 33), (12 12 1 33), (60 60 7 33), (60 90.1 7 33), (90 90 7 33), (70 70 7 33), (70 80 7 33), (80 80 7 33))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = "Multipoint zm (empty, empty, (10 10 5 33))"; multipoint = (com.esri.core.geometry.MultiPoint)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportPoint, multipoint, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("POINT ZM (10 10 5 33)")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } }
public static void TestImportExportWktMultiLineString() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); com.esri.core.geometry.OperatorExportToWkt exporterWKT = (com.esri.core.geometry.OperatorExportToWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ExportToWkt); com.esri.core.geometry.Polyline polyline; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.WktParser wktParser = new com.esri.core.geometry.WktParser(); // Test Import from MultiLineString wktString = "MultiLineStringZMempty"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline != null); NUnit.Framework.Assert.IsTrue(polyline.IsEmpty()); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = "MultiLineStringm(empty, empty, (10 10 5, 10 20 5, 20 88 5, 20 10 5), (12 88 3), empty, (10 10 1, 12 12 1), empty, (88 60 7, 60 90 7, 90 90 7), empty, (70 70 7, 70 80 7, 80 80 7), empty)"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline != null); polyline.QueryEnvelope2D(envelope); NUnit.Framework.Assert.IsTrue(envelope.xmin == 10 && envelope.xmax == 90 && envelope.ymin == 10 && envelope.ymax == 90); NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == 14); NUnit.Framework.Assert.IsTrue(polyline.GetPathCount() == 5); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = exporterWKT.Execute(0, polyline, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTILINESTRING M ((10 10 5, 10 20 5, 20 88 5, 20 10 5), (12 88 3, 12 88 3), (10 10 1, 12 12 1), (88 60 7, 60 90 7, 90 90 7), (70 70 7, 70 80 7, 80 80 7))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } // Test Import LineString wktString = "Linestring Z(10 10 5, 10 20 5, 20 20 5, 20 10 5)"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == 4); wktString = exporterWKT.Execute(com.esri.core.geometry.WktExportFlags.wktExportLineString, polyline, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("LINESTRING Z (10 10 5, 10 20 5, 20 20 5, 20 10 5)")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } wktString = exporterWKT.Execute(0, polyline, null); NUnit.Framework.Assert.IsTrue(wktString.Equals("MULTILINESTRING Z ((10 10 5, 10 20 5, 20 20 5, 20 10 5))")); wktParser.ResetParser(wktString); while (wktParser.NextToken() != com.esri.core.geometry.WktParser.WktToken.not_available) { } }
public static void TestImportExportWktLineString() { com.esri.core.geometry.OperatorImportFromWkt importerWKT = (com.esri.core.geometry.OperatorImportFromWkt)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.ImportFromWkt); // OperatorExportToWkt exporterWKT = // (OperatorExportToWkt)OperatorFactoryLocal.getInstance().getOperator(Operator.Type.ExportToWkt); com.esri.core.geometry.Polyline polyline; string wktString; com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); // Test Import from LineString wktString = "LineString ZM empty"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline != null); NUnit.Framework.Assert.IsTrue(polyline.IsEmpty()); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); wktString = "LineString m (10 10 5, 10 20 5, 20 20 5, 20 10 5)"; polyline = (com.esri.core.geometry.Polyline)(importerWKT.Execute(0, com.esri.core.geometry.Geometry.Type.Unknown, wktString, null)); NUnit.Framework.Assert.IsTrue(polyline != null); polyline.QueryEnvelope2D(envelope); NUnit.Framework.Assert.IsTrue(envelope.xmin == 10 && envelope.xmax == 20 && envelope.ymin == 10 && envelope.ymax == 20); NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == 4); NUnit.Framework.Assert.IsTrue(polyline.GetPathCount() == 1); NUnit.Framework.Assert.IsTrue(polyline.HasAttribute(com.esri.core.geometry.VertexDescription.Semantics.M)); }
public virtual void TestCreation() { { com.esri.core.geometry.OperatorFactoryLocal projEnv = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.SpatialReference inputSR = com.esri.core.geometry.SpatialReference.Create(3857); com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env1 = new com.esri.core.geometry.Envelope2D(); env1.SetCoords(855277, 3892059, 855277 + 100, 3892059 + 100); poly1.AddEnvelope(env1, false); com.esri.core.geometry.Polygon poly2 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env2 = new com.esri.core.geometry.Envelope2D(); env2.SetCoords(855277, 3892059, 855277 + 300, 3892059 + 200); poly2.AddEnvelope(env2, false); { com.esri.core.geometry.OperatorEquals operatorEquals = (com.esri.core.geometry.OperatorEquals)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Equals)); bool result = operatorEquals.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); com.esri.core.geometry.Polygon poly11 = new com.esri.core.geometry.Polygon(); poly1.CopyTo(poly11); result = operatorEquals.Execute(poly1, poly11, inputSR, null); NUnit.Framework.Assert.IsTrue(result); } { com.esri.core.geometry.OperatorCrosses operatorCrosses = (com.esri.core.geometry.OperatorCrosses)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); bool result = operatorCrosses.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); } { com.esri.core.geometry.OperatorWithin operatorWithin = (com.esri.core.geometry.OperatorWithin)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Within)); bool result = operatorWithin.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(result); } { com.esri.core.geometry.OperatorDisjoint operatorDisjoint = (com.esri.core.geometry.OperatorDisjoint)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); com.esri.core.geometry.OperatorIntersects operatorIntersects = (com.esri.core.geometry.OperatorIntersects)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Intersects)); bool result = operatorDisjoint.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); { result = operatorIntersects.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(result); } } { com.esri.core.geometry.OperatorDisjoint operatorDisjoint = (com.esri.core.geometry.OperatorDisjoint)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); com.esri.core.geometry.OperatorIntersects operatorIntersects = (com.esri.core.geometry.OperatorIntersects)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Intersects)); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); poly2.QueryEnvelope2D(env2D); com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(env2D); bool result = operatorDisjoint.Execute(envelope, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); { result = operatorIntersects.Execute(envelope, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(result); } } { com.esri.core.geometry.OperatorDisjoint operatorDisjoint = (com.esri.core.geometry.OperatorDisjoint)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); com.esri.core.geometry.OperatorIntersects operatorIntersects = (com.esri.core.geometry.OperatorIntersects)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Intersects)); com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); env2D.SetCoords(855277, 3892059, 855277 + 100, 3892059 + 100); poly.AddEnvelope(env2D, false); env2D.SetCoords(855277 + 10, 3892059 + 10, 855277 + 90, 3892059 + 90); poly.AddEnvelope(env2D, true); env2D.SetCoords(855277 + 20, 3892059 + 20, 855277 + 200, 3892059 + 80); com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(env2D); bool result = operatorDisjoint.Execute(envelope, poly, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); { result = operatorIntersects.Execute(envelope, poly, inputSR, null); NUnit.Framework.Assert.IsTrue(result); } } { com.esri.core.geometry.OperatorTouches operatorTouches = (com.esri.core.geometry.OperatorTouches)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Touches)); bool result = operatorTouches.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); } } }
// [NUnit.Framework.Test] // public virtual void TestPolylinePolylineCrosses() // { // com.esri.core.geometry.OperatorCrosses crosses = (com.esri.core.geometry.OperatorCrosses)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); // com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(102100); // double tolerance = sr.GetTolerance(com.esri.core.geometry.VertexDescription.Semantics.POSITION); // // Polyline1 and Polyline2 touch at a point // string str1 = "{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0]],[[1,1],[9,1],[9,9],[1,9],[1,1],[1,1]]]}"; // string str2 = "{\"paths\":[[[10,10],[10,15],[15,15],[15,10]]]}"; // com.esri.core.geometry.Polyline polyline1 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str1).GetGeometry()); // com.esri.core.geometry.Polyline polyline2 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str2).GetGeometry()); // bool res = crosses.Execute(polyline1, polyline2, sr, null); // NUnit.Framework.Assert.IsTrue(!res); // res = crosses.Execute(polyline2, polyline1, sr, null); // NUnit.Framework.Assert.IsTrue(!res); // // Polyline1 and Polyline2 intersect at interiors // str1 = "{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]],[[1,1],[9,1],[9,9],[1,9],[1,1],[1,1]]]}"; // str2 = "{\"paths\":[[[15,5],[5,15],[15,15],[15,5]]]}"; // polyline1 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str1).GetGeometry()); // polyline2 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str2).GetGeometry()); // res = crosses.Execute(polyline1, polyline2, sr, null); // NUnit.Framework.Assert.IsTrue(res); // res = crosses.Execute(polyline2, polyline1, sr, null); // NUnit.Framework.Assert.IsTrue(res); // // Polyline1 and Polyline2 touch at an endpoint of Polyline1 and // // interior of Polyline2 (but Polyline1 is closed) // str1 = "{\"paths\":[[[10,10],[10,0],[0,0],[0,10],[10,10]],[[1,1],[9,1],[9,9],[1,9],[1,1],[1,1]]]}"; // str2 = "{\"paths\":[[[15,5],[5,15],[15,15]]]}"; // polyline1 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str1).GetGeometry()); // polyline2 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str2).GetGeometry()); // res = crosses.Execute(polyline1, polyline2, sr, null); // NUnit.Framework.Assert.IsTrue(res); // res = crosses.Execute(polyline2, polyline1, sr, null); // NUnit.Framework.Assert.IsTrue(res); // // Polyline1 and Polyline2 touch at an endpoint of Polyline1 and // // interior of Polyline2 (same as previous case, but Polyline1 is not // // closed) // str1 = "{\"paths\":[[[10,10],[10,0],[0,0],[0,10]],[[1,1],[9,1],[9,9],[1,9],[1,1],[1,1]]]}"; // str2 = "{\"paths\":[[[15,5],[5,15],[15,15]]]}"; // polyline1 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str1).GetGeometry()); // polyline2 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str2).GetGeometry()); // res = crosses.Execute(polyline1, polyline2, sr, null); // NUnit.Framework.Assert.IsTrue(!res); // res = crosses.Execute(polyline2, polyline1, sr, null); // NUnit.Framework.Assert.IsTrue(!res); // str1 = "{\"paths\":[[[10,11],[10,0],[0,0],[0,10]],[[1,1],[9,1],[9,9],[1,9],[6, 9]]]}"; // str2 = "{\"paths\":[[[15,5],[5,15],[15,15],[15,5]]]}"; // polyline1 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str1).GetGeometry()); // polyline2 = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson(str2).GetGeometry()); // res = crosses.Execute(polyline1, polyline2, sr, null); // NUnit.Framework.Assert.IsTrue(res); // res = crosses.Execute(polyline2, polyline1, sr, null); // NUnit.Framework.Assert.IsTrue(res); // polyline1.SetEmpty(); // polyline2.SetEmpty(); // polyline1.StartPath(-2, -2); // polyline1.LineTo(-1, -1); // polyline1.LineTo(1, 1); // polyline1.LineTo(2, 2); // polyline2.StartPath(-2, 2); // polyline2.LineTo(-1, 1); // polyline2.LineTo(1, -1); // polyline2.LineTo(2, -2); // res = crosses.Execute(polyline2, polyline1, sr, null); // NUnit.Framework.Assert.IsTrue(res); // } // // [NUnit.Framework.Test] // public virtual void TestPolygonEnvelope() // { // com.esri.core.geometry.OperatorEquals equals = (com.esri.core.geometry.OperatorEquals)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Equals)); // com.esri.core.geometry.OperatorContains contains = (com.esri.core.geometry.OperatorContains)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Contains)); // com.esri.core.geometry.OperatorDisjoint disjoint = (com.esri.core.geometry.OperatorDisjoint)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); // com.esri.core.geometry.OperatorCrosses crosses = (com.esri.core.geometry.OperatorCrosses)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); // com.esri.core.geometry.OperatorWithin within = (com.esri.core.geometry.OperatorWithin)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Within)); // com.esri.core.geometry.OperatorOverlaps overlaps = (com.esri.core.geometry.OperatorOverlaps)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Overlaps)); // com.esri.core.geometry.OperatorTouches touches = (com.esri.core.geometry.OperatorTouches)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Touches)); // com.esri.core.geometry.OperatorDensifyByLength densify = (com.esri.core.geometry.OperatorDensifyByLength)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.DensifyByLength)); // com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(envelope, densified, sr, null)); // // they // // cover // // the // // same // // space // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // the // // polygon // // contains // // the // // envelope, // // but // // they // // aren't // // equal // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":15,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // the // // envelope // // sticks // // outside // // of // // the // // polygon // // but // // they // // intersect // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":15,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // the // // envelope // // sticks // // outside // // of // // the // // polygon // // but // // they // // intersect // // and // // overlap // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":10,\"ymin\":0,\"xmax\":15,\"ymax\":5}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // the // // envelope // // rides // // the // // side // // of // // the // // polygon // // (they // // touch) // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // // polygon // // and // // envelope // // cover // // the // // same // // space // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // sticks // // outside // // of // // polygon, // // but // // the // // envelopes // // are // // equal // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":15,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // the // // polygon // // envelope // // doesn't // // contain // // the // // envelope, // // but // // they // // intersect // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // point // // and // // is // // on // // border // // (i.e. // // touches) // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":1,\"ymin\":1,\"xmax\":1,\"ymax\":1}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // point // // and // // is // // properly // // inside // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":-1,\"ymin\":-1,\"xmax\":-1,\"ymax\":-1}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // point // // and // // is // // properly // // outside // NUnit.Framework.Assert.IsTrue(disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":1,\"ymax\":0}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // line // // and // // rides // // the // // bottom // // of // // the // // polygon // // (no // // interior // // intersection) // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":1,\"xmax\":1,\"ymax\":1}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // line, // // touches // // the // // border // // on // // the // // inside // // yet // // has // // interior // // intersection // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":5,\"xmax\":6,\"ymax\":5}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // line, // // touches // // the // // boundary, // // and // // is // // outside // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":6,\"ymin\":5,\"xmax\":7,\"ymax\":5}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // line, // // and // // is // // outside // NUnit.Framework.Assert.IsTrue(disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polygon polygon = (com.esri.core.geometry.Polygon)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"rings\":[[[0,0],[0,5],[0,10],[10,0],[0,0]]]}").GetGeometry()); // com.esri.core.geometry.Polygon densified = (com.esri.core.geometry.Polygon)(densify.Execute(polygon, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":4,\"ymin\":5,\"xmax\":7,\"ymax\":5}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // // envelope // // degenerate // // to // // a // // line, // // and // // crosses // // polygon // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(envelope, densified, sr, null)); // } // } // // [NUnit.Framework.Test] // public virtual void TestPolylineEnvelope() // { // com.esri.core.geometry.OperatorEquals equals = (com.esri.core.geometry.OperatorEquals)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Equals)); // com.esri.core.geometry.OperatorContains contains = (com.esri.core.geometry.OperatorContains)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Contains)); // com.esri.core.geometry.OperatorDisjoint disjoint = (com.esri.core.geometry.OperatorDisjoint)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); // com.esri.core.geometry.OperatorCrosses crosses = (com.esri.core.geometry.OperatorCrosses)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); // com.esri.core.geometry.OperatorWithin within = (com.esri.core.geometry.OperatorWithin)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Within)); // com.esri.core.geometry.OperatorOverlaps overlaps = (com.esri.core.geometry.OperatorOverlaps)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Overlaps)); // com.esri.core.geometry.OperatorTouches touches = (com.esri.core.geometry.OperatorTouches)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Touches)); // com.esri.core.geometry.OperatorDensifyByLength densify = (com.esri.core.geometry.OperatorDensifyByLength)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.DensifyByLength)); // com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // polyline // // straddles // // the // // envelope // // like // // a hat // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[-10,0],[0,10]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[-11,0],[1,12]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[5,5],[6,6]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // polyline // // properly // // inside // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[5,5],[10,10]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[-5,5],[15,5]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(densified, envelope, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[5,5],[5,15]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // polyline // // slices // // through // // the // // envelope // // (interior // // and // // exterior // // intersection) // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[5,11],[5,15]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // polyline // // outside // // of // // envelope // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // polyline // // straddles // // the // // degenerate // // envelope // // like // // a hat // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":-5,\"xmax\":0,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 511); // WiggleGeometry(envelope, 0.00000001, 1982); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // degenerate // // envelope // // is at // // the // // end // // point // // of // // polyline // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[0,0],[0,5],[0,10],[10,10],[10,0]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":5,\"xmax\":0,\"ymax\":5}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // degenerate // // envelope // // is at // // the // // interior // // of // // polyline // NUnit.Framework.Assert.IsTrue(contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[2,-2],[2,2]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // degenerate // // envelope // // crosses // // polyline // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[2,0],[2,2]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // degenerate // // envelope // // crosses // // polyline // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[2,0],[2,2]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":2,\"ymin\":0,\"xmax\":2,\"ymax\":3}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // degenerate // // envelope // // contains // // polyline // NUnit.Framework.Assert.IsTrue(!contains.Execute(densified, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[5,5],[6,6]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":5,\"ymax\":5}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, densified, sr, null)); // // polyline // // properly // // inside // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // { // com.esri.core.geometry.Polyline polyline = (com.esri.core.geometry.Polyline)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"paths\":[[[5,5],[5,10]]]}").GetGeometry()); // com.esri.core.geometry.Polyline densified = (com.esri.core.geometry.Polyline)(densify.Execute(polyline, 1.0, null)); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":5,\"xmax\":5,\"ymax\":10}").GetGeometry()); // WiggleGeometry(densified, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(envelope, densified, sr, null)); // // polyline // // properly // // inside // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, densified, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, densified, sr, null)); // } // } // // [NUnit.Framework.Test] // public virtual void TestMultiPointEnvelope() // { // com.esri.core.geometry.OperatorEquals equals = (com.esri.core.geometry.OperatorEquals)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Equals)); // com.esri.core.geometry.OperatorContains contains = (com.esri.core.geometry.OperatorContains)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Contains)); // com.esri.core.geometry.OperatorDisjoint disjoint = (com.esri.core.geometry.OperatorDisjoint)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); // com.esri.core.geometry.OperatorCrosses crosses = (com.esri.core.geometry.OperatorCrosses)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); // com.esri.core.geometry.OperatorWithin within = (com.esri.core.geometry.OperatorWithin)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Within)); // com.esri.core.geometry.OperatorOverlaps overlaps = (com.esri.core.geometry.OperatorOverlaps)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Overlaps)); // com.esri.core.geometry.OperatorTouches touches = (com.esri.core.geometry.OperatorTouches)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Touches)); // com.esri.core.geometry.OperatorDensifyByLength densify = (com.esri.core.geometry.OperatorDensifyByLength)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.DensifyByLength)); // com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,0],[0,10],[10,10],[10,0]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // all // // points // // on // // boundary // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,0],[0,10],[10,10],[5,5]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // points // // on // // boundary // // and // // one // // point // // in // // interior // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,0],[0,10],[10,10],[5,5],[15,15]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // points // // on // // boundary, // // one // // interior, // // one // // exterior // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,0],[0,10],[10,10],[15,15]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // points // // on // // boundary, // // one // // exterior // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,-1],[0,11],[11,11],[15,15]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // all // // points // // exterior // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,0],[0,10],[10,10],[10,0]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // degenerate // // envelope // // slices // // through // // some // // points, // // but // // some // // points // // are // // off // // the // // line // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,0],[1,10],[10,10],[10,0]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // degenerate // // envelope // // slices // // through // // some // // points, // // but // // some // // points // // are // // off // // the // // line // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,10],[10,10]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // degenerate // // envelopes // // slices // // through // // all // // the // // points, // // and // // they // // are // // at // // the // // end // // points // // of // // the // // line // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[1,10],[9,10]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // degenerate // // envelopes // // slices // // through // // all // // the // // points, // // and // // they // // are // // in // // the // // interior // // of // // the // // line // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,-1],[0,11],[11,11],[15,15]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // all // // points // // exterior // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,-1],[0,11],[11,11],[15,15]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":10,\"ymin\":10,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // all // // points // // exterior // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,-1],[0,11],[11,11],[15,15]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":11,\"ymax\":11}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, multi_point, sr, null)); // // all // // points // // exterior // NUnit.Framework.Assert.IsTrue(!contains.Execute(multi_point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // { // com.esri.core.geometry.MultiPoint multi_point = (com.esri.core.geometry.MultiPoint)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"points\":[[0,-1],[0,-1]]}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":-1,\"xmax\":0,\"ymax\":-1}").GetGeometry()); // WiggleGeometry(multi_point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(envelope, multi_point, sr, null)); // // all // // points // // exterior // NUnit.Framework.Assert.IsTrue(contains.Execute(multi_point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, multi_point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, multi_point, sr, null)); // } // } // // [NUnit.Framework.Test] // public virtual void TestPointEnvelope() // { // com.esri.core.geometry.OperatorEquals equals = (com.esri.core.geometry.OperatorEquals)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Equals)); // com.esri.core.geometry.OperatorContains contains = (com.esri.core.geometry.OperatorContains)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Contains)); // com.esri.core.geometry.OperatorDisjoint disjoint = (com.esri.core.geometry.OperatorDisjoint)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); // com.esri.core.geometry.OperatorCrosses crosses = (com.esri.core.geometry.OperatorCrosses)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); // com.esri.core.geometry.OperatorWithin within = (com.esri.core.geometry.OperatorWithin)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Within)); // com.esri.core.geometry.OperatorOverlaps overlaps = (com.esri.core.geometry.OperatorOverlaps)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Overlaps)); // com.esri.core.geometry.OperatorTouches touches = (com.esri.core.geometry.OperatorTouches)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Touches)); // com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":5,\"y\":6}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":0,\"y\":10}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":0,\"y\":11}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":0,\"y\":0}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":5,\"y\":0}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":11,\"y\":0}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // { // com.esri.core.geometry.Point point = (com.esri.core.geometry.Point)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"x\":0,\"y\":0}").GetGeometry()); // com.esri.core.geometry.Envelope envelope = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // WiggleGeometry(point, 0.00000001, 1982); // WiggleGeometry(envelope, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(point, envelope, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(envelope, point, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(envelope, point, sr, null)); // } // } // // [NUnit.Framework.Test] // public virtual void TestEnvelopeEnvelope() // { // com.esri.core.geometry.OperatorEquals equals = (com.esri.core.geometry.OperatorEquals)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Equals)); // com.esri.core.geometry.OperatorContains contains = (com.esri.core.geometry.OperatorContains)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Contains)); // com.esri.core.geometry.OperatorDisjoint disjoint = (com.esri.core.geometry.OperatorDisjoint)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); // com.esri.core.geometry.OperatorCrosses crosses = (com.esri.core.geometry.OperatorCrosses)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Crosses)); // com.esri.core.geometry.OperatorWithin within = (com.esri.core.geometry.OperatorWithin)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Within)); // com.esri.core.geometry.OperatorOverlaps overlaps = (com.esri.core.geometry.OperatorOverlaps)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Overlaps)); // com.esri.core.geometry.OperatorTouches touches = (com.esri.core.geometry.OperatorTouches)(com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Touches)); // com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":5,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":5,\"xmax\":15,\"ymax\":15}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":10,\"ymin\":0,\"xmax\":20,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":10,\"ymin\":0,\"xmax\":20,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":10,\"ymin\":0,\"xmax\":20,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":10,\"xmax\":10,\"ymax\":20}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":15,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":-5,\"ymin\":5,\"xmax\":0,\"ymax\":5}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":-5,\"ymin\":5,\"xmax\":5,\"ymax\":5}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":3,\"ymin\":5,\"xmax\":5,\"ymax\":5}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":3,\"ymin\":5,\"xmax\":10,\"ymax\":5}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":-5,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":15,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":15,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":-5,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":-5,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":-5,\"xmax\":5,\"ymax\":5}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":10,\"ymin\":0,\"xmax\":20,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":5,\"ymax\":5}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":5,\"xmax\":5,\"ymax\":5}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":10}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":0,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":0,\"ymin\":0,\"xmax\":10,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(!equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // { // com.esri.core.geometry.Envelope env1 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // com.esri.core.geometry.Envelope env2 = (com.esri.core.geometry.Envelope)(com.esri.core.geometry.TestCommonMethods.FromJson("{\"xmin\":5,\"ymin\":0,\"xmax\":5,\"ymax\":0}").GetGeometry()); // WiggleGeometry(env1, 0.00000001, 1982); // WiggleGeometry(env2, 0.00000001, 511); // NUnit.Framework.Assert.IsTrue(equals.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(contains.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!disjoint.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!touches.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!overlaps.Execute(env2, env1, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env1, env2, sr, null)); // NUnit.Framework.Assert.IsTrue(!crosses.Execute(env2, env1, sr, null)); // } // } internal static void WiggleGeometry(com.esri.core.geometry.Geometry geometry, double tolerance, int rand) { int type = geometry.GetType().Value(); if (type == com.esri.core.geometry.Geometry.GeometryType.Polygon || type == com.esri.core.geometry.Geometry.GeometryType.Polyline || type == com.esri.core.geometry.Geometry.GeometryType.MultiPoint) { com.esri.core.geometry.MultiVertexGeometry mvGeom = (com.esri.core.geometry.MultiVertexGeometry)geometry; for (int i = 0; i < mvGeom.GetPointCount(); i++) { com.esri.core.geometry.Point2D pt = mvGeom.GetXY(i); // create random vector and normalize it to 0.49 * tolerance com.esri.core.geometry.Point2D randomV = new com.esri.core.geometry.Point2D(); rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.x = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.y = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; randomV.Normalize(); randomV.Scale(0.45 * tolerance); pt.Add(randomV); mvGeom.SetXY(i, pt); } } else { if (type == com.esri.core.geometry.Geometry.GeometryType.Point) { com.esri.core.geometry.Point ptGeom = (com.esri.core.geometry.Point)(geometry); com.esri.core.geometry.Point2D pt = ptGeom.GetXY(); // create random vector and normalize it to 0.49 * tolerance com.esri.core.geometry.Point2D randomV = new com.esri.core.geometry.Point2D(); rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.x = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.y = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; randomV.Normalize(); randomV.Scale(0.45 * tolerance); pt.Add(randomV); ptGeom.SetXY(pt); } else { if (type == com.esri.core.geometry.Geometry.GeometryType.Envelope) { com.esri.core.geometry.Envelope envGeom = (com.esri.core.geometry.Envelope)(geometry); com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); envGeom.QueryEnvelope2D(env); double xmin; double xmax; double ymin; double ymax; com.esri.core.geometry.Point2D pt = new com.esri.core.geometry.Point2D(); env.QueryLowerLeft(pt); // create random vector and normalize it to 0.49 * tolerance com.esri.core.geometry.Point2D randomV = new com.esri.core.geometry.Point2D(); rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.x = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.y = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; randomV.Normalize(); randomV.Scale(0.45 * tolerance); xmin = (pt.x + randomV.x); ymin = (pt.y + randomV.y); env.QueryUpperRight(pt); // create random vector and normalize it to 0.49 * tolerance rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.x = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; rand = com.esri.core.geometry.NumberUtils.NextRand(rand); randomV.y = 1.0 * rand / com.esri.core.geometry.NumberUtils.IntMax() - 0.5; randomV.Normalize(); randomV.Scale(0.45 * tolerance); xmax = (pt.x + randomV.x); ymax = (pt.y + randomV.y); if (xmin > xmax) { double swap = xmin; xmin = xmax; xmax = swap; } if (ymin > ymax) { double swap = ymin; ymin = ymax; ymax = swap; } envGeom.SetCoords(xmin, ymin, xmax, ymax); } } } }
public virtual void testBufferPolygon() { com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference .create(4326); com.esri.core.geometry.Polygon inputGeom = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type .Buffer); com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify )com.esri.core.geometry.OperatorFactoryLocal.getInstance().getOperator(com.esri.core.geometry.Operator.Type .Simplify); inputGeom.startPath(0, 0); inputGeom.lineTo(50, 50); inputGeom.lineTo(50, 0); { com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 0, null); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); NUnit.Framework.Assert.IsTrue(result == inputGeom); } { com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, 10, null); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.queryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 20 - 50) < 0.1 && System.Math.abs(env2D.getHeight() - 20 - 50) < 0.1); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 25) < 0.1 && System.Math .abs(env2D.getCenterY() - 25) < 0.1); int pathCount = poly.getPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 1); int pointCount = poly.getPointCount(); NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 104.0) < 10); NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null)); } { sr = com.esri.core.geometry.SpatialReference.create(4326); inputGeom = new com.esri.core.geometry.Polygon(); inputGeom.startPath(0, 0); inputGeom.lineTo(50, 50); inputGeom.lineTo(50, 0); com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, -10, null); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.queryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() - 15.85) < 0.1 && System.Math.abs(env2D.getHeight() - 15.85) < 0.1); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 32.07) < 0.1 && System.Math.abs(env2D.getCenterY() - 17.93) < 0.1); int pathCount = poly.getPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 1); int pointCount = poly.getPointCount(); NUnit.Framework.Assert.IsTrue(pointCount == 3); NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null)); } { sr = com.esri.core.geometry.SpatialReference.create(4326); inputGeom = new com.esri.core.geometry.Polygon(); inputGeom.startPath(0, 0); inputGeom.lineTo(0, 50); inputGeom.lineTo(50, 50); inputGeom.lineTo(50, 0); inputGeom.startPath(10, 10); inputGeom.lineTo(40, 10); inputGeom.lineTo(40, 40); inputGeom.lineTo(10, 40); com.esri.core.geometry.Geometry result = buffer.execute(inputGeom, sr, -2, null); NUnit.Framework.Assert.IsTrue(result.getType().value() == com.esri.core.geometry.Geometry.GeometryType .Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.queryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getWidth() + 4 - 50) < 0.1 && System.Math.abs(env2D.getHeight() + 4 - 50) < 0.1); NUnit.Framework.Assert.IsTrue(System.Math.abs(env2D.getCenterX() - 25) < 0.1 && System.Math .abs(env2D.getCenterY() - 25) < 0.1); int pathCount = poly.getPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 2); int pointCount = poly.getPointCount(); NUnit.Framework.Assert.IsTrue(System.Math.abs(pointCount - 108) < 10); NUnit.Framework.Assert.IsTrue(simplify.isSimpleAsFeature(result, sr, null)); } }
public static void TestClipGeometries() { // RandomTest(); com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip)engine.GetOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polygon polygon = MakePolygon(); com.esri.core.geometry.SimpleGeometryCursor polygonCurs = new com.esri.core.geometry.SimpleGeometryCursor(polygon); com.esri.core.geometry.Polyline polyline = MakePolyline(); com.esri.core.geometry.SimpleGeometryCursor polylineCurs = new com.esri.core.geometry.SimpleGeometryCursor(polyline); com.esri.core.geometry.MultiPoint multipoint = MakeMultiPoint(); com.esri.core.geometry.SimpleGeometryCursor multipointCurs = new com.esri.core.geometry.SimpleGeometryCursor(multipoint); com.esri.core.geometry.Point point = MakePoint(); com.esri.core.geometry.SimpleGeometryCursor pointCurs = new com.esri.core.geometry.SimpleGeometryCursor(point); com.esri.core.geometry.SpatialReference spatialRef = com.esri.core.geometry.SpatialReference.Create(3857); com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D(); envelope.xmin = 0; envelope.xmax = 20; envelope.ymin = 5; envelope.ymax = 15; // Cursor implementation com.esri.core.geometry.GeometryCursor clipPolygonCurs = clipOp.Execute(polygonCurs, envelope, spatialRef, null); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipPolygonCurs.Next(); double area = clippedPolygon.CalculateArea2D(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(area - 25) < 0.00001); // Single Geometry implementation clippedPolygon = (com.esri.core.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.esri.core.geometry.GeometryCursor clipPolylineCurs = clipOp.Execute(polylineCurs, envelope, spatialRef, null); com.esri.core.geometry.Polyline clippedPolyline = (com.esri.core.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.esri.core.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.esri.core.geometry.GeometryCursor clipMulti_pointCurs = clipOp.Execute(multipointCurs, envelope, spatialRef, null); com.esri.core.geometry.MultiPoint clipped_multi_point = (com.esri.core.geometry.MultiPoint)clipMulti_pointCurs.Next(); int pointCount = clipped_multi_point.GetPointCount(); NUnit.Framework.Assert.IsTrue(pointCount == 2); // Cursor implementation com.esri.core.geometry.GeometryCursor clipPointCurs = clipOp.Execute(pointCurs, envelope, spatialRef, null); com.esri.core.geometry.Point clippedPoint = (com.esri.core.geometry.Point)clipPointCurs.Next(); NUnit.Framework.Assert.IsTrue(clippedPoint != null); // RandomTest(); com.esri.core.geometry.Polyline _poly = new com.esri.core.geometry.Polyline(); _poly.StartPath(2, 2); _poly.LineTo(0, 0); com.esri.core.geometry.Envelope2D _env = new com.esri.core.geometry.Envelope2D(); _env.SetCoords(2, 1, 5, 3); com.esri.core.geometry.Polyline _clippedPolyline = (com.esri.core.geometry.Polyline)clipOp.Execute(_poly, _env, spatialRef, null); NUnit.Framework.Assert.IsTrue(_clippedPolyline.IsEmpty()); { com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); poly.AddEnvelope(new com.esri.core.geometry.Envelope2D(0, 0, 100, 100), false); poly.AddEnvelope(new com.esri.core.geometry.Envelope2D(5, 5, 95, 95), true); com.esri.core.geometry.Polygon clippedPoly = (com.esri.core.geometry.Polygon)clipOp.Execute(poly, new com.esri.core.geometry.Envelope2D(-10, -10, 110, 50), spatialRef, null); NUnit.Framework.Assert.IsTrue(clippedPoly.GetPathCount() == 1); NUnit.Framework.Assert.IsTrue(clippedPoly.GetPointCount() == 8); } }
public static com.esri.core.geometry.Envelope MakeEnvelope3() { com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(5, 5, 6, 6); com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(env); return envelope; }
internal static com.esri.core.geometry.QuadTree BuildQuadTree_(com.esri.core.geometry.MultiPathImpl multipathImpl) { com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D(); multipathImpl.QueryEnvelope2D(extent); com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent, 8); int hint_index = -1; com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.SegmentIteratorImpl seg_iter = multipathImpl.QuerySegmentIterator(); while (seg_iter.NextPath()) { while (seg_iter.HasNextSegment()) { com.esri.core.geometry.Segment segment = seg_iter.NextSegment(); int index = seg_iter.GetStartPointIndex(); segment.QueryEnvelope2D(boundingbox); hint_index = quadTree.Insert(index, boundingbox, hint_index); } } return quadTree; }
public virtual void TestFromProjection() { com.esri.core.geometry.MultiPoint multiPointInitial = new com.esri.core.geometry.MultiPoint(); multiPointInitial.Add(-20037508.342789244, 3360107.7777777780); multiPointInitial.Add(-18924313.434856508, 3360107.7777777780); multiPointInitial.Add(-18924313.434856508, -3360107.7777777780); multiPointInitial.Add(-20037508.342789244, -3360107.7777777780); com.esri.core.geometry.Geometry geom1 = ((com.esri.core.geometry.MultiPoint)multiPointInitial); com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(102100); com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(-20037508.342788246, -30240971.958386172, 20037508.342788246, 30240971.958386205); /* xmin */ /* ymin */ /* xmax */ /* ymax */ // /*xmin*/ -20037508.342788246 // /*ymin*/ -30240971.958386172 // /*xmax*/ 20037508.342788246 // /*ymax*/ 30240971.958386205 com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); poly.StartPath(env.xmin, env.ymin); poly.LineTo(env.xmin, env.ymax); poly.LineTo(env.xmax, env.ymax); poly.LineTo(env.xmax, env.ymin); com.esri.core.geometry.Geometry geom2 = new com.esri.core.geometry.Envelope(env); // Geometry geom2 = poly; com.esri.core.geometry.OperatorIntersection operatorIntersection = (com.esri.core.geometry.OperatorIntersection)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Intersection); com.esri.core.geometry.MultiPoint multiPointOut = (com.esri.core.geometry.MultiPoint)(operatorIntersection.Execute(geom1, geom2, sr, null)); NUnit.Framework.Assert.IsTrue(multiPointOut.GetCoordinates2D().Length == 2); NUnit.Framework.Assert.IsTrue(multiPointOut.GetCoordinates2D()[0].x == -18924313.434856508); NUnit.Framework.Assert.IsTrue(multiPointOut.GetCoordinates2D()[0].y == 3360107.7777777780); NUnit.Framework.Assert.IsTrue(multiPointOut.GetCoordinates2D()[1].x == -18924313.434856508); NUnit.Framework.Assert.IsTrue(multiPointOut.GetCoordinates2D()[1].y == -3360107.7777777780); }
public static void TestArcObjectsFailureCR196492() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip)engine.GetOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.AddEnvelope(new com.esri.core.geometry.Envelope2D(0, 0, 600, 600), false); polygon.StartPath(30, 300); polygon.LineTo(20, 310); polygon.LineTo(10, 300); com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference.Create(4326); com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D(10, 10, 500, 500); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.Execute(polygon, envelopeCR, gcsWGS84, null); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetPointCount() == 7); }
public static void TestClipIssue258243() { com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); poly1.StartPath(21.476191371901479, 41.267022001907215); poly1.LineTo(59.669186665158051, 36.62700518555863); poly1.LineTo(20.498578117352313, 30.363180148246094); poly1.LineTo(18.342565836615044, 46.303295352085627); poly1.LineTo(17.869569458621626, 23.886816966894159); poly1.LineTo(19.835465558090434, 20); poly1.LineTo(18.83911285048551, 43.515995498114791); poly1.LineTo(20.864485260298004, 20.235921201027757); poly1.LineTo(18.976127544787012, 20); poly1.LineTo(34.290201277718218, 61.801369014954794); poly1.LineTo(20.734727419368866, 20); poly1.LineTo(18.545865698148113, 20); poly1.LineTo(19.730260558565515, 20); poly1.LineTo(19.924806216827005, 23.780315893949187); poly1.LineTo(21.675168105421452, 36.699924873001258); poly1.LineTo(22.500527828912158, 43.703424859922983); poly1.LineTo(42.009527116514818, 36.995486982256089); poly1.LineTo(24.469729873835782, 58.365871758247039); poly1.LineTo(24.573736036545878, 36.268390409195824); poly1.LineTo(22.726502169802746, 20); poly1.LineTo(23.925834885228145, 20); poly1.LineTo(25.495346880936729, 20); poly1.LineTo(23.320941499288317, 20); poly1.LineTo(24.05655665646276, 28.659578774758632); poly1.LineTo(23.205940789341135, 38.491506888710504); poly1.LineTo(21.472847203385509, 53.057228182018044); poly1.LineTo(25.04257681654104, 20); poly1.LineTo(25.880572351149542, 25.16102863979474); poly1.LineTo(26.756283333879658, 20); poly1.LineTo(21.476191371901479, 41.267022001907215); com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.SetCoords(24.269517325186033, 19.999998900000001, 57.305574253225409, 61.801370114954793); try { com.esri.core.geometry.Geometry output_geom = com.esri.core.geometry.OperatorClip.Local().Execute(poly1, env, com.esri.core.geometry.SpatialReference.Create(4326), null); com.esri.core.geometry.Envelope envPoly = new com.esri.core.geometry.Envelope(); poly1.QueryEnvelope(envPoly); com.esri.core.geometry.Envelope e = new com.esri.core.geometry.Envelope(env); e.Intersect(envPoly); com.esri.core.geometry.Envelope clippedEnv = new com.esri.core.geometry.Envelope(); output_geom.QueryEnvelope(clippedEnv); NUnit.Framework.Assert.IsTrue(System.Math.Abs(clippedEnv.GetXMin() - e.GetXMin()) < 1e-10 && System.Math.Abs(clippedEnv.GetYMin() - e.GetYMin()) < 1e-10 && System.Math.Abs(clippedEnv.GetXMax() - e.GetXMax()) < 1e-10 && System.Math.Abs(clippedEnv.GetYMax() - e.GetYMax()) < 1e-10); } catch (System.Exception) { NUnit.Framework.Assert.IsTrue(false); } }
public static void TestGetXCorrectCR185697() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip)engine.GetOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polyline polylineCR = MakePolylineCR(); com.esri.core.geometry.SimpleGeometryCursor polylineCursCR = new com.esri.core.geometry.SimpleGeometryCursor(polylineCR); com.esri.core.geometry.SpatialReference gcsWGS84 = com.esri.core.geometry.SpatialReference.Create(4326); com.esri.core.geometry.Envelope2D envelopeCR = new com.esri.core.geometry.Envelope2D(); envelopeCR.xmin = -180; envelopeCR.xmax = 180; envelopeCR.ymin = -90; envelopeCR.ymax = 90; // CR com.esri.core.geometry.Polyline clippedPolylineCR = (com.esri.core.geometry.Polyline)clipOp.Execute(polylineCR, envelopeCR, gcsWGS84, null); com.esri.core.geometry.Point pointResult = new com.esri.core.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 static void TestClipAttributes() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip)engine.GetOperator(com.esri.core.geometry.Operator.Type.Clip); { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); polygon.StartPath(0, 0); polygon.LineTo(30, 30); polygon.LineTo(60, 0); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 0); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 60); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 120); com.esri.core.geometry.Envelope2D clipper = new com.esri.core.geometry.Envelope2D(); clipper.SetCoords(10, 0, 50, 20); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.Execute(polygon, clipper, com.esri.core.geometry.SpatialReference.Create(4326), null); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 100); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 19.999999999999996); // 20.0 NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 20); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0) == 40); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 4, 0) == 80); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 5, 0) == 100); } { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.AddAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); polygon.StartPath(0, 0); polygon.LineTo(0, 40); polygon.LineTo(20, 40); polygon.LineTo(20, 0); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 0); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 60); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 120); polygon.SetAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0, 180); com.esri.core.geometry.Envelope2D clipper = new com.esri.core.geometry.Envelope2D(); clipper.SetCoords(0, 10, 20, 20); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp.Execute(polygon, clipper, com.esri.core.geometry.SpatialReference.Create(4326), null); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0) == 15); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0) == 30); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0) == 150); NUnit.Framework.Assert.IsTrue(clippedPolygon.GetAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0) == 165); } }
public static void testEnvelope2Dintersector() { System.Collections.Generic.List <com.esri.core.geometry.Envelope2D> envelopes = new System.Collections.Generic.List <com.esri.core.geometry.Envelope2D>(0); com.esri.core.geometry.Envelope2D env0 = new com.esri.core.geometry.Envelope2D(2, 3, 4, 4); com.esri.core.geometry.Envelope2D env1 = new com.esri.core.geometry.Envelope2D(5, 13, 9, 15); com.esri.core.geometry.Envelope2D env2 = new com.esri.core.geometry.Envelope2D(6, 9, 11, 12); com.esri.core.geometry.Envelope2D env3 = new com.esri.core.geometry.Envelope2D(8, 10, 9, 17); com.esri.core.geometry.Envelope2D env4 = new com.esri.core.geometry.Envelope2D(11.001 , 12, 14, 14); com.esri.core.geometry.Envelope2D env5 = new com.esri.core.geometry.Envelope2D(1, 3, 3, 4); com.esri.core.geometry.Envelope2D env6 = new com.esri.core.geometry.Envelope2D(0, 2, 5, 10); com.esri.core.geometry.Envelope2D env7 = new com.esri.core.geometry.Envelope2D(4, 7, 5, 10); com.esri.core.geometry.Envelope2D env8 = new com.esri.core.geometry.Envelope2D(3, 15, 15, 15); com.esri.core.geometry.Envelope2D env9 = new com.esri.core.geometry.Envelope2D(0, 9, 14, 9); com.esri.core.geometry.Envelope2D env10 = new com.esri.core.geometry.Envelope2D(0 , 8.999, 14, 8.999); envelopes.add(env0); envelopes.add(env1); envelopes.add(env2); envelopes.add(env3); envelopes.add(env4); envelopes.add(env5); envelopes.add(env6); envelopes.add(env7); envelopes.add(env8); envelopes.add(env9); envelopes.add(env10); com.esri.core.geometry.Envelope2DIntersectorImpl intersector = new com.esri.core.geometry.Envelope2DIntersectorImpl (); intersector.setTolerance(0.001); intersector.startConstruction(); for (int i = 0; i < envelopes.Count; i++) { intersector.addEnvelope(i, envelopes[i]); } intersector.endConstruction(); int count = 0; while (intersector.next()) { int env_a = intersector.getHandleA(); int env_b = intersector.getHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(envelopes[env_a]); env.inflate(0.001, 0.001); NUnit.Framework.Assert.IsTrue(env.isIntersecting(envelopes[env_b])); } System.Diagnostics.Debug.Assert((count == 16)); com.esri.core.geometry.Envelope2DIntersectorImpl intersector2 = new com.esri.core.geometry.Envelope2DIntersectorImpl (); intersector2.setTolerance(0.0); intersector2.startConstruction(); for (int i_1 = 0; i_1 < envelopes.Count; i_1++) { intersector2.addEnvelope(i_1, envelopes[i_1]); } intersector2.endConstruction(); count = 0; while (intersector2.next()) { int env_a = intersector2.getHandleA(); int env_b = intersector2.getHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.isIntersecting(envelopes[env_b])); } System.Diagnostics.Debug.Assert((count == 13)); env0 = new com.esri.core.geometry.Envelope2D(0, 0, 0, 10); env1 = new com.esri.core.geometry.Envelope2D(0, 10, 10, 10); env2 = new com.esri.core.geometry.Envelope2D(10, 0, 10, 10); env3 = new com.esri.core.geometry.Envelope2D(0, 0, 10, 0); envelopes.clear(); envelopes.add(env0); envelopes.add(env1); envelopes.add(env2); envelopes.add(env3); com.esri.core.geometry.Envelope2DIntersectorImpl intersector3 = new com.esri.core.geometry.Envelope2DIntersectorImpl (); intersector3.setTolerance(0.001); intersector3.startConstruction(); for (int i_2 = 0; i_2 < envelopes.Count; i_2++) { intersector3.addEnvelope(i_2, envelopes[i_2]); } intersector3.endConstruction(); count = 0; while (intersector3.next()) { int env_a = intersector3.getHandleA(); int env_b = intersector3.getHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.isIntersecting(envelopes[env_b])); } NUnit.Framework.Assert.IsTrue(count == 4); env0 = new com.esri.core.geometry.Envelope2D(0, 0, 0, 10); envelopes.clear(); envelopes.add(env0); envelopes.add(env0); envelopes.add(env0); envelopes.add(env0); com.esri.core.geometry.Envelope2DIntersectorImpl intersector4 = new com.esri.core.geometry.Envelope2DIntersectorImpl (); intersector4.setTolerance(0.001); intersector4.startConstruction(); for (int i_3 = 0; i_3 < envelopes.Count; i_3++) { intersector4.addEnvelope(i_3, envelopes[i_3]); } intersector4.endConstruction(); count = 0; while (intersector4.next()) { int env_a = intersector4.getHandleA(); int env_b = intersector4.getHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.isIntersecting(envelopes[env_b])); } System.Diagnostics.Debug.Assert((count == 6)); env0 = new com.esri.core.geometry.Envelope2D(0, 10, 10, 10); envelopes.clear(); envelopes.add(env0); envelopes.add(env0); envelopes.add(env0); envelopes.add(env0); com.esri.core.geometry.Envelope2DIntersectorImpl intersector5 = new com.esri.core.geometry.Envelope2DIntersectorImpl (); intersector5.setTolerance(0.001); intersector5.startConstruction(); for (int i_4 = 0; i_4 < envelopes.Count; i_4++) { intersector5.addEnvelope(i_4, envelopes[i_4]); } intersector5.endConstruction(); count = 0; while (intersector5.next()) { int env_a = intersector5.getHandleA(); int env_b = intersector5.getHandleB(); count++; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); env.setCoords(envelopes[env_a]); NUnit.Framework.Assert.IsTrue(env.isIntersecting(envelopes[env_b])); } NUnit.Framework.Assert.IsTrue(count == 6); }
public virtual void TestEnvelope2D_corners() { com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(0, 1, 2, 3); NUnit.Framework.Assert.IsFalse(env.Equals(null)); NUnit.Framework.Assert.IsTrue(env.Equals((object)new com.esri.core.geometry.Envelope2D(0, 1, 2, 3))); com.esri.core.geometry.Point2D pt2D = env.GetLowerLeft(); NUnit.Framework.Assert.IsTrue(pt2D.Equals(com.esri.core.geometry.Point2D.Construct(0, 1))); pt2D = env.GetUpperLeft(); NUnit.Framework.Assert.IsTrue(pt2D.Equals(com.esri.core.geometry.Point2D.Construct(0, 3))); pt2D = env.GetUpperRight(); NUnit.Framework.Assert.IsTrue(pt2D.Equals(com.esri.core.geometry.Point2D.Construct(2, 3))); pt2D = env.GetLowerRight(); NUnit.Framework.Assert.IsTrue(pt2D.Equals(com.esri.core.geometry.Point2D.Construct(2, 1))); { com.esri.core.geometry.Point2D[] corners = new com.esri.core.geometry.Point2D[4]; env.QueryCorners(corners); NUnit.Framework.Assert.IsTrue(corners[0].Equals(com.esri.core.geometry.Point2D.Construct(0, 1))); NUnit.Framework.Assert.IsTrue(corners[1].Equals(com.esri.core.geometry.Point2D.Construct(0, 3))); NUnit.Framework.Assert.IsTrue(corners[2].Equals(com.esri.core.geometry.Point2D.Construct(2, 3))); NUnit.Framework.Assert.IsTrue(corners[3].Equals(com.esri.core.geometry.Point2D.Construct(2, 1))); env.QueryCorners(corners); NUnit.Framework.Assert.IsTrue(corners[0].Equals(env.QueryCorner(0))); NUnit.Framework.Assert.IsTrue(corners[1].Equals(env.QueryCorner(1))); NUnit.Framework.Assert.IsTrue(corners[2].Equals(env.QueryCorner(2))); NUnit.Framework.Assert.IsTrue(corners[3].Equals(env.QueryCorner(3))); } { com.esri.core.geometry.Point2D[] corners = new com.esri.core.geometry.Point2D[4]; env.QueryCornersReversed(corners); NUnit.Framework.Assert.IsTrue(corners[0].Equals(com.esri.core.geometry.Point2D.Construct(0, 1))); NUnit.Framework.Assert.IsTrue(corners[1].Equals(com.esri.core.geometry.Point2D.Construct(2, 1))); NUnit.Framework.Assert.IsTrue(corners[2].Equals(com.esri.core.geometry.Point2D.Construct(2, 3))); NUnit.Framework.Assert.IsTrue(corners[3].Equals(com.esri.core.geometry.Point2D.Construct(0, 3))); env.QueryCornersReversed(corners); NUnit.Framework.Assert.IsTrue(corners[0].Equals(env.QueryCorner(0))); NUnit.Framework.Assert.IsTrue(corners[1].Equals(env.QueryCorner(3))); NUnit.Framework.Assert.IsTrue(corners[2].Equals(env.QueryCorner(2))); NUnit.Framework.Assert.IsTrue(corners[3].Equals(env.QueryCorner(1))); } NUnit.Framework.Assert.IsTrue(env.GetCenter().Equals(com.esri.core.geometry.Point2D.Construct(1, 2))); NUnit.Framework.Assert.IsFalse(env.ContainsExclusive(env.GetUpperLeft())); NUnit.Framework.Assert.IsTrue(env.Contains(env.GetUpperLeft())); NUnit.Framework.Assert.IsTrue(env.ContainsExclusive(env.GetCenter())); }
public virtual void TestOperatorDisjoint() { { com.esri.core.geometry.OperatorFactoryLocal projEnv = com.esri.core.geometry.OperatorFactoryLocal.GetInstance(); com.esri.core.geometry.SpatialReference inputSR = com.esri.core.geometry.SpatialReference.Create(3857); com.esri.core.geometry.Polygon poly1 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env1 = new com.esri.core.geometry.Envelope2D(); env1.SetCoords(855277, 3892059, 855277 + 100, 3892059 + 100); poly1.AddEnvelope(env1, false); com.esri.core.geometry.Polygon poly2 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env2 = new com.esri.core.geometry.Envelope2D(); env2.SetCoords(855277, 3892059, 855277 + 300, 3892059 + 200); poly2.AddEnvelope(env2, false); com.esri.core.geometry.Polygon poly3 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env3 = new com.esri.core.geometry.Envelope2D(); env3.SetCoords(855277 + 100, 3892059 + 100, 855277 + 100 + 100, 3892059 + 100 + 100); poly3.AddEnvelope(env3, false); com.esri.core.geometry.Polygon poly4 = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Envelope2D env4 = new com.esri.core.geometry.Envelope2D(); env4.SetCoords(855277 + 200, 3892059 + 200, 855277 + 200 + 100, 3892059 + 200 + 100); poly4.AddEnvelope(env4, false); com.esri.core.geometry.Point point1 = new com.esri.core.geometry.Point(855277, 3892059); com.esri.core.geometry.Point point2 = new com.esri.core.geometry.Point(855277 + 2, 3892059 + 3); com.esri.core.geometry.Point point3 = new com.esri.core.geometry.Point(855277 - 2, 3892059 - 3); { com.esri.core.geometry.OperatorDisjoint operatorDisjoint = (com.esri.core.geometry.OperatorDisjoint)(projEnv.GetOperator(com.esri.core.geometry.Operator.Type.Disjoint)); bool result = operatorDisjoint.Execute(poly1, poly2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); result = operatorDisjoint.Execute(poly1, poly3, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); result = operatorDisjoint.Execute(poly1, poly4, inputSR, null); NUnit.Framework.Assert.IsTrue(result); result = operatorDisjoint.Execute(poly1, point1, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); result = operatorDisjoint.Execute(point1, poly1, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); result = operatorDisjoint.Execute(poly1, point2, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); result = operatorDisjoint.Execute(point2, poly1, inputSR, null); NUnit.Framework.Assert.IsTrue(!result); result = operatorDisjoint.Execute(poly1, point3, inputSR, null); NUnit.Framework.Assert.IsTrue(result); result = operatorDisjoint.Execute(point3, poly1, inputSR, null); NUnit.Framework.Assert.IsTrue(result); } } }
public static void TestRandom() { int passcount = 10; int figureSize = 100; int figureSize2 = 100; com.esri.core.geometry.Envelope extent1 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.Envelope extent2 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.Envelope extent3 = new com.esri.core.geometry.Envelope(); com.esri.core.geometry.Envelope extent4 = new com.esri.core.geometry.Envelope(); extent1.SetCoords(-10000, 5000, 10000, 25000); // red extent2.SetCoords(-10000, 2000, 10000, 8000); // blue extent3.SetCoords(-10000, -8000, 10000, -2000); // blue extent4.SetCoords(-10000, -25000, 10000, -5000); // red com.esri.core.geometry.RandomCoordinateGenerator generator1 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent1, 0.001); com.esri.core.geometry.RandomCoordinateGenerator generator2 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent2, 0.001); com.esri.core.geometry.RandomCoordinateGenerator generator3 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent3, 0.001); com.esri.core.geometry.RandomCoordinateGenerator generator4 = new com.esri.core.geometry.RandomCoordinateGenerator(System.Math.Max(figureSize, 10000), extent4, 0.001); System.Random random = new System.Random(1982); int rand_max = 511; int qCount = 0; int eCount = 0; int bCount = 0; for (int c = 0; c < passcount; c++) { com.esri.core.geometry.Polygon polyRed = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.Polygon polyBlue = new com.esri.core.geometry.Polygon(); int r = figureSize; if (r < 3) { continue; } com.esri.core.geometry.Point pt; for (int j = 0; j < r; j++) { int rand = random.Next(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator1.GetRandomCoord(); if (j == 0 || bRandomNew) { polyRed.StartPath(pt); } else { polyRed.LineTo(pt); } } for (int j_1 = 0; j_1 < r; j_1++) { int rand = random.Next(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator4.GetRandomCoord(); if (j_1 == 0 || bRandomNew) { polyRed.StartPath(pt); } else { polyRed.LineTo(pt); } } r = figureSize2; if (r < 3) { continue; } for (int j_2 = 0; j_2 < r; j_2++) { int rand = random.Next(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator2.GetRandomCoord(); if (j_2 == 0 || bRandomNew) { polyBlue.StartPath(pt); } else { polyBlue.LineTo(pt); } } for (int j_3 = 0; j_3 < r; j_3++) { int rand = random.Next(rand_max); bool bRandomNew = (r > 10) && ((1.0 * rand) / rand_max > 0.95); pt = generator3.GetRandomCoord(); if (j_3 == 0 || bRandomNew) { polyBlue.StartPath(pt); } else { polyBlue.LineTo(pt); } } com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); // Quad_tree com.esri.core.geometry.QuadTree quadTree = BuildQuadTree(polyBlue); com.esri.core.geometry.QuadTree.QuadTreeIterator iterator = quadTree.GetIterator(); com.esri.core.geometry.SegmentIteratorImpl _segIterRed = ((com.esri.core.geometry.MultiPathImpl)polyRed._getImpl()).QuerySegmentIterator(); while (_segIterRed.NextPath()) { while (_segIterRed.HasNextSegment()) { com.esri.core.geometry.Segment segmentRed = _segIterRed.NextSegment(); segmentRed.QueryEnvelope2D(env); iterator.ResetIterator(env, 0.001); while (iterator.Next() != -1) { qCount++; } } } // Envelope_2D_intersector System.Collections.Generic.List<com.esri.core.geometry.Envelope2D> envelopes_red = new System.Collections.Generic.List<com.esri.core.geometry.Envelope2D>(); System.Collections.Generic.List<com.esri.core.geometry.Envelope2D> envelopes_blue = new System.Collections.Generic.List<com.esri.core.geometry.Envelope2D>(); com.esri.core.geometry.SegmentIterator segIterRed = polyRed.QuerySegmentIterator(); while (segIterRed.NextPath()) { while (segIterRed.HasNextSegment()) { com.esri.core.geometry.Segment segment = segIterRed.NextSegment(); env = new com.esri.core.geometry.Envelope2D(); segment.QueryEnvelope2D(env); envelopes_red.Add(env); } } com.esri.core.geometry.SegmentIterator segIterBlue = polyBlue.QuerySegmentIterator(); while (segIterBlue.NextPath()) { while (segIterBlue.HasNextSegment()) { com.esri.core.geometry.Segment segment = segIterBlue.NextSegment(); env = new com.esri.core.geometry.Envelope2D(); segment.QueryEnvelope2D(env); envelopes_blue.Add(env); } } com.esri.core.geometry.Envelope2DIntersectorImpl intersector = new com.esri.core.geometry.Envelope2DIntersectorImpl(); intersector.SetTolerance(0.001); intersector.StartRedConstruction(); for (int i = 0; i < envelopes_red.Count; i++) { intersector.AddRedEnvelope(i, envelopes_red[i]); } intersector.EndRedConstruction(); intersector.StartBlueConstruction(); for (int i_1 = 0; i_1 < envelopes_blue.Count; i_1++) { intersector.AddBlueEnvelope(i_1, envelopes_blue[i_1]); } intersector.EndBlueConstruction(); while (intersector.Next()) { eCount++; } NUnit.Framework.Assert.IsTrue(qCount == eCount); } }
public static void compareGeometryContent(com.esri.core.geometry.MultiVertexGeometry geom1, com.esri.core.geometry.MultiVertexGeometry geom2) { // Geometry types NUnit.Framework.Assert.IsTrue(geom1.getType().value() == geom2.getType().value()); // Envelopes com.esri.core.geometry.Envelope2D env1 = new com.esri.core.geometry.Envelope2D(); geom1.queryEnvelope2D(env1); com.esri.core.geometry.Envelope2D env2 = new com.esri.core.geometry.Envelope2D(); geom2.queryEnvelope2D(env2); NUnit.Framework.Assert.IsTrue(env1.xmin == env2.xmin && env1.xmax == env2.xmax && env1.ymin == env2.ymin && env1.ymax == env2.ymax); int type = geom1.getType().value(); if (type == com.esri.core.geometry.Geometry.GeometryType.Polyline || type == com.esri.core.geometry.Geometry.GeometryType .Polygon) { // Part Count int partCount1 = ((com.esri.core.geometry.MultiPath)geom1).getPathCount(); int partCount2 = ((com.esri.core.geometry.MultiPath)geom2).getPathCount(); NUnit.Framework.Assert.IsTrue(partCount1 == partCount2); // Part indices for (int i = 0; i < partCount1; i++) { int start1 = ((com.esri.core.geometry.MultiPath)geom1).getPathStart(i); int start2 = ((com.esri.core.geometry.MultiPath)geom2).getPathStart(i); NUnit.Framework.Assert.IsTrue(start1 == start2); int end1 = ((com.esri.core.geometry.MultiPath)geom1).getPathEnd(i); int end2 = ((com.esri.core.geometry.MultiPath)geom2).getPathEnd(i); NUnit.Framework.Assert.IsTrue(end1 == end2); } } // Point count int pointCount1 = geom1.getPointCount(); int pointCount2 = geom2.getPointCount(); NUnit.Framework.Assert.IsTrue(pointCount1 == pointCount2); if (type == com.esri.core.geometry.Geometry.GeometryType.MultiPoint || type == com.esri.core.geometry.Geometry.GeometryType .Polyline || type == com.esri.core.geometry.Geometry.GeometryType.Polygon) { // POSITION com.esri.core.geometry.AttributeStreamBase positionStream1 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom1._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .POSITION); com.esri.core.geometry.AttributeStreamOfDbl position1 = (com.esri.core.geometry.AttributeStreamOfDbl )(positionStream1); com.esri.core.geometry.AttributeStreamBase positionStream2 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom2._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .POSITION); com.esri.core.geometry.AttributeStreamOfDbl position2 = (com.esri.core.geometry.AttributeStreamOfDbl )(positionStream2); for (int i = 0; i < pointCount1; i++) { double x1 = position1.read(2 * i); double x2 = position2.read(2 * i); NUnit.Framework.Assert.IsTrue(x1 == x2); double y1 = position1.read(2 * i + 1); double y2 = position2.read(2 * i + 1); NUnit.Framework.Assert.IsTrue(y1 == y2); } // Zs bool bHasZs1 = geom1.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .Z); bool bHasZs2 = geom2.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .Z); NUnit.Framework.Assert.IsTrue(bHasZs1 == bHasZs2); if (bHasZs1) { com.esri.core.geometry.AttributeStreamBase zStream1 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom1._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .Z); com.esri.core.geometry.AttributeStreamOfDbl zs1 = (com.esri.core.geometry.AttributeStreamOfDbl )(zStream1); com.esri.core.geometry.AttributeStreamBase zStream2 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom2._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .Z); com.esri.core.geometry.AttributeStreamOfDbl zs2 = (com.esri.core.geometry.AttributeStreamOfDbl )(zStream2); for (int i_1 = 0; i_1 < pointCount1; i_1++) { double z1 = zs1.read(i_1); double z2 = zs2.read(i_1); NUnit.Framework.Assert.IsTrue(z1 == z2); } } // Ms bool bHasMs1 = geom1.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .M); bool bHasMs2 = geom2.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .M); NUnit.Framework.Assert.IsTrue(bHasMs1 == bHasMs2); if (bHasMs1) { com.esri.core.geometry.AttributeStreamBase mStream1 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom1._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .M); com.esri.core.geometry.AttributeStreamOfDbl ms1 = (com.esri.core.geometry.AttributeStreamOfDbl )(mStream1); com.esri.core.geometry.AttributeStreamBase mStream2 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom2._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .M); com.esri.core.geometry.AttributeStreamOfDbl ms2 = (com.esri.core.geometry.AttributeStreamOfDbl )(mStream2); for (int i_1 = 0; i_1 < pointCount1; i_1++) { double m1 = ms1.read(i_1); double m2 = ms2.read(i_1); NUnit.Framework.Assert.IsTrue(m1 == m2); } } // IDs bool bHasIDs1 = geom1.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .ID); bool bHasIDs2 = geom2.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .ID); NUnit.Framework.Assert.IsTrue(bHasIDs1 == bHasIDs2); if (bHasIDs1) { com.esri.core.geometry.AttributeStreamBase idStream1 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom1._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .ID); com.esri.core.geometry.AttributeStreamOfInt32 ids1 = (com.esri.core.geometry.AttributeStreamOfInt32 )(idStream1); com.esri.core.geometry.AttributeStreamBase idStream2 = ((com.esri.core.geometry.MultiVertexGeometryImpl )geom2._getImpl()).getAttributeStreamRef(com.esri.core.geometry.VertexDescription.Semantics .ID); com.esri.core.geometry.AttributeStreamOfInt32 ids2 = (com.esri.core.geometry.AttributeStreamOfInt32 )(idStream2); for (int i_1 = 0; i_1 < pointCount1; i_1++) { int id1 = ids1.read(i_1); int id2 = ids2.read(i_1); NUnit.Framework.Assert.IsTrue(id1 == id2); } } } }
public static void testClipGeometries() { // RandomTest(); com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal .getInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip); com.esri.core.geometry.Polygon polygon = makePolygon(); com.esri.core.geometry.SimpleGeometryCursor polygonCurs = new com.esri.core.geometry.SimpleGeometryCursor (polygon); com.esri.core.geometry.Polyline polyline = makePolyline(); com.esri.core.geometry.SimpleGeometryCursor polylineCurs = new com.esri.core.geometry.SimpleGeometryCursor (polyline); com.esri.core.geometry.MultiPoint multipoint = makeMultiPoint(); com.esri.core.geometry.SimpleGeometryCursor multipointCurs = new com.esri.core.geometry.SimpleGeometryCursor (multipoint); com.esri.core.geometry.Point point = makePoint(); com.esri.core.geometry.SimpleGeometryCursor pointCurs = new com.esri.core.geometry.SimpleGeometryCursor (point); com.esri.core.geometry.SpatialReference spatialRef = com.esri.core.geometry.SpatialReference .create(3857); com.esri.core.geometry.Envelope2D envelope = new com.esri.core.geometry.Envelope2D (); envelope.xmin = 0; envelope.xmax = 20; envelope.ymin = 5; envelope.ymax = 15; // Cursor implementation com.esri.core.geometry.GeometryCursor clipPolygonCurs = clipOp.execute(polygonCurs , envelope, spatialRef, null); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipPolygonCurs .next(); double area = clippedPolygon.calculateArea2D(); NUnit.Framework.Assert.IsTrue(System.Math.abs(area - 25) < 0.00001); // Single Geometry implementation clippedPolygon = (com.esri.core.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.esri.core.geometry.GeometryCursor clipPolylineCurs = clipOp.execute(polylineCurs , envelope, spatialRef, null); com.esri.core.geometry.Polyline clippedPolyline = (com.esri.core.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.esri.core.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.esri.core.geometry.GeometryCursor clipMulti_pointCurs = clipOp.execute(multipointCurs , envelope, spatialRef, null); com.esri.core.geometry.MultiPoint clipped_multi_point = (com.esri.core.geometry.MultiPoint )clipMulti_pointCurs.next(); int pointCount = clipped_multi_point.getPointCount(); NUnit.Framework.Assert.IsTrue(pointCount == 2); // Cursor implementation com.esri.core.geometry.GeometryCursor clipPointCurs = clipOp.execute(pointCurs, envelope , spatialRef, null); com.esri.core.geometry.Point clippedPoint = (com.esri.core.geometry.Point)clipPointCurs .next(); NUnit.Framework.Assert.IsTrue(clippedPoint != null); // RandomTest(); com.esri.core.geometry.Polyline _poly = new com.esri.core.geometry.Polyline(); _poly.startPath(2, 2); _poly.lineTo(0, 0); com.esri.core.geometry.Envelope2D _env = new com.esri.core.geometry.Envelope2D(); _env.setCoords(2, 1, 5, 3); com.esri.core.geometry.Polyline _clippedPolyline = (com.esri.core.geometry.Polyline )clipOp.execute(_poly, _env, spatialRef, null); NUnit.Framework.Assert.IsTrue(_clippedPolyline.isEmpty()); { com.esri.core.geometry.Polygon poly = new com.esri.core.geometry.Polygon(); poly.addEnvelope(new com.esri.core.geometry.Envelope2D(0, 0, 100, 100), false); poly.addEnvelope(new com.esri.core.geometry.Envelope2D(5, 5, 95, 95), true); com.esri.core.geometry.Polygon clippedPoly = (com.esri.core.geometry.Polygon)clipOp .execute(poly, new com.esri.core.geometry.Envelope2D(-10, -10, 110, 50), spatialRef , null); NUnit.Framework.Assert.IsTrue(clippedPoly.getPathCount() == 1); NUnit.Framework.Assert.IsTrue(clippedPoly.getPointCount() == 8); } }
public virtual void TestBufferPolygon() { com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.Create(4326); com.esri.core.geometry.Polygon inputGeom = new com.esri.core.geometry.Polygon(); com.esri.core.geometry.OperatorBuffer buffer = (com.esri.core.geometry.OperatorBuffer)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Buffer); com.esri.core.geometry.OperatorSimplify simplify = (com.esri.core.geometry.OperatorSimplify)com.esri.core.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.esri.core.geometry.Operator.Type.Simplify); inputGeom.StartPath(0, 0); inputGeom.LineTo(50, 50); inputGeom.LineTo(50, 0); { com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 0, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); NUnit.Framework.Assert.IsTrue(result == inputGeom); } { com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, 10, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.QueryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 20 - 50) < 0.1 && System.Math.Abs(env2D.GetHeight() - 20 - 50) < 0.1); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 25) < 0.1 && System.Math.Abs(env2D.GetCenterY() - 25) < 0.1); int pathCount = poly.GetPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 1); int pointCount = poly.GetPointCount(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 104.0) < 10); NUnit.Framework.Assert.IsTrue(simplify.IsSimpleAsFeature(result, sr, null)); } { sr = com.esri.core.geometry.SpatialReference.Create(4326); inputGeom = new com.esri.core.geometry.Polygon(); inputGeom.StartPath(0, 0); inputGeom.LineTo(50, 50); inputGeom.LineTo(50, 0); com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, -10, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.QueryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() - 15.85) < 0.1 && System.Math.Abs(env2D.GetHeight() - 15.85) < 0.1); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 32.07) < 0.1 && System.Math.Abs(env2D.GetCenterY() - 17.93) < 0.1); int pathCount = poly.GetPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 1); int pointCount = poly.GetPointCount(); NUnit.Framework.Assert.IsTrue(pointCount == 3); NUnit.Framework.Assert.IsTrue(simplify.IsSimpleAsFeature(result, sr, null)); } { sr = com.esri.core.geometry.SpatialReference.Create(4326); inputGeom = new com.esri.core.geometry.Polygon(); inputGeom.StartPath(0, 0); inputGeom.LineTo(0, 50); inputGeom.LineTo(50, 50); inputGeom.LineTo(50, 0); inputGeom.StartPath(10, 10); inputGeom.LineTo(40, 10); inputGeom.LineTo(40, 40); inputGeom.LineTo(10, 40); com.esri.core.geometry.Geometry result = buffer.Execute(inputGeom, sr, -2, null); NUnit.Framework.Assert.IsTrue(result.GetType().Value() == com.esri.core.geometry.Geometry.GeometryType.Polygon); com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)(result); com.esri.core.geometry.Envelope2D env2D = new com.esri.core.geometry.Envelope2D(); result.QueryEnvelope2D(env2D); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetWidth() + 4 - 50) < 0.1 && System.Math.Abs(env2D.GetHeight() + 4 - 50) < 0.1); NUnit.Framework.Assert.IsTrue(System.Math.Abs(env2D.GetCenterX() - 25) < 0.1 && System.Math.Abs(env2D.GetCenterY() - 25) < 0.1); int pathCount = poly.GetPathCount(); NUnit.Framework.Assert.IsTrue(pathCount == 2); int pointCount = poly.GetPointCount(); NUnit.Framework.Assert.IsTrue(System.Math.Abs(pointCount - 108) < 10); NUnit.Framework.Assert.IsTrue(simplify.IsSimpleAsFeature(result, sr, null)); } }
public static void testClipAttributes() { com.esri.core.geometry.OperatorFactoryLocal engine = com.esri.core.geometry.OperatorFactoryLocal .getInstance(); com.esri.core.geometry.OperatorClip clipOp = (com.esri.core.geometry.OperatorClip )engine.getOperator(com.esri.core.geometry.Operator.Type.Clip); { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); polygon.startPath(0, 0); polygon.lineTo(30, 30); polygon.lineTo(60, 0); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 0); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 60); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 120); com.esri.core.geometry.Envelope2D clipper = new com.esri.core.geometry.Envelope2D (); clipper.setCoords(10, 0, 50, 20); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp .execute(polygon, clipper, com.esri.core.geometry.SpatialReference.create(4326), null); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 0, 0) == 100); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == 19.999999999999996); // 20.0 NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 2, 0) == 20); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 3, 0) == 40); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 4, 0) == 80); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 5, 0) == 100); } { com.esri.core.geometry.Polygon polygon = new com.esri.core.geometry.Polygon(); polygon.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); polygon.startPath(0, 0); polygon.lineTo(0, 40); polygon.lineTo(20, 40); polygon.lineTo(20, 0); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 0, 0, 0); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 1, 0, 60); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 2, 0, 120); polygon.setAttribute(com.esri.core.geometry.VertexDescription.Semantics.M, 3, 0, 180); com.esri.core.geometry.Envelope2D clipper = new com.esri.core.geometry.Envelope2D (); clipper.setCoords(0, 10, 20, 20); com.esri.core.geometry.Polygon clippedPolygon = (com.esri.core.geometry.Polygon)clipOp .execute(polygon, clipper, com.esri.core.geometry.SpatialReference.create(4326), null); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 0, 0) == 15); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 1, 0) == 30); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 2, 0) == 150); NUnit.Framework.Assert.IsTrue(clippedPolygon.getAttributeAsDbl(com.esri.core.geometry.VertexDescription.Semantics .M, 3, 0) == 165); } }
/// <exception cref="org.codehaus.jackson.JsonParseException"/> /// <exception cref="System.IO.IOException"/> internal virtual bool testEnvelope() { bool bAnswer = true; com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); envelope.setCoords(-109.55, 25.76, -86.39, 49.94); { org.codehaus.jackson.JsonParser envelopeWGS84Parser = factory.createJsonParser(com.esri.core.geometry.GeometryEngine .geometryToJson(spatialReferenceWGS84, envelope)); com.esri.core.geometry.MapGeometry envelopeWGS84MP = com.esri.core.geometry.GeometryEngine .jsonToGeometry(envelopeWGS84Parser); NUnit.Framework.Assert.IsTrue(envelope.isEmpty() == envelopeWGS84MP.getGeometry() .isEmpty()); NUnit.Framework.Assert.IsTrue(envelope.getXMax() == ((com.esri.core.geometry.Envelope )envelopeWGS84MP.getGeometry()).getXMax()); NUnit.Framework.Assert.IsTrue(envelope.getYMax() == ((com.esri.core.geometry.Envelope )envelopeWGS84MP.getGeometry()).getYMax()); NUnit.Framework.Assert.IsTrue(envelope.getXMin() == ((com.esri.core.geometry.Envelope )envelopeWGS84MP.getGeometry()).getXMin()); NUnit.Framework.Assert.IsTrue(envelope.getYMin() == ((com.esri.core.geometry.Envelope )envelopeWGS84MP.getGeometry()).getYMin()); NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.getID() == envelopeWGS84MP.getSpatialReference ().getID()); if (!checkResultSpatialRef(envelopeWGS84MP, 4326, 0)) { bAnswer = false; } } { // export com.esri.core.geometry.Envelope e = new com.esri.core.geometry.Envelope(); e.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.Z); e.addAttribute(com.esri.core.geometry.VertexDescription.Semantics.M); string s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1 , e); NUnit.Framework.Assert.IsTrue(s.Equals("{\"xmin\":null,\"ymin\":null,\"xmax\":null,\"ymax\":null,\"zmin\":null,\"zmax\":null,\"mmin\":null,\"mmax\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}" )); e.setCoords(0, 1, 2, 3); com.esri.core.geometry.Envelope1D z = new com.esri.core.geometry.Envelope1D(); com.esri.core.geometry.Envelope1D m = new com.esri.core.geometry.Envelope1D(); z.setCoords(5, 7); m.setCoords(11, 13); e.setInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0, z); e.setInterval(com.esri.core.geometry.VertexDescription.Semantics.M, 0, m); s = com.esri.core.geometry.GeometryEngine.geometryToJson(spatialReferenceWebMerc1 , e); NUnit.Framework.Assert.IsTrue(s.Equals("{\"xmin\":0,\"ymin\":1,\"xmax\":2,\"ymax\":3,\"zmin\":5,\"zmax\":7,\"mmin\":11,\"mmax\":13,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}" )); } { // import string s = "{\"xmin\":0.0,\"ymin\":1.0,\"xmax\":2.0,\"ymax\":3.0,\"zmin\":5.0,\"zmax\":7.0,\"mmin\":11.0,\"mmax\":13.0,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"; org.codehaus.jackson.JsonParser parser = factory.createJsonParser(s); com.esri.core.geometry.MapGeometry map_env = com.esri.core.geometry.GeometryEngine .jsonToGeometry(parser); com.esri.core.geometry.Envelope env = (com.esri.core.geometry.Envelope)map_env.getGeometry (); com.esri.core.geometry.Envelope1D z = env.queryInterval(com.esri.core.geometry.VertexDescription.Semantics .Z, 0); com.esri.core.geometry.Envelope1D m = env.queryInterval(com.esri.core.geometry.VertexDescription.Semantics .M, 0); NUnit.Framework.Assert.IsTrue(z.vmin == 5.0); NUnit.Framework.Assert.IsTrue(z.vmax == 7.0); NUnit.Framework.Assert.IsTrue(m.vmin == 11.0); NUnit.Framework.Assert.IsTrue(m.vmax == 13.0); } { string s = "{ \"zmin\" : 33, \"xmin\" : -109.55, \"zmax\" : 53, \"ymin\" : 25.76, \"xmax\" : -86.39, \"ymax\" : 49.94, \"mmax\" : 13}"; org.codehaus.jackson.JsonParser parser = factory.createJsonParser(s); com.esri.core.geometry.MapGeometry map_env = com.esri.core.geometry.GeometryEngine .jsonToGeometry(parser); com.esri.core.geometry.Envelope env = (com.esri.core.geometry.Envelope)map_env.getGeometry (); com.esri.core.geometry.Envelope2D e = new com.esri.core.geometry.Envelope2D(); env.queryEnvelope2D(e); NUnit.Framework.Assert.IsTrue(e.xmin == -109.55 && e.ymin == 25.76 && e.xmax == - 86.39 && e.ymax == 49.94); com.esri.core.geometry.Envelope1D e1D; NUnit.Framework.Assert.IsTrue(env.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .Z)); e1D = env.queryInterval(com.esri.core.geometry.VertexDescription.Semantics.Z, 0); NUnit.Framework.Assert.IsTrue(e1D.vmin == 33 && e1D.vmax == 53); NUnit.Framework.Assert.IsTrue(!env.hasAttribute(com.esri.core.geometry.VertexDescription.Semantics .M)); } return(bAnswer); }
internal virtual bool rgHelper(com.esri.core.geometry.RasterizedGeometry2D rg, com.esri.core.geometry.MultiPath mp) { com.esri.core.geometry.SegmentIterator iter = mp.querySegmentIterator(); while (iter.nextPath()) { while (iter.hasNextSegment()) { com.esri.core.geometry.Segment seg = iter.nextSegment(); int count = 20; for (int i = 0; i < count; i++) { double t = (1.0 * i / count); com.esri.core.geometry.Point2D pt = seg.getCoord2D(t); com.esri.core.geometry.RasterizedGeometry2D.HitType hit = rg.queryPointInGeometry (pt.x, pt.y); if (hit != com.esri.core.geometry.RasterizedGeometry2D.HitType.Border) { return(false); } } } } if (mp.getType() != com.esri.core.geometry.Geometry.Type.Polygon) { return(true); } com.esri.core.geometry.Polygon poly = (com.esri.core.geometry.Polygon)mp; com.esri.core.geometry.Envelope2D env = new com.esri.core.geometry.Envelope2D(); poly.queryEnvelope2D(env); int count_1 = 100; for (int iy = 0; iy < count_1; iy++) { double ty = 1.0 * iy / count_1; double y = env.ymin * (1.0 - ty) + ty * env.ymax; for (int ix = 0; ix < count_1; ix++) { double tx = 1.0 * ix / count_1; double x = env.xmin * (1.0 - tx) + tx * env.xmax; com.esri.core.geometry.RasterizedGeometry2D.HitType hit = rg.queryPointInGeometry (x, y); com.esri.core.geometry.PolygonUtils.PiPResult res = com.esri.core.geometry.PolygonUtils .isPointInPolygon2D(poly, new com.esri.core.geometry.Point2D(x, y), 0); if (res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside) { bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border || hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Inside); if (!bgood) { return(false); } } else { if (res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside) { bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border || hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Outside); if (!bgood) { return(false); } } else { bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border); if (!bgood) { return(false); } } } } } return(true); }