source: subversion/applications/lib/libosm/Way.h @ 34963

Last change on this file since 34963 was 11684, checked in by nienhueser, 11 years ago

Less inline definitions. Start to document things (doxygen style)

File size: 2.0 KB
Line 
1#ifndef WAY_H
2#define WAY_H
3
4/*
5 Copyright (C) 2006 Nick Whitelegg, Hogweed Software, nick@hogweed.org
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
20
21 */
22
23#include "Node.h"
24#include "Object.h"
25
26#include <vector>
27
28namespace OSM
29{
30
31/**
32 * A way is an ordered list of nodes
33 */
34class Way: public Object
35{
36public:
37        /**
38         * Constructor Creates a new Way (ordered list of nodes)
39         * @param id The unique id to assign. Default is 0
40         */
41        Way(int id = 0);
42
43        /**
44         * Add another node to this way
45         * @param id The ID of the node to add
46         */
47        void addNode(int id);
48
49        /**
50         * Add a node to the way at the specified position if possible
51         * @param index Place to insert the node at
52         * @param n
53         * @return
54         */
55        bool addNodeAt(unsigned int index, int n);
56
57        /**
58         * Remove a node from this way
59         * @param id The ID of the node to remove
60         * @return The position of the node in the way
61         */
62        int removeNode(int id);
63
64        /**
65         * Accessor for the node at the given  index
66         * @param index
67         * @return
68         */
69        int getNode(unsigned int index) const;
70
71        /**
72         * Returns the number of nodes
73         * @return The number of nodes this way consists of
74         */
75        int nNodes() const;
76
77        /**
78         * Write an xml representation of this way and its elements
79         * to the given stream
80         * @param strm
81         */
82        void toXML(std::ostream &strm);
83
84private:
85        /** Keeps node ids this way contains */
86        std::vector<int> nodes;
87};
88
89}
90
91#endif
Note: See TracBrowser for help on using the repository browser.