当前位置: 首页>>代码示例>>C++>>正文


C++ QGeoCoordinate::isValid方法代码示例

本文整理汇总了C++中QGeoCoordinate::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QGeoCoordinate::isValid方法的具体用法?C++ QGeoCoordinate::isValid怎么用?C++ QGeoCoordinate::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QGeoCoordinate的用法示例。


在下文中一共展示了QGeoCoordinate::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseBoundingBox

bool QGeoRouteXmlParser::parseBoundingBox(QGeoBoundingBox &bounds)
{
    Q_ASSERT(m_reader->isStartElement() && m_reader->name() == "BoundingBox");

    QGeoCoordinate tl;
    QGeoCoordinate br;

    m_reader->readNext();
    while (!(m_reader->tokenType() == QXmlStreamReader::EndElement && m_reader->name() == "BoundingBox")) {
        if (m_reader->tokenType() == QXmlStreamReader::StartElement) {
            if (m_reader->name() == "TopLeft") {
                QGeoCoordinate coordinates;
                if (parseCoordinates(coordinates))
                    tl = coordinates;
            } else if (m_reader->name() == "BottomRight") {
                QGeoCoordinate coordinates;
                if (parseCoordinates(coordinates))
                    br = coordinates;
            } else {
                m_reader->skipCurrentElement();
            }
        }
        m_reader->readNext();
    }

    if (tl.isValid() && br.isValid()) {
        bounds = QGeoBoundingBox(tl, br);
        return true;
    }

    return false;
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:32,代码来源:qgeoroutexmlparser.cpp

示例2: dragEnded

/*!
    \internal
*/
void QDeclarativeRectangleMapItem::dragEnded()
{
    QPointF newTopLeftPoint = QPointF(x(),y());
    QGeoCoordinate newTopLeft = map()->screenPositionToCoordinate(newTopLeftPoint, false);
    if (newTopLeft.isValid()) {
        // calculate new geo width while checking for dateline crossing
        const double lonW = bottomRight_.longitude() > topLeft_.longitude() ?
                    bottomRight_.longitude() - topLeft_.longitude() :
                    bottomRight_.longitude() + 360 - topLeft_.longitude();
        const double latH = qAbs(bottomRight_.latitude() - topLeft_.latitude());
        QGeoCoordinate newBottomRight;
        // prevent dragging over valid min and max latitudes
        if (QLocationUtils::isValidLat(newTopLeft.latitude() - latH)) {
            newBottomRight.setLatitude(newTopLeft.latitude() - latH);
        } else {
            newBottomRight.setLatitude(QLocationUtils::clipLat(newTopLeft.latitude() - latH));
            newTopLeft.setLatitude(newBottomRight.latitude() + latH);
        }
        // handle dateline crossing
        newBottomRight.setLongitude(QLocationUtils::wrapLong(newTopLeft.longitude() + lonW));
        newBottomRight.setAltitude(newTopLeft.altitude());
        topLeft_ = newTopLeft;
        bottomRight_ = newBottomRight;
        geometry_.setPreserveGeometry(true, newTopLeft);
        borderGeometry_.setPreserveGeometry(true, newTopLeft);
        geometry_.markSourceDirty();
        borderGeometry_.markSourceDirty();
        updateMapItem();
        emit topLeftChanged(topLeft_);
        emit bottomRightChanged(bottomRight_);
    }
}
开发者ID:amccarthy,项目名称:qtlocation,代码行数:35,代码来源:qdeclarativerectanglemapitem.cpp

示例3: dragEnded

/*!
    \internal
*/
void QDeclarativeCircleMapItem::dragEnded()
{
    QPointF newPoint = QPointF(x(),y()) + QPointF(width(), height()) / 2;
    QGeoCoordinate newCoordinate = map()->screenPositionToCoordinate(newPoint, false);
    if (newCoordinate.isValid())
        setCenter(newCoordinate);
}
开发者ID:erimat,项目名称:qtlocation-1,代码行数:10,代码来源:qdeclarativecirclemapitem.cpp

示例4: positionUpdated

void PointInPolygonWidget::positionUpdated(const QGeoPositionInfo &info)
{
    QGeoPositionInfo pos_info = info;
    QGeoCoordinate pos = pos_info.coordinate();

    if (pos.isValid()) {

        ui->xNewPoint->setValue(pos.latitude());
        ui->yNewPoint->setValue(pos.longitude());

        ui->xPoint->setValue(pos.latitude());
        ui->yPoint->setValue(pos.longitude());

        double dist = 0;
        if (is_first_distance_) {
            dist_acc_ = 0;
            is_first_distance_ = false;
        } else {
            if (std::fabs(pos.altitude()) < 1e-3) {
                pos.setAltitude(last_position_.coordinate().altitude());
                pos_info.setCoordinate(pos);
            }
            dist = pos_info.coordinate().distanceTo(last_position_.coordinate());
            if (dist > 10) {
                dist_acc_ += dist;
            }
        }
        last_position_ = pos_info;
    }
}
开发者ID:gogo40,项目名称:GoGo-PointsInAPolygon,代码行数:30,代码来源:point_in_polygon_widget.cpp

示例5: setPath

void QDeclarativeGeoRoute::setPath(const QJSValue &value)
{
    if (!value.isArray())
        return;

    QList<QGeoCoordinate> pathList;
    quint32 length = value.property(QStringLiteral("length")).toUInt();
    for (quint32 i = 0; i < length; ++i) {
        bool ok;
        QGeoCoordinate c = parseCoordinate(value.property(i), &ok);

        if (!ok || !c.isValid()) {
            qmlInfo(this) << "Unsupported path type";
            return;
        }

        pathList.append(c);
    }

    if (route_.path() == pathList)
        return;

    route_.setPath(pathList);

    emit pathChanged();
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:26,代码来源:qdeclarativegeoroute.cpp

示例6: setPath

void QDeclarativePolylineMapItem::setPath(const QJSValue &value)
{
    if (!value.isArray())
        return;

    QList<QGeoCoordinate> pathList;
    quint32 length = value.property(QStringLiteral("length")).toUInt();
    for (quint32 i = 0; i < length; ++i) {
        bool ok;
        QGeoCoordinate c = parseCoordinate(value.property(i), &ok);

        if (!ok || !c.isValid()) {
            qmlInfo(this) << "Unsupported path type";
            return;
        }

        pathList.append(c);
    }

    if (path_ == pathList)
        return;

    path_ = pathList;

    geometry_.markSourceDirty();
    updateMapItem();
    emit pathChanged();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:28,代码来源:qdeclarativepolylinemapitem.cpp

示例7: extendShape

/*!
  Extends the circle to include \a coordinate
*/
void QGeoCirclePrivate::extendShape(const QGeoCoordinate &coordinate)
{
    if (!isValid() || !coordinate.isValid() || contains(coordinate))
        return;

    radius = center.distanceTo(coordinate);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:10,代码来源:qgeocircle.cpp

示例8: setCenter

void QGeoAreaMonitorPolling::setCenter(const QGeoCoordinate& coordinate)
{
    if (coordinate.isValid()) {
        QGeoAreaMonitor::setCenter(coordinate);
        checkStartStop();
    }
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:7,代码来源:qgeoareamonitor_polling.cpp

示例9: setCoordinate

void QDeclarativePosition::setCoordinate(const QGeoCoordinate &coordinate)
{
    if (m_coordinate == coordinate)
        return;

    m_coordinate = coordinate;

    if (coordinate.type() == QGeoCoordinate::Coordinate3D && !m_altitudeValid) {
        m_altitudeValid = true;
        emit altitudeValidChanged();
    } else if (m_altitudeValid) {
        m_altitudeValid = false;
        emit altitudeValidChanged();
    }
    if (coordinate.isValid()) {
        if (!m_longitudeValid) {
            m_longitudeValid = true;
            emit longitudeValidChanged();
        }
        if (!m_latitudeValid) {
            m_latitudeValid = true;
            emit latitudeValidChanged();
        }
    } else {
        if (m_longitudeValid) {
            m_longitudeValid = false;
            emit longitudeValidChanged();
        }
        if (m_latitudeValid) {
            m_latitudeValid = false;
            emit latitudeValidChanged();
        }
    }
    emit coordinateChanged();
}
开发者ID:xjohncz,项目名称:qt5,代码行数:35,代码来源:qdeclarativeposition.cpp

示例10: addAtForBoundingArea

static bool addAtForBoundingArea(const QGeoShape &area,
                                 QUrlQuery *queryItems)
{
    QGeoCoordinate center;
    switch (area.type()) {
    case QGeoShape::RectangleType:
        center = QGeoRectangle(area).center();
        break;
    case QGeoShape::CircleType:
        center = QGeoCircle(area).center();
        break;
    case QGeoShape::UnknownType:
        break;
    }

    if (!center.isValid()) {
        return false;
    } else {
        queryItems->addQueryItem(QLatin1String("at"),
                                 QString::number(center.latitude()) +
                                 QLatin1Char(',') +
                                 QString::number(center.longitude()));
        return true;
    }
}
开发者ID:agunnarsson,项目名称:qtlocation,代码行数:25,代码来源:qplacemanagerengine_nokiav2.cpp

示例11: contains

/*!
    Returns whether the coordinate \a coordinate is contained within this
    bounding box.
*/
bool QGeoBoundingBox::contains(const QGeoCoordinate &coordinate) const
{

    if (!isValid() || !coordinate.isValid())
        return false;

    double left = d_ptr->topLeft.longitude();
    double right = d_ptr->bottomRight.longitude();
    double top = d_ptr->topLeft.latitude();
    double bottom = d_ptr->bottomRight.latitude();

    double lon = coordinate.longitude();
    double lat = coordinate.latitude();

    if (lat > top)
        return false;
    if (lat < bottom)
        return false;

    if ((lat == 90.0) && (top == 90.0))
        return true;

    if ((lat == -90.0) && (bottom == -90.0))
        return true;

    if (left <= right) {
        if ((lon < left) || (lon > right))
            return false;
    } else {
        if ((lon < left) && (lon > right))
            return false;
    }

    return true;
}
开发者ID:blackberry,项目名称:QtLocationSubset,代码行数:39,代码来源:qgeoboundingbox.cpp

示例12: xmpGeoCoordinate

QGeoCoordinate QExiv2::geoCoordinate() const
{
	// Prefer XMP
	QGeoCoordinate gc = xmpGeoCoordinate();
	if (!gc.isValid()) {
		// Fallback to exif
		gc = exifGeoCoordinate();
	}
	return gc;
}
开发者ID:rbbrnc,项目名称:krbkACD,代码行数:10,代码来源:qexiv2_gps.cpp

示例13: contains

bool QGeoCirclePrivate::contains(const QGeoCoordinate &coordinate) const
{
    if (!isValid() || !coordinate.isValid())
        return false;

    // see QTBUG-41447 for details
    qreal distance = center.distanceTo(coordinate);
    if (qFuzzyCompare(distance, radius) || distance <= radius)
        return true;

    return false;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:12,代码来源:qgeocircle.cpp

示例14: defaultHostLocation

QGeoCoordinate GasInfoSettings::defaultHostLocation() const
{
    QByteArray ba = value(defaultHostLocationKey).toByteArray();
    QDataStream in(&ba, QIODevice::ReadOnly);
    QGeoCoordinate location;

    in >> location;

    if (!location.isValid())
        return QGeoCoordinate(39.903924, 116.391432, 0);
    else
        return location;
}
开发者ID:Quenii,项目名称:adcevm,代码行数:13,代码来源:gasinfosettings.cpp

示例15: geometryChanged

/*!
    \internal
*/
void QDeclarativeCircleMapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
    if (updatingGeometry_ || newGeometry == oldGeometry) {
        QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry);
        return;
    }

    QDoubleVector2D newPoint = QDoubleVector2D(x(),y()) + QDoubleVector2D(width(), height()) / 2;
    QGeoCoordinate newCoordinate = map()->itemPositionToCoordinate(newPoint, false);
    if (newCoordinate.isValid())
        setCenter(newCoordinate);

    // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested
    // call to this function.
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:18,代码来源:qdeclarativecirclemapitem.cpp


注:本文中的QGeoCoordinate::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。