2017-05-10 14:23:28 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsregularpolygon.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRegularPolygon
{
%Docstring
2018-05-26 14:10:30 +10:00
Regular Polygon geometry type.
2017-05-10 14:23:28 +02:00
2017-12-15 10:36:55 -04:00
A regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).
The regular polygon is defined by a center point with a number of sides/vertices, a radius and the first vertex.
2017-05-10 14:23:28 +02:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsregularpolygon.h"
%End
public:
enum ConstructionOption
{
InscribedCircle,
CircumscribedCircle
};
QgsRegularPolygon();
2017-09-28 08:17:06 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsRegularPolygon.
2017-09-28 08:17:06 +10:00
%End
2017-05-10 14:23:28 +02:00
2018-06-04 21:56:07 +10:00
QgsRegularPolygon( const QgsPoint ¢er, double radius, double azimuth, unsigned int numberSides, ConstructionOption circle );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructs a regular polygon by ``center`` and parameters for the first vertex. An empty regular polygon is returned if ``numberSides`` < 3 or ``ConstructionOption`` isn't valid.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param center: The center of the regular polygon.
:param radius: Distance from the center and the first vertex or sides (see ``ConstructionOption``).
:param azimuth: Angle in degrees started from the North to the first vertex.
:param numberSides: Number of sides of the regular polygon.
2018-01-09 17:26:37 -04:00
:param circle: Option to create the polygon. see ConstructionOption
2017-05-10 14:23:28 +02:00
%End
2018-06-04 21:56:07 +10:00
QgsRegularPolygon( const QgsPoint ¢er, const QgsPoint &pt1, unsigned int numberSides, ConstructionOption circle );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructs a regular polygon by ``center`` and another point.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param center: The center of the regular polygon.
:param pt1: The first vertex if the polygon is inscribed in circle or the midpoint of a side if the polygon is circumscribed about circle.
:param numberSides: Number of sides of the regular polygon.
:param circle: Option to create the polygon inscribed in circle (the radius is the distance between the center and vertices) or circumscribed about circle (the radius is the distance from the center to the midpoints of the sides).
2017-05-10 14:23:28 +02:00
%End
2018-06-04 21:56:07 +10:00
QgsRegularPolygon( const QgsPoint &pt1, const QgsPoint &pt2, unsigned int numberSides );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructs a regular polygon by two points of the first side.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param pt1: The first vertex of the first side, also first vertex of the regular polygon.
:param pt2: The second vertex of the first side.
:param numberSides: Number of sides of the regular polygon.
2017-05-10 14:23:28 +02:00
%End
bool operator ==( const QgsRegularPolygon &rp ) const;
bool operator !=( const QgsRegularPolygon &rp ) const;
bool isEmpty() const;
%Docstring
A regular polygon is empty if radius equal to 0 or number of sides < 3
%End
2017-06-01 12:18:43 +02:00
QgsPoint center() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the center point of the regular polygon.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`setCenter`
2017-05-10 14:23:28 +02:00
%End
double radius() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the radius.
This is also the radius of the circumscribing circle.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`apothem`
2017-12-15 10:36:55 -04:00
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`setRadius`
2017-05-10 14:23:28 +02:00
%End
2017-06-01 12:18:43 +02:00
QgsPoint firstVertex() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the first vertex (corner) of the regular polygon.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`setFirstVertex`
2017-05-10 14:23:28 +02:00
%End
double apothem() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the apothem of the regular polygon.
The apothem is the radius of the inscribed circle.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`radius`
2017-05-10 14:23:28 +02:00
%End
2017-09-18 12:59:26 +10:00
unsigned int numberSides() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the number of sides of the regular polygon.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`setNumberSides`
2017-05-10 14:23:28 +02:00
%End
2017-06-01 12:18:43 +02:00
void setCenter( const QgsPoint ¢er );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the center point.
Radius is unchanged. The first vertex is reprojected from the new center.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`center`
2017-05-10 14:23:28 +02:00
%End
2018-06-04 21:56:07 +10:00
void setRadius( double radius );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the radius.
Center is unchanged. The first vertex is reprojected from the center with the new radius.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`radius`
2017-05-10 14:23:28 +02:00
%End
2017-06-01 12:18:43 +02:00
void setFirstVertex( const QgsPoint &firstVertex );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the first vertex.
Radius is unchanged. The center is reprojected from the new first vertex.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`firstVertex`
2017-05-10 14:23:28 +02:00
%End
2018-06-04 21:56:07 +10:00
void setNumberSides( unsigned int numberSides );
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the number of sides.
If numberSides < 3, the number of sides is unchanged.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`numberSides`
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsPointSequence points() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a list including the vertices of the regular polygon.
2017-05-10 14:23:28 +02:00
%End
2017-10-29 12:08:07 +01:00
QgsPolygon *toPolygon() const /Factory/;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns as a polygon.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsLineString *toLineString() const /Factory/;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns as a linestring.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsTriangle toTriangle() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns as a triangle.
An empty triangle is returned if the regular polygon is empty or if the number of sides is different from 3.
2017-05-10 14:23:28 +02:00
%End
2017-11-14 16:07:39 +10:00
QVector<QgsTriangle> triangulate() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a triangulation (vertices from sides to the center) of the regular polygon.
An empty list is returned if the regular polygon is empty.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsCircle inscribedCircle() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the inscribed circle
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsCircle circumscribedCircle() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the circumscribed circle
2017-05-10 14:23:28 +02:00
%End
QString toString( int pointPrecision = 17, int radiusPrecision = 17, int anglePrecision = 2 ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns a string representation of the regular polygon.
Members will be truncated to the specified precision.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
double interiorAngle() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the measure of the interior angles in degrees.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
double centralAngle() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the measure of the central angle (the angle subtended at the center of the polygon by one of its sides) in degrees.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
double area() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the area.
Returns 0 if the regular polygon is empty.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
double perimeter() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the perimeter.
Returns 0 if the regular polygon is empty.
2017-05-10 14:23:28 +02:00
%End
2017-07-19 09:19:37 +02:00
double length() const;
2017-05-10 14:23:28 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the length of a side.
Returns 0 if the regular polygon is empty.
2017-05-10 14:23:28 +02:00
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsregularpolygon.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/