comparison gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java @ 1119:7c4f81f74c47

merged gnv-artifacts
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:00 +0200
parents f953c9a559d8
children
comparison
equal deleted inserted replaced
1027:fca4b5eb8d2f 1119:7c4f81f74c47
1 /*
2 * Copyright (c) 2010 by Intevation GmbH
3 *
4 * This program is free software under the LGPL (>=v2.1)
5 * Read the file LGPL.txt coming with the software for details
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
7 */
8
9 package de.intevation.gnv.raster;
10
11 import de.intevation.gnv.raster.Vectorizer.Edge;
12 import de.intevation.gnv.raster.Vectorizer.RingsHandler;
13
14 import java.util.ArrayList;
15 import java.util.List;
16
17 /**
18 * Ring Handler that demultiplexes to a list of other ring handlers.
19 * Handy if you want to pipe the polygons and line strings produced
20 * by the Vectorize to more than one handler at once.
21 *
22 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
23 */
24 public class DemuxRingsHandler
25 implements RingsHandler
26 {
27 /**
28 * The list of internal ring handlers.
29 */
30 protected ArrayList<RingsHandler> handlers;
31
32 /**
33 * Default constructor.
34 */
35 public DemuxRingsHandler() {
36 handlers = new ArrayList<RingsHandler>();
37 }
38
39 /**
40 * Add a ring handler to the list of handlers.
41 * @param handler The handler to add to the internal list.
42 */
43 public void addHandler(RingsHandler handler) {
44 handlers.add(handler);
45 }
46
47 public void handleRings(
48 List<Edge> rings,
49 int value,
50 int width,
51 int height
52 ) {
53 for (RingsHandler handler: handlers) {
54 handler.handleRings(rings, value, width, height);
55 }
56 }
57
58 /**
59 * Empties the internal list of ring handlers.
60 */
61 public void clear() {
62 handlers.clear();
63 }
64 }
65 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org