annotate flys-client/src/main/java/org/dive4elements/river/client/client/ui/map/ElevationWindow.java @ 5835:821a02bbfb4e

Fixed internal java dependencies
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 13:12:15 +0200
parents f507086aa94b
children
rev   line source
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
1 package org.dive4elements.river.client.client.ui.map;
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import com.google.gwt.i18n.client.NumberFormat;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import com.smartgwt.client.types.Alignment;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.smartgwt.client.types.SelectionStyle;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.types.SortArrow;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.types.SortDirection;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.util.SC;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.widgets.Label;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import com.smartgwt.client.widgets.IButton;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.widgets.Window;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import com.smartgwt.client.widgets.events.ClickEvent;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import com.smartgwt.client.widgets.events.ClickHandler;
1619
f8c03d3af300 Reactivated the Enterprise Blue theme. Fixes some icon and image issues in IE8.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1315
diff changeset
16 import com.smartgwt.client.widgets.events.CloseClickEvent;
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import com.smartgwt.client.widgets.events.CloseClickHandler;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.layout.HLayout;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.layout.VLayout;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import com.smartgwt.client.widgets.grid.ListGrid;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import com.smartgwt.client.widgets.grid.ListGridField;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import com.smartgwt.client.widgets.grid.ListGridRecord;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import com.smartgwt.client.widgets.grid.events.EditCompleteEvent;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import com.smartgwt.client.widgets.grid.events.EditCompleteHandler;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import com.smartgwt.client.widgets.grid.events.RowOutEvent;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import com.smartgwt.client.widgets.grid.events.RowOutHandler;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import com.smartgwt.client.widgets.grid.events.RowOverEvent;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import com.smartgwt.client.widgets.grid.events.RowOverHandler;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 import org.gwtopenmaps.openlayers.client.Style;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 import org.gwtopenmaps.openlayers.client.geometry.Geometry;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import org.gwtopenmaps.openlayers.client.geometry.LinearRing;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 import org.gwtopenmaps.openlayers.client.geometry.LineString;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 import org.gwtopenmaps.openlayers.client.geometry.Point;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 import org.gwtopenmaps.openlayers.client.geometry.Polygon;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 import org.gwtopenmaps.openlayers.client.layer.Vector;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 import org.gwtopenmaps.openlayers.client.util.Attributes;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
41 import org.dive4elements.river.client.client.FLYSConstants;
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 public class ElevationWindow extends Window {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 public static FLYSConstants MSG = GWT.create(FLYSConstants.class);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 public static final int WINDOW_WIDTH = 250;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 public static final int WINDOW_HEIGHT = 250;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 protected FloodMap floodmap;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 protected Vector layer;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 protected VectorFeature feature;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 protected ListGrid grid;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 private class PointRecord extends ListGridRecord {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 protected VectorFeature point;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 public PointRecord(VectorFeature point, double x, double y, String z) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 super();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 this.point = point;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 setAttribute("x", x);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 setAttribute("y", y);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 setAttribute("z", z);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 public VectorFeature getPoint() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 return point;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 public ElevationWindow(FloodMap floodmap, VectorFeature feature) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 super();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 this.feature = feature;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 this.floodmap = floodmap;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 init();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 protected void init() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 addCloseClickHandler(new CloseClickHandler() {
1619
f8c03d3af300 Reactivated the Enterprise Blue theme. Fixes some icon and image issues in IE8.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1315
diff changeset
88 public void onCloseClick(CloseClickEvent evt) {
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 doClose();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 });
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 initLayout();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 initEdit();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 updateGrid();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 protected void initLayout() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 setWidth(WINDOW_WIDTH);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 setHeight(WINDOW_HEIGHT);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 setTitle(MSG.ele_window_title());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 VLayout root = new VLayout();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 root.setMembersMargin(5);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 root.setPadding(5);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 root.addMember(getLabel());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 root.addMember(getGrid());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 root.addMember(getButtonBar());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 addItem(root);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 centerInPage();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 protected void initEdit() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 VectorOptions opts = new VectorOptions();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 opts.setProjection(floodmap.getRiverProjection());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 opts.setMaxExtent(floodmap.getMaxExtent());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 layer = new Vector("tmp", opts);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 layer.setIsBaseLayer(false);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 floodmap.getMap().addLayer(layer);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 public Style getStyle() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 Style style = new Style();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 style.setStrokeColor("#000000");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 style.setStrokeWidth(1);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 style.setFillColor("#FF0000");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 style.setFillOpacity(0.5);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 style.setPointRadius(5);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 style.setStrokeOpacity(1.0);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 return style;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 public Style getHighStyle() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 Style style = new Style();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 style.setStrokeColor("#000000");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 style.setStrokeWidth(1);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 style.setFillColor("#FFFF22");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 style.setFillOpacity(0.5);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 style.setPointRadius(5);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 style.setStrokeOpacity(1.0);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 return style;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 protected Label getLabel() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 Label label = new Label(MSG.ele_window_label());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 label.setHeight(25);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 return label;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 protected ListGrid getGrid() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 if (grid == null) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 grid = new ListGrid();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 grid.setCanEdit(true);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 grid.setCanReorderFields(false);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 grid.setAutoFitMaxWidth(WINDOW_WIDTH);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 grid.setShowHeaderContextMenu(false);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 grid.setShowSortArrow(SortArrow.NONE);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 grid.setSortDirection(SortDirection.DESCENDING);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 grid.setSelectionType(SelectionStyle.NONE);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 ListGridField x = new ListGridField("x", MSG.ele_window_x_col());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 x.setCanEdit(false);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 ListGridField y = new ListGridField("y", MSG.ele_window_y_col());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 y.setCanEdit(false);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 ListGridField z = new ListGridField("z", MSG.ele_window_z_col());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 z.setCanEdit(true);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 grid.setFields(x, y, z);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 grid.addRowOverHandler(new RowOverHandler() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 public void onRowOver(RowOverEvent evt) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 PointRecord pr = (PointRecord) evt.getRecord();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 VectorFeature p = pr.getPoint();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 p.setStyle(getHighStyle());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 layer.redraw();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 });
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 grid.addRowOutHandler(new RowOutHandler() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 public void onRowOut(RowOutEvent evt) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 PointRecord pr = (PointRecord) evt.getRecord();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 VectorFeature p = pr.getPoint();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 p.setStyle(getStyle());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 layer.redraw();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 });
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 grid.addEditCompleteHandler(new EditCompleteHandler() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 public void onEditComplete(EditCompleteEvent evt) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 NumberFormat nf = NumberFormat.getDecimalFormat();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 String z = (String) evt.getNewValues().get("z");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 try {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 nf.parse(z);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 catch (NumberFormatException nfe) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 SC.warn(MSG.ele_window_format_error() + " " + z);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 PointRecord old = (PointRecord) evt.getOldRecord();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 ListGridRecord[] records = grid.getRecords();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 records[evt.getRowNum()] = old;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 grid.setRecords(records);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 });
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 return grid;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 protected HLayout getButtonBar() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 HLayout bar = new HLayout();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 bar.setAlign(Alignment.CENTER);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 bar.setHeight(25);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234 bar.setMembersMargin(15);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 bar.addMember(getOKButton());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 bar.addMember(getCancelButton());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 return bar;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 protected IButton getOKButton() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 IButton btn = new IButton(MSG.ele_window_ok_button());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 btn.addClickHandler(new ClickHandler() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 public void onClick(ClickEvent evt) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248 if (saveElevation()) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 doClose();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 });
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 return btn;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 protected IButton getCancelButton() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 IButton btn = new IButton(MSG.ele_window_cancel_button());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 btn.addClickHandler(new ClickHandler() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263 public void onClick(ClickEvent evt) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264 doClose();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266 });
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 return btn;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 public void updateGrid() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 Attributes attr = feature.getAttributes();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
274 Geometry geom = feature.getGeometry();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276 String barrierType = null;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 if (attr != null) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 barrierType = attr.getAttributeAsString("typ");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 else {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 barrierType = DrawControl.BARRIER_DAM_VALUE;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 GWT.log("Geometry is from type: " + geom.getClassName());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 GWT.log("Barrier is from type: " + barrierType);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 double[][] points = getPointsFromGeometry(geom);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 double[] ele = extractElevations(attr);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
291 if (points == null) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292 return;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295 NumberFormat nf = NumberFormat.getDecimalFormat();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297 ListGrid grid = getGrid();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
299 int zLen = ele != null ? ele.length : 0;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
300
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
301 for (int i = 0, len = points.length; i < len; i++) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 double[] point = points[i];
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
303 VectorFeature p = addPoint(point[0], point[1]);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
305 String value = null;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
307 if (zLen > i) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
308 value = nf.format(ele[i]);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
309 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
310 else if (barrierType.equals(DrawControl.BARRIER_DITCH_VALUE)) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
311 value = "-9999";
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
312 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313 else {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
314 value = "9999";
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
316
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317 grid.addData(new PointRecord(p, point[0], point[1], value));
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
318 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
319
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
320 grid.redraw();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
322
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324 public static double[] extractElevations(Attributes attr) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
325 if (attr == null) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
326 return null;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
327 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
328
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329 String elevationStr = attr.getAttributeAsString("elevation");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
330
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
331 if (elevationStr == null || elevationStr.length() == 0) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332 return null;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
334
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 String[] elevations = elevationStr.split(" ");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
337 int len = elevations != null ? elevations.length : 0;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
338
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
339 if (len == 0) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340 return null;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
341 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
342
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
343 double[] res = new double[len];
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
344
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
345 for (int i = 0; i < len; i++) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
346 try {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
347 res[i] = Double.valueOf(elevations[i]);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
348 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
349 catch (NumberFormatException nfe) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
350 // go on
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
351 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
352 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
353
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
354 return res;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
355 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
356
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
357
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
358 public static double[][] getPointsFromGeometry(Geometry geom) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
359 String clazz = geom.getClassName();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
360
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
361 if (clazz != null && clazz.equals(Geometry.LINESTRING_CLASS_NAME)) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
362 return getPointsFromLineString(
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
363 LineString.narrowToLineString(geom.getJSObject()));
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
364 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
365 else if (clazz != null && clazz.equals(Geometry.POLYGON_CLASS_NAME)) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
366 return getPointsFromPolygon(
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
367 Polygon.narrowToPolygon(geom.getJSObject()));
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
368 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
369 else {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
370 SC.warn(MSG.ele_window_geometry_error() + " " + clazz);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
371 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
373 return null;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
374 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
375
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377 public static double[][] getPointsFromLineString(LineString line) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
378 return line.getCoordinateArray();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
379 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
381
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382 public static double[][] getPointsFromPolygon(Polygon polygon) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
383 LinearRing[] rings = polygon.getComponents();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
384
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385 return getPointsFromLineString(rings[0]);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
388
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
389 protected VectorFeature addPoint(double x, double y) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
390 VectorFeature point = new VectorFeature(new Point(x, y), getStyle());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
391 layer.addFeature(point);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
392
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
393 return point;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
394 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
395
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
396
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
397 protected boolean saveElevation() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
398 ListGridRecord[] records = grid.getRecords();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
399
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
400 NumberFormat nf = NumberFormat.getDecimalFormat();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
401
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
402 StringBuilder sb = new StringBuilder();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
403
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
404 for (ListGridRecord record: records) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
405 PointRecord pr = (PointRecord) record;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
406 String value = pr.getAttributeAsString("z");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
407
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
408 try {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
409 double z = nf.parse(value);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
410 sb.append(String.valueOf(z));
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
411 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
412 catch (NumberFormatException nfe) {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
413 SC.warn(MSG.ele_window_save_error());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
414 return false;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
415 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
416
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
417 sb.append(" ");
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
418 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
419
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
420 Attributes attr = feature.getAttributes();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
421 attr.setAttribute("elevation", sb.toString());
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
422
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
423 return true;
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
424 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
425
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
426
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
427 protected void doClose() {
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
428 floodmap.getMap().removeLayer(layer);
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
429 destroy();
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
430 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
431 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
432 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org