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

- File List

# GraphComponent.h

    00001 /**********************************************************************
    00002  * $Id: GraphComponent.h 2563 2009-06-08 15:43:40Z strk $
    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  * Last port: planargraph/GraphComponent.java rev. 1.7 (JTS-1.7)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
    00022 #define GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
    00023
    00024 #include <geos/export.h>
    00025
    00026 namespace geos {
    00027 namespace planargraph { // geos.planargraph
    00028
    00047 class GEOS_DLL GraphComponent {
    00048
    00049 protected:
    00050
    00052         bool isMarkedVar;
    00053
    00055         bool isVisitedVar;
    00056
    00057 public:
    00058
    00059         GraphComponent()
    00060                 :
    00061                 isMarkedVar(false),
    00062                 isVisitedVar(false)
    00063                 {}
    00064
    00065         virtual ~GraphComponent() {};
    00066
    00073         virtual bool isVisited() const { return isVisitedVar; }
    00074
    00079         virtual void setVisited(bool isVisited) { isVisitedVar=isVisited; }
    00080
    00089         template <typename T>
    00090         static void setVisited(T start, T end, bool visited) {
    00091                 for(T i=start; i!=end; ++i) {
    00092                         (*i)->setVisited(visited);
    00093                 }
    00094         }
    00095
    00104         template <typename T>
    00105         static void setVisitedMap(T start, T end, bool visited) {
    00106                 for(T i=start; i!=end; ++i) {
    00107                         i->second->setVisited(visited);
    00108                 }
    00109         }
    00110
    00119         template <typename T>
    00120         static void setMarked(T start, T end, bool marked) {
    00121                 for(T i=start; i!=end; ++i) {
    00122                         (*i)->setMarked(marked);
    00123                 }
    00124         }
    00125
    00126
    00135         template <typename T>
    00136         static void setMarkedMap(T start, T end, bool marked) {
    00137                 for(T i=start; i!=end; ++i) {
    00138                         i->second->setMarked(marked);
    00139                 }
    00140         }
    00141
    00147         virtual bool isMarked() const { return isMarkedVar; }
    00148
    00153         virtual void setMarked(bool isMarked) { isMarkedVar=isMarked; }
    00154
    00155 };
    00156
    00157 // For backward compatibility
    00158 //typedef GraphComponent planarGraphComponent;
    00159
    00160 } // namespace geos::planargraph
    00161 } // namespace geos
    00162
    00163 #endif // GEOS_PLANARGRAPH_GRAPHCOMPONENT_H
    00164
    00165 /**********************************************************************
    00166  * $Log$
    00167  * Revision 1.1  2006/03/21 21:42:54  strk
    00168  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
    00169  *
    00170  **********************************************************************/
    00171