Changeset 6140 in josm


Ignore:
Timestamp:
2013-08-11T21:09:08+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8951 - fix clearing of primitive metadata

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r6084 r6140  
    111111            }
    112112            PrimitiveData copy = data.makeCopy();
    113             copy.clearOsmId();
     113            copy.clearOsmMetadata();
    114114            if (data instanceof NodeData) {
    115115                newNodeIds.put(data.getUniqueId(), copy.getUniqueId());
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r6090 r6140  
    200200
    201201    /**
    202      * Clears the id and version known to the OSM API. The id and the version is set to 0.
    203      * incomplete is set to false. It's preferred to use copy constructor with clearId set to true instead
     202     * Clears the metadata, including id and version known to the OSM API.
     203     * The id is a new unique id. The version, changeset and timestamp are set to 0.
     204     * incomplete and deleted are set to false. It's preferred to use copy constructor with clearMetadata set to true instead
    204205     * of calling this method.
    205      */
    206     public void clearOsmId() {
     206     * @since 6140
     207     */
     208    public void clearOsmMetadata() {
    207209        // Not part of dataset - no lock necessary
    208210        this.id = generateUniqueId();
     
    210212        this.user = null;
    211213        this.changesetId = 0; // reset changeset id on a new object
     214        this.timestamp = 0;
    212215        this.setIncomplete(false);
     216        this.setDeleted(false);
     217        this.setVisible(true);
    213218    }
    214219
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r6105 r6140  
    152152     * Constructs an identical clone of the argument.
    153153     * @param clone The node to clone
    154      * @param clearId If true, set version to 0 and id to new unique value
    155      */
    156     public Node(Node clone, boolean clearId) {
     154     * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. If {@code false}, does nothing
     155     */
     156    public Node(Node clone, boolean clearMetadata) {
    157157        super(clone.getUniqueId(), true /* allow negative IDs */);
    158158        cloneFrom(clone);
    159         if (clearId) {
    160             clearOsmId();
     159        if (clearMetadata) {
     160            clearOsmMetadata();
    161161        }
    162162    }
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r6069 r6140  
    383383
    384384    /**
    385      * Clears the id and version known to the OSM API. The id and the version is set to 0.
    386      * incomplete is set to false. It's preferred to use copy constructor with clearId set to true instead
    387      * of calling this method.
     385     * Clears the metadata, including id and version known to the OSM API.
     386     * The id is a new unique id. The version, changeset and timestamp are set to 0.
     387     * incomplete and deleted are set to false. It's preferred to use copy constructor with clearMetadata set to true instead
    388388     *
    389389     * <strong>Caution</strong>: Do not use this method on primitives which are already added to a {@link DataSet}.
    390390     *
    391391     * @throws DataIntegrityProblemException If primitive was already added to the dataset
    392      */
    393     @Override
    394     public void clearOsmId() {
     392     * @since 6140
     393     */
     394    @Override
     395    public void clearOsmMetadata() {
    395396        if (dataSet != null)
    396397            throw new DataIntegrityProblemException("Method cannot be called after primitive was added to the dataset");
    397         super.clearOsmId();
     398        super.clearOsmMetadata();
    398399    }
    399400
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r6105 r6140  
    183183    }
    184184
    185     public Relation(Relation clone, boolean clearId) {
     185    /**
     186     * Constructs an identical clone of the argument.
     187     * @param clone The relation to clone
     188     * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. If {@code false}, does nothing
     189     */
     190    public Relation(Relation clone, boolean clearMetadata) {
    186191        super(clone.getUniqueId(), true);
    187192        cloneFrom(clone);
    188         if (clearId) {
    189             clearOsmId();
     193        if (clearMetadata) {
     194            clearOsmMetadata();
    190195        }
    191196    }
     
    193198    /**
    194199     * Create an identical clone of the argument (including the id)
     200     * @param clone The relation to clone, including its id
    195201     */
    196202    public Relation(Relation clone) {
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r6105 r6140  
    232232     * Contructs a new {@code Way} from an existing {@code Way}.
    233233     * @param original The original {@code Way} to be identically cloned. Must not be null
    234      * @param clearId If true, clears the OSM id as defined by {@link #clearOsmId}. If false, does nothing
     234     * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. If {@code false}, does nothing
    235235     * @since 2410
    236236     */
    237     public Way(Way original, boolean clearId) {
     237    public Way(Way original, boolean clearMetadata) {
    238238        super(original.getUniqueId(), true);
    239239        cloneFrom(original);
    240         if (clearId) {
    241             clearOsmId();
     240        if (clearMetadata) {
     241            clearOsmMetadata();
    242242        }
    243243    }
Note: See TracChangeset for help on using the changeset viewer.