Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public void paint(Graphics2D g, final MapView mv, Bounds bounds) {
for (int i = 0; i <= way.getNodes().size() - 2; i++) {
Node node1 = way.getNode(i);
Node node2 = way.getNode(i + 1);
Point pnt1 = mv.getPoint(node1.getCoor());
Point pnt2 = mv.getPoint(node2.getCoor());
Point pnt1 = mv.getPoint(node1);
Point pnt2 = mv.getPoint(node2);
g.draw(new Line2D.Double(pnt1.x, pnt1.y, pnt2.x, pnt2.y));
}
} else if (primitive instanceof Node) {
Expand All @@ -132,7 +132,7 @@ public void paint(Graphics2D g, final MapView mv, Bounds bounds) {
g.setColor(new Color(229, 228, 61));
}

Point pnt = mv.getPoint(node.getCoor());
Point pnt = mv.getPoint(node);
g.fillOval(pnt.x, pnt.y, 7, 7);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.json.JsonValue;

import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.coor.ILatLon;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.Node;
Expand Down Expand Up @@ -164,18 +165,19 @@ private Map<String, String> getTags(final JsonObject tags, final String action)
return mapTags;
}

private Bounds mergeBounds(final Bounds bounds, final OsmPrimitive osmPrimitive) {
if (osmPrimitive instanceof Node) { // ways and relations consist of nodes that are already in the dataset
return mergeBounds(bounds, ((Node) osmPrimitive).getCoor());
private static Bounds mergeBounds(final Bounds bounds, final OsmPrimitive osmPrimitive) {
// ways and relations consist of nodes that are already in the dataset
if (osmPrimitive instanceof Node && ((Node) osmPrimitive).isLatLonKnown()) {
return mergeBounds(bounds, ((ILatLon) osmPrimitive));
}
return bounds;
}

private Bounds mergeBounds(final Bounds bounds, final LatLon coords) {
private static Bounds mergeBounds(final Bounds bounds, final ILatLon coords) {
if (bounds == null) {
return new Bounds(coords);
return new Bounds(coords.lat(), coords.lon(), coords.lat(), coords.lon());
} else {
bounds.extend(coords);
bounds.extend(coords.lat(), coords.lon());
return bounds;
}
}
Expand Down