aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/cobrands/bathnes/assets.js39
-rw-r--r--web/cobrands/bexley/js.js38
-rw-r--r--web/cobrands/bromley/assets.js9
-rw-r--r--web/cobrands/buckinghamshire/assets.js31
-rw-r--r--web/cobrands/fixmystreet/assets.js66
-rw-r--r--web/cobrands/highways/assets.js9
-rw-r--r--web/cobrands/hounslow/assets.js38
-rw-r--r--web/cobrands/lincolnshire/assets.js15
8 files changed, 57 insertions, 188 deletions
diff --git a/web/cobrands/bathnes/assets.js b/web/cobrands/bathnes/assets.js
index fd1386480..7a32facc9 100644
--- a/web/cobrands/bathnes/assets.js
+++ b/web/cobrands/bathnes/assets.js
@@ -68,12 +68,7 @@ fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
],
asset_item: "park",
disable_pin_snapping: true,
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- }),
+ stylemap: fixmystreet.assets.stylemap_invisible,
attributes: {
asset_details: function() {
var a = this.attributes;
@@ -161,35 +156,15 @@ var rule_not_owned = new OpenLayers.Rule({
});
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
- }),
+ 'select': fixmystreet.assets.style_default_select,
'hover': new OpenLayers.Style({
pointRadius: 8,
cursor: 'pointer'
})
-
});
-
fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
http_options: {
params: {
@@ -213,21 +188,13 @@ fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
}
});
-
-var highways_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
-});
-
fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
http_options: {
params: {
TYPENAME: "AdoptedHighways"
}
},
- stylemap: highways_stylemap,
+ stylemap: fixmystreet.assets.stylemap_invisible,
non_interactive: true,
always_visible: true,
usrn: {
diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js
index 27694f772..907185aea 100644
--- a/web/cobrands/bexley/js.js
+++ b/web/cobrands/bexley/js.js
@@ -23,42 +23,17 @@ var defaults = {
strategy_class: OpenLayers.Strategy.FixMyStreet
};
-var streetlight_default = {
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
-};
-
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var streetlight_select = {
- 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,
-
+var streetlight_select = $.extend({
label: "${Unit_No}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
-};
+}, fixmystreet.assets.style_default_select.defaultStyle);
var streetlight_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(streetlight_default),
+ 'default': fixmystreet.assets.style_default,
'select': new OpenLayers.Style(streetlight_select)
});
@@ -100,12 +75,7 @@ fixmystreet.assets.add(defaults, {
attribute: 'NSG_REF',
field: 'NSGRef'
},
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
+ stylemap: fixmystreet.assets.stylemap_invisible
});
fixmystreet.assets.add(labeled_defaults, {
diff --git a/web/cobrands/bromley/assets.js b/web/cobrands/bromley/assets.js
index d5386d9af..c1f22f529 100644
--- a/web/cobrands/bromley/assets.js
+++ b/web/cobrands/bromley/assets.js
@@ -76,13 +76,6 @@ fixmystreet.assets.add(defaults, {
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'],
@@ -106,7 +99,7 @@ fixmystreet.assets.add(defaults, {
TYPENAME: "TFL_Red_Route"
}
},
- stylemap: highways_stylemap,
+ stylemap: fixmystreet.assets.stylemap_invisible,
always_visible: true,
asset_category: tfl_asset_categories,
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index 7b27a84f2..fe54c32fe 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -42,42 +42,17 @@ fixmystreet.assets.add(defaults, {
asset_item: 'grit bin'
});
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var streetlight_default = {
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
-};
-
-var streetlight_select = {
- 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,
-
+var streetlight_select = $.extend({
label: "${feature_id}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
-};
+}, fixmystreet.assets.style_default_select.defaultStyle);
var streetlight_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(streetlight_default),
+ 'default': fixmystreet.assets.style_default,
'select': new OpenLayers.Style(streetlight_select)
});
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 1d2bc3206..15ac3a9a3 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -452,34 +452,9 @@ function layer_loadend() {
}
function get_asset_stylemap() {
- // 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');
-
return new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
- }),
- '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
- }),
+ 'default': fixmystreet.assets.style_default,
+ 'select': fixmystreet.assets.style_default_select,
'hover': new OpenLayers.Style({
fillColor: "#55BB00",
fillOpacity: 0.8,
@@ -505,10 +480,47 @@ function get_fault_stylemap() {
});
}
+// fixmystreet.pin_prefix isn't always available here, due
+// to file loading order, so get it from the DOM directly.
+var map_data = document.getElementById('js-map-data');
+var pin_prefix = fixmystreet.pin_prefix || (map_data ? map_data.getAttribute('data-pin_prefix') : '/i/');
+
fixmystreet.assets = {
layers: [],
controls: [],
+ stylemap_invisible: new OpenLayers.StyleMap({
+ 'default': new OpenLayers.Style({
+ fill: false,
+ stroke: false
+ })
+ }),
+
+ style_default: new OpenLayers.Style({
+ fillColor: "#FFFF00",
+ fillOpacity: 0.6,
+ strokeColor: "#000000",
+ strokeOpacity: 0.8,
+ strokeWidth: 2,
+ pointRadius: 6
+ }),
+
+ style_default_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
+ }),
+
selectedFeature: function() {
return selected_feature;
},
diff --git a/web/cobrands/highways/assets.js b/web/cobrands/highways/assets.js
index 8f4734131..f24ad66f5 100644
--- a/web/cobrands/highways/assets.js
+++ b/web/cobrands/highways/assets.js
@@ -24,20 +24,13 @@ var defaults = {
strategy_class: OpenLayers.Strategy.FixMyStreet
};
-var highways_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false,
- })
-});
-
fixmystreet.assets.add(defaults, {
http_options: {
params: {
TYPENAME: "Highways"
}
},
- stylemap: highways_stylemap,
+ stylemap: fixmystreet.assets.stylemap_invisible,
always_visible: true,
non_interactive: true,
diff --git a/web/cobrands/hounslow/assets.js b/web/cobrands/hounslow/assets.js
index e6d3383ff..918123141 100644
--- a/web/cobrands/hounslow/assets.js
+++ b/web/cobrands/hounslow/assets.js
@@ -114,39 +114,14 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
// asset_item: 'gulley'
// }));
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var streetlight_default = {
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
-};
-
-var streetlight_select = {
- 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,
-
+var streetlight_select = $.extend({
label: "${FeatureId}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
-};
+}, fixmystreet.assets.style_default_select.defaultStyle);
// The label for street light markers should be everything after the final
// '/' in the feature's FeatureId attribute.
@@ -162,7 +137,7 @@ select_style.createLiterals = function() {
};
var streetlight_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(streetlight_default),
+ 'default': fixmystreet.assets.style_default,
'select': select_style
});
@@ -229,12 +204,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
attribute: 'SITE_CODE',
field: 'site_code'
},
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
+ stylemap: fixmystreet.assets.stylemap_invisible
}));
diff --git a/web/cobrands/lincolnshire/assets.js b/web/cobrands/lincolnshire/assets.js
index b36b04b64..afe6abf8f 100644
--- a/web/cobrands/lincolnshire/assets.js
+++ b/web/cobrands/lincolnshire/assets.js
@@ -173,12 +173,7 @@ fixmystreet.assets.add(defaults, {
asset_item: 'road',
asset_item_message: null,
disable_pin_snapping: true,
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
+ stylemap: fixmystreet.assets.stylemap_invisible
});
fixmystreet.assets.add(defaults, {
@@ -193,13 +188,7 @@ fixmystreet.assets.add(defaults, {
attribute: 'Site_Code',
field: 'site_code'
},
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
-
+ stylemap: fixmystreet.assets.stylemap_invisible
});
var llpg_stylemap = new OpenLayers.StyleMap({