• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QGeoCoordinate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: QGeoCoordinate

QGeoCoordinate TrackRecorder::trackPointAt(int index) {
    if(index < m_points.length()) {
        return m_points.at(index).coordinate();
    } else {
        return QGeoCoordinate();
    }
}
开发者ID:juiceme,项目名称:rena,代码行数:7,代码来源:trackrecorder.cpp


示例2: QGeoCoordinate

QGeoCoordinate OpenstreetmapMapProvider::pixelToCoord(const QPoint& point,
    int zoomLevel) const
{
    return QGeoCoordinate(tiley2lat(point.y() / (double)TILE_DIMENSION,
               zoomLevel),
               tilex2long(point.x() / (double)TILE_DIMENSION, zoomLevel));
}
开发者ID:jaapgeurts,项目名称:photostage,代码行数:7,代码来源:openstreetmapmapprovider.cpp


示例3: QGeoCoordinate

QGeoCoordinate QGraphicsGeoMap::center() const
{
    if (d_ptr->mapData)
        return d_ptr->mapData->center();

    return QGeoCoordinate();
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:7,代码来源:qgraphicsgeomap.cpp


示例4: calculatePeripheralPoints

static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, const QGeoCoordinate &center, qreal distance, int steps)
{
    // Calculate points based on great-circle distance
    // Calculation is the same as GeoCoordinate's atDistanceAndAzimuth function
    // but tweaked here for computing multiple points

    // pre-calculate
    qreal latRad = qgeocoordinate_degToRad(center.latitude());
    qreal lonRad = qgeocoordinate_degToRad(center.longitude());
    qreal cosLatRad = std::cos(latRad);
    qreal sinLatRad = std::sin(latRad);
    qreal ratio = (distance / (qgeocoordinate_EARTH_MEAN_RADIUS * 1000.0));
    qreal cosRatio = std::cos(ratio);
    qreal sinRatio = std::sin(ratio);
    qreal sinLatRad_x_cosRatio = sinLatRad * cosRatio;
    qreal cosLatRad_x_sinRatio = cosLatRad * sinRatio;

    for (int i = 0; i < steps; ++i) {
        qreal azimuthRad = 2 * M_PI * i / steps;
        qreal resultLatRad = std::asin(sinLatRad_x_cosRatio
                                   + cosLatRad_x_sinRatio * std::cos(azimuthRad));
        qreal resultLonRad = lonRad + std::atan2(std::sin(azimuthRad) * cosLatRad_x_sinRatio,
                                       cosRatio - sinLatRad * std::sin(resultLatRad));
        qreal lat2 = qgeocoordinate_radToDeg(resultLatRad);
        qreal lon2 = qgeocoordinate_radToDeg(resultLonRad);
        if (lon2 < -180.0) {
            lon2 += 360.0;
        } else if (lon2 > 180.0) {
            lon2 -= 360.0;
        }
        path << QGeoCoordinate(lat2, lon2, center.altitude());
    }
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:33,代码来源:qdeclarativecirclemapitem.cpp


示例5: QGraphicsView

MapView::MapView(QWidget *parent) :
    QGraphicsView(parent)
{
    QGraphicsScene* scene = new QGraphicsScene(this);
    setScene(scene);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setInteractive(true);

    QGeoServiceProvider *serviceProvider = new QGeoServiceProvider("nokia");
    QGeoMappingManager *manager = serviceProvider->mappingManager();

    geo_map = new Map(manager);
    connect(geo_map, SIGNAL(markerClicked(QStringList)), SIGNAL(markerClicked(QStringList)));
    geo_map->setMapType(QGraphicsGeoMap::StreetMap);
    geo_map->setCenter(QGeoCoordinate(0.0, 0.0));
    geo_map->setZoomLevel(5);
    scene->addItem(geo_map);

    track = new QGeoMapPolylineObject;
    QPen pen(Qt::red);
    pen.setWidth(3);
    track->setPen(pen);
    track->setZValue(1);
    setMouseTracking(true);
}
开发者ID:favalex,项目名称:StratoTracker,代码行数:26,代码来源:mapview.cpp


示例6: if

QGeoCoordinate QGeoProjection::mercatorToCoord(const QDoubleVector2D &mercator)
{
    const double pi = M_PI;

    double fx = mercator.x();
    double fy = mercator.y();

    if (fy < 0.0)
        fy = 0.0;
    else if (fy > 1.0)
        fy = 1.0;

    double lat;

    if (fy == 0.0)
        lat = 90.0;
    else if (fy == 1.0)
        lat = -90.0;
    else
        lat = (180.0 / pi) * (2.0 * std::atan(std::exp(pi * (1.0 - 2.0 * fy))) - (pi / 2.0));

    double lng;
    if (fx >= 0) {
        lng = realmod(fx, 1.0);
    } else {
        lng = realmod(1.0 - realmod(-1.0 * fx, 1.0), 1.0);
    }

    lng = lng * 360.0 - 180.0;

    return QGeoCoordinate(lat, lng, 0.0);
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:32,代码来源:qgeoprojection.cpp


示例7: Q_D

/*!
    Translates this geo rectangle by \a degreesLatitude northwards and \a
    degreesLongitude eastwards.

    Negative values of \a degreesLatitude and \a degreesLongitude correspond to
    southward and westward translation respectively.

    If the translation would have caused the geo rectangle to cross a pole the
    geo rectangle will be translated until the top or bottom edge of the geo rectangle
    touches the pole but not further.
*/
void QGeoRectangle::translate(double degreesLatitude, double degreesLongitude)
{
    // TODO handle dlat, dlon larger than 360 degrees

    Q_D(QGeoRectangle);

    double tlLat = d->topLeft.latitude();
    double tlLon = d->topLeft.longitude();
    double brLat = d->bottomRight.latitude();
    double brLon = d->bottomRight.longitude();

    if ((tlLat != 90.0) || (brLat != -90.0)) {
        tlLat += degreesLatitude;
        brLat += degreesLatitude;
    }

    if ( (tlLon != -180.0) || (brLon != 180.0) ) {
        tlLon += degreesLongitude;
        brLon += degreesLongitude;
    }

    if (tlLon < -180.0)
        tlLon += 360.0;
    if (tlLon > 180.0)
        tlLon -= 360.0;

    if (brLon < -180.0)
        brLon += 360.0;
    if (brLon > 180.0)
        brLon -= 360.0;

    if (tlLat > 90.0)
        tlLat = 90.0;

    if (tlLat < -90.0)
        tlLat = -90.0;

    if (brLat > 90.0)
        brLat = 90.0;

    if (brLat < -90.0)
        brLat = -90.0;

    d->topLeft = QGeoCoordinate(tlLat, tlLon);
    d->bottomRight = QGeoCoordinate(brLat, brLon);
}
开发者ID:kobolabs,项目名称:qtlocation,代码行数:57,代码来源:qgeorectangle.cpp


示例8: azimuth

/*!
    Returns the coordinate that is reached by traveling \a distance meters
    from the current coordinate at \a azimuth (or bearing) along a great-circle.
    There is an assumption that the Earth is spherical for the purpose of this
    calculation.

    The altitude will have \a distanceUp added to it.

    Returns an invalid coordinate if this coordinate is invalid.
*/
QGeoCoordinate QGeoCoordinate::atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp) const
{
    if (!isValid())
        return QGeoCoordinate();

    double resultLon, resultLat;
    QGeoCoordinatePrivate::atDistanceAndAzimuth(*this, distance, azimuth,
                                                &resultLon, &resultLat);

    if (resultLon > 180.0)
        resultLon -= 360.0;
    else if (resultLon < -180.0)
        resultLon += 360.0;

    double resultAlt = d->alt + distanceUp;
    return QGeoCoordinate(resultLat, resultLon, resultAlt);
}
开发者ID:blackberry,项目名称:QtLocationSubset,代码行数:27,代码来源:qgeocoordinate.cpp


示例9: qInfo

void
TestEphemeride::test_Ephemeride()
{
  Ephemeride ephemeride;
  ephemeride.set_date(QDate(2016, 1, 1));
  ephemeride.set_coordinate(QGeoCoordinate(48.87, 2.67));
  qInfo() << ephemeride.sunrise() << ephemeride.solar_noon() << ephemeride.sunset();
}
开发者ID:bleausard,项目名称:meije-tk,代码行数:8,代码来源:test_ephemeride.cpp


示例10: c1

void tst_QGeoCircle::areaComparison_data()
{
    QTest::addColumn<QGeoShape>("area");
    QTest::addColumn<QGeoCircle>("circle");
    QTest::addColumn<bool>("equal");

    QGeoCircle c1(QGeoCoordinate(10.0, 0.0), 10.0);
    QGeoCircle c2(QGeoCoordinate(20.0, 10.0), 20.0);
    QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));

    QTest::newRow("default constructed") << QGeoShape() << QGeoCircle() << false;
    QTest::newRow("c1 c1") << QGeoShape(c1) << c1 << true;
    QTest::newRow("c1 c2") << QGeoShape(c1) << c2 << false;
    QTest::newRow("c2 c1") << QGeoShape(c2) << c1 << false;
    QTest::newRow("c2 c2") << QGeoShape(c2) << c2 << true;
    QTest::newRow("b c1") << QGeoShape(b) << c1 << false;
}
开发者ID:kobolabs,项目名称:qtlocation,代码行数:17,代码来源:tst_qgeocircle.cpp


