diff --git a/src/script/plugins/VectorStyleWriter.js b/src/script/plugins/VectorStyleWriter.js index 01d306c5..cb2655a6 100644 --- a/src/script/plugins/VectorStyleWriter.js +++ b/src/script/plugins/VectorStyleWriter.js @@ -169,9 +169,9 @@ gxp.plugins.VectorStyleWriter = Ext.extend(gxp.plugins.StyleWriter, { textStyle.fontWeight = symbolizer.fontWeight; textStyle.fontStyle = symbolizer.fontStyle; textStyle.fontColor = symbolizer.fontColor; + textStyle.fontOpacity = symbolizer.fontOpacity; } rule.symbolizer[symbolType] = rule.symbolizers[j].clone(); - // newStyle.label = rule.symbolizer[symbolType].label; } rule.symbolizers = undefined; } diff --git a/src/script/widgets/VectorStylesDialog.js b/src/script/widgets/VectorStylesDialog.js index 2164bc88..24e2107b 100644 --- a/src/script/widgets/VectorStylesDialog.js +++ b/src/script/widgets/VectorStylesDialog.js @@ -87,6 +87,11 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, { */ editRule: function () { var rule = this.selectedRule; + // May need TextSymbolizer if here first time and feature has data attrs + if (!this.textSym && this.attributeStore && this.attributeStore.data.getCount() > 0) { + rule.symbolizers.push(this.createSymbolizer('Text', {})); + this.textSym = true; + } var origRule = rule.clone(); var ruleDlg = new this.dialogCls({ @@ -165,6 +170,8 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, { if (textSymbolizers && textSymbolizers.length == 1) { var textSymbolizer = textSymbolizers[0]; removeItems = textSymbolizer.items.getRange(3, 7); + + // Remove all from range for (i = 0; i < removeItems.length; i++) { textSymbolizer.remove(removeItems[i]); } @@ -245,6 +252,7 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, { } symbolizer = this.createSymbolizer(symbol, style.defaultStyle); symbolizers = [symbolizer]; + style.rules = [new OpenLayers.Rule({title: style.name, symbolizers: symbolizers})]; // style.defaultsPerSymbolizer = true; } @@ -362,11 +370,12 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, { listeners: { 'load': function (store) { self.layerDescription = self.attributeStore; - // The TextSymbolizer calls load() as well, leading to loop + // The TextSymbolizer calls load() as well, leading to loop // when we would call editRule() again... // prevent by makin load() function empty... // We should fix this in TextSymbolizer but there is a risk to break other stuff... - store.load = function() {}; + store.load = function () { + }; callback.call(self); }, scope: this