本文整理汇总了C++中GeoWriter::setDocumentType方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoWriter::setDocumentType方法的具体用法?C++ GeoWriter::setDocumentType怎么用?C++ GeoWriter::setDocumentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoWriter
的用法示例。
在下文中一共展示了GeoWriter::setDocumentType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: saveTourAs
bool TourWidgetPrivate::saveTourAs(const QString &filename)
{
if ( !filename.isEmpty() )
{
QFile file( filename );
if ( file.open( QIODevice::WriteOnly ) ) {
GeoWriter writer;
writer.setDocumentType( kml::kmlTag_nameSpaceOgc22 );
if ( writer.write( &file, m_document ) ) {
file.close();
m_tourUi.m_actionSaveTour->setEnabled( false );
m_isChanged = false;
GeoDataDocument* document = m_document;
if ( !document->fileName().isNull() ) {
m_widget->model()->removeGeoData( document->fileName() );
}
m_widget->model()->addGeoDataFile( filename );
m_document->setFileName( filename );
return true;
}
}
}
return false;
}