# GraphComponent.h

    00001 /**********************************************************************
    00002  * $Id: GraphComponent.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00008  * Copyright (C) 2005-2006 Refractions Research Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************/
    00016
    00017 #ifndef GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
    00018 #define GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
    00019
    00020 namespace geos {
    00021 namespace planargraph { // geos.planargraph
    00022
    00043 class GraphComponent {
    00044
    00045 protected:
    00046
    00048         bool isMarkedVar;
    00049
    00051         bool isVisitedVar;
    00052
    00053 public:
    00054
    00055         GraphComponent()
    00056                 :
    00057                 isMarkedVar(false),
    00058                 isVisitedVar(false)
    00059                 {}
    00060
    00061         virtual ~GraphComponent() {};
    00062
    00069         virtual bool isVisited() const { return isVisitedVar; }
    00070
    00075         virtual void setVisited(bool isVisited) { isVisitedVar=isVisited; }
    00076
    00085         template <typename T>
    00086         static void setVisited(T start, T end, bool visited) {
    00087                 for(T i=start; i!=end; ++i) {
    00088                         //i->second->setVisited(visited);
    00089                         (*i)->setVisited(visited);
    00090                 }
    00091         }
    00092
    00101         template <typename T>
    00102         static void setVisitedMap(T start, T end, bool visited) {
    00103                 for(T i=start; i!=end; ++i) {
    00104                         i->second->setVisited(visited);
    00105                 }
    00106         }
    00107
    00113         virtual bool isMarked() const { return isMarkedVar; }
    00114
    00119         virtual void setMarked(bool isMarked) { isMarkedVar=isMarked; }
    00120
    00121 };
    00122
    00123 // For backward compatibility
    00124 //typedef GraphComponent planarGraphComponent;
    00125
    00126 } // namespace geos::planargraph
    00127 } // namespace geos
    00128
    00129 #endif // GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
    00130
    00131 /**********************************************************************
    00132  * $Log$
    00133  * Revision 1.1  2006/03/21 21:42:54  strk
    00134  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
    00135  *
    00136  **********************************************************************/
    00137