Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java @ 6831:8c7433b8656d
Backed out changeset 74a437805e2a
Description does not match. Why changing logging behavior? Why re-sorting imports? This can be done (if there is really a reason to do so) in separate commits with adequate descriptions.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 14 Aug 2013 16:50:35 +0200 |
parents | 74a437805e2a |
children | 20f98087664d |
comparison
equal
deleted
inserted
replaced
6830:eb4b123daaf7 | 6831:8c7433b8656d |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.utils; | 9 package org.dive4elements.river.utils; |
10 | 10 |
11 import java.io.File; | |
12 import java.io.FileNotFoundException; | |
13 import java.io.IOException; | |
14 import java.util.List; | |
15 | |
16 import org.apache.log4j.Logger; | |
17 import org.apache.velocity.Template; | |
18 import org.dive4elements.artifacts.CallContext; | 11 import org.dive4elements.artifacts.CallContext; |
19 import org.dive4elements.river.artifacts.D4EArtifact; | 12 import org.dive4elements.river.artifacts.D4EArtifact; |
20 import org.dive4elements.river.artifacts.access.RiverAccess; | 13 import org.dive4elements.river.artifacts.access.RiverAccess; |
21 import org.dive4elements.river.artifacts.model.LayerInfo; | 14 import org.dive4elements.river.artifacts.model.LayerInfo; |
22 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet; | 15 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet; |
23 import org.dive4elements.river.artifacts.model.map.WMSLayerFacet; | 16 import org.dive4elements.river.artifacts.model.map.WMSLayerFacet; |
24 import org.dive4elements.river.artifacts.model.map.WSPLGENLayerFacet; | 17 import org.dive4elements.river.artifacts.model.map.WSPLGENLayerFacet; |
25 import org.dive4elements.river.artifacts.resources.Resources; | 18 import org.dive4elements.river.artifacts.resources.Resources; |
26 import org.dive4elements.river.artifacts.states.FloodMapState; | 19 |
20 import java.io.File; | |
21 import java.io.FileNotFoundException; | |
22 import java.io.IOException; | |
23 import java.util.List; | |
24 | |
25 import org.apache.log4j.Logger; | |
26 import org.apache.velocity.Template; | |
27 import org.geotools.data.shapefile.ShpFiles; | 27 import org.geotools.data.shapefile.ShpFiles; |
28 import org.geotools.data.shapefile.shp.ShapefileHeader; | 28 import org.geotools.data.shapefile.shp.ShapefileHeader; |
29 import org.geotools.data.shapefile.shp.ShapefileReader; | 29 import org.geotools.data.shapefile.shp.ShapefileReader; |
30 | 30 |
31 public class ArtifactMapfileGenerator extends MapfileGenerator { | 31 public class ArtifactMapfileGenerator extends MapfileGenerator { |
133 File userShape = new File(dir, WSPLGEN_USER_SHAPE); | 133 File userShape = new File(dir, WSPLGEN_USER_SHAPE); |
134 ShpFiles sf = new ShpFiles(userShape); | 134 ShpFiles sf = new ShpFiles(userShape); |
135 ShapefileReader sfr = new ShapefileReader(sf, true, false, null); | 135 ShapefileReader sfr = new ShapefileReader(sf, true, false, null); |
136 ShapefileHeader sfh = sfr.getHeader(); | 136 ShapefileHeader sfh = sfr.getHeader(); |
137 | 137 |
138 String group = MS_USERSHAPE_PREFIX + uuid; | 138 String group = uuid + MS_USERSHAPE_PREFIX; |
139 String groupTitle = "I18N_USER_SHAPE_TITLE"; | 139 String groupTitle = "I18N_USER_SHAPE_TITLE"; |
140 | 140 |
141 LayerInfo info = new LayerInfo(); | 141 LayerInfo info = new LayerInfo(); |
142 info.setName(MS_LAYER_PREFIX + FloodMapState.WSPLGEN_USER_RGD + uuid); | 142 info.setName(MS_USERSHAPE_PREFIX + uuid); |
143 if (sfh.getShapeType().isLineType()) { | 143 if (sfh.getShapeType().isLineType()) { |
144 info.setType("LINE"); | 144 info.setType("LINE"); |
145 } | 145 } |
146 else if (sfh.getShapeType().isPolygonType()) { | 146 else if (sfh.getShapeType().isPolygonType()) { |
147 info.setType("POLYGON"); | 147 info.setType("POLYGON"); |
154 info.setTitle("I18N_USER_SHAPE"); | 154 info.setTitle("I18N_USER_SHAPE"); |
155 info.setGroup(group); | 155 info.setGroup(group); |
156 info.setGroupTitle(groupTitle); | 156 info.setGroupTitle(groupTitle); |
157 info.setSrid(wms.getSrid()); | 157 info.setSrid(wms.getSrid()); |
158 | 158 |
159 //String nameUser = MS_LAYER_PREFIX + wms.getName(); | 159 String nameUser = MS_LAYER_PREFIX + wms.getName(); |
160 // TODO: This rewrites the user-rgd mapfile fragment generated by | |
161 // HWSBarrierState. Otherwise we would have to fragments with same | |
162 // layer name. Should be refactored... | |
163 String nameUser = MS_LAYER_PREFIX + "user-rgd"; | |
164 | 160 |
165 Template tpl = getTemplateByName(SHP_LAYER_TEMPLATE); | 161 Template tpl = getTemplateByName(SHP_LAYER_TEMPLATE); |
166 if (tpl == null) { | 162 if (tpl == null) { |
167 logger.warn("Template '" + SHP_LAYER_TEMPLATE + "' found."); | 163 logger.warn("Template '" + SHP_LAYER_TEMPLATE + "' found."); |
168 return; | 164 return; |