Changeset 29156 in osm for applications/editors/josm/plugins/smed2/src/seamap/Map.java
- Timestamp:
- 2013-01-03T13:37:21+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Map.java
r29153 r29156 39 39 public class Feature { 40 40 public Fflag flag; 41 public ArrayList<Long>refs;41 public long refs; 42 42 public Obj type; 43 43 public EnumMap<Att, AttItem> atts; … … 45 45 46 46 Feature() { 47 clean();48 }49 50 void clean() {51 47 flag = Fflag.UNKN; 52 refs = new ArrayList<Long>();48 refs = 0; 53 49 type = Obj.UNKOBJ; 54 50 atts = new EnumMap<Att, AttItem>(Att.class); … … 70 66 public HashMap<Long, ArrayList<Long>> ways; 71 67 public HashMap<Long, ArrayList<Long>> mpolys; 72 public ArrayList<Feature> features;68 public HashMap<Long, Feature> features; 73 69 74 70 private Feature feature; 71 private ArrayList<Long> list; 75 72 76 73 public Map() { … … 79 76 mpolys = new HashMap<Long, ArrayList<Long>>(); 80 77 feature = new Feature(); 81 features = new ArrayList<Feature>(); 82 features.add(feature); 78 features = new HashMap<Long, Feature>(); 83 79 } 84 80 85 81 public void addNode(long id, double lat, double lon) { 86 82 nodes.put(id, new Coord(lat, lon)); 87 if (feature.type == Obj.UNKOBJ) { 88 feature.clean(); 89 } else { 90 feature = new Feature(); 91 features.add(feature); 92 } 83 feature = new Feature(); 84 feature.refs = id; 85 feature.flag = Fflag.NODE; 93 86 } 94 87 95 88 public void addWay(long id) { 96 ways.put(id, new ArrayList<Long>()); 97 if (feature.type == Obj.UNKOBJ) { 98 feature.clean(); 99 } else { 100 feature = new Feature(); 101 features.add(feature); 102 } 103 } 104 105 public void addToWay(long way, long node) { 106 ways.get(way).add(node); 89 list = new ArrayList<Long>(); 90 ways.put(id, list); 91 feature = new Feature(); 92 feature.refs = id; 93 feature.flag = Fflag.WAY; 107 94 } 108 95 109 96 public void addMpoly(long id) { 110 mpolys.put(id, new ArrayList<Long>()); 97 list = new ArrayList<Long>(); 98 mpolys.put(id, list); 111 99 } 112 100 113 public void addToMpoly(long id, long way) { 114 mpolys.get(id).add(way); 101 public void addToWay(long node) { 102 list.add(node); 103 } 104 105 public void addToMpoly(long way, boolean outer) { 106 if (outer) 107 list.add(0, way); 108 else 109 list.add(way); 110 } 111 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))) { 115 feature.flag = Fflag.AREA; 116 } 117 features.put(feature.refs, feature); 118 } 115 119 } 116 120
Note:
See TracChangeset
for help on using the changeset viewer.