1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
5 | import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
|
---|
6 | import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter;
|
---|
7 |
|
---|
8 | abstract public class ElemStyle {
|
---|
9 |
|
---|
10 | public float z_index;
|
---|
11 | public float object_z_index;
|
---|
12 |
|
---|
13 | public ElemStyle(float z_index, float object_z_index) {
|
---|
14 | this.z_index = z_index;
|
---|
15 | this.object_z_index = object_z_index;
|
---|
16 | }
|
---|
17 |
|
---|
18 | protected ElemStyle(Cascade c) {
|
---|
19 | z_index = c.get("z-index", 0f, Float.class);
|
---|
20 | object_z_index = c.get("object-z-index", 0f, Float.class);
|
---|
21 | }
|
---|
22 |
|
---|
23 | public abstract void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected, boolean member);
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public boolean equals(Object o) {
|
---|
27 | if (!(o instanceof ElemStyle))
|
---|
28 | return false;
|
---|
29 | ElemStyle s = (ElemStyle) o;
|
---|
30 | return z_index == s.z_index && object_z_index == s.object_z_index;
|
---|
31 | }
|
---|
32 |
|
---|
33 | @Override
|
---|
34 | public int hashCode() {
|
---|
35 | int hash = 5;
|
---|
36 | hash = 41 * hash + Float.floatToIntBits(this.z_index);
|
---|
37 | hash = 41 * hash + Float.floatToIntBits(this.object_z_index);
|
---|
38 | return hash;
|
---|
39 | }
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | public String toString() {
|
---|
43 | if (z_index != 0f || object_z_index != 0f)
|
---|
44 | return String.format("z_idx=%s/%s ", z_index, object_z_index);
|
---|
45 | return "";
|
---|
46 | }
|
---|
47 | }
|
---|