Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QGeoShape Class Reference

\inmodule QtPositioning More...

#include <qgeoshape.h>

+ Inheritance diagram for QGeoShape:
+ Collaboration diagram for QGeoShape:

Public Types

enum  ShapeType {
  UnknownType , RectangleType , CircleType , PathType ,
  PolygonType
}
 Describes the type of the shape. More...
 

Public Member Functions

 QGeoShape ()
 Constructs a new invalid geo shape of \l UnknownType.
 
Q_INVOKABLE QGeoShape (const QGeoShape &other)
 Constructs a new geo shape which is a copy of other.
 
 ~QGeoShape ()
 Destroys this geo shape.
 
ShapeType type () const
 Returns the type of this geo shape.
 
bool isValid () const
 Returns whether this geo shape is valid.
 
bool isEmpty () const
 Returns whether this geo shape is empty.
 
Q_INVOKABLE bool contains (const QGeoCoordinate &coordinate) const
 Returns whether the coordinate coordinate is contained within this geo shape.
 
Q_INVOKABLE QGeoRectangle boundingGeoRectangle () const
 Returns a QGeoRectangle representing the geographical bounding rectangle of the geo shape, that defines the latitudinal/longitudinal bounds of the geo shape.
 
QGeoCoordinate center () const
 Returns the coordinate located at the geometric center of the geo shape.
 
QGeoShapeoperator= (const QGeoShape &other)
 Assigns other to this geo shape and returns a reference to this geo shape.
 
Q_INVOKABLE QString toString () const
 Returns a string representation of this geo shape.
 

Protected Member Functions

 QGeoShape (QGeoShapePrivate *d)
 

Protected Attributes

QSharedDataPointer< QGeoShapePrivated_ptr
 

Properties

ShapeType type
 This property holds the type of this geo shape.
 
bool isValid
 This property holds the validity of the geo shape.
 
bool isEmpty
 This property defines whether this geo shape is empty.
 
QGeoCoordinate center
 

Friends

bool operator== (const QGeoShape &lhs, const QGeoShape &rhs)
 Returns true if the lhs geo shape is equivalent to the rhs geo shape, otherwise returns false.
 
bool operator!= (const QGeoShape &lhs, const QGeoShape &rhs)
 Returns true if the lhs geo shape is not equivalent to the rhs geo shape, otherwise returns false.
 
QDebug operator<< (QDebug dbg, const QGeoShape &shape)
 
QDataStreamoperator<< (QDataStream &stream, const QGeoShape &shape)
 
QDataStreamoperator>> (QDataStream &stream, QGeoShape &shape)
 
Q_POSITIONING_EXPORT size_t qHash (const QGeoShape &key, size_t seed=0)
 Returns the hash value for the shape, using seed for the calculation.
 

Detailed Description

\inmodule QtPositioning

Since
5.2

The QGeoShape class defines a geographic area.

This class is the base class for classes which specify a geographic area.

For the sake of consistency, subclasses should describe the specific details of the associated areas in terms of QGeoCoordinate instances and distances in meters.

This class is a \l Q_GADGET since Qt 5.5. It can be \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.

Definition at line 16 of file qgeoshape.h.

Member Enumeration Documentation

◆ ShapeType

Describes the type of the shape.

\value UnknownType A shape of unknown type \value RectangleType A rectangular shape \value CircleType A circular shape \value PathType A path type \value PolygonType A polygon type

Enumerator
UnknownType 
RectangleType 
CircleType 
PathType 
PolygonType 

Definition at line 30 of file qgeoshape.h.

Constructor & Destructor Documentation

◆ QGeoShape() [1/3]

QGeoShape::QGeoShape ( )

Constructs a new invalid geo shape of \l UnknownType.

Definition at line 118 of file qgeoshape.cpp.

◆ QGeoShape() [2/3]

QGeoShape::QGeoShape ( const QGeoShape & other)

Constructs a new geo shape which is a copy of other.

Definition at line 125 of file qgeoshape.cpp.

◆ ~QGeoShape()

QGeoShape::~QGeoShape ( )

Destroys this geo shape.

Definition at line 152 of file qgeoshape.cpp.

◆ QGeoShape() [3/3]

