001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.renderer;
017:
018: import java.awt.Graphics2D;
019: import java.awt.Rectangle;
020: import java.awt.RenderingHints;
021: import java.awt.geom.AffineTransform;
022: import java.util.Map;
023:
024: import org.geotools.geometry.jts.ReferencedEnvelope;
025: import org.geotools.map.MapContext;
026:
027: import com.vividsolutions.jts.geom.Envelope;
028:
029: /**
030: * Typical usage: <pre>
031: *
032: * Rectangle paintArea = new Rectangle(width, height);
033: * Envelope mapArea = map.getAreaOfInterest();
034: *
035: * renderer = new StreamingRenderer();
036: * renderer.setContext(map);
037: *
038: * RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
039: * renderer.setJava2DHints(hints);
040: *
041: * Map rendererParams = new HashMap();
042: * rendererParams.put("optimizedDataLoadingEnabled",new Boolean(true) );
043: *
044: * renderer.paint(graphic, paintArea, mapArea);
045: *</pre>
046: *
047: * @author David Blasby
048: * @author Simone Giannecchini
049: *
050: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/render/src/main/java/org/geotools/renderer/GTRenderer.java $
051: */
052:
053: public interface GTRenderer {
054: public void stopRendering();
055:
056: public void addRenderListener(RenderListener listener);
057:
058: public void removeRenderListener(RenderListener listener);
059:
060: public void setJava2DHints(RenderingHints hints);
061:
062: public RenderingHints getJava2DHints();
063:
064: public void setRendererHints(Map hints);
065:
066: public Map getRendererHints();
067:
068: public void setContext(MapContext context);
069:
070: public MapContext getContext();
071:
072: /** Renders features based on the map layers and their styles as specified
073: * in the map context using <code>setContext</code>.
074: * <p/>
075: * This version of the method assumes that the size of the output area
076: * and the transformation from coordinates to pixels are known.
077: * The latter determines the map scale. The viewport (the visible
078: * part of the map) will be calculated internally.
079: *
080: * @param graphics The graphics object to draw to.
081: * @param paintArea The size of the output area in output units (eg: pixels).
082: * @param worldToScreen A transform which converts World coordinates to Screen coordinates.
083: * @task Need to check if the Layer CoordinateSystem is different to the BoundingBox rendering
084: * CoordinateSystem and if so, then transform the coordinates.
085: */
086: public void paint(Graphics2D graphics, Rectangle paintArea,
087: AffineTransform worldToScreen);
088:
089: /** Renders features based on the map layers and their styles as specified
090: * in the map context using <code>setContext</code>.
091: * <p/>
092: * This version of the method assumes that the area of the visible part
093: * of the map and the size of the output area are known. The transform
094: * between the two is calculated internally.
095: *
096: * @param graphics The graphics object to draw to.
097: * @param paintArea The size of the output area in output units (eg: pixels).
098: * @param mapArea the map's visible area (viewport) in map coordinates.
099: */
100: public void paint(Graphics2D graphics, Rectangle paintArea,
101: Envelope mapArea);
102:
103: /**
104: * Renders features based on the map layers and their styles as specified in
105: * the map context using <code>setContext</code>. <p/> This version of
106: * the method assumes that the area of the visible part of the map and the
107: * size of the output area are known. The transform between the two is
108: * calculated internally.
109: *
110: * @param graphics
111: * The graphics object to draw to.
112: * @param paintArea
113: * The size of the output area in output units (eg: pixels).
114: * @param mapArea
115: * the map's visible area (viewport) in map coordinates.
116: */
117: public void paint(Graphics2D graphics, Rectangle paintArea,
118: ReferencedEnvelope mapArea);
119:
120: /**
121: * Renders features based on the map layers and their styles as specified
122: * in the map context using <code>setContext</code>.
123: * <p/>
124: * This version of the method assumes that paint area, enelope and
125: * worldToScreen transform are already computed and in sync. Use this method
126: * to avoid recomputation. <b>Note however that no check is performed that
127: * they are really synchronized!<b/>
128: *
129: * @param graphics The graphics object to draw to.
130: * @param paintArea The size of the output area in output units (eg: pixels).
131: * @param mapArea the map's visible area (viewport) in map coordinates.
132: * @param worldToScreen A transform which converts World coordinates to Screen coordinates.
133: */
134: public void paint(Graphics2D graphics, Rectangle paintArea,
135: Envelope mapArea, AffineTransform worldToScreen);
136:
137: /**
138: * Renders features based on the map layers and their styles as specified in
139: * the map context using <code>setContext</code>. <p/> This version of
140: * the method assumes that paint area, enelope and worldToScreen transform
141: * are already computed and in sync. Use this method to avoid recomputation.
142: * <b>Note however that no check is performed that they are really
143: * synchronized!<b/>
144: *
145: * @param graphics
146: * The graphics object to draw to.
147: * @param paintArea
148: * The size of the output area in output units (eg: pixels).
149: * @param mapArea
150: * the map's visible area (viewport) in map coordinates.
151: * @param worldToScreen
152: * A transform which converts World coordinates to Screen
153: * coordinates.
154: *
155: */
156: public void paint(Graphics2D graphics, Rectangle paintArea,
157: ReferencedEnvelope mapArea, AffineTransform worldToScreen);
158: }
|