Class PreparedPoint

 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.geom.prep;
13  
14 import org.locationtech.jts.geom.Geometry;
15 import org.locationtech.jts.geom.Puntal;
16  
17  
18 /**
19  * A prepared version for {@link Puntal} geometries.
20  * <p>
21  * Instances of this class are thread-safe.
22  * 
23  * @author Martin Davis
24  *
25  */
26 public class PreparedPoint
27   extends BasicPreparedGeometry
28 {
29   public PreparedPoint(Puntal point) {
30     super((Geometry) point);
31   }
32  
33   /**
34    * Tests whether this point intersects a {@link Geometry}.
35    * <p>
36    * The optimization here is that computing topology for the test geometry
37    * is avoided.  This can be significant for large geometries.
38    */
39   public boolean intersects(Geometry g)
40   {
41       if (! envelopesIntersect(g)) return false;
42       
43       /**
44        * This avoids computing topology for the test geometry
45        */
46     return isAnyTargetComponentInTest(g);
47   }  
48 }
49