01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.project.render;
18:
19: /**
20: * The CompositeRenderer is a container for all the Renderers of a viewport.
21: * <p>
22: * Produces a Image out of a series of renderers, provides viewport pane notification when content
23: * changes.
24: * </p>
25: * <p>
26: * <li>Renderer must ensure that the layers are combined in the correct zorder. The largest zorder
27: * must be drawn first.</li>
28: * <li>Combines all outputs from contained renderers into a buffered image</li>
29: * <li>Image creation is provided by RenderContext</li>
30: * <li>Double Buffering is handled by someone else (viewport pane)</li>
31: * <li>CompositeRenderer must register with its contained renderers so it can merge the rendered
32: * layers again.</li>
33: * <li>The events the render stack must listen for are setState(DONE) events. The following code
34: * illustrates how this can be done:
35: *
36: * <pre><code>
37: * executor.eAdapters().add(new RenderListenerAdapter(){
38: * //renderDone is called when setState(DONE) is called
39: * protected void renderDone() {
40: * synchronized (CompositeRendererImpl.this) {
41: * setState(DONE);
42: * }
43: * }
44: * });
45: * </code></pre>
46: *
47: * <li>Call setState(RENDERING) when a redraw is required.</li>
48: * </p>
49: * The Default implementation simply draws the layers overtop one another to merge the Layers.
50: * CompositeRenderer
51: * </p>
52: *
53: * @author jeichar
54: */
55: public interface IMultiLayerRenderer extends IRenderer {
56:
57: /**
58: * Implementation always returns a CompositeRendererContext.
59: * <p>
60: * Note: The declaration of getContext is declared in IRender so the return type cannot be
61: * declared in this interface
62: * </p>
63: *
64: * @return a CompositeRendererContext.
65: */
66: IRenderContext getContext();
67:
68: /**
69: * Called when the map has changed.
70: * <p>
71: * This method is guaranteed not to block.
72: * </p>
73: * <p>
74: * Usually the image will merge the images for each layer. However in some cases, such as for a
75: * WMS, the image will have to be recreated. This should be a quick operation.
76: * </p>
77: * <p>
78: * Note: This command differs from render. render() forces a full rerendering of the data
79: * whereas refreshImage does not require that the renderer access the data again.
80: *
81: * @throws RenderException
82: */
83: void refreshImage() throws RenderException;
84: }
|