⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oppolygonize.h

📁 一个很好的vc代码
💻 H
📖 第 1 页 / 共 2 页
字号:
	/*	 * \brief	 * Computes the EdgeRings formed by the edges in this graph.	 *	 * @return a list of the EdgeRing found by the	 * 	polygonization process.	 */	vector<polygonizeEdgeRing*>* getEdgeRings();	/*	 * \brief	 * Finds and removes all cut edges from the graph.	 *	 * @return a list of the LineString forming the removed cut edges	 */	vector<const LineString*>* deleteCutEdges();	/*	 * 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	 *	 * @return a List containing the LineStrings that formed dangles	 */	vector<const LineString*>* deleteDangles();private:	static int getDegreeNonDeleted(planarNode *node);	static int getDegree(planarNode *node, long label);	const GeometryFactory *factory;	planarNode* getNode(const 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(vector<PolygonizeDirectedEdge*> *ringEdges);	/*	 * \brief	 * Finds all nodes in a maximal edgering which are self-intersection	 * nodes	 *	 * @param startDE	 * @param label	 * @return the list of intersection nodes found,	 * or <code>null</code> if no intersection nodes were found.	 * Ownership of returned vector goes to caller.	 */	static vector<planarNode*>* findIntersectionNodes(PolygonizeDirectedEdge *startDE, long label);	/*	 * @param dirEdges a List of the DirectedEdges in the graph	 * @return a List of DirectedEdges, one for each edge ring found	 */	static vector<PolygonizeDirectedEdge*>* findLabeledEdgeRings(vector<planarDirectedEdge*> *dirEdges);	static void label(vector<planarDirectedEdge*> *dirEdges, long label);	static void computeNextCWEdges(planarNode *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(planarNode *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	 * @return a List of DirectedEdges that form a ring	 */	static vector<planarDirectedEdge*>* findDirEdgesInRing(PolygonizeDirectedEdge *startDE);	polygonizeEdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);	/* Tese are for memory management */	vector<planarEdge *>newEdges;	vector<planarDirectedEdge *>newDirEdges;	vector<planarNode *>newNodes;	vector<polygonizeEdgeRing *>newEdgeRings;	vector<CoordinateSequence *>newCoords;};/* * Polygonizes a set of Geometrys which contain linework that * represents the edges of a planar graph. * Any dimension of Geometry is handled - the constituent linework is extracted * to form the edges. * The edges must be correctly noded; that is, they must only meet * at their endpoints.  The Polygonizer will still run on incorrectly noded input * but will not form polygons from incorrected noded edges. * <p> * The Polygonizer reports the follow kinds of errors: * <ul> * <li><b>Dangles</b> - edges which have one or both ends which are not incident on another edge endpoint * <li><b>Cut Edges</b> - edges which are connected at both ends but which do not form part of polygon * <li><b>Invalid Ring Lines</b> - edges which form rings which are invalid * (e.g. the component lines contain a self-intersection) * </ul> * */class Polygonizer {private:	/**	* Add every linear element in a geometry into the polygonizer graph.	*/	class LineStringAdder: public GeometryComponentFilter {	public:		Polygonizer *pol;		LineStringAdder(Polygonizer *p);		void filter_rw(Geometry *g);		void filter_ro(const Geometry *g){};	};	// default factory	LineStringAdder *lineStringAdder;	/**	* Add a linestring to the graph of polygon edges.	*	* @param line the {@link LineString} to add	*/	void add(LineString *line);	/**	* Perform the polygonization, if it has not already been carried out.	*/	void polygonize();	void findValidRings(vector<polygonizeEdgeRing*> *edgeRingList, vector<polygonizeEdgeRing*> *validEdgeRingList, vector<LineString*> *invalidRingList);	void findShellsAndHoles(vector<polygonizeEdgeRing*> *edgeRingList);	static void assignHolesToShells(vector<polygonizeEdgeRing*> *holeList,vector<polygonizeEdgeRing*> *shellList);	static void assignHoleToShell(polygonizeEdgeRing *holeER,vector<polygonizeEdgeRing*> *shellList);protected:	PolygonizeGraph *graph;	// initialize with empty collections, in case nothing is computed	vector<const LineString*> *dangles;	vector<const LineString*> *cutEdges;	vector<LineString*> *invalidRingLines;	vector<polygonizeEdgeRing*> *holeList;	vector<polygonizeEdgeRing*> *shellList;	vector<Polygon*> *polyList;public:	/*	 * Create a polygonizer with the same GeometryFactory	 * as the input Geometry	 */	Polygonizer();	~Polygonizer();	/*	 * Add a collection of geometries to be polygonized.	 * May be called multiple times.	 * Any dimension of Geometry may be added;	 * the constituent linework will be extracted and used	 *	 * @param geomList a list of Geometry with linework to be polygonized	 */	void add(vector<Geometry*> *geomList);	/**	 * Add a geometry to the linework to be polygonized.	 * May be called multiple times.	 * Any dimension of Geometry may be added;	 * the constituent linework will be extracted and used	 *	 * @param g a Geometry with linework to be polygonized	 */	void add(Geometry *g);	/**	 * Gets the list of polygons formed by the polygonization.	 * Ownership of vector is transferred to caller, subsequent	 * calls will return NULL.	 * @return a collection of Polygons	 */	vector<Polygon*>* getPolygons();	/**	 * Get the list of dangling lines found during polygonization.	 * @return a collection of the input LineStrings which are dangles	 */	vector<const LineString*>* getDangles();	/**	 * Get the list of cut edges found during polygonization.	 * @return a collection of the input LineStrings which are cut edges	 */	vector<const LineString*>* getCutEdges();	/*	 * Get the list of lines forming invalid rings found during	 * polygonization.	 * Ownership is tranferred to caller, second call will return	 * NULL (unless polygonize is called again).	 * @return a collection of LineStrings which form	 * invalid rings	 */	vector<LineString*>* getInvalidRingLines();// This seems to be needed by    GCC 2.95.4friend class Polygonizer::LineStringAdder;};} // namespace geos#endif/********************************************************************** * $Log: opPolygonize.h,v $ * Revision 1.7.2.1  2005/05/23 17:23:15  strk * Commented out Polygonizer::LineStringAdder friendship * * Revision 1.7  2004/12/14 10:35:44  strk * Comments cleanup. PolygonizeGraph keeps track of generated CoordinateSequence * for delayed destruction. * * Revision 1.6  2004/12/13 13:54:42  strk * Added a not about gcc 2.95.4 required friendship * * Revision 1.5  2004/10/19 19:51:14  strk * Fixed many leaks and bugs in Polygonizer. * Output still bogus. * * Revision 1.4  2004/10/13 10:03:02  strk * Added missing linemerge and polygonize operation. * Bug fixes and leaks removal from the newly added modules and * planargraph (used by them). * Some comments and indentation changes. * * Revision 1.3  2004/07/19 13:19:31  strk * Documentation fixes * * Revision 1.2  2004/07/08 19:34:49  strk * Mirrored JTS interface of CoordinateSequence, factory and * default implementations. * Added DefaultCoordinateSequenceFactory::instance() function. * * Revision 1.1  2004/07/02 13:20:42  strk * Header files moved under geos/ dir. * * Revision 1.1  2004/04/08 04:53:56  ybychkov * "operation/polygonize" ported from JTS 1.4 * * **********************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -