view gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java @ 1138:2c00570ab3bd

merged doc
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:02 +0200
parents f953c9a559d8
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

package de.intevation.gnv.raster;

import de.intevation.gnv.raster.Vectorizer.Edge;
import de.intevation.gnv.raster.Vectorizer.RingsHandler;

import java.util.ArrayList;
import java.util.List;

/**
 * Ring Handler that demultiplexes to a list of other ring handlers.
 * Handy if you want to pipe the polygons and line strings produced
 * by the Vectorize to more than one handler at once.
 *
 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
 */
public class DemuxRingsHandler
implements   RingsHandler
{
    /**
     * The list of internal ring handlers.
     */
    protected ArrayList<RingsHandler> handlers;

    /**
     * Default constructor.
     */
    public DemuxRingsHandler() {
        handlers = new ArrayList<RingsHandler>();
    }

    /**
     * Add a ring handler to the list of handlers.
     * @param handler The handler to add to the internal list.
     */
    public void addHandler(RingsHandler handler) {
        handlers.add(handler);
    }

    public void handleRings(
        List<Edge> rings,
        int        value,
        int        width,
        int        height
    ) {
        for (RingsHandler handler: handlers) {
            handler.handleRings(rings, value, width, height);
        }
    }

    /**
     * Empties the internal list of ring handlers.
     */
    public void clear() {
        handlers.clear();
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org