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


C++ GeoDataCoordinates::setLatitude方法代码示例

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


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

示例1: popup

void PopupLayer::popup()
{
    GeoDataCoordinates coords = d->m_popupItem->coordinate();
    ViewportParams viewport( d->m_widget->viewport()->projection(),
                             coords.longitude(), coords.latitude(), d->m_widget->viewport()->radius(),
                             d->m_widget->viewport()->size() );
    qreal sx, sy, lon, lat;
    viewport.screenCoordinates( coords, sx, sy );
    sx = viewport.radius() < viewport.width() ? 0.5 * (viewport.width() + viewport.radius()) : 0.75 * viewport.width();
    viewport.geoCoordinates( sx, sy, lon, lat, GeoDataCoordinates::Radian );
    coords.setLatitude( lat );
    coords.setLongitude( lon );
    d->m_widget->centerOn( coords, true );
    setVisible( true );
}
开发者ID:abhgangwar,项目名称:marble,代码行数:15,代码来源:PopupLayer.cpp

示例2: setLatitude

void WikipediaItem::setLatitude( qreal latitude )
{
    GeoDataCoordinates updatedCoordinates = coordinate();
    updatedCoordinates.setLatitude( latitude );
    setCoordinate( updatedCoordinates );
}
开发者ID:KDE,项目名称:marble,代码行数:6,代码来源:WikipediaItem.cpp

示例3: paint

void GroundOverlayFrame::paint(GeoPainter *painter, const ViewportParams *viewport )
{
    m_viewport = viewport;
    m_regionList.clear();

    painter->save();
    if ( placemark()->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType ) {
        GeoDataPolygon *polygon = static_cast<GeoDataPolygon*>( placemark()->geometry() );
        GeoDataLinearRing &ring = polygon->outerBoundary();
        QList<GeoDataCoordinates> coordinateList;

        coordinateList.append( ring.at( NorthWest ) );
        coordinateList.append( ring.at( SouthWest ) );
        coordinateList.append( ring.at( SouthEast ) );
        coordinateList.append( ring.at( NorthEast ) );

        GeoDataCoordinates northernHandle = ring.at( NorthEast ).interpolate( ring.at( NorthWest ), 0.5 );
        GeoDataCoordinates southernHandle = ring.at( SouthEast ).interpolate( ring.at( SouthWest ), 0.5 );
        // Special case handle position to take tessellation
        // along latitude circles into account
        if (m_overlay->latLonBox().rotation() == 0) {
            northernHandle.setLatitude(ring.at( NorthEast ).latitude());
            southernHandle.setLatitude(ring.at( SouthEast ).latitude());
        }
        coordinateList.append( northernHandle );
        coordinateList.append( southernHandle );

        coordinateList.append( ring.at( NorthEast ).interpolate( ring.at( SouthEast ), 0.5 ) );
        coordinateList.append( ring.at( NorthWest ).interpolate( ring.at( SouthWest ), 0.5 ) );

        m_regionList.append( painter->regionFromEllipse( coordinateList.at( NorthWest ), 16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( SouthWest ), 16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( SouthEast ), 16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( NorthEast ), 16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( North ), 16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( South ), 16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( East ),  16, 16 ) );
        m_regionList.append( painter->regionFromEllipse( coordinateList.at( West ),  16, 16 ) );
        m_regionList.append( painter->regionFromPolygon( ring, Qt::OddEvenFill ) );

        // Calculate handle icon orientation due to the projection
        qreal xNW, yNW, xSW, ySW;
        viewport->screenCoordinates(ring.at( NorthWest ), xNW, yNW);
        viewport->screenCoordinates(ring.at( SouthWest ), xSW, ySW);
        qreal westernAngle = qAtan2(ySW - yNW, xSW - xNW) - M_PI/2;
        qreal xNE, yNE, xSE, ySE;
        viewport->screenCoordinates(ring.at( NorthEast ), xNE, yNE);
        viewport->screenCoordinates(ring.at( SouthEast ), xSE, ySE);
        qreal easternAngle = qAtan2(ySE - yNE, xSE - xNE) - M_PI/2;

        painter->setPen( Qt::DashLine );
        painter->setBrush( Qt::NoBrush );
        painter->drawPolygon( ring );

        qreal projectedAngle = 0;

        for( int i = NorthWest; i != Polygon; ++i ) {

            // Assign handle icon orientation due to the projection
            if (i == NorthWest || i == West || i == SouthWest) {
                projectedAngle = westernAngle;
            }
            else if (i == NorthEast || i == East || i == SouthEast) {
                projectedAngle = easternAngle;
            }
            else if (i == North || i == South) {
                projectedAngle = (westernAngle + easternAngle) / 2;
            }
            QTransform trans;
            trans.rotateRadians( projectedAngle );
            if ( m_editStatus == Resize ){
                if( m_hoveredHandle != i ) {
                    painter->drawImage( coordinateList.at( i ),
                                        m_resizeIcons.at( 2*i ).transformed( trans, Qt::SmoothTransformation ) );
                } else {
                    painter->drawImage( coordinateList.at( i ),
                                        m_resizeIcons.at( 2*i + 1 ).transformed( trans, Qt::SmoothTransformation ) );
                }
            } else if ( m_editStatus == Rotate ) {
                if( m_hoveredHandle != i ) {
                    painter->drawImage( coordinateList.at( i ),
                                        m_rotateIcons.at( 2*i ).transformed( trans, Qt::SmoothTransformation ) );
                } else {
                    painter->drawImage( coordinateList.at( i ),
                                        m_rotateIcons.at( 2*i + 1 ).transformed( trans, Qt::SmoothTransformation ) );
                }
            }
        }
    }
    painter->restore();
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:91,代码来源:GroundOverlayFrame.cpp


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