Changeset 29156 in osm for applications/editors/josm/plugins/smed2/src/smed2/Smed2Action.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/smed2/Smed2Action.java
r29153 r29156 41 41 @Override 42 42 public void dataChanged(DataChangedEvent e) { 43 reMap();43 // reMap(); 44 44 } 45 45 46 46 @Override 47 47 public void nodeMoved(NodeMovedEvent e) { 48 reMap();48 // reMap(); 49 49 } 50 50 51 51 @Override 52 52 public void otherDatasetChange(AbstractDatasetChangedEvent e) { 53 reMap();53 // reMap(); 54 54 } 55 55 56 56 @Override 57 57 public void primitivesAdded(PrimitivesAddedEvent e) { 58 reMap();58 // reMap(); 59 59 } 60 60 61 61 @Override 62 62 public void primitivesRemoved(PrimitivesRemovedEvent e) { 63 reMap();63 // reMap(); 64 64 } 65 65 66 66 @Override 67 67 public void relationMembersChanged(RelationMembersChangedEvent e) { 68 reMap();68 // reMap(); 69 69 } 70 70 71 71 @Override 72 72 public void tagsChanged(TagsChangedEvent e) { 73 reMap();73 // reMap(); 74 74 } 75 75 76 76 @Override 77 77 public void wayNodesChanged(WayNodesChangedEvent e) { 78 reMap();78 // reMap(); 79 79 } 80 80 }; … … 119 119 panelS57.setVisible(false); 120 120 frame.add(panelS57); 121 //System.out.println("hello");121 // System.out.println("hello"); 122 122 rendering = ImageryLayer.create(new ImageryInfo("OpenSeaMap")); 123 123 Main.main.addLayer(rendering); … … 144 144 data = newLayer.data.allPrimitives(); 145 145 reMap(); 146 146 } else { 147 147 data = null; 148 148 map = null; … … 155 155 156 156 } 157 157 158 158 void reMap() { 159 159 map = new Map(); 160 160 for (OsmPrimitive osm : data) { 161 if (osm instanceof Node) { 162 map.addNode(((Node)osm).getId(), ((Node)osm).getCoor().lat(), ((Node)osm).getCoor().lon()); 163 } else if (osm instanceof Way) { 164 map.addWay(((Way)osm).getId()); 165 for (Node node : ((Way)osm).getNodes()) { 166 map.addToWay(((Way)osm).getUniqueId(), node.getUniqueId()); 161 System.out.println(osm); 162 if ((osm instanceof Node) || (osm instanceof Way)) { 163 if (osm instanceof Node) { 164 map.addNode(((Node) osm).getUniqueId(), ((Node) osm).getCoor().lat(), ((Node) osm).getCoor().lon()); 165 } else { 166 map.addWay(((Way) osm).getUniqueId()); 167 for (Node node : ((Way) osm).getNodes()) { 168 map.addToWay((node.getUniqueId())); 169 } 170 } 171 for (Entry<String, String> entry : osm.getKeys().entrySet()) { 172 map.addTag(entry.getKey(), entry.getValue()); 173 } 174 map.tagsDone(); 175 } else if ((osm instanceof Relation) && ((Relation) osm).isMultipolygon()) { 176 map.addMpoly(((Relation) osm).getUniqueId()); 177 for (RelationMember mem : ((Relation) osm).getMembers()) { 178 if (mem.getType() == OsmPrimitiveType.WAY) 179 map.addToMpoly(mem.getUniqueId(), (mem.getRole().equals("outer"))); 167 180 } 168 181 } 169 for (Entry<String, String> entry : osm.getKeys().entrySet()) {170 map.addTag(entry.getKey(), entry.getValue());171 }172 182 } 173 174 183 } 175 184
Note:
See TracChangeset
for help on using the changeset viewer.