Changeset 7751 in josm


Ignore:
Timestamp:
2014-11-26T23:32:32+01:00 (6 years ago)
Author:
Don-vip
Message:

see #10775 - allow to sum all numeric values as conflict resolution also for capacity:*=* and step_count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueResolutionDecision.java

    r7743 r7751  
    2929    /** the selected value if {@link #type} is {@link MultiValueDecisionType#KEEP_ONE} */
    3030    private String value;
     31
     32    private static final String[] SUMMABLE_KEYS = new String[] {
     33        "capacity(:.+)?", "step_count"
     34    };
    3135
    3236    /**
     
    197201     */
    198202    public boolean canSumAllNumeric() {
    199         return "capacity".equals(getKey()) && canKeepAll();
     203        if (!canKeepAll()) {
     204            return false;
     205        }
     206        for (String key : SUMMABLE_KEYS) {
     207            if (getKey().matches(key)) {
     208                return true;
     209            }
     210        }
     211        return false;
    200212    }
    201213
     
    225237     *
    226238     */
    227     public void applyTo(OsmPrimitive primitive) throws IllegalStateException{
     239    public void applyTo(OsmPrimitive primitive) {
    228240        if (primitive == null) return;
    229241        if (!isDecided())
    230242            throw new IllegalStateException(tr("Not decided yet."));
    231243        String key = tags.getKeys().iterator().next();
    232         String value = getChosenValue();
    233244        if (type.equals(MultiValueDecisionType.KEEP_NONE)) {
    234245            primitive.remove(key);
    235246        } else {
    236             primitive.put(key, value);
     247            primitive.put(key, getChosenValue());
    237248        }
    238249    }
     
    244255     * @throws IllegalStateException thrown if this resolution is not resolved yet
    245256     */
    246     public void applyTo(Collection<? extends OsmPrimitive> primitives) throws IllegalStateException {
     257    public void applyTo(Collection<? extends OsmPrimitive> primitives) {
    247258        if (primitives == null) return;
    248259        for (OsmPrimitive primitive: primitives) {
     
    262273     * @throws IllegalStateException thrown if this resolution is not resolved yet
    263274     */
    264     public Command buildChangeCommand(OsmPrimitive primitive) throws IllegalArgumentException, IllegalStateException {
     275    public Command buildChangeCommand(OsmPrimitive primitive) {
    265276        CheckParameterUtil.ensureParameterNotNull(primitive, "primitive");
    266277        if (!isDecided())
Note: See TracChangeset for help on using the changeset viewer.