sascha@465: package de.intevation.gnv.raster;
sascha@465:
sascha@779: import de.intevation.gnv.raster.Vectorizer.Edge;
sascha@779: import de.intevation.gnv.raster.Vectorizer.RingsHandler;
sascha@779:
sascha@465: import java.util.ArrayList;
sascha@465: import java.util.List;
sascha@465:
sascha@465: /**
sascha@802: * Ring Handler that demultiplexes to a list of other ring handlers.
sascha@802: * Handy if you want to pipe the polygons and line strings produced
sascha@802: * by the Vectorize to more than one handler at once.
sascha@803: *
sascha@780: * @author Sascha L. Teichmann
sascha@465: */
sascha@465: public class DemuxRingsHandler
sascha@465: implements RingsHandler
sascha@465: {
sascha@802: /**
sascha@802: * The list of internal ring handlers.
sascha@802: */
sascha@465: protected ArrayList handlers;
sascha@465:
sascha@802: /**
sascha@802: * Default constructor.
sascha@802: */
sascha@465: public DemuxRingsHandler() {
sascha@465: handlers = new ArrayList();
sascha@465: }
sascha@465:
sascha@802: /**
sascha@802: * Add a ring handler to the list of handlers.
sascha@802: * @param handler The handler to add to the internal list.
sascha@802: */
sascha@465: public void addHandler(RingsHandler handler) {
sascha@465: handlers.add(handler);
sascha@465: }
sascha@465:
sascha@465: public void handleRings(
sascha@778: List rings,
sascha@778: int value,
sascha@465: int width,
sascha@465: int height
sascha@465: ) {
sascha@465: for (RingsHandler handler: handlers) {
sascha@465: handler.handleRings(rings, value, width, height);
sascha@465: }
sascha@465: }
sascha@465:
sascha@802: /**
sascha@802: * Empties the internal list of ring handlers.
sascha@802: */
sascha@465: public void clear() {
sascha@465: handlers.clear();
sascha@465: }
sascha@465: }
sascha@465: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :