01: /**
02: *
03: */package org.geotools.renderer.lite;
04:
05: import java.awt.Graphics2D;
06: import java.awt.Rectangle;
07: import java.util.List;
08:
09: import javax.media.jai.util.Range;
10:
11: import org.geotools.feature.Feature;
12: import org.geotools.geometry.jts.LiteShape2;
13: import org.geotools.styling.TextSymbolizer;
14:
15: /**
16: * Allow multiple thread to modify LabelCache.
17: *
18: * @author Jesse
19: */
20: public class SynchronizedLabelCache implements LabelCache {
21:
22: private final LabelCache wrapped;
23:
24: public SynchronizedLabelCache() {
25: this (new LabelCacheDefault());
26: }
27:
28: public SynchronizedLabelCache(LabelCacheDefault default1) {
29: wrapped = default1;
30: }
31:
32: public synchronized void start() {
33: wrapped.start();
34: }
35:
36: public synchronized void clear() {
37: wrapped.clear();
38: }
39:
40: public synchronized void clear(String layerId) {
41: wrapped.clear(layerId);
42: }
43:
44: public synchronized void enableLayer(String layerId) {
45: wrapped.enableLayer(layerId);
46: }
47:
48: public synchronized void end(Graphics2D graphics,
49: Rectangle displayArea) {
50: wrapped.end(graphics, displayArea);
51: }
52:
53: public synchronized void endLayer(String layerId,
54: Graphics2D graphics, Rectangle displayArea) {
55: wrapped.endLayer(layerId, graphics, displayArea);
56: }
57:
58: public synchronized void put(String layerId,
59: TextSymbolizer symbolizer, Feature feature,
60: LiteShape2 shape, Range scaleRange) {
61: wrapped.put(layerId, symbolizer, feature, shape, scaleRange);
62: }
63:
64: public synchronized void startLayer(String layerId) {
65: wrapped.startLayer(layerId);
66: }
67:
68: public synchronized void stop() {
69: wrapped.stop();
70: }
71:
72: public synchronized void disableLayer(String layerId) {
73: wrapped.disableLayer(layerId);
74: }
75:
76: public synchronized List orderedLabels() {
77: return wrapped.orderedLabels();
78: }
79:
80: }
|