Mercurial > mxd2map
diff 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 |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Tue Jul 05 17:52:24 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 06 15:17:05 2011 +0200 @@ -42,6 +42,7 @@ private String mapFilename; private String MS_BINDIR = "c:/ms_6.1-dev/bin"; private String prefix = ""; + private MS_UNITS units = MS_UNITS.MS_METERS; public MapScriptWriter() { map = new mapObj(""); @@ -101,33 +102,36 @@ Double.parseDouble(mapNode.getAttribute("extent_max_y"))); //Set the units. - String units = mapNode.getAttribute("units"); - MS_UNITS msu; - if(units.equals("feet")) { - msu = MS_UNITS.MS_FEET; - } - else if(units.equals("inches")) { - msu = MS_UNITS.MS_INCHES; - } - else if(units.equals("kilometers")) { - msu = MS_UNITS.MS_KILOMETERS; + map.setProjection("epsg:" + mapNode.getAttribute("projection")); + String u = mapNode.getAttribute("units"); + if(u.equals("feet")) { + units = MS_UNITS.MS_FEET; } - else if(units.equals("meters")) { - msu = MS_UNITS.MS_METERS; - } - else if(units.equals("miles")) { - msu = MS_UNITS.MS_MILES; + else if(u.equals("inches")) { + units = MS_UNITS.MS_INCHES; } - else if(units.equals("nauticalmiles")) { - msu = MS_UNITS.MS_NAUTICALMILES; + else if(u.equals("kilometers")) { + units = MS_UNITS.MS_KILOMETERS; } - else if(units.equals("points")) { - msu = MS_UNITS.MS_PIXELS; + else if(u.equals("meters")) { + units = MS_UNITS.MS_METERS; } + else if(u.equals("miles")) { + units = MS_UNITS.MS_MILES; + } + else if(u.equals("nauticalmiles")) { + units = MS_UNITS.MS_NAUTICALMILES; + } + else if(u.equals("points")) { + units = MS_UNITS.MS_PIXELS; + } + else if(u.equals("degree")) { + units = MS_UNITS.MS_DD; + } else { - msu = MS_UNITS.MS_METERS; + units = MS_UNITS.MS_METERS; } - map.setUnits(msu); + map.setUnits(units); //TODO: Find out whats the correct scale value. //map.setScaledenom(Double.parseDouble(mapNode.getAttribute("scale"))); @@ -151,6 +155,7 @@ String lname = layerElement.getAttribute("name"); lname = lname.replaceAll(" ", ""); layer.setName(lname); + layer.setUnits(units.swigValue()); layer.setMetaData("wms_title", layerElement.getAttribute("name")); if(layerElement.hasAttribute("group")) { layer.setGroup(layerElement.getAttribute("group"));