Class PolygonizeDirectedEdge

 1  
 2 /*
 3  * Copyright (c) 2016 Vivid Solutions.
 4  *
 5  * All rights reserved. This program and the accompanying materials
 6  * are made available under the terms of the Eclipse Public License 2.0
 7  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
 8  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html
 9  * and the Eclipse Distribution License is available at
10  *
11  * http://www.eclipse.org/org/documents/edl-v10.php.
12  */
13 package org.locationtech.jts.operation.polygonize;
14  
15 import org.locationtech.jts.geom.Coordinate;
16 import org.locationtech.jts.planargraph.DirectedEdge;
17 import org.locationtech.jts.planargraph.Node;
18  
19 /**
20  * A {@link DirectedEdge} of a {@link PolygonizeGraph}, which represents
21  * an edge of a polygon formed by the graph.
22  * May be logically deleted from the graph by setting the <code>marked</code> flag.
23  *
24  * @version 1.7
25  */
26 class PolygonizeDirectedEdge
27     extends DirectedEdge
28 {
29  
30   private EdgeRing edgeRing = null;
31   private PolygonizeDirectedEdge next = null;
32   private long label = -1;
33  
34   /**
35    * Constructs a directed edge connecting the <code>from</code> node to the
36    * <code>to</code> node.
37    *
38    * @param directionPt
39    *                  specifies this DirectedEdge's direction (given by an imaginary
40    *                  line from the <code>from</code> node to <code>directionPt</code>)
41    * @param edgeDirection
42    *                  whether this DirectedEdge's direction is the same as or
43    *                  opposite to that of the parent Edge (if any)
44    */
45   public PolygonizeDirectedEdge(Node from, Node to, Coordinate directionPt,
46       boolean edgeDirection)
47   {
48     super(from, to, directionPt, edgeDirection);
49   }
50  
51   /**
52    * Returns the identifier attached to this directed edge.
53    */
54   public long getLabel() { return label; }
55   /**
56    * Attaches an identifier to this directed edge.
57    */
58   public void setLabel(long label) { this.label = label; }
59   /**
60    * Returns the next directed edge in the EdgeRing that this directed edge is a member
61    * of.
62    */
63   public PolygonizeDirectedEdge getNext()  {    return next;  }
64   /**
65    * Sets the next directed edge in the EdgeRing that this directed edge is a member
66    * of.
67    */
68   public void setNext(PolygonizeDirectedEdge next)  {   this.next = next;  }
69   /**
70    * Returns the ring of directed edges that this directed edge is
71    * a member of, or null if the ring has not been set.
72    * @see #setRing(EdgeRing)
73    */
74   public boolean isInRing() { return edgeRing != null; }
75   /**
76    * Sets the ring of directed edges that this directed edge is
77    * a member of.
78    */
79   public void setRing(EdgeRing edgeRing)
80   {
81       this.edgeRing = edgeRing;
82   }
83   /**
84    * Gets the {@link EdgeRing} this edge is a member of.
85    * 
86    * @return an edge ring
87    */
88   public EdgeRing getRing() 
89   {
90     return this.edgeRing;
91   }
92  
93 }
94