Changeset 31955 in osm for applications/editors/josm/plugins/seachart/src/s57
- Timestamp:
- 2016-01-06T09:33:48+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/seachart/src/s57
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/s57/S57att.java
r31846 r31955 147 147 AttStr.put(Att.UPDMSG, "message"); AttStr.put(Att.LITRAD, "radius"); 148 148 } 149 150 149 private static final EnumMap<Obj, Att> Accuracy = new EnumMap<>(Obj.class); static { Accuracy.put(Obj.UNKOBJ, Att.HORACC); } 151 150 private static final EnumMap<Obj, Att> Addition = new EnumMap<>(Obj.class); static { Addition.put(Obj.UNKOBJ, Att.ADDMRK); } … … 158 157 private static final EnumMap<Obj, Att> Category = new EnumMap<>(Obj.class); static { 159 158 Category.put(Obj.ACHARE, Att.CATACH); Category.put(Obj.ACHBRT, Att.CATACH); Category.put(Obj.AIRARE, Att.CATAIR); Category.put(Obj.BCNCAR, Att.CATCAM); Category.put(Obj.BCNLAT, Att.CATLAM); 160 Category.put(Obj.BCNSPP, Att.CATSPM); Category.put(Obj.BOYLAT, Att.CATLAM); Category.put(Obj.BOYINB, Att.CATINB); Category.put(Obj.BOYSPP, Att.CATSPM); 159 Category.put(Obj.BCNSPP, Att.CATSPM); Category.put(Obj.BOYLAT, Att.CATLAM); Category.put(Obj.BOYINB, Att.CATINB); Category.put(Obj.BOYSPP, Att.CATSPM); Category.put(Obj.DAYMAR, Att.CATSPM); 161 160 Category.put(Obj.BRIDGE, Att.CATBRG); Category.put(Obj.BUAARE, Att.CATBUA); Category.put(Obj.BUNSTA, Att.CATBUN); Category.put(Obj.CANALS, Att.CATCAN); 162 161 Category.put(Obj.CBLARE, Att.CATCBL); Category.put(Obj.CBLOHD, Att.CATCBL); Category.put(Obj.CBLSUB, Att.CATCBL); Category.put(Obj.CHKPNT, Att.CATCHP); Category.put(Obj.COMARE, Att.CATCOM); -
applications/editors/josm/plugins/seachart/src/s57/S57map.java
r31846 r31955 559 559 560 560 // Utility methods 561 561 562 562 public boolean sortGeom(Feature feature) { 563 Geom sort = new Geom(feature.geom.prim); 564 long first = 0; 565 long last = 0; 566 Comp comp = null; 567 boolean next = true; 568 feature.geom.length = 0; 569 feature.geom.area = 0; 570 if (feature.geom.elems.isEmpty()) { 571 return false; 572 } 573 if (feature.geom.prim == Pflag.POINT) { 574 feature.geom.centre = nodes.get(feature.geom.elems.get(0).id); 575 return true; 576 } else { 577 int sweep = feature.geom.elems.size(); 578 while (!feature.geom.elems.isEmpty()) { 579 Prim prim = feature.geom.elems.remove(0); 580 Edge edge = edges.get(prim.id); 581 if (edge == null) { 582 return false; 583 } 584 if (next == true) { 585 next = false; 586 first = edge.first; 587 last = edge.last; 588 prim.forward = true; 589 sort.elems.add(prim); 590 if (prim.outer) { 591 sort.outers++; 592 } else { 593 sort.inners++; 594 } 595 comp = new Comp(cref++, 1); 596 sort.comps.add(comp); 597 } else { 598 if (edge.first == last) { 599 sort.elems.add(prim); 563 try { 564 Geom sort = new Geom(feature.geom.prim); 565 long first = 0; 566 long last = 0; 567 Comp comp = null; 568 boolean next = true; 569 feature.geom.length = 0; 570 feature.geom.area = 0; 571 if (feature.geom.elems.isEmpty()) { 572 return false; 573 } 574 if (feature.geom.prim == Pflag.POINT) { 575 feature.geom.centre = nodes.get(feature.geom.elems.get(0).id); 576 return true; 577 } else { 578 int sweep = feature.geom.elems.size(); 579 while (!feature.geom.elems.isEmpty()) { 580 Prim prim = feature.geom.elems.remove(0); 581 Edge edge = edges.get(prim.id); 582 if (edge == null) { 583 return false; 584 } 585 if (next == true) { 586 next = false; 587 first = edge.first; 600 588 last = edge.last; 601 589 prim.forward = true; 602 comp.size++;603 } else if (edge.last == first) {604 sort.elems.add(0, prim);605 first = edge.first;606 prim.forward = true;607 comp.size++;608 } else if (edge.last == last) {609 590 sort.elems.add(prim); 610 last = edge.first; 611 prim.forward = false; 612 comp.size++; 613 } else if (edge.first == first) { 614 sort.elems.add(0, prim); 615 first = edge.last; 616 prim.forward = false; 617 comp.size++; 591 if (prim.outer) { 592 sort.outers++; 593 } else { 594 sort.inners++; 595 } 596 comp = new Comp(cref++, 1); 597 sort.comps.add(comp); 618 598 } else { 619 feature.geom.elems.add(prim); 620 } 621 } 622 if (--sweep == 0) { 623 next = true; 624 sweep = feature.geom.elems.size(); 625 } 626 } 627 if ((sort.prim == Pflag.LINE) && (sort.outers == 1) && (sort.inners == 0) && (first == last)) { 628 sort.prim = Pflag.AREA; 629 } 630 feature.geom = sort; 631 } 632 if (feature.geom.prim == Pflag.AREA) { 633 int ie = 0; 634 int ic = 0; 635 while (ie < feature.geom.elems.size()) { 636 double area = calcArea(feature.geom, ic); 637 if (ie == 0) feature.geom.area = Math.abs(area) * 3444 * 3444; 638 if (((ie == 0) && (area < 0.0)) || ((ie > 0) && (area >= 0.0))) { 639 ArrayList<Prim> tmp = new ArrayList<>(); 640 for (int i = 0; i < feature.geom.comps.get(ic).size; i++) { 641 Prim p = feature.geom.elems.remove(ie); 642 p.forward = !p.forward; 643 tmp.add(0, p); 644 } 645 feature.geom.elems.addAll(ie, tmp); 646 } 647 ie += feature.geom.comps.get(ic).size; 648 ic++; 649 } 650 } 651 feature.geom.length = calcLength(feature.geom); 652 feature.geom.centre = calcCentroid(feature); 653 return true; 599 if (edge.first == last) { 600 sort.elems.add(prim); 601 last = edge.last; 602 prim.forward = true; 603 comp.size++; 604 } else if (edge.last == first) { 605 sort.elems.add(0, prim); 606 first = edge.first; 607 prim.forward = true; 608 comp.size++; 609 } else if (edge.last == last) { 610 sort.elems.add(prim); 611 last = edge.first; 612 prim.forward = false; 613 comp.size++; 614 } else if (edge.first == first) { 615 sort.elems.add(0, prim); 616 first = edge.last; 617 prim.forward = false; 618 comp.size++; 619 } else { 620 feature.geom.elems.add(prim); 621 } 622 } 623 if (--sweep == 0) { 624 next = true; 625 sweep = feature.geom.elems.size(); 626 } 627 } 628 if ((sort.prim == Pflag.LINE) && (sort.outers == 1) && (sort.inners == 0) && (first == last)) { 629 sort.prim = Pflag.AREA; 630 } 631 feature.geom = sort; 632 } 633 if (feature.geom.prim == Pflag.AREA) { 634 int ie = 0; 635 int ic = 0; 636 while (ie < feature.geom.elems.size()) { 637 double area = calcArea(feature.geom, ic); 638 if (ie == 0) 639 feature.geom.area = Math.abs(area) * 3444 * 3444; 640 if (((ie == 0) && (area < 0.0)) || ((ie > 0) && (area >= 0.0))) { 641 ArrayList<Prim> tmp = new ArrayList<>(); 642 for (int i = 0; i < feature.geom.comps.get(ic).size; i++) { 643 Prim p = feature.geom.elems.remove(ie); 644 p.forward = !p.forward; 645 tmp.add(0, p); 646 } 647 feature.geom.elems.addAll(ie, tmp); 648 } 649 ie += feature.geom.comps.get(ic).size; 650 ic++; 651 } 652 } 653 feature.geom.length = calcLength(feature.geom); 654 feature.geom.centre = calcCentroid(feature); 655 return true; 656 } catch (Exception e) { 657 return false; 658 } 654 659 } 655 660 -
applications/editors/josm/plugins/seachart/src/s57/S57osm.java
r31846 r31955 47 47 OSMtags.put("landuse=industrial", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); OSMtags.put("landuse=commercial", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); 48 48 OSMtags.put("landuse=retail", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); OSMtags.put("landuse=residential", new KeyVal<>(Obj.BUAARE, Att.UNKATT, null, null)); 49 } 49 OSMtags.put("place=city", new KeyVal<>(Obj.BUAARE, Att.CATBUA, Conv.E, CatBUA.BUA_CITY)); OSMtags.put("place=town", new KeyVal<>(Obj.BUAARE, Att.CATBUA, Conv.E, CatBUA.BUA_TOWN)); 50 OSMtags.put("place=village", new KeyVal<>(Obj.BUAARE, Att.CATBUA, Conv.E, CatBUA.BUA_VLLG)); 51 } 50 52 51 53 public static KeyVal<?> OSMtag(String key, String val) { … … 142 144 } 143 145 } 144 map.addToEdge(ref); 146 try { 147 map.addToEdge(ref); 148 } catch (Exception e) { 149 inWay = false; 150 } 145 151 } 146 152 if (ln.contains("</way")) {
Note:
See TracChangeset
for help on using the changeset viewer.