annotate app/controller/Map.js @ 688:6a6d1b02a1a3

constrain windows to viewport
author Dustin Demuth <dustin@intevation.de>
date Wed, 25 Mar 2015 15:59:45 +0100
parents d21048cbdbb3
children 6e28ebbe1a73
rev   line source
638
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 */
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 Ext.define('Lada.controller.Map', {
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 extend: 'Ext.app.Controller',
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 requires: [
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 ],
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 init: function() {
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 this.control({
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 'maptoolbar button[action=add]': {
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 click: this.addLocation
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 }
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 });
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 this.callParent(arguments);
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 },
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 addLocation: function(button) {
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 var mapPanel = button.up('map');
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 var details = button.up('window').down('locationform');
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 var newLocation = Ext.create('Lada.model.Location');
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 details.setRecord(newLocation);
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 details.setReadOnly(false);
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 mapPanel.activateDraw(newLocation);
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 });

http://lada.wald.intevation.org