comparison app/view/window/Ortszuordnung.js @ 1279:291df0037835

Ortszuordnung window: create, change and display (wip)
author Maximilian Krambach <mkrambach@intevation.de>
date Wed, 18 Jan 2017 11:41:50 +0100
parents a792eecf1614
children faecbb446a04
comparison
equal deleted inserted replaced
1278:cb9609380056 1279:291df0037835
13 extend: 'Ext.window.Window', 13 extend: 'Ext.window.Window',
14 alias: 'widget.ortszuordnungwindow', 14 alias: 'widget.ortszuordnungwindow',
15 15
16 requires: [ 16 requires: [
17 'Lada.view.form.Ortszuordnung', 17 'Lada.view.form.Ortszuordnung',
18 'Lada.view.form.Ortserstellung',
18 'Lada.view.panel.Ort' 19 'Lada.view.panel.Ort'
19 ], 20 ],
20 21
21 collapsible: true, 22 collapsible: true,
22 maximizable: true, 23 maximizable: true,
101 region: 'south', 102 region: 'south',
102 border: 0, 103 border: 0,
103 layout: 'fit', 104 layout: 'fit',
104 name: 'ortgrid', 105 name: 'ortgrid',
105 hidden: true, 106 hidden: true,
106 maxHeight: '45%', 107 maxHeight: 240,
107 items: [{ 108 items: [{
108 xtype: 'ortstammdatengrid', 109 xtype: 'ortstammdatengrid'
109 maxHeight: '45%'
110 }], 110 }],
111 dockedItems: [{ 111 dockedItems: [{
112 xtype: 'toolbar', 112 xtype: 'toolbar',
113 dock: 'bottom', 113 dock: 'bottom',
114 border: '0, 1, 1, 1', 114 border: '0, 1, 1, 1',
121 xtype: 'textfield', 121 xtype: 'textfield',
122 labelWidth: 50, 122 labelWidth: 50,
123 fieldLabel: i18n.getMsg('ortszuordnung.ortsuche'), 123 fieldLabel: i18n.getMsg('ortszuordnung.ortsuche'),
124 }, '->', { 124 }, '->', {
125 text: i18n.getMsg('orte.new'), 125 text: i18n.getMsg('orte.new'),
126 action: 'createort', 126 action: 'createort'
127 }, { 127 }, {
128 text: i18n.getMsg('orte.frommap'), 128 text: i18n.getMsg('orte.frommap'),
129 action: 'frommap', 129 action: 'frommap'
130 }, { 130 }, {
131 text: i18n.getMsg('orte.clone'), 131 text: i18n.getMsg('orte.clone'),
132 action: 'clone', 132 action: 'clone'
133 }, {
134 text: i18n.getMsg('orte.select'),
135 action: 'select',
136 }] 133 }]
137 }] 134 }]
138 }] 135 }]
139 }]; 136 }];
137
140 this.callParent(arguments); 138 this.callParent(arguments);
141 }, 139 },
142 140
143 /** 141 /**
144 * Initialise the Data of this Window 142 * Initialise the Data of this Window
168 load: { 166 load: {
169 fn: function() { 167 fn: function() {
170 osg.setLoading(false); 168 osg.setLoading(false);
171 map.setLoading(false); 169 map.setLoading(false);
172 osg.setStore(ortstore); 170 osg.setStore(ortstore);
173 var store = Ext.create('Lada.store.Orte', { 171 map.addLocations(ortstore);
174 autoLoad: false 172 map.featureLayer.setVisibility(false);
175 }); 173 map.selectedFeatureLayer = new OpenLayers.Layer.Vector(
176 store.add(ortstore.getRange()); 174 'gewählter Messpunkt', {
177 var rec = store.getById(me.record.get('ortId')); 175 styleMap: new OpenLayers.StyleMap({
178 store.remove(rec); 176 externalGraphic: 'resources/lib/OpenLayers/img/marker-blue.png',
179 console.log(rec); 177 pointRadius: 10,
180 map.addLocations(store); 178 label: '${bez}',
179 labelAlign: 'rt',
180 fontColor: 'blue',
181 fontWeight: 'bold',
182 }),
183 displayInLayerSwitcher: false,
184 projection: new OpenLayers.Projection('EPSG:3857')
185 });
186 map.map.addLayer(map.selectedFeatureLayer);
187 map.selectedFeatureLayer.setZIndex(499);
188 var ortId = me.record.get('ortId');
189 if (ortId){
190 var feat = map.featureLayer.getFeaturesByAttribute('id', ortId)[0];
191 map.selectControl.select(feat);
192 }
181 } 193 }
182 } 194 }
183 } 195 }
184 }); 196 });
185 ortstore.load(); 197 ortstore.load();
198 map.addListener('featureselected', osg.selectOrt, osg);
199 osg.addListener('select', map.selectFeature, map);
186 }, 200 },
187 201
188 /** 202 /**
189 * @private 203 * @private
190 * Override to display and update the map view in the panel. 204 * Override to display and update the map view in the panel.
191 */ 205 */
192 afterRender: function(){ 206 afterRender: function(){
193 this.superclass.afterRender.apply(this, arguments); 207 this.superclass.afterRender.apply(this, arguments);
194 var map = this.down('map'); 208 var map = this.down('map');
195 map.map.addControl(new OpenLayers.Control.LayerSwitcher()); 209 map.map.addControl(new OpenLayers.Control.LayerSwitcher());
196 //map.map.zoomToMaxExtent();
197 }, 210 },
198 211
199 /** 212 /**
200 * Instructs the fields / forms listed in this method to set a message. 213 * Instructs the fields / forms listed in this method to set a message.
201 * @param errors These Errors shall be shown 214 * @param errors These Errors shall be shown

http://lada.wald.intevation.org