Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sipify] Fix header formatting
  • Loading branch information
nyalldawson committed Jun 13, 2020
1 parent cedd73e commit a5101f2
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 67 deletions.
Expand Up @@ -21,7 +21,8 @@ help a user to create valid geometries.

Implementing a custom geometry check consists of the following parts

### Writing the check
Writing the check
-----------------

A new subclass of QgsGeometryCheck needs to be written and at least the following
abstract methods need to be implemented:
Expand Down Expand Up @@ -53,7 +54,8 @@ into this method with the parameter ids and should be retrieved from the availab
use of caching. New errors should be appended to the error list and other message strings to messages.
The method needs to return a tuple (errors, messages).

### Creating a geometry check factory
Creating a geometry check factory
---------------------------------

A Geometry check factory manages meta information for checks. There will always be one single
geometry check factory created per check type, but it's possible that multiple QgsGeometryCheck
Expand Down Expand Up @@ -87,7 +89,8 @@ Returns additional flags for a geometry check. If unsure return QgsGeometryCheck

Returns the type of this geometry check.

### Registering the geometry check
Registering the geometry check
------------------------------

Finally the geometry check factory needs to be registered in QGIS, so the system
is aware of the available geometry checks.
Expand Down
Expand Up @@ -529,7 +529,8 @@ If the gridified geometry could not be calculated ``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:
Example
-------

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 Expand Up @@ -688,7 +689,8 @@ Checks validity of the geometry, and returns ``True`` if the geometry is valid.
Returns Java-style iterator for traversal of parts of the geometry. This iterator
can safely be used to modify parts of the geometry.

### Example:
Example
-------

.. code-block:: python

Expand Down Expand Up @@ -728,7 +730,8 @@ Returns a read-only, Java-style iterator for traversal of vertices of all the ge
The iterator returns a copy of individual vertices, and accordingly geometries cannot be
modified using the iterator. See transformVertices() for a safe method to modify vertices "in-place".

### Example:
Example
-------

.. code-block:: python

Expand Down
9 changes: 6 additions & 3 deletions python/core/auto_generated/geometry/qgsgeometry.sip.in
Expand Up @@ -410,7 +410,8 @@ Returns a read-only, Java-style iterator for traversal of vertices of all the ge
The iterator returns a copy of individual vertices, and accordingly geometries cannot be
modified using the iterator. See transformVertices() for a safe method to modify vertices "in-place".

### Example:
Example
-------

.. code-block:: python

Expand Down Expand Up @@ -438,7 +439,8 @@ can safely be used to modify parts of the geometry.
This method forces a detach. Use constParts() to avoid the detach
if the parts are not going to be modified.

### Example:
Example
-------

.. code-block:: python

Expand Down Expand Up @@ -478,7 +480,8 @@ returns read-only references to parts and cannot be used to modify the parts.
Unlike parts(), this method does not force a detach and is more efficient if read-only
iteration only is required.

### Example:
Example
-------

.. code-block:: python

Expand Down
9 changes: 6 additions & 3 deletions python/core/auto_generated/geometry/qgsgeometryutils.sip.in
Expand Up @@ -117,7 +117,8 @@ Compute the intersection between two segments
:return: - Whether the segments intersect
- intersectionPoint: Output parameter, the intersection point

### Example:
Example
-------

.. code-block:: python

Expand Down Expand Up @@ -477,7 +478,8 @@ M value is computed if one of this point have M.

:return: New point at middle between points pt1 and pt2.

### Example:
Example
-------

.. code-block:: python

Expand Down Expand Up @@ -625,7 +627,8 @@ An algorithm to calculate an (approximate) intersection of two lines in 3D.
:return: - ``True`` if the intersection can be found, ``False`` - otherwise.
- intersection: is the result intersection, of it can be found.

### Example:
Example
-------

.. code-block:: python

Expand Down
3 changes: 2 additions & 1 deletion python/core/auto_generated/geometry/qgspoint.sip.in
Expand Up @@ -317,7 +317,8 @@ 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:
Example
-------

.. code-block:: python

