source: subversion/applications/utils/import/srtm2wayinfo/osm-parse.h

Last change on this file was 17101, checked in by herm, 8 years ago

Support different storage systems for ways.

File size: 1.3 KB
Line 
1/* Copyright (c) 2009 Hermann Kraus
2 * This software is available under a "MIT Style" license
3 * (see COPYING).
4 */
5/** \file
6  * Minimalistic OSM parser.
7  * Only handles the attributes required for this project and ignores everything else.
8  */
9#ifndef __OSM_PARSE_H__
10#define __OSM_PARSE_H__
11
12#include <QStringRef>
13#include <QMap>
14#include <QVector>
15#include <QStringList>
16
17#include "osmtypes.h"
18
19class QFile;
20
21/** Parses and stores all (relevant) information contained in an OSM file. */
22class OsmData
23{
24    public:
25        OsmData(OsmWayStorage *ways, OsmNodeStorage *nodes) {
26            wayTags << "highway";
27            this->nodes = nodes;
28            this->ways = ways;
29        }
30        void parse(QString filename);
31        void parse(QFile *file);
32        /** Maps all node IDs for to their node objects. */
33        OsmNodeStorage *nodes;
34        /** List of all way objects. */
35        OsmWayStorage *ways;
36    protected:
37        OsmWay currentWay;
38        QStringList wayTags;
39        void processTag(char *tag);
40        void processParam(char *tag, char *name, char *value);
41        OsmNodeId nodeid, noderef;
42        OsmWayId wayid;
43        float lat, lon;
44        bool keep;
45    /* For debugging / optimization only: */
46    private:
47        int kept, discarded, nodes_referenced, nodes_total;
48};
49#endif
Note: See TracBrowser for help on using the repository browser.