Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 802:d45ad7fd3027
Added map tools to measure lines and polygons.
flys-client/trunk@2323 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 12 Jul 2011 15:04:50 +0000 |
parents | 95cc560ce7c4 |
children | 1b9b7e9ab219 |
comparison
equal
deleted
inserted
replaced
801:f6693d8f0bc8 | 802:d45ad7fd3027 |
---|---|
41 protected ImgButton zoomOutButton; | 41 protected ImgButton zoomOutButton; |
42 protected ImgButton panButton; | 42 protected ImgButton panButton; |
43 protected ImgButton selectButton; | 43 protected ImgButton selectButton; |
44 protected ImgButton removeButton; | 44 protected ImgButton removeButton; |
45 | 45 |
46 protected DrawControl drawControl; | 46 protected DrawControl drawControl; |
47 protected MeasureControl measureControl; | |
47 | 48 |
48 protected Canvas position; | 49 protected Canvas position; |
49 | 50 |
50 | 51 |
51 public MapToolbar(FloodMap floodMap, Canvas wrapper) { | 52 public MapToolbar(FloodMap floodMap, Canvas wrapper) { |
68 panButton = createPanControl(); | 69 panButton = createPanControl(); |
69 position = createMousePosition(wrapper); | 70 position = createMousePosition(wrapper); |
70 drawControl = createDrawControl(); | 71 drawControl = createDrawControl(); |
71 selectButton = createSelectFeatureControl(); | 72 selectButton = createSelectFeatureControl(); |
72 removeButton = createRemoveFeatureControl(); | 73 removeButton = createRemoveFeatureControl(); |
74 measureControl = createMeasureControl(); | |
73 | 75 |
74 addMember(zoomToMaxButton); | 76 addMember(zoomToMaxButton); |
75 addMember(zoomBoxButton); | 77 addMember(zoomBoxButton); |
76 addMember(zoomOutButton); | 78 addMember(zoomOutButton); |
77 addMember(panButton); | 79 addMember(panButton); |
78 addMember(drawControl); | 80 addMember(drawControl); |
79 addMember(selectButton); | 81 addMember(selectButton); |
80 addMember(removeButton); | 82 addMember(removeButton); |
83 addMember(measureControl); | |
81 addMember(spacer); | 84 addMember(spacer); |
82 addMember(position); | 85 addMember(position); |
83 } | 86 } |
84 | 87 |
85 | 88 |
124 } | 127 } |
125 else { | 128 else { |
126 selectButton.deselect(); | 129 selectButton.deselect(); |
127 selectFeature.deactivate(); | 130 selectFeature.deactivate(); |
128 } | 131 } |
132 } | |
133 | |
134 | |
135 protected void activateMeasureControl(boolean activate) { | |
136 measureControl.activate(activate); | |
129 } | 137 } |
130 | 138 |
131 | 139 |
132 protected ImgButton createButton(String img, ClickHandler handler) { | 140 protected ImgButton createButton(String img, ClickHandler handler) { |
133 ImgButton btn = new ImgButton(); | 141 ImgButton btn = new ImgButton(); |
196 public void enable() { | 204 public void enable() { |
197 activateZoomBox(true); | 205 activateZoomBox(true); |
198 activatePan(false); | 206 activatePan(false); |
199 activateDrawFeature(false); | 207 activateDrawFeature(false); |
200 activateSelectFeature(false); | 208 activateSelectFeature(false); |
209 activateMeasureControl(false); | |
201 } | 210 } |
202 | 211 |
203 public void disable() { | 212 public void disable() { |
204 activateZoomBox(false); | 213 activateZoomBox(false); |
205 } | 214 } |
237 public void enable() { | 246 public void enable() { |
238 activateZoomBox(false); | 247 activateZoomBox(false); |
239 activatePan(true); | 248 activatePan(true); |
240 activateDrawFeature(false); | 249 activateDrawFeature(false); |
241 activateSelectFeature(false); | 250 activateSelectFeature(false); |
251 activateMeasureControl(false); | |
242 } | 252 } |
243 | 253 |
244 public void disable() { | 254 public void disable() { |
245 activatePan(false); | 255 activatePan(false); |
246 } | 256 } |
257 public void enable() { | 267 public void enable() { |
258 activateZoomBox(false); | 268 activateZoomBox(false); |
259 activatePan(false); | 269 activatePan(false); |
260 activateDrawFeature(true); | 270 activateDrawFeature(true); |
261 activateSelectFeature(false); | 271 activateSelectFeature(false); |
272 activateMeasureControl(false); | |
262 } | 273 } |
263 | 274 |
264 public void disable() { | 275 public void disable() { |
265 activateDrawFeature(false); | 276 activateDrawFeature(false); |
266 } | 277 } |
300 public void enable() { | 311 public void enable() { |
301 activateDrawFeature(false); | 312 activateDrawFeature(false); |
302 activatePan(false); | 313 activatePan(false); |
303 activateZoomBox(false); | 314 activateZoomBox(false); |
304 activateSelectFeature(true); | 315 activateSelectFeature(true); |
316 activateMeasureControl(false); | |
305 } | 317 } |
306 | 318 |
307 public void disable() { | 319 public void disable() { |
308 activateSelectFeature(false); | 320 activateSelectFeature(false); |
309 } | 321 } |
344 | 356 |
345 | 357 |
346 protected Canvas createMousePosition(Canvas mapWrapper) { | 358 protected Canvas createMousePosition(Canvas mapWrapper) { |
347 return new MapPositionPanel(floodMap.getMapWidget(), mapWrapper); | 359 return new MapPositionPanel(floodMap.getMapWidget(), mapWrapper); |
348 } | 360 } |
361 | |
362 | |
363 protected MeasureControl createMeasureControl() { | |
364 EnableDisableCmd cmd = new EnableDisableCmd() { | |
365 public void enable() { | |
366 activateDrawFeature(false); | |
367 activatePan(false); | |
368 activateZoomBox(false); | |
369 activateSelectFeature(false); | |
370 } | |
371 | |
372 public void disable() { | |
373 // do nothing | |
374 } | |
375 }; | |
376 | |
377 return new MeasureControl(floodMap, cmd); | |
378 } | |
349 } | 379 } |
350 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 380 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |