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


C++ GeoWriter类代码示例

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


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

示例1: saveRoute

void RoutingManagerPrivate::saveRoute(const QString &filename)
{
    GeoWriter writer;
    writer.setDocumentType( kml::kmlTag_nameSpaceOgc22 );

    QMutexLocker locker( &m_fileMutex );
    QFile file( filename );
    if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
    {
        mDebug() << "Cannot write to " << file.fileName();
        return;
    }

    GeoDataDocument container;
    container.setName(QStringLiteral("Route"));
    GeoDataFolder* request = routeRequest();
    if ( request ) {
        container.append( request );
    }

    GeoDataDocument *route = m_alternativeRoutesModel.currentRoute();
    if ( route ) {
        container.append( new GeoDataDocument( *route ) );
    }

    if ( !writer.write( &file, &container ) ) {
        mDebug() << "Can not write route state to " << file.fileName();
    }
    file.close();
}
开发者ID:KDE,项目名称:marble,代码行数:30,代码来源:RoutingManager.cpp

示例2: writeMultipolygon

void OsmRelationTagWriter::writeMultipolygon( const GeoDataPolygon& polygon,
                                              const OsmPlacemarkData& osmData, GeoWriter& writer )
{
    writer.writeStartElement( osm::osmTag_relation );

    OsmObjectAttributeWriter::writeAttributes( osmData, writer );
    OsmTagTagWriter::writeTags( osmData, writer );

    writer.writeStartElement( osm::osmTag_member );
    QString memberId = QString::number( osmData.memberReference( -1 ).id() );
    writer.writeAttribute( "type", "way" );
    writer.writeAttribute( "ref", memberId );
    writer.writeAttribute( "role", "outer" );
    writer.writeEndElement();

    for ( int index = 0; index < polygon.innerBoundaries().size(); ++index ) {
        writer.writeStartElement( osm::osmTag_member );
        QString memberId = QString::number( osmData.memberReference( index ).id() );
        writer.writeAttribute( "type", "way" );
        writer.writeAttribute( "ref", memberId );
        writer.writeAttribute( "role", "inner" );
        writer.writeEndElement();
    }
    writer.writeEndElement();
 }
开发者ID:tzapzoor,项目名称:marble,代码行数:25,代码来源:OsmRelationTagWriter.cpp

示例3: write

bool KmlPointTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataPoint *point = static_cast<const GeoDataPoint*>(node);

    writer.writeStartElement( kml::kmlTag_Point );

    writer.writeStartElement("coordinates");

    QString coordinateString;

    //FIXME: this should be using the GeoDataCoordinates::toString but currently
    // it is not including the altitude and is adding an extra space after commas

    coordinateString += QString::number( point->coordinates().longitude( GeoDataCoordinates::Degree ), 'f', 10 );
    coordinateString += ',' ;
    coordinateString += QString::number( point->coordinates().latitude( GeoDataCoordinates::Degree ) , 'f', 10 );

    if( point->coordinates().altitude() ) {
        coordinateString += ',';
        coordinateString += QString::number( point->coordinates().altitude() , 'f' , 10);
    }

    writer.writeCharacters( coordinateString );

    writer.writeEndElement();
    writer.writeEndElement();

    return true;
}
开发者ID:AsherBond,项目名称:marble,代码行数:30,代码来源:KmlPointTagWriter.cpp

示例4: saveTrack

bool PositionTracking::saveTrack( const QString& fileName )
{

    if ( fileName.isEmpty() ) {
        return false;
    }

    GeoWriter writer;
    //FIXME: a better way to do this?
    writer.setDocumentType( kml::kmlTag_nameSpaceOgc22 );

    GeoDataDocument *document = new GeoDataDocument;
    QFileInfo fileInfo( fileName );
    QString name = fileInfo.baseName();
    document->setName( name );
    foreach( const GeoDataStyle &style, d->m_document.styles() ) {
        document->addStyle( style );
    }
    foreach( const GeoDataStyleMap &map, d->m_document.styleMaps() ) {
        document->addStyleMap( map );
    }
    GeoDataPlacemark *track = new GeoDataPlacemark( *d->m_currentTrackPlacemark );
    track->setName( "Track " + name );
    document->append( track );

    QFile file( fileName );
    file.open( QIODevice::WriteOnly );
    bool const result = writer.write( &file, document );
    file.close();
    delete document;
    return result;
}
开发者ID:abhgangwar,项目名称:marble,代码行数:32,代码来源:PositionTracking.cpp

