comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 1400:96708d81eaf6

Added an initial GetFeatureInfo tool to get information about points in the map. flys-client/trunk@3285 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 17 Nov 2011 16:20:55 +0000
parents d29a9fa10313
children 09566522e899
comparison
equal deleted inserted replaced
1399:748e7c828d03 1400:96708d81eaf6
18 import org.gwtopenmaps.openlayers.client.feature.VectorFeature; 18 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
19 import org.gwtopenmaps.openlayers.client.layer.Vector; 19 import org.gwtopenmaps.openlayers.client.layer.Vector;
20 import org.gwtopenmaps.openlayers.client.util.Attributes; 20 import org.gwtopenmaps.openlayers.client.util.Attributes;
21 21
22 import de.intevation.flys.client.client.FLYSConstants; 22 import de.intevation.flys.client.client.FLYSConstants;
23 import de.intevation.flys.client.client.ui.OutputTab;
23 import de.intevation.flys.client.client.ui.Toolbar; 24 import de.intevation.flys.client.client.ui.Toolbar;
24 import de.intevation.flys.client.client.utils.EnableDisableCmd; 25 import de.intevation.flys.client.client.utils.EnableDisableCmd;
26 import de.intevation.flys.client.shared.model.ThemeList;
25 27
26 28
27 /** 29 /**
28 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
29 */ 31 */
30 public class MapToolbar extends Toolbar { 32 public class MapToolbar extends Toolbar {
31 33
32 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); 34 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
33 35
34 protected FloodMap floodMap; 36 protected FloodMap floodMap;
35 protected DragPan pan; 37 protected DragPan pan;
36 protected ZoomBox zoomBox; 38 protected ZoomBox zoomBox;
37 protected SelectFeature selectFeature; 39 protected SelectFeature selectFeature;
40 protected GetFeatureInfo getFeatureInfo;
38 41
39 protected Button datacageButton; 42 protected Button datacageButton;
40 43
41 protected ImgButton zoomToMaxButton; 44 protected ImgButton zoomToMaxButton;
42 protected ImgButton zoomBoxButton; 45 protected ImgButton zoomBoxButton;
43 protected ImgButton zoomOutButton; 46 protected ImgButton zoomOutButton;
44 protected ImgButton panButton; 47 protected ImgButton panButton;
45 protected ImgButton selectButton; 48 protected ImgButton selectButton;
49 protected ImgButton infoButton;
46 protected ImgButton removeButton; 50 protected ImgButton removeButton;
47 protected ImgButton elevationButton; 51 protected ImgButton elevationButton;
48 52
49 protected DrawControl drawControl; 53 protected DrawControl drawControl;
50 protected MeasureControl measureControl; 54 protected MeasureControl measureControl;
81 zoomBoxButton = createZoomBoxControl(); 85 zoomBoxButton = createZoomBoxControl();
82 zoomOutButton = createZoomOutControl(); 86 zoomOutButton = createZoomOutControl();
83 panButton = createPanControl(); 87 panButton = createPanControl();
84 drawControl = createDrawControl(); 88 drawControl = createDrawControl();
85 selectButton = createSelectFeatureControl(); 89 selectButton = createSelectFeatureControl();
90 infoButton = createGetFeatureInfo();
86 measureControl = createMeasureControl(); 91 measureControl = createMeasureControl();
87 position = createMousePosition(); 92 position = createMousePosition();
88 removeButton = createRemoveFeatureControl(); 93 removeButton = createRemoveFeatureControl();
89 elevationButton = createElevationControl(); 94 elevationButton = createElevationControl();
90 95
103 addMember(selectButton); 108 addMember(selectButton);
104 addMember(removeButton); 109 addMember(removeButton);
105 addMember(elevationButton); 110 addMember(elevationButton);
106 } 111 }
107 112
113 if (infoButton != null) {
114 addMember(infoButton);
115 }
116
108 addMember(measureControl); 117 addMember(measureControl);
109 addMember(position); 118 addMember(position);
110 } 119 }
111 120
112 121
156 } 165 }
157 166
158 167
159 protected void activateMeasureControl(boolean activate) { 168 protected void activateMeasureControl(boolean activate) {
160 measureControl.activate(activate); 169 measureControl.activate(activate);
170 }
171
172
173 protected void activateGetFeatureInfo(boolean activate) {
174 getFeatureInfo.activate(activate);
161 } 175 }
162 176
163 177
164 protected ImgButton createButton(String img, ClickHandler handler) { 178 protected ImgButton createButton(String img, ClickHandler handler) {
165 ImgButton btn = new ImgButton(); 179 ImgButton btn = new ImgButton();
466 } 480 }
467 }); 481 });
468 482
469 return btn; 483 return btn;
470 } 484 }
485
486
487 protected ImgButton createGetFeatureInfo() {
488 OutputTab ot = getOutputTab();
489 if (ot == null) {
490 return null;
491 }
492
493 ThemeList tl = ot.getCollection().getThemeList("floodmap");
494
495 getFeatureInfo = new GetFeatureInfo(
496 getMap(),
497 tl.getThemes(),
498 "gml");
499
500 EnableDisableCmd cmd = new EnableDisableCmd() {
501 public void enable() {
502 activateDrawFeature(false);
503 activatePan(false);
504 activateZoomBox(false);
505 activateSelectFeature(false);
506 activateGetFeatureInfo(true);
507 }
508
509 public void disable() {
510 activateGetFeatureInfo(false);
511 }
512 };
513
514 ImgButton button = createToggleButton(MSG.getFeatureInfo(), cmd);
515 button.setTooltip(MSG.getFeatureInfoTooltip());
516
517 return button;
518 }
471 } 519 }
472 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 520 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org