Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverAxisState.java @ 3807:d73c43798a99 pre2.6-2011-11-04
merged flys-backend/pre2.6-2011-11-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:51 +0200 |
parents | 5364b86a0880 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.states; import java.util.List; import org.apache.log4j.Logger; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.context.FLYSContext; import de.intevation.flys.artifacts.model.WMSDBLayerFacet; import de.intevation.flys.artifacts.resources.Resources; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; import de.intevation.flys.utils.FLYSUtils; import de.intevation.flys.utils.GeometryUtils; public class RiverAxisState extends OutputState { public static final String I18N_DESCRIPTION = "floodmap.riveraxis"; private static final Logger logger = Logger.getLogger(RiverAxisState.class); @Override public Object computeInit( FLYSArtifact artifact, String hash, Object context, CallMeta meta, List<Facet> facets ) { logger.debug("RiverAxisState.computeInit()"); FLYSContext flysContext = null; if (context instanceof FLYSContext) { flysContext = (FLYSContext) context; } else { flysContext = (FLYSContext) ((CallContext) context).globalContext(); } String river = artifact.getDataAsString("river"); if(river == null || river.length() == 0) { logger.warn("No river found in the current parameterization."); return null; } String url = FLYSUtils.getUserWMSUrl(artifact.identifier()); WMSDBLayerFacet facet = new WMSDBLayerFacet( 0, FLOODMAP_RIVERAXIS, Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION), ComputeType.INIT, getID(), hash, url); String name = artifact.identifier() + "-" + FLOODMAP_RIVERAXIS; facet.addLayer(name); facet.setExtent(GeometryUtils.getRiverBoundary(river)); facet.setSrid(FLYSUtils.getRiverSrid(artifact)); facet.setData("geom FROM river_axes USING UNIQUE id USING SRID 31466"); facet.setFilter("river_id=1"); facet.setGeometryType("LINE"); facets.add(facet); return null; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :