GEOS: GraphComponent.h Source File

GEOS 3.5.0

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

- File List

planargraph/GraphComponent.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: planargraph/GraphComponent.java rev. 1.7 (JTS-1.7)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
21 #define GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
22
23 #include <geos/export.h>
24
25 namespace geos {
26 namespace planargraph { // geos.planargraph
27
46 class GEOS_DLL GraphComponent {
47
48 protected:
49
51 bool isMarkedVar;
52
54 bool isVisitedVar;
55
56 public:
57
58 GraphComponent()
59 :
60 isMarkedVar(false),
61 isVisitedVar(false)
62 {}
63
64 virtual ~GraphComponent() {}
65
72 virtual bool isVisited() const { return isVisitedVar; }
73
78 virtual void setVisited(bool isVisited) { isVisitedVar=isVisited; }
79
88 template <typename T>
89 static void setVisited(T start, T end, bool visited) {
90 for(T i=start; i!=end; ++i) {
91 (*i)->setVisited(visited);
92 }
93 }
94
103 template <typename T>
104 static void setVisitedMap(T start, T end, bool visited) {
105 for(T i=start; i!=end; ++i) {
106 i->second->setVisited(visited);
107 }
108 }
109
118 template <typename T>
119 static void setMarked(T start, T end, bool marked) {
120 for(T i=start; i!=end; ++i) {
121 (*i)->setMarked(marked);
122 }
123 }
124
125
134 template <typename T>
135 static void setMarkedMap(T start, T end, bool marked) {
136 for(T i=start; i!=end; ++i) {
137 i->second->setMarked(marked);
138 }
139 }
140
146 virtual bool isMarked() const { return isMarkedVar; }
147
152 virtual void setMarked(bool isMarked) { isMarkedVar=isMarked; }
153
154 };
155
156 // For backward compatibility
157 //typedef GraphComponent planarGraphComponent;
158
159 } // namespace geos::planargraph
160 } // namespace geos
161
162 #endif // GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
geos::planargraph::GraphComponent::isVisited
virtual bool isVisited() const
Tests if a component has been visited during the course of a graph algorithm.
Definition: planargraph/GraphComponent.h:72
geos::planargraph::GraphComponent::isMarkedVar
bool isMarkedVar
Variable holding &#39;&#39;marked&#39;&#39; status.
Definition: planargraph/GraphComponent.h:51
geos::planargraph::GraphComponent::setVisitedMap
static void setVisitedMap(T start, T end, bool visited)
Sets the Visited state for the values of each map container element, from start to end iterator...
Definition: planargraph/GraphComponent.h:104
geos::planargraph::GraphComponent::isMarked
virtual bool isMarked() const
Tests if a component has been marked at some point during the processing involving this graph...
Definition: planargraph/GraphComponent.h:146
geos::planargraph::GraphComponent::setVisited
virtual void setVisited(bool isVisited)
Sets the visited flag for this component.
Definition: planargraph/GraphComponent.h:78
geos::planargraph::GraphComponent::setMarked
virtual void setMarked(bool isMarked)
Sets the marked flag for this component.
Definition: planargraph/GraphComponent.h:152
geos::planargraph::GraphComponent::setMarked
static void setMarked(T start, T end, bool marked)
Sets the Marked state for the elements of a container, from start to end iterator.
Definition: planargraph/GraphComponent.h:119
geos::planargraph::GraphComponent::setVisited
static void setVisited(T start, T end, bool visited)
Sets the Visited state for the elements of a container, from start to end iterator.
Definition: planargraph/GraphComponent.h:89
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::planargraph::GraphComponent::setMarkedMap
static void setMarkedMap(T start, T end, bool marked)
Sets the Marked state for the values of each map container element, from start to end iterator...
Definition: planargraph/GraphComponent.h:135
geos::planargraph::GraphComponent
The base class for all graph component classes.
Definition: planargraph/GraphComponent.h:46
geos::planargraph::GraphComponent::isVisitedVar
bool isVisitedVar
Variable holding &#39;&#39;visited&#39;&#39; status.
Definition: planargraph/GraphComponent.h:54