Changeset 19022 in josm


Ignore:
Timestamp:
2024-03-28T09:29:34+01:00 (6 weeks ago)
Author:
GerdP
Message:

see #23305 and #23555:
-revert most of the changes in r18988, it caused too many problems with plugins which relied on the old behaviour

Location:
trunk/src/org/openstreetmap/josm/gui/conflict/tags
Files:
2 edited

Legend:

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

    r18988 r19022  
    1717import java.beans.PropertyChangeListener;
    1818import java.util.Collection;
    19 import java.util.HashSet;
    2019import java.util.LinkedList;
    2120import java.util.List;
     
    4746import org.openstreetmap.josm.gui.util.WindowGeometry;
    4847import org.openstreetmap.josm.gui.widgets.AutoAdjustingSplitPane;
    49 import org.openstreetmap.josm.spi.preferences.Config;
    5048import org.openstreetmap.josm.tools.CheckParameterUtil;
    5149import org.openstreetmap.josm.tools.ImageProvider;
     
    519517        tagModel.populate(tagsToEdit, completeWayTags.getKeysWithMultipleValues(), false);
    520518        relModel.populate(parentRelations, primitives, false);
    521         if (Config.getPref().getBoolean("combine-conflict-precise", true)) {
    522             tagModel.prepareDefaultTagDecisions(getResolvableKeys(tagsOfPrimitives.getKeys(), primitives));
    523         } else {
    524             tagModel.prepareDefaultTagDecisions(false);
    525         }
     519        tagModel.prepareDefaultTagDecisions(false);
    526520        relModel.prepareDefaultRelationDecisions(false);
    527521
     
    649643    }
    650644
    651     /**
    652      * See #23305: Find those tag keys for which no conflict exists.
    653      * @param keysToDecide the keys of tags which might be shown in the conflict dialog
    654      * @param primitives the collection of primitives
    655      * @return the keys which can be resolved using the only available value
    656      */
    657     private static Set<String> getResolvableKeys(Set<String> keysToDecide, Collection<? extends OsmPrimitive> primitives) {
    658         Set<String> easyKeys = new HashSet<>();
    659         // determine the number of objects which have any of the tags which require a decision
    660         int countTagged = 0;
    661         for (OsmPrimitive p : primitives) {
    662             for (String key : keysToDecide) {
    663                 if (p.hasTag(key)) {
    664                     ++countTagged;
    665                     break;
    666                 }
    667             }
    668         }
    669         for (String key : keysToDecide) {
    670             Set<String> values = new HashSet<>();
    671             int num = 0;
    672             for (OsmPrimitive p : primitives) {
    673                 String val = p.get(key);
    674                 if (val != null) {
    675                     num++;
    676                     values.add(val);
    677                 }
    678             }
    679             if (values.size() == 1 && num == countTagged) {
    680                 // there is only one value and all tagged objects have that value -> easy to solve
    681                 easyKeys.add(key);
    682             }
    683         }
    684         return easyKeys;
    685     }
    686 
    687645    @Override
    688646    public void dispose() {
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java

    r19002 r19022  
    293293
    294294    /**
    295      * Prepare the default decisions for the current model.
    296      * @param decidedKeys set of tag keys for which the first value should be used
    297      * @since 18988
    298      */
    299     public void prepareDefaultTagDecisions(Set<String> decidedKeys) {
    300         for (MultiValueResolutionDecision decision : decisions.values()) {
    301             if (!decidedKeys.contains(decision.getKey()))
    302                 continue;
    303             List<String> values = decision.getValues();
    304             if (!values.isEmpty()) {
    305                 decision.keepOne(values.iterator().next());
    306             }
    307         }
    308         rebuild(false);
    309     }
    310 
    311     /**
    312295     * Returns the set of keys in conflict.
    313296     * @return the set of keys in conflict.
Note: See TracChangeset for help on using the changeset viewer.