diff options
author | Dave Arter <davea@mysociety.org> | 2018-06-14 15:52:11 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-08-17 11:04:19 +0100 |
commit | b0c5155b23f4d792df669c7951f2e925ad84f964 (patch) | |
tree | 0b6745fe2d5acd30f0729e3e303cd2caa30f23f8 /web | |
parent | 7f95b46a2516a5104c699bd03231a7a7d8f88a1d (diff) |
[Lincolnshire] Add assets to map & roadworks.org integration
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/lincolnshire/assets.js | 231 | ||||
-rw-r--r-- | web/cobrands/lincolnshire/base.scss | 10 | ||||
-rw-r--r-- | web/cobrands/lincolnshire/roadworks.js | 42 |
3 files changed, 283 insertions, 0 deletions
diff --git a/web/cobrands/lincolnshire/assets.js b/web/cobrands/lincolnshire/assets.js new file mode 100644 index 000000000..40187e188 --- /dev/null +++ b/web/cobrands/lincolnshire/assets.js @@ -0,0 +1,231 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +var defaults = { + http_options: { + url: "https://tilma.mysociety.org/mapserver/lincs", + params: { + SERVICE: "WFS", + VERSION: "1.1.0", + REQUEST: "GetFeature", + SRSNAME: "urn:ogc:def:crs:EPSG::3857" + } + }, + format_class: OpenLayers.Format.GML.v3.MultiCurveFix, + asset_type: 'spot', + max_resolution: 2.388657133579254, + min_resolution: 0.5971642833948135, + asset_id_field: 'Confirm_CA', + attributes: { + central_asset_id: 'Confirm_CA', + asset_details: 'Asset_Id' + }, + geometryName: 'msGeometry', + srsName: "EPSG:3857", + strategy_class: OpenLayers.Strategy.FixMyStreet, + body: "Lincolnshire County Council" +}; + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "SL_Bollards" + } + }, + asset_category: "Bollards (lit)", + asset_item: 'bollard' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "SL_Street_Light_Units" + } + }, + asset_category: "Street light", + asset_item: 'street light', + filter_key: 'Type', + filter_value: [ + "SL: Bulkhead Lighting", "SL: Refuge Beacon", "SL: Street Lighting Unit" + ] +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "SL_Street_Light_Units" + } + }, + asset_category: "Subway light", + asset_item: 'light', + filter_key: 'Type', + filter_value: "SL: Subway Lighting Unit" +})); + +function get_barrier_stylemap() { + return new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + strokeColor: "#000000", + strokeOpacity: 0.9, + strokeWidth: 4 + }), + 'select': new OpenLayers.Style({ + strokeColor: "#55BB00", + strokeOpacity: 1, + strokeWidth: 8 + }), + 'hover': new OpenLayers.Style({ + strokeWidth: 6, + strokeOpacity: 1, + strokeColor: "#FFFF00", + cursor: 'pointer' + }) + }); +} + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Safety_Barriers" + } + }, + asset_category: ["Roadside safety barrier", "Missing safety fence"], + asset_item: 'barrier or fence', + filter_key: 'Type', + filter_value: "ST: Safety Barrier", + stylemap: get_barrier_stylemap(), + max_resolution: 1.194328566789627 +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "LCC_Drainage-GulliesOffletsManholes" + } + }, + asset_category: "Blocked drain", + asset_item: 'drain' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "ST_All_Structures" + } + }, + asset_category: "Damaged dyke, ditch or culvert", + asset_item: 'culvert', + filter_key: 'Type', + filter_value: [ + "ST: Culvert 1 Cell", "ST: Culvert 2+ Cells", "ST: Culvert/Pipe" + ] +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "SL_Lit_Signs" + } + }, + asset_category: "Sign (lit)", + asset_item: 'street sign' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "ST_All_Structures" + } + }, + asset_category: "Bridge", + asset_item: 'bridge', + filter_key: 'Type', + filter_value: [ + "ST: Bridge", "ST: Bridge Ped/Cycle 1 Span", + "ST: Bridge Ped/Cycle 2+ Spans", "ST: Bridge Vehicular 1 Span", + "ST: Bridge Vehicular 2-3 Spans", "ST: Bridge Vehicular 4+ Spans" + ] +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Carriageway" + } + }, + asset_category: [ + "Damaged/missing cats eye", + "Damaged road edge, encroaches less than 100mm", + "Damaged road edge, encroaches more than 100mm", + "Loose chippings", + "Manhole/drain cover on road/cycleway", + "Obstruction on road/cycleway", + "Pothole on road/cycleway", + "Road markings faded/missing", + "Road surface issue" + ], + asset_item: 'road', + asset_item_message: null, + disable_pin_snapping: true, + stylemap: new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fill: false, + stroke: false + }) + }) +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "NSG" + } + }, + always_visible: true, + non_interactive: true, + usrn: { + attribute: 'Site_Code', + field: 'site_code' + }, + stylemap: new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fill: false, + stroke: false + }) + }) + +})); + +var llpg_stylemap = new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fillOpacity: 0, + strokeColor: "#000000", + strokeOpacity: 0.25, + strokeWidth: 2, + pointRadius: 10, + + label: "${label}", + labelOutlineColor: "white", + labelOutlineWidth: 2, + fontSize: '11px', + fontWeight: 'bold' + }) +}); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "LLPG" + } + }, + // LLPG is only to be shown when fully zoomed in + max_resolution: 0.5971642833948135, + stylemap: llpg_stylemap, + non_interactive: true, + always_visible: true +})); + +})(); diff --git a/web/cobrands/lincolnshire/base.scss b/web/cobrands/lincolnshire/base.scss index 468a678e4..1d045f4ea 100644 --- a/web/cobrands/lincolnshire/base.scss +++ b/web/cobrands/lincolnshire/base.scss @@ -142,6 +142,16 @@ body.mappage .big-green-banner { padding: 2em 0 3em; } +.js-roadworks-message dd:last-child { + margin-bottom: 0; +} + +// Certain categories have linear assets so hide the spot marker in the guidance +#category_meta_message_Missingsafetyfence, #category_meta_message_Roadsidesafetybarrier { + .asset-spot:before { + display: none; + } +} // admin diff --git a/web/cobrands/lincolnshire/roadworks.js b/web/cobrands/lincolnshire/roadworks.js new file mode 100644 index 000000000..a9fa64bb6 --- /dev/null +++ b/web/cobrands/lincolnshire/roadworks.js @@ -0,0 +1,42 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +fixmystreet.roadworks.display_message = function(feature) { + var attr = feature.attributes, + start = new Date(attr.start.replace(/{ts '([^ ]*).*/, '$1')).toDateString(), + end = new Date(attr.end.replace(/{ts '([^ ]*).*/, '$1')).toDateString(), + tooltip = attr.tooltip.replace(/\\n/g, '\n'), + desc = attr.works_desc.replace(/\\n/g, '\n'); + + var $msg = $('<div class="js-roadworks-message box-warning"><p>Roadworks are scheduled near this location, so you may not need to report your issue.</p></div>'); + var $dl = $("<dl></dl>").appendTo($msg); + $dl.append("<dt>Dates</dt>"); + $dl.append($("<dd></dd>").text(start + " until " + end)); + $dl.append("<dt>Summary</dt>"); + var $summary = $("<dd></dd>").appendTo($dl); + tooltip.split("\n").forEach(function(para) { + if (para.match(/^(\d{2}\s+\w{3}\s+(\d{2}:\d{2}\s+)?\d{4}( - )?){2}/)) { + // skip showing the date again + return; + } + $summary.append(para).append("<br />"); + }); + if (desc) { + $dl.append("<dt>Description</dt>"); + $dl.append($("<dd></dd>").text(desc)); + } + + $('.change_location').after($msg); +}; + +fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_future, { + http_options: { params: { organisation_id: '1070' } }, + body: "Lincolnshire County Council" +})); +// NB Lincs don't want forward planning works displayed, so +// fixmystreet.roadworks.layer_planned is deliberately missing here. + +})(); |