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 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, "" );
Copy link
Member

@m-kuhn m-kuhn May 7, 2017

Choose a reason for hiding this comment

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

Should there be an error message here?

#endif

private:
const QgsAbstractGeometry *g;
Copy link
Member

@m-kuhn m-kuhn May 7, 2017

Choose a reason for hiding this comment

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

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;
Copy link
Member

@m-kuhn m-kuhn May 7, 2017

Choose a reason for hiding this comment

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

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 30, 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).
@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
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants