Skip to content

Commit

Permalink
drop julia v0.4, fix dep warns for v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed May 25, 2017
1 parent 549c6cb commit 929a4fa
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ os:
- osx
- linux
julia:
- 0.4
- 0.5
- 0.6
- nightly
matrix:
allow_failures:
- julia: nightly
- julia: nightly
notifications:
email: false
script:
Expand Down
5 changes: 2 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
julia 0.4
Compat 0.8.7
GeoInterface 0.1
julia 0.5
GeoInterface 0.2.1
BinDeps
@osx Homebrew
@windows WinRPM
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand Down
2 changes: 1 addition & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using BinDeps, Compat
using BinDeps
@BinDeps.setup

libgeos = library_dependency("libgeos",aliases=["libgeos_c", "libgeos_c-1"], validate = function(path, handle)
Expand Down
11 changes: 1 addition & 10 deletions src/LibGEOS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,9 @@ module LibGEOS
error("LibGEOS not properly installed. Please run Pkg.build(\"LibGEOS\")")
end

using Compat, GeoInterface
using GeoInterface
import Base: contains

# normalize! was added in julia v0.5, for v0.4 extend Compat version
if isdefined(Base, :normalize!)
import Base: normalize!
else
import Compat: normalize!
export normalize!
end


export Point, MultiPoint, LineString, MultiLineString, LinearRing, Polygon, MultiPolygon, GeometryCollection,
parseWKT, geomFromWKT, geomToWKT,
project, projectNormalized, interpolate, interpolateNormalized,
Expand Down
2 changes: 1 addition & 1 deletion src/geo_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GeoInterface.coordinates(multipoint::MultiPoint) = Vector{Float64}[getCoordinate
GeoInterface.coordinates(multiline::MultiLineString) = Vector{Vector{Float64}}[getCoordinates(getCoordSeq(geom)) for geom in getGeometries(multiline.ptr)]
function GeoInterface.coordinates(multipolygon::MultiPolygon)
geometries = getGeometries(multipolygon.ptr)
coords = Array(Vector{Vector{Vector{Float64}}}, length(geometries))
coords = Array{Vector{Vector{Vector{Float64}}}}(length(geometries))
for (i,geom) in enumerate(getGeometries(multipolygon.ptr))
exterior = getCoordinates(getCoordSeq(exteriorRing(geom)))
interiors = [getCoordinates(getCoordSeq(ring)) for ring in interiorRings(geom)]
Expand Down
34 changes: 17 additions & 17 deletions src/geos_c.jl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Contents of this file is generated. Do not edit by hand!

typealias GEOSMessageHandler Ptr{Void}
typealias GEOSGeometry Ptr{Void}
typealias GEOSPreparedGeometry Ptr{Void}
typealias GEOSCoordSequence Ptr{Void}
typealias GEOSSTRtree Ptr{Void}
typealias GEOSBufferParams Ptr{Void}
typealias GEOSContextHandle_t Ptr{Void}
typealias GEOSQueryCallback Ptr{Void}
typealias GEOSInterruptCallback Ptr{Void}
typealias GEOSWKTReader Ptr{Void}
typealias GEOSWKTWriter Ptr{Void}
typealias GEOSWKBReader Ptr{Void}
typealias GEOSWKBWriter Ptr{Void}
const GEOSMessageHandler = Ptr{Void}
const GEOSGeometry = Ptr{Void}
const GEOSPreparedGeometry = Ptr{Void}
const GEOSCoordSequence = Ptr{Void}
const GEOSSTRtree = Ptr{Void}
const GEOSBufferParams = Ptr{Void}
const GEOSContextHandle_t = Ptr{Void}
const GEOSQueryCallback = Ptr{Void}
const GEOSInterruptCallback = Ptr{Void}
const GEOSWKTReader = Ptr{Void}
const GEOSWKTWriter = Ptr{Void}
const GEOSWKBReader = Ptr{Void}
const GEOSWKBWriter = Ptr{Void}


typealias GEOSGeom Ptr{GEOSGeometry};
typealias GEOSCoordSeq Ptr{GEOSCoordSequence};
const GEOSGeom = Ptr{GEOSGeometry}
const GEOSCoordSeq = Ptr{GEOSCoordSequence}



Expand Down Expand Up @@ -62,15 +62,15 @@ function GEOSContext_setErrorHandler_r(extHandle::GEOSContextHandle_t,ef::GEOSMe
ccall((:GEOSContext_setErrorHandler_r,libgeos),GEOSMessageHandler,(GEOSContextHandle_t,GEOSMessageHandler),extHandle,ef)
end

function GEOSGeomFromWKT(wkt::Compat.String)
function GEOSGeomFromWKT(wkt::String)
ccall((:GEOSGeomFromWKT,libgeos),Ptr{GEOSGeometry},(Ptr{UInt8},),wkt)
end

function GEOSGeomToWKT(g::Ptr{GEOSGeometry})
ccall((:GEOSGeomToWKT,libgeos),Ptr{UInt8},(Ptr{GEOSGeometry},),g)
end

function GEOSGeomFromWKT_r(handle::GEOSContextHandle_t,wkt::Compat.String)
function GEOSGeomFromWKT_r(handle::GEOSContextHandle_t,wkt::String)
ccall((:GEOSGeomFromWKT_r,libgeos),Ptr{GEOSGeometry},(GEOSContextHandle_t,Ptr{UInt8}),handle,wkt)
end

Expand Down
38 changes: 19 additions & 19 deletions src/geos_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GEOMTYPE = Dict( GEOS_POINT => :Point,
GEOS_GEOMETRYCOLLECTION => :GeometryCollection)


function geomFromWKT(geom::Compat.String)
function geomFromWKT(geom::String)
result = GEOSGeomFromWKT(geom)
if result == C_NULL
error("LibGEOS: Error in GEOSGeomFromWKT")
Expand Down Expand Up @@ -108,7 +108,7 @@ function getZ!(ptr::GEOSCoordSeq, index::Integer, coord::Vector{Float64})
result
end

let out = Array(UInt32, 1)
let out = Array{UInt32}(1)
global getSize
function getSize(ptr::GEOSCoordSeq)
# Get size info from a Coordinate Sequence (Return 0 on exception)
Expand All @@ -120,7 +120,7 @@ let out = Array(UInt32, 1)
end
end

let out = Array(UInt32, 1)
let out = Array{UInt32}(1)
global getDimensions
function getDimensions(ptr::GEOSCoordSeq)
# Get dimensions info from a Coordinate Sequence (Return 0 on exception)
Expand Down Expand Up @@ -195,7 +195,7 @@ function createCoordSeq(coords::Vector{Vector{Float64}})
coordinates
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global getX
function getX(ptr::GEOSCoordSeq, i::Integer)
getX!(ptr, i, out)
Expand All @@ -205,7 +205,7 @@ end

function getX(ptr::GEOSCoordSeq)
ncoords = getSize(ptr)
xcoords = Array(Float64, ncoords)
xcoords = Array{Float64}(ncoords)
start = pointer(xcoords)
floatsize = sizeof(Float64)
for i=0:ncoords-1
Expand All @@ -214,18 +214,18 @@ function getX(ptr::GEOSCoordSeq)
xcoords
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global getY
function getY(ptr::GEOSCoordSeq, i::Integer)
out = Array(Float64, 1)
out = Array{Float64}(1)
getY!(ptr, i, out)
out[1]
end
end

function getY(ptr::GEOSCoordSeq)
ncoords = getSize(ptr)
ycoords = Array(Float64, ncoords)
ycoords = Array{Float64}(ncoords)
start = pointer(ycoords)
floatsize = sizeof(Float64)
for i=0:ncoords-1
Expand All @@ -234,7 +234,7 @@ function getY(ptr::GEOSCoordSeq)
ycoords
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global getZ
function getZ(ptr::GEOSCoordSeq, i::Integer)
getZ!(ptr, i, out)
Expand All @@ -244,7 +244,7 @@ end

function getZ(ptr::GEOSCoordSeq)
ncoords = getSize(ptr)
zcoords = Array(Float64, ncoords)
zcoords = Array{Float64}(ncoords)
start = pointer(zcoords)
floatsize = sizeof(Float64)
for i=0:ncoords-1
Expand All @@ -255,7 +255,7 @@ end

function getCoordinates(ptr::GEOSCoordSeq, i::Integer)
ndim = getDimensions(ptr)
coord = Array(Float64, ndim)
coord = Array{Float64}(ndim)
start = pointer(coord)
floatsize = sizeof(Float64)
GEOSCoordSeq_getX(ptr, i-1, start)
Expand Down Expand Up @@ -919,7 +919,7 @@ getGeometries(ptr::GEOSGeom) = GEOSGeom[getGeometry(ptr, i) for i=1:numGeometrie

# Converts Geometry to normal form (or canonical form).
# Return -1 on exception, 0 otherwise.
function normalize!(ptr::GEOSGeom)
function Base.normalize!(ptr::GEOSGeom)
result = GEOSNormalize(ptr)
if result == -1
error("LibGEOS: Error in GEOSNormalize")
Expand All @@ -946,7 +946,7 @@ function numPoints(ptr::GEOSGeom)
end

# Return -1 on exception, Geometry must be a Point.
let out = Array(Float64, 1)
let out = Array{Float64}(1)
global getGeomX
function getGeomX(ptr::GEOSGeom)
result = GEOSGeomGetX(ptr, pointer(out))
Expand All @@ -957,7 +957,7 @@ let out = Array(Float64, 1)
end
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global getGeomY
function getGeomY(ptr::GEOSGeom)
result = GEOSGeomGetY(ptr, pointer(out))
Expand Down Expand Up @@ -1052,7 +1052,7 @@ end
# -----
# Misc functions
# -----
let out = Array(Float64, 1)
let out = Array{Float64}(1)
global geomArea
function geomArea(ptr::GEOSGeom)
# Return 0 on exception, 1 otherwise
Expand All @@ -1064,7 +1064,7 @@ let out = Array(Float64, 1)
end
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global geomLength
function geomLength(ptr::GEOSGeom)
# Return 0 on exception, 1 otherwise
Expand All @@ -1076,7 +1076,7 @@ let out = Array(Float64, 1)
end
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global geomDistance
function geomDistance(g1::GEOSGeom, g2::GEOSGeom)
# Return 0 on exception, 1 otherwise
Expand All @@ -1088,7 +1088,7 @@ let out = Array(Float64, 1)
end
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global hausdorffdistance
function hausdorffdistance(g1::GEOSGeom, g2::GEOSGeom)
# Return 0 on exception, 1 otherwise
Expand All @@ -1100,7 +1100,7 @@ let out = Array(Float64, 1)
end
end

let out = Array(Float64, 1)
let out = Array{Float64}(1)
global hausdorffdistance
function hausdorffdistance(g1::GEOSGeom, g2::GEOSGeom, densifyFrac::Real)
# Return 0 on exception, 1 otherwise
Expand Down
8 changes: 4 additions & 4 deletions src/geos_operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function geomFromGEOS(ptr::GEOSGeom)
return GeometryCollection(ptr)
end
end
parseWKT(geom::Compat.String) = geomFromGEOS(geomFromWKT(geom))
parseWKT(geom::String) = geomFromGEOS(geomFromWKT(geom))

# -----
# Linear referencing functions -- there are more, but these are probably sufficient for most purposes
Expand Down Expand Up @@ -288,11 +288,11 @@ isClosed(obj::LineString) = isClosed(obj.ptr) # Call only on LINESTRING

# Converts Geometry to normal form (or canonical form).
for geom in (:Point, :MultiPoint, :LineString, :MultiLineString, :LinearRing, :Polygon, :MultiPolygon, :GeometryCollection)
@eval normalize!(obj::$geom) = normalize!(obj.ptr)
@eval Base.normalize!(obj::$geom) = normalize!(obj.ptr)
end

# # Return -1 on exception, Geometry must be a Point.
# let out = Array(Float64, 1)
# let out = Array{Float64}(1)
# global getGeomX
# function getGeomX(ptr::GEOSGeom)
# result = GEOSGeomGetX(ptr, pointer(out))
Expand All @@ -303,7 +303,7 @@ end
# end
# end

# let out = Array(Float64, 1)
# let out = Array{Float64}(1)
# global getGeomY
# function getGeomY(ptr::GEOSGeom)
# result = GEOSGeomGetY(ptr, pointer(out))
Expand Down
Loading

0 comments on commit 929a4fa

Please sign in to comment.