diff --git a/src/script/locale/en.js b/src/script/locale/en.js index 995cd8da..83c8384d 100644 --- a/src/script/locale/en.js +++ b/src/script/locale/en.js @@ -249,15 +249,15 @@ GeoExt.Lang.add("en", { }, "gxp.PointSymbolizer.prototype": { - graphicCircleText: "circle", - graphicSquareText: "square", - graphicTriangleText: "triangle", - graphicStarText: "star", - graphicCrossText: "cross", - graphicXText: "x", - graphicExternalText: "external", + graphicCircleText: "Circle", + graphicSquareText: "Square", + graphicTriangleText: "Triangle", + graphicStarText: "Star", + graphicCrossText: "Cross", + graphicXText: "X", + graphicExternalText: "External", urlText: "URL", - opacityText: "opacity", + opacityText: "Opacity", symbolText: "Symbol", sizeText: "Size", rotationText: "Rotation" @@ -289,13 +289,13 @@ GeoExt.Lang.add("en", { }, "gxp.StrokeSymbolizer.prototype": { - solidStrokeName: "solid", - dashStrokeName: "dash", - dotStrokeName: "dot", + solidStrokeName: "Solid", + dashStrokeName: "Dash", + dotStrokeName: "Dot", titleText: "Stroke", styleText: "Style", colorText: "Color", - widthText: "Width", + widthText: "Width (px)", opacityText: "Opacity" }, diff --git a/src/script/plugins/VectorStyleWriter.js b/src/script/plugins/VectorStyleWriter.js index 99b3b865..af89eba8 100644 --- a/src/script/plugins/VectorStyleWriter.js +++ b/src/script/plugins/VectorStyleWriter.js @@ -183,7 +183,13 @@ gxp.plugins.VectorStyleWriter = Ext.extend(gxp.plugins.StyleWriter, { if (feature.style) { delete feature.style; } - feature.style = newStyle.createSymbolizer(feature); + if (feature.featureType == 'text') { + // nasty fix for OL-Editor Labels (DrawText control) + feature.style = layer.styleMap.styles.defaultLabel.createSymbolizer(feature); + + } else { + feature.style = newStyle.createSymbolizer(feature); + } } layer.drawFeature(feature); } else { diff --git a/src/script/widgets/PointSymbolizer.js b/src/script/widgets/PointSymbolizer.js index 008658f0..d260e78f 100644 --- a/src/script/widgets/PointSymbolizer.js +++ b/src/script/widgets/PointSymbolizer.js @@ -1,12 +1,12 @@ /** * Copyright (c) 2008-2011 The Open Planning Project - * + * * Published under the GPL license. * See https://github.com/opengeo/gxp/raw/master/license.txt for the full text * of the license. */ -/** +/** * @include widgets/FillSymbolizer.js * @include widgets/StrokeSymbolizer.js */ @@ -20,7 +20,7 @@ Ext.namespace("gxp"); /** api: constructor * .. class:: PointSymbolizer(config) - * + * * Form for configuring a point symbolizer. */ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { @@ -32,21 +32,21 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { * you do not want your symbolizer modified. */ symbolizer: null, - + /** i18n */ - graphicCircleText: "circle", - graphicSquareText: "square", - graphicTriangleText: "triangle", - graphicStarText: "star", - graphicCrossText: "cross", - graphicXText: "x", - graphicExternalText: "external", + graphicCircleText: "Circle", + graphicSquareText: "Square", + graphicTriangleText: "Triangle", + graphicStarText: "Star", + graphicCrossText: "Cross", + graphicXText: "X", + graphicExternalText: "External", urlText: "URL", opacityText: "opacity", symbolText: "Symbol", sizeText: "Size", rotationText: "Rotation", - + /** api: config[pointGraphics] * ``Array`` * A list of objects to be used as the root of the data for a @@ -67,31 +67,39 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { * ``false``, the value will be assumed to be a url for an external graphic. */ pointGraphics: null, - + /** api: config[colorManager] * ``Function`` * Optional color manager constructor to be used as a plugin for the color * field. */ colorManager: null, - + /** private: property[external] * ``Boolean`` * Currently using an external graphic. */ external: null, - + /** private: config[layout] * ``String`` */ layout: "form", initComponent: function() { - + if(!this.symbolizer) { this.symbolizer = {}; - } - + } + + // JvdB Use defaults when not set, otherwise fields in form are empty + if (!this.symbolizer["graphicName"]) { + this.symbolizer["graphicName"] = 'circle'; + } + if (!this.symbolizer["rotation"]) { + this.symbolizer["rotation"] = 0; + } + if (!this.pointGraphics) { this.pointGraphics = [ {display: this.graphicCircleText, value: "circle", mark: true}, @@ -103,7 +111,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { {display: this.graphicExternalText} ]; } - + this.external = !!this.symbolizer["externalGraphic"]; this.markPanel = new Ext.Panel({ @@ -136,7 +144,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { } }] }); - + this.urlField = new Ext.form.TextField({ name: "url", fieldLabel: this.urlText, @@ -151,7 +159,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { }, width: 100 // TODO: push this to css }); - + this.graphicPanel = new Ext.Panel({ border: false, collapsed: !this.external, @@ -176,7 +184,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { } }) ], - width: 100 // TODO: push this to css + width: 100 // TODO: push this to css }] }); @@ -277,12 +285,12 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { * updated. */ "change" - ); + ); gxp.PointSymbolizer.superclass.initComponent.call(this); }, - + updateGraphicDisplay: function() { if(this.external) { this.markPanel.collapse(); @@ -293,8 +301,8 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, { } // TODO: window shadow fails to sync } - - + + }); /** api: xtype = gxp_pointsymbolizer */ diff --git a/src/script/widgets/RulePanel.js b/src/script/widgets/RulePanel.js index a602089e..fa503309 100644 --- a/src/script/widgets/RulePanel.js +++ b/src/script/widgets/RulePanel.js @@ -1,6 +1,6 @@ /** * Copyright (c) 2008-2011 The Open Planning Project - * + * * Published under the GPL license. * See https://github.com/opengeo/gxp/raw/master/license.txt for the full text * of the license. @@ -24,11 +24,11 @@ Ext.namespace("gxp"); /** api: constructor * .. class:: RulePanel(config) - * + * * Create a panel for assembling SLD rules. */ gxp.RulePanel = Ext.extend(Ext.TabPanel, { - + /** api: property[fonts] * ``Array(String)`` List of fonts for the font combo. If not set, * defaults to the list provided by the . @@ -36,7 +36,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { fonts: undefined, /** api: property[symbolType] - * ``String`` One of "Point", "Line", or "Polygon". If no rule is + * ``String`` One of "Point", "Line", or "Polygon". If no rule is * provided, default is "Point". */ symbolType: "Point", @@ -48,13 +48,13 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * rule. */ rule: null, - + /** private: property[attributes] * ``GeoExt.data.AttributeStore`` A configured attributes store for use * in the filter property combo. */ attributes: null, - + /** private: property[pointGraphics] * ``Array`` A list of objects to be used as the root of the data for a * JsonStore. These will become records used in the selection of @@ -66,7 +66,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * URL. * * Fields: - * + * * * display - ``String`` The name to be displayed to the user. * * preview - ``String`` URL to a graphic for preview. * * value - ``String`` Value to be sent to the server. @@ -79,7 +79,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * allowGroups property of the filter builder. Default is true. */ nestedFilters: true, - + /** private: property[minScaleDenominatorLimit] * ``Number`` Lower limit for scale denominators. Default is what you get * when you assume 20 zoom levels starting with the world in Spherical @@ -95,19 +95,19 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * corresponds to zoom level 0 in Google Maps). */ maxScaleDenominatorLimit: 40075016.68 * 39.3701 * OpenLayers.DOTS_PER_INCH / 256, - + /** private: property [scaleLevels] * ``Number`` Number of scale levels to assume. This is only for scaling * values exponentially along the slider. Scale values are not * required to one of the discrete levels. Default is 20. */ scaleLevels: 20, - + /** private: property[scaleSliderTemplate] * ``String`` Template for the tip displayed by the scale threshold slider. * * Can be customized using the following keywords in curly braces: - * + * * * zoom - the zoom level * * scale - the scale denominator * * type - "Max" or "Min" denominator @@ -116,7 +116,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * Default is "{scaleType} Scale 1:{scale}". */ scaleSliderTemplate: "{scaleType} Scale 1:{scale}", - + /** private: method[modifyScaleTipContext] * Called from the multi-slider tip's getText function. The function * will receive two arguments - a reference to the panel and a data @@ -125,7 +125,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * are available to the . */ modifyScaleTipContext: Ext.emptyFn, - + /** i18n */ labelFeaturesText: "Label Features", labelsText: "Labels", @@ -138,13 +138,13 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { /** private */ initComponent: function() { - + var defConfig = { plain: true, border: false }; Ext.applyIf(this, defConfig); - + if(!this.rule) { this.rule = new OpenLayers.Rule({ name: this.uniqueRuleName() @@ -154,9 +154,9 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { this.symbolType = this.getSymbolTypeFromRule(this.rule) || this.symbolType; } } - + this.activeTab = 0; - + this.textSymbolizer = new gxp.TextSymbolizer({ symbolizer: this.getTextSymbolizer(), attributes: this.attributes, @@ -168,7 +168,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { scope: this } }); - + /** * The interpretation here is that scale values of zero are equivalent to * no scale value. If someone thinks that a scale value of zero should have @@ -193,21 +193,21 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { scope: this } }); - + this.filterBuilder = new gxp.FilterBuilder({ allowGroups: this.nestedFilters, filter: this.rule && this.rule.filter && this.rule.filter.clone(), attributes: this.attributes, listeners: { change: function(builder) { - var filter = builder.getFilter(); + var filter = builder.getFilter(); this.rule.filter = filter; this.fireEvent("change", this, this.rule); }, scope: this } }); - + this.items = [{ title: this.labelsText, autoScroll: true, @@ -217,7 +217,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { title: this.labelFeaturesText, autoHeight: true, checkboxToggle: true, - collapsed: !this.hasTextSymbolizer(), + collapsed: !this.hasTextSymbolizer(true), items: [ this.textSymbolizer ], @@ -228,6 +228,7 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { }, expand: function() { this.setTextSymbolizer(this.textSymbolizer.symbolizer); + this.textSymbolizer.doLayout(); this.fireEvent("change", this, this.rule); }, scope: this @@ -320,8 +321,8 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { * * rule - ``OpenLayers.Rule`` The updated rule. */ "change" - ); - + ); + this.on({ tabchange: function(panel, tab) { tab.doLayout(); @@ -334,18 +335,23 @@ gxp.RulePanel = Ext.extend(Ext.TabPanel, { /** private: method[hasTextSymbolizer] */ - hasTextSymbolizer: function() { + hasTextSymbolizer: function(withLabel) { var candidate, symbolizer; for (var i=0, ii=this.rule.symbolizers.length; i