aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-01-16 18:30:10 +0000
committerM Somerville <matthew-github@dracos.co.uk>2020-08-10 17:43:10 +0100
commit00fe7b548cee48c9683e4fa99ed148cdf911cc84 (patch)
treea1f0a386fa53692e286450a9670b6332cf69b4db
parent5a0dd3f573f7aba771fe916a65138dfbbb258982 (diff)
[Oxfordshire] add asset layers
Trees, street lights, traffic lights, grit bins and gullies
-rw-r--r--templates/web/fixmystreet.com/footer_extra_js.html1
-rw-r--r--templates/web/oxfordshire/footer_extra_js.html2
-rw-r--r--web/cobrands/fixmystreet/assets.js20
-rw-r--r--web/cobrands/oxfordshire/assets.js138
-rw-r--r--web/cobrands/oxfordshire/base.scss4
5 files changed, 155 insertions, 10 deletions
diff --git a/templates/web/fixmystreet.com/footer_extra_js.html b/templates/web/fixmystreet.com/footer_extra_js.html
index 289e230e7..2a4f9ed9c 100644
--- a/templates/web/fixmystreet.com/footer_extra_js.html
+++ b/templates/web/fixmystreet.com/footer_extra_js.html
@@ -16,6 +16,7 @@ IF bodyclass.match('mappage');
scripts.push( version('/cobrands/lincolnshire/assets.js') );
scripts.push( version('/cobrands/northamptonshire/assets.js') );
scripts.push( version('/cobrands/hounslow/assets.js') );
+ scripts.push( version('/cobrands/oxfordshire/assets.js') );
scripts.push( version('/cobrands/westminster/assets.js') );
scripts.push( version('/cobrands/peterborough/assets.js') );
scripts.push( version('/cobrands/tfl/assets.js') );
diff --git a/templates/web/oxfordshire/footer_extra_js.html b/templates/web/oxfordshire/footer_extra_js.html
index 12a42c0d2..bb65cec8b 100644
--- a/templates/web/oxfordshire/footer_extra_js.html
+++ b/templates/web/oxfordshire/footer_extra_js.html
@@ -1 +1 @@
-[% PROCESS 'footer_extra_js_base.html' highways=1 validation=1 roadworks=1 %]
+[% PROCESS 'footer_extra_js_base.html' highways=1 validation=1 roadworks=1 cobrand_js=1 %]
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 56055ec52..c42d900fc 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -549,15 +549,7 @@ function get_asset_stylemap() {
return new OpenLayers.StyleMap({
'default': fixmystreet.assets.style_default,
'select': fixmystreet.assets.style_default_select,
- 'hover': new OpenLayers.Style({
- fillColor: "#55BB00",
- fillOpacity: 0.8,
- strokeColor: "#000000",
- strokeOpacity: 1,
- strokeWidth: 2,
- pointRadius: 8,
- cursor: 'pointer'
- })
+ 'hover': fixmystreet.assets.style_default_hover
});
}
@@ -824,6 +816,16 @@ fixmystreet.assets = {
pointRadius: 6
}),
+ style_default_hover: new OpenLayers.Style({
+ fillColor: "#55BB00",
+ fillOpacity: 0.8,
+ strokeColor: "#000000",
+ strokeOpacity: 1,
+ strokeWidth: 2,
+ pointRadius: 8,
+ cursor: 'pointer'
+ }),
+
style_default_select: new OpenLayers.Style({
externalGraphic: pin_prefix + "pin-spot.png",
fillColor: "#55BB00",
diff --git a/web/cobrands/oxfordshire/assets.js b/web/cobrands/oxfordshire/assets.js
new file mode 100644
index 000000000..9bd38acac
--- /dev/null
+++ b/web/cobrands/oxfordshire/assets.js
@@ -0,0 +1,138 @@
+(function(){
+
+if (!fixmystreet.maps) {
+ return;
+}
+
+var wfs_host = fixmystreet.staging ? 'tilma.staging.mysociety.org' : 'tilma.mysociety.org';
+var tilma_url = "https://" + wfs_host + "/mapserver/oxfordshire";
+var proxy_base_url = "https://" + wfs_host + "/proxy/occ/";
+
+var defaults = {
+ wfs_url: tilma_url,
+ asset_type: 'spot',
+ max_resolution: 4.777314267158508,
+ geometryName: 'msGeometry',
+ srsName: "EPSG:3857",
+ body: "Oxfordshire County Council",
+ strategy_class: OpenLayers.Strategy.FixMyStreet
+};
+
+var occ_default = $.extend({}, fixmystreet.assets.style_default.defaultStyle, {
+ fillColor: "#007258"
+});
+
+var occ_hover = new OpenLayers.Style({
+ pointRadius: 8,
+ cursor: 'pointer'
+});
+
+var occ_stylemap = new OpenLayers.StyleMap({
+ 'default': occ_default,
+ 'select': fixmystreet.assets.style_default_select,
+ 'hover': occ_hover
+});
+
+fixmystreet.assets.add(defaults, {
+ stylemap: occ_stylemap,
+ wfs_feature: "Trees",
+ asset_id_field: 'Ref',
+ attributes: {
+ feature_id: 'Ref'
+ },
+ asset_category: ["Trees"],
+ asset_item: 'tree'
+});
+
+fixmystreet.assets.add(defaults, {
+ stylemap: occ_stylemap,
+ wfs_feature: "Traffic_Lights",
+ asset_id_field: 'Site',
+ attributes: {
+ feature_id: 'Site'
+ },
+ asset_category: ["Traffic Lights (permanent only)"],
+ asset_item: 'traffic light'
+});
+
+var streetlight_select = $.extend({
+ label: "${UNITNO}",
+ fontColor: "#FFD800",
+ labelOutlineColor: "black",
+ labelOutlineWidth: 3,
+ labelYOffset: 69,
+ fontSize: '18px',
+ fontWeight: 'bold'
+}, fixmystreet.assets.style_default_select.defaultStyle);
+
+var streetlight_stylemap = new OpenLayers.StyleMap({
+ 'default': occ_default,
+ 'select': new OpenLayers.Style(streetlight_select),
+ 'hover': occ_hover
+});
+
+fixmystreet.assets.add(defaults, {
+ select_action: true,
+ stylemap: streetlight_stylemap,
+ wfs_feature: "Street_Lights",
+ asset_id_field: 'UNITID',
+ attributes: {
+ feature_id: 'UNITID',
+ column_no: 'UNITNO'
+ },
+ asset_category: ["Street lighting"],
+ asset_item: 'street light',
+ feature_code: 'UNITNO',
+ actions: {
+ asset_found: fixmystreet.assets.named_select_action_found,
+ asset_not_found: fixmystreet.assets.named_select_action_not_found
+ }
+});
+
+var owned_defaults = $.extend({}, defaults, {
+ stylemap: occ_stylemap,
+ // have to do this by hand rather than using wfs_* options
+ // as the server does not like being POSTed xml with application/xml
+ // as the Content-Type which is what using those options results in.
+ http_options: {
+ headers: {
+ 'Content-Type': 'text/plain'
+ },
+ params: {
+ SERVICE: "WFS",
+ VERSION: "1.1.0",
+ REQUEST: "GetFeature",
+ SRSNAME: "urn:ogc:def:crs:EPSG::27700",
+ propertyName: 'id,maintained_by,msGeometry'
+ }
+ },
+ srsName: "EPSG:27700",
+ asset_id_field: 'id',
+ attributes: {
+ feature_id: 'id'
+ }
+});
+
+fixmystreet.assets.add(owned_defaults, {
+ http_options: {
+ url: proxy_base_url + 'drains/wfs',
+ params: {
+ TYPENAME: "junctions"
+ }
+ },
+ asset_category: ["Gully and Catchpits"],
+ asset_item: 'drain'
+});
+
+fixmystreet.assets.add(owned_defaults, {
+ http_options: {
+ url: proxy_base_url + 'grit/wfs',
+ params: {
+ TYPENAME: "Grit_bins"
+ }
+ },
+ asset_category: ["Ice/Snow"],
+ asset_item: 'grit bin'
+});
+
+})();
diff --git a/web/cobrands/oxfordshire/base.scss b/web/cobrands/oxfordshire/base.scss
index 9fd4bc2ad..a5f7a43d6 100644
--- a/web/cobrands/oxfordshire/base.scss
+++ b/web/cobrands/oxfordshire/base.scss
@@ -279,6 +279,10 @@ textarea {
color: $color-oxfordshire-link-blue;
}
+.asset-spot:before {
+ background-color: #007258;
+}
+
@media print {
body {
background-color: #fff !important;