source: josm/trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java@ 5431

Last change on this file since 5431 was 4087, checked in by bastiK, 13 years ago

PaintVisitor refactoring, includes hook for external MapRenderers (author: Gubaer)

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm.visitor.paint;
3
4import java.awt.Graphics2D;
5
6import org.openstreetmap.josm.gui.NavigatableComponent;
7import org.openstreetmap.josm.tools.CheckParameterUtil;
8
9/**
10 * <p>Abstract common superclass for {@link Rendering} implementations.</p>
11 *
12 */
13public abstract class AbstractMapRenderer implements Rendering {
14
15 /** the graphics context to which the visitor renders OSM objects */
16 protected Graphics2D g;
17 /** the map viewport - provides projection and hit detection functionality */
18 protected NavigatableComponent nc;
19 /** if true, the paint visitor shall render OSM objects such that they
20 * look inactive. Example: rendering of data in an inactive layer using light gray as color only.
21 */
22 protected boolean isInactiveMode;
23
24 /**
25 * <p>Creates an abstract paint visitor</p>
26 *
27 * @param g the graphics context. Must not be null.
28 * @param nc the map viewport. Must not be null.
29 * @param isInactiveMode if true, the paint visitor shall render OSM objects such that they
30 * look inactive. Example: rendering of data in an inactive layer using light gray as color only.
31 * @throws IllegalArgumentException thrown if {@code g} is null
32 * @throws IllegalArgumentException thrown if {@code nc} is null
33 */
34 public AbstractMapRenderer(Graphics2D g, NavigatableComponent nc, boolean isInactiveMode) throws IllegalArgumentException{
35 CheckParameterUtil.ensureParameterNotNull(g);
36 CheckParameterUtil.ensureParameterNotNull(nc);
37 this.g = g;
38 this.nc = nc;
39 this.isInactiveMode = isInactiveMode;
40 }
41}
Note: See TracBrowser for help on using the repository browser.