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


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

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


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

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

示例2: write

bool KmlBalloonStyleTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataBalloonStyle *balloonStyle = static_cast<const GeoDataBalloonStyle*>( node );
    bool const isEmpty = balloonStyle->backgroundColor() == QColor( Qt::white ) &&
            balloonStyle->textColor() == QColor( Qt::black ) &&
            balloonStyle->text().isEmpty() &&
            balloonStyle->displayMode() == GeoDataBalloonStyle::Default;
    if ( isEmpty ) {
            return true;
    }

    writer.writeStartElement( kml::kmlTag_BalloonStyle );
    KmlObjectTagWriter::writeIdentifiers( writer, balloonStyle );

    QString const backgroundColor = KmlColorStyleTagWriter::formatColor( balloonStyle->backgroundColor() );
    writer.writeOptionalElement( kml::kmlTag_bgColor, backgroundColor, "ffffffff" );
    QString const textColor = KmlColorStyleTagWriter::formatColor( balloonStyle->textColor() );
    writer.writeOptionalElement( kml::kmlTag_textColor, textColor, "ff000000" );

    QString const textString = balloonStyle->text();
    if ( textString.contains( QRegExp( "[<>&]" ) ) ) {
        writer.writeStartElement( kml::kmlTag_text );
        writer.writeCDATA( textString );
        writer.writeEndElement();
    } else {
        writer.writeOptionalElement( kml::kmlTag_text, textString );
    }

    if ( balloonStyle->displayMode() == GeoDataBalloonStyle::Hide ) {
        writer.writeElement( kml::kmlTag_displayMode, "hide" );
    }

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


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