1 /*
2  * Copyright (c) 2019 Martin Davis.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
7  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html
8  * and the Eclipse Distribution License is available at
9  *
10  * http://www.eclipse.org/org/documents/edl-v10.php.
11  */
12 package org.locationtech.jts.operation.overlayng;
13 
14 import org.locationtech.jts.geom.Dimension;
15 
16 /**
17  * Records topological information about an
18  * edge representing a piece of linework (lineString or polygon ring)
19  * from a single source geometry.
20  * This information is carried through the noding process
21  * (which may result in many noded edges sharing the same information object).
22  * It is then used to populate the topology info fields
23  * in {@link Edge}s (possibly via merging).
24  * That information is used to construct the topology graph {@link OverlayLabel}s.
25  *
26  * @author mdavis
27  *
28  */
29 class EdgeSourceInfo {
30   private int index;
31   private int dim = -999;
32   private boolean isHole = false;
33   private int depthDelta = 0;
34 
EdgeSourceInfo(int index, int depthDelta, boolean isHole)35   public EdgeSourceInfo(int index, int depthDelta, boolean isHole) {
36     this.index = index;
37     this.dim = Dimension.A;
38     this.depthDelta = depthDelta;
39     this.isHole = isHole;
40   }
41 
EdgeSourceInfo(int index)42   public EdgeSourceInfo(int index) {
43     this.index = index;
44     this.dim = Dimension.L;
45   }
46 
getIndex()47   public int getIndex() {
48     return index;
49   }
50 
getDimension()51   public int getDimension() {
52     return dim;
53   }
getDepthDelta()54   public int getDepthDelta() {
55     return depthDelta;
56   }
57 
isHole()58   public boolean isHole() {
59     return isHole;
60   }
61 
toString()62   public String toString() {
63     return Edge.infoString(index, dim, isHole, depthDelta);
64   }
65 }
66