示例11: atDistanceAndAzimuth_data

    void atDistanceAndAzimuth_data()
    {
        QTest::addColumn<QGeoCoordinate>("origin");
        QTest::addColumn<qreal>("distance");
        QTest::addColumn<qreal>("azimuth");
        QTest::addColumn<QGeoCoordinate>("result");

        QTest::newRow("invalid coord")
            << QGeoCoordinate()
            << qreal(1000.0)
            << qreal(10.0)
            << QGeoCoordinate();
        if (sizeof(qreal) == sizeof(double)) {
            QTest::newRow("brisbane -> melbourne")
                << BRISBANE
                << qreal(1374820.1618767744)
                << qreal(211.1717286649)
                << MELBOURNE;
            QTest::newRow("london -> new york")
                << LONDON
                << qreal(5570538.4987236429)
                << qreal(288.3388804508)
                << NEW_YORK;
            QTest::newRow("north pole -> south pole")
                << NORTH_POLE
                << qreal(20015109.4154876769)
                << qreal(180.0)
                << SOUTH_POLE;
        } else {
            QTest::newRow("brisbane -> melbourne")
                << BRISBANE
                << qreal(1374820.1618767744)
                << qreal(211.1717286649)
                << QGeoCoordinate(-37.8142515084775, 144.963170622944);
            QTest::newRow("london -> new york")
                << LONDON
                << qreal(5570538.4987236429)
                << qreal(288.3388804508)
                << QGeoCoordinate(40.7145220608416, -74.0071216045375);
            QTest::newRow("north pole -> south pole")
                << NORTH_POLE
                << qreal(20015109.4154876769)
                << qreal(180.0)
                << QGeoCoordinate(-89.9999947369857, -90.0);
        }
    }
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:46,代码来源:tst_qgeocoordinate.cpp