示例5: write

bool KmlLinkTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataLink *link = static_cast<const GeoDataLink*>( node );

    writer.writeStartElement( kml::kmlTag_Link );
    KmlObjectTagWriter::writeIdentifiers( writer, link );

    writer.writeElement( kml::kmlTag_href, link->href() );

    QString const refreshMode = refreshModeToString( link->refreshMode() );
    writer.writeOptionalElement( kml::kmlTag_refreshMode, refreshMode, "onChange" );

    writer.writeElement( kml::kmlTag_refreshInterval, QString::number( link->refreshInterval() ) );

    QString const viewRefreshMode = viewRefreshModeToString( link->viewRefreshMode() );
    writer.writeOptionalElement( kml::kmlTag_viewRefreshMode, viewRefreshMode, "never" );

    writer.writeElement( kml::kmlTag_viewRefreshTime, QString::number( link->viewRefreshTime() ) );

    writer.writeElement( kml::kmlTag_viewBoundScale, QString::number( link->viewBoundScale() ) );

    writer.writeOptionalElement( kml::kmlTag_viewFormat, link->viewFormat());

    writer.writeOptionalElement( kml::kmlTag_httpQuery, link->httpQuery());

    writer.writeEndElement();

    return true;
}
开发者ID:KDE,项目名称:marble,代码行数:29,代码来源:KmlLinkTagWriter.cpp

示例6: write

bool OsmTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    Q_UNUSED( node );

    writer.writeStartElement( "osm" );
    writer.writeAttribute( "version", osm::osmTag_version06 );
    writer.writeAttribute( "generator", "Marble " + Marble::MARBLE_VERSION_STRING );

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:10,代码来源:OsmTagWriter.cpp

示例7: write

bool KmlFlyToTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataFlyTo *flyTo = static_cast<const GeoDataFlyTo*>( node );
    writer.writeStartElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_FlyTo );
    writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_duration, QString::number( flyTo->duration()) );
    QString const flyToModeString = flyTo->flyToMode() == GeoDataFlyTo::Smooth ? "smooth" : "bounce";
    writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_flyToMode, flyToModeString );
    writeElement( flyTo->view(), writer );
    writer.writeEndElement();
    return true;
}
开发者ID:AsherBond,项目名称:marble,代码行数:11,代码来源:KmlFlyToTagWriter.cpp

示例8: write

bool KmlDataTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataData *data = static_cast<const GeoDataData*>( node );

    writer.writeStartElement( kml::kmlTag_Data );
    writer.writeAttribute( "name", data->name() );
    writer.writeOptionalElement( kml::kmlTag_displayName, data->displayName() );
    writer.writeElement( "value", data->value().toString() );
    writer.writeEndElement();

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:13,代码来源:KmlDataTagWriter.cpp

示例9: writeMid

