Changeset 3336 in osm for applications/editors
- Timestamp:
- 2007-06-25T19:09:35+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java
r3073 r3336 21 21 private boolean fix; 22 22 private String wayString; 23 private Way way; 23 24 24 25 /** … … 117 118 * @return the name of the way that is closest to the current coordinates. 118 119 */ 119 public String getWay () {120 public String getWayInfo() { 120 121 if(wayString == null) { 121 EastNorth eastnorth = Main.proj.latlon2eastNorth(getLatLon()); 122 Point xy = Main.map.mapView.getPoint(eastnorth); 123 Way way = Main.map.mapView.getNearestWay(xy); 122 Way way = getWay(); 124 123 if(way != null) { 125 wayString = way.get("name") + " (" + way.get("highway") + ")"; 124 StringBuilder builder = new StringBuilder(); 125 String tmp = way.get("name"); 126 if(tmp != null) { 127 builder.append(tmp); 128 } else { 129 builder.append("no name"); 130 } 131 tmp = way.get("ref"); 132 if(tmp != null) { 133 builder.append(" (").append(tmp).append(")"); 134 } 135 tmp = way.get("highway"); 136 if(tmp != null) { 137 builder.append(" {").append(tmp).append("}"); 138 } 139 String type = ""; 140 tmp = way.get("tunnel"); 141 if(tmp != null) { 142 type = type + "T"; 143 } 144 tmp = way.get("bridge"); 145 if(tmp != null) { 146 type = type + "B"; 147 } 148 if(type.length() > 0) { 149 builder.append(" [").append(type).append("]"); 150 } 151 wayString = builder.toString(); 126 152 } else { 127 153 wayString = ""; … … 129 155 } 130 156 return wayString; 157 } 158 159 /** 160 * Returns the closest way to this position. 161 * @return the closest way to this position. 162 */ 163 public Way getWay() { 164 if(way == null) { 165 EastNorth eastnorth = Main.proj.latlon2eastNorth(getLatLon()); 166 Point xy = Main.map.mapView.getPoint(eastnorth); 167 way = Main.map.mapView.getNearestWay(xy); 168 } 169 return way; 170 131 171 } 132 172
Note:
See TracChangeset
for help on using the changeset viewer.