GEOS  3.8.0dev
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 
52 
55 
56 public:
57 
59  :
60  isMarkedVar(false),
61  isVisitedVar(false)
62  {}
63 
64  virtual
65  ~GraphComponent() {}
66 
73  virtual bool
74  isVisited() const
75  {
76  return isVisitedVar;
77  }
78 
83  virtual void
84  setVisited(bool p_isVisited)
85  {
86  isVisitedVar = p_isVisited;
87  }
88 
97  template <typename T>
98  static void
99  setVisited(T start, T end, bool visited)
100  {
101  for(T i = start; i != end; ++i) {
102  (*i)->setVisited(visited);
103  }
104  }
105 
114  template <typename T>
115  static void
116  setVisitedMap(T start, T end, bool visited)
117  {
118  for(T i = start; i != end; ++i) {
119  i->second->setVisited(visited);
120  }
121  }
122 
131  template <typename T>
132  static void
133  setMarked(T start, T end, bool marked)
134  {
135  for(T i = start; i != end; ++i) {
136  (*i)->setMarked(marked);
137  }
138  }
139 
140 
149  template <typename T>
150  static void
151  setMarkedMap(T start, T end, bool marked)
152  {
153  for(T i = start; i != end; ++i) {
154  i->second->setMarked(marked);
155  }
156  }
157 
163  virtual bool
164  isMarked() const
165  {
166  return isMarkedVar;
167  }
168 
173  virtual void
174  setMarked(bool p_isMarked)
175  {
176  isMarkedVar = p_isMarked;
177  }
178 
179 };
180 
181 // For backward compatibility
182 //typedef GraphComponent planarGraphComponent;
183 
184 } // namespace geos::planargraph
185 } // namespace geos
186 
187 #endif // GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
virtual void setVisited(bool p_isVisited)
Sets the visited flag for this component.
Definition: planargraph/GraphComponent.h:84
virtual void setMarked(bool p_isMarked)
Sets the marked flag for this component.
Definition: planargraph/GraphComponent.h:174
virtual bool isVisited() const
Tests if a component has been visited during the course of a graph algorithm.
Definition: planargraph/GraphComponent.h:74
bool isMarkedVar
Variable holding ''marked'' status.
Definition: planargraph/GraphComponent.h:51
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:116
virtual bool isMarked() const
Tests if a component has been marked at some point during the processing involving this graph...
Definition: planargraph/GraphComponent.h:164
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:133
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:99
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
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:151
The base class for all graph component classes.
Definition: planargraph/GraphComponent.h:46
bool isVisitedVar
Variable holding ''visited'' status.
Definition: planargraph/GraphComponent.h:54