view flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java @ 2085:dd3f5bd174ea

Fix typo in meta data, such that string can be translated in GUI. flys-artifacts/trunk@3606 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 06 Jan 2012 07:57:28 +0000
parents 007a8f5ed9f1
children 0da8874bd378
line wrap: on
line source
package de.intevation.flys.artifacts;

import org.apache.log4j.Logger;

import java.util.List;

import org.w3c.dom.Document;

import de.intevation.artifacts.ArtifactFactory;
import de.intevation.artifacts.CallMeta;
import de.intevation.artifacts.CallContext;

import de.intevation.artifactdatabase.state.DefaultOutput;
import de.intevation.artifactdatabase.state.Facet;
import de.intevation.artifactdatabase.state.State;

import de.intevation.flys.artifacts.model.WMSDBLayerFacet;

import de.intevation.flys.model.River;

import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.RiverFactory;
import de.intevation.flys.artifacts.resources.Resources;
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.utils.GeometryUtils;


public class MapArtifact extends RiverAxisArtifact {

    private static final Logger logger =
        Logger.getLogger(MapArtifact.class);

    @Override
    public void setup(
        String          identifier,
        ArtifactFactory factory,
        Object          context,
        CallMeta        callmeta,
        Document        data)
    {
        logger.debug("MapArtifact.setup");
        this.identifier = identifier;
    }

    @Override
    public State getCurrentState(Object cc) {
        logger.debug("MapArtifact.getCurrentState");

        State state = new MapState(this);
        List<Facet> fs = facets.get(getCurrentStateId());

        DefaultOutput o = new DefaultOutput(
            "floodmap",
            "floodmap",
            "image/png",
            fs,
            "map");

        state.getOutputs().add(o);

        return state;
    }


    @Override
    public String getCurrentStateId() {
        return "state.map.new";
    }


    public static class MapState extends RiverAxisState {

        public MapState() {
        }

        public MapState(MapArtifact artifact) {
            super(artifact);
            this.id = "state.map.new";
        }

        @Override
        public Object computeInit(
            FLYSArtifact artifact,
            String       hash,
            Object       context,
            CallMeta     meta,
            List<Facet>  facets)
        {
            return null;
        }

        @Override
        public Object computeFeed(
            FLYSArtifact artifact,
            String       hash,
            CallContext  context,
            List<Facet>  facets,
            Object       old)
        {
            logger.debug("MapState.computeFeed");

            String type = getFacetType();

            WMSDBLayerFacet facet = new WMSDBLayerFacet(
                0,
                type,
                getTitle(context.getMeta()),
                ComputeType.FEED,
                getID(), hash,
                getUrl());

            String name = type + "-" + artifact.identifier();

            facet.addLayer(name);
            facet.setExtent(getExtent());
            facet.setSrid(getSrid());
            facet.setData(getDataString());
            facet.setFilter(getFilter());
            facet.setGeometryType(getGeometryType());
            facet.setConnection(getConnection());
            facet.setConnectionType(getConnectionType());
            facet.setLabelItem(getLabelItem());

            facets.add(facet);

            return null;
        }

        @Override
        public int getRiverId() {
            River r = FLYSUtils.getRiver(artifact);
            int riverId = r.getId();

            return riverId;
        }
    }
}

http://dive4elements.wald.intevation.org