OpenCPN Partial API docs
Loading...
Searching...
No Matches
kml.h
1/******************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Read and write KML Format
5 *(http://en.wikipedia.org/wiki/Keyhole_Markup_Language) Author: Jesper
6 *Weissglas
7 *
8 ***************************************************************************
9 * Copyright (C) 2012 by David S. Register *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25 ***************************************************************************
26 *
27 *
28 */
29
30#ifndef KML_H
31#define KML_H
32
33#include "tinyxml.h"
34
35#define KML_INSERT_EXTRADATA true // For QtVlm Routing.
36
37enum KmlPastebufferType {
38 KML_PASTE_WAYPOINT,
39 KML_PASTE_ROUTE,
40 KML_PASTE_TRACK,
41 KML_PASTE_ROUTE_TRACK,
42 KML_PASTE_INVALID,
43 KML_COPY_STANDARD,
44 KML_COPY_EXTRADATA
45};
46
47class dPoint {
48public:
49 double x, y, z;
50};
51
52typedef std::vector<dPoint> dPointList;
53
54class Kml {
55public:
56 Kml();
57 ~Kml();
58 KmlPastebufferType ParsePasteBuffer();
59 Route* GetParsedRoute() { return parsedRoute; }
60 Track* GetParsedTrack() { return parsedTrack; }
61 RoutePoint* GetParsedRoutePoint() { return parsedRoutePoint; }
62
63 static wxString MakeKmlFromRoute(Route* route, bool insertSeqNames = false);
64 static wxString MakeKmlFromTrack(Track* track);
65 static wxString MakeKmlFromWaypoint(RoutePoint* routepoint);
66 static void CopyWaypointToClipboard(RoutePoint* routepoint);
67 static void CopyRouteToClipboard(Route* route);
68 static void CopyTrackToClipboard(Track* route);
69
70private:
71 KmlPastebufferType ParseOnePlacemarkPoint(TiXmlNode* node, wxString& name);
72 KmlPastebufferType ParseTrack(TiXmlNode* node, wxString& name);
73 int ParseCoordinates(TiXmlNode* node, dPointList& points);
74 static TiXmlElement* StandardHead(TiXmlDocument& xmlDoc, wxString name);
75 static std::string PointPlacemark(TiXmlElement* document,
76 RoutePoint* routepoint);
77
78 wxString kmlText;
79 RoutePoint* parsedRoutePoint;
80 Route* parsedRoute;
81 Track* parsedTrack;
82 static bool insertQtVlmExtendedData;
83 static int seqCounter;
84};
85
86//---------------------------------------------------------------------------
87
88class KmlFormatDialog : public wxDialog {
89private:
90 std::vector<wxRadioButton*> choices;
91
92public:
93 KmlFormatDialog(wxWindow* parent);
94 int GetSelectedFormat();
95};
96
97#endif
Definition: kml.h:54
Definition: route.h:70
Definition: track.h:79
Definition: kml.h:47