Skip to content

Commit

Permalink
Fix #23828: Very slow wireframe view with large data set
Browse files Browse the repository at this point in the history
This occurred since we were drawing every object in every relation (including
nodes of ways) even if those objects were not in view. We fix that by only
drawing objects that are inside the current viewing area.

git-svn-id: https://josm.openstreetmap.de/svn/trunk@19166 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
taylor.smock committed Aug 5, 2024
1 parent ebf0269 commit 8e373fc
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public void render(OsmData<?, ?, ?, ?> data, boolean virtual, Bounds bounds) {
way.accept(this);
}
}
displaySegments();
}
displaySegments();

Expand Down Expand Up @@ -351,18 +352,19 @@ public void visit(IRelation<?> r) {
}
g.setColor(col);

Bounds viewArea = mapState.getViewArea().getLatLonBoundsBox();
for (IRelationMember<?> m : r.getMembers()) {
if (m.getMember().isIncomplete() || !m.getMember().isDrawable()) {
continue;
}

if (m.isNode()) {
if (m.isNode() && viewArea.contains((INode) m.getMember())) {
MapViewPoint p = mapState.getPointFor((INode) m.getMember());
if (p.isInView()) {
g.draw(new Ellipse2D.Double(p.getInViewX()-4, p.getInViewY()-4, 9, 9));
}

} else if (m.isWay()) {
} else if (m.isWay() && viewArea.contains(m.getMember().getBBox())) {
GeneralPath path = new GeneralPath();

boolean first = true;
Expand Down

0 comments on commit 8e373fc

Please sign in to comment.