Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java @ 1717:755a890ecf0e
FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
flys-artifacts/trunk@2995 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 17 Oct 2011 15:53:59 +0000 |
parents | aaf8d32f85bd |
children | 092e1e5020bc |
line wrap: on
line source
package de.intevation.flys.wsplgen; import java.util.ArrayList; import java.util.List; import de.intevation.artifacts.CallContext; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.model.CrossSectionTrack; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.WMSLayerFacet; 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; import de.intevation.flys.utils.MapfileGenerator; public class FacetCreator implements FacetTypes { public static final String I18N_WSPLGEN_RESULT = "floodmap.uesk"; public static final String I18N_WSPLGEN_DEFAULT = "floodmap.uesk"; public static final String I18N_BARRIERS = "floodmap.barriers"; public static final String I18N_BARRIERS_DEFAULT = "floodmap.barriers"; protected FLYSArtifact artifact; protected CallContext cc; protected List<Facet> facets; protected List<Facet> tmpFacets; protected String url; protected String hash; protected String stateId; public FacetCreator( FLYSArtifact artifact, CallContext cc, String hash, String sId, List<Facet> facets ) { this.tmpFacets = new ArrayList<Facet>(2); this.facets = facets; this.artifact = artifact; this.cc = cc; this.hash = hash; this.stateId = sId; } protected String getRiver() { return artifact.getDataAsString("river"); } protected String getUrl() { String url = FLYSUtils.getXPathString(FLYSUtils.XPATH_MAPSERVER_URL); url = url + "user-wms"; return url; } protected String getSrid() { return FLYSUtils.getRiverSrid(artifact); } protected String getWSPLGENBounds() { String river = getRiver(); double kms[] = FLYSUtils.getKmRange(artifact); CrossSectionTrack a = CrossSectionTrack.getCrossSectionTrack(river, kms[0]); CrossSectionTrack b = CrossSectionTrack.getCrossSectionTrack(river, kms[1]); if (a == null || b == null) { return null; } return GeometryUtils.createOLBounds(a.getGeom(), b.getGeom()); } protected String getBounds() { return GeometryUtils.getRiverBounds(getRiver()); } public List<Facet> getFacets() { return tmpFacets; } public void createWSPLGENFacet() { WMSLayerFacet wsplgen = new WMSLayerFacet( 0, FLOODMAP_WSPLGEN, Resources.getMsg( cc.getMeta(), I18N_WSPLGEN_RESULT, I18N_WSPLGEN_DEFAULT), ComputeType.ADVANCE, stateId, hash, getUrl()); String bounds = getWSPLGENBounds(); if (bounds == null || bounds.length() == 0) { bounds = getBounds(); } wsplgen.addLayer( artifact.identifier() + MapfileGenerator.MS_WSPLGEN_POSTFIX); wsplgen.setSrid(getSrid()); wsplgen.setExtent(bounds); tmpFacets.add(wsplgen); } public void createBarrierFacet() { WMSLayerFacet barriers = new WMSLayerFacet( 1, FLOODMAP_WSPLGEN, Resources.getMsg( cc.getMeta(), I18N_BARRIERS, I18N_BARRIERS_DEFAULT), ComputeType.ADVANCE, stateId, hash, getUrl()); barriers.addLayer( artifact.identifier() + MapfileGenerator.MS_BARRIERS_POSTFIX); barriers.setSrid(getSrid()); barriers.setExtent(getBounds()); tmpFacets.add(barriers); } public void finish() { facets.addAll(getFacets()); } } // end of FacetCreator