source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java@ 3865

Last change on this file since 3865 was 3865, checked in by bastiK, 15 years ago

mapcss: basic support for node shapes and some fine tuning

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint;
3
4import org.openstreetmap.josm.data.osm.OsmPrimitive;
5import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
6import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter;
7
8abstract public class ElemStyle {
9
10 public float z_index;
11 public float object_z_index;
12 public boolean isModifier; // false, if style can serve as main style for the
13 // primitive; true, if it is a highlight or modifier
14
15 public ElemStyle(float z_index, float object_z_index, boolean isModifier) {
16 this.z_index = z_index;
17 this.object_z_index = object_z_index;
18 this.isModifier = isModifier;
19 }
20
21 protected ElemStyle(Cascade c) {
22 z_index = c.get("z-index", 0f, Float.class);
23 object_z_index = c.get("object-z-index", 0f, Float.class);
24 isModifier = c.get("modifier", false, Boolean.class);
25 }
26
27 public abstract void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected, boolean member);
28
29 @Override
30 public boolean equals(Object o) {
31 if (!(o instanceof ElemStyle))
32 return false;
33 ElemStyle s = (ElemStyle) o;
34 return z_index == s.z_index && object_z_index == s.object_z_index && isModifier == s.isModifier;
35 }
36
37 @Override
38 public int hashCode() {
39 int hash = 5;
40 hash = 41 * hash + Float.floatToIntBits(this.z_index);
41 hash = 41 * hash + Float.floatToIntBits(this.object_z_index);
42 hash = 41 * hash + (isModifier ? 1 : 0);
43 return hash;
44 }
45
46 @Override
47 public String toString() {
48 if (z_index != 0f || object_z_index != 0f)
49 return String.format("z_idx=%s/%s ", z_index, object_z_index) + (isModifier ? "modifier " : "");
50 return "";
51 }
52}
Note: See TracBrowser for help on using the repository browser.