Skip to content
Permalink
Browse files
Merge pull request #2586 from nyalldawson/coordinate_formatter
Initial implementation of QgsCoordinateFormatter
  • Loading branch information
nyalldawson committed Nov 15, 2017
2 parents ac574e2 + 3734a0d commit fbe5a17af745477709606cc73fa58858b9ffb5e8
Show file tree
Hide file tree
Showing 112 changed files with 1,913 additions and 1,563 deletions.
@@ -453,6 +453,9 @@ QgsAbstractGeometry {#qgis_api_break_3_0_QgsAbstractGeometry}
- asWkb() returns QByteArray instead of new raw pointer
- wkbSize() has been removed, use asWkb() to get length of returned QByteArray
- fromWkb() gets the WKB pointer passed by reference instead of value, so that caller may to find out where the parsing ended
- asGML2() was renamed to asGml2()
- asGML3() was renamed to asGml3()
- asJSON() was renamed to asJson()


QgsActionManager {#qgis_api_break_3_0_QgsActionManager}
@@ -1313,7 +1316,7 @@ can force a detach and full clone of the geometry, so it is preferable to use th
method if the geometry is not being modified.
- isEmpty() was renamed to isNull() to differentiate a missing geometry from a geometry which is empty (eg an
empty geometry collection)
- wkbSize() and asWkb() has been replaced by exportToWkb(). WKB representation is no longer cached within QgsGeometry
- wkbSize() was removed. WKB representation is no longer cached within QgsGeometry
- asGeos() has been replaced by exportToGeos(). GEOS representation is no longer cached within QgsGeometry
- int addPart( const QList<QgsPoint> &points, QgsWkbTypes::GeometryType geomType ) has been renamed to addPointsXY
- int addPart( const QList<QgsPointV2> &points, QgsWkbTypes::GeometryType geomType ) has been renamed to addPoints
@@ -1333,6 +1336,8 @@ maintains Z or M dimensions from the input points and is more efficient.
- fromMultiPolyline() was renamed to fromMultiPolylineXY()
- fromPolygon() was renamed to fromPolygonXY()
- fromMultiPolygon() was renamed to fromMultiPolygonXY()
- exportToWkt() was renamed to asWkt()
- exportToGeoJSON() was renamed to asJson()


QgsGeometryAnalyzer {#qgis_api_break_3_0_QgsGeometryAnalyzer}
@@ -1963,6 +1968,8 @@ QgsPoint {#qgis_api_break_3_0_QgsPoint}
--------

- onSegment() has been removed. Use sqrDistToSegment() instead for a more precise test.
- toDegreesMinutesSeconds() and toDegreesMinutes() have been removed. Use QgsCoordinateFormatter instead.
- wellKnownText() was renamed to asWkt()


QgsPointDisplacementRenderer {#qgis_api_break_3_0_QgsPointDisplacementRenderer}
@@ -83,7 +83,7 @@ def mapping_feature(feature):


def mapping_geometry(geometry):
geo = geometry.exportToGeoJSON()
geo = geometry.asJson()
# We have to use eval because exportToGeoJSON() gives us
# back a string that looks like a dictionary.
return eval(geo)
@@ -21,6 +21,7 @@
%Include qgscolorscheme.sip
%Include qgscolorschemeregistry.sip
%Include qgsconditionalstyle.sip
%Include qgscoordinateformatter.sip
%Include qgscoordinatetransform.sip
%Include qgscrscache.sip
%Include qgsdartmeasurement.sip
@@ -166,7 +166,7 @@ class QgsAbstractGeometry
.. seealso:: asWkt
.. seealso:: asGML2
.. seealso:: asGML3
.. seealso:: asJSON
.. seealso:: asJson()
.. versionadded:: 3.0
:rtype: QByteArray
%End
@@ -175,47 +175,47 @@ class QgsAbstractGeometry
%Docstring
Returns a WKT representation of the geometry.
\param precision number of decimal places for coordinates
.. seealso:: asWkb
.. seealso:: asGML2
.. seealso:: asGML3
.. seealso:: asJSON
.. seealso:: asWkb()
.. seealso:: asGml2()
.. seealso:: asGml3()
.. seealso:: asJson()
:rtype: str
%End

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const = 0;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const = 0;
%Docstring
Returns a GML2 representation of the geometry.
\param doc DOM document
\param precision number of decimal places for coordinates
\param ns XML namespace
.. seealso:: asWkb
.. seealso:: asWkt
.. seealso:: asGML3
.. seealso:: asJSON
.. seealso:: asWkb()
.. seealso:: asWkt()
.. seealso:: asGml3()
.. seealso:: asJson()
:rtype: QDomElement
%End

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const = 0;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const = 0;
%Docstring
Returns a GML3 representation of the geometry.
\param doc DOM document
\param precision number of decimal places for coordinates
\param ns XML namespace
.. seealso:: asWkb
.. seealso:: asWkt
.. seealso:: asGML2
.. seealso:: asJSON
.. seealso:: asWkb()
.. seealso:: asWkt()
.. seealso:: asGml2()
.. seealso:: asJson()
:rtype: QDomElement
%End

virtual QString asJSON( int precision = 17 ) const = 0;
virtual QString asJson( int precision = 17 ) const = 0;
%Docstring
Returns a GeoJSON representation of the geometry.
\param precision number of decimal places for coordinates
.. seealso:: asWkb
.. seealso:: asWkt
.. seealso:: asGML2
.. seealso:: asGML3
.. seealso:: asWkb()
.. seealso:: asWkt()
.. seealso:: asGml2()
.. seealso:: asGml3()
:rtype: str
%End

@@ -47,11 +47,11 @@ class QgsCircularString: QgsCurve

virtual QString asWkt( int precision = 17 ) const;

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;


virtual bool isEmpty() const;
@@ -47,11 +47,11 @@ class QgsCompoundCurve: QgsCurve

virtual QString asWkt( int precision = 17 ) const;

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;


virtual double length() const;
@@ -50,11 +50,11 @@ class QgsCurvePolygon: QgsSurface

virtual QString asWkt( int precision = 17 ) const;

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;


virtual double area() const;
@@ -1088,14 +1088,14 @@ Returns an extruded version of this geometry.
:rtype: QgsGeometry
%End

QByteArray exportToWkb() const;
QByteArray asWkb() const;
%Docstring
Export the geometry to WKB
.. versionadded:: 3.0
:rtype: QByteArray
%End

QString exportToWkt( int precision = 17 ) const;
QString asWkt( int precision = 17 ) const;
%Docstring
Exports the geometry to WKT
.. note::
@@ -1105,17 +1105,9 @@ Returns an extruded version of this geometry.
:rtype: str
%End

QString exportToGeoJSON( int precision = 17 ) const;
QString asJson( int precision = 17 ) const;
%Docstring
Exports the geometry to GeoJSON
:return: a QString representing the geometry as GeoJSON
.. versionadded:: 1.8
.. note::

Available in Python bindings since QGIS 1.9
.. note::

precision parameter added in QGIS 2.4
Exports the geometry to a GeoJSON string.
:rtype: str
%End

@@ -97,11 +97,11 @@ Adds a geometry and takes ownership. Returns true in case of success.

virtual QString asWkt( int precision = 17 ) const;

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;


virtual QgsRectangle boundingBox() const;
@@ -189,11 +189,11 @@ Closes the line string by appending the first point to the end of the line, if i

virtual QString asWkt( int precision = 17 ) const;

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;


virtual double length() const;
@@ -30,11 +30,11 @@ class QgsMultiCurve: QgsGeometryCollection

virtual bool fromWkt( const QString &wkt );

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;

virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

@@ -29,11 +29,11 @@ class QgsMultiLineString: QgsMultiCurve

virtual bool fromWkt( const QString &wkt );

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;

virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

@@ -31,11 +31,11 @@ class QgsMultiPoint: QgsGeometryCollection

virtual void clear();

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;

virtual int nCoordinates() const;

@@ -28,11 +28,11 @@ class QgsMultiPolygon: QgsMultiSurface

virtual bool fromWkt( const QString &wkt );

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;

virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

@@ -30,11 +30,11 @@ class QgsMultiSurface: QgsGeometryCollection

virtual bool fromWkt( const QString &wkt );

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;

virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

@@ -34,10 +34,10 @@ class QgsPoint: QgsAbstractGeometry

\code{.py}
pt = QgsPoint(43.4, 5.3)
pt.exportToWkt() # Point(43.4 5.3)
pt.asWkt() # Point(43.4 5.3)

pt_z = QgsPoint(120, 343, 77)
pt.exportToWkt() # PointZ(120 343 77)
pt.asWkt() # PointZ(120 343 77)

pt_m = QgsPoint(33, 88, m=5)
pt_m.m() # 5
@@ -349,11 +349,11 @@ class QgsPoint: QgsAbstractGeometry

virtual QString asWkt( int precision = 17 ) const;

virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;
virtual QString asJson( int precision = 17 ) const;

virtual void draw( QPainter &p ) const;

@@ -65,7 +65,7 @@ class QgsTriangle : QgsPolygon
virtual bool fromWkt( const QString &wkt );


virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;


virtual QgsPolygon *surfaceToPolygon() const /Factory/;

0 comments on commit fbe5a17

Please sign in to comment.