示例12: setCenter

/*!
    Sets the height of this geo rectangle in degrees to \a degreesHeight.

    If \a degreesHeight is less than 0.0 or if this geo rectangle is invalid
    this function does nothing. To set up the values of an invalid
    geo rectangle based on the center, width and height you should use
    setCenter() first in order to make the geo rectangle valid.

    If the change in height would cause the geo rectangle to cross a pole
    the height is adjusted such that the geo rectangle only touches the pole.

    This change is done such that the center coordinate is still at the
    center of the geo rectangle, which may result in a geo rectangle with
    a smaller height than might otherwise be expected.

    If \a degreesHeight is greater than 180.0 then 180.0 is used as the height.
*/
void QGeoRectangle::setHeight(double degreesHeight)
{
    if (!isValid())
        return;

    if (degreesHeight < 0.0)
        return;

    if (degreesHeight >= 180.0) {
        degreesHeight = 180.0;
    }

    Q_D(QGeoRectangle);

    double tlLon = d->topLeft.longitude();
    double brLon = d->bottomRight.longitude();

    QGeoCoordinate c = center();

    double tlLat = c.latitude() + degreesHeight / 2.0;
    double brLat = c.latitude() - degreesHeight / 2.0;

    if (tlLat > 90.0) {
        brLat = 2* c.latitude() - 90.0;
        tlLat = 90.0;
    }

    if (tlLat < -90.0) {
        brLat = -90.0;
        tlLat = -90.0;
    }

    if (brLat > 90.0) {
        tlLat = 90.0;
        brLat = 90.0;
    }

    if (brLat < -90.0) {
        tlLat = 2 * c.latitude() + 90.0;
        brLat = -90.0;
    }

    d->topLeft = QGeoCoordinate(tlLat, tlLon);
    d->bottomRight = QGeoCoordinate(brLat, brLon);
}
开发者ID:kobolabs,项目名称:qtlocation,代码行数:62,代码来源:qgeorectangle.cpp


示例13: qMin

QGeoCoordinate TrackRecorder::trackCenter() {
    // Keep also current position in view
    qreal minLon = qMin(m_minLon, (qreal)m_currentPosition.longitude());
    qreal maxLon = qMax(m_maxLon, (qreal)m_currentPosition.longitude());
    qreal minLat = qMin(m_minLat, (qreal)m_currentPosition.latitude());
    qreal maxLat = qMax(m_maxLat, (qreal)m_currentPosition.latitude());

    return QGeoCoordinate((minLat+maxLat)/2, (minLon+maxLon)/2);
}
开发者ID:juiceme,项目名称:rena,代码行数:9,代码来源:trackrecorder.cpp


