@@ -4,9 +4,9 @@ use std::io;
4
4
use std:: path:: Path ;
5
5
use std:: { borrow:: Borrow , convert:: TryInto } ;
6
6
7
- use geo:: { point, Contains , Geometry , MultiPolygon , Point , Polygon , PreparedGeometry } ;
7
+ use geo:: { point, Contains , Geometry , MultiPolygon , Point , Polygon , PreparedGeometry , Relate } ;
8
8
use numpy:: { PyArray , PyReadonlyArrayDyn } ;
9
- use rstar:: { PointDistance , RTree , RTreeObject , AABB , Envelope } ;
9
+ use rstar:: { Envelope , PointDistance , RTree , RTreeObject , AABB } ;
10
10
11
11
pub static GSHHS_F : & str = "gshhs_f_-180.000000E-90.000000N180.000000E90.000000N.wkb.xz" ;
12
12
@@ -18,15 +18,15 @@ pub struct Gshhg {
18
18
19
19
#[ derive( Clone ) ]
20
20
struct PolW {
21
- p : Polygon ,
21
+ p : PreparedGeometry < ' static > ,
22
22
e : AABB < Point < f64 > > ,
23
23
}
24
24
25
25
impl PolW {
26
26
pub fn from ( p : Polygon ) -> PolW {
27
27
PolW {
28
- p : p. clone ( ) ,
29
- e : p . envelope ( )
28
+ e : p. envelope ( ) ,
29
+ p : PreparedGeometry :: from ( p ) ,
30
30
}
31
31
}
32
32
}
@@ -51,7 +51,8 @@ impl PointDistance for PolW {
51
51
return false ;
52
52
}
53
53
54
- self . p . contains ( point)
54
+ self . p . relate ( point) . is_covers ( )
55
+ // self.p.contains(point)
55
56
}
56
57
57
58
fn distance_2_if_less_or_equal ( & self , _point : & Point < f64 > , _max_distance : f64 ) -> Option < f64 > {
0 commit comments