geoshape QML Basic Type | Qt Positioning 5.4

- Qt 5.4
- Qt Positioning
- QML Types
- geoshape QML Basic Type
- Qt 5.4.2 Reference Documentation

# geoshape QML Basic Type

A geoshape type represents an abstract geographic area.

The `geoshape` type represents an abstract geographic area. It includes attributes and methods common to all geographic areas. To create objects that represent a valid geographic area use georectangle or geocircle.

The isValid attribute can be used to test if the geoshape represents a valid geographic area.

The isEmpty attribute can be used to test if the geoshape represents a region with a geomatrical area of 0.

The contains() method can be used to test if a coordinate is within the geoshape.

## Example Usage

Use properties of type variant to store a `geoshape`. To create a `geoshape` use one of the methods described below.

To create a `geoshape` value, specify it as a "shape()" string:

    import QtPositioning

    Item {
        property variant region: "shape()"
    }

or with the QtPositioning.shape() function:

    import QtPositioning 5.2

    Item {
        property variant region: QtPositioning.shape()
    }

When integrating with C++, note that any QGeoShape value passed into QML from C++ is automatically converted into a `geoshape` value, and vice-versa.

## Properties

### isEmpty

    bool isEmpty

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

### isValid

    bool isValid

Returns whether this geo shape is valid.

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.

## Methods

### contains()

    bool contains(coordinate coord)

Returns true if the coordinate specified by coord is within this geoshape; Otherwise returns false.