Expand Down
54 changes: 36 additions & 18 deletions python/core/auto_generated/geometry/qgstriangle.sip.in
Expand Up @@ -117,7 +117,8 @@ Returns the three lengths of the triangle.
:return: Lengths of triangle ABC where [AB] is at 0, [BC] is at 1, [CA] is at 2.
An empty list is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -135,7 +136,8 @@ Returns the three angles of the triangle.
:return: Angles in radians of triangle ABC where angle BAC is at 0, angle ABC is at 1, angle BCA is at 2.
An empty list is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -152,7 +154,8 @@ Convenient method checking if the geometry is degenerate (have duplicate or coli

:return: ``True`` if the triangle is degenerate or empty, otherwise ``False``.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -178,7 +181,8 @@ Is the triangle isocele (two sides with the same length)?

:return: ``True`` or ``False``. Always ``False`` for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -200,7 +204,8 @@ Is the triangle equilateral (three sides with the same length)?

:return: ``True`` or ``False``. Always ``False`` for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -222,7 +227,8 @@ Is the triangle right-angled?

:return: ``True`` or ``False``. Always ``False`` for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -244,7 +250,8 @@ Is the triangle scalene (all sides have different lengths)?

:return: ``True`` or ``False``. Always ``False`` for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -265,7 +272,8 @@ An altitude is a segment (defined by a :py:class:`QgsLineString`) from a vertex
:return: Three altitudes from this triangle.
An empty list is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -283,7 +291,8 @@ A median is a segment (defined by a :py:class:`QgsLineString`) from a vertex to
:return: Three medians from this triangle.
An empty list is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -303,7 +312,8 @@ The segment (defined by a :py:class:`QgsLineString`) returned bisect the angle o
:return: Three angle bisector from this triangle.
An empty list is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -321,7 +331,8 @@ Medial (or midpoint) triangle of a triangle ABC is the triangle with vertices at
:return: The medial from this triangle.
An empty triangle is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -341,7 +352,8 @@ An orthocenter is the point of intersection of the altitudes of a triangle.
:return: The orthocenter of the triangle.
An empty point is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -359,7 +371,8 @@ Center of the circumscribed circle of the triangle.
:return: The center of the circumscribed circle of the triangle.
An empty point is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -377,7 +390,8 @@ Radius of the circumscribed circle of the triangle.
:return: The radius of the circumscribed circle of the triangle.
0.0 is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -395,7 +409,8 @@ Circumscribed circle of the triangle.
:return: The circumbscribed of the triangle with a :py:class:`QgsCircle`.
An empty circle is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -414,7 +429,8 @@ supported and is retrieved from the first 3D point amongst vertices.
:return: The center of the inscribed circle of the triangle.
An empty point is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -432,7 +448,8 @@ Radius of the inscribed circle of the triangle.
:return: The radius of the inscribed circle of the triangle.
0.0 is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand All @@ -450,7 +467,8 @@ Inscribed circle of the triangle.
:return: The inscribed of the triangle with a :py:class:`QgsCircle`.
An empty circle is returned for empty triangle.

### Example:
Example
-------

.. code-block:: python

Expand Down
3 changes: 2 additions & 1 deletion python/core/auto_generated/qgseditformconfig.sip.in
Expand Up @@ -138,7 +138,8 @@ If ``ui`` is a URL, a local copy of the file will be made and will be used to cr
%Docstring
Set the editor widget config for a widget which is not for a simple field.

### Example:
Example
-------

.. code-block:: python

Expand Down
3 changes: 2 additions & 1 deletion python/core/auto_generated/qgsfeature.sip.in
Expand Up @@ -338,7 +338,8 @@ This method is a shortcut for calling:

feature.setGeometry( QgsGeometry( geometry ) )

### Example:
Example
-------

.. code-block:: python

Expand Down
12 changes: 12 additions & 0 deletions scripts/sipify.pl
Expand Up @@ -185,6 +185,18 @@ sub processDoxygenLine {
# replace nullptr with None (nullptr means nothing to Python devs)
$line =~ s/\bnullptr\b/None/g;

# convert ### style headings
if ( $line =~ m/^###\s+(.*)$/) {
$line = "$1\n".('-' x length($1));
}
if ( $line =~ m/^##\s+(.*)$/) {
$line = "$1\n".('=' x length($1));
}
if ( $line =~ m/^#\s+(.*)$/) {
$line = "$1\n".('*' x length($1));
}


if ( $line eq '*' ) {
$line = '';
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/geometry/qgsabstractgeometry.h
Expand Up @@ -535,7 +535,7 @@ class CORE_EXPORT QgsAbstractGeometry
* 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:
* ### Example
*
* \code{.cpp}
* geometry->snappedToGrid(1, 1);
Expand Down Expand Up @@ -906,7 +906,7 @@ class CORE_EXPORT QgsAbstractGeometry
* Returns Java-style iterator for traversal of parts of the geometry. This iterator
* can safely be used to modify parts of the geometry.
*
* ### Example:
* ### Example
*
* \code{.py}
* # print the WKT representation of each part in a multi-point geometry
Expand Down Expand Up @@ -944,7 +944,7 @@ class CORE_EXPORT QgsAbstractGeometry
* \warning The iterator returns a copy of individual vertices, and accordingly geometries cannot be
* modified using the iterator. See transformVertices() for a safe method to modify vertices "in-place".
*
* ### Example:
* ### Example
*
* \code{.py}
* # print the x and y coordinate for each vertex in a LineString
Expand Down

0 comments on commit a5101f2

Please sign in to comment.