This file is indexed.

/usr/include/geos/operation/polygonize/PolygonizeGraph.h is in libgeos-dev 3.2.2-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/**********************************************************************
 * $Id: PolygonizeGraph.h 2730 2009-11-19 20:29:01Z strk $
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.refractions.net
 *
 * Copyright (C) 2006 Refractions Research Inc.
 * Copyright (C) 2001-2002 Vivid Solutions Inc.
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Public Licence as published
 * by the Free Software Foundation. 
 * See the COPYING file for more information.
 *
 **********************************************************************
 *
 * Last port: operation/polygonize/PolygonizeGraph.java rev. 1.6 (JTS-1.10)
 *
 **********************************************************************/


#ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
#define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H

#include <geos/export.h>

#include <geos/planargraph/PlanarGraph.h> // for inheritance

#include <vector>

// Forward declarations
namespace geos {
	namespace geom { 
		class LineString;
		class GeometryFactory;
		class Coordinate;
		class CoordinateSequence;
	}
	namespace planargraph { 
		class Node;
		class Edge;
		class DirectedEdge;
	}
	namespace operation { 
		namespace polygonize {
			class EdgeRing;
			class PolygonizeDirectedEdge;
		}
	}
}

namespace geos {
namespace operation { // geos::operation
namespace polygonize { // geos::operation::polygonize


/** \brief
 * Represents a planar graph of edges that can be used to compute a
 * polygonization, and implements the algorithms to compute the
 * EdgeRings formed by the graph.
 * 
 * The marked flag on DirectedEdge is used to indicate that a directed edge
 * has be logically deleted from the graph.
 *
 */
class GEOS_DLL PolygonizeGraph: public planargraph::PlanarGraph {

public:

	/**
	 * \brief
	 * Deletes all edges at a node
	 */
	static void deleteAllEdges(planargraph::Node *node);

	/**
	 * \brief
	 * Create a new polygonization graph.
	 */
	PolygonizeGraph(const geom::GeometryFactory *newFactory);

	/**
	 * \brief
	 * Destroy a polygonization graph.
	 */
	~PolygonizeGraph();

	/**
	 * \brief
	 * Add a LineString forming an edge of the polygon graph.
	 * @param line the line to add
	 */
	void addEdge(const geom::LineString *line);

	/**
	 * \brief
	 * Computes the EdgeRings formed by the edges in this graph.
	 *
	 * @param edgeRingList : the EdgeRing found by the
	 * 	polygonization process will be pushed here.
	 *
	 */
	void getEdgeRings(std::vector<EdgeRing*>& edgeRingList);

	/**
	 * \brief
	 * Finds and removes all cut edges from the graph.
	 *
	 * @param cutLines : the list of the LineString forming the removed
	 *                   cut edges will be pushed here.
	 *
	 * TODO: document ownership of the returned LineStrings
	 */
	void deleteCutEdges(std::vector<const geom::LineString*> &cutLines);

	/** \brief
	 * Marks all edges from the graph which are "dangles".
	 *
	 * Dangles are which are incident on a node with degree 1.
	 * This process is recursive, since removing a dangling edge
	 * may result in another edge becoming a dangle.
	 * In order to handle large recursion depths efficiently,
	 * an explicit recursion stack is used
	 *
	 * @param dangleLines : the LineStrings that formed dangles will
	 *                      be push_back'ed here
	 */
	void deleteDangles(std::vector<const geom::LineString*> &dangleLines);

private:

	static int getDegreeNonDeleted(planargraph::Node *node);

	static int getDegree(planargraph::Node *node, long label);

	const geom::GeometryFactory *factory;

	planargraph::Node* getNode(const geom::Coordinate& pt);

	void computeNextCWEdges();

	/**
	 * \brief
	 * Convert the maximal edge rings found by the initial graph traversal
	 * into the minimal edge rings required by JTS polygon topology rules.
	 *
	 * @param ringEdges
	 * 	the list of start edges for the edgeRings to convert.
	 *
	 */
	void convertMaximalToMinimalEdgeRings(
			std::vector<PolygonizeDirectedEdge*> &ringEdges);

	/**
	 * \brief
	 * Finds all nodes in a maximal edgering
	 * which are self-intersection nodes
	 *
	 * @param startDE
	 * @param label
	 * @param intNodes : intersection nodes found will be pushed here
	 *                   the vector won't be cleared before pushing.
	 */
	static void findIntersectionNodes( PolygonizeDirectedEdge *startDE,
			long label, std::vector<planargraph::Node*>& intNodes
);

	/**
	 * Finds and labels all edgerings in the graph.
	 *
	 * The edge rings are labelling with unique integers.
	 * The labelling allows detecting cut edges.
	 *
	 * @param dirEdgesIn  a list of the DirectedEdges in the graph
	 * @param dirEdgesOut each ring found will be pushed here
	 */
	static void findLabeledEdgeRings(
			std::vector<planargraph::DirectedEdge*> &dirEdgesIn,
			std::vector<PolygonizeDirectedEdge*> &dirEdgesOut);

	static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);

	static void computeNextCWEdges(planargraph::Node *node);

	/**
	 * \brief
	 * Computes the next edge pointers going CCW around the given node,
	 * for the given edgering label.
	 * This algorithm has the effect of converting maximal edgerings
	 * into minimal edgerings
	 */
	static void computeNextCCWEdges(planargraph::Node *node, long label);

	/**
	 * \brief
	 * Traverse a ring of DirectedEdges, accumulating them into a list.
	 * This assumes that all dangling directed edges have been removed
	 * from the graph, so that there is always a next dirEdge.
	 *
	 * @param startDE the DirectedEdge to start traversing at
	 * @param edgesInRing : the DirectedEdges that form a ring will
	 *                      be pushed here.
	 */
	static void findDirEdgesInRing(PolygonizeDirectedEdge *startDE,
		std::vector<planargraph::DirectedEdge*>& edgesInRing);

	EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);

	/* Tese are for memory management */
	std::vector<planargraph::Edge *> newEdges;
	std::vector<planargraph::DirectedEdge *> newDirEdges;
	std::vector<planargraph::Node *> newNodes;
	std::vector<EdgeRing *> newEdgeRings;
	std::vector<geom::CoordinateSequence *> newCoords;
};

} // namespace geos::operation::polygonize
} // namespace geos::operation
} // namespace geos

#endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H

/**********************************************************************
 * $Log$
 * Revision 1.1  2006/03/22 11:19:06  strk
 * opPolygonize.h headers split.
 *
 **********************************************************************/