• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • plugins
  • runner
  • gpx
  • handlers
GPXgpxTagHandler.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 
4  This file is part of the KDE project
5 
6  This library is free software you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  aint with this library see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "GPXgpxTagHandler.h"
23 
24 #include "MarbleDebug.h"
25 
26 #include "GPXElementDictionary.h"
27 #include "GeoDataParser.h"
28 
29 #include "GeoDataDocument.h"
30 #include "GeoDataStyle.h"
31 #include "GeoDataStyleMap.h"
32 #include "GeoDataHotSpot.h"
33 #include "MarbleDirs.h"
34 #include "MarbleGlobal.h"
35 
36 namespace Marble
37 {
38 namespace gpx
39 {
40 GPX_DEFINE_TAG_HANDLER(gpx)
41 
42 GeoNode* GPXgpxTagHandler::parse(GeoParser& parser) const
43 {
44  GeoDataDocument* doc = geoDataDoc( parser );
45 
46  GeoDataStyle style;
47  GeoDataLineStyle lineStyle;
48  QColor transparentRed = Oxygen::brickRed6;
49  transparentRed.setAlpha( 200 );
50  lineStyle.setColor( transparentRed );
51  lineStyle.setWidth( 4 );
52  style.setLineStyle(lineStyle);
53  style.setStyleId("track");
54 
55  GeoDataStyleMap styleMap;
56  styleMap.setStyleId("map-track");
57  styleMap.insert("normal", QString("#").append(style.styleId()));
58  doc->addStyleMap(styleMap);
59  doc->addStyle(style);
60 
61  // create a style for routes
62  GeoDataStyle routestyle;
63  GeoDataLineStyle routeLineStyle;
64  QColor skyBlue = Oxygen::skyBlue6;
65  skyBlue.setAlpha( 200 );
66  routeLineStyle.setColor( skyBlue );
67  routeLineStyle.setWidth( 5 );
68  routestyle.setLineStyle(routeLineStyle);
69  routestyle.setStyleId("route");
70 
71  GeoDataStyleMap routeStyleMap;
72  routeStyleMap.setStyleId("map-route");
73  routeStyleMap.insert("normal", QString("#").append(routestyle.styleId()));
74  doc->addStyleMap(routeStyleMap);
75  doc->addStyle(routestyle);
76 
77  // create a default style for waypoint icons
78  GeoDataStyle waypointStyle;
79  waypointStyle.setStyleId("waypoint");
80  GeoDataIconStyle iconStyle;
81  iconStyle.setIconPath(MarbleDirs::path("bitmaps/flag.png"));
82  iconStyle.setHotSpot(QPointF(0.12,0.03), GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction);
83  waypointStyle.setIconStyle(iconStyle);
84 
85  GeoDataLabelStyle waypointLabelStyle;
86  waypointLabelStyle.setAlignment(GeoDataLabelStyle::Corner);
87  waypointStyle.setLabelStyle(waypointLabelStyle);
88 
89  GeoDataStyleMap waypointStyleMap;
90  waypointStyleMap.setStyleId("map-waypoint");
91  waypointStyleMap.insert("normal", QString("#").append(waypointStyle.styleId()));
92  doc->addStyleMap(waypointStyleMap);
93  doc->addStyle(waypointStyle);
94 
95  return doc;
96 }
97 
98 }
99 }
Marble::GeoDataIconStyle
Definition: GeoDataIconStyle.h:29
GeoDataDocument.h
Marble::GeoDataLineStyle
specifies the style how lines are drawn
Definition: GeoDataLineStyle.h:36
Marble::GeoDataDocument::addStyleMap
void addStyleMap(const GeoDataStyleMap &map)
Add a stylemap to the stylemap storage.
Definition: GeoDataDocument.cpp:137
Marble::GeoDataStyleSelector::setStyleId
void setStyleId(const QString &value)
Set a new style id.
Definition: GeoDataStyleSelector.cpp:60
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:64
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:53
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
Marble::GeoDataStyle::setIconStyle
void setIconStyle(const GeoDataIconStyle &style)
set the icon style
Definition: GeoDataStyle.cpp:82
Marble::GeoDataColorStyle::setColor
void setColor(const QColor &value)
Set a new color.
Definition: GeoDataColorStyle.cpp:73
GeoDataStyle.h
GeoDataParser.h
Marble::GeoDataStyleMap
a class to map different styles to one style
Definition: GeoDataStyleMap.h:38
MarbleDebug.h
GPX_DEFINE_TAG_HANDLER
#define GPX_DEFINE_TAG_HANDLER(Name)
Definition: GPXElementDictionary.h:66
Marble::GeoParser
Definition: GeoParser.h:40
Marble::GeoDataStyle
an addressable style group
Definition: GeoDataStyle.h:55
MarbleDirs.h
Marble::GeoDataLineStyle::setWidth
void setWidth(const float &width)
Set the width of the line.
Definition: GeoDataLineStyle.cpp:76
Marble::GeoDataHotSpot::Fraction
Definition: GeoDataHotSpot.h:30
Marble::Oxygen::brickRed6
QColor const brickRed6
Definition: MarbleColors.h:30
Marble::GeoDataIconStyle::setIconPath
void setIconPath(const QString &filename)
Definition: GeoDataIconStyle.cpp:89
Marble::GeoDataDocument::addStyle
void addStyle(const GeoDataStyle &style)
Add a style to the style storage.
Definition: GeoDataDocument.cpp:110
MarbleGlobal.h
GeoDataStyleMap.h
Marble::GeoDataLabelStyle
specifies how the name of a GeoDataFeature is drawn
Definition: GeoDataLabelStyle.h:36
Marble::GeoDataStyle::setLineStyle
void setLineStyle(const GeoDataLineStyle &style)
set the line style
Definition: GeoDataStyle.cpp:88
GPXgpxTagHandler.h
GeoDataHotSpot.h
Marble::GeoDataLabelStyle::Corner
Definition: GeoDataLabelStyle.h:39
Marble::GeoDataStyleSelector::styleId
QString styleId() const
Return the style id.
Definition: GeoDataStyleSelector.cpp:65
Marble::GeoDataLabelStyle::setAlignment
void setAlignment(GeoDataLabelStyle::Alignment alignment)
Set the alignment of the label.
Definition: GeoDataLabelStyle.cpp:95
Marble::Oxygen::skyBlue6
QColor const skyBlue6
Definition: MarbleColors.h:54
Marble::GeoDataStyle::setLabelStyle
void setLabelStyle(const GeoDataLabelStyle &style)
set the label style
Definition: GeoDataStyle.cpp:93
GPXElementDictionary.h
Marble::gpx::GPXgpxTagHandler
Definition: GPXgpxTagHandler.h:32
Marble::GeoDataIconStyle::setHotSpot
void setHotSpot(const QPointF &hotSpot, GeoDataHotSpot::Units xunits, GeoDataHotSpot::Units yunits)
Definition: GeoDataIconStyle.cpp:111
Marble::geoDataDoc
GeoDataDocument * geoDataDoc(GeoParser &parser)
Definition: GeoDataParser.cpp:105
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal