Class EdgeEndBundleStar

 1  
 2  
 3  
 4 /*
 5  * Copyright (c) 2016 Vivid Solutions.
 6  *
 7  * All rights reserved. This program and the accompanying materials
 8  * are made available under the terms of the Eclipse Public License 2.0
 9  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
10  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html
11  * and the Eclipse Distribution License is available at
12  *
13  * http://www.eclipse.org/org/documents/edl-v10.php.
14  */
15 package org.locationtech.jts.operation.relate;
16  
17 import java.util.Iterator;
18  
19 import org.locationtech.jts.geom.IntersectionMatrix;
20 import org.locationtech.jts.geomgraph.EdgeEnd;
21 import org.locationtech.jts.geomgraph.EdgeEndStar;
22  
23 /**
24  * An ordered list of {@link EdgeEndBundle}s around a {@link RelateNode}.
25  * They are maintained in CCW order (starting with the positive x-axis) around the node
26  * for efficient lookup and topology building.
27  *
28  * @version 1.7
29  */
30 public class EdgeEndBundleStar
31   extends EdgeEndStar
32 {
33   /**
34    * Creates a new empty EdgeEndBundleStar
35    */
36   public EdgeEndBundleStar() {
37   }
38  
39   /**
40    * Insert a EdgeEnd in order in the list.
41    * If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is
42    * added to the bundle.  Otherwise, a new EdgeEndBundle is created
43    * to contain the EdgeEnd.
44    * <br>
45    */
46   public void insert(EdgeEnd e)
47   {
48     EdgeEndBundle eb = (EdgeEndBundle) edgeMap.get(e);
49     if (eb == null) {
50       eb = new EdgeEndBundle(e);
51       insertEdgeEnd(e, eb);
52     }
53     else {
54       eb.insert(e);
55     }
56   }
57  
58   /**
59    * Update the IM with the contribution for the EdgeStubs around the node.
60    */
61   void updateIM(IntersectionMatrix im)
62   {
63     for (Iterator it = iterator(); it.hasNext(); ) {
64       EdgeEndBundle esb = (EdgeEndBundle) it.next();
65       esb.updateIM(im);
66     }
67   }
68  
69 }
70