Interface SegmentIntersector

 1 /*
 2  * Copyright (c) 2016 Vivid Solutions.
 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.noding;
13  
14 /**
15  * Processes possible intersections detected by a {@link Noder}.
16  * The {@link SegmentIntersector} is passed to a {@link Noder}.
17  * The {@link SegmentIntersector#processIntersections(SegmentString, int, SegmentString, int)} method is called whenever the {@link Noder}
18  * detects that two SegmentStrings <i>might</i> intersect.
19  * This class may be used either to find all intersections, or
20  * to detect the presence of an intersection.  In the latter case,
21  * Noders may choose to short-circuit their computation by calling the
22  * {@link #isDone()} method.
23  * This class is an example of the <i>Strategy</i> pattern.
24  *
25  * @version 1.7
26  */
27 public interface SegmentIntersector
28 {
29   /**
30    * This method is called by clients
31    * of the {@link SegmentIntersector} interface to process
32    * intersections for two segments of the {@link SegmentString}s being intersected.
33    */
34   void processIntersections(
35     SegmentString e0,  int segIndex0,
36     SegmentString e1,  int segIndex1
37      );
38   
39   /**
40    * Reports whether the client of this class
41    * needs to continue testing all intersections in an arrangement.
42    * 
43    * @return true if there is no need to continue testing segments
44    */
45   boolean isDone();
46 }
47