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

New API for traversal of geometry's vertices using iterator pattern #4513

Closed
wants to merge 2 commits into from

Conversation

@wonder-sk
Copy link
Member

wonder-sk commented May 7, 2017

Introducing:

  1. STL-style iterator: QgsAbstractGeometry::vertex_iterator
  2. Java-style iterator: QgsVertexIterator (built on top of STL-style)

The iterators are modeled after Qt's STL-style and Java-style iterators, the idea is to replace nextVertex() method and later introduce iterators for other bits (e.g. part_iterator, ring_iterator).

@nyalldawson
Copy link
Collaborator

nyalldawson commented May 7, 2017

Awesome! This will be very useful

@m-kuhn
m-kuhn approved these changes May 7, 2017
if ( sipCpp->hasNext() )
sipRes = sipConvertFromType( new QgsPointV2( sipCpp->next() ), sipType_QgsPointV2, Py_None );
else
PyErr_SetString( PyExc_StopIteration, "" );

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn May 7, 2017

Member

Should there be an error message here?

#endif

private:
const QgsAbstractGeometry *g;

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn May 7, 2017

Member

Can these be prefixed with a mEmber prefix?


//! Returns Java-style iterator for traversal of vertices of the geometry
//! \since QGIS 3.0
QgsVertexIterator vertices() const;

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn May 7, 2017

Member

Would be great to have a short code snippet here or on the class QgsVertexIterator
Maybe just a copy of the python test.

@m-kuhn
Copy link
Member

m-kuhn commented May 7, 2017

Really nice stuff

wonder-sk added 2 commits May 7, 2017
Introducing:
1. STL-style iterator: QgsAbstractGeometry::vertex_iterator
2. Java-style iterator: QgsVertexIterator (built on top of STL-style)

The iterators are modeled after Qt's STL-style and Java-style iterators,
the idea is to replace nextVertex() method and later introduce iterators
for other bits (e.g. part_iterator, ring_iterator).
@wonder-sk wonder-sk force-pushed the wonder-sk:vertex-iterator branch from 5f7903b to fc39b81 May 30, 2017
@m-kuhn
Copy link
Member

m-kuhn commented Jul 17, 2017

@wonder-sk are you planning to revive this? It will be very valuable to have this in place!

@wonder-sk
Copy link
Member Author

wonder-sk commented Jul 17, 2017

Yeah I will update it soon... the third dimension is keeping me busy nowadays...

@m-kuhn
Copy link
Member

m-kuhn commented Aug 13, 2017

I wish it would be possible to upvote PRs ;)

@nyalldawson nyalldawson mentioned this pull request Sep 2, 2017
6 of 8 tasks complete
@nyalldawson
Copy link
Collaborator

nyalldawson commented Oct 12, 2017

cough please finish this cough

@wonder-sk
Copy link
Member Author

wonder-sk commented Oct 13, 2017

Superseded by #5365

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.