Changeset 35687 in osm for applications/editors/josm/plugins/seachart/src/render
- Timestamp:
- 2021-01-14T11:54:01+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/Signals.java
r35685 r35687 347 347 Enum<ColCOL> tcol = null; 348 348 ObjTab lights = feature.objs.get(Obj.LIGHTS); 349 for (AttMap atts : lights.values()) { 350 if (atts.containsKey(Att.COLOUR)) { 351 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; 352 if (cols.size() == 1) { 353 if (atts.containsKey(Att.CATLIT) && ((ArrayList<?>) atts.get(Att.CATLIT).val).contains(CatLIT.LIT_FLDL)) { 354 Renderer.symbol(Beacons.Floodlight, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(90)))); 355 } else { 356 tcol = cols.get(0); 357 if (col == null) { 358 col = tcol; 359 } else if (tcol != col) { 360 col = ColCOL.COL_MAG; 361 break; 362 } 363 } 364 } else { 365 col = ColCOL.COL_MAG; 366 break; 367 } 368 } 369 } 370 if (col != null) { 371 Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120)))); 372 } 373 String str = ""; 374 if ((lights.get(1) != null) && (Renderer.zoom >= 12)) { 375 for (AttMap atts : lights.values()) { 376 Enum<ColCOL> col1 = null; 377 Enum<ColCOL> col2 = null; 378 double radius = 0.5; 379 if (atts.containsKey(Att.VALNMR)) { 380 radius += Math.log10((Double) atts.get(Att.VALNMR).val) * 2.0; 381 } 382 radius /= Math.pow(Renderer.zoom, 4) / 5000; 383 double s1 = 361; 384 double s2 = 361; 385 Double dir = null; 386 if (atts.containsKey(Att.COLOUR)) { 387 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; 388 col1 = cols.get(0); 389 if (cols.size() > 1) 390 col2 = cols.get(1); 391 } else { 392 continue; 393 } 394 if (atts.containsKey(Att.CATLIT)) { 395 ArrayList<CatLIT> cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val; 396 if (cats.contains(CatLIT.LIT_DIR)) { 397 if (atts.containsKey(Att.ORIENT)) { 398 dir = (Double) atts.get(Att.ORIENT).val; 399 s1 = ((dir - 4) + 360) % 360; 400 s2 = (dir + 4) % 360; 401 for (AttMap satts : lights.values()) { 402 double ss1 = 361; 403 double ss2 = 361; 404 Double sdir = null; 405 if (satts == atts) 406 continue; 407 ArrayList<CatLIT> scats = (ArrayList<CatLIT>) (satts.containsKey(Att.CATLIT) ? (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<>()); 408 if (scats.contains(CatLIT.LIT_DIR)) { 409 if (satts.containsKey(Att.ORIENT)) { 410 sdir = (Double) satts.get(Att.ORIENT).val; 411 ss1 = sdir; 412 ss2 = sdir; 413 } 414 } else { 415 if (satts.containsKey(Att.SECTR1)) { 416 ss1 = (Double) satts.get(Att.SECTR1).val; 417 } 418 if (satts.containsKey(Att.SECTR2)) { 419 ss2 = (Double) satts.get(Att.SECTR2).val; 420 } 421 } 422 if ((ss1 > 360) || (ss2 > 360)) 423 continue; 424 if (sdir != null) { 425 if (((dir - sdir + 360) % 360) < 8) { 426 s1 = ((((sdir > dir) ? 360 : 0) + sdir + dir) / 2) % 360; 427 } 428 if (((sdir - dir + 360) % 360) < 8) { 429 s2 = ((((dir > sdir) ? 360 : 0) + sdir + dir) / 2) % 360; 430 } 431 } else { 432 if (((dir - ss2 + 360) % 360) < 4) { 433 s1 = ss2; 434 } 435 if (((ss1 - dir + 360) % 360) < 4) { 436 s2 = ss1; 437 } 438 } 439 } 440 } 441 } 442 } 443 if ((s1 > 360) && atts.containsKey(Att.SECTR1)) { 444 s1 = (Double) atts.get(Att.SECTR1).val; 445 } else if (dir == null) { 446 continue; 447 } 448 if ((s2 > 360) && atts.containsKey(Att.SECTR2)) { 449 s2 = (Double) atts.get(Att.SECTR2).val; 450 } else if (dir == null) { 451 continue; 452 } 453 str = ""; 454 if (atts.containsKey(Att.LITCHR)) { 455 str += LightCharacters.get(((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0)); 456 } 457 if (atts.containsKey(Att.SIGGRP)) { 458 str += "(" + atts.get(Att.SIGGRP).val + ")"; 459 } else if (!str.isEmpty()) { 460 str += "."; 461 } 462 if (atts.containsKey(Att.COLOUR)) { 463 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; 464 str += LightLetters.get(cols.get(0)); 465 if (cols.size() > 1) 466 str += LightLetters.get(cols.get(1)); 467 } 468 if (atts.containsKey(Att.SIGPER)) { 469 str += "." + df.format(atts.get(Att.SIGPER).val) + "s"; 470 } 471 if ((s1 < 360) && (s2 < 360) && (s1 != s2)) 472 Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, (Renderer.zoom >= 15) ? str : ""); 473 } 474 if (Renderer.zoom >= 15) { 475 class LitSect { 476 boolean dir; 477 LitCHR chr; 478 ColCOL col; 479 String grp; 480 double per; 481 double rng; 482 double hgt; 483 } 484 485 ArrayList<LitSect> litatts = new ArrayList<>(); 486 for (AttMap atts : lights.values()) { 487 LitSect sect = new LitSect(); 488 sect.dir = (atts.containsKey(Att.CATLIT) && ((ArrayList<CatLIT>) atts.get(Att.CATLIT).val).contains(CatLIT.LIT_DIR)); 489 sect.chr = atts.containsKey(Att.LITCHR) ? ((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0) : LitCHR.CHR_UNKN; 490 switch (sect.chr) { 491 case CHR_AL: 492 sect.chr = LitCHR.CHR_F; 493 break; 494 case CHR_ALOC: 495 sect.chr = LitCHR.CHR_OC; 496 break; 497 case CHR_ALLFL: 498 sect.chr = LitCHR.CHR_LFL; 499 break; 500 case CHR_ALFL: 501 sect.chr = LitCHR.CHR_FL; 502 break; 503 case CHR_ALFFL: 504 sect.chr = LitCHR.CHR_FFL; 505 break; 506 default: 507 break; 508 } 509 sect.grp = atts.containsKey(Att.SIGGRP) ? (String) atts.get(Att.SIGGRP).val : ""; 510 sect.per = atts.containsKey(Att.SIGPER) ? (Double) atts.get(Att.SIGPER).val : 0.0; 511 sect.rng = atts.containsKey(Att.VALNMR) ? (Double) atts.get(Att.VALNMR).val : 0.0; 512 sect.hgt = atts.containsKey(Att.HEIGHT) ? (Double) atts.get(Att.HEIGHT).val : 0.0; 513 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) (atts.containsKey(Att.COLOUR) ? atts.get(Att.COLOUR).val : new ArrayList<>()); 514 sect.col = cols.size() > 0 ? cols.get(0) : ColCOL.COL_UNK; 515 if ((sect.chr != LitCHR.CHR_UNKN) && (sect.col != null)) 516 litatts.add(sect); 517 } 518 ArrayList<ArrayList<LitSect>> groupings = new ArrayList<>(); 519 for (LitSect lit : litatts) { 520 boolean found = false; 521 for (ArrayList<LitSect> group : groupings) { 522 LitSect mem = group.get(0); 523 if (lit.dir == mem.dir && lit.chr == mem.chr && lit.grp.equals(mem.grp) && lit.per == mem.per && lit.hgt == mem.hgt) { 524 group.add(lit); 525 found = true; 526 } 527 } 528 if (!found) { 529 ArrayList<LitSect> tmp = new ArrayList<>(); 530 tmp.add(lit); 531 groupings.add(tmp); 532 } 533 } 534 for (boolean moved = true; moved;) { 535 moved = false; 536 for (int i = 0; i < groupings.size() - 1; i++) { 537 if (groupings.get(i).size() < groupings.get(i + 1).size()) { 538 ArrayList<LitSect> tmp = groupings.remove(i); 539 groupings.add(i + 1, tmp); 540 moved = true; 541 } 542 } 543 } 544 class ColRng { 545 ColCOL col; 546 double rng; 547 548 ColRng(ColCOL c, double r) { 549 col = c; 550 rng = r; 551 } 552 } 553 554 int y = -30; 555 for (ArrayList<LitSect> group : groupings) { 556 ArrayList<ColRng> colrng = new ArrayList<>(); 557 for (LitSect lit : group) { 558 boolean found = false; 559 for (ColRng cr : colrng) { 560 if (cr.col == lit.col) { 561 if (lit.rng > cr.rng) { 562 cr.rng = lit.rng; 563 } 564 found = true; 565 } 566 } 567 if (!found) { 568 colrng.add(new ColRng(lit.col, lit.rng)); 569 } 570 } 571 for (boolean moved = true; moved;) { 572 moved = false; 573 for (int i = 0; i < colrng.size() - 1; i++) { 574 if (colrng.get(i).rng < colrng.get(i + 1).rng) { 575 ColRng tmp = colrng.remove(i); 576 colrng.add(i + 1, tmp); 577 moved = true; 578 } 579 } 580 } 581 LitSect tmp = group.get(0); 582 str = tmp.dir ? "Dir" : ""; 583 str += LightCharacters.get(tmp.chr); 584 if (!tmp.grp.isEmpty()) 585 str += "(" + tmp.grp + ")"; 586 else 587 str += "."; 588 for (ColRng cr : colrng) { 589 str += LightLetters.get(cr.col); 590 } 591 if ((tmp.per > 0) || (tmp.hgt > 0) || (colrng.get(0).rng > 0)) 592 str += "."; 593 if (tmp.per > 0) 594 str += df.format(tmp.per) + "s"; 595 if (tmp.hgt > 0) 596 str += df.format(tmp.hgt) + "m"; 597 if (colrng.get(0).rng > 0) 598 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"; 599 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y))); 600 y += 40; 601 str = ""; 602 } 603 } 604 } else { 605 if ((Renderer.zoom >= 15) && (lights.get(0) != null)) { 606 AttMap atts = lights.get(0); 607 ArrayList<CatLIT> cats = new ArrayList<>(); 608 if (atts.containsKey(Att.CATLIT)) { 609 cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val; 610 } 611 str = (cats.contains(CatLIT.LIT_AIR) || cats.contains(CatLIT.LIT_AERO)) ? "Aero" : cats.contains(CatLIT.LIT_DIR) ? "Dir" : ""; 612 str += atts.containsKey(Att.MLTYLT) ? atts.get(Att.MLTYLT).val : ""; 613 if (atts.containsKey(Att.LITCHR)) { 614 LitCHR chr = ((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0); 615 if (atts.containsKey(Att.SIGGRP)) { 616 String grp = (String) atts.get(Att.SIGGRP).val; 617 switch (chr) { 618 case CHR_QLFL: 619 str += String.format("Q(%s)+LFl", grp); 620 break; 621 case CHR_VQLFL: 622 str += String.format("VQ(%s)+LFl", grp); 623 break; 624 case CHR_UQLFL: 625 str += String.format("UQ(%s)+LFl", grp); 626 break; 627 default: 628 str += String.format("%s(%s)", LightCharacters.get(chr), grp); 629 break; 630 } 631 } else { 632 str += LightCharacters.get(chr); 633 } 634 } 635 if (atts.containsKey(Att.COLOUR)) { 636 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) atts.get(Att.COLOUR).val; 637 if (!((cols.size() == 1) && (cols.get(0) == ColCOL.COL_WHT))) { 638 if (!str.isEmpty() && !str.endsWith(")")) { 639 str += "."; 640 } 641 for (ColCOL acol : cols) { 642 str += LightLetters.get(acol); 643 } 644 } 645 } 646 str += cats.contains(CatLIT.LIT_VERT) ? "(vert)" : ""; 647 str += cats.contains(CatLIT.LIT_HORI) ? "(hor)" : ""; 648 str += (!str.isEmpty() && (atts.containsKey(Att.SIGPER) || atts.containsKey(Att.HEIGHT) || atts.containsKey(Att.VALMXR)) && !str.endsWith(")")) ? "." : ""; 649 str += atts.containsKey(Att.SIGPER) ? df.format(atts.get(Att.SIGPER).val) + "s" : ""; 650 str += atts.containsKey(Att.HEIGHT) ? df.format(atts.get(Att.HEIGHT).val) + "m" : ""; 651 str += atts.containsKey(Att.VALNMR) ? df.format(atts.get(Att.VALNMR).val) + "M" : ""; 652 str += cats.contains(CatLIT.LIT_FRNT) ? "(Front)" : ""; 653 str += cats.contains(CatLIT.LIT_REAR) ? "(Rear)" : ""; 654 str += cats.contains(CatLIT.LIT_UPPR) ? "(Upper)" : ""; 655 str += cats.contains(CatLIT.LIT_LOWR) ? "(Lower)" : ""; 656 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30))); 657 } 658 } 659 } 349 if (lights != null) { 350 for (AttMap atts : lights.values()) { 351 if (atts.containsKey(Att.COLOUR)) { 352 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; 353 if (cols.size() == 1) { 354 if (atts.containsKey(Att.CATLIT) 355 && ((ArrayList<?>) atts.get(Att.CATLIT).val).contains(CatLIT.LIT_FLDL)) { 356 Renderer.symbol(Beacons.Floodlight, 357 new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(90)))); 358 } else { 359 tcol = cols.get(0); 360 if (col == null) { 361 col = tcol; 362 } else if (tcol != col) { 363 col = ColCOL.COL_MAG; 364 break; 365 } 366 } 367 } else { 368 col = ColCOL.COL_MAG; 369 break; 370 } 371 } 372 } 373 if (col != null) { 374 Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)), 375 new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120)))); 376 } 377 String str = ""; 378 if ((lights.get(1) != null) && (Renderer.zoom >= 12)) { 379 for (AttMap atts : lights.values()) { 380 Enum<ColCOL> col1 = null; 381 Enum<ColCOL> col2 = null; 382 double radius = 0.5; 383 if (atts.containsKey(Att.VALNMR)) { 384 radius += Math.log10((Double) atts.get(Att.VALNMR).val) * 2.0; 385 } 386 radius /= Math.pow(Renderer.zoom, 4) / 5000; 387 double s1 = 361; 388 double s2 = 361; 389 Double dir = null; 390 if (atts.containsKey(Att.COLOUR)) { 391 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; 392 col1 = cols.get(0); 393 if (cols.size() > 1) 394 col2 = cols.get(1); 395 } else { 396 continue; 397 } 398 if (atts.containsKey(Att.CATLIT)) { 399 ArrayList<CatLIT> cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val; 400 if (cats.contains(CatLIT.LIT_DIR)) { 401 if (atts.containsKey(Att.ORIENT)) { 402 dir = (Double) atts.get(Att.ORIENT).val; 403 s1 = ((dir - 4) + 360) % 360; 404 s2 = (dir + 4) % 360; 405 for (AttMap satts : lights.values()) { 406 double ss1 = 361; 407 double ss2 = 361; 408 Double sdir = null; 409 if (satts == atts) 410 continue; 411 ArrayList<CatLIT> scats = (ArrayList<CatLIT>) (satts.containsKey(Att.CATLIT) 412 ? (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<>()); 413 if (scats.contains(CatLIT.LIT_DIR)) { 414 if (satts.containsKey(Att.ORIENT)) { 415 sdir = (Double) satts.get(Att.ORIENT).val; 416 ss1 = sdir; 417 ss2 = sdir; 418 } 419 } else { 420 if (satts.containsKey(Att.SECTR1)) { 421 ss1 = (Double) satts.get(Att.SECTR1).val; 422 } 423 if (satts.containsKey(Att.SECTR2)) { 424 ss2 = (Double) satts.get(Att.SECTR2).val; 425 } 426 } 427 if ((ss1 > 360) || (ss2 > 360)) 428 continue; 429 if (sdir != null) { 430 if (((dir - sdir + 360) % 360) < 8) { 431 s1 = ((((sdir > dir) ? 360 : 0) + sdir + dir) / 2) % 360; 432 } 433 if (((sdir - dir + 360) % 360) < 8) { 434 s2 = ((((dir > sdir) ? 360 : 0) + sdir + dir) / 2) % 360; 435 } 436 } else { 437 if (((dir - ss2 + 360) % 360) < 4) { 438 s1 = ss2; 439 } 440 if (((ss1 - dir + 360) % 360) < 4) { 441 s2 = ss1; 442 } 443 } 444 } 445 } 446 } 447 } 448 if ((s1 > 360) && atts.containsKey(Att.SECTR1)) { 449 s1 = (Double) atts.get(Att.SECTR1).val; 450 } else if (dir == null) { 451 continue; 452 } 453 if ((s2 > 360) && atts.containsKey(Att.SECTR2)) { 454 s2 = (Double) atts.get(Att.SECTR2).val; 455 } else if (dir == null) { 456 continue; 457 } 458 str = ""; 459 if (atts.containsKey(Att.LITCHR)) { 460 str += LightCharacters.get(((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0)); 461 } 462 if (atts.containsKey(Att.SIGGRP)) { 463 str += "(" + atts.get(Att.SIGGRP).val + ")"; 464 } else if (!str.isEmpty()) { 465 str += "."; 466 } 467 if (atts.containsKey(Att.COLOUR)) { 468 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; 469 str += LightLetters.get(cols.get(0)); 470 if (cols.size() > 1) 471 str += LightLetters.get(cols.get(1)); 472 } 473 if (atts.containsKey(Att.SIGPER)) { 474 str += "." + df.format(atts.get(Att.SIGPER).val) + "s"; 475 } 476 if ((s1 < 360) && (s2 < 360) && (s1 != s2)) 477 Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, 478 (Renderer.zoom >= 15) ? str : ""); 479 } 480 if (Renderer.zoom >= 15) { 481 class LitSect { 482 boolean dir; 483 LitCHR chr; 484 ColCOL col; 485 String grp; 486 double per; 487 double rng; 488 double hgt; 489 } 490 491 ArrayList<LitSect> litatts = new ArrayList<>(); 492 for (AttMap atts : lights.values()) { 493 LitSect sect = new LitSect(); 494 sect.dir = (atts.containsKey(Att.CATLIT) 495 && ((ArrayList<CatLIT>) atts.get(Att.CATLIT).val).contains(CatLIT.LIT_DIR)); 496 sect.chr = atts.containsKey(Att.LITCHR) ? ((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0) 497 : LitCHR.CHR_UNKN; 498 switch (sect.chr) { 499 case CHR_AL: 500 sect.chr = LitCHR.CHR_F; 501 break; 502 case CHR_ALOC: 503 sect.chr = LitCHR.CHR_OC; 504 break; 505 case CHR_ALLFL: 506 sect.chr = LitCHR.CHR_LFL; 507 break; 508 case CHR_ALFL: 509 sect.chr = LitCHR.CHR_FL; 510 break; 511 case CHR_ALFFL: 512 sect.chr = LitCHR.CHR_FFL; 513 break; 514 default: 515 break; 516 } 517 sect.grp = atts.containsKey(Att.SIGGRP) ? (String) atts.get(Att.SIGGRP).val : ""; 518 sect.per = atts.containsKey(Att.SIGPER) ? (Double) atts.get(Att.SIGPER).val : 0.0; 519 sect.rng = atts.containsKey(Att.VALNMR) ? (Double) atts.get(Att.VALNMR).val : 0.0; 520 sect.hgt = atts.containsKey(Att.HEIGHT) ? (Double) atts.get(Att.HEIGHT).val : 0.0; 521 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) (atts.containsKey(Att.COLOUR) 522 ? atts.get(Att.COLOUR).val : new ArrayList<>()); 523 sect.col = cols.size() > 0 ? cols.get(0) : ColCOL.COL_UNK; 524 if ((sect.chr != LitCHR.CHR_UNKN) && (sect.col != null)) 525 litatts.add(sect); 526 } 527 ArrayList<ArrayList<LitSect>> groupings = new ArrayList<>(); 528 for (LitSect lit : litatts) { 529 boolean found = false; 530 for (ArrayList<LitSect> group : groupings) { 531 LitSect mem = group.get(0); 532 if (lit.dir == mem.dir && lit.chr == mem.chr && lit.grp.equals(mem.grp) 533 && lit.per == mem.per && lit.hgt == mem.hgt) { 534 group.add(lit); 535 found = true; 536 } 537 } 538 if (!found) { 539 ArrayList<LitSect> tmp = new ArrayList<>(); 540 tmp.add(lit); 541 groupings.add(tmp); 542 } 543 } 544 for (boolean moved = true; moved;) { 545 moved = false; 546 for (int i = 0; i < groupings.size() - 1; i++) { 547 if (groupings.get(i).size() < groupings.get(i + 1).size()) { 548 ArrayList<LitSect> tmp = groupings.remove(i); 549 groupings.add(i + 1, tmp); 550 moved = true; 551 } 552 } 553 } 554 class ColRng { 555 ColCOL col; 556 double rng; 557 558 ColRng(ColCOL c, double r) { 559 col = c; 560 rng = r; 561 } 562 } 563 564 int y = -30; 565 for (ArrayList<LitSect> group : groupings) { 566 ArrayList<ColRng> colrng = new ArrayList<>(); 567 for (LitSect lit : group) { 568 boolean found = false; 569 for (ColRng cr : colrng) { 570 if (cr.col == lit.col) { 571 if (lit.rng > cr.rng) { 572 cr.rng = lit.rng; 573 } 574 found = true; 575 } 576 } 577 if (!found) { 578 colrng.add(new ColRng(lit.col, lit.rng)); 579 } 580 } 581 for (boolean moved = true; moved;) { 582 moved = false; 583 for (int i = 0; i < colrng.size() - 1; i++) { 584 if (colrng.get(i).rng < colrng.get(i + 1).rng) { 585 ColRng tmp = colrng.remove(i); 586 colrng.add(i + 1, tmp); 587 moved = true; 588 } 589 } 590 } 591 LitSect tmp = group.get(0); 592 str = tmp.dir ? "Dir" : ""; 593 str += LightCharacters.get(tmp.chr); 594 if (!tmp.grp.isEmpty()) 595 str += "(" + tmp.grp + ")"; 596 else 597 str += "."; 598 for (ColRng cr : colrng) { 599 str += LightLetters.get(cr.col); 600 } 601 if ((tmp.per > 0) || (tmp.hgt > 0) || (colrng.get(0).rng > 0)) 602 str += "."; 603 if (tmp.per > 0) 604 str += df.format(tmp.per) + "s"; 605 if (tmp.hgt > 0) 606 str += df.format(tmp.hgt) + "m"; 607 if (colrng.get(0).rng > 0) 608 str += df.format(colrng.get(0).rng) + ((colrng.size() > 1) 609 ? ((colrng.size() > 2) ? ("-" + df.format(colrng.get(colrng.size() - 1).rng)) 610 : ("/" + df.format(colrng.get(1).rng))) 611 : "") + "M"; 612 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 613 new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y))); 614 y += 40; 615 str = ""; 616 } 617 } 618 } else { 619 if ((Renderer.zoom >= 15) && (lights.get(0) != null)) { 620 AttMap atts = lights.get(0); 621 ArrayList<CatLIT> cats = new ArrayList<>(); 622 if (atts.containsKey(Att.CATLIT)) { 623 cats = (ArrayList<CatLIT>) atts.get(Att.CATLIT).val; 624 } 625 str = (cats.contains(CatLIT.LIT_AIR) || cats.contains(CatLIT.LIT_AERO)) ? "Aero" 626 : cats.contains(CatLIT.LIT_DIR) ? "Dir" : ""; 627 str += atts.containsKey(Att.MLTYLT) ? atts.get(Att.MLTYLT).val : ""; 628 if (atts.containsKey(Att.LITCHR)) { 629 LitCHR chr = ((ArrayList<LitCHR>) atts.get(Att.LITCHR).val).get(0); 630 if (atts.containsKey(Att.SIGGRP)) { 631 String grp = (String) atts.get(Att.SIGGRP).val; 632 switch (chr) { 633 case CHR_QLFL: 634 str += String.format("Q(%s)+LFl", grp); 635 break; 636 case CHR_VQLFL: 637 str += String.format("VQ(%s)+LFl", grp); 638 break; 639 case CHR_UQLFL: 640 str += String.format("UQ(%s)+LFl", grp); 641 break; 642 default: 643 str += String.format("%s(%s)", LightCharacters.get(chr), grp); 644 break; 645 } 646 } else { 647 str += LightCharacters.get(chr); 648 } 649 } 650 if (atts.containsKey(Att.COLOUR)) { 651 ArrayList<ColCOL> cols = (ArrayList<ColCOL>) atts.get(Att.COLOUR).val; 652 if (!((cols.size() == 1) && (cols.get(0) == ColCOL.COL_WHT))) { 653 if (!str.isEmpty() && !str.endsWith(")")) { 654 str += "."; 655 } 656 for (ColCOL acol : cols) { 657 str += LightLetters.get(acol); 658 } 659 } 660 } 661 str += cats.contains(CatLIT.LIT_VERT) ? "(vert)" : ""; 662 str += cats.contains(CatLIT.LIT_HORI) ? "(hor)" : ""; 663 str += (!str.isEmpty() && (atts.containsKey(Att.SIGPER) || atts.containsKey(Att.HEIGHT) 664 || atts.containsKey(Att.VALMXR)) && !str.endsWith(")")) ? "." : ""; 665 str += atts.containsKey(Att.SIGPER) ? df.format(atts.get(Att.SIGPER).val) + "s" : ""; 666 str += atts.containsKey(Att.HEIGHT) ? df.format(atts.get(Att.HEIGHT).val) + "m" : ""; 667 str += atts.containsKey(Att.VALNMR) ? df.format(atts.get(Att.VALNMR).val) + "M" : ""; 668 str += cats.contains(CatLIT.LIT_FRNT) ? "(Front)" : ""; 669 str += cats.contains(CatLIT.LIT_REAR) ? "(Rear)" : ""; 670 str += cats.contains(CatLIT.LIT_UPPR) ? "(Upper)" : ""; 671 str += cats.contains(CatLIT.LIT_LOWR) ? "(Lower)" : ""; 672 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, 673 new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30))); 674 } 675 } 676 } 677 } 660 678 }
Note:
See TracChangeset
for help on using the changeset viewer.