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

Add LineMerger directed option #597

Merged
merged 5 commits into from
May 24, 2022
Merged

Conversation

mngr777
Copy link
Contributor

@mngr777 mngr777 commented Apr 20, 2022

Directed line merger implementation locationtech/jts#773

Is it ok to start with C++ implementation and backport to JTS?

@dr-jts dr-jts added the Enhancement New feature or feature improvement. label Apr 25, 2022
@dr-jts
Copy link
Contributor

dr-jts commented Apr 25, 2022

It seems like it should be possible to implement this using most of the current LineMerger code, but with a flag indicating whether edges are allowed to be "flipped". Have you looked into this? Any reason that won't work?

@mngr777
Copy link
Contributor Author

mngr777 commented Apr 26, 2022

You're right, and the solution is much simpler than what I did.

I still left dirEdgeBegin and dirEdgeEnd methods in planargraph::Planargraph.
Also, operation::linemerge::EdgeString class cannot cache coordinate sequence, because LineString takes ownership of it, so I removed coordinates field.

@mngr777 mngr777 force-pushed the directed-line-merger branch from bf663c0 to 47a7b27 Compare May 17, 2022 11:26
@mngr777
Copy link
Contributor Author

mngr777 commented May 19, 2022

@dr-jts Updated to include API header changes.

void object::test<1>
()
{
auto input = GEOSGeomFromWKT("MULTILINESTRING((0 0, 0 100),(0 -5, 0 0))");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use geom1_ and geom2_ as the variables, the capitest::utility will automatically clean them up after each test so you can drop the GEOSGeom_destroy calls.

@pramsey
Copy link
Member

pramsey commented May 20, 2022

Looks fine to me.

@dr-jts dr-jts changed the title directed line merger Add LineMerger directed option May 24, 2022
@dr-jts dr-jts merged commit b813572 into libgeos:main May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or feature improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants