1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm.visitor.paint;
|
---|
3 |
|
---|
4 | import java.awt.Graphics2D;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.gui.NavigatableComponent;
|
---|
7 | import org.openstreetmap.josm.tools.CheckParameterUtil;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * <p>Abstract common superclass for {@link Rendering} implementations.</p>
|
---|
11 | *
|
---|
12 | */
|
---|
13 | public 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 | }
|
---|