GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

planargraph/GraphComponent.h
1 /**********************************************************************
2 * $Id: GraphComponent.h 2563 2009-06-08 15:43:40Z strk $
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 * Last port: planargraph/GraphComponent.java rev. 1.7 (JTS-1.7)
18 *
19 **********************************************************************/
20
21 #ifndef GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
22 #define GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
23
24 #include <geos/export.h>
25
26 namespace geos {
27 namespace planargraph { // geos.planargraph
28
47 class GEOS_DLL GraphComponent {
48
49 protected:
50
52 bool isMarkedVar;
53
55 bool isVisitedVar;
56
57 public:
58
59 GraphComponent()
60 :
61 isMarkedVar(false),
62 isVisitedVar(false)
63 {}
64
65 virtual ~GraphComponent() {};
66
73 virtual bool isVisited() const { return isVisitedVar; }
74
79 virtual void setVisited(bool isVisited) { isVisitedVar=isVisited; }
80
89 template <typename T>
90 static void setVisited(T start, T end, bool visited) {
91 for(T i=start; i!=end; ++i) {
92 (*i)->setVisited(visited);
93 }
94 }
95
104 template <typename T>
105 static void setVisitedMap(T start, T end, bool visited) {
106 for(T i=start; i!=end; ++i) {
107 i->second->setVisited(visited);
108 }
109 }
110
119 template <typename T>
120 static void setMarked(T start, T end, bool marked) {
121 for(T i=start; i!=end; ++i) {
122 (*i)->setMarked(marked);
123 }
124 }
125
126
135 template <typename T>
136 static void setMarkedMap(T start, T end, bool marked) {
137 for(T i=start; i!=end; ++i) {
138 i->second->setMarked(marked);
139 }
140 }
141
147 virtual bool isMarked() const { return isMarkedVar; }
148
153 virtual void setMarked(bool isMarked) { isMarkedVar=isMarked; }
154
155 };
156
157 // For backward compatibility
158 //typedef GraphComponent planarGraphComponent;
159
160 } // namespace geos::planargraph
161 } // namespace geos
162
163 #endif // GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
164
165 /**********************************************************************
166 * $Log$
167 * Revision 1.1 2006/03/21 21:42:54 strk
168 * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
169 *
170 **********************************************************************/
171