Struct rute::auto::polygon::Polygon

source ·
pub struct Polygon<'a> { /* private fields */ }
Expand description

Notice these docs are heavy WIP and not very relevent yet

A QPolygon object is a QVector. The easiest way to add points to a QPolygon is to use QVector’s streaming operator, as illustrated below:

In addition to the functions provided by QVector, QPolygon provides some point-specific functions.

Each point in a polygon can be retrieved by passing its index to the point() function. To populate the polygon, QPolygon provides the setPoint() function to set the point at a given index, the setPoints() function to set all the points in the polygon (resizing it to the given number of points), and the putPoints() function which copies a number of given points into the polygon from a specified index (resizing the polygon if necessary).

QPolygon provides the boundingRect() and translate() functions for geometry functions. Use the QMatrix::map() function for more general transformations of QPolygons.

The QPolygon class is implicitly shared

See also: [Vector] PolygonF Line

Licence

The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.

Implementations

Swaps polygon other with this polygon. This operation is very fast and never fails.

Returns the bounding rectangle of the polygon, or QRect(0, 0, 0, 0) if the polygon is empty.

See also: [Vector::is_empty]

Extracts the coordinates of the point at the given index to

  • x and * y (if they are valid pointers).

See also: [set_point()]

Overloads Returns the point at the given index.

Overloads Sets the point at the given index to the given point.

Sets the point at the given index to the point specified by ( x , y ).

See also: [point()] [put_points()] [set_points()] */

/*! Resizes the polygon to nPoints and populates it with the given points.

The example code creates a polygon with two points (10, 20) and (30, 40):

See also: [set_point()] [put_points()]

Overloads Resizes the polygon to nPoints and populates it with the points specified by the variable argument list. The points are given as a sequence of integers, starting with firstx then firsty, and so on.

The example code creates a polygon with two points (10, 20) and (30, 40):

Overloads Sets the point at the given index to the given point.

Sets the point at the given index to the point specified by ( x , y ).

See also: [point()] [put_points()] [set_points()] */

/*! Resizes the polygon to nPoints and populates it with the given points.

The example code creates a polygon with two points (10, 20) and (30, 40):

See also: [set_point()] [put_points()]

Overloads Resizes the polygon to nPoints and populates it with the points specified by the variable argument list. The points are given as a sequence of integers, starting with firstx then firsty, and so on.

The example code creates a polygon with two points (10, 20) and (30, 40):

Overloads Resizes the polygon to nPoints and populates it with the points specified by the variable argument list. The points are given as a sequence of integers, starting with firstx then firsty, and so on.

The example code creates a polygon with two points (10, 20) and (30, 40):

Copies nPoints points from the variable argument list into this polygon from the given index.

The points are given as a sequence of integers, starting with firstx then firsty, and so on. The polygon is resized if index+nPoints exceeds its current size.

The example code creates a polygon with three points (4,5), (6,7) and (8,9), by expanding the polygon from 1 to 3 points:

The following code has the same result, but here the putPoints() function overwrites rather than extends:

See also: [set_points()]

Overloads Copies nPoints points from the given fromIndex ( 0 by default) in fromPolygon into this polygon, starting at the specified index. For example:

Copies nPoints points from the variable argument list into this polygon from the given index.

The points are given as a sequence of integers, starting with firstx then firsty, and so on. The polygon is resized if index+nPoints exceeds its current size.

The example code creates a polygon with three points (4,5), (6,7) and (8,9), by expanding the polygon from 1 to 3 points:

The following code has the same result, but here the putPoints() function overwrites rather than extends:

See also: [set_points()]

Overloads Copies nPoints points from the given fromIndex ( 0 by default) in fromPolygon into this polygon, starting at the specified index. For example:

Returns true if the given point is inside the polygon according to the specified fillRule; otherwise returns false.

Returns a polygon which is the union of this polygon and r.

Set operations on polygons, will treat the polygons as areas, and implicitly close the polygon.

See also: [intersected()] [subtracted()]

Returns a polygon which is the intersection of this polygon and r.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

See also: [intersects()]

Returns true if the current polygon intersects at any point the given polygon p. Also returns true if the current polygon contains or is contained by any part of p.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

See also: [intersected()]

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.