Changeset 29184 in osm for applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
- Timestamp:
- 2013-01-08T21:26:40+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
r29174 r29184 15 15 16 16 import s57.S57att; 17 import s57.S57att. *;17 import s57.S57att.Att; 18 18 import s57.S57obj; 19 19 import s57.S57obj.*; … … 37 37 } 38 38 39 public class AttMap extends EnumMap<Att, AttItem> { 40 private static final long serialVersionUID = 1L; 41 public AttMap() { 42 super(Att.class); 43 } 44 } 45 46 public class ObjTab extends HashMap<Integer, AttMap> { 47 private static final long serialVersionUID = 1L; 48 public ObjTab() { 49 super(); 50 } 51 } 52 53 public class ObjMap extends EnumMap<Obj, ObjTab> { 54 private static final long serialVersionUID = 1L; 55 public ObjMap() { 56 super(Obj.class); 57 } 58 } 59 60 public class NodeTab extends HashMap<Long, Coord> { 61 private static final long serialVersionUID = 1L; 62 public NodeTab() { 63 super(); 64 } 65 } 66 67 public class WayTab extends HashMap<Long, ArrayList<Long>> { 68 private static final long serialVersionUID = 1L; 69 public WayTab() { 70 super(); 71 } 72 } 73 74 public class FtrMap extends EnumMap<Obj, ArrayList<Feature>> { 75 private static final long serialVersionUID = 1L; 76 public FtrMap() { 77 super(Obj.class); 78 } 79 } 80 81 public class FtrTab extends HashMap<Long, Feature> { 82 private static final long serialVersionUID = 1L; 83 public FtrTab() { 84 super(); 85 } 86 } 87 39 88 public class Feature { 40 89 public Fflag flag; 41 90 public long refs; 42 91 public Obj type; 43 public EnumMap<Att, AttItem>atts;44 public EnumMap<Obj, HashMap<Integer, EnumMap<Att, AttItem>>>objs;92 public AttMap atts; 93 public ObjMap objs; 45 94 46 95 Feature() { … … 48 97 refs = 0; 49 98 type = Obj.UNKOBJ; 50 atts = new EnumMap<Att, AttItem>(Att.class);51 objs = new EnumMap<Obj, HashMap<Integer, EnumMap<Att, AttItem>>>(Obj.class);99 atts = new AttMap(); 100 objs = new ObjMap(); 52 101 } 53 102 } … … 57 106 public double lon; 58 107 59 Coord(double ilat, double ilon) { 108 public Coord(double ilat, double ilon) { 60 109 lat = ilat; 61 110 lon = ilon; … … 63 112 } 64 113 65 public HashMap<Long, Coord> nodes; 66 public HashMap<Long, ArrayList<Long>> ways; 67 public HashMap<Long, ArrayList<Long>> mpolys; 68 public EnumMap<Obj, ArrayList<Feature>> features; 114 public NodeTab nodes; 115 public WayTab ways; 116 public WayTab mpolys; 117 public FtrMap features; 118 public FtrTab index; 69 119 70 120 private Feature feature; … … 72 122 73 123 public SeaMap() { 74 nodes = new HashMap<Long, Coord>();75 ways = new HashMap<Long, ArrayList<Long>>();76 mpolys = new HashMap<Long, ArrayList<Long>>();124 nodes = new NodeTab(); 125 ways = new WayTab(); 126 mpolys = new WayTab(); 77 127 feature = new Feature(); 78 features = new EnumMap<Obj, ArrayList<Feature>>(Obj.class); 128 features = new FtrMap(); 129 index = new FtrTab(); 79 130 } 80 131 … … 84 135 feature.refs = id; 85 136 feature.flag = Fflag.NODE; 137 } 138 139 public void moveNode(long id, double lat, double lon) { 140 nodes.put(id, new Coord(lat, lon)); 86 141 } 87 142 … … 110 165 } 111 166 112 public void tagsDone() { 113 if (feature.type != Obj.UNKOBJ) { 114 if ((feature.flag == Fflag.WAY) && (list.size() > 0) && (list.get(0) == list.get(list.size() - 1))) { 167 public void tagsDone(long id) { 168 if ((feature.type != Obj.UNKOBJ) && !((feature.flag == Fflag.WAY) && (list.size() < 2))) { 169 index.put(id, feature); 170 if ((feature.flag == Fflag.WAY) && (list.size() > 0) && (list.get(0).equals(list.get(list.size() - 1)))) { 115 171 feature.flag = Fflag.AREA; 116 172 } … … 137 193 att = S57att.enumAttribute(subkeys[2], obj); 138 194 } 139 HashMap<Integer, EnumMap<Att, AttItem>>items = feature.objs.get(obj);195 ObjTab items = feature.objs.get(obj); 140 196 if (items == null) { 141 items = new HashMap<Integer, EnumMap<Att, AttItem>>();197 items = new ObjTab(); 142 198 feature.objs.put(obj, items); 143 199 } 144 EnumMap<Att, AttItem>atts = items.get(idx);200 AttMap atts = items.get(idx); 145 201 if (atts == null) { 146 atts = new EnumMap<Att, AttItem>(Att.class);202 atts = new AttMap(); 147 203 items.put(idx, atts); 148 204 }
Note:
See TracChangeset
for help on using the changeset viewer.