walkmap.superstructure

single indexing structure for walkmap objects

find-nearest

(find-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).

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

  1. s is not a map;
  2. o is not a map;
  3. o does not have a value for the key :walkmap.id/id;
  4. 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

  1. s is not a map;
  2. o is not a map;
  3. o does not have a value for the key :walkmap.id/id.

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.

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

  1. s is not a map;
  2. o is not a recognisable walkmap object

vertex-index

TODO: write docs

vertices

(vertices o)

If o is an object with vertices, return those vertices, else nil.