Changeset 30157 in osm for applications/editors/josm/plugins/smed2/src/s57
- Timestamp:
- 2013-12-29T12:52:10+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/s57
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/s57/S57map.java
r30150 r30157 13 13 14 14 import s57.S57att; 15 import s57.S57val.AttVal; 15 16 import s57.S57att.*; 16 17 import s57.S57obj; … … 351 352 items.put(idx, atts); 352 353 } 353 AttVal attval = S57val.convertValue(val, att);354 AttVal<?> attval = S57val.convertValue(val, att); 354 355 if (attval.val != null) 355 356 atts.put(att, new AttItem(attval.conv, attval.val)); … … 363 364 Att att = S57att.enumAttribute(subkeys[1], Obj.UNKOBJ); 364 365 if (att != Att.UNKATT) { 365 AttVal attval = S57val.convertValue(val, att);366 AttVal<?> attval = S57val.convertValue(val, att); 366 367 if (attval.val != null) 367 368 feature.atts.put(att, new AttItem(attval.conv, attval.val)); … … 436 437 areas.put(id, area); 437 438 break; 439 case UNKN: 440 default: 441 break; 438 442 } 439 443 if ((feature.type != Obj.UNKOBJ) && !((edge != null) && (edge.last == 0))) { … … 556 560 } 557 561 return new Snode((sarc > 0.0 ? slat / sarc : 0.0), (sarc > 0.0 ? slon / sarc : 0.0)); 562 default: 558 563 } 559 564 return null; -
applications/editors/josm/plugins/smed2/src/s57/S57val.java
r30046 r30157 26 26 } 27 27 28 public static class AttVal {28 public static class AttVal<V> { 29 29 public Att att; 30 30 public Conv conv; 31 public Objectval;32 AttVal(Att a, Conv c, Objectv) {31 public V val; 32 AttVal(Att a, Conv c, V v) { 33 33 att = a; conv = c; val = v; 34 34 } … … 1141 1141 1142 1142 1143 public static String stringValue(AttVal attval) { // Convert OSeaM value object to OSeaM attribute value string1143 public static String stringValue(AttVal<?> attval) { // Convert OSeaM value object to OSeaM attribute value string 1144 1144 switch (attval.conv) { 1145 1145 case A: … … 1177 1177 } 1178 1178 1179 public static AttVal convertValue(String val, Att att) { // Convert OSeaM attribute value string to OSeaM value object1179 public static AttVal<?> convertValue(String val, Att att) { // Convert OSeaM attribute value string to OSeaM value object 1180 1180 switch (keys.get(att).conv) { 1181 1181 case A: 1182 1182 case S: 1183 return new AttVal (att, Conv.S, val);1183 return new AttVal<String>(att, Conv.S, val); 1184 1184 case E: 1185 return new AttVal (att, Conv.E, enumValue(val, att));1185 return new AttVal<Enum<?>>(att, Conv.E, enumValue(val, att)); 1186 1186 case L: 1187 1187 ArrayList<Enum<?>> list = new ArrayList<Enum<?>>(); … … 1189 1189 list.add(enumValue(item, att)); 1190 1190 } 1191 return new AttVal (att, Conv.L, list);1191 return new AttVal<ArrayList<?>>(att, Conv.L, list); 1192 1192 case I: 1193 1193 try { 1194 1194 long i = Long.parseLong(val); 1195 return new AttVal (att, Conv.I, i);1195 return new AttVal<Long>(att, Conv.I, i); 1196 1196 } catch (Exception e) { 1197 1197 break; … … 1200 1200 try { 1201 1201 double f = Double.parseDouble(val); 1202 return new AttVal (att, Conv.F, f);1202 return new AttVal<Double>(att, Conv.F, f); 1203 1203 } catch (Exception e) { 1204 1204 break; 1205 1205 } 1206 1206 } 1207 return new AttVal (att, keys.get(att).conv, null);1207 return new AttVal<>(att, keys.get(att).conv, null); 1208 1208 } 1209 1209
Note:
See TracChangeset
for help on using the changeset viewer.