001  (ns cc.journeyman.the-great-game.location.location)
002  
003  ;;; There's probably conflict between this sense of a reified location and
004  ;;; the simpler sense of a location described in 
005  ;;; `cc.journeyman.the-great-game.world.location`, q.v. This needs to
006  ;;; be resolved!
007  
008  (defprotocol ProtoLocation
009    (easting [location]
010     "Return the easting of this location")
011    (northing [location] "Return the northing of this location")
012    (altitude [location]
013              "Return the absolute altitude of this location, which may be
014               different from the terrain height at this location, if, for
015               example, the location is underground or on an upper floor.")
016    (terrain-altitude [location]
017                      "Return the 'ground level' (altitude of the terrain)
018                       at this location given this world. TODO: possibly
019                       terrain-altitude should be a method of the world.")
020    (settlement [location]
021                "Return the settlement record of the settlement in this world
022                 within whose parish polygon this location exists, or if none
023                 whose centre (inn location) is closest to this location"))
024  
025  
026  (defrecord Location [^Double easting ^Double northing ^Double altitude world]
027    ProtoLocation
028    (easting [l] (:easting l))
029    (northing [l] (:northing l))
030    (altitude [l] (:altitude l))
031    (terrain-altitude [l] 0.0) ;; TODO
032    (settlement [l] :tchahua))
033  
034  (defrecord OrientedLocation
035    ;; "Identical to a Location except having, additionally, an orientation"
036             [^Double easting ^Double northing ^Double altitude ^Double orientation world]
037    ProtoLocation
038    (easting [l] (:easting l))
039    (northing [l] (:northing l))
040    (altitude [l] (:altitude l))
041    (terrain-altitude [l] 0.0) ;; TODO
042    (settlement [l] :tchahua)) ;; TODO
043  
044   ;; (.settlement (OrientedLocation. 123.45 543.76 12.34 0.00 {}))
045