Symbolizer defaults for the select renderIntent
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
goog.provide('ol.interaction.Select');
|
goog.provide('ol.interaction.Select');
|
||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.interaction.ConditionType');
|
goog.require('ol.interaction.ConditionType');
|
||||||
goog.require('ol.interaction.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
@@ -114,11 +113,9 @@ ol.interaction.Select.prototype.select =
|
|||||||
}
|
}
|
||||||
var selectionLayer = this.selectionLayers[mapId].layers[layerId];
|
var selectionLayer = this.selectionLayers[mapId].layers[layerId];
|
||||||
if (!goog.isDef(selectionLayer)) {
|
if (!goog.isDef(selectionLayer)) {
|
||||||
goog.asserts.assertFunction(layer.getStyle,
|
|
||||||
'At least one of the layers has no "getStyle()" function.');
|
|
||||||
selectionLayer = new ol.layer.Vector({
|
selectionLayer = new ol.layer.Vector({
|
||||||
source: new ol.source.Vector({parser: null}),
|
source: new ol.source.Vector({parser: null}),
|
||||||
style: layer.getStyle()
|
style: goog.isFunction(layer.getStyle) ? layer.getStyle() : null
|
||||||
});
|
});
|
||||||
selectionLayer.setTemporary(true);
|
selectionLayer.setTemporary(true);
|
||||||
map.addLayer(selectionLayer);
|
map.addLayer(selectionLayer);
|
||||||
|
|||||||
@@ -116,10 +116,20 @@ ol.style.Fill.prototype.setOpacity = function(opacity) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{fillColor: (string),
|
* @typedef {{color: (string),
|
||||||
* fillOpacity: (number)}}
|
* opacity: (number)}}
|
||||||
*/
|
*/
|
||||||
ol.style.FillDefaults = {
|
ol.style.FillDefaults = {
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
opacity: 0.4
|
opacity: 0.4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{color: (string),
|
||||||
|
* opacity: (number)}}
|
||||||
|
*/
|
||||||
|
ol.style.FillDefaultsSelect = {
|
||||||
|
color: '#ffffff',
|
||||||
|
opacity: 0.7
|
||||||
|
};
|
||||||
|
|||||||
@@ -158,12 +158,24 @@ ol.style.Stroke.prototype.setWidth = function(width) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{strokeColor: (string),
|
* @typedef {{color: (string),
|
||||||
* strokeOpacity: (number),
|
* opacity: (number),
|
||||||
* strokeWidth: (number)}}
|
* width: (number)}}
|
||||||
*/
|
*/
|
||||||
ol.style.StrokeDefaults = {
|
ol.style.StrokeDefaults = {
|
||||||
color: '#696969',
|
color: '#696969',
|
||||||
opacity: 0.75,
|
opacity: 0.75,
|
||||||
width: 1.5
|
width: 1.5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{color: (string),
|
||||||
|
* opacity: (number),
|
||||||
|
* width: (number)}}
|
||||||
|
*/
|
||||||
|
ol.style.StrokeDefaultsSelect = {
|
||||||
|
color: '#696969',
|
||||||
|
opacity: 0.9,
|
||||||
|
width: 2.0
|
||||||
|
};
|
||||||
|
|||||||
@@ -67,6 +67,19 @@ ol.style.Style.prototype.createLiterals = function(feature) {
|
|||||||
* @type {ol.style.Style}
|
* @type {ol.style.Style}
|
||||||
*/
|
*/
|
||||||
ol.style.Style.defaults = new ol.style.Style({
|
ol.style.Style.defaults = new ol.style.Style({
|
||||||
|
rules: [
|
||||||
|
new ol.style.Rule({
|
||||||
|
filter: 'renderIntent("select")',
|
||||||
|
symbolizers: [
|
||||||
|
new ol.style.Shape({
|
||||||
|
fill: new ol.style.Fill(ol.style.FillDefaultsSelect),
|
||||||
|
stroke: new ol.style.Stroke(ol.style.StrokeDefaultsSelect)
|
||||||
|
}),
|
||||||
|
new ol.style.Fill(ol.style.FillDefaultsSelect),
|
||||||
|
new ol.style.Stroke(ol.style.StrokeDefaultsSelect)
|
||||||
|
]
|
||||||
|
})
|
||||||
|
],
|
||||||
symbolizers: [
|
symbolizers: [
|
||||||
new ol.style.Shape({
|
new ol.style.Shape({
|
||||||
fill: new ol.style.Fill(),
|
fill: new ol.style.Fill(),
|
||||||
|
|||||||
Reference in New Issue
Block a user