Changeset 6506 in josm


Ignore:
Timestamp:
2013-12-22T00:09:16+01:00 (11 years ago)
Author:
simon04
Message:

see #9414 - implement MapCSS-based tag checker/fixer

The file deprecated.mapcss contains all DeprecatedTags tests. The
latter is to be removed eventually.

Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Tag.java

    r5058 r6506  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.osm;
     3
     4import org.openstreetmap.josm.tools.CheckParameterUtil;
    35
    46/**
     
    9799    }
    98100
     101    public static Tag ofString(String s) {
     102        CheckParameterUtil.ensureParameterNotNull(s, "s");
     103        final String[] x = s.split("=", 2);
     104        if (x.length == 2) {
     105            return new Tag(x[0], x[1]);
     106        } else {
     107            throw new IllegalArgumentException("String does not contain '='");
     108        }
     109    }
     110
    99111    @Override
    100112    public String toString() {
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r6472 r6506  
    3535import org.openstreetmap.josm.data.validation.tests.DuplicatedWayNodes;
    3636import org.openstreetmap.josm.data.validation.tests.Highways;
     37import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
    3738import org.openstreetmap.josm.data.validation.tests.MultipolygonTest;
    3839import org.openstreetmap.josm.data.validation.tests.NameMismatch;
     
    106107        DuplicateRelation.class, // ID 1901 .. 1999
    107108        BuildingInBuilding.class, // ID 2001 .. 2099
    108         DeprecatedTags.class, // ID 2101 .. 2199
     109        //DeprecatedTags.class, // ID 2101 .. 2199
    109110        OverlappingAreas.class, // ID 2201 .. 2299
    110111        WayConnectedToArea.class, // ID 2301 .. 2399
     
    114115        Highways.class, // ID 2701 .. 2799
    115116        BarriersEntrances.class, // ID 2801 .. 2899
    116         OpeningHourTest.class // 2901 .. 2999
     117        OpeningHourTest.class, // 2901 .. 2999
     118        MapCSSTagChecker.class, // 3000 .. 3099
    117119    };
    118120   
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r6362 r6506  
    359359            return env.osm.getUniqueId();
    360360        }
     361
     362        public static String tr(String... args) {
     363            final String text = args[0];
     364            System.arraycopy(args, 1, args, 0, args.length - 1);
     365            return org.openstreetmap.josm.tools.I18n.tr(text, args);
     366        }
    361367    }
    362368
  • trunk/src/org/openstreetmap/josm/tools/CheckParameterUtil.java

    r6362 r6506  
    9292
    9393    /**
     94     * Ensures that the condition {@code condition} holds.
     95     * @param condition The condition to check
     96     * @throws IllegalArgumentException if the condition does not hold
     97     */
     98    public static void ensureThat(boolean condition, String message) throws IllegalArgumentException {
     99        if (!condition)
     100            throw new IllegalArgumentException(message);
     101    }
     102
     103    /**
    94104     * Ensures that <code>id</code> is non-null primitive id of type {@link OsmPrimitiveType#NODE}
    95105     *
Note: See TracChangeset for help on using the changeset viewer.