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


C++ GeoDataDocument::remove方法代码示例

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


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

示例1: readSettings

void PositionTracking::readSettings()
{
    QFile file( d->statusFile() );
    if ( !file.open( QIODevice::ReadOnly ) ) {
        mDebug() << "Can not read track from " << file.fileName();
        return;
    }

    GeoDataParser parser( GeoData_KML );
    if ( !parser.read( &file ) ) {
        mDebug() << "Could not parse tracking file: " << parser.errorString();
        return;
    }

    GeoDataDocument *doc = dynamic_cast<GeoDataDocument*>( parser.releaseDocument() );
    file.close();

    if( !doc ){
        mDebug() << "tracking document not available";
        return;
    }

    GeoDataPlacemark *track = dynamic_cast<GeoDataPlacemark*>( doc->child( 0 ) );
    if( !track ) {
        mDebug() << "tracking document doesn't have a placemark";
        delete doc;
        return;
    }

    d->m_trackSegments = dynamic_cast<GeoDataMultiTrack*>( track->geometry() );
    if( !d->m_trackSegments ) {
        mDebug() << "tracking document doesn't have a multitrack";
        delete doc;
        return;
    }
    if( d->m_trackSegments->size() < 1 ) {
        mDebug() << "tracking document doesn't have a track";
        delete doc;
        return;
    }

    d->m_currentTrack = dynamic_cast<GeoDataTrack*>( d->m_trackSegments->child( d->m_trackSegments->size() - 1 ) );
    if( !d->m_currentTrack ) {
        mDebug() << "tracking document doesn't have a last track";
        delete doc;
        return;
    }

    doc->remove( 0 );
    delete doc;

    d->m_treeModel->removeDocument( &d->m_document );
    d->m_document.remove( 1 );
    delete d->m_currentTrackPlacemark;
    d->m_currentTrackPlacemark = track;
    d->m_currentTrackPlacemark->setName("Current Track");
    d->m_document.append( d->m_currentTrackPlacemark );
    d->m_currentTrackPlacemark->setStyleUrl( d->m_currentTrackPlacemark->styleUrl() );

    d->m_treeModel->addDocument( &d->m_document );
    d->m_length = 0.0;
    for ( int i = 0; i < d->m_trackSegments->size(); ++i ) {
        d->m_length += d->m_trackSegments->at( i ).lineString()->length( 1 );
    }
}
开发者ID:abhgangwar,项目名称:marble,代码行数:65,代码来源:PositionTracking.cpp


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