Changeset 7599 in josm


Ignore:
Timestamp:
2014-10-05T01:24:20+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10582 - drop support of undocumented tag josm/ignore. New deprecation test in mapcss tagchecker, with new fix resolution that deletes the object. Please use upload prohibition flag at layer level.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/validator/deprecated.mapcss

    r7490 r7599  
    281281  fixAdd: "bridge:structure=suspension";
    282282}
     283
     284/* See #10582 - JOSM supported this tag as "don't upload this" feature, before the introduction of upload flag at layer level */
     285*[/josm\/ignore/] {
     286  throwError: tr("{0} is deprecated. Please delete this object and use a private layer instead", "{0.key}");
     287  fixDeleteObject: this;
     288}
  • trunk/src/org/openstreetmap/josm/data/APIDataSet.java

    r7120 r7599  
    2929
    3030/**
    31  * Represents a collection of {@link OsmPrimitive}s which should be uploaded to the
    32  * API.
     31 * Represents a collection of {@link OsmPrimitive}s which should be uploaded to the API.
    3332 * The collection is derived from the modified primitives of an {@link DataSet} and it provides methods
    3433 * for sorting the objects in upload order.
    35  *
     34 * @since 2025
    3635 */
    3736public class APIDataSet {
     
    6564
    6665        for (OsmPrimitive osm :primitives) {
    67             if (osm.get("josm/ignore") != null) {
    68                 continue;
    69             }
    7066            if (osm.isNewOrUndeleted() && !osm.isDeleted()) {
    7167                toAdd.add(osm);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r7417 r7599  
    2828import org.openstreetmap.josm.command.ChangePropertyKeyCommand;
    2929import org.openstreetmap.josm.command.Command;
     30import org.openstreetmap.josm.command.DeleteCommand;
    3031import org.openstreetmap.josm.command.SequenceCommand;
    3132import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    3738import org.openstreetmap.josm.data.validation.TestError;
    3839import org.openstreetmap.josm.gui.mappaint.Environment;
     40import org.openstreetmap.josm.gui.mappaint.Keyword;
    3941import org.openstreetmap.josm.gui.mappaint.MultiCascade;
    4042import org.openstreetmap.josm.gui.mappaint.mapcss.Condition;
     
    139141        protected final Map<Instruction.AssignmentInstruction, Severity> errors = new HashMap<>();
    140142        protected final Map<String, Boolean> assertions = new HashMap<>();
     143        protected boolean deletion = false;
    141144
    142145        TagCheck(GroupedMapCSSRule rule) {
     
    210213                            : ai.val instanceof String
    211214                            ? (String) ai.val
     215                            : ai.val instanceof Keyword
     216                            ? ((Keyword) ai.val).val
    212217                            : null;
    213218                    if (ai.key.startsWith("throw")) {
     
    238243                        final String[] x = val.split("=>", 2);
    239244                        check.keyChange.put(Tag.removeWhiteSpaces(x[0]), Tag.removeWhiteSpaces(x[1]));
     245                    } else if ("fixDeleteObject".equals(ai.key) && val != null) {
     246                        CheckParameterUtil.ensureThat(val.equals("this"), "fixDeleteObject must be followed by 'this'");
     247                        check.deletion = true;
    240248                    } else if ("suggestAlternative".equals(ai.key) && val != null) {
    241249                        check.alternatives.add(val);
     
    388396         */
    389397        Command fixPrimitive(OsmPrimitive p) {
    390             if (change.isEmpty() && keyChange.isEmpty()) {
     398            if (change.isEmpty() && keyChange.isEmpty() && !deletion) {
    391399                return null;
    392400            }
     
    403411                final String newKey = insertArguments(matchingSelector, i.getValue());
    404412                cmds.add(new ChangePropertyKeyCommand(p, oldKey, newKey));
     413            }
     414            if (deletion) {
     415                cmds.add(new DeleteCommand(p));
    405416            }
    406417            return new SequenceCommand(tr("Fix of {0}", getDescriptionForMatchingSelector(p, matchingSelector)), cmds);
Note: See TracChangeset for help on using the changeset viewer.