~ubuntu-branches/ubuntu/quantal/marble/quantal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2011 Utku Aydın <utkuaydin34@gmail.com>
//

#include "DgmlVectorTagWriter.h"

#include "GeoWriter.h"
#include "GeoSceneVector.h"
#include "GeoSceneTypes.h"
#include "DgmlElementDictionary.h"

namespace Marble
{

static GeoTagWriterRegistrar s_writerVector( GeoTagWriter::QualifiedName( GeoSceneTypes::GeoSceneVectorType, dgml::dgmlTag_nameSpace20 ), new DgmlVectorTagWriter() );

bool DgmlVectorTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoSceneVector *vector = static_cast<const GeoSceneVector*>( node );
    writer.writeStartElement( dgml::dgmlTag_Vector );
    writer.writeAttribute( "name", vector->name() );
    writer.writeAttribute( "feature", vector->feature() );
    
    writer.writeStartElement( dgml::dgmlTag_SourceFile );
    writer.writeAttribute( "format", vector->fileFormat() );
    writer.writeCharacters( vector->sourceFile() );
    writer.writeEndElement();
    
    writer.writeStartElement( dgml::dgmlTag_Pen );
    writer.writeAttribute( "color", vector->pen().color().name() );
    writer.writeEndElement();
        
    writer.writeEndElement();
    return true;
}

}