@@ -77,7 +77,7 @@ type compositeShape interface {
77
77
Members () []index.GeoJSON
78
78
}
79
79
80
- //--------------------------------------------------------
80
+ // --------------------------------------------------------
81
81
// Point represents the geoJSON point type and it
82
82
// implements the index.GeoJSON interface.
83
83
type Point struct {
@@ -141,7 +141,7 @@ func (p *Point) Coordinates() []float64 {
141
141
return p .Vertices
142
142
}
143
143
144
- //--------------------------------------------------------
144
+ // --------------------------------------------------------
145
145
// MultiPoint represents the geoJSON multipoint type and it
146
146
// implements the index.GeoJSON interface as well as the
147
147
// compositeShap interface.
@@ -247,7 +247,7 @@ func (p *MultiPoint) Members() []index.GeoJSON {
247
247
return points
248
248
}
249
249
250
- //--------------------------------------------------------
250
+ // --------------------------------------------------------
251
251
// LineString represents the geoJSON linestring type and it
252
252
// implements the index.GeoJSON interface.
253
253
type LineString struct {
@@ -309,7 +309,7 @@ func (ls *LineString) Coordinates() [][]float64 {
309
309
return ls .Vertices
310
310
}
311
311
312
- //--------------------------------------------------------
312
+ // --------------------------------------------------------
313
313
// MultiLineString represents the geoJSON multilinestring type
314
314
// and it implements the index.GeoJSON interface as well as the
315
315
// compositeShap interface.
@@ -393,7 +393,7 @@ func (p *MultiLineString) Members() []index.GeoJSON {
393
393
return lines
394
394
}
395
395
396
- //--------------------------------------------------------
396
+ // --------------------------------------------------------
397
397
// Polygon represents the geoJSON polygon type
398
398
// and it implements the index.GeoJSON interface.
399
399
type Polygon struct {
@@ -455,7 +455,7 @@ func (p *Polygon) Coordinates() [][][]float64 {
455
455
return p .Vertices
456
456
}
457
457
458
- //--------------------------------------------------------
458
+ // --------------------------------------------------------
459
459
// MultiPolygon represents the geoJSON multipolygon type
460
460
// and it implements the index.GeoJSON interface as well as the
461
461
// compositeShap interface.
@@ -553,7 +553,7 @@ func (p *MultiPolygon) Members() []index.GeoJSON {
553
553
return polygons
554
554
}
555
555
556
- //--------------------------------------------------------
556
+ // --------------------------------------------------------
557
557
// GeometryCollection represents the geoJSON geometryCollection type
558
558
// and it implements the index.GeoJSON interface as well as the
559
559
// compositeShap interface.
@@ -743,7 +743,7 @@ func (gc *GeometryCollection) UnmarshalJSON(data []byte) error {
743
743
return nil
744
744
}
745
745
746
- //--------------------------------------------------------
746
+ // --------------------------------------------------------
747
747
// Circle represents a custom circle type and it
748
748
// implements the index.GeoJSON interface.
749
749
type Circle struct {
@@ -828,7 +828,7 @@ func (c *Circle) UnmarshalJSON(data []byte) error {
828
828
return err
829
829
}
830
830
831
- //--------------------------------------------------------
831
+ // --------------------------------------------------------
832
832
// Envelope represents the envelope/bounding box type and it
833
833
// implements the index.GeoJSON interface.
834
834
type Envelope struct {
@@ -1143,26 +1143,9 @@ func checkLineStringsIntersectsShape(pls []*s2.Polyline, shapeIn,
1143
1143
1144
1144
// check if the other shape is a envelope.
1145
1145
if e , ok := other .(* Envelope ); ok {
1146
- for _ , pl := range pls {
1147
- for i := 0 ; i < pl .NumEdges (); i ++ {
1148
- edge := pl .Edge (i )
1149
- latlng1 := s2 .LatLngFromPoint (edge .V0 )
1150
- latlng2 := s2 .LatLngFromPoint (edge .V1 )
1151
- a := []float64 {latlng1 .Lng .Degrees (), latlng1 .Lat .Degrees ()}
1152
- b := []float64 {latlng2 .Lng .Degrees (), latlng2 .Lat .Degrees ()}
1153
- for j := 0 ; j < 4 ; j ++ {
1154
- v1 := e .r .Vertex (j )
1155
- v2 := e .r .Vertex ((j + 1 ) % 4 )
1156
- c := []float64 {v1 .Lng .Degrees (), v1 .Lat .Degrees ()}
1157
- d := []float64 {v2 .Lng .Degrees (), v2 .Lat .Degrees ()}
1158
- if doIntersect (a , b , c , d ) {
1159
- return true , nil
1160
- }
1161
- }
1162
- }
1163
- }
1146
+ res := rectangleIntersectsWithLineStrings (e .r , pls )
1164
1147
1165
- return false , nil
1148
+ return res , nil
1166
1149
}
1167
1150
1168
1151
return false , fmt .Errorf ("unknown geojson type: %s " +
0 commit comments