Skip to content

Commit

Permalink
fix deprecation warnings on julia v0.6
Browse files Browse the repository at this point in the history
fix abstract type with Compat
change typealias A B to const A = B
  • Loading branch information
visr committed May 24, 2017
1 parent 5107b71 commit e3b883b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
julia 0.5
Compat 0.17
24 changes: 13 additions & 11 deletions src/GeoInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ __precompile__()

module GeoInterface

using Compat

export AbstractPosition, Position,
AbstractGeometry, AbstractGeometryCollection, GeometryCollection,
AbstractPoint, Point,
Expand All @@ -20,7 +22,7 @@ module GeoInterface
geometry, bbox, crs, properties,
features

abstract AbstractPosition{T <: Real} <: AbstractVector{T}
@compat abstract type AbstractPosition{T <: Real} <: AbstractVector{T} end
geotype(::AbstractPosition) = :Position
xcoord(::AbstractPosition) = error("xcoord(::AbstractPosition) not defined.")
ycoord(::AbstractPosition) = error("ycoord(::AbstractPosition) not defined.")
Expand All @@ -38,40 +40,40 @@ module GeoInterface
Base.convert(::Type{Vector{Float64}}, p::AbstractPosition) = coordinates(p)
# Base.linearindexing{T <: AbstractPosition}(::Type{T}) = LinearFast()

abstract AbstractGeometry
@compat abstract type AbstractGeometry end
coordinates(obj::AbstractGeometry) = error("coordinates(::AbstractGeometry) not defined.")

abstract AbstractPoint <: AbstractGeometry
@compat abstract type AbstractPoint <: AbstractGeometry end
geotype(::AbstractPoint) = :Point

abstract AbstractMultiPoint <: AbstractGeometry
@compat abstract type AbstractMultiPoint <: AbstractGeometry end
geotype(::AbstractMultiPoint) = :MultiPoint

abstract AbstractLineString <: AbstractGeometry
@compat abstract type AbstractLineString <: AbstractGeometry end
geotype(::AbstractLineString) = :LineString

abstract AbstractMultiLineString <: AbstractGeometry
@compat abstract type AbstractMultiLineString <: AbstractGeometry end
geotype(::AbstractMultiLineString) = :MultiLineString

abstract AbstractPolygon <: AbstractGeometry
@compat abstract type AbstractPolygon <: AbstractGeometry end
geotype(::AbstractPolygon) = :Polygon

abstract AbstractMultiPolygon <: AbstractGeometry
@compat abstract type AbstractMultiPolygon <: AbstractGeometry end
geotype(::AbstractMultiPolygon) = :MultiPolygon

abstract AbstractGeometryCollection <: AbstractGeometry
@compat abstract type AbstractGeometryCollection <: AbstractGeometry end
geotype(::AbstractGeometryCollection) = :GeometryCollection
geometries(obj::AbstractGeometryCollection) = error("geometries(::AbstractGeometryCollection) not defined.")

abstract AbstractFeature
@compat abstract type AbstractFeature end
geotype(::AbstractFeature) = :Feature
geometry(obj::AbstractFeature) = error("geometry(::AbstractFeature) not defined.")
# optional
properties(obj::AbstractFeature) = Dict{String,Any}()
bbox(obj::AbstractFeature) = nothing
crs(obj::AbstractFeature) = nothing

abstract AbstractFeatureCollection
@compat abstract type AbstractFeatureCollection end
geotype(::AbstractFeatureCollection) = :FeatureCollection
features(obj::AbstractFeatureCollection) = error("features(::AbstractFeatureCollection) not defined.")
# optional
Expand Down
6 changes: 3 additions & 3 deletions src/geotypes.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Coordinate Reference System Objects
# (has keys "type" and "properties")
# TODO: Handle full CRS spec
typealias CRS Dict{String,Any}
const CRS = Dict{String,Any}

# Bounding Boxes
# The value of the bbox member must be a 2*n array,
Expand All @@ -11,9 +11,9 @@ typealias CRS Dict{String,Any}
# The axes order of a bbox follows the axes order of geometries.
# In addition, the coordinate reference system for the bbox is assumed to match
# the coordinate reference system of the GeoJSON object of which it is a member.
typealias BBox Vector{Float64}
const BBox = Vector{Float64}

typealias Position Vector{Float64}
const Position = Vector{Float64}
# (x, y, [z, ...]) - meaning of additional elements undefined.
# In an object's contained geometries, Positions must have uniform dimensions.
geotype(::Position) = :Position
Expand Down

0 comments on commit e3b883b

Please sign in to comment.