root/MGET/Branches/Jason/Libraries/geos-3.3.2/include/geos/planargraph/DirectedEdgeStar.h @ 891

Revision 891, 4.1 KB (checked in by jjr8, 17 months ago)

* Incremented build number.
* Added Libraries/geos-3.3.2

Line 
1/**********************************************************************
2 * $Id: DirectedEdgeStar.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * Copyright (C) 2005-2006 Refractions Research Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************/
16
17#ifndef GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
18#define GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
19
20#include <geos/export.h>
21
22#include <vector>
23
24#ifdef _MSC_VER
25#pragma warning(push)
26#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
27#endif
28
29// Forward declarations
30namespace geos {
31        namespace geom {
32                class Coordinate;
33        }
34        namespace planargraph {
35                class DirectedEdge;
36                class Edge;
37        }
38}
39
40namespace geos {
41namespace planargraph { // geos.planargraph
42
43/// A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
44class GEOS_DLL DirectedEdgeStar {
45protected:
46
47private:
48        /**
49         * \brief The underlying list of outgoing DirectedEdges
50         */
51        mutable std::vector<DirectedEdge*> outEdges;
52        mutable bool sorted;
53        void sortEdges() const;
54
55public:
56        /**
57         * \brief Constructs a DirectedEdgeStar with no edges.
58         */
59        DirectedEdgeStar(): sorted(false) {}
60
61        virtual ~DirectedEdgeStar() {}
62
63        /**
64         * \brief Adds a new member to this DirectedEdgeStar.
65         */
66        void add(DirectedEdge *de);
67
68        /**
69         * \brief Drops a member of this DirectedEdgeStar.
70         */
71        void remove(DirectedEdge *de);
72
73        /**
74         * \brief Returns an Iterator over the DirectedEdges,
75         * in ascending order by angle with the positive x-axis.
76         */
77        std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
78        /// Returns an iterator to first DirectedEdge
79        std::vector<DirectedEdge*>::iterator begin();
80
81        /// Returns an iterator to one-past last DirectedEdge
82        std::vector<DirectedEdge*>::iterator end();
83
84        /// Returns an const_iterator to first DirectedEdge
85        std::vector<DirectedEdge*>::const_iterator begin() const;
86
87        /// Returns an const_iterator to one-past last DirectedEdge
88        std::vector<DirectedEdge*>::const_iterator end() const;
89
90        /**
91         * \brief Returns the number of edges around the Node associated
92         * with this DirectedEdgeStar.
93         */
94         std::size_t getDegree() const { return outEdges.size(); }
95
96        /**
97         * \brief Returns the coordinate for the node at wich this
98         * star is based
99         */
100        geom::Coordinate& getCoordinate() const;
101
102        /**
103         * \brief Returns the DirectedEdges, in ascending order
104         * by angle with the positive x-axis.
105         */
106        std::vector<DirectedEdge*>& getEdges();
107
108        /**
109         * \brief Returns the zero-based index of the given Edge,
110         * after sorting in ascending order by angle with the
111         * positive x-axis.
112         */
113        int getIndex(const Edge *edge);
114
115        /**
116         * \brief Returns the zero-based index of the given DirectedEdge,
117         * after sorting in ascending order
118         * by angle with the positive x-axis.
119         */ 
120        int getIndex(const DirectedEdge *dirEdge);
121
122        /**
123         * \brief Returns the remainder when i is divided by the number of
124         * edges in this DirectedEdgeStar.
125         */
126        int getIndex(int i) const;
127
128        /**
129         * \brief Returns the DirectedEdge on the left-hand side
130         * of the given DirectedEdge (which must be a member of this
131         * DirectedEdgeStar).
132         */
133        DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
134};
135
136} // namespace geos::planargraph
137} // namespace geos
138
139#ifdef _MSC_VER
140#pragma warning(pop)
141#endif
142
143#endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
144
145/**********************************************************************
146 * $Log$
147 * Revision 1.2  2006/06/12 10:49:43  strk
148 * unsigned int => size_t
149 *
150 * Revision 1.1  2006/03/21 21:42:54  strk
151 * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
152 *
153 **********************************************************************/
154
Note: See TracBrowser for help on using the browser.