Beispiel #1
0
/*!
    Sets the coordinate units of the object to \a unit.

    Note that setting this property will reset the transformType property to
    the default for the units given. For PixelUnit, this is ExactTransform,
    and for all others, BilinearTransform.
    \since 1.2
*/
void QGeoMapObject::setUnits(const CoordinateUnit &unit)
{
    if (unit == d_ptr->units)
        return;

    d_ptr->units = unit;

    if (unit == QGeoMapObject::PixelUnit)
        setTransformType(QGeoMapObject::ExactTransform);
    else
        setTransformType(QGeoMapObject::BilinearTransform);

    emit unitsChanged(unit);
}
/*!
    Constructs a new circle object based on the circle \a circle.
    \since 1.1
*/
QGeoMapCircleObject::QGeoMapCircleObject(const QGeoBoundingCircle &circle)
    : d_ptr(new QGeoMapCircleObjectPrivate())
{
    d_ptr->circle = circle;
    setUnits(QGeoMapObject::MeterUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
QTM_BEGIN_NAMESPACE

/*!
    \class QGeoMapCircleObject
    \brief The QGeoMapCircleObject class is a QGeoMapObject used to draw the region
    within a given distance of a coordinate.

    \inmodule QtLocation
    \since 1.1

    \ingroup maps-mapping-objects

    The circle is specified by either a valid QGeoBoundingCircle instance or a
    valid QGeoCoordinate instance and a qreal with value greater than 0.0,
    which represent the center of the circle and the radius of the circle in
    metres respectively.

    The circle may appear as an ellipse on maps which use the Mercator
    projection. This is done so that the circle accurately covers all points at
    a distance of the radius or less from the center.
*/

/*!
    Constructs a new circle object.
*/
QGeoMapCircleObject::QGeoMapCircleObject()
    : d_ptr(new QGeoMapCircleObjectPrivate())
{
    setUnits(QGeoMapObject::MeterUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
QTM_BEGIN_NAMESPACE

/*!
    \class QGeoMapPolygonObject
    \brief The QGeoMapPolygonObject class is a QGeoMapObject used to draw
    a polygon on a map.

    \inmodule QtLocation
    \since 1.1

    \ingroup maps-mapping-objects

    The polygon is specified by a set of at least 3 valid QGeoCoordinate
    instances listed in the same order in which the coordinates would be
    traversed when traveling around the border of the polygon.
*/

/*!
    Constructs a new polygon object.
*/
QGeoMapPolygonObject::QGeoMapPolygonObject()
    : d_ptr(new QGeoMapPolygonObjectPrivate())
{
    setUnits(QGeoMapObject::RelativeArcSecondUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
/*!
    Constructs a new route object for the route \a route.
*/
QGeoMapRouteObject::QGeoMapRouteObject(const QGeoRoute &route)
    : d_ptr(new QGeoMapRouteObjectPrivate())
{
    d_ptr->route = route;
    setUnits(QGeoMapObject::AbsoluteArcSecondUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
QTM_BEGIN_NAMESPACE

/*!
    \class QGeoMapRouteObject
    \brief The QGeoMapRouteObject class is a QGeoMapObject used to draw
    a route on a map.

    \inmodule QtLocation
    \since 1.1

    \ingroup maps-mapping-objects

    The route is specified by a QGeoRoute object.

    The route might be quite detailed, and so to improve performance the
    detail level can be set with QGeoMapRouteObject::detailLevel.

    The route object draws the route as a series of lines with a minimum
    on-screen harmattan length equal to the detail level.  This is done so that
    the small changes in direction of a road will be visible at high zoom
    levels but will not slow down the rendering at the lower zoom levels.
*/

/*!
    Constructs a new route object.
*/
QGeoMapRouteObject::QGeoMapRouteObject()
    : d_ptr(new QGeoMapRouteObjectPrivate())
{
    setUnits(QGeoMapObject::AbsoluteArcSecondUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
/*!
    Constructs a new circle object with a center at coordinate \a center
    and a radius in meters of \a radius.
    \since 1.1
*/
QGeoMapCircleObject::QGeoMapCircleObject(const QGeoCoordinate &center, qreal radius)
    : d_ptr(new QGeoMapCircleObjectPrivate())
{
    d_ptr->circle = QGeoBoundingCircle(center, radius);
    setUnits(QGeoMapObject::MeterUnit);
    setTransformType(QGeoMapObject::ExactTransform);
    setOrigin(center);
}