public static void Test2() { com.epl.geometry.MultiPoint multipoint = new com.epl.geometry.MultiPoint(); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { multipoint.Add(i, j); } } com.epl.geometry.Envelope2D extent = new com.epl.geometry.Envelope2D(); multipoint.QueryEnvelope2D(extent); com.epl.geometry.MultiPointImpl multipointImpl = (com.epl.geometry.MultiPointImpl)multipoint._getImpl(); com.epl.geometry.QuadTree quadtree = BuildQuadTree_(multipointImpl); com.epl.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); }
internal static com.epl.geometry.Geometry MultiPointSymDiffPoint_(com.epl.geometry.MultiPoint multi_point, com.epl.geometry.Point point, double tolerance, com.epl.geometry.ProgressTracker progress_tracker) { com.epl.geometry.MultiPointImpl multipointImpl = (com.epl.geometry.MultiPointImpl)(multi_point._getImpl()); com.epl.geometry.AttributeStreamOfDbl position = (com.epl.geometry.AttributeStreamOfDbl)(multipointImpl.GetAttributeStreamRef(com.epl.geometry.VertexDescription.Semantics.POSITION)); int point_count = multi_point.GetPointCount(); com.epl.geometry.Point2D point2D = point.GetXY(); com.epl.geometry.MultiPoint new_multipoint = (com.epl.geometry.MultiPoint)(multi_point.CreateInstance()); double tolerance_cluster = tolerance * System.Math.Sqrt(2.0) * 1.00001; com.epl.geometry.Envelope2D env = new com.epl.geometry.Envelope2D(); multi_point.QueryEnvelope2D(env); env.Inflate(tolerance_cluster, tolerance_cluster); if (env.Contains(point2D)) { double tolerance_cluster_sq = tolerance_cluster * tolerance_cluster; bool b_found_covered = false; bool[] covered = new bool[point_count]; for (int i = 0; i < point_count; i++) { covered[i] = false; } for (int i_1 = 0; i_1 < point_count; i_1++) { double x = position.Read(2 * i_1); double y = position.Read(2 * i_1 + 1); double dx = x - point2D.x; double dy = y - point2D.y; if (dx * dx + dy * dy <= tolerance_cluster_sq) { b_found_covered = true; covered[i_1] = true; } } if (!b_found_covered) { new_multipoint.Add(multi_point, 0, point_count); new_multipoint.Add(point); } else { for (int i_2 = 0; i_2 < point_count; i_2++) { if (!covered[i_2]) { new_multipoint.Add(multi_point, i_2, i_2 + 1); } } } } else { new_multipoint.Add(multi_point, 0, point_count); new_multipoint.Add(point); } return(new_multipoint); }
private static int QuickTest2DPolylineMultiPoint(com.epl.geometry.Polyline geomA, com.epl.geometry.MultiPoint geomB, double tolerance) { com.epl.geometry.Envelope2D geomBEnv = new com.epl.geometry.Envelope2D(); geomB.QueryEnvelope2D(geomBEnv); int res = QuickTest2DMVEnvelopeRasterOnly(geomA, geomBEnv, tolerance); if (res > 0) { return(res); } // TODO: implement me return(0); }