• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

BufferSubgraph.h

00001 /**********************************************************************
00002  * $Id: BufferSubgraph.h 2559 2009-06-08 10:07:05Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: operation/buffer/BufferSubgraph.java rev. 1.21 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00021 #define GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <vector>
00026 #include <set>
00027 
00028 #include <geos/operation/buffer/RightmostEdgeFinder.h> // for composition
00029 
00030 // Forward declarations
00031 namespace geos {
00032         namespace geom {
00033                 class Coordinate;
00034                 class Envelope;
00035         }
00036         namespace algorithm {
00037                 class CGAlgorithms;
00038         }
00039         namespace geomgraph {
00040                 class DirectedEdge;
00041                 class Node;
00042         }
00043 }
00044 
00045 namespace geos {
00046 namespace operation { // geos.operation
00047 namespace buffer { // geos.operation.buffer
00048 
00057 class GEOS_DLL BufferSubgraph {
00058 private:
00059         RightmostEdgeFinder finder;
00060 
00061         std::vector<geomgraph::DirectedEdge*> dirEdgeList;
00062 
00063         std::vector<geomgraph::Node*> nodes;
00064 
00065         geom::Coordinate *rightMostCoord;
00066 
00067         geom::Envelope *env;
00068 
00076         void addReachable(geomgraph::Node *startNode);
00077 
00079         //
00083         void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack);
00084 
00085         void clearVisitedEdges();
00086 
00093         // <FIX> MD - use iteration & queue rather than recursion, for speed and robustness
00094         void computeDepths(geomgraph::DirectedEdge *startEdge);
00095 
00096         void computeNodeDepth(geomgraph::Node *n);
00097 
00098         void copySymDepths(geomgraph::DirectedEdge *de);
00099 
00100         bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node *node);
00101 
00102 public:
00103 
00104         friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00105 
00106         BufferSubgraph(); 
00107 
00108         ~BufferSubgraph();
00109 
00110         std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
00111 
00112         std::vector<geomgraph::Node*>* getNodes();
00113 
00117         geom::Coordinate* getRightmostCoordinate();
00118 
00127         void create(geomgraph::Node *node);
00128 
00129         void computeDepth(int outsideDepth);
00130 
00142         void findResultEdges();
00143 
00158         int compareTo(BufferSubgraph *);
00159 
00166         geom::Envelope *getEnvelope();
00167 };
00168 
00169 std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00170 
00171 // INLINES
00172 inline geom::Coordinate*
00173 BufferSubgraph::getRightmostCoordinate() {return rightMostCoord;}
00174 
00175 inline std::vector<geomgraph::Node*>*
00176 BufferSubgraph::getNodes() { return &nodes; }
00177 
00178 inline std::vector<geomgraph::DirectedEdge*>*
00179 BufferSubgraph::getDirectedEdges() {
00180         return &dirEdgeList;
00181 }
00182 
00183 bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second);
00184 
00185 } // namespace geos::operation::buffer
00186 } // namespace geos::operation
00187 } // namespace geos
00188 
00189 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00190 
00191 /**********************************************************************
00192  * $Log$
00193  * Revision 1.3  2006/03/15 11:45:06  strk
00194  * doxygen comments
00195  *
00196  * Revision 1.2  2006/03/14 14:16:52  strk
00197  * operator<< for BufferSubgraph, more debugging calls
00198  *
00199  * Revision 1.1  2006/03/14 00:19:40  strk
00200  * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
00201  *
00202  **********************************************************************/
00203 

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1