aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands/bathnes/js.js
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2019-10-30 19:28:55 +0100
committerMarius Halden <marius.h@lden.org>2019-10-30 19:28:55 +0100
commit377bd96aab7cad3434185c30eb908c9da447fe40 (patch)
tree7ec5527e205d5b62caaa862a7de8cd25199c8bf0 /web/cobrands/bathnes/js.js
parent56f61b1441070aa0b9ddcfc74aca46c20313609f (diff)
parent92b253904062edd533e55c22824de6fd01e2f7c1 (diff)
Merge tag 'v2.6' into fiksgatami-dev
Diffstat (limited to 'web/cobrands/bathnes/js.js')
-rw-r--r--web/cobrands/bathnes/js.js206
1 files changed, 25 insertions, 181 deletions
diff --git a/web/cobrands/bathnes/js.js b/web/cobrands/bathnes/js.js
index 84c9c56f5..afc7df44d 100644
--- a/web/cobrands/bathnes/js.js
+++ b/web/cobrands/bathnes/js.js
@@ -4,191 +4,35 @@ if (!fixmystreet.maps) {
return;
}
-fixmystreet.maps.banes_defaults = {
- http_options: {
- url: "https://isharemaps.bathnes.gov.uk/getows.ashx",
- params: {
- mapsource: "BathNES/WFS",
- SERVICE: "WFS",
- VERSION: "1.1.0",
- REQUEST: "GetFeature",
- TYPENAME: "",
- SRSNAME: "urn:ogc:def:crs:EPSG::27700",
- outputFormat: 'application/json'
- }
- },
- format_class: OpenLayers.Format.GeoJSON,
- format_options: {ignoreExtraDims: true},
- strategy_class: OpenLayers.Strategy.FixMyStreet,
- asset_category: "",
- asset_item: "asset",
- asset_type: 'spot',
- max_resolution: 2.388657133579254,
- min_resolution: 0.5971642833948135,
- asset_id_field: 'feature_no',
- attributes: null,
- geometryName: 'msGeometry',
- srsName: "EPSG:27700"
+fixmystreet.roadworks.config = {
+ tag_top: 'h3',
+ colon: true,
+ skip_delays: true,
+ text_after: "<p>If you think this issue needs immediate attention you can continue your report below</p>"
};
+fixmystreet.roadworks.filter = function(feature) {
+ var category = $('select#form_category').val(),
+ parts = feature.attributes.symbol.split(''),
+ valid_types = ['h', 'n', 'l', 'w'],
+ valid_subtypes = ['15', '25'],
+ type = parts[2],
+ sub_type = parts[4] + parts[5],
+ categories = ['Damage to pavement', 'Damage to road', 'Faded road markings', 'Damaged Railing, manhole, or drain cover'];
+ return OpenLayers.Util.indexOf(categories, category) != -1 &&
+ ( OpenLayers.Util.indexOf(valid_types, type) != -1 ||
+ ( type === 'o' && OpenLayers.Util.indexOf(valid_subtypes, sub_type) != -1 ) );
+};
-fixmystreet.assets.add($.extend(true, {}, fixmystreet.maps.banes_defaults, {
- http_options: {
- params: {
- TYPENAME: "Gritbins"
- }
- },
- asset_category: "Grit bin issue",
- asset_item: "grit bin",
- attributes: {
- asset_details: 'feature_location'
- }
-}));
-
-
-
-/*
- * Street lights are included/styled according to their owner.
- */
-
-var banes_ownernames = [
- "B&NES CAR PARKS",
- "B&NES PARKS",
- "B&NES PROPERTY",
- "B&NES HIGHWAYS"
-];
-
-// Some are excluded from the map entirely
-var exclude_ownernames = [
- "EXCEPTIONS"
-];
-
-function include_feature(f) {
- return f &&
- f.attributes &&
- f.attributes.ownername &&
- exclude_ownernames.indexOf(f.attributes.ownername) == -1;
-}
-
-function banes_owns_feature(f) {
- return f &&
- f.attributes &&
- f.attributes.ownername &&
- banes_ownernames.indexOf(f.attributes.ownername) > -1 &&
- include_feature(f);
-}
-
-function banes_does_not_own_feature(f) {
- return !banes_owns_feature(f) &&
- include_feature(f);
-}
-
-var lighting_default_style = new OpenLayers.Style({
- fillColor: "#868686",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.6,
- strokeWidth: 2,
- pointRadius: 4,
- title: '${unitdescription} ${unitno}\r\nNot owned by B&NES. Owned by ${ownername}.'
-});
-
-var rule_owned = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.FeatureId({
- type: OpenLayers.Filter.Function,
- evaluate: banes_owns_feature
- }),
- symbolizer: {
- fillColor: "#FFFF00",
- pointRadius: 6,
- title: '${unitdescription} ${unitno}',
- }
-});
-
-var rule_not_owned = new OpenLayers.Rule({
- filter: new OpenLayers.Filter.FeatureId({
- type: OpenLayers.Filter.Function,
- evaluate: banes_does_not_own_feature
- })
-});
-lighting_default_style.addRules([rule_owned, rule_not_owned]);
-
-// XXX fixmystreet.pin_prefix isn't always available here (e.g. on /report/new),
-// so get it from the DOM directly
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var lighting_stylemap = new OpenLayers.StyleMap({
- 'default': lighting_default_style,
- 'select': new OpenLayers.Style({
- externalGraphic: pin_prefix + "pin-spot.png",
- fillColor: "#55BB00",
- graphicWidth: 48,
- graphicHeight: 64,
- graphicXOffset: -24,
- graphicYOffset: -56,
- backgroundGraphic: pin_prefix + "pin-shadow.png",
- backgroundWidth: 60,
- backgroundHeight: 30,
- backgroundXOffset: -7,
- backgroundYOffset: -22,
- popupYOffset: -40,
- graphicOpacity: 1.0
- }),
- 'hover': new OpenLayers.Style({
- pointRadius: 8,
- cursor: 'pointer'
- })
-
-});
-
-
-fixmystreet.assets.add($.extend(true, {}, fixmystreet.maps.banes_defaults, {
- http_options: {
- params: {
- TYPENAME: "StreetLighting"
- }
- },
- asset_category: "Street Light Fault",
- asset_item: "street light",
- stylemap: lighting_stylemap,
- attributes: {
- unitid: "unitid",
- asset_details: function() {
- var a = this.attributes;
- return "street: " + a.street + "\n" +
- "owner: " + a.ownername + "\n" +
- "unitno: " + a.unitno + "\n" +
- "lamp: " + a.lamp + "\n" +
- "lampclass: " + a.lampclass + "\n" +
- "description: " + a.unitdescription;
- }
- }
+var org_id = '114';
+var body = "Bath and North East Somerset Council";
+fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_future, {
+ http_options: { params: { organisation_id: org_id } },
+ body: body
}));
-
-
-var highways_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
-});
-
-fixmystreet.assets.add($.extend(true, {}, fixmystreet.maps.banes_defaults, {
- http_options: {
- params: {
- TYPENAME: "AdoptedHighways"
- }
- },
- stylemap: highways_stylemap,
- non_interactive: true,
- always_visible: true,
- usrn: {
- attribute: 'usrn',
- field: 'site_code'
- },
- name: "Adopted Highways",
- attribution: " © Crown Copyright. All rights reserved. 1000233344"
+fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_planned, {
+ http_options: { params: { organisation_id: org_id } },
+ body: body
}));
-
})();