Ignore:
Timestamp:
2018-06-17T17:51:18+02:00 (7 years ago)
Author:
donvip
Message:

fix #josm16385 - handle multi values in repeat_on tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoorhelper/src/controller/IndoorHelperController.java

    r34179 r34309  
    5757
    5858import model.IndoorHelperModel;
     59import model.IndoorLevel;
    5960import model.TagCatalog.IndoorObject;
    6061import views.LevelSelectorView;
     
    264265   static class ToolHelpButtonListener implements ActionListener {
    265266
    266            @Override
    267            public void actionPerformed(ActionEvent e) {
    268                    String topic = "Plugin/IndoorHelper";
    269                    //Open HelpBrowser for short description about the plugin
    270                    HelpBrowser.setUrlForHelpTopic(Optional.ofNullable(topic).orElse("/"));
    271            }
     267       @Override
     268       public void actionPerformed(ActionEvent e) {
     269           String topic = "Plugin/IndoorHelper";
     270           //Open HelpBrowser for short description about the plugin
     271           HelpBrowser.setUrlForHelpTopic(Optional.ofNullable(topic).orElse("/"));
     272       }
    272273   }
    273274
     
    565566    * specific tag (key). Just unsets the disabled state if object has a tag-value which is part of the
    566567    * current working level.
    567     * 
     568    *
    568569    * @author rebsc
    569570    * @param key sepcific key to unset hidden objects which contains it
     
    572573
    573574     Collection<OsmPrimitive> p = Main.main.getEditDataSet().allPrimitives();
    574      Map<String, String> tags = new HashMap<>();
    575      Integer level = Integer.parseInt(levelValue);
    576      Integer firstVal, secVal;
     575     int level = Integer.parseInt(levelValue);
    577576
    578577     //Find all primitives with the specific tag and check if value is part of the current
     
    580579     for (OsmPrimitive osm: p) {
    581580         if ((osm.isDisabledAndHidden() || osm.isDisabled()) && osm.hasKey(key)) {
    582 
    583              tags = osm.getInterestingTags();
    584 
    585              for (Map.Entry<String, String> e: tags.entrySet()) {
     581             for (Map.Entry<String, String> e: osm.getInterestingTags().entrySet()) {
    586582                if (e.getKey().equals(key)) {
    587                     String val = e.getValue();
    588 
    589                     //Extract values
    590                     if (val.indexOf("-") == 0) {
    591                         firstVal = (Integer.parseInt(val.split("-", 2)[1].split("-", 2)[0]))*-1;
    592                         secVal = Integer.parseInt(val.split("-", 2)[1].split("-", 2)[1]);
    593                     } else {
    594                         firstVal = Integer.parseInt(val.split("-")[0]);
    595                         secVal = Integer.parseInt(val.split("-")[1]);
    596                     }
    597 
    598583                    //Compare values to current working level
    599                     if (level >= ((firstVal)-1) && level <= secVal) {
     584                    if (IndoorLevel.isPartOfWorkingLevel(e.getValue(), level)) {
    600585                        osm.unsetDisabledState();
    601586                    } else {
Note: See TracChangeset for help on using the changeset viewer.