Use geomgraph::Label by value (less extra-heap), cleanups and port sync.
[geos.git] / include / geos / geomgraph / GraphComponent.h
blob54014dbd088d5eb3a09473674d45e2f864b1095f
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.refractions.net
6 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
15 **********************************************************************
17 * Last port: geomgraph/GraphComponent.java r428 (JTS-1.12+)
19 **********************************************************************/
22 #ifndef GEOS_GEOMGRAPH_GRAPHCOMPONENT_H
23 #define GEOS_GEOMGRAPH_GRAPHCOMPONENT_H
25 #include <geos/export.h>
26 #include <geos/inline.h>
28 #include <geos/geomgraph/Label.h>
30 // Forward declarations
31 namespace geos {
32 namespace geom {
33 class IntersectionMatrix;
37 namespace geos {
38 namespace geomgraph { // geos.geomgraph
41 /** \brief
42 * A GraphComponent is the parent class for the objects'
43 * that form a graph.
45 * Each GraphComponent can carry a Label.
47 class GEOS_DLL GraphComponent {
48 public:
49 GraphComponent();
52 * GraphComponent copies the given Label.
54 GraphComponent(const Label& newLabel);
55 virtual ~GraphComponent();
57 Label& getLabel() { return label; }
58 const Label& getLabel() const { return label; }
59 void setLabel(const Label& newLabel) { label = newLabel; }
61 virtual void setInResult(bool isInResult) { isInResultVar=isInResult; }
62 virtual bool isInResult() const { return isInResultVar; }
63 virtual void setCovered(bool isCovered);
64 virtual bool isCovered() const { return isCoveredVar; }
65 virtual bool isCoveredSet() const { return isCoveredSetVar; }
66 virtual bool isVisited() const { return isVisitedVar; }
67 virtual void setVisited(bool isVisited) { isVisitedVar = isVisited; }
68 virtual bool isIsolated() const=0;
69 virtual void updateIM(geom::IntersectionMatrix& im);
70 protected:
71 Label label;
72 virtual void computeIM(geom::IntersectionMatrix& im)=0;
73 private:
74 bool isInResultVar;
75 bool isCoveredVar;
76 bool isCoveredSetVar;
77 bool isVisitedVar;
80 } // namespace geos.geomgraph
81 } // namespace geos
83 #endif // ifndef GEOS_GEOMGRAPH_GRAPHCOMPONENT_H