Skip to content

Commit 97f3618

Browse files
author
wonder
committed
Applied patch from Stefanie Tellex for simpler retreival of coords from QgsPoint
Thanks! git-svn-id: http://svn.osgeo.org/qgis/trunk@8582 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 35f10e1 commit 97f3618

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

python/core/qgspoint.sip

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ public:
8282
sipRes = PyString_FromString(str.toLocal8Bit().data());
8383
%End
8484

85+
int __len__();
86+
%MethodCode
87+
sipRes = 2;
88+
%End
89+
90+
91+
SIP_PYOBJECT __getitem__(int);
92+
%MethodCode
93+
if (a0 == 0) {
94+
sipRes = Py_BuildValue("d",sipCpp->x());
95+
} else if (a0 == 1) {
96+
sipRes = Py_BuildValue("d",sipCpp->y());
97+
} else {
98+
QString msg = QString("Bad index: %1").arg(a0);
99+
PyErr_SetString(PyExc_IndexError, msg.toAscii().constData());
100+
}
101+
%End
102+
103+
85104

86105
}; // class QgsPOint
87106

0 commit comments

Comments
 (0)