Class SinglePassNoder

 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.noding;
14  
15 import java.util.Collection;
16  
17 /**
18  * Base class for {@link Noder}s which make a single
19  * pass to find intersections.
20  * This allows using a custom {@link SegmentIntersector}
21  * (which for instance may simply identify intersections, rather than
22  * insert them).
23  *
24  * @version 1.7
25  */
26 public abstract class SinglePassNoder
27     implements Noder
28 {
29  
30   protected SegmentIntersector segInt;
31  
32   public SinglePassNoder() {
33   }
34  
35   public SinglePassNoder(SegmentIntersector segInt) {
36     setSegmentIntersector(segInt);
37   }
38  
39   /**
40    * Sets the SegmentIntersector to use with this noder.
41    * A SegmentIntersector will normally add intersection nodes
42    * to the input segment strings, but it may not - it may
43    * simply record the presence of intersections.
44    * However, some Noders may require that intersections be added.
45    *
46    * @param segInt
47    */
48   public void setSegmentIntersector(SegmentIntersector segInt)
49   {
50     this.segInt = segInt;
51   }
52  
53   /**
54    * Computes the noding for a collection of {@link SegmentString}s.
55    * Some Noders may add all these nodes to the input SegmentStrings;
56    * others may only add some or none at all.
57    *
58    * @param segStrings a collection of {@link SegmentString}s to node
59    */
60   public abstract void computeNodes(Collection segStrings);
61  
62   /**
63    * Returns a {@link Collection} of fully noded {@link SegmentString}s.
64    * The SegmentStrings have the same context as their parent.
65    *
66    * @return a Collection of SegmentStrings
67    */
68   public abstract Collection getNodedSubstrings();
69  
70 }
71