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


C++ GeoWriter::writeCharacters方法代码示例

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


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

示例1: 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

示例2: 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

示例3: write

bool KmlPlacemarkTagWriter::write( const GeoNode *node,
                                   GeoWriter& writer ) const
{
    const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark*>(node);
    writer.writeStartElement( kml::kmlTag_Placemark );

    writer.writeOptionalElement( "name", placemark->name() );
    writer.writeElement( kml::kmlTag_visibility, QString::number( placemark->isVisible() ) );
    writer.writeOptionalElement( kml::kmlTag_styleUrl, placemark->styleUrl() );

    if( !placemark->description().isEmpty() ) {
        writer.writeStartElement( "description" );
        if( placemark->descriptionIsCDATA() ) {
            writer.writeCDATA( placemark->description() );
        } else {
            writer.writeCharacters( placemark->description() );
        }
        writer.writeEndElement();
    }


    if( !placemark->extendedData().isEmpty() ){
        writeElement( &placemark->extendedData(), writer );
    }

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

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

    if( placemark->timeStamp().when().isValid() )
        writeElement( &placemark->timeStamp(), writer );

    writer.writeEndElement();
    return true;
}
开发者ID:AsherBond,项目名称:marble,代码行数:39,代码来源:KmlPlacemarkTagWriter.cpp

示例4: write

bool KmlLatLonQuadWriter::write( const GeoNode *node,
                 GeoWriter& writer ) const
{
    const GeoDataLatLonQuad *latLonQuad = static_cast<const GeoDataLatLonQuad*>( node );

    if ( latLonQuad->isValid() ) {
        writer.writeStartElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_LatLonQuad );

        writer.writeStartElement( kml::kmlTag_coordinates );

        writer.writeCharacters( QString::number( latLonQuad->bottomLeftLongitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ',' ) );
        writer.writeCharacters( QString::number( latLonQuad->bottomLeftLatitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ' ' ) );

        writer.writeCharacters( QString::number( latLonQuad->bottomRightLongitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ',' ) );
        writer.writeCharacters( QString::number( latLonQuad->bottomRightLatitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ' ' ) );

        writer.writeCharacters( QString::number( latLonQuad->topRightLongitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ',' ) );
        writer.writeCharacters( QString::number( latLonQuad->topRightLatitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ' ' ) );

        writer.writeCharacters( QString::number( latLonQuad->topLeftLongitude( GeoDataCoordinates::Degree ) ) );
        writer.writeCharacters( QString( ',' ) );
        writer.writeCharacters( QString::number( latLonQuad->topLeftLatitude( GeoDataCoordinates::Degree ) ) );

        writer.writeEndElement();

        writer.writeEndElement();
    }

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


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