bool KmlPhotoOverlayWriter::writeMid( const GeoNode *node, GeoWriter &writer ) const
{
    KmlOverlayTagWriter::writeMid( node, writer );

    const GeoDataPhotoOverlay *photo_overlay =
        static_cast<const GeoDataPhotoOverlay*>( node );

    // rotation
    QString const rotation = QString::number( photo_overlay->rotation(), 'f', 3 );
    writer.writeOptionalElement( kml::kmlTag_rotation, rotation, "0.000" );

    // ViewVolume
    writer.writeStartElement( kml::kmlTag_ViewVolume );
    writer.writeOptionalElement<qreal>( kml::kmlTag_leftFov, photo_overlay->viewVolume().leftFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_rightFov, photo_overlay->viewVolume().rightFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_bottomFov, photo_overlay->viewVolume().bottomFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_topFov, photo_overlay->viewVolume().topFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_near, photo_overlay->viewVolume().near(), 0 );
    writer.writeEndElement();

    // ImagePyramid
    writer.writeStartElement( kml::kmlTag_ImagePyramid );
    writer.writeOptionalElement<int>( kml::kmlTag_tileSize, photo_overlay->imagePyramid().tileSize(), 256 );
    writer.writeOptionalElement<int>( kml::kmlTag_maxWidth, photo_overlay->imagePyramid().maxWidth() );
    writer.writeOptionalElement<int>( kml::kmlTag_maxHeight, photo_overlay->imagePyramid().maxHeight() );

    switch ( photo_overlay->imagePyramid().gridOrigin() )
    {
    case GeoDataImagePyramid::LowerLeft:
        writer.writeElement( kml::kmlTag_gridOrigin, "lowerLeft" );
        break;
    case GeoDataImagePyramid::UpperLeft:
        writer.writeElement( kml::kmlTag_gridOrigin, "upperLeft" );
        break;
    }
    writer.writeEndElement();

    // Point
    writeElement( &photo_overlay->point(), writer );

    // shape
    switch ( photo_overlay->shape() )
    {
    case GeoDataPhotoOverlay::Rectangle:
        break;
    case GeoDataPhotoOverlay::Cylinder:
        writer.writeElement( kml::kmlTag_shape, "cylinder" );
        break;
    case GeoDataPhotoOverlay::Sphere:
        writer.writeElement( kml::kmlTag_shape, "sphere" );
        break;
    }

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:55,代码来源:KmlPhotoOverlayWriter.cpp

示例10: write

bool KmlLatLonAltBoxWriter::write( const GeoNode *node,
				 GeoWriter& writer ) const
{
    const GeoDataLatLonAltBox *latLonAltBox = static_cast<const GeoDataLatLonAltBox*>( node );
    writer.writeStartElement(kml::kmlTag_LatLonAltBox);
    KmlObjectTagWriter::writeIdentifiers( writer, latLonAltBox );
    writer.writeTextElement( kml::kmlTag_north, QString::number(latLonAltBox->north( GeoDataCoordinates::Degree )) );
    writer.writeTextElement( kml::kmlTag_south, QString::number(latLonAltBox->south( GeoDataCoordinates::Degree )) );
    writer.writeTextElement( kml::kmlTag_east,  QString::number(latLonAltBox->east( GeoDataCoordinates::Degree )) );
    writer.writeTextElement( kml::kmlTag_west,  QString::number(latLonAltBox->west( GeoDataCoordinates::Degree )) );
    writer.writeTextElement( kml::kmlTag_minAltitude, QString::number(latLonAltBox->minAltitude()) );
    writer.writeTextElement( kml::kmlTag_maxAltitude, QString::number(latLonAltBox->maxAltitude()) );
    KmlGroundOverlayWriter::writeAltitudeMode( writer, latLonAltBox->altitudeMode());
    writer.writeEndElement();
    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:16,代码来源:KmlLatLonAltBoxWriter.cpp

示例11: writeAltitudeMode

void KmlGroundOverlayWriter::writeAltitudeMode(GeoWriter& writer, AltitudeMode altMode)
{
    if ( altMode == ClampToGround ) {
        // clampToGround is always the default value, so we never have to write it
        return;
    }

    const QString altitudeMode = KmlGroundOverlayWriter::altitudeModeToString( altMode );
    bool const isGoogleExtension = ( altMode == ClampToSeaFloor || altMode == RelativeToSeaFloor );
    if ( isGoogleExtension ) {
        // clampToSeaFloor and relativeToSeaFloor are Google extensions that need a gx: tag namespace
        writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_altitudeMode, altitudeMode);
    } else {
        writer.writeElement( kml::kmlTag_altitudeMode, altitudeMode );
    }
}
开发者ID:KDE,项目名称:marble,代码行数:16,代码来源:KmlGroundOverlayWriter.cpp

示例12: write

bool KmlPolygonTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataPolygon *polygon = static_cast<const GeoDataPolygon*>( node );

    writer.writeStartElement( kml::kmlTag_Polygon );
    KmlObjectTagWriter::writeIdentifiers( writer, polygon );
    writer.writeOptionalElement( kml::kmlTag_extrude, QString::number( polygon->extrude() ), "0" );

    writer.writeStartElement( "outerBoundaryIs" );
    writeElement( &polygon->outerBoundary(), writer );
    writer.writeEndElement();

    const QVector<GeoDataLinearRing>& linearRings = polygon->innerBoundaries();
    if (linearRings.size() > 0) {
	writer.writeStartElement( "innerBoundaryIs" );
	for ( int i = 0; i < linearRings.size(); ++i ) {
	    const GeoDataLinearRing& ring = linearRings[i];
	    writeElement( &ring, writer );
	}
	writer.writeEndElement();
    }

    writer.writeEndElement();

    return true;

}
开发者ID:PayalPradhan,项目名称:marble,代码行数:27,代码来源:KmlPolygonTagWriter.cpp

