Changeset 32088 in osm for applications/editors/josm/plugins/seachart/src/render/Signals.java
- Timestamp:
- 2016-02-29T11:29:17+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Signals.java
r32084 r32088 329 329 Enum<ColCOL> col2 = null; 330 330 double radius = 0.2; 331 double s1 = 0;332 double s2 = 0;333 boolean dir = false;331 double s1 = 361; 332 double s2 = 361; 333 Double dir = null; 334 334 if (atts.containsKey(Att.COLOUR)) { 335 335 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; … … 343 343 radius = (Double) atts.get(Att.LITRAD).val; 344 344 } 345 if (atts.containsKey(Att.SECTR1)) {346 s1 = (Double) atts.get(Att.SECTR1).val;347 } else {348 continue;349 }350 if (atts.containsKey(Att.SECTR2)) {351 s2 = (Double) atts.get(Att.SECTR2).val;352 } else {353 continue;354 }355 345 if (atts.containsKey(Att.CATLIT)) { 356 346 ArrayList<CatLIT> cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val; 357 347 if (cats.contains(CatLIT.LIT_DIR)) { 358 dir = true; 359 } 348 if (atts.containsKey(Att.ORIENT)) { 349 dir = (Double) atts.get(Att.ORIENT).val; 350 s1 = ((dir - 4) + 360) % 360; 351 s2 = (dir + 4) % 360; 352 for (AttMap satts : lights.values()) { 353 double srad = 0.2; 354 double ss1 = 361; 355 double ss2 = 361; 356 Double sdir = null; 357 if (satts == atts) continue; 358 if (satts.containsKey(Att.LITRAD)) { 359 srad = (Double) satts.get(Att.LITRAD).val; 360 } 361 if (srad == radius) { 362 ArrayList<CatLIT> scats = (satts.containsKey(Att.CATLIT)) ? (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<CatLIT>(); 363 if (scats.contains(CatLIT.LIT_DIR)) { 364 if (satts.containsKey(Att.ORIENT)) { 365 sdir = (Double) satts.get(Att.ORIENT).val; 366 ss1 = sdir; 367 ss2 = sdir; 368 } 369 } else { 370 if (satts.containsKey(Att.SECTR1)) { 371 ss1 = (Double) satts.get(Att.SECTR1).val; 372 } 373 if (satts.containsKey(Att.SECTR2)) { 374 ss2 = (Double) satts.get(Att.SECTR2).val; 375 } 376 } 377 if ((ss1 > 360) || (ss2 > 360)) continue; 378 if (sdir != null) { 379 if (((dir - sdir + 360) % 360) < 8) { 380 s1 = ((((sdir > dir) ? 360 : 0) + sdir + dir) / 2) % 360; 381 } 382 if (((sdir - dir + 360) % 360) < 8) { 383 s2 = ((((dir > sdir) ? 360 : 0) + sdir + dir) / 2) % 360; 384 } 385 } else { 386 if (((dir - ss2 + 360) % 360) < 4) { 387 s1 = ss2; 388 } 389 if (((ss1 - dir + 360) % 360) < 4) { 390 s2 = ss1; 391 } 392 } 393 } 394 } 395 } 396 } 397 } 398 if ((s1 > 360) && atts.containsKey(Att.SECTR1)) { 399 s1 = (Double) atts.get(Att.SECTR1).val; 400 } else if (dir == null) { 401 continue; 402 } 403 if ((s2 > 360) && atts.containsKey(Att.SECTR2)) { 404 s2 = (Double) atts.get(Att.SECTR2).val; 405 } else if (dir == null) { 406 continue; 360 407 } 361 408 str = ""; … … 377 424 str += "." + df.format(atts.get(Att.SIGPER).val) + "s"; 378 425 } 379 if (dir && atts.containsKey(Att.ORIENT)) { 380 double orient = (Double) atts.get(Att.ORIENT).val; 381 str += " " + orient + "°"; 382 s1 = (orient - 4 + 360) % 360; 383 s2 = (orient + 4) % 360; 384 double n1 = 360; 385 double n2 = 360; 386 for (AttMap sect : lights.values()) { 387 if (sect != atts) { 388 389 } 390 } 391 } 392 Renderer.lightSector(feature, LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, (Renderer.zoom >= 15) ? str : ""); 426 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 : ""); 393 428 } 394 429 if (Renderer.zoom >= 15) { … … 403 438 double hgt; 404 439 } 405 str = "";406 440 ArrayList<LitSect> litatts = new ArrayList<>(); 407 441 for (AttMap atts : lights.values()) { 408 442 LitSect sect = new LitSect(); 409 sect.dir = (atts.containsKey(Att.CATLIT) ) && (atts.get(Att.CATLIT).val == CatLIT.LIT_DIR);443 sect.dir = (atts.containsKey(Att.CATLIT) && ((ArrayList<CatLIT>)atts.get(Att.CATLIT).val).contains(CatLIT.LIT_DIR)); 410 444 sect.chr = atts.containsKey(Att.LITCHR) ? ((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0) : LitCHR.CHR_UNKN; 411 445 switch (sect.chr) { … … 501 535 } 502 536 LitSect tmp = group.get(0); 503 if (tmp.dir) 504 str += "Dir"; 537 str = (tmp.dir) ? "Dir" : ""; 505 538 str += LightCharacters.get(tmp.chr); 506 539 if (!tmp.grp.isEmpty()) … … 531 564 cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val; 532 565 } 533 str += (cats.contains(CatLIT.LIT_DIR)) ? "Dir" : "";566 str = (cats.contains(CatLIT.LIT_DIR)) ? "Dir" : ""; 534 567 str += (atts.containsKey(Att.MLTYLT)) ? atts.get(Att.MLTYLT).val : ""; 535 568 if (atts.containsKey(Att.LITCHR)) {
Note:
See TracChangeset
for help on using the changeset viewer.