Changeset 1779
- Timestamp:
- 02/18/09 16:30:56 (4 years ago)
- Location:
- sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler
- Files:
-
- 7 modified
-
ClassPropertiesPanel.js (modified) (6 diffs)
-
tools/MapFileToStylerVisitor.js (modified) (2 diffs)
-
tools/StylerPanel.js (modified) (1 diff)
-
tools/StylerToMapFileVisitor.js (modified) (3 diffs)
-
widgets/FillStylePanel.js (modified) (1 diff)
-
widgets/LimitByConditionPanel.js (modified) (1 diff)
-
widgets/StrokeStylePanel.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/ClassPropertiesPanel.js
r1758 r1779 1 1 Ext.namespace('Studio', 'Studio.MapfileMgr'); 2 2 3 Studio.MapfileMgr.ClassPropertiesPanel = Ext.extend(Studio.MapfileMgr.Styler Panel, {3 Studio.MapfileMgr.ClassPropertiesPanel = Ext.extend(Studio.MapfileMgr.StylerForm, { 4 4 5 5 title: 'CLASS object properties', … … 20 20 */ 21 21 mapfile: null, 22 23 /** 24 * Property: clazz 25 * The MapFile class being edited 26 * {Object} 27 */ 28 clazz: null, 22 29 23 30 createAddButton: function(clazz, opts) { … … 44 51 tooltip: 'Apply modifications', 45 52 //disabled: true, // TODO disabled first, enabled when form is modified 46 handler: function() { 47 48 Ext.getCmp('studio.mm.panel').saveMapFile(); 49 }, 53 handler: this.apply, 50 54 scope: this 51 55 }]; … … 203 207 //TODO: this must be passed during construction 204 208 setData: function(mapfile, layerIndex, classIndex) { 205 varclazz = mapfile.getClass(layerIndex, classIndex);206 207 this.visitStyler(new Studio.MapfileMgr.MapFileToStylerVisitor( clazz, this.mapfile));209 this.clazz = mapfile.getClass(layerIndex, classIndex); 210 211 this.visitStyler(new Studio.MapfileMgr.MapFileToStylerVisitor(this.clazz, this.mapfile)); 208 212 this.doLayout(); 209 213 this.doLayout(); //have to do it twice for style fieldsets … … 272 276 this.getStyles().remove(styleFieldSet); 273 277 this.updateStyleButtons(); 274 this.doLayout(); 278 this.doLayout(); 275 279 }, 276 280 scope: this … … 283 287 } 284 288 return this.styles; 289 }, 290 291 apply: function() { 292 this.visitStyler(new Studio.MapfileMgr.StylerToMapFileVisitor(this.clazz)); 293 Ext.getCmp('studio.mm.panel').saveMapFile(); 285 294 } 286 295 }); -
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/tools/MapFileToStylerVisitor.js
r1770 r1779 47 47 if (json.expression) { 48 48 panel.ownerCt.expand(); 49 return new Studio.MapfileMgr.MapFileToStylerVisitor. Simple(json);49 return new Studio.MapfileMgr.MapFileToStylerVisitor.LimitByCondition(json.expression); 50 50 } else { 51 51 panel.ownerCt.collapse(); … … 115 115 }; 116 116 }; 117 118 Studio.MapfileMgr.MapFileToStylerVisitor.LimitByCondition = function(expression) { 119 var regexp=/^\(\s*\[([^\]]+)\]\s*([!=<>]*)\s*"?([^"]*)"?\)$/; 120 var matches=regexp(expression); 121 var exploded; 122 if(!matches) { 123 alert("Cannot parse expression: "+expression); 124 exploded={}; 125 } else { 126 exploded={ 127 attribute: matches[1], 128 operator: matches[2], 129 value: matches[3] 130 }; 131 } 132 133 return { 134 beginPanel: function(panel) { 135 return this; 136 }, 137 138 endPanel: function(panel) { 139 }, 140 141 value: function(component, name, value) { 142 return Studio.MapfileMgr.MapFileToStylerVisitor.getValue(exploded, component, name); 143 } 144 }; 145 }; -
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/tools/StylerPanel.js
r1778 r1779 18 18 if (subVisitor) { 19 19 Studio.MapfileMgr.StylerPanel.visitItems(this, subVisitor); 20 if(subVisitor.destroy) subVisitor.destroy(); 20 21 } 21 22 visitor.endPanel(this); -
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/tools/StylerToMapFileVisitor.js
r1724 r1779 17 17 } else if (panelType == 'studio.mm.limitbycondition') { 18 18 if (!panel.ownerCt.collapsed) { 19 return new Studio.MapfileMgr.StylerToMapFileVisitor. Simple(json);19 return new Studio.MapfileMgr.StylerToMapFileVisitor.LimitByCondition(json); 20 20 } else { 21 21 delete json.expression; … … 58 58 delete json[name]; 59 59 60 } else if(component.isXType('gx_colorfield')) { 61 var hex=component.getHexValue(); 60 } else if (component.isXType('gx_colorfield')) { 61 var hex = component.getHexValue(); 62 62 63 function toDec(val, pos) { 63 return parseInt(val.substring(pos, pos +2), 16);64 return parseInt(val.substring(pos, pos + 2), 16); 64 65 } 66 65 67 json[name] = [toDec(hex, 1), toDec(hex, 3), toDec(hex, 5)]; 66 68 … … 85 87 }; 86 88 }; 89 90 Studio.MapfileMgr.StylerToMapFileVisitor.LimitByCondition = function(json) { 91 var exploded = {}; 92 93 return { 94 beginPanel: function(panel) { 95 return this; 96 }, 97 98 endPanel: function(panel) { 99 }, 100 101 value: function(component, name, value) { 102 return Studio.MapfileMgr.StylerToMapFileVisitor.updateValue(exploded, component, name, value); 103 }, 104 105 destroy: function() { 106 if (exploded.attribute !== "" && exploded.operator) { 107 json.expression = "([" + exploded.attribute + "]" + exploded.operator + exploded.value + ")"; 108 } else { 109 delete json.expression; 110 } 111 } 112 }; 113 }; -
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/widgets/FillStylePanel.js
r1771 r1779 22 22 xtype: 'studio.mm.colorpickerfield', 23 23 fieldLabel: 'Color', 24 name: 'color' 24 name: 'color', 25 allowBlank: false 25 26 },{ 26 27 xtype: 'studio.mm.symbolcombo', -
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/widgets/LimitByConditionPanel.js
r1724 r1779 13 13 this.items = [{ 14 14 xtype: 'textfield', 15 fieldLabel: 'Condition', 16 name: 'expression' 15 fieldLabel: 'Attribute', 16 name: 'attribute' 17 },{ 18 xtype: 'textfield', 19 fieldLabel: 'Operator', 20 name: 'operator' 21 },{ 22 xtype: 'textfield', 23 fieldLabel: 'Value', 24 name: 'value' 17 25 }]; 18 26 Studio.MapfileMgr.LimitByConditionPanel.superclass.initComponent.apply(this, arguments); -
sandbox/camptocamp/Studio/studio/public/js/Studio/MapfileMgr/styler/widgets/StrokeStylePanel.js
r1771 r1779 22 22 xtype: 'studio.mm.colorpickerfield', 23 23 fieldLabel: 'Color', 24 name: "color" 24 name: "color", 25 allowBlank: false 25 26 },{ 26 27 xtype: 'studio.mm.colorpickerfield', … … 30 31 xtype: 'studio.mm.numberspinner', 31 32 fieldLabel: 'Size', 33 width: 40, 32 34 name: 'size', 33 35 minValue: 1