示例13: write

bool KmlStyleTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataStyle *style = static_cast<const GeoDataStyle*>( node );

    writer.writeStartElement( kml::kmlTag_Style );
    KmlObjectTagWriter::writeIdentifiers( writer, style );

    writeElement( &style->iconStyle(), writer );
    writeElement( &style->labelStyle(), writer );
    writeElement( &style->lineStyle(), writer );
    writeElement( &style->polyStyle(), writer );
    writeElement( &style->balloonStyle(), writer );
    writeElement( &style->listStyle(), writer );

    writer.writeEndElement();

    return true;
}
开发者ID:calincru,项目名称:marble,代码行数:18,代码来源:KmlStyleTagWriter.cpp

示例14: write

bool KmlLineStringTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataLineString *lineString = static_cast<const GeoDataLineString*>( node );

    if ( lineString->size() > 1 )
    {
        writer.writeStartElement( kml::kmlTag_LineString );
        writer.writeStartElement( "coordinates" );

        // Write altitude for *all* elements, if *any* element
        // has altitude information (!= 0.0)
        bool hasAltitude = false;
        for ( int i = 0; i < lineString->size(); ++i ) {
            if ( lineString->at( i ).altitude() ) {
                hasAltitude = true;
                break;
            }
        }

        for ( int i = 0; i < lineString->size(); ++i ) {
            GeoDataCoordinates coordinates = lineString->at( i );
            if ( i > 0 )
            {
                writer.writeCharacters( " " );
            }

            qreal lon = coordinates.longitude( GeoDataCoordinates::Degree );
            writer.writeCharacters( QString::number( lon, 'f', 10 ) );
            writer.writeCharacters( "," );
            qreal lat = coordinates.latitude( GeoDataCoordinates::Degree );
            writer.writeCharacters( QString::number( lat, 'f', 10 ) );

            if ( hasAltitude ) {
                qreal alt = coordinates.altitude();
                writer.writeCharacters( "," );
                writer.writeCharacters( QString::number( alt, 'f', 2 ) );
            }
        }

        writer.writeEndElement();
        writer.writeEndElement();

        return true;
    }

    return false;
}
开发者ID:AsherBond,项目名称:marble,代码行数:47,代码来源:KmlLineStringTagWriter.cpp

示例15: writeMid

bool KmlPlacemarkTagWriter::writeMid( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark*>(node);

    writer.writeOptionalElement( kml::kmlTag_styleUrl, placemark->styleUrl() );
    if ( placemark->styleUrl().isEmpty() && placemark->customStyle() ) {
        writeElement( placemark->customStyle().data(), writer );
    }

    if( placemark->geometry() ) {
        writeElement( placemark->geometry(), writer );
    }

    if( placemark->isBalloonVisible() ){
        QString string;
        string.setNum( 1 );
        writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_balloonVisibility, string );
    }

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:21,代码来源:KmlPlacemarkTagWriter.cpp


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