walkmap.superstructure
single indexing structure for walkmap objects
in-retrieve
(in-retrieve x s)
Internal guts of retrieve
, q.v. x
can be anything; s
must be a walkmap superstructure. TODO: recursive, quite likely to blow the fragile Clojure stack. Probably better to do this with walk
, but I don’t yet understand that.
in-store-find-objects
(in-store-find-objects o)
(in-store-find-objects o s)
Return an id -> object map of every object within o
. Internal to in-store
, q.v. Use at your own peril.
in-store-replace-with-keys
(in-store-replace-with-keys o)
Return a copy of o
in which each reified walkmap object within o
has been replaced with the :walkmap.id/id
of that object. Internal to in-store
, q.v. Use at your own peril.
index-vertex
(index-vertex s o v)
Return a superstructure like s
in which object o
is indexed by vertex v
. It is an error (and an exception may be thrown) if
s
is not a map;o
is not a map;o
does not have a value for the key:walkmap.id/id
;v
is not a vertex.
index-vertices
(index-vertices s o)
Return a superstructure like s
in which object o
is indexed by its vertices. It is an error (and an exception may be thrown) if
s
is not a map;o
is not a map;o
does not have a value for the key:walkmap.id/id
.
nearest
(nearest s target filter-fn radius)
Search superstructure s
for the nearest object matching filter-fn
to the target
vertex. Searches only with radius
(slight misnomer, area actually searched is a cube). Returns one object, or nil
if no matching object found.
WARNING: currently only returns objects which have a defined :centre
(but most of the significant objects we have do).
neighbour-ids
(neighbour-ids target s)
(neighbour-ids target filter-fn s)
Return a sequence of the ids all those objects in superstructure s
which share at least one vertex with target
, and which are matched by filter-fn
if supplied.
neighbours
(neighbours target s)
(neighbours target filter-fn s)
Return a sequence of all those objects in superstructure s
which share at least one vertex with target
, and which are matched by filter-fn
if supplied.
retrieve
(retrieve id s)
Retrieve the canonical representation of the object with this id
from the superstructure s
.
search-vertices
(search-vertices s minv maxv)
(search-vertices s minv maxv d2?)
Search superstructure s
for vertices within the box defined by vertices minv
and maxv
. Every coordinate in minv
must have a lower value than the equivalent coordinate in maxv
. If d2?
is supplied and not false, search only in the x,y projection.
NOTE THAT this depends on the fact that vertices do not currently have properties which will be denormalised by store
, and therefore do not have to restored with retrieve
. If properties are added to vertices whose values are objects, then this will have to be rewritten.
store
(store o)
(store o s)
Return a superstructure like s
with object o
added. If only one argument is supplied it will be assumed to represent o
and a new superstructure will be returned.
It is an error (and an exception may be thrown) if
s
is not a map;o
is not a recognisable walkmap object
touching
(touching vertex s)
(touching vertex filter-fn s)
Return a sequence of all objects in superstructure s
which are indexed as touching the vertex v
.