Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java @ 8816:f5e126739c36
min and max must not be equal in LAYER EXTENT in mapfile.
(issue1879) In passing some whitespace cosmetics.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 09 May 2017 18:42:56 +0200 |
parents | e701ef544ffa |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8815:c4ce25093953 | 8816:f5e126739c36 |
---|---|
27 import org.apache.velocity.Template; | 27 import org.apache.velocity.Template; |
28 import org.geotools.data.shapefile.ShpFiles; | 28 import org.geotools.data.shapefile.ShpFiles; |
29 import org.geotools.data.shapefile.shp.ShapefileHeader; | 29 import org.geotools.data.shapefile.shp.ShapefileHeader; |
30 import org.geotools.data.shapefile.shp.ShapefileReader; | 30 import org.geotools.data.shapefile.shp.ShapefileReader; |
31 | 31 |
32 import com.vividsolutions.jts.geom.Envelope; | |
33 | |
32 public class ArtifactMapfileGenerator extends MapfileGenerator { | 34 public class ArtifactMapfileGenerator extends MapfileGenerator { |
33 | 35 |
34 private static Logger log = Logger.getLogger(ArtifactMapfileGenerator.class); | 36 private static Logger log = Logger.getLogger(ArtifactMapfileGenerator.class); |
35 | 37 |
36 public static final String FLOODMAP_UESK_KEY = | 38 public static final String FLOODMAP_UESK_KEY = |
222 layerinfo.setType(wms.getGeometryType()); | 224 layerinfo.setType(wms.getGeometryType()); |
223 layerinfo.setFilter(wms.getFilter()); | 225 layerinfo.setFilter(wms.getFilter()); |
224 layerinfo.setData(wms.getData()); | 226 layerinfo.setData(wms.getData()); |
225 layerinfo.setTitle(wms.getDescription()); | 227 layerinfo.setTitle(wms.getDescription()); |
226 layerinfo.setStyle(style); | 228 layerinfo.setStyle(style); |
227 if(wms.getExtent() != null) { | 229 |
228 layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(wms.getExtent())); | 230 Envelope env = wms.getExtent(); |
231 if (env != null) { | |
232 if (env.getArea() <= 0) { | |
233 /* For MapServer min and max must not be equal. EXTENT has no | |
234 effect on Layerzoom, thus expand arbitrarily by 1. */ | |
235 env.expandBy(1d); | |
236 } | |
237 layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(env)); | |
229 } else { | 238 } else { |
230 log.error("Layer without extent. Probably no geometry at all."); | 239 log.error("Layer without extent. Probably no geometry at all."); |
231 layerinfo.setExtent("0 0 1 1"); | 240 layerinfo.setExtent("0 0 1 1"); |
232 } | 241 } |
233 layerinfo.setConnection(wms.getConnection()); | 242 layerinfo.setConnection(wms.getConnection()); |