Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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) noexcept
 Returns the hash value for the shape, using seed for the calculation.
 

Related Symbols

(Note that these are not member symbols.)

size_t qHash (const QGeoShape &shape, size_t seed) noexcept
 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.

References d.

Referenced by QGeoCodingManagerEngineNokia::geocode(), GeoCodingManagerEngineEsri::geocode(), QGeoCodingManagerEngineOsm::geocode(), QGeoRouteParserOsrmV5Private::parseReply(), QDeclarativeGeoMapQuickItem::setGeoShape(), QDeclarativeRectangleMapItem::setGeoShape(), and QDeclarativeGeoMap::setVisibleRegion().

+ Here is the caller graph for this function:

◆ 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.

References d.

◆ 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.

References d.

Referenced by QGeoAreaMonitorPolling::activeMonitors(), and QT_BEGIN_NAMESPACE::parseLocation().

+ Here is the caller graph for this function:

◆ 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.

References d.

◆ isValid()

bool QGeoShape::isValid ( ) const

Returns whether this geo shape is valid.

Definition at line 173 of file qgeoshape.cpp.

References d.

◆ 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.

References d_ptr, and other().

Referenced by QGeoCircle::operator=(), QGeoPath::operator=(), QGeoPolygon::operator=(), and QGeoRectangle::operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

QString QGeoShape::toString ( ) const

Returns a string representation of this geo shape.

Since
5.5

Definition at line 273 of file qgeoshape.cpp.

References QStringLiteral, and type.

◆ type()

QGeoShape::ShapeType QGeoShape::type ( ) const

Returns the type of this geo shape.

Definition at line 159 of file qgeoshape.cpp.

References d, and UnknownType.

Friends And Related Symbol Documentation

◆ operator!=

bool QGeoShape::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 QGeoShape::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 [1/2]

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.

◆ qHash() [2/2]

size_t qHash ( const QGeoShape & shape,
size_t seed )
related

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

Property Documentation

◆ center

QGeoCoordinate QGeoShape::center
read

Definition at line 22 of file qgeoshape.h.

◆ isEmpty

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.

Referenced by QGeoAreaMonitorPolling::activeMonitors(), QGeoLocationPrivate::isEmpty(), QGeoAreaMonitorInfo::isValid(), PlaceManagerEngineEsri::search(), and QPlaceManagerEngineOsm::search().

◆ isValid

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.

Referenced by QGeoRectangle::bottomLeft(), QDeclarativeCircleMapItem::geometryChange(), QDeclarativePolygonMapItem::geometryChange(), QDeclarativePolylineMapItem::geometryChange(), QDeclarativeRectangleMapItem::geometryChange(), QGeoRectangle::height(), QT_BEGIN_NAMESPACE::parseLocation(), QGeoRectangle::setCenter(), QGeoRectangle::setHeight(), QDeclarativeGeoMap::setVisibleRegion(), QGeoRectangle::setWidth(), QGeoRectangle::topRight(), QGeoRectangle::united(), QDeclarativeCircleMapItemPrivateCPU::updatePolish(), and QGeoRectangle::width().

◆ type


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