Ignore:
Timestamp:
2009-11-07T14:41:34+01:00 (10 years ago)
Author:
jttt
Message:

Added map of primitives to dataset to make search by id faster
check if primitive already exist in addPrimitive and removePrimitive
use PrimitiveId instead of id + primitive type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java

    r2349 r2399  
    1313
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1615import org.openstreetmap.josm.data.osm.PrimitiveData;
    1716
     
    2928
    3029        for (PrimitiveData pd:data) {
    31             createdPrimitives.add(getLayer().data.getPrimitiveById(pd.getId(), OsmPrimitiveType.fromData(pd), true));
     30            createdPrimitives.add(getLayer().data.getPrimitiveById(pd, true));
    3231        }
    3332
     
    4140    @Override public void undoCommand() {
    4241        for (PrimitiveData p:data) {
    43             getLayer().data.removePrimitive(p.getId(), OsmPrimitiveType.fromData(p));
     42            getLayer().data.removePrimitive(p);
    4443        }
    4544    }
     
    4746    @Override
    4847    public MutableTreeNode description() {
    49          return new DefaultMutableTreeNode(
     48        return new DefaultMutableTreeNode(
    5049                new JLabel(tr("Added {0} objects", data.size()), null,
    5150                        JLabel.HORIZONTAL
Note: See TracChangeset for help on using the changeset viewer.