Changeset 32090 in osm for applications/editors/josm/plugins/seachart/src/render/Signals.java
- Timestamp:
- 2016-03-03T08:32:31+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Signals.java
r32088 r32090 84 84 } 85 85 86 public static void addSignals(Feature feature) {87 if (feature.objs.containsKey(Obj.FOGSIG)) fogSignals(feature);88 if (feature.objs.containsKey(Obj.RTPBCN)) radarStations(feature);89 if (feature.objs.containsKey(Obj.RADSTA)) radarStations(feature);90 if (feature.objs.containsKey(Obj.RDOSTA)) radioStations(feature);91 if (feature.objs.containsKey(Obj.LIGHTS)) lights(feature);92 }93 94 86 static final EnumMap<CatFOG, String> fogSignals = new EnumMap<CatFOG, String>(CatFOG.class); 95 87 static { … … 108 100 static final DecimalFormat df = new DecimalFormat("#.#"); 109 101 110 public static void fogSignals(Feature feature) { 111 Renderer.symbol(feature, Beacons.FogSignal); 112 AttMap atts = feature.objs.get(Obj.FOGSIG).get(0); 113 String str = ""; 114 if (atts.containsKey(Att.CATFOG)) { 115 str += fogSignals.get(((ArrayList<?>)(atts.get(Att.CATFOG).val)).get(0)); 116 } 117 if (atts.containsKey(Att.SIGGRP)) { 118 str += "(" + atts.get(Att.SIGGRP).val + ")"; 119 } else { 120 str += " "; 121 } 122 if (atts.containsKey(Att.SIGPER)) { 123 str += df.format(atts.get(Att.SIGPER).val) + "s"; 124 } 125 if (atts.containsKey(Att.VALMXR)) { 126 str += df.format(atts.get(Att.VALMXR).val) + "M"; 127 } 128 if ((Renderer.zoom >= 15) && !str.isEmpty()) { 129 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40),Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30))); 130 } 131 } 132 133 public static void radarStations(Feature feature) { 134 Renderer.symbol(feature, Beacons.RadarStation); 135 String bstr = ""; 136 CatRTB cat = (CatRTB) Rules.getAttEnum(feature, Obj.RTPBCN, 0, Att.CATRTB); 137 String wal = Rules.getAttStr(feature, Obj.RTPBCN, 0, Att.RADWAL); 138 switch (cat) { 139 case RTB_RAMK: 140 bstr += " Ramark"; 141 break; 142 case RTB_RACN: 143 bstr += " Racon"; 144 String astr = Rules.getAttStr(feature, Obj.RTPBCN, 0, Att.SIGGRP); 145 if (!astr.isEmpty()) { 146 bstr += "(" + astr + ")"; 147 } 148 Double per = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGPER); 149 Double mxr = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.VALMXR); 150 if ((per != null) || (mxr != null)) { 151 bstr += (astr.isEmpty() ? " " : ""); 152 if (per != null) bstr += (per != 0) ? per.toString() + "s" : ""; 153 if (mxr != null) bstr += (mxr != 0) ? mxr.toString() + "M" : ""; 154 } 155 break; 156 default: 157 break; 158 } 159 if (!wal.isEmpty()) { 160 switch (wal) { 161 case "0.03-X": 162 bstr += "(3cm)"; 102 public static void addSignals() { 103 if (Rules.feature.objs.containsKey(Obj.RADRFL)) reflectors(); 104 if (Rules.feature.objs.containsKey(Obj.FOGSIG)) fogSignals(); 105 if (Rules.feature.objs.containsKey(Obj.RTPBCN)) radarStations(); 106 if (Rules.feature.objs.containsKey(Obj.RADSTA)) radarStations(); 107 if (Rules.feature.objs.containsKey(Obj.RDOSTA)) radioStations(); 108 if (Rules.feature.objs.containsKey(Obj.LIGHTS)) lights(); 109 } 110 111 public static void reflectors() { 112 if (Renderer.zoom >= 14) { 113 switch (Rules.feature.type) { 114 case BCNLAT: 115 case BCNCAR: 116 case BCNISD: 117 case BCNSAW: 118 case BCNSPP: 119 case LITFLT: 120 case LITVES: 121 case BOYINB: 122 if ((Rules.feature.objs.containsKey(Obj.TOPMAR)) || (Rules.feature.objs.containsKey(Obj.DAYMAR))) { 123 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -140))); 124 } else { 125 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -80))); 126 } 163 127 break; 164 case "0.10-S": 165 bstr += "(10cm)"; 128 case LITMAJ: 129 case LITMIN: 130 if ((Rules.feature.objs.containsKey(Obj.TOPMAR)) || (Rules.feature.objs.containsKey(Obj.DAYMAR))) { 131 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 132 } else { 133 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -30))); 134 } 166 135 break; 167 } 168 } 169 if ((Renderer.zoom >= 15) && !bstr.isEmpty()) { 170 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 171 } 172 } 173 174 @SuppressWarnings("unchecked") 175 public static void radioStations(Feature feature) { 176 ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttList(feature, Obj.RDOSTA, 0, Att.CATROS); 177 boolean vais = false; 178 String bstr = ""; 179 for (CatROS ros : cats) { 180 switch (ros) { 181 case ROS_OMNI: 182 bstr += " RC"; 183 break; 184 case ROS_DIRL: 185 bstr += " RD"; 186 break; 187 case ROS_ROTP: 188 bstr += " RW"; 189 break; 190 case ROS_CNSL: 191 bstr += " Consol"; 192 break; 193 case ROS_RDF: 194 bstr += " RG"; 195 break; 196 case ROS_QTA: 197 bstr += " R"; 198 break; 199 case ROS_AERO: 200 bstr += " AeroRC"; 201 break; 202 case ROS_DECA: 203 bstr += " Decca"; 204 break; 205 case ROS_LORN: 206 bstr += " Loran"; 207 break; 208 case ROS_DGPS: 209 bstr += " DGPS"; 210 break; 211 case ROS_TORN: 212 bstr += " Toran"; 213 break; 214 case ROS_OMGA: 215 bstr += " Omega"; 216 break; 217 case ROS_SYLD: 218 bstr += " Syledis"; 219 break; 220 case ROS_CHKA: 221 bstr += " Chiaka"; 222 break; 223 case ROS_PCOM: 224 case ROS_COMB: 225 case ROS_FACS: 226 case ROS_TIME: 227 break; 228 case ROS_PAIS: 229 case ROS_SAIS: 230 bstr += " AIS"; 231 break; 232 case ROS_VAIS: 233 vais = true; 234 break; 235 case ROS_VANC: 236 vais = true; 237 Renderer.symbol(feature, Topmarks.TopNorth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 238 break; 239 case ROS_VASC: 240 vais = true; 241 Renderer.symbol(feature, Topmarks.TopSouth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 242 break; 243 case ROS_VAEC: 244 vais = true; 245 Renderer.symbol(feature, Topmarks.TopEast, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 246 break; 247 case ROS_VAWC: 248 vais = true; 249 Renderer.symbol(feature, Topmarks.TopWest, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 250 break; 251 case ROS_VAPL: 252 vais = true; 253 Renderer.symbol(feature, Topmarks.TopCan, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 254 break; 255 case ROS_VASL: 256 vais = true; 257 Renderer.symbol(feature, Topmarks.TopCone, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 258 break; 259 case ROS_VAID: 260 vais = true; 261 Renderer.symbol(feature, Topmarks.TopIsol, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 262 break; 263 case ROS_VASW: 264 vais = true; 265 Renderer.symbol(feature, Topmarks.TopSphere, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 266 break; 267 case ROS_VASP: 268 vais = true; 269 Renderer.symbol(feature, Topmarks.TopX, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 270 break; 271 case ROS_VAWK: 272 vais = true; 273 Renderer.symbol(feature, Topmarks.TopCross, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 136 case BOYLAT: 137 case BOYCAR: 138 case BOYISD: 139 case BOYSAW: 140 case BOYSPP: 141 if ((Rules.feature.objs.containsKey(Obj.TOPMAR)) || (Rules.feature.objs.containsKey(Obj.DAYMAR))) { 142 if (Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR) || Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR)) { 143 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(45, -140))); 144 } else { 145 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(25, -80))); 146 } 147 } else { 148 if (Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR) || Rules.testAttribute(Rules.feature.type, Att.BOYSHP, BoySHP.BOY_PILR)) { 149 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(30, -100))); 150 } else { 151 Renderer.symbol(Topmarks.RadarReflector, new Delta(Handle.BC, AffineTransform.getTranslateInstance(10, -50))); 152 } 153 } 274 154 break; 275 155 default: … … 277 157 } 278 158 } 279 if (!vais) { 280 Renderer.symbol(feature, Beacons.RadarStation); 159 } 160 161 public static void fogSignals() { 162 if (Renderer.zoom >= 11) 163 Renderer.symbol(Beacons.FogSignal); 164 if (Renderer.zoom >= 15) { 165 AttMap atts = Rules.feature.objs.get(Obj.FOGSIG).get(0); 166 String str = ""; 167 if (atts.containsKey(Att.CATFOG)) { 168 str += fogSignals.get(((ArrayList<?>) (atts.get(Att.CATFOG).val)).get(0)); 169 } 170 if (atts.containsKey(Att.SIGGRP)) { 171 str += "(" + atts.get(Att.SIGGRP).val + ")"; 172 } else { 173 str += " "; 174 } 175 if (atts.containsKey(Att.SIGPER)) { 176 str += df.format(atts.get(Att.SIGPER).val) + "s"; 177 } 178 if (atts.containsKey(Att.VALMXR)) { 179 str += df.format(atts.get(Att.VALMXR).val) + "M"; 180 } 181 if (!str.isEmpty()) { 182 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30))); 183 } 184 } 185 } 186 187 public static void radarStations() { 188 if (Renderer.zoom >= 11) 189 Renderer.symbol(Beacons.RadarStation); 190 if (Renderer.zoom >= 15) { 191 String bstr = ""; 192 CatRTB cat = (CatRTB) Rules.getAttEnum(Obj.RTPBCN, Att.CATRTB); 193 String wal = Rules.getAttStr(Obj.RTPBCN, Att.RADWAL); 194 switch (cat) { 195 case RTB_RAMK: 196 bstr += " Ramark"; 197 break; 198 case RTB_RACN: 199 bstr += " Racon"; 200 String astr = Rules.getAttStr(Obj.RTPBCN, Att.SIGGRP); 201 if (!astr.isEmpty()) { 202 bstr += "(" + astr + ")"; 203 } 204 Double per = (Double) Rules.getAttVal(Obj.RTPBCN, Att.SIGPER); 205 Double mxr = (Double) Rules.getAttVal(Obj.RTPBCN, Att.VALMXR); 206 if ((per != null) || (mxr != null)) { 207 bstr += (astr.isEmpty() ? " " : ""); 208 if (per != null) 209 bstr += (per != 0) ? per.toString() + "s" : ""; 210 if (mxr != null) 211 bstr += (mxr != 0) ? mxr.toString() + "M" : ""; 212 } 213 break; 214 default: 215 break; 216 } 217 if (!wal.isEmpty()) { 218 switch (wal) { 219 case "0.03-X": 220 bstr += "(3cm)"; 221 break; 222 case "0.10-S": 223 bstr += "(10cm)"; 224 break; 225 } 226 } 227 if (!bstr.isEmpty()) { 228 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70))); 229 } 230 } 231 } 232 233 @SuppressWarnings("unchecked") 234 public static void radioStations() { 235 boolean vais = false; 236 String bstr = ""; 237 if (Renderer.zoom >= 11) { 238 ArrayList<CatROS> cats = (ArrayList<CatROS>) Rules.getAttList(Obj.RDOSTA, Att.CATROS); 239 for (CatROS ros : cats) { 240 switch (ros) { 241 case ROS_OMNI: 242 bstr += " RC"; 243 break; 244 case ROS_DIRL: 245 bstr += " RD"; 246 break; 247 case ROS_ROTP: 248 bstr += " RW"; 249 break; 250 case ROS_CNSL: 251 bstr += " Consol"; 252 break; 253 case ROS_RDF: 254 bstr += " RG"; 255 break; 256 case ROS_QTA: 257 bstr += " R"; 258 break; 259 case ROS_AERO: 260 bstr += " AeroRC"; 261 break; 262 case ROS_DECA: 263 bstr += " Decca"; 264 break; 265 case ROS_LORN: 266 bstr += " Loran"; 267 break; 268 case ROS_DGPS: 269 bstr += " DGPS"; 270 break; 271 case ROS_TORN: 272 bstr += " Toran"; 273 break; 274 case ROS_OMGA: 275 bstr += " Omega"; 276 break; 277 case ROS_SYLD: 278 bstr += " Syledis"; 279 break; 280 case ROS_CHKA: 281 bstr += " Chiaka"; 282 break; 283 case ROS_PCOM: 284 case ROS_COMB: 285 case ROS_FACS: 286 case ROS_TIME: 287 break; 288 case ROS_PAIS: 289 case ROS_SAIS: 290 bstr += " AIS"; 291 break; 292 case ROS_VAIS: 293 vais = true; 294 break; 295 case ROS_VANC: 296 vais = true; 297 Renderer.symbol(Topmarks.TopNorth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 298 break; 299 case ROS_VASC: 300 vais = true; 301 Renderer.symbol(Topmarks.TopSouth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 302 break; 303 case ROS_VAEC: 304 vais = true; 305 Renderer.symbol(Topmarks.TopEast, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 306 break; 307 case ROS_VAWC: 308 vais = true; 309 Renderer.symbol(Topmarks.TopWest, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 310 break; 311 case ROS_VAPL: 312 vais = true; 313 Renderer.symbol(Topmarks.TopCan, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 314 break; 315 case ROS_VASL: 316 vais = true; 317 Renderer.symbol(Topmarks.TopCone, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 318 break; 319 case ROS_VAID: 320 vais = true; 321 Renderer.symbol(Topmarks.TopIsol, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 322 break; 323 case ROS_VASW: 324 vais = true; 325 Renderer.symbol(Topmarks.TopSphere, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 326 break; 327 case ROS_VASP: 328 vais = true; 329 Renderer.symbol(Topmarks.TopX, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 330 break; 331 case ROS_VAWK: 332 vais = true; 333 Renderer.symbol(Topmarks.TopCross, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 334 break; 335 default: 336 break; 337 } 338 } 339 if (!vais) { 340 Renderer.symbol(Beacons.RadarStation); 341 } 281 342 } 282 343 if (Renderer.zoom >= 15) { 283 344 if (vais) { 284 Renderer.labelText( feature,"V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));345 Renderer.labelText("V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70))); 285 346 } 286 347 if (!bstr.isEmpty()) { 287 Renderer.labelText( feature,bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));348 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110))); 288 349 } 289 350 } … … 301 362 302 363 @SuppressWarnings("unchecked") 303 public static void lights( Feature feature) {364 public static void lights() { 304 365 Enum<ColCOL> col = null; 305 366 Enum<ColCOL> tcol = null; 306 ObjTab lights = feature.objs.get(Obj.LIGHTS); 367 ObjTab lights = Rules.feature.objs.get(Obj.LIGHTS); 307 368 for (AttMap atts : lights.values()) { 308 369 if (atts.containsKey(Att.COLOUR)) { … … 322 383 } 323 384 } 324 Renderer.symbol( feature,Beacons.LightFlare, new Scheme(LightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120))));385 Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120)))); 325 386 String str = ""; 326 387 if (lights.get(1) != null) { … … 425 486 } 426 487 if ((s1 <= 360) && (s2 <= 360) && (s1 != s2)) 427 Renderer.lightSector( feature,LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, (Renderer.zoom >= 15) ? str : "");488 Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, (Renderer.zoom >= 15) ? str : ""); 428 489 } 429 490 if (Renderer.zoom >= 15) { … … 432 493 LitCHR chr; 433 494 ColCOL col; 434 ColCOL alt;435 495 String grp; 436 496 double per; … … 468 528 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) (atts.containsKey(Att.COLOUR) ? atts.get(Att.COLOUR).val : new ArrayList<>()); 469 529 sect.col = cols.size() > 0 ? cols.get(0) : ColCOL.COL_UNK; 470 sect.alt = cols.size() > 1 ? cols.get(1) : ColCOL.COL_UNK;471 530 if ((sect.chr != LitCHR.CHR_UNKN) && (sect.col != null)) 472 531 litatts.add(sect); … … 552 611 if (colrng.get(0).rng > 0) 553 612 str += df.format(colrng.get(0).rng) + ((colrng.size() > 1) ? ((colrng.size() > 2) ? ("-" + df.format(colrng.get(colrng.size() - 1).rng)) : ("/" + df.format(colrng.get(1).rng))) : "") + "M"; 554 Renderer.labelText( feature,str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y)));613 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y))); 555 614 y += 40; 556 615 str = ""; … … 609 668 str += (cats.contains(CatLIT.LIT_UPPR)) ? "(Upper)" : ""; 610 669 str += (cats.contains(CatLIT.LIT_LOWR)) ? "(Lower)" : ""; 611 Renderer.labelText( feature,str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30)));670 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30))); 612 671 } 613 672 }
Note:
See TracChangeset
for help on using the changeset viewer.