Merge branch 'feature/8' into develop
This commit is contained in:
commit
0e943b0e18
|
@ -54,10 +54,6 @@ GeoCSV is at an early stage of development, and some features are not yet workin
|
||||||
|
|
||||||
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
|
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
|
||||||
|
|
||||||
### Doesn't scale and centre the map to show the data in the sheet
|
|
||||||
|
|
||||||
Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't.
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
You will need [Leiningen][1] 2.0 or above installed.
|
You will need [Leiningen][1] 2.0 or above installed.
|
||||||
|
|
2
env/prod/cljs/geocsv/app.cljs
vendored
2
env/prod/cljs/geocsv/app.cljs
vendored
|
@ -1,5 +1,5 @@
|
||||||
(ns geocsv.app
|
(ns geocsv.app
|
||||||
(:require [geocsv.core :as core]))
|
(:require [geocsv.client.core :as core]))
|
||||||
|
|
||||||
;;ignore println statements in prod
|
;;ignore println statements in prod
|
||||||
(set! *print-fn* (fn [& _]))
|
(set! *print-fn* (fn [& _]))
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
[com.cemerick/url "0.1.1"]
|
[com.cemerick/url "0.1.1"]
|
||||||
[com.cognitect/transit-clj "0.8.319"]
|
[com.cognitect/transit-clj "0.8.319"]
|
||||||
[compojure "1.6.1"]
|
[compojure "1.6.1"]
|
||||||
|
[cpath-clj "0.1.2"]
|
||||||
[cprop "0.1.15"]
|
[cprop "0.1.15"]
|
||||||
[csv2edn "0.1.6"]
|
[csv2edn "0.1.6"]
|
||||||
[day8.re-frame/http-fx "0.1.6"]
|
[day8.re-frame/http-fx "0.1.6"]
|
||||||
|
|
|
@ -54,10 +54,6 @@ GeoCSV is at an early stage of development, and some features are not yet workin
|
||||||
|
|
||||||
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
|
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
|
||||||
|
|
||||||
### Doesn't scale and centre the map to show the data in the sheet
|
|
||||||
|
|
||||||
Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't.
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
You will need [Leiningen][1] 2.0 or above installed.
|
You will need [Leiningen][1] 2.0 or above installed.
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[clojure.string :as s]
|
[clojure.string :as s]
|
||||||
[clojure.tools.logging :as log]
|
[clojure.tools.logging :as log]
|
||||||
|
[cpath-clj.core :as cp]
|
||||||
[compojure.core :refer [defroutes GET POST]]
|
[compojure.core :refer [defroutes GET POST]]
|
||||||
[csv2edn.csv2edn :refer :all]
|
[csv2edn.csv2edn :refer :all]
|
||||||
[noir.response :as nresponse]
|
[noir.response :as nresponse]
|
||||||
|
@ -37,19 +38,18 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defn get-pin-image-names
|
(defn get-pin-image-names
|
||||||
|
"Return the category names for which we have pin images; `request` is ignored.
|
||||||
|
|
||||||
|
This looks odd - why not file-seq over the directory? - but the answer is we
|
||||||
|
may be running in a jar file, and if we are that will fail."
|
||||||
[request]
|
[request]
|
||||||
(ar/do-or-server-fail
|
(ar/do-or-server-fail
|
||||||
(map
|
(map
|
||||||
#(s/replace (.getName %) #"-pin\.png$" "")
|
#(s/replace (s/replace (str %) #"-pin\.png$" "") "/" "")
|
||||||
(let [grammar-matcher (.getPathMatcher
|
|
||||||
(java.nio.file.FileSystems/getDefault)
|
|
||||||
"glob:*-pin.png")]
|
|
||||||
(->> "public/img/map-pins"
|
(->> "public/img/map-pins"
|
||||||
io/resource
|
cp/resources
|
||||||
io/file
|
keys
|
||||||
file-seq
|
(filter #(re-find #".*-pin.png" %))))
|
||||||
(filter #(.isFile %))
|
|
||||||
(filter #(.matches grammar-matcher (.getFileName (.toPath %)))))))
|
|
||||||
200))
|
200))
|
||||||
|
|
||||||
(defn get-data-uri
|
(defn get-data-uri
|
||||||
|
|
|
@ -6,11 +6,9 @@
|
||||||
[re-frame.core :as rf]))
|
[re-frame.core :as rf]))
|
||||||
|
|
||||||
(defn local-uri? [{:keys [uri]}]
|
(defn local-uri? [{:keys [uri]}]
|
||||||
(js/console.log (str "local-uri?: received `" (str uri) "` (type " (type uri) ") as uri"))
|
|
||||||
(not (re-find #"^\w+?://" (str uri))))
|
(not (re-find #"^\w+?://" (str uri))))
|
||||||
|
|
||||||
(defn default-headers [request]
|
(defn default-headers [request]
|
||||||
(js/console.log (str "default-headers: received `" request "` as request"))
|
|
||||||
(if (local-uri? request)
|
(if (local-uri? request)
|
||||||
(-> request
|
(-> request
|
||||||
(update :headers #(merge {"x-csrf-token" js/csrfToken} %)))
|
(update :headers #(merge {"x-csrf-token" js/csrfToken} %)))
|
||||||
|
|
|
@ -38,6 +38,4 @@
|
||||||
"Other-key-customers"
|
"Other-key-customers"
|
||||||
"Power-supplier"} ;; need to be fetched from server side
|
"Power-supplier"} ;; need to be fetched from server side
|
||||||
:latitude 56
|
:latitude 56
|
||||||
:longitude -4
|
:longitude -4})
|
||||||
:map {:map-centre [56 -4]
|
|
||||||
:map-zoom 6}})
|
|
||||||
|
|
|
@ -198,11 +198,6 @@
|
||||||
(js/console.log (str "Fetching longitude" v))
|
(js/console.log (str "Fetching longitude" v))
|
||||||
v)))
|
v)))
|
||||||
|
|
||||||
(rf/reg-sub
|
|
||||||
:map
|
|
||||||
(fn [db _]
|
|
||||||
(:map db)))
|
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:route
|
:route
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
(defn map-render
|
(defn map-render
|
||||||
"Render the actual div containing the map."
|
"Render the actual div containing the map."
|
||||||
[]
|
[]
|
||||||
[:div#map {:style {:height "1000px"}}])
|
[:div#map {:style {:height "800px"}}])
|
||||||
|
|
||||||
(defn panel
|
(defn panel
|
||||||
"A reagent class for the map object."
|
"A reagent class for the map object."
|
||||||
|
|
Loading…
Reference in a new issue