comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 170:b9ee44070056

Manage projections and units.
author vc11884admin@VC11884.win.bsh.de
date Wed, 06 Jul 2011 15:17:05 +0200
parents d7c8493cb345
children 929e09649b08
comparison
equal deleted inserted replaced
169:d7c8493cb345 170:b9ee44070056
40 private Document root; 40 private Document root;
41 private mapObj map; 41 private mapObj map;
42 private String mapFilename; 42 private String mapFilename;
43 private String MS_BINDIR = "c:/ms_6.1-dev/bin"; 43 private String MS_BINDIR = "c:/ms_6.1-dev/bin";
44 private String prefix = ""; 44 private String prefix = "";
45 private MS_UNITS units = MS_UNITS.MS_METERS;
45 46
46 public MapScriptWriter() { 47 public MapScriptWriter() {
47 map = new mapObj(""); 48 map = new mapObj("");
48 mapFilename = ""; 49 mapFilename = "";
49 } 50 }
99 Double.parseDouble(mapNode.getAttribute("extent_min_y")), 100 Double.parseDouble(mapNode.getAttribute("extent_min_y")),
100 Double.parseDouble(mapNode.getAttribute("extent_max_x")), 101 Double.parseDouble(mapNode.getAttribute("extent_max_x")),
101 Double.parseDouble(mapNode.getAttribute("extent_max_y"))); 102 Double.parseDouble(mapNode.getAttribute("extent_max_y")));
102 103
103 //Set the units. 104 //Set the units.
104 String units = mapNode.getAttribute("units"); 105 map.setProjection("epsg:" + mapNode.getAttribute("projection"));
105 MS_UNITS msu; 106 String u = mapNode.getAttribute("units");
106 if(units.equals("feet")) { 107 if(u.equals("feet")) {
107 msu = MS_UNITS.MS_FEET; 108 units = MS_UNITS.MS_FEET;
108 } 109 }
109 else if(units.equals("inches")) { 110 else if(u.equals("inches")) {
110 msu = MS_UNITS.MS_INCHES; 111 units = MS_UNITS.MS_INCHES;
111 } 112 }
112 else if(units.equals("kilometers")) { 113 else if(u.equals("kilometers")) {
113 msu = MS_UNITS.MS_KILOMETERS; 114 units = MS_UNITS.MS_KILOMETERS;
114 } 115 }
115 else if(units.equals("meters")) { 116 else if(u.equals("meters")) {
116 msu = MS_UNITS.MS_METERS; 117 units = MS_UNITS.MS_METERS;
117 } 118 }
118 else if(units.equals("miles")) { 119 else if(u.equals("miles")) {
119 msu = MS_UNITS.MS_MILES; 120 units = MS_UNITS.MS_MILES;
120 } 121 }
121 else if(units.equals("nauticalmiles")) { 122 else if(u.equals("nauticalmiles")) {
122 msu = MS_UNITS.MS_NAUTICALMILES; 123 units = MS_UNITS.MS_NAUTICALMILES;
123 } 124 }
124 else if(units.equals("points")) { 125 else if(u.equals("points")) {
125 msu = MS_UNITS.MS_PIXELS; 126 units = MS_UNITS.MS_PIXELS;
126 } 127 }
128 else if(u.equals("degree")) {
129 units = MS_UNITS.MS_DD;
130 }
127 else { 131 else {
128 msu = MS_UNITS.MS_METERS; 132 units = MS_UNITS.MS_METERS;
129 } 133 }
130 map.setUnits(msu); 134 map.setUnits(units);
131 135
132 //TODO: Find out whats the correct scale value. 136 //TODO: Find out whats the correct scale value.
133 //map.setScaledenom(Double.parseDouble(mapNode.getAttribute("scale"))); 137 //map.setScaledenom(Double.parseDouble(mapNode.getAttribute("scale")));
134 } 138 }
135 139
149 153
150 //The layer name. 154 //The layer name.
151 String lname = layerElement.getAttribute("name"); 155 String lname = layerElement.getAttribute("name");
152 lname = lname.replaceAll(" ", ""); 156 lname = lname.replaceAll(" ", "");
153 layer.setName(lname); 157 layer.setName(lname);
158 layer.setUnits(units.swigValue());
154 layer.setMetaData("wms_title", layerElement.getAttribute("name")); 159 layer.setMetaData("wms_title", layerElement.getAttribute("name"));
155 if(layerElement.hasAttribute("group")) { 160 if(layerElement.hasAttribute("group")) {
156 layer.setGroup(layerElement.getAttribute("group")); 161 layer.setGroup(layerElement.getAttribute("group"));
157 } 162 }
158 //The layer status. 163 //The layer status.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)