1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
(function(){
if (!fixmystreet.maps) {
return;
}
var defaults = {
http_options: {
url: "https://tilma.staging.mysociety.org/mapserver/bromley_wfs",
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: 4.777314267158508,
min_resolution: 0.5971642833948135,
asset_id_field: 'CENTRAL_AS',
geometryName: 'msGeometry',
srsName: "EPSG:3857",
body: "Bromley Council",
strategy_class: OpenLayers.Strategy.FixMyStreet
};
OpenLayers.Layer.VectorAssetBromley = OpenLayers.Class(OpenLayers.Layer.VectorAsset, {
relevant: function() {
var relevant = OpenLayers.Layer.VectorAsset.prototype.relevant.apply(this, arguments),
subcategories = this.fixmystreet.subcategories,
subcategory = $('#form_service_sub_code').val(),
relevant_sub = OpenLayers.Util.indexOf(subcategories, subcategory) > -1;
return relevant && relevant_sub;
},
CLASS_NAME: 'OpenLayers.Layer.VectorAssetBromley'
});
fixmystreet.assets.add($.extend(true, {}, defaults, {
class: OpenLayers.Layer.VectorAssetBromley,
http_options: {
params: {
TYPENAME: "Streetlights"
}
},
asset_id_field: 'FEATURE_ID',
attributes: {
feature_id: 'FEATURE_ID'
},
asset_category: ["Street Lighting and Road Signs"],
subcategories: [ 'SL_LAMP', 'SL_NOT_WORK', 'SL_ON_DAY', 'SL_BLOCK_VEG' ],
asset_item: 'street light'
}));
fixmystreet.assets.add($.extend(true, {}, defaults, {
class: OpenLayers.Layer.VectorAssetBromley,
http_options: {
params: {
TYPENAME: "Bins"
}
},
asset_category: ["Parks and Greenspace", "Street Cleansing"],
subcategories: ['PG_OFLOW_DOG', 'SC_LIT_BIN'],
asset_item: 'park bin',
asset_item_message: 'For our parks, pick a <b class="asset-spot">bin</b> from the map »'
}));
fixmystreet.assets.add($.extend(true, {}, defaults, {
http_options: {
params: {
TYPENAME: "Street_Trees"
}
},
asset_category: ["Public Trees"],
asset_item: 'tree'
}));
var highways_stylemap = new OpenLayers.StyleMap({
'default': new OpenLayers.Style({
fill: false,
stroke: false
})
});
var bromley_to_tfl = {
'Enforcement': ['ENF_NUI_SIGN', 'ENF_OBS_HIGH', 'ENF_OHANG_HANG', 'ENF_UNLIC_HIGH'],
'Graffiti and Flyposting': ['GF_NUI_SIGN'],
'Parks and Greenspace': ['PG_BLOC_DRAIN', 'PG_FLO_DISP', 'PG_GRASS_CUT'],
'Street Cleansing': ['SC_BLOCK_DRAIN'],
'Road and Pavement Issues': true,
'Street Lighting and Road Signs': true,
'Public Trees': true
};
var tfl_asset_categories = Object.keys(bromley_to_tfl);
$(function(){
$("#problem_form").on("change.category", "#form_service_sub_code", function() {
$(fixmystreet).trigger('report_new:category_change', [ $('#form_category') ]);
});
});
fixmystreet.assets.add($.extend(true, {}, defaults, {
http_options: {
params: {
TYPENAME: "TFL_Red_Route"
}
},
stylemap: highways_stylemap,
always_visible: true,
asset_category: tfl_asset_categories,
non_interactive: true,
road: true,
body: 'Bromley Council',
actions: {
found: function(layer, feature) {
var category = $('select#form_category').val(),
subcategory = $('#form_service_sub_code').val(),
subcategories = bromley_to_tfl[category],
relevant = (subcategories === true || (subcategory && OpenLayers.Util.indexOf(subcategories, subcategory) > -1));
if (!fixmystreet.assets.selectedFeature() && relevant) {
fixmystreet.body_overrides.only_send('TfL');
} else {
fixmystreet.body_overrides.remove_only_send();
}
},
not_found: function(layer) {
fixmystreet.body_overrides.remove_only_send();
}
}
}));
var prow_stylemap = new OpenLayers.StyleMap({
'default': new OpenLayers.Style({
fill: false,
fillOpacity: 0,
strokeColor: "#660099",
strokeOpacity: 0.5,
strokeWidth: 6
})
});
fixmystreet.assets.add($.extend(true, {}, defaults, {
http_options: {
params: {
TYPENAME: "PROW"
}
},
stylemap: prow_stylemap,
always_visible: true,
non_interactive: true,
road: true,
all_categories: true,
actions: {
found: function(layer, feature) {
$('#form_prow_reference').val(feature.attributes.PROW_REFER);
},
not_found: function(layer) {
$('#form_prow_reference').val('');
}
}
}));
})();
|