[QGIS Commit] r8582 - trunk/qgis/python/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jun 3 10:36:57 EDT 2008


Author: wonder
Date: 2008-06-03 10:36:56 -0400 (Tue, 03 Jun 2008)
New Revision: 8582

Modified:
   trunk/qgis/python/core/qgspoint.sip
Log:
Applied patch from Stefanie Tellex for simpler retreival of coords from QgsPoint
Thanks!


Modified: trunk/qgis/python/core/qgspoint.sip
===================================================================
--- trunk/qgis/python/core/qgspoint.sip	2008-06-03 14:33:52 UTC (rev 8581)
+++ trunk/qgis/python/core/qgspoint.sip	2008-06-03 14:36:56 UTC (rev 8582)
@@ -82,6 +82,25 @@
     sipRes = PyString_FromString(str.toLocal8Bit().data());
 %End
 
+  int __len__();
+%MethodCode
+    sipRes = 2;
+%End
+
+
+  SIP_PYOBJECT __getitem__(int);
+%MethodCode    
+    if (a0 == 0) {
+        sipRes = Py_BuildValue("d",sipCpp->x());
+    } else if (a0 == 1) {
+        sipRes = Py_BuildValue("d",sipCpp->y());
+    } else {
+        QString msg = QString("Bad index: %1").arg(a0);
+        PyErr_SetString(PyExc_IndexError, msg.toAscii().constData());
+    }
+%End
+
+
   
 }; // class QgsPOint
 



More information about the QGIS-commit mailing list