Changeset 29929 in osm for applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
- Timestamp:
- 2013-09-18T12:41:49+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29826 r29929 27 27 public class Renderer { 28 28 29 public static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class); 30 static { 31 bodyColours.put(ColCOL.COL_UNK, new Color(0, true)); 32 bodyColours.put(ColCOL.COL_WHT, new Color(0xffffff)); 33 bodyColours.put(ColCOL.COL_BLK, new Color(0x000000)); 34 bodyColours.put(ColCOL.COL_RED, new Color(0xd40000)); 35 bodyColours.put(ColCOL.COL_GRN, new Color(0x00d400)); 36 bodyColours.put(ColCOL.COL_BLU, Color.blue); 37 bodyColours.put(ColCOL.COL_YEL, new Color(0xffd400)); 38 bodyColours.put(ColCOL.COL_GRY, Color.gray); 39 bodyColours.put(ColCOL.COL_BRN, new Color(0x8b4513)); 40 bodyColours.put(ColCOL.COL_AMB, new Color(0xfbf00f)); 41 bodyColours.put(ColCOL.COL_VIO, new Color(0xee82ee)); 42 bodyColours.put(ColCOL.COL_ORG, Color.orange); 43 bodyColours.put(ColCOL.COL_MAG, new Color(0xf000f0)); 44 bodyColours.put(ColCOL.COL_PNK, Color.pink); 45 } 46 47 public static final EnumMap<ColPAT, Patt> pattMap = new EnumMap<ColPAT, Patt>(ColPAT.class); 48 static { 49 pattMap.put(ColPAT.PAT_UNKN, Patt.Z); 50 pattMap.put(ColPAT.PAT_HORI, Patt.H); 51 pattMap.put(ColPAT.PAT_VERT, Patt.V); 52 pattMap.put(ColPAT.PAT_DIAG, Patt.D); 53 pattMap.put(ColPAT.PAT_BRDR, Patt.B); 54 pattMap.put(ColPAT.PAT_SQUR, Patt.S); 55 pattMap.put(ColPAT.PAT_CROS, Patt.C); 56 pattMap.put(ColPAT.PAT_SALT, Patt.X); 57 pattMap.put(ColPAT.PAT_STRP, Patt.H); 58 } 59 60 public static final double symbolScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007, 0.138 }; 61 62 public static final double textScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.5556, 0.3086, 0.1714, 0.0953, 0.0529, 0.0294, 0.0163, 0.0091, 0.0050, 0.0028, 0.0163 }; 63 29 64 static MapHelper helper; 30 65 static SeaMap map; … … 39 74 helper = h; 40 75 map = m; 41 sScale = Symbols.symbolScale[zoom] * factor;42 tScale = Symbols.textScale[zoom] * factor;76 sScale = symbolScale[zoom] * factor; 77 tScale = textScale[zoom] * factor; 43 78 if (map != null) { 44 79 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); … … 73 108 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), delta, null); 74 109 } else { 75 ArrayList<ColCOL> colours = (ArrayList<ColCOL>) getAttVal(feature, obj, 0, Att.COLOUR); 76 ArrayList<ColPAT> pattern = (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT); 77 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), delta, new Scheme(pattern, colours)); 110 ArrayList<Color> colours = new ArrayList<Color>(); 111 for (ColCOL col : (ArrayList<ColCOL>)getAttVal(feature, obj, 0, Att.COLOUR)) { 112 colours.add(bodyColours.get(col)); 113 } 114 ArrayList<Patt> patterns = new ArrayList<Patt>(); 115 for(ColPAT pat: (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT)) { 116 patterns.add(pattMap.get(pat)); 117 } 118 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), delta, new Scheme(patterns, colours)); 78 119 } 79 120 }
Note:
See TracChangeset
for help on using the changeset viewer.
