Ignore:
Timestamp:
2011-06-07T19:05:14+02:00 (10 years ago)
Author:
bastiK
Message:

memory optimizations for Node & WayPoint (Patch by Gubaer, modified)

The field 'proj' in CachedLatLon is a waste of memory. For the 2 classes where this has the greatest impact, the cache for the projected coordinates is replaced by 2 simple double fields (east & north). On projection change, they have to be invalidated explicitly. This is handled by the DataSet & the GpxLayer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r3966 r4126  
    3030    public boolean isUsable(ImageryLayer layer) {
    3131        if (proj == null) return false;
    32         if (!Main.proj.toCode().equals(proj.toCode())) return false;
     32        if (!Main.getProjection().toCode().equals(proj.toCode())) return false;
    3333        return layer.getInfo().getName().equals(layerName);
    3434    }
     
    122122        LatLon center;
    123123        if (Main.map != null && Main.map.mapView != null) {
    124             center = Main.proj.eastNorth2latlon(Main.map.mapView.getCenter());
     124            center = Main.getProjection().eastNorth2latlon(Main.map.mapView.getCenter());
    125125        } else {
    126126            center = new LatLon(0,0);
    127127        }
    128128        OffsetBookmark nb = new OffsetBookmark(
    129                 Main.proj, layer.getInfo().getName(),
     129                Main.getProjection(), layer.getInfo().getName(),
    130130                name, layer.getDx(), layer.getDy(), center.lon(), center.lat());
    131131        for (ListIterator<OffsetBookmark> it = allBookmarks.listIterator();it.hasNext();) {
Note: See TracChangeset for help on using the changeset viewer.