Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selftangency typeo #248

Merged
merged 1 commit into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,12 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
|| (xyindex == path_last);
if (m_bOGCRestrictions)
vi_prev.boundary = !is_closed_path && vi_prev.end_point;
else
else {
// for regular planar simplify, only the end points are allowed
// to coincide
vi_prev.boundary = vi_prev.end_point;
}

vi_prev.ipath = ipath;
vi_prev.x = pt.x;
vi_prev.y = pt.y;
Expand All @@ -506,11 +508,11 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
boolean end_point = (xyindex == path_start)
|| (xyindex == path_last);
if (m_bOGCRestrictions)
boundary = !is_closed_path && vi_prev.end_point;
boundary = !is_closed_path && end_point;
else
// for regular planar simplify, only the end points are allowed
// to coincide
boundary = vi_prev.end_point;
boundary = end_point;

vi.x = pt.x;
vi.y = pt.y;
Expand All @@ -522,22 +524,12 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
if (vi.x == vi_prev.x && vi.y == vi_prev.y) {
if (m_bOGCRestrictions) {
if (!vi.boundary || !vi_prev.boundary) {
// check that this is not the endpoints of a closed path
if ((vi.ipath != vi_prev.ipath)
|| (!vi.end_point && !vi_prev.end_point))// check
// that
// this
// is
// not
// the
// endpoints
// of
// a
// closed
// path
{
|| (!vi.end_point && !vi_prev.end_point)) {
// one of coincident vertices is not on the boundary
// this is either Non_simple_result::cross_over or
// Non_simple_result::ogc_self_tangency.
// this is either NonSimpleResult.CrossOver or
// NonSimpleResult.OGCPolylineSelfTangency.
// too expensive to distinguish between the two.
m_nonSimpleResult = new NonSimpleResult(
NonSimpleResult.Reason.OGCPolylineSelfTangency,
Expand All @@ -546,12 +538,9 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
}
}
} else {
if (!vi.end_point || !vi_prev.end_point) {// one of
// coincident
// vertices is
// not an
// endpoint
m_nonSimpleResult = new NonSimpleResult(
if (!vi.end_point || !vi_prev.end_point) {
//one of coincident vertices is not an endpoint
m_nonSimpleResult = new NonSimpleResult(
NonSimpleResult.Reason.CrossOver, vi.ivertex,
vi_prev.ivertex);
return false;// common point not on the boundary
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/com/esri/core/geometry/TestOGC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1036,4 +1036,13 @@ public void testFlattened() {
ogcGeometry = (OGCConcreteGeometryCollection)OGCGeometry.fromText("GEOMETRYCOLLECTION (MULTIPOINT (1 1), MULTILINESTRING ((1 2, 3 4)), MULTIPOLYGON (((1 2, 3 4, 5 6, 1 2))))");
assertTrue(ogcGeometry.isFlattened());
}

@Test
public void testIssue247IsSimple() {
//https://github.com/Esri/geometry-api-java/issues/247
String wkt = "MULTILINESTRING ((-103.4894322 25.6164519, -103.4889647 25.6159054, -103.489434 25.615654), (-103.489434 25.615654, -103.4894322 25.6164519), (-103.4897361 25.6168342, -103.4894322 25.6164519))";
OGCGeometry ogcGeom = OGCGeometry.fromText(wkt);
boolean b = ogcGeom.isSimple();
assertTrue(b);
}
}