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