GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 ********************************************************************** 00015 * 00016 * Last port: planargraph/GraphComponent.java rev. 1.7 (JTS-1.7) 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_PLANARGRAPH_GRAPHCOMPONENT_H 00021 #define GEOS_PLANARGRAPH_GRAPHCOMPONENT_H 00022 00023 #include <geos/export.h> 00024 00025 namespace geos { 00026 namespace planargraph { // geos.planargraph 00027 00046 class GEOS_DLL GraphComponent { 00047 00048 protected: 00049 00051 bool isMarkedVar; 00052 00054 bool isVisitedVar; 00055 00056 public: 00057 00058 GraphComponent() 00059 : 00060 isMarkedVar(false), 00061 isVisitedVar(false) 00062 {} 00063 00064 virtual ~GraphComponent() {} 00065 00072 virtual bool isVisited() const { return isVisitedVar; } 00073 00078 virtual void setVisited(bool isVisited) { isVisitedVar=isVisited; } 00079 00088 template <typename T> 00089 static void setVisited(T start, T end, bool visited) { 00090 for(T i=start; i!=end; ++i) { 00091 (*i)->setVisited(visited); 00092 } 00093 } 00094 00103 template <typename T> 00104 static void setVisitedMap(T start, T end, bool visited) { 00105 for(T i=start; i!=end; ++i) { 00106 i->second->setVisited(visited); 00107 } 00108 } 00109 00118 template <typename T> 00119 static void setMarked(T start, T end, bool marked) { 00120 for(T i=start; i!=end; ++i) { 00121 (*i)->setMarked(marked); 00122 } 00123 } 00124 00125 00134 template <typename T> 00135 static void setMarkedMap(T start, T end, bool marked) { 00136 for(T i=start; i!=end; ++i) { 00137 i->second->setMarked(marked); 00138 } 00139 } 00140 00146 virtual bool isMarked() const { return isMarkedVar; } 00147 00152 virtual void setMarked(bool isMarked) { isMarkedVar=isMarked; } 00153 00154 }; 00155 00156 // For backward compatibility 00157 //typedef GraphComponent planarGraphComponent; 00158 00159 } // namespace geos::planargraph 00160 } // namespace geos 00161 00162 #endif // GEOS_PLANARGRAPH_GRAPHCOMPONENT_H