QGeoShape::QGeoShape ( QGeoShapePrivate * d)
protected

Definition at line 133 of file qgeoshape.cpp.

Member Function Documentation

◆ boundingGeoRectangle()

QGeoRectangle QGeoShape::boundingGeoRectangle ( ) const

Returns a QGeoRectangle representing the geographical bounding rectangle of the geo shape, that defines the latitudinal/longitudinal bounds of the geo shape.

Since
5.9

Definition at line 217 of file qgeoshape.cpp.

◆ center()

QGeoCoordinate QGeoShape::center ( ) const

Returns the coordinate located at the geometric center of the geo shape.

Since
5.5

Definition at line 232 of file qgeoshape.cpp.

◆ contains()

bool QGeoShape::contains ( const QGeoCoordinate & coordinate) const

Returns whether the coordinate coordinate is contained within this geo shape.

Definition at line 201 of file qgeoshape.cpp.

◆ isEmpty()

bool QGeoShape::isEmpty ( ) const

Returns whether this geo shape is empty.

An empty geo shape is a region which has a geometrical area of 0.

Definition at line 188 of file qgeoshape.cpp.

◆ isValid()

bool QGeoShape::isValid ( ) const

Returns whether this geo shape is valid.

Definition at line 173 of file qgeoshape.cpp.

◆ operator=()

QGeoShape & QGeoShape::operator= ( const QGeoShape & other)

Assigns other to this geo shape and returns a reference to this geo shape.

Definition at line 259 of file qgeoshape.cpp.

◆ toString()

QString QGeoShape::toString ( ) const

Returns a string representation of this geo shape.

Since
5.5

Definition at line 273 of file qgeoshape.cpp.

◆ type()

QGeoShape::ShapeType QGeoShape::type ( ) const

Returns the type of this geo shape.

Definition at line 159 of file qgeoshape.cpp.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const QGeoShape & lhs,
const QGeoShape & rhs )
friend

Returns true if the lhs geo shape is not equivalent to the rhs geo shape, otherwise returns false.

Definition at line 50 of file qgeoshape.h.

◆ operator<< [1/2]

QDataStream & operator<< ( QDataStream & stream,
const QGeoShape & shape )
friend

Definition at line 75 of file qgeoshape.h.

◆ operator<< [2/2]

QDebug operator<< ( QDebug dbg,
const QGeoShape & shape )
friend

Definition at line 68 of file qgeoshape.h.

◆ operator==

bool operator== ( const QGeoShape & lhs,
const QGeoShape & rhs )
friend

Returns true if the lhs geo shape is equivalent to the rhs geo shape, otherwise returns false.

Definition at line 46 of file qgeoshape.h.

◆ operator>>

QDataStream & operator>> ( QDataStream & stream,
QGeoShape & shape )
friend

Definition at line 79 of file qgeoshape.h.

◆ qHash

size_t qHash ( const QGeoShape & key,
size_t seed = 0 )
friend

Returns the hash value for the shape, using seed for the calculation.

Definition at line 404 of file qgeoshape.cpp.

Member Data Documentation

◆ d_ptr

QSharedDataPointer<QGeoShapePrivate> QGeoShape::d_ptr
protected

Definition at line 61 of file qgeoshape.h.

Property Documentation

◆ center

QGeoCoordinate QGeoShape::center
read

Definition at line 22 of file qgeoshape.h.

◆ isEmpty

bool QGeoShape::isEmpty
read

This property defines whether this geo shape is empty.

An empty geo shape is a region which has a geometrical area of 0.

While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.

Since
5.5

Definition at line 21 of file qgeoshape.h.

◆ isValid

bool QGeoShape::isValid
read

This property holds the validity of the geo shape.

A geo shape is considered to be invalid if some of the data that is required to unambiguously describe the geo shape has not been set or has been set to an unsuitable value depending on the subclass of this object. The default constructed objects of this type are invalid.

While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.

Since
5.5

Definition at line 20 of file qgeoshape.h.

◆ type

ShapeType QGeoShape::type
read

This property holds the type of this geo shape.

While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.

Since
5.5

Definition at line 19 of file qgeoshape.h.


The documentation for this class was generated from the following files: