Skip to content

Commit

Permalink
run sipify for code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Dec 20, 2017
1 parent d042304 commit 64c99e0
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 257 deletions.
16 changes: 0 additions & 16 deletions python/core/expression/qgsexpression.sip
Expand Up @@ -18,22 +18,6 @@ Class for parsing and evaluation of expressions (formerly called "search strings
The expressions try to follow both syntax and semantics of SQL expressions.

Usage:
\code{.cpp}
QgsExpression exp("gid*2 > 10 and type not in ('D','F')");
if (exp.hasParserError())
{
// show error message with parserErrorString() and exit
}
QVariant result = exp.evaluate(feature, fields);
if (exp.hasEvalError())
{
// show error message with evalErrorString()
}
else
{
// examine the result
}
\endcode

Three Value Logic
=================
Expand Down
4 changes: 1 addition & 3 deletions python/core/geometry/qgsabstractgeometry.sip
Expand Up @@ -456,9 +456,7 @@ If the gridified geometry could not be calculated a None will be returned.
It may generate an invalid geometry (in some corner cases).
It can also be thought as rounding the edges and it may be useful for removing errors.
Example:
\code
geometry->snappedToGrid(1, 1);
\endcode

In this case we use a 2D grid of 1x1 to gridify.
In this case, it can be thought like rounding the x and y of all the points/vertices to full units (remove all decimals).

Expand Down
22 changes: 11 additions & 11 deletions python/core/geometry/qgsgeometryutils.sip
Expand Up @@ -297,17 +297,17 @@ M value is computed if one of this point have M.

:return: New point at middle between points pt1 and pt2.
* Example:
\code{.py}
p = :py:class:`QgsPoint`( 4, 6 ) # 2D point
pr = midpoint ( p, :py:class:`QgsPoint`( 2, 2 ) )
# pr is a 2D point: 'Point (3 4)'
pr = midpoint ( p, :py:class:`QgsPoint`( QgsWkbTypes.PointZ, 2, 2, 2 ) )
# pr is a 3D point: 'PointZ (3 4 1)'
pr = midpoint ( p, :py:class:`QgsPoint`( QgsWkbTypes.PointM, 2, 2, 0, 2 ) )
# pr is a 3D point: 'PointM (3 4 1)'
pr = midpoint ( p, :py:class:`QgsPoint`( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) )
# pr is a 3D point: 'PointZM (3 4 1 1)'
\endcode
.. code-block:: python

p = QgsPoint( 4, 6 ) # 2D point
pr = midpoint ( p, QgsPoint( 2, 2 ) )
# pr is a 2D point: 'Point (3 4)'
pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZ, 2, 2, 2 ) )
# pr is a 3D point: 'PointZ (3 4 1)'
pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointM, 2, 2, 0, 2 ) )
# pr is a 3D point: 'PointM (3 4 1)'
pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) )
# pr is a 3D point: 'PointZM (3 4 1 1)'

.. versionadded:: 3.0
%End
Expand Down
62 changes: 31 additions & 31 deletions python/core/geometry/qgspoint.sip
Expand Up @@ -33,21 +33,21 @@ based on the following rules:
- If only x and y are specified, the type will be a 2D point.
- If any or both of the Z and M are specified, the appropriate type will be created.

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

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

pt_m = QgsPoint(33, 88, m=5)
pt_m.m() # 5
pt_m.wkbType() # QgsWkbTypes.PointM

pt = QgsPoint(30, 40, wkbType=QgsWkbTypes.PointZ)
pt.z() # nan
pt.wkbType() # QgsWkbTypes.PointZ
\endcode
.. code-block:: python

pt = QgsPoint(43.4, 5.3)
pt.asWkt() # Point(43.4 5.3)

pt_z = QgsPoint(120, 343, 77)
pt.asWkt() # PointZ(120 343 77)
pt_m = QgsPoint(33, 88, m=5)
pt_m.m() # 5
pt_m.wkbType() # QgsWkbTypes.PointM
pt = QgsPoint(30, 40, wkbType=QgsWkbTypes.PointZ)
pt.z() # nan
pt.wkbType() # QgsWkbTypes.PointZ
%End
%MethodCode
double z;
Expand Down Expand Up @@ -293,22 +293,22 @@ M value is preserved.
:return: The point projected. If a 2D point is projected a 3D point will be returned except if
inclination is 90. A 3D point is always returned if a 3D point is projected.
Example:
\code{.py}
p = QgsPoint( 1, 2 ) # 2D point
pr = p.project ( 1, 0 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project ( 1, 0, 90 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 1)'
p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point
pr = p.project ( 1, 0 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project ( 1, 0, 90 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 3)'
\endcode
.. code-block:: python

p = QgsPoint( 1, 2 ) # 2D point
pr = p.project ( 1, 0 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project ( 1, 0, 90 )
# pr is a 2D point: 'Point (1 3)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 1)'
p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point
pr = p.project ( 1, 0 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project ( 1, 0, 90 )
# pr is a 3D point: 'PointZ (1 3 2)'
pr = p.project (1, 0, 0 )
# pr is a 3D point: 'PointZ (1 2 3)'

.. versionadded:: 3.0
%End
Expand Down

0 comments on commit 64c99e0

Please sign in to comment.