Changeset 329 in josm for branch/0.5/src/org/openstreetmap/josm/data/osm/DataSet.java
- Timestamp:
- 2007-09-24T01:36:24+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/0.5/src/org/openstreetmap/josm/data/osm/DataSet.java
r298 r329 31 31 32 32 /** 33 * All segments goes here, even when they are in a way. 33 * All ways (Streets etc.) in the DataSet. 34 * 35 * The way nodes are stored only in the way list. 34 36 */ 35 public Collection< Segment> segments = new LinkedList<Segment>();37 public Collection<Way> ways = new LinkedList<Way>(); 36 38 37 39 /** 38 * All ways (Streets etc.) in the DataSet. 39 * 40 * The nodes of the way segments of this way must be objects from 41 * the nodes list, however the way segments are stored only in the 42 * way list. 40 * All relations/relationships 43 41 */ 44 public Collection< Way> ways = new LinkedList<Way>();42 public Collection<Relation> relations = new LinkedList<Relation>(); 45 43 46 44 /** … … 55 53 * selection does only change in the active layer) 56 54 */ 57 public static Collection<SelectionChangedListener> listeners = new LinkedList<SelectionChangedListener>();55 public static Collection<SelectionChangedListener> selListeners = new LinkedList<SelectionChangedListener>(); 58 56 59 57 /** 60 58 * @return A collection containing all primitives of the dataset. The 61 * data is ordered after: first come s nodes, then segments, then ways.59 * data is ordered after: first come nodes, then ways, then relations. 62 60 * Ordering in between the categories is not guaranteed. 63 61 */ … … 65 63 List<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 66 64 o.addAll(nodes); 67 o.addAll(segments);68 65 o.addAll(ways); 66 o.addAll(relations); 69 67 return o; 70 68 } … … 88 86 public void clearSelection() { 89 87 clearSelection(nodes); 90 clearSelection(segments);91 88 clearSelection(ways); 89 clearSelection(relations); 92 90 Collection<OsmPrimitive> sel = Collections.emptyList(); 93 91 fireSelectionChanged(sel); … … 100 98 public Collection<OsmPrimitive> getSelected() { 101 99 Collection<OsmPrimitive> sel = getSelected(nodes); 102 sel.addAll(getSelected(segments));103 100 sel.addAll(getSelected(ways)); 101 sel.addAll(getSelected(relations)); 104 102 return sel; 105 103 } … … 107 105 public void setSelected(Collection<? extends OsmPrimitive> selection) { 108 106 clearSelection(nodes); 109 clearSelection(segments);110 107 clearSelection(ways); 108 clearSelection(relations); 111 109 for (OsmPrimitive osm : selection) 112 110 osm.selected = true; … … 120 118 } 121 119 clearSelection(nodes); 122 clearSelection(segments);123 120 clearSelection(ways); 121 clearSelection(relations); 124 122 for (OsmPrimitive o : osm) 125 123 if (o != null) … … 158 156 */ 159 157 public static void fireSelectionChanged(Collection<? extends OsmPrimitive> sel) { 160 for (SelectionChangedListener l : listeners)158 for (SelectionChangedListener l : selListeners) 161 159 l.selectionChanged(sel); 162 160 } 163 161 164 162 @Override public DataSet clone() { 165 163 DataSet ds = new DataSet(); 166 164 for (Node n : nodes) 167 165 ds.nodes.add(new Node(n)); 168 for (Segment s : segments)169 ds.segments.add(new Segment(s));170 166 for (Way w : ways) 171 167 ds.ways.add(new Way(w)); 168 for (Relation e : relations) 169 ds.relations.add(new Relation(e)); 172 170 for (DataSource source : dataSources) 173 171 ds.dataSources.add(new DataSource(source.bounds, source.origin));
Note:
See TracChangeset
for help on using the changeset viewer.