Skip to content

Commit

Permalink
issue planetfederal#216 - fix per-layer redraw wtih styling
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Feb 4, 2014
1 parent c749071 commit c9caa74
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/script/plugins/VectorStyleWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,27 @@ gxp.plugins.VectorStyleWriter = Ext.extend(gxp.plugins.StyleWriter, {
var layerStyles = layer.styleMap;
var controls = layer.map.getControlsByClass("OpenLayers.Control.SelectFeature");

/* if (controls && controls.length > 0 && layerSelectStyle) {
var layerDefaultStyle = layerStyles.styles['default'].clone();
var layerSelectStyle = layerStyles.styles['select'];
var selectStyleHash = OpenLayers.Util.extend(layerDefaultStyle.defaultStyle, layerSelectStyle.defaultStyle);
var selectStyle = selectStyleHash; // new OpenLayers.Style(selectStyleHash);
for (var index = 0; index < controls.length; index++) {
var control = controls[index];
if (control.layers && control.layers.length > 0) {
for (var l = 0; l < control.layers.length; l++) {
if (control.layers[l].id == layer.id) {
control.selectStyle = selectStyle;
break;
}
}
} else if (control.layer && control.layer.id == layer.id) {
control.selectStyle = selectStyle;
break;
}
}
} */
/* if (controls && controls.length > 0 && layerSelectStyle) {
var layerDefaultStyle = layerStyles.styles['default'].clone();
var layerSelectStyle = layerStyles.styles['select'];
var selectStyleHash = OpenLayers.Util.extend(layerDefaultStyle.defaultStyle, layerSelectStyle.defaultStyle);
var selectStyle = selectStyleHash; // new OpenLayers.Style(selectStyleHash);
for (var index = 0; index < controls.length; index++) {
var control = controls[index];
if (control.layers && control.layers.length > 0) {
for (var l = 0; l < control.layers.length; l++) {
if (control.layers[l].id == layer.id) {
control.selectStyle = selectStyle;
break;
}
}
} else if (control.layer && control.layer.id == layer.id) {
control.selectStyle = selectStyle;
break;
}
}
} */
var styleRec = this.target.selectedStyle;
if (styleRec) {
// var oldStyleName = styleRec.get("userStyle").name;
Expand Down Expand Up @@ -210,9 +210,11 @@ gxp.plugins.VectorStyleWriter = Ext.extend(gxp.plugins.StyleWriter, {
delete feature.style;
}
feature.style = newStyle.createSymbolizer(feature);
layer.drawFeature(feature);
} else {
layer.drawFeature(feature, newStyle.createSymbolizer(feature));
}

layer.drawFeature(feature);
}

// Emit this proprietary event, for example to have VectorLegend update itself
Expand Down

0 comments on commit c9caa74

Please sign in to comment.