-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ff6e76
commit a888d02
Showing
13 changed files
with
95 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,48 @@ | ||
const __COORDINATE_TYPES = Union{Tuple{<:Real, <:Real}, CartesianIndex} | ||
|
||
# TODO: extent this to be GeoInterface.PointLike compat | ||
""" | ||
Node | ||
A single sampling location within a [`BiodiversityObservationNetwork`](@ref), represented as a coordinate. | ||
A `Node` extends the GeoInterface PointTrait type. | ||
""" | ||
struct Node{C <: __COORDINATE_TYPES} | ||
coordinate::C | ||
end | ||
Base.show(io::IO, node::Node) = print(io, "Node at $(node.coordinate)") | ||
Base.getindex(node::Node, i) = getindex(node.coordinate, i) | ||
|
||
GI.isgeometry(::Node)::Bool = true | ||
GI.geomtrait(::Node)::DataType = PointTrait() | ||
GI.ncoord(::PointTrait, ::Node)::Integer = 1 | ||
GI.getcoord(::PointTrait, node::Node, i)::Real = node[i] | ||
|
||
is_bonifyable(::T) where T = T <: Union{<:__COORDINATE_TYPES,Vector{<:__COORDINATE_TYPES}} | ||
|
||
|
||
""" | ||
BiodiversityObservationNetwork | ||
A set of [`Node`](@ref)s that together create a sampling design for monitoring | ||
biodiversity. | ||
`BiodiversityObservationNetwork` extends the GeoInterface MultiPointTrait type. | ||
""" | ||
struct BiodiversityObservationNetwork{N <: Node} | ||
nodes::Vector{N} | ||
end | ||
|
||
Base.show(io::IO, bon::BiodiversityObservationNetwork) = | ||
print(io, "BiodiversityObservationNetwork with $(length(bon)) nodes") | ||
Base.getindex(bon::BiodiversityObservationNetwork, i::Integer) = bon.nodes[i] | ||
Base.length(bon::BiodiversityObservationNetwork) = length(bon.nodes) | ||
Base.iterate(bon::BiodiversityObservationNetwork, i) = iterate(bon.nodes, i) | ||
Base.iterate(bon::BiodiversityObservationNetwork) = iterate(bon.nodes) | ||
|
||
Base.vcat(bons::Vector{<:BiodiversityObservationNetwork}) = BiodiversityObservationNetwork(vcat([b.nodes for b in bons]...)) | ||
|
||
|
||
GI.isgeometry(::BiodiversityObservationNetwork)::Bool = true | ||
GI.geomtrait(::BiodiversityObservationNetwork)::DataType = MultiPointTrait() | ||
GI.ngeom(::MultiPointTrait, bon::BiodiversityObservationNetwork)::Integer = length(bon) | ||
GI.getgeom(::MultiPointTrait, bon::BiodiversityObservationNetwork, i) = bon[i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters