1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint;
|
---|
3 |
|
---|
4 | import java.awt.Color;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
7 | import org.openstreetmap.josm.data.osm.Way;
|
---|
8 | import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
|
---|
9 | import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter;
|
---|
10 | import org.openstreetmap.josm.tools.Utils;
|
---|
11 |
|
---|
12 | public class AreaElemStyle extends ElemStyle
|
---|
13 | {
|
---|
14 | public Color color;
|
---|
15 |
|
---|
16 | public AreaElemStyle(long minScale, long maxScale, Color color) {
|
---|
17 | super(minScale, maxScale);
|
---|
18 | this.color = color;
|
---|
19 | }
|
---|
20 |
|
---|
21 | @Override
|
---|
22 | public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected, boolean member) {
|
---|
23 | if (primitive instanceof Way) {
|
---|
24 | Way w = (Way) primitive;
|
---|
25 | String name = painter.isShowNames() ? painter.getAreaName(w) : null;
|
---|
26 | painter.drawArea(w, w.isSelected() ? paintSettings.getSelectedColor() : color, name);
|
---|
27 | // line.paintPrimitive(way, paintSettings, painter, selected);
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | @Override
|
---|
32 | public boolean equals(Object obj) {
|
---|
33 | if (obj == null || getClass() != obj.getClass())
|
---|
34 | return false;
|
---|
35 | if (!super.equals(obj))
|
---|
36 | return false;
|
---|
37 | return Utils.equal(color, ((AreaElemStyle) obj).color);
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public int hashCode() {
|
---|
42 | return color.hashCode();
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public String toString() {
|
---|
47 | return "AreaElemStyle{" + "color=" + color + '}';
|
---|
48 | }
|
---|
49 | }
|
---|