Skip to content

Commit

Permalink
fixes for #79 and #80, made MultiPath.addEnvelope public
Browse files Browse the repository at this point in the history
  • Loading branch information
stolstov committed Feb 20, 2015
1 parent 0570d12 commit 591acbe
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/esri/core/geometry/MultiPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ boolean hasNonLinearSegments(int pathIndex) {
* @param bReverse
* Creates reversed path.
*/
void addEnvelope(Envelope2D envSrc, boolean bReverse) {
public void addEnvelope(Envelope2D envSrc, boolean bReverse) {
m_impl.addEnvelope(envSrc, bReverse);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PairwiseIntersectorImpl {
private double m_tolerance;
private int m_path_index;
private int m_element_handle;
private Envelope2D m_paths_query; // only used for m_b_paths == true case
private Envelope2D m_paths_query = new Envelope2D(); // only used for m_b_paths == true case
private QuadTreeImpl m_quad_tree;
private QuadTreeImpl.QuadTreeIteratorImpl m_qt_iter;
private SegmentIteratorImpl m_seg_iter;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/esri/core/geometry/SimpleRasterizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class SimpleRasterizer {
public static interface ScanCallback {
/**
* Rasterizer calls this method for each scan it produced
* @param scan array of scans. Scans are triplets of numbers. The start X coordinate for the scan (inclusive),
* @param scans array of scans. Scans are triplets of numbers. The start X coordinate for the scan (inclusive),
* the end X coordinate of the scan (exclusive), the Y coordinate for the scan.
* @param scanCount3 The number of initialized elements in the scans array. The scan count is scanCount3 / 3.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/esri/core/geometry/Wkid.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static double find_tolerance_from_wkid(int wkid) {
if (tol == 1e38) {
int old = wkid_to_old(wkid);
if (old != wkid)
tol = find_tolerance_from_wkid_helper(wkid);
tol = find_tolerance_from_wkid_helper(old);
if (tol == 1e38)
return 1e-10;
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/com/esri/core/geometry/TestRelation.java
Original file line number Diff line number Diff line change
Expand Up @@ -5481,4 +5481,16 @@ public void testCrosses_github_issue_40() {
null);
assertTrue(answer2);
}

@Test
public void testDisjointCrash() {
Polygon g1 = new Polygon();
g1.addEnvelope(Envelope2D.construct(0, 0, 10, 10), false);
Polygon g2 = new Polygon();
g2.addEnvelope(Envelope2D.construct(10, 1, 21, 21), false);
g1 = (Polygon)OperatorDensifyByLength.local().execute(g1, 0.1, null);
OperatorDisjoint.local().accelerateGeometry(g1, SpatialReference.create(4267), GeometryAccelerationDegree.enumHot);
boolean res = OperatorDisjoint.local().execute(g1, g2, SpatialReference.create(4267), null);
assertTrue(!res);
}
}
9 changes: 9 additions & 0 deletions src/test/java/com/esri/core/geometry/TestWkid.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,13 @@ public void test() {
assertTrue(Math.abs(tol84 - 1e-8) < 1e-8 * 1e-8);
}

@Test
public void test_80() {
SpatialReference sr = SpatialReference.create(3857);
assertTrue(sr.getID() == 3857);
assertTrue(sr.getLatestID() == 3857);
assertTrue(sr.getOldID() == 102100);
assertTrue(sr.getTolerance() == 0.001);
}

}

0 comments on commit 591acbe

Please sign in to comment.