示例14: addTestData_info

    void addTestData_info()
    {
        QTest::addColumn<QGeoPositionInfo>("info");

        QTest::newRow("invalid") << QGeoPositionInfo();

        QTest::newRow("coord") << QGeoPositionInfo(QGeoCoordinate(-27.3422,150.2342), QDateTime());
        QTest::newRow("datetime") << QGeoPositionInfo(QGeoCoordinate(), QDateTime::currentDateTime());

        QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes();
        QList<qreal> values = tst_qgeopositioninfo_qrealTestValues();
        for (int i=0; i<attributes.count(); i++) {
            for (int j=0; j<values.count(); j++) {
                QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j])))
                        << infoWithAttribute(attributes[i], values[j]);
            }
        }
    }
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:18,代码来源:tst_qgeopositioninfo.cpp


示例15: georectangle

/*
    This property holds the width of this georectangle (in degrees).
*/
void GeoRectangleValueType::setWidth(double width)
{
    QGeoRectangle r = v;

    if (!r.isValid())
        r.setCenter(QGeoCoordinate(0.0, 0.0));

    r.setWidth(width);
    v = r;
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:13,代码来源:qdeclarativegeorectangle.cpp


示例16: QGraphicsView

WidgetGPS::WidgetGPS(QWidget *parent) :
    QGraphicsView(parent)
{
    coordinatesList.clear();
    myScene = new QGraphicsScene(this);
    this->setScene(myScene);
    this->addCoordinates(QGeoCoordinate(0,0));
    targetCoordinate.setLatitude(0);
    targetCoordinate.setLongitude(0);
}
开发者ID:RoverURC,项目名称:ARES_URS,代码行数:10,代码来源:widgetgps.cpp


示例17: screenPositionToCoordinate

QPoint GeoMap::coordinateToOffscreenPosition (QGeoCoordinate coordinate)
{
    QPoint pixelPosition;
    QGeoCoordinate originCoordinate = screenPositionToCoordinate(QPointF(0,0));
    QGeoCoordinate differenceFromOrigin = QGeoCoordinate (originCoordinate.latitude() - coordinate.latitude(), coordinate.longitude() - originCoordinate.longitude());

    pixelPosition = QPoint(differenceFromOrigin.longitude() * pixelsPerDegreeLongitude, differenceFromOrigin.latitude() * pixelsPerDegreeLatitude);

    return pixelPosition;
}
开发者ID:lewkoo,项目名称:CoMapScalePlayer,代码行数:10,代码来源:geomap.cpp


示例18: QGeoCoordinate

/*!
    Returns the center of this bounding box.
*/
QGeoCoordinate QGeoBoundingBox::center() const
{
    if (!isValid())
        return QGeoCoordinate();

    double cLat = (d_ptr->topLeft.latitude() + d_ptr->bottomRight.latitude()) / 2.0;

    double cLon = (d_ptr->bottomRight.longitude() + d_ptr->topLeft.longitude()) / 2.0;
    if (d_ptr->topLeft.longitude() > d_ptr->bottomRight.longitude()) {
        cLon = cLon - 180.0;
    }

    if (cLon < -180.0)
        cLon += 360.0;
    if (cLon > 180.0)
        cLon -= 360.0;

    return QGeoCoordinate(cLat, cLon);
}
开发者ID:blackberry,项目名称:QtLocationSubset,代码行数:22,代码来源:qgeoboundingbox.cpp


示例19: if

bool LocationValueTypeProvider::create(int type, int argc, const void *argv[], QVariant *v)
{
    if (type == qMetaTypeId<QGeoCoordinate>()) {
        if (argc == 2) {
            const float *a = reinterpret_cast<const float *>(argv[0]);
            const float *b = reinterpret_cast<const float *>(argv[1]);
            *v = QVariant::fromValue(QGeoCoordinate(*a, *b));
            return true;
        } else if (argc == 3) {
            const float *a = reinterpret_cast<const float *>(argv[0]);
            const float *b = reinterpret_cast<const float *>(argv[1]);
            const float *c = reinterpret_cast<const float *>(argv[2]);
            *v = QVariant::fromValue(QGeoCoordinate(*a, *b, *c));
            return true;
        }
    }

    return false;
}
开发者ID:kobolabs,项目名称:qtlocation,代码行数:19,代码来源:locationvaluetypeprovider.cpp


示例20: thisPositionInfo

void Ut_Location::testConstructorQGeoPositionInfo()
{
  QGeoPositionInfo thisPositionInfo( QGeoCoordinate( 60.16183, 24.88256 ), QDateTime( QDate( 1965, 11, 11 ) ) );
  Location subject( thisPositionInfo );

  QString x( "2549182" );
  QString y( "6672569" );
  QCOMPARE( subject.x(), x );
  QCOMPARE( subject.y(), y );
}
开发者ID:nikobockerman,项目名称:AtoBe,代码行数:10,代码来源:ut_location.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QHostAddress函数代码示例发布时间:2022-05-30
下一篇:
C++ QGLFormat函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap