Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/exports/injector/KmFromLocationInjector.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 | 16dc2da05aef |
children | a805211690f7 |
line wrap: on
line source
package org.dive4elements.river.exports.injector; import org.apache.log4j.Logger; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.ContextInjector; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.access.RangeAccess; import org.w3c.dom.Document; import org.w3c.dom.Element; import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM; public class KmFromLocationInjector implements ContextInjector { private static Logger log = Logger.getLogger(KmFromLocationInjector.class); @Override public void setup(Element cfg) { } @Override public void injectContext( CallContext ctx, Artifact artifact, Document doc ) { if (ctx.getContextValue(CURRENT_KM) instanceof Number) { return; } RangeAccess access = new RangeAccess((D4EArtifact)artifact); if (access.getLocations() != null && access.getLocations().length > 0) { ctx.putContextValue(CURRENT_KM, access.getLocations()[0]); return; } log.warn("No locations accessible."); } }