Ignore:
Timestamp:
2009-12-28T00:14:33+01:00 (14 years ago)
Author:
Gubaer
Message:

Partial commit due to issue described in #4137
Breaks the build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r2578 r2686  
    11// License: GPL. Copyright 2007 by Immanuel Scholz and others
    22package org.openstreetmap.josm.data.osm.visitor;
     3
     4import java.util.Collection;
    35
    46import org.openstreetmap.josm.Main;
     
    2931    public void visit(Way w) {
    3032        if (w.isIncomplete()) return;
    31         for (Node n : w.getNodes())
     33        for (Node n : w.getNodes()) {
    3234            visit(n);
     35        }
    3336    }
    3437
     
    6164        if(latlon != null)
    6265        {
    63             if(latlon instanceof CachedLatLon)
     66            if(latlon instanceof CachedLatLon) {
    6467                visit(((CachedLatLon)latlon).getEastNorth());
    65             else
     68            } else {
    6669                visit(Main.proj.latlon2eastNorth(latlon));
     70            }
    6771        }
    6872    }
     
    7074    public void visit(EastNorth eastNorth) {
    7175        if (eastNorth != null) {
    72             if (bounds == null)
     76            if (bounds == null) {
    7377                bounds = new ProjectionBounds(eastNorth);
    74             else
     78            } else {
    7579                bounds.extend(eastNorth);
     80            }
    7681        }
    7782    }
     
    111116        LatLon maxLatlon = Main.proj.eastNorth2latlon(bounds.max);
    112117        bounds = new ProjectionBounds(
    113         Main.proj.latlon2eastNorth(new LatLon(minLatlon.lat() - enlargeDegree, minLatlon.lon() - enlargeDegree)),
    114         Main.proj.latlon2eastNorth(new LatLon(maxLatlon.lat() + enlargeDegree, maxLatlon.lon() + enlargeDegree)));
     118                Main.proj.latlon2eastNorth(new LatLon(minLatlon.lat() - enlargeDegree, minLatlon.lon() - enlargeDegree)),
     119                Main.proj.latlon2eastNorth(new LatLon(maxLatlon.lat() + enlargeDegree, maxLatlon.lon() + enlargeDegree)));
    115120    }
    116121
     
    118123        return "BoundingXYVisitor["+bounds+"]";
    119124    }
     125
     126    public void computeBoundingBox(Collection<? extends OsmPrimitive> primitives) {
     127        if (primitives == null) return;
     128        for (OsmPrimitive p: primitives) {
     129            if (p == null) {
     130                continue;
     131            }
     132            p.visit(this);
     133        }
     134    }
    120135}
Note: See TracChangeset for help on using the changeset viewer.