Changeset 30226 in osm for applications/editors/josm/plugins/smed2/src
- Timestamp:
- 2014-01-25T17:56:23+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/s57/S57att.java
r30215 r30226 50 50 AttS57.put(Att.ORIENT, 117); AttS57.put(Att.PEREND, 118); AttS57.put(Att.PERSTA, 119); AttS57.put(Att.PICREP, 120); AttS57.put(Att.PILDST, 121); AttS57.put(Att.PRCTRY, 122); 51 51 AttS57.put(Att.PRODCT, 123); AttS57.put(Att.PUBREF, 124); AttS57.put(Att.QUASOU, 125); AttS57.put(Att.RADWAL, 126); AttS57.put(Att.RADIUS, 127); AttS57.put(Att.RECDAT, 128); 52 AttS57.put(Att.RECIND, 129); AttS57.put(Att.RYRMGV, 130); AttS57.put(Att.RESTRN, 131); 53 AttS57.put(Att.SECTR1, 136); AttS57.put(Att.SECTR2, 137); AttS57.put(Att.SHIPAM, 138); 52 AttS57.put(Att.RECIND, 129); AttS57.put(Att.RYRMGV, 130); AttS57.put(Att.RESTRN, 131); AttS57.put(Att.SCAMAX, 132); AttS57.put(Att.SCAMIN, 133); AttS57.put(Att.SCVAL1, 134); 53 AttS57.put(Att.SCVAL2, 135); AttS57.put(Att.SECTR1, 136); AttS57.put(Att.SECTR2, 137); AttS57.put(Att.SHIPAM, 138); 54 54 AttS57.put(Att.SIGFRQ, 139); AttS57.put(Att.SIGGEN, 140); AttS57.put(Att.SIGGRP, 141); AttS57.put(Att.SIGPER, 142); AttS57.put(Att.SIGSEQ, 143); AttS57.put(Att.SOUACC, 144); 55 55 AttS57.put(Att.SDISMX, 145); AttS57.put(Att.SDISMN, 146); AttS57.put(Att.SORDAT, 147); AttS57.put(Att.SORIND, 148); AttS57.put(Att.STATUS, 149); AttS57.put(Att.SURATH, 150); … … 152 152 AttStr.put(Att.CATVTR, "category"); AttStr.put(Att.CATTAB, "operation"); AttStr.put(Att.SCHREF, "schedule"); AttStr.put(Att.USESHP, "use"); AttStr.put(Att.CURVHW, "high_velocity"); 153 153 AttStr.put(Att.CURVLW, "low_velocity"); AttStr.put(Att.CURVMW, "mean_velocity"); AttStr.put(Att.CURVOW, "other_velocity"); AttStr.put(Att.APTREF, "passing_time"); 154 AttStr.put(Att.CATCOM, "category"); AttStr.put(Att.CATCVR, "category"); AttStr.put(Att.SCAMIN, "scale_minimum");154 AttStr.put(Att.CATCOM, "category"); AttStr.put(Att.CATCVR, "category"); 155 155 AttStr.put(Att.CATEXS, "category"); AttStr.put(Att.CATWWM, "category"); AttStr.put(Att.SHPTYP, "ship"); AttStr.put(Att.UPDMSG, "message"); AttStr.put(Att.LITRAD, "radius"); 156 156 } -
applications/editors/josm/plugins/smed2/src/s57/S57map.java
r30215 r30226 319 319 } 320 320 } 321 sortGeom(); 321 322 } 322 323 … … 450 451 // Utility methods 451 452 453 public void sortGeom() { 454 for (long id : index.keySet()) { 455 feature = index.get(id); 456 Geom geom = feature.geom; 457 Geom sort = new Geom(geom.prim); 458 long first = 0; 459 long last = 0; 460 boolean next = true; 461 if ((geom.prim == Pflag.LINE) || (geom.prim == Pflag.AREA)) { 462 int sweep = geom.elems.size(); 463 while (!geom.elems.isEmpty()) { 464 Prim prim = geom.elems.remove(0); 465 Edge edge = edges.get(prim.id); 466 if (next == true) { 467 next = false; 468 if (prim.forward) { 469 first = edge.first; 470 last = edge.last; 471 } else { 472 first = edge.last; 473 last = edge.first; 474 } 475 sort.elems.add(prim); 476 } else { 477 if (prim.forward) { 478 if (edge.first == last) { 479 sort.elems.add(prim); 480 last = edge.last; 481 } else if (edge.last == first) { 482 sort.elems.add(0, prim); 483 first = edge.first; 484 } else { 485 geom.elems.add(prim); 486 } 487 } else { 488 if (edge.last == last) { 489 sort.elems.add(prim); 490 last = edge.first; 491 } else if (edge.first == first) { 492 sort.elems.add(0, prim); 493 first = edge.last; 494 } else { 495 geom.elems.add(prim); 496 } 497 } 498 } 499 if (--sweep == 0) { 500 next = true; 501 sweep = geom.elems.size(); 502 } 503 } 504 feature.geom = sort; 505 } 506 if (geom.prim == Pflag.AREA) { 507 ArrayList<Prim> outers = new ArrayList<Prim>(); 508 ArrayList<Prim> inners = new ArrayList<Prim>(); 509 for (Prim prim : feature.geom.elems) { 510 if (prim.outer) { 511 outers.add(prim); 512 } else { 513 inners.add(prim); 514 } 515 } 516 ArrayList<Prim> sorting = outers; 517 ArrayList<Prim> closed = null; 518 sort = new Geom(geom.prim); 519 next = true; 520 while (!sorting.isEmpty()) { 521 Prim prim = sorting.remove(0); 522 Edge edge = edges.get(prim.id); 523 if (next == true) { 524 next = false; 525 closed = new ArrayList<Prim>(); 526 closed.add(prim); 527 if (prim.forward) { 528 first = edge.first; 529 last = edge.last; 530 } else { 531 first = edge.last; 532 last = edge.first; 533 } 534 } else { 535 if (prim.forward) { 536 if (edge.first == last) { 537 last = edge.last; 538 closed.add(prim); 539 } else { 540 sorting.add(0, prim); 541 next = true; 542 } 543 } else { 544 if (edge.last == last) { 545 last = edge.first; 546 closed.add(prim); 547 } else { 548 sorting.add(0, prim); 549 next = true; 550 } 551 } 552 } 553 if (first == last) { 554 sort.elems.addAll(closed); 555 next = true; 556 } 557 if (sorting.isEmpty() && sorting == outers) { 558 sorting = inners; 559 next = true; 560 } 561 } 562 feature.geom = sort; 563 } 564 } 565 } 566 452 567 public class EdgeIterator { 453 568 Edge edge; … … 465 580 } 466 581 467 public Snode next() {582 public long nextRef() { 468 583 long ref = 0; 469 584 if (forward) { … … 492 607 } 493 608 } 494 return nodes.get(ref); 609 return ref; 610 } 611 612 public Snode next() { 613 return nodes.get(nextRef()); 495 614 } 496 615 } … … 501 620 EdgeIterator eit; 502 621 ListIterator<S57map.Prim> it; 503 Snodefirst;504 Snodelast;622 long first; 623 long last; 505 624 506 625 public GeomIterator(Geom g) { 507 626 geom = g; 508 627 eit = null; 509 first = last = null; 628 first = 0; 629 last = -1; 510 630 if ((geom.prim != Pflag.NOSP) && (geom.prim != Pflag.POINT)) { 511 631 it = geom.elems.listIterator(); … … 522 642 if ((it != null) && it.hasNext()) { 523 643 prim = it.next(); 644 eit = new EdgeIterator(edges.get(prim.id), prim.forward); 524 645 return prim.outer; 525 646 } … … 528 649 529 650 public boolean hasNext() { 530 return (first != last) && ( eit.hasNext() || it.hasNext());651 return (first != last) && (it.hasNext() || eit.hasNext()); 531 652 } 532 653 533 public Snode next() {534 if (!eit.hasNext()) { 654 public long nextRef() { 655 if ((eit == null) || !eit.hasNext()) { 535 656 if (it.hasNext()) { 536 657 prim = it.next(); 537 658 eit = new EdgeIterator(edges.get(prim.id), prim.forward); 538 659 } else { 539 return null; 540 } 541 } 542 last = eit.next(); 543 return last; 660 return 0; 661 } 662 } 663 long ref = eit.nextRef(); 664 if (ref == last) 665 ref = eit.nextRef(); 666 if (first == 0) { 667 first = ref; 668 last = 0; 669 } else { 670 last = ref; 671 } 672 return ref; 673 } 674 675 public Snode next() { 676 return nodes.get(nextRef()); 544 677 } 545 678 } -
applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
r30215 r30226 68 68 col = new ArrayList<Color>(); 69 69 col.add(icol); 70 } 71 public Scheme() { 72 pat = new ArrayList<Patt>(); 73 col = new ArrayList<Color>(); 70 74 } 71 75 }
Note:
See TracChangeset
for help on using the changeset viewer.