Skip to content

Commit 64c99e0

Browse files
committedDec 20, 2017
run sipify for code snippets
1 parent d042304 commit 64c99e0

File tree

10 files changed

+207
-257
lines changed

10 files changed

+207
-257
lines changed
 

‎python/core/expression/qgsexpression.sip

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ Class for parsing and evaluation of expressions (formerly called "search strings
1818
The expressions try to follow both syntax and semantics of SQL expressions.
1919

2020
Usage:
21-
\code{.cpp}
22-
QgsExpression exp("gid*2 > 10 and type not in ('D','F')");
23-
if (exp.hasParserError())
24-
{
25-
// show error message with parserErrorString() and exit
26-
}
27-
QVariant result = exp.evaluate(feature, fields);
28-
if (exp.hasEvalError())
29-
{
30-
// show error message with evalErrorString()
31-
}
32-
else
33-
{
34-
// examine the result
35-
}
36-
\endcode
3721

3822
Three Value Logic
3923
=================

‎python/core/geometry/qgsabstractgeometry.sip

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,7 @@ If the gridified geometry could not be calculated a None will be returned.
456456
It may generate an invalid geometry (in some corner cases).
457457
It can also be thought as rounding the edges and it may be useful for removing errors.
458458
Example:
459-
\code
460-
geometry->snappedToGrid(1, 1);
461-
\endcode
459+
462460
In this case we use a 2D grid of 1x1 to gridify.
463461
In this case, it can be thought like rounding the x and y of all the points/vertices to full units (remove all decimals).
464462

‎python/core/geometry/qgsgeometryutils.sip

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,17 @@ M value is computed if one of this point have M.
297297

298298
:return: New point at middle between points pt1 and pt2.
299299
* Example:
300-
\code{.py}
301-
p = :py:class:`QgsPoint`( 4, 6 ) # 2D point
302-
pr = midpoint ( p, :py:class:`QgsPoint`( 2, 2 ) )
303-
# pr is a 2D point: 'Point (3 4)'
304-
pr = midpoint ( p, :py:class:`QgsPoint`( QgsWkbTypes.PointZ, 2, 2, 2 ) )
305-
# pr is a 3D point: 'PointZ (3 4 1)'
306-
pr = midpoint ( p, :py:class:`QgsPoint`( QgsWkbTypes.PointM, 2, 2, 0, 2 ) )
307-
# pr is a 3D point: 'PointM (3 4 1)'
308-
pr = midpoint ( p, :py:class:`QgsPoint`( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) )
309-
# pr is a 3D point: 'PointZM (3 4 1 1)'
310-
\endcode
300+
.. code-block:: python
301+
302+
p = QgsPoint( 4, 6 ) # 2D point
303+
pr = midpoint ( p, QgsPoint( 2, 2 ) )
304+
# pr is a 2D point: 'Point (3 4)'
305+
pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZ, 2, 2, 2 ) )
306+
# pr is a 3D point: 'PointZ (3 4 1)'
307+
pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointM, 2, 2, 0, 2 ) )
308+
# pr is a 3D point: 'PointM (3 4 1)'
309+
pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) )
310+
# pr is a 3D point: 'PointZM (3 4 1 1)'
311311

312312
.. versionadded:: 3.0
313313
%End

‎python/core/geometry/qgspoint.sip

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ based on the following rules:
3333
- If only x and y are specified, the type will be a 2D point.
3434
- If any or both of the Z and M are specified, the appropriate type will be created.
3535

36-
\code{.py}
37-
pt = QgsPoint(43.4, 5.3)
38-
pt.asWkt() # Point(43.4 5.3)
39-
40-
pt_z = QgsPoint(120, 343, 77)
41-
pt.asWkt() # PointZ(120 343 77)
42-
43-
pt_m = QgsPoint(33, 88, m=5)
44-
pt_m.m() # 5
45-
pt_m.wkbType() # QgsWkbTypes.PointM
46-
47-
pt = QgsPoint(30, 40, wkbType=QgsWkbTypes.PointZ)
48-
pt.z() # nan
49-
pt.wkbType() # QgsWkbTypes.PointZ
50-
\endcode
36+
.. code-block:: python
37+
38+
pt = QgsPoint(43.4, 5.3)
39+
pt.asWkt() # Point(43.4 5.3)
40+
41+
pt_z = QgsPoint(120, 343, 77)
42+
pt.asWkt() # PointZ(120 343 77)
43+
44+
pt_m = QgsPoint(33, 88, m=5)
45+
pt_m.m() # 5
46+
pt_m.wkbType() # QgsWkbTypes.PointM
47+
48+
pt = QgsPoint(30, 40, wkbType=QgsWkbTypes.PointZ)
49+
pt.z() # nan
50+
pt.wkbType() # QgsWkbTypes.PointZ
5151
%End
5252
%MethodCode
5353
double z;
@@ -293,22 +293,22 @@ M value is preserved.
293293
:return: The point projected. If a 2D point is projected a 3D point will be returned except if
294294
inclination is 90. A 3D point is always returned if a 3D point is projected.
295295
Example:
296-
\code{.py}
297-
p = QgsPoint( 1, 2 ) # 2D point
298-
pr = p.project ( 1, 0 )
299-
# pr is a 2D point: 'Point (1 3)'
300-
pr = p.project ( 1, 0, 90 )
301-
# pr is a 2D point: 'Point (1 3)'
302-
pr = p.project (1, 0, 0 )
303-
# pr is a 3D point: 'PointZ (1 2 1)'
304-
p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point
305-
pr = p.project ( 1, 0 )
306-
# pr is a 3D point: 'PointZ (1 3 2)'
307-
pr = p.project ( 1, 0, 90 )
308-
# pr is a 3D point: 'PointZ (1 3 2)'
309-
pr = p.project (1, 0, 0 )
310-
# pr is a 3D point: 'PointZ (1 2 3)'
311-
\endcode
296+
.. code-block:: python
297+
298+
p = QgsPoint( 1, 2 ) # 2D point
299+
pr = p.project ( 1, 0 )
300+
# pr is a 2D point: 'Point (1 3)'
301+
pr = p.project ( 1, 0, 90 )
302+
# pr is a 2D point: 'Point (1 3)'
303+
pr = p.project (1, 0, 0 )
304+
# pr is a 3D point: 'PointZ (1 2 1)'
305+
p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point
306+
pr = p.project ( 1, 0 )
307+
# pr is a 3D point: 'PointZ (1 3 2)'
308+
pr = p.project ( 1, 0, 90 )
309+
# pr is a 3D point: 'PointZ (1 3 2)'
310+
pr = p.project (1, 0, 0 )
311+
# pr is a 3D point: 'PointZ (1 2 3)'
312312

313313
.. versionadded:: 3.0
314314
%End

‎python/core/geometry/qgstriangle.sip

Lines changed: 145 additions & 145 deletions
Large diffs are not rendered by default.

‎python/core/qgseditformconfig.sip

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ EditorLayout.GeneratedLayout.
127127
Set the editor widget config for a widget which is not for a simple field.
128128

129129
Example:
130-
\code{.py}
131-
editFormConfig = layer.editFormConfig()
132-
editFormConfig.setWidgetConfig( 'relation_id', { 'nm-rel': 'other_relation' } )
133-
layer.setEditFormConfig(editFormConfig)
134-
\endcode
130+
.. code-block:: python
131+
132+
editFormConfig = layer.editFormConfig()
133+
editFormConfig.setWidgetConfig( 'relation_id', { 'nm-rel': 'other_relation' } )
134+
layer.setEditFormConfig(editFormConfig)
135135

136136
:param widgetName: The name of the widget to configure
137137
:param config: The config to set for this widget

‎python/core/qgsvectorlayer.sip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ manages editing transactions.
3333

3434
Sample usage of the QgsVectorLayer class:
3535

36-
\code
37-
QString uri = "point?crs=epsg:4326&field=id:integer";
38-
QgsVectorLayer *scratchLayer = new QgsVectorLayer(uri, "Scratch point layer", "memory");
39-
\endcode
36+
.. code-block::
37+
38+
QString uri = "point?crs=epsg:4326&field=id:integer";
39+
QgsVectorLayer *scratchLayer = new QgsVectorLayer(uri, "Scratch point layer", "memory");
4040

4141
The main data providers supported by QGIS are listed below.
4242

‎python/core/raster/qgsrasterlayer.sip

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,12 @@ so the rasterlayer class appends the band number in brackets behind each band na
5555

5656
Sample usage of the QgsRasterLayer class:
5757

58-
\code
59-
QString myFileNameQString = "/path/to/file";
60-
QFileInfo myFileInfo(myFileNameQString);
61-
QString myBaseNameQString = myFileInfo.baseName();
62-
QgsRasterLayer *myRasterLayer = new QgsRasterLayer(myFileNameQString, myBaseNameQString);
63-
64-
\endcode
65-
6658
In order to automate redrawing of a raster layer, you should like it to a map canvas like this :
6759

68-
\code
69-
QObject.connect( myRasterLayer, SIGNAL(repaintRequested()), mapCanvas, SLOT(refresh()) );
70-
\endcode
71-
7260
Once a layer has been created you can find out what type of layer it is (GrayOrUndefined, Palette or Multiband):
7361

74-
\code
75-
if (rasterLayer->rasterType()==QgsRasterLayer.Multiband)
76-
{
77-
//do something
78-
}
79-
else if (rasterLayer->rasterType()==QgsRasterLayer.Palette)
80-
{
81-
//do something
82-
}
83-
else // QgsRasterLayer.GrayOrUndefined
84-
{
85-
//do something.
86-
}
87-
\endcode
62+
63+
8864

8965
Raster layers can also have an arbitrary level of transparency defined, and have their
9066
color palettes inverted using the setTransparency and setInvertHistogram methods.

‎python/gui/qgshighlight.sip

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ A class for highlight features on the map.
1616
The QgsHighlight class provides a transparent overlay canvas item
1717
for highlighting features or geometries on a map canvas.
1818

19-
\code{.py}
20-
color = QColor(Qt.red)
21-
highlight = QgsHighlight(mapCanvas, feature, layer)
22-
highlight.setColor(color)
23-
color.setAlpha(50)
24-
highlight.setFillColor(color)
25-
highlight.show()
26-
\endcode
19+
.. code-block:: python
20+
21+
color = QColor(Qt.red)
22+
highlight = QgsHighlight(mapCanvas, feature, layer)
23+
highlight.setColor(color)
24+
color.setAlpha(50)
25+
highlight.setFillColor(color)
26+
highlight.show()
2727
%End
2828

2929
%TypeHeaderCode

‎python/gui/qgsprojectionselectiondialog.sip

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ A generic dialog to prompt the user for a Coordinate Reference System.
1818
Typically you will use this when you want to prompt the user for
1919
a coordinate system identifier e.g. from a plugin you might do this
2020
to get an epsg code:
21-
\code
22-
QgsProjectionSelectionDialog mySelector( mQGisIface->mainWindow() );
23-
mySelector.setCrs( crs );
24-
if ( mySelector.exec() )
25-
{
26-
mCrs = mySelector.crs();
27-
}
28-
\endcode
2921

3022
If you wish to embed the projection selector into an existing dialog
3123
the you probably want to look at QgsProjectionSelectionWidget instead.

0 commit comments

Comments
 (0)
Please sign in to comment.