Skip to content

Commit efe733d

Browse files
committed
extend the right normalize! on v0.4 and v0.5
Fixes warning on julia v0.4
1 parent 756f92d commit efe733d

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/LibGEOS.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ module LibGEOS
77
end
88

99
using Compat, GeoInterface
10-
import Base: normalize!, contains
10+
import Base: contains
11+
12+
# normalize! was added in julia v0.5, for v0.4 extend Compat version
13+
if isdefined(Base, :normalize!)
14+
import Base: normalize!
15+
else
16+
import Compat: normalize!
17+
export normalize!
18+
end
19+
1120

1221
export Point, MultiPoint, LineString, MultiLineString, LinearRing, Polygon, MultiPolygon, GeometryCollection,
1322
parseWKT, geomFromWKT, geomToWKT,
@@ -19,7 +28,7 @@ module LibGEOS
1928
disjoint, touches, intersects, crosses, within, contains, overlaps, equals, equalsexact, covers, coveredby,
2029
prepareGeom, prepcontains, prepcontainsproperly, prepcoveredby, prepcovers, prepcrosses,
2130
prepdisjoint, prepintersects, prepoverlaps, preptouches, prepwithin,
22-
isEmpty, isSimple, isRing, hasZ, isClosed, isValid, normalize!, interiorRings, exteriorRing,
31+
isEmpty, isSimple, isRing, hasZ, isClosed, isValid, interiorRings, exteriorRing,
2332
numPoints, startPoint, endPoint, area, geomLength, distance, hausdorffdistance, nearestPoints
2433

2534
include("geos_c.jl")

test/test_geos_functions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ LibGEOS.destroyCoordSeq(coords_)
324324
# GEOSNodeTest
325325
geom1_ = LibGEOS.geomFromWKT("LINESTRING(0 0, 10 10, 10 0, 0 10)")
326326
geom2_ = LibGEOS.node(geom1_)
327-
LibGEOS.normalize!(geom2_)
327+
normalize!(geom2_)
328328
geom3_ = LibGEOS.geomFromWKT("MULTILINESTRING ((5 5, 10 0, 10 10, 5 5), (0 10, 5 5), (0 0, 5 5))")
329329
@fact LibGEOS.geomToWKT(geom2_) --> LibGEOS.geomToWKT(geom3_)
330330
LibGEOS.destroyGeom(geom1_)
@@ -333,7 +333,7 @@ LibGEOS.destroyGeom(geom3_)
333333

334334
geom1_ = LibGEOS.geomFromWKT("MULTILINESTRING((0 0, 2 0, 4 0),(5 0, 3 0, 1 0))")
335335
geom2_ = LibGEOS.node(geom1_)
336-
LibGEOS.normalize!(geom2_)
336+
normalize!(geom2_)
337337
geom3_ = LibGEOS.geomFromWKT("MULTILINESTRING ((4 0, 5 0), (3 0, 4 0), (2 0, 3 0), (1 0, 2 0), (0 0, 1 0))")
338338
@fact LibGEOS.geomToWKT(geom2_) --> LibGEOS.geomToWKT(geom3_)
339339
LibGEOS.destroyGeom(geom1_)
@@ -342,7 +342,7 @@ LibGEOS.destroyGeom(geom3_)
342342

343343
geom1_ = LibGEOS.geomFromWKT("MULTILINESTRING((0 0, 2 0, 4 0),(0 0, 2 0, 4 0))")
344344
geom2_ = LibGEOS.node(geom1_)
345-
LibGEOS.normalize!(geom2_)
345+
normalize!(geom2_)
346346
geom3_ = LibGEOS.geomFromWKT("MULTILINESTRING ((2 0, 4 0), (0 0, 2 0))")
347347
@fact LibGEOS.geomToWKT(geom2_) --> LibGEOS.geomToWKT(geom3_)
348348
LibGEOS.destroyGeom(geom1_)

test/test_geos_operations.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ points = nearestPoints(g1, g2)
144144

145145
# GEOSNodeTest
146146
g1 = node(parseWKT("LINESTRING(0 0, 10 10, 10 0, 0 10)"))
147-
LibGEOS.normalize!(g1)
147+
normalize!(g1)
148148
equivalent_to_wkt(g1, "MULTILINESTRING ((5 5, 10 0, 10 10, 5 5), (0 10, 5 5), (0 0, 5 5))")
149149

150150
g1 = node(parseWKT("MULTILINESTRING((0 0, 2 0, 4 0),(5 0, 3 0, 1 0))"))
151-
LibGEOS.normalize!(g1)
151+
normalize!(g1)
152152
equivalent_to_wkt(g1, "MULTILINESTRING ((4 0, 5 0), (3 0, 4 0), (2 0, 3 0), (1 0, 2 0), (0 0, 1 0))")
153153

154154
g1 = node(parseWKT("MULTILINESTRING((0 0, 2 0, 4 0),(0 0, 2 0, 4 0))"))
155-
LibGEOS.normalize!(g1)
155+
normalize!(g1)
156156
equivalent_to_wkt(g1, "MULTILINESTRING ((2 0, 4 0), (0 0, 2 0))")
157157

158158
# GEOSPointOnSurfaceTest

0 commit comments

Comments
 (0)