001: /*
002: * The JTS Topology Suite is a collection of Java classes that
003: * implement the fundamental operations required to validate a given
004: * geo-spatial data set to a known topological specification.
005: *
006: * Copyright (C) 2001 Vivid Solutions
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Lesser General Public
010: * License as published by the Free Software Foundation; either
011: * version 2.1 of the License, or (at your option) any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public
019: * License along with this library; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021: *
022: * For more information, contact:
023: *
024: * Vivid Solutions
025: * Suite #1A
026: * 2328 Government Street
027: * Victoria BC V8T 5G5
028: * Canada
029: *
030: * (250)385-6040
031: * www.vividsolutions.com
032: */
033: package com.vividsolutions.jts.operation.polygonize;
034:
035: import com.vividsolutions.jts.geom.Coordinate;
036: import com.vividsolutions.jts.planargraph.DirectedEdge;
037: import com.vividsolutions.jts.planargraph.Node;
038:
039: /**
040: * A {@link DirectedEdge} of a {@link PolygonizeGraph}, which represents
041: * an edge of a polygon formed by the graph.
042: * May be logically deleted from the graph by setting the <code>marked</code> flag.
043: *
044: * @version 1.7
045: */
046: public class PolygonizeDirectedEdge extends DirectedEdge {
047:
048: private EdgeRing edgeRing = null;
049: private PolygonizeDirectedEdge next = null;
050: private long label = -1;
051:
052: /**
053: * Constructs a directed edge connecting the <code>from</code> node to the
054: * <code>to</code> node.
055: *
056: * @param directionPt
057: * specifies this DirectedEdge's direction (given by an imaginary
058: * line from the <code>from</code> node to <code>directionPt</code>)
059: * @param edgeDirection
060: * whether this DirectedEdge's direction is the same as or
061: * opposite to that of the parent Edge (if any)
062: */
063: public PolygonizeDirectedEdge(Node from, Node to,
064: Coordinate directionPt, boolean edgeDirection) {
065: super (from, to, directionPt, edgeDirection);
066: }
067:
068: /**
069: * Returns the identifier attached to this directed edge.
070: */
071: public long getLabel() {
072: return label;
073: }
074:
075: /**
076: * Attaches an identifier to this directed edge.
077: */
078: public void setLabel(long label) {
079: this .label = label;
080: }
081:
082: /**
083: * Returns the next directed edge in the EdgeRing that this directed edge is a member
084: * of.
085: */
086: public PolygonizeDirectedEdge getNext() {
087: return next;
088: }
089:
090: /**
091: * Sets the next directed edge in the EdgeRing that this directed edge is a member
092: * of.
093: */
094: public void setNext(PolygonizeDirectedEdge next) {
095: this .next = next;
096: }
097:
098: /**
099: * Returns the ring of directed edges that this directed edge is
100: * a member of, or null if the ring has not been set.
101: * @see #setRing(EdgeRing)
102: */
103: public boolean isInRing() {
104: return edgeRing != null;
105: }
106:
107: /**
108: * Sets the ring of directed edges that this directed edge is
109: * a member of.
110: */
111: public void setRing(EdgeRing edgeRing) {
112: this.edgeRing = edgeRing;
113: }
114:
115: }
|