Ignore:
Timestamp:
2011-06-07T19:05:14+02:00 (14 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/command/MoveCommand.java

    r3682 r4126  
    1212import javax.swing.JLabel;
    1313
    14 import org.openstreetmap.josm.data.coor.CachedLatLon;
    1514import org.openstreetmap.josm.data.coor.EastNorth;
    1615import org.openstreetmap.josm.data.coor.LatLon;
     
    1817import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1918import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor;
     19import org.openstreetmap.josm.data.projection.Projections;
    2020import org.openstreetmap.josm.tools.ImageProvider;
    2121
     
    5959
    6060    public MoveCommand(Node node, LatLon position) {
    61         this(Collections.singleton((OsmPrimitive) node), node.getEastNorth().sub(new CachedLatLon(position).getEastNorth()));
     61        this(Collections.singleton((OsmPrimitive) node), node.getEastNorth().sub(Projections.project(position)));
    6262    }
    6363
Note: See TracChangeset for help on using the changeset viewer.