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

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
@wonder-sk
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

This comment has been minimized.

Show comment
Hide comment
@nyalldawson

nyalldawson May 7, 2017

Contributor

Awesome! This will be very useful

Contributor

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.

@m-kuhn

m-kuhn May 7, 2017

Member

Should there be an error message here?

@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.

@m-kuhn

m-kuhn May 7, 2017

Member

Can these be prefixed with a mEmber prefix?

@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.

@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

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

This comment has been minimized.

Show comment
Hide comment
@m-kuhn

m-kuhn May 7, 2017

Member

Really nice stuff

Member

m-kuhn commented May 7, 2017

Really nice stuff

wonder-sk added some commits May 7, 2017

New API for traversal of geometry's vertices using iterator pattern
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

This comment has been minimized.

Show comment
Hide comment
@m-kuhn

m-kuhn Jul 17, 2017

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@wonder-sk

wonder-sk Jul 17, 2017

Member

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

Member

wonder-sk commented Jul 17, 2017

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

@m-kuhn

This comment has been minimized.

Show comment
Hide comment
@m-kuhn

m-kuhn Aug 13, 2017

Member

I wish it would be possible to upvote PRs ;)

Member

m-kuhn commented Aug 13, 2017

I wish it would be possible to upvote PRs ;)

@nyalldawson nyalldawson referenced this pull request Sep 2, 2017

Merged

[FEATURE][Processing] Minimal enclosing circle #5106

6 of 8 tasks complete
@nyalldawson

This comment has been minimized.

Show comment
Hide comment
@nyalldawson

nyalldawson Oct 12, 2017

Contributor

cough please finish this cough

Contributor

nyalldawson commented Oct 12, 2017

cough please finish this cough

@wonder-sk

This comment has been minimized.

Show comment
Hide comment
@wonder-sk

wonder-sk Oct 13, 2017

Member

Superseded by #5365

Member

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