本文整理汇总了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;
}
示例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;
}