Ignore:
Timestamp:
2017-11-25T01:25:40+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12856

Location:
applications/editors/josm/plugins/indoorhelper/src/model
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoorhelper/src/model/IndoorHelperModel.java

    r32637 r33887  
    2929import org.openstreetmap.josm.data.osm.Filter.FilterPreferenceEntry;
    3030import org.openstreetmap.josm.data.osm.Tag;
     31import org.openstreetmap.josm.gui.MainApplication;
    3132import org.openstreetmap.josm.gui.dialogs.FilterDialog;
    3233import org.openstreetmap.josm.gui.dialogs.FilterTableModel;
     
    7879
    7980                // Get the filter dialog
    80                 FilterDialog filterDialog = Main.map.getToggleDialog(FilterDialog.class);
     81                FilterDialog filterDialog = MainApplication.getMap().getToggleDialog(FilterDialog.class);
    8182
    8283                if (filterDialog != null) {
     
    123124
    124125            // Get the filter dialog
    125             FilterDialog filterDialog = Main.map.getToggleDialog(FilterDialog.class);
     126            FilterDialog filterDialog = MainApplication.getMap().getToggleDialog(FilterDialog.class);
    126127
    127128            if (filterDialog != null) {
     
    182183        this.workingLevel = this.getLevelNumberFromIndex(index);
    183184
    184         FilterDialog filterDialog = Main.map.getToggleDialog(FilterDialog.class);
     185        FilterDialog filterDialog = MainApplication.getMap().getToggleDialog(FilterDialog.class);
    185186        FilterTableModel filterTableModel = filterDialog.getFilterModel();
    186187
     
    258259     */
    259260    public void addTagsToOSM(IndoorObject object, List<Tag> userTags) {
    260         if (!Main.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
     261        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
    261262
    262263            List<Tag> tags = this.getObjectTags(object);
     
    276277            }
    277278
    278         } else if (Main.getLayerManager().getEditDataSet().selectionEmpty()) {
     279        } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
    279280
    280281            JOptionPane.showMessageDialog(null, "No data selected.", "Error", JOptionPane.ERROR_MESSAGE);
     
    290291    public void addTagsToOSM(IndoorObject object) {
    291292
    292         if (!Main.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
     293        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
    293294            List<Tag> tags = this.getObjectTags(object);
    294295            tags.add(new Tag("indoor:level", Integer.toString(workingLevel)));
     
    301302                Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
    302303            }
    303         } else if (Main.getLayerManager().getEditDataSet().selectionEmpty()) {
     304        } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
    304305            JOptionPane.showMessageDialog(null, "No data selected.", "Error", JOptionPane.ERROR_MESSAGE);
    305306        }
  • applications/editors/josm/plugins/indoorhelper/src/model/PresetCounter.java

    r32637 r33887  
    2828/**
    2929 * Counter for the calls of specific indoor objects, to track which items were used most frequently.
    30  * 
     30 *
    3131 * @author egru
    3232 *
    3333 */
    3434public class PresetCounter {
    35    
     35
    3636    private List<IndoorObject> rankingList;
    3737    private List<ObjectCounter> counterList;
    38    
     38
    3939    /**
    4040     * Initiates the counterList with the available IndoorObjects.
    4141     */
    42    
     42
    4343    public PresetCounter() {
    4444        this.init();
    4545    }
    46    
     46
    4747    private void init() {
    4848        counterList = new ArrayList<>();
    49        
     49
    5050        counterList.add(new ObjectCounter(IndoorObject.CONCRETE_WALL, 0));
    5151        counterList.add(new ObjectCounter(IndoorObject.DOOR, 0));
     
    6060        counterList.add(new ObjectCounter(IndoorObject.TOILET_MALE, 0));
    6161    }
    62    
     62
    6363    /**
    6464     * Increments the counter of a specific IndoorObject in the list.
     
    6767    public void count(IndoorObject object) {
    6868        ListIterator<ObjectCounter> iterator = this.counterList.listIterator();
    69        
     69
    7070        // Go through the list and increment the corresponding objects counter value.
    7171        while (iterator.hasNext()) {
    7272            ObjectCounter counterTemp = iterator.next();
    7373            if (counterTemp.getObject().equals(object)) {
    74                     counterList.get(iterator.nextIndex()-1).increment();   
     74                    counterList.get(iterator.nextIndex()-1).increment();
    7575            }
    7676        }
    77        
     77
    7878        //Sort the list.
    7979        this.sort();
    8080    }
    81    
     81
    8282    private void sort() {
    8383        Collections.sort(counterList);
    8484        Collections.reverse(counterList);
    8585    }
    86    
     86
    8787    public List<IndoorObject> getRanking() {
    88         rankingList = new ArrayList<IndoorObject>();
    89        
     88        rankingList = new ArrayList<>();
     89
    9090        rankingList.add(counterList.get(0).getObject());
    9191        rankingList.add(counterList.get(1).getObject());
    9292        rankingList.add(counterList.get(2).getObject());
    9393        rankingList.add(counterList.get(3).getObject());
    94        
     94
    9595        return rankingList;
    9696    }
    97    
    98     private class ObjectCounter implements Comparable<ObjectCounter> {
     97
     98    private static class ObjectCounter implements Comparable<ObjectCounter> {
    9999        private IndoorObject object;
    100100        private int count;
    101        
     101
    102102        ObjectCounter(IndoorObject o, int c) {
    103103            this.object = o;
    104104            this.count = c;
    105105        }
    106        
     106
    107107        public int getCount() {
    108108            return this.count;
    109109        }
    110        
     110
    111111        public IndoorObject getObject() {
    112112            return this.object;
    113113        }
    114        
     114
    115115        public void increment() {
    116116            this.count += 1;
    117117        }
    118        
     118
    119119        @Override
    120120        public int compareTo(ObjectCounter o) {
     
    128128                return 1;
    129129            }
    130            
     130
    131131            return 0;
    132132        }
    133        
     133
    134134    }
    135    
     135
    136136}
Note: See TracChangeset for help on using the changeset viewer.