📄 geomgraph.h
字号:
protected: Coordinate coord; EdgeEndStar* edges; virtual void computeIM(IntersectionMatrix *im) {};private: vector<double>zvals; double ztot;};class NodeFactory {public: virtual Node* createNode(Coordinate coord);};class EdgeIntersection {public: Coordinate coord; int segmentIndex; double dist; EdgeIntersection(const Coordinate& newCoord, int newSegmentIndex, double newDist); virtual ~EdgeIntersection(); int compare(int newSegmentIndex, double newDist); bool isEndPoint(int maxSegmentIndex); string print(); int compareTo(void* obj);};class EdgeIntersectionList{public: vector<EdgeIntersection*> *list; Edge *edge; EdgeIntersectionList(Edge *edge); ~EdgeIntersectionList(); EdgeIntersection* add(const Coordinate& coord, int segmentIndex, double dist); vector<EdgeIntersection*>::iterator iterator(); bool isEmpty(); bool findInsertionPoint(int segmentIndex,double dist,vector<EdgeIntersection*>::iterator *insertIt); bool isIntersection(const Coordinate& pt); void addEndpoints(); void addSplitEdges(vector<Edge*> *edgeList); Edge *createSplitEdge(EdgeIntersection *ei0, EdgeIntersection *ei1); string print();};class EdgeList {public: EdgeList(); virtual ~EdgeList(); void add(Edge *e); void addAll(vector<Edge*> *edgeColl); vector<Edge*>* getEdges(); Edge* findEqualEdge(Edge* e); Edge* get(int i); int findEdgeIndex(Edge *e); string print();private: vector<Edge*> *edges; /** * An index of the edges, for fast lookup. * * a Quadtree is used, because this index needs to be dynamic * (e.g. allow insertions after queries). * An alternative would be to use an ordered set based on the values * of the edge coordinates * */ SpatialIndex* index;};struct CoordLT { bool operator()(Coordinate s1, Coordinate s2) const { return s1.compareTo(s2)<0; }};class NodeMap{public: map<Coordinate,Node*,CoordLT>* nodeMap; NodeFactory *nodeFact; // newNodeFact will be deleted by ~NodeMap NodeMap(NodeFactory *newNodeFact); virtual ~NodeMap(); Node* addNode(const Coordinate& coord); Node* addNode(Node *n); void add(EdgeEnd *e); Node *find(const Coordinate& coord) const; map<Coordinate,Node*,CoordLT>::iterator iterator() const; //Collection values(); //Doesn't work yet. Use iterator. //vector instead of Collection vector<Node*>* getBoundaryNodes(int geomIndex) const; //returns new obj string print() const;};class EdgeRing;class DirectedEdge: public EdgeEnd{public: static int depthFactor(int currLocation, int nextLocation); DirectedEdge(); virtual ~DirectedEdge(); DirectedEdge(Edge *newEdge, bool newIsForward); Edge* getEdge(); void setInResult(bool newIsInResult); bool isInResult(); bool isVisited(); void setVisited(bool newIsVisited); void setEdgeRing(EdgeRing *newEdgeRing); EdgeRing* getEdgeRing(); void setMinEdgeRing(EdgeRing *newMinEdgeRing); EdgeRing* getMinEdgeRing(); int getDepth(int position); void setDepth(int position, int newDepth); int getDepthDelta(); void setVisitedEdge(bool newIsVisited); DirectedEdge* getSym(); bool isForward(); void setSym(DirectedEdge *de); DirectedEdge* getNext(); void setNext(DirectedEdge *newNext); DirectedEdge* getNextMin(); void setNextMin(DirectedEdge *newNextMin); bool isLineEdge(); bool isInteriorAreaEdge(); void setEdgeDepths(int position, int newDepth); void OLDsetEdgeDepths(int position, int newDepth); string print(); string printEdge();protected: bool isForwardVar;private: bool isInResultVar; bool isVisitedVar; DirectedEdge *sym; // the symmetric edge DirectedEdge *next; // the next edge in the edge ring for the polygon containing this edge DirectedEdge *nextMin; // the next edge in the MinimalEdgeRing that contains this edge EdgeRing *edgeRing; // the EdgeRing that this edge is part of EdgeRing *minEdgeRing; // the MinimalEdgeRing that this edge is part of /** * The depth of each side (position) of this edge. * The 0 element of the array is never used. */ int depth[3]; void computeDirectedLabel();};class EdgeRing{public: EdgeRing(DirectedEdge *newStart, const GeometryFactory *newGeometryFactory, CGAlgorithms *newCga); virtual ~EdgeRing(); bool isIsolated(); bool isHole(); const Coordinate& getCoordinate(int i); LinearRing* getLinearRing(); Label* getLabel(); bool isShell(); EdgeRing *getShell(); void setShell(EdgeRing *newShell); void addHole(EdgeRing *edgeRing); Polygon* toPolygon(const GeometryFactory* geometryFactory); void computeRing(); virtual DirectedEdge* getNext(DirectedEdge *de)=0; virtual void setEdgeRing(DirectedEdge *de, EdgeRing *er)=0; vector<DirectedEdge*>* getEdges(); int getMaxNodeDegree(); void setInResult(); bool containsPoint(Coordinate& p);protected: DirectedEdge *startDe; // the directed edge which starts the list of edges for this EdgeRing const GeometryFactory *geometryFactory; CGAlgorithms *cga; void computePoints(DirectedEdge *newStart); void mergeLabel(Label *deLabel); void mergeLabel(Label *deLabel, int geomIndex); void addPoints(Edge *edge, bool isForward, bool isFirstEdge); vector<EdgeRing*>* holes; // a list of EdgeRings which are holes in this EdgeRingprivate: int maxNodeDegree; vector<DirectedEdge*>* edges; // the DirectedEdges making up this EdgeRing CoordinateSequence* pts; Label* label; // label stores the locations of each geometry on the face surrounded by this ring LinearRing *ring; // the ring created for this EdgeRing bool isHoleVar; EdgeRing *shell; // if non-null, the ring is a hole and this EdgeRing is its containing shell void computeMaxNodeDegree();};class PlanarGraph {public: static CGAlgorithms *cga;// static LineIntersector *li; static void linkResultDirectedEdges(vector<Node*>* allNodes); // throw(TopologyException *); // nodeFact will be deleted by ~NodeMap PlanarGraph(NodeFactory *nodeFact); PlanarGraph(); virtual ~PlanarGraph(); virtual vector<Edge*>::iterator getEdgeIterator(); virtual vector<EdgeEnd*>* getEdgeEnds(); virtual bool isBoundaryNode(int geomIndex,Coordinate& coord); virtual void add(EdgeEnd *e); virtual map<Coordinate,Node*,CoordLT>::iterator getNodeIterator(); virtual vector<Node*>* getNodes(); virtual Node* addNode(Node *node); virtual Node* addNode(const Coordinate& coord); virtual Node* find(Coordinate& coord); virtual void addEdges(vector<Edge*>* edgesToAdd); virtual void linkResultDirectedEdges(); virtual void linkAllDirectedEdges(); virtual EdgeEnd* findEdgeEnd(Edge *e); virtual Edge* findEdge(const Coordinate& p0,const Coordinate& p1); virtual Edge* findEdgeInSameDirection(const Coordinate& p0,const Coordinate& p1); virtual string printEdges(); virtual NodeMap* getNodeMap(); //Not used //string debugPrint(); //string debugPrintln();protected: vector<Edge*> *edges; NodeMap *nodes; vector<EdgeEnd*> *edgeEndList; virtual void insertEdge(Edge *e);private: bool matchInSameDirection(const Coordinate& p0, const Coordinate& p1, const Coordinate& ep0, const Coordinate& ep1);};struct LineStringLT { bool operator()(const LineString *ls1, const LineString *ls2) const { return ls1->compareTo(ls2)<0; }};class GeometryGraph: public PlanarGraph {public: static bool isInBoundary(int boundaryCount); static int determineBoundary(int boundaryCount); GeometryGraph(); virtual ~GeometryGraph(); GeometryGraph(int newArgIndex, const Geometry *newParentGeom); const Geometry* getGeometry(); vector<Node*>* getBoundaryNodes(); CoordinateSequence* getBoundaryPoints(); Edge* findEdge(const LineString *line); void computeSplitEdges(vector<Edge*> *edgelist); void addEdge(Edge *e); void addPoint(Coordinate& pt); SegmentIntersector* computeSelfNodes(LineIntersector *li, bool computeRingSelfNodes); SegmentIntersector* computeEdgeIntersections(GeometryGraph *g, LineIntersector *li,bool includeProper); vector<Edge*> *getEdges(); bool hasTooFewPoints(); const Coordinate& getInvalidPoint(); private: const Geometry *parentGeom; /* * The lineEdgeMap is a map of the linestring components of the * parentGeometry to the edges which are derived from them. * This is used to efficiently perform findEdge queries */ map<const LineString*,Edge*,LineStringLT>* lineEdgeMap; /* * If this flag is true, the Boundary Determination Rule will * used when deciding whether nodes are in the boundary or not */ bool useBoundaryDeterminationRule; /* * the index of this geometry as an argument to a spatial function * (used for labelling) */ int argIndex; vector<Node*>* boundaryNodes; bool hasTooFewPointsVar; Coordinate invalidPoint; EdgeSetIntersector* createEdgeSetIntersector(); void add(const Geometry *g); // throw(UnsupportedOperationException *); void addCollection(const GeometryCollection *gc); void addPoint(const Point *p); void addPolygonRing(const LinearRing *lr,int cwLeft,int cwRight); void addPolygon(const Polygon *p); void addLineString(const LineString *line); void insertPoint(int argIndex, const Coordinate& coord,int onLocation); void insertBoundaryPoint(int argIndex, const Coordinate& coord); void addSelfIntersectionNodes(int argIndex); void addSelfIntersectionNode(int argIndex,Coordinate& coord,int loc);};class SegmentString;class NodingValidator;/* * Validates that a collection of SegmentStrings is correctly noded. * Throws an appropriate exception if an noding error is found. * * @version 1.4 */class EdgeNodingValidator {private: static vector<SegmentString*>* toSegmentStrings(vector<Edge*> *edges); NodingValidator *nv;public: EdgeNodingValidator(vector<Edge*> *edges); virtual ~EdgeNodingValidator(); void checkValid();};//Operatorsbool operator==(Edge a,Edge b);} // namespace geos#endif // ifndef GEOS_GEOMGRAPH_H/********************************************************************** * $Log: geomgraph.h,v $ * Revision 1.7.2.1 2005/06/26 09:40:19 strk * Backport of OverlayOp performance improvements * * Revision 1.7 2004/11/20 15:46:45 strk * Added composing Z management functions and elements for class Node * * Revision 1.6 2004/11/17 08:13:16 strk * Indentation changes. * Some Z_COMPUTATION activated by default. * * Revision 1.5 2004/10/21 22:29:54 strk * Indentation changes and some more COMPUTE_Z rules * * Revision 1.4 2004/07/19 13:19:31 strk * Documentation fixes * * Revision 1.3 2004/07/13 08:33:52 strk * Added missing virtual destructor to virtual classes. * Fixed implicit unsigned int -> int casts * * 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.6 2004/06/30 20:59:12 strk * Removed GeoemtryFactory copy from geometry constructors. * Enforced const-correctness on GeometryFactory arguments. * * Revision 1.5 2004/05/26 09:50:05 strk * Added comments about OverlayNodeFactory() ownership in NodeMap and PlanarGraph constuctors * * Revision 1.4 2004/05/03 10:43:42 strk * Exception specification considered harmful - left as comment. * * Revision 1.3 2004/04/10 08:40:01 ybychkov * "operation/buffer" upgraded to JTS 1.4 * * Revision 1.2 2004/04/04 06:29:11 ybychkov * "planargraph" and "geom/utill" upgraded to JTS 1.4 * * Revision 1.1 2004/03/19 09:48:45 ybychkov * "geomgraph" and "geomgraph/indexl" upgraded to JTS 1.4 * * Revision 1.27 2003/11/12 18:02:56 strk * Added throw specification. Fixed leaks on exceptions. * * Revision 1.26 2003/11/12 15:43:38 strk * Added some more throw specifications * * Revision 1.25 2003/11/07 01:23:42 pramsey * Add standard CVS headers licence notices and copyrights to all cpp and h * files. * * Revision 1.24 2003/11/06 18:45:05 strk * Added throw specification for DirectEdgeStar::linkResultDirectedEdges() * **********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -