Ignore:
Timestamp:
2011-02-20T10:50:59+01:00 (14 years ago)
Author:
stoecker
Message:

remove tabs, cleanup code

Location:
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
Files:
46 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressEditContainer.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
    1414/**
    15  * This program is free software: you can redistribute it and/or modify it under 
    16  * the terms of the GNU General Public License as published by the 
    17  * Free Software Foundation, either version 3 of the License, or 
    18  * (at your option) any later version. 
    19  * 
    20  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    21  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    22  * See the GNU General Public License for more details. 
    23  * 
    24  * You should have received a copy of the GNU General Public License along with this program. 
     15 * This program is free software: you can redistribute it and/or modify it under
     16 * the terms of the GNU General Public License as published by the
     17 * Free Software Foundation, either version 3 of the License, or
     18 * (at your option) any later version.
     19 *
     20 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     21 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     22 * See the GNU General Public License for more details.
     23 *
     24 * You should have received a copy of the GNU General Public License along with this program.
    2525 * If not, see <http://www.gnu.org/licenses/>.
    2626 */
     
    5858 * set of OSM primitives and checks for incomplete addresses (e. g. missing addr:... tags) or
    5959 * addresses with unknown streets ("unresolved addresses").
    60  * 
    61  * It listens to changes within instances of {@link IOSMEntity} to notify clients on update. 
    62  * 
     60 *
     61 * It listens to changes within instances of {@link IOSMEntity} to notify clients on update.
     62 *
    6363 * {@link AddressEditContainer} is the central class used within actions and UI models to show
    6464 * and alter OSM data.
    65  * 
     65 *
    6666 * {@see AbstractAddressEditAction}
    6767 * {@see AddressEditTableModel}
    68  * 
     68 *
    6969 * @author Oliver Wieland <oliver.wieland@online.de>
    70  * 
     70 *
    7171 */
    7272
    7373public class AddressEditContainer implements Visitor, DataSetListener, IAddressEditContainerListener, IProblemVisitor, IAllKnowingTrashHeap {
    74        
     74
    7575        private Collection<? extends OsmPrimitive> workingSet;
    7676        /** The street dictionary collecting all streets to a set of unique street names. */
    7777        private HashMap<String, OSMStreet> streetDict = new HashMap<String, OSMStreet>(100);
    78        
     78
    7979        /** The unresolved addresses list. */
    8080        private List<OSMAddress> unresolvedAddresses = new ArrayList<OSMAddress>(100);
    81        
     81
    8282        /** The incomplete addresses list. */
    8383        private List<OSMAddress> incompleteAddresses = new ArrayList<OSMAddress>(100);
    84        
     84
    8585        /** The shadow copy to assemble the street dict during update. */
    8686        private HashMap<String, OSMStreet> shadowStreetDict = new HashMap<String, OSMStreet>(100);
     
    8989        /** The shadow copy to assemble the incomplete addresses during update. */
    9090        private List<OSMAddress> shadowIncompleteAddresses = new ArrayList<OSMAddress>(100);
    91        
     91
    9292        /** The visited nodes cache to increase iteration speed. */
    9393        private HashSet<Node> visitedNodes = new HashSet<Node>();
    9494        /** The visited ways cache to increase iteration speed. */
    95         private HashSet<Way> visitedWays = new HashSet<Way>(); 
     95        private HashSet<Way> visitedWays = new HashSet<Way>();
    9696        /** The tag list used within the data area. */
    9797        private HashSet<String> tags = new HashSet<String>();
    9898        /** The tag list used within the data area. */
    9999        private HashMap<String, String> values = new HashMap<String, String>();
    100        
     100
    101101        /** The list containing the problems */
    102102        private List<IProblem> problems = new ArrayList<IProblem>();
    103        
     103
    104104        /** The change listeners. */
    105105        private List<IAddressEditContainerListener> listeners = new ArrayList<IAddressEditContainerListener>();
    106        
    107         /**
    108          * Creates an empty container. 
     106
     107        /**
     108         * Creates an empty container.
    109109         */
    110110        public AddressEditContainer() {
     
    130130                listeners.add(listener);
    131131        }
    132        
     132
    133133        /**
    134134         * Removes a change listener.
     
    138138                listeners.remove(listener);
    139139        }
    140        
     140
    141141        /**
    142142         * Notifies clients that the address container changed.
    143143         */
    144144        protected void fireContainerChanged() {
    145                 List<IAddressEditContainerListener> shadowListeners = 
     145                List<IAddressEditContainerListener> shadowListeners =
    146146                        new ArrayList<IAddressEditContainerListener>(listeners);
    147                
     147
    148148                for (IAddressEditContainerListener listener : shadowListeners) {
    149149                        listener.containerChanged(this);
    150150                }
    151151        }
    152        
     152
    153153        /**
    154154         * Notifies clients that an entity within the address container changed.
     
    156156        protected void fireEntityChanged(IOSMEntity entity) {
    157157                if (entity == null) throw new RuntimeException("Entity must not be null");
    158                
    159                 List<IAddressEditContainerListener> shadowListeners = 
     158
     159                List<IAddressEditContainerListener> shadowListeners =
    160160                        new ArrayList<IAddressEditContainerListener>(listeners);
    161                
     161
    162162                for (IAddressEditContainerListener listener : shadowListeners) {
    163163                        listener.entityChanged(entity);
    164164                }
    165165        }
    166        
     166
    167167        /**
    168168         * Marks an OSM node as visited.
     
    173173                visitedNodes.add(n);
    174174        }
    175        
     175
    176176        /**
    177177         * Checks a node for been visited.
     
    183183                return visitedNodes.contains(n);
    184184        }
    185        
     185
    186186        /**
    187187         * Marks a way as visited.
     
    192192                visitedWays.add(w);
    193193        }
    194        
     194
    195195        /**
    196196         * Checks a way for been visited.
     
    202202                return visitedWays.contains(w);
    203203        }
    204        
     204
    205205        /* (non-Javadoc)
    206206         * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Node)
     
    215215                // Address nodes are recycled in order to keep instance variables like guessed names
    216216                aNode = OsmFactory.createNode(n);
    217                                                
     217
    218218                if (aNode != null) {
    219219                        addAndClassifyAddress(aNode);
    220220                        aNode.visit(this, this);
    221                 } 
     221                }
    222222                markNodeAsVisited(n);
    223223        }
    224        
     224
    225225        /* (non-Javadoc)
    226226         * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Way)
     
    228228        @Override
    229229        public void visit(Way w) {
    230                 // This doesn't matter, we just need the street name 
     230                // This doesn't matter, we just need the street name
    231231                //if (w.isIncomplete()) return;
    232                
     232
    233233                if (hasBeenVisited(w)) {
    234234                        return;
    235235                }
    236                
     236
    237237                createNodeFromWay(w);
    238238                markWayAsVisited(w);
     
    246246        private void addAndClassifyAddress(OSMAddress aNode) {
    247247                if (!assignAddressToStreet(aNode)) {
    248                         // Assignment failed: Street is not known (yet) -> add to 'unresolved' list 
     248                        // Assignment failed: Street is not known (yet) -> add to 'unresolved' list
    249249                        shadowUnresolvedAddresses.add(aNode);
    250250                }
     
    262262        private void createNodeFromWay(Way w) {
    263263                IOSMEntity ne = OsmFactory.createNodeFromWay(w);
    264                
     264
    265265                if (!processNode(ne, w)) {
    266266                        // Look also into nodes for addresses (unlikely, but at least they
     
    274274                                        tags.add(key);
    275275                                }
    276                                
     276
    277277                                String v = w.get(key);
    278278                                if (!values.containsKey(v)) {
     
    286286         * Process an entity node depending on the type. A street segment is added as a child to the
    287287         * corresponding street dictionary while an address is added to the incomplete/unresolved list
    288          * depending of it's properties. 
     288         * depending of it's properties.
    289289         *
    290290         * @param ne the entity node.
     
    321321                        }
    322322
    323                         // Node is an address 
     323                        // Node is an address
    324324                        if (ne instanceof OSMAddress) {
    325325                                OSMAddress aNode = (OSMAddress) ne;
     
    352352                return streetDict;
    353353        }
    354        
     354
    355355        /**
    356356         * Gets the unresolved (addresses without valid street name) addresses.
     
    376376         * @return the street list
    377377         */
    378         public List<OSMStreet> getStreetList() {               
     378        public List<OSMStreet> getStreetList() {
    379379                ArrayList<OSMStreet> sortedList = new ArrayList<OSMStreet>(streetDict.values());
    380380                Collections.sort(sortedList);
     
    397397                return tags;
    398398        }
    399                
     399
    400400        /**
    401401         * @return the values
     
    412412                return streetDict != null ? streetDict.size() : 0;
    413413        }
    414        
     414
    415415        /**
    416416         * Get the number of incomplete addresses.
     
    420420                return incompleteAddresses != null ? incompleteAddresses.size() : 0;
    421421        }
    422        
     422
    423423        /**
    424424         * Gets the number of unresolved addresses.
     
    428428                return unresolvedAddresses != null ? unresolvedAddresses.size() : 0;
    429429        }
    430        
     430
    431431        /**
    432432         * Gets the number of invalid (unresolved and/or incomplete) addresses.
     
    437437                return getNumberOfIncompleteAddresses() + getNumberOfUnresolvedAddresses();
    438438        }
    439        
     439
    440440        /**
    441441         * Gets the number of guessed tags.
     
    444444        public int getNumberOfGuesses() {
    445445                int sum = 0;
    446                                
     446
    447447                for (OSMAddress aNode : getAllAddressesToFix()) {
    448448                        if (aNode.hasGuesses()) {
     
    452452                return sum;
    453453        }
    454        
     454
    455455        /**
    456456         * Gets all (incomplete and/or unresolved) address nodes to fix.
     
    465465                        }
    466466                }
    467                
    468                 return all; 
    469         }
    470        
     467
     468                return all;
     469        }
     470
    471471        /**
    472472         * @return the problems
     
    475475                return problems;
    476476        }
    477        
     477
    478478        /**
    479479         * Clears the problem list.
     
    489489        private boolean assignAddressToStreet(OSMAddress aNode) {
    490490                String streetName = aNode.getStreetName();
    491                
     491
    492492                if (streetName != null && shadowStreetDict.containsKey(streetName)) {
    493493                        OSMStreet sNode = shadowStreetDict.get(streetName);
     
    495495                        return true;
    496496                }
    497                
     497
    498498                return false;
    499499        }
    500        
     500
    501501        /**
    502502         * Walks through the list of unassigned addresses and tries to assign them to streets.
     
    507507                        if (assignAddressToStreet(node)) {
    508508                                resolvedAddresses.add(node);
    509                         } 
    510                 }
    511                
     509                        }
     510                }
     511
    512512                /* Remove all resolves nodes from unresolved list */
    513513                for (OSMAddress resolved : resolvedAddresses) {
     
    515515                }
    516516        }
    517        
     517
    518518        /**
    519519         * Rebuilds the street and address lists using the data set given
    520          * in  {@link AddressEditContainer#attachToDataSet(Collection)} or the 
    521          * full data set of the current data layer {@link Main#getCurrentDataSet()}. 
     520         * in  {@link AddressEditContainer#attachToDataSet(Collection)} or the
     521         * full data set of the current data layer {@link Main#getCurrentDataSet()}.
    522522         */
    523523        public void invalidate() {
     
    530530                }
    531531        }
    532        
     532
    533533        /**
    534534         * Invalidate using the given data collection.
     
    543543                        clearData();
    544544                        clearProblems();
    545                        
     545
    546546                        for (OsmPrimitive osmPrimitive : osmData) {
    547547                                osmPrimitive.visit(this);
     
    561561                        shadowUnresolvedAddresses.clear();
    562562                        shadowIncompleteAddresses.clear();
    563                        
     563
    564564                        // update clients
    565565                        fireContainerChanged();
    566566                }
    567567        }
    568        
     568
    569569        /**
    570570         * Clears the shadowed lists data and resets the 'visited' flag for every OSM object.
     
    577577                visitedWays.clear();
    578578        }
    579        
     579
    580580        /**
    581581         * Connects the listener to the given data set and revisits the data. This method should
    582582         * be called immediately after an edit session finished.
    583          * 
     583         *
    584584         * If the given data set is not null, calls of {@link AddressEditContainer#invalidate()} will
    585585         * only consider the data given within this set. This can be useful to keep out unimportant
    586586         * areas. However, a side-effect could be that some streets are not included and leads to
    587587         * false alarms regarding unresolved addresses.
    588          * 
     588         *
    589589         * Calling {@link AddressEditContainer#detachFromDataSet()} drops the explicit data set and uses
    590590         * the full data set on subsequent updates.<p>
    591          * 
     591         *
    592592         * <b>Example</b><br>
    593593         * <code>
     
    600600         */
    601601        public void attachToDataSet(Collection<? extends OsmPrimitive> osmDataToWorkOn) {
    602                 if (osmDataToWorkOn != null && !osmDataToWorkOn.isEmpty()) {                   
     602                if (osmDataToWorkOn != null && !osmDataToWorkOn.isEmpty()) {
    603603                        workingSet = new ArrayList<OsmPrimitive>(osmDataToWorkOn);
    604604                } else {
     
    607607                invalidate(); // start our investigation...
    608608        }
    609        
     609
    610610        /**
    611611         * Disconnects the listener from the data set. This method should
    612          * be called immediately before an edit session started in order to 
     612         * be called immediately before an edit session started in order to
    613613         * prevent updates caused by e. g. a selection change within the map view.
    614614         */
    615615        public void detachFromDataSet() {
    616                 //Main.main.getCurrentDataSet().removeDataSetListener(this);           
     616                //Main.main.getCurrentDataSet().removeDataSetListener(this);
    617617                if (workingSet != null) {
    618618                        workingSet.clear();
     
    633633        @Override
    634634        public void nodeMoved(NodeMovedEvent event) {
    635                                
     635
    636636        }
    637637
     
    671671        @Override
    672672        public void tagsChanged(TagsChangedEvent event) {
    673                 invalidate();           
     673                invalidate();
    674674        }
    675675
     
    694694        @Override
    695695        public void entityChanged(IOSMEntity entity) {
    696                 fireEntityChanged(entity);     
    697         }
    698        
     696                fireEntityChanged(entity);
     697        }
     698
    699699        /* (non-Javadoc)
    700700         * @see org.openstreetmap.josm.plugins.fixAddresses.IProblemVisitor#addProblem(org.openstreetmap.josm.plugins.fixAddresses.IProblem)
     
    711711        public void removeProblemsOfSource(IOSMEntity entity) {
    712712                CheckParameterUtil.ensureParameterNotNull(entity, "entity");
    713                
     713
    714714                List<IProblem> problemsToRemove = new ArrayList<IProblem>();
    715715                for (IProblem problem : problems) {
     
    718718                        }
    719719                }
    720                
     720
    721721                for (IProblem iProblem : problemsToRemove) {
    722722                        problems.remove(iProblem);
     
    730730        public String getClosestStreetName(String name) {
    731731                List<String> matches = getClosestStreetNames(name, 1);
    732                
     732
    733733                if (matches != null && matches.size() > 0) {
    734734                        return matches.get(0);
    735735                }
    736                
     736
    737737                return null;
    738738        }
     
    744744        public List<String> getClosestStreetNames(String name, int maxEntries) {
    745745                CheckParameterUtil.ensureParameterNotNull(name, "name");
    746                
     746
    747747                // ensure right number of entries
    748748                if (maxEntries < 1) maxEntries = 1;
    749                
     749
    750750                List<StreetScore> scores = new ArrayList<StreetScore>();
    751751                List<String> matches = new ArrayList<String>();
    752                
     752
    753753                // Find the longest common sub string
    754                 for (String     streetName : streetDict.keySet()) {
     754                for (String streetName : streetDict.keySet()) {
    755755                        int score = StringUtils.lcsLength(name, streetName);
    756                        
     756
    757757                        if (score > 3) { // reasonable value?
    758758                                StreetScore sc = new StreetScore(streetName, score);
     
    760760                        }
    761761                }
    762                
     762
    763763                // sort by score
    764764                Collections.sort(scores);
    765                
     765
    766766                // populate result list
    767767                int n = Math.min(maxEntries, scores.size());
     
    769769                        matches.add(scores.get(i).getName());
    770770                }
    771                
     771
    772772                return matches;
    773773        }
     
    779779        public boolean isValidStreetName(String name) {
    780780                if (streetDict == null) return false;
    781                
     781
    782782                return streetDict.containsKey(name);
    783783        }
    784        
     784
    785785        /**
    786786         * Internal class to handle results of {@link AddressEditContainer#getClosestStreetNames(String, int)}.
     
    789789                private String name;
    790790                private int score;
    791                
     791
    792792                /**
    793793                 * @param name Name of the street.
     
    817817                public int compareTo(StreetScore arg0) {
    818818                        if (arg0 == null) return 1;
    819                        
     819
    820820                        return new Integer(score).compareTo(new Integer(arg0.score));
    821821                }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressProblem.java

    r24979 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    5252                this(source, description, solutions, ProblemType.Warning);
    5353        }
    54        
     54
    5555        /**
    5656         * Instantiates a new problem with type 'warning' and without solutions.
     
    7171                }
    7272        }
    73        
     73
    7474        /* (non-Javadoc)
    7575         * @see org.openstreetmap.josm.plugins.fixAddresses.IProblem#addSolution(org.openstreetmap.josm.plugins.fixAddresses.ISolution)
     
    7878        public void addSolution(ISolution solution) {
    7979                CheckParameterUtil.ensureParameterNotNull(solution, "solution");
    80                
     80
    8181                lazyCreateSolutions();
    8282                solutions.add(solution);
     
    8989        public void applySolution(ISolution solution) {
    9090                CheckParameterUtil.ensureParameterNotNull(solution, "solution");
    91                                
    92                 solution.solve();               
     91
     92                solution.solve();
    9393        }
    9494
     
    9999        public void clearSolutions() {
    100100                if (solutions == null) return;
    101                
     101
    102102                solutions.clear();
    103103        }
     
    134134                if (solutions == null ) throw new RuntimeException("Solution list is null");
    135135                if (solutions.size() == 0) throw new RuntimeException("Solution list is empty");
    136                
     136
    137137                CheckParameterUtil.ensureParameterNotNull(solution, "solution");
    138138                solutions.remove(solution);
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressSolution.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2323        private String description;
    2424        private SolutionType type;
    25        
     25
    2626        /**
    2727         * @param description The solution description.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixAddressesMapMode.java

    r24112 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2626
    2727        public FixAddressesMapMode(MapFrame mapFrame) {
    28                 super(tr("Fix adresses"), "incompleteaddress_24", 
    29                                 tr("Show dialog with incomplete addresses"), 
    30                                 mapFrame, 
     28                super(tr("Fix adresses"), "incompleteaddress_24",
     29                                tr("Show dialog with incomplete addresses"),
     30                                mapFrame,
    3131                                Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    3232        }
    3333
    34        
     34
    3535}
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixAddressesPlugin.java

    r24977 r25373  
    11/**
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2727public class FixAddressesPlugin extends Plugin {
    2828        private static IncompleteAddressesDialog incompleteAddrDlg;
    29         private static FixAddressesPreferences preferences; 
     29        private static FixAddressesPreferences preferences;
    3030
    3131        /**
     
    3535        public FixAddressesPlugin(PluginInformation info) {
    3636                super(info);
    37                                
     37
    3838                // Create actions...
    39                 FixUnresolvedStreetsAction action = new FixUnresolvedStreetsAction();           
     39                FixUnresolvedStreetsAction action = new FixUnresolvedStreetsAction();
    4040                SelectIncompleteAddressesAction incAddrAction = new SelectIncompleteAddressesAction();
    41                
     41
    4242                // ... and add them to the tools menu in main
    4343                Main.main.menu.toolsMenu.addSeparator();
    44         Main.main.menu.toolsMenu.add(action);
    45         Main.main.menu.toolsMenu.add(incAddrAction);
    46        
    47         // create preferences instance
    48         preferences = (FixAddressesPreferences) new FixAddressesPreferences.Factory().createPreferenceSetting();
     44                Main.main.menu.toolsMenu.add(action);
     45                Main.main.menu.toolsMenu.add(incAddrAction);
     46
     47                // create preferences instance
     48                preferences = (FixAddressesPreferences) new FixAddressesPreferences.Factory().createPreferenceSetting();
    4949        }
    5050
     
    5656                // TODO Auto-generated method stub
    5757                super.mapFrameInitialized(oldFrame, newFrame);
    58                
     58
    5959                if (newFrame != null) {
    6060                        incompleteAddrDlg = new IncompleteAddressesDialog();
    61                 FixAddressesMapMode faMode = new FixAddressesMapMode(Main.map);
     61                        FixAddressesMapMode faMode = new FixAddressesMapMode(Main.map);
    6262                        IconToggleButton faModeButton = new IconToggleButton(faMode);
    6363                        faModeButton.setVisible(true);
    64                         newFrame.addToggleDialog(incompleteAddrDlg);                                           
     64                        newFrame.addToggleDialog(incompleteAddrDlg);
    6565                }
    6666        }
    67        
    68        
     67
     68
    6969
    7070        /**
     
    7474                return incompleteAddrDlg;
    7575        }
    76        
     76
    7777        /**
    7878         * Gets the preferences instance for this plugin.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixAddressesPreferences.java

    r24230 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2323
    2424        public static class Factory implements PreferenceSettingFactory {
    25         public PreferenceSetting createPreferenceSetting() {
    26             return new FixAddressesPreferences();
    27         }
    28     }
    29        
     25                public PreferenceSetting createPreferenceSetting() {
     26                        return new FixAddressesPreferences();
     27                }
     28        }
     29
    3030        @Override
    3131        public void addGui(PreferenceTabbedPane gui) {
    3232                // TODO Auto-generated method stub
    33                
     33
    3434        }
    3535
     
    5959                this.selectGuessedObjects = selectGuessedObjects;
    6060        }
    61        
    62        
    63        
     61
     62
     63
    6464}
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixUnresolvedStreetsAction.java

    r24112 r25373  
    1818 * Action to find and fix addresses without (valid) streets. It launches an dialog
    1919 * instance of {@link AddressEditDialog}.
    20  * 
     20 *
    2121 * @author Oliver Wieland <oliver.wieland@online.de>
    2222 */
     
    3434                                                Shortcut.GROUP_MENU, InputEvent.ALT_DOWN_MASK
    3535                                                | InputEvent.SHIFT_DOWN_MASK), false);
    36                
    37                 setEnabled(false);             
    38                 addressEditContainer = new AddressEditContainer();                             
    39                 DataSet.addSelectionListener(this);             
     36
     37                setEnabled(false);
     38                addressEditContainer = new AddressEditContainer();
     39                DataSet.addSelectionListener(this);
    4040        }
    4141
     
    5353         */
    5454        @Override
    55         public void actionPerformed(ActionEvent arg0) {         
     55        public void actionPerformed(ActionEvent arg0) {
    5656                if (addressEditContainer != null) {
    5757                        addressEditContainer.attachToDataSet(newSelection);
     
    6565                }
    6666        }
    67        
     67
    6868
    6969        /* (non-Javadoc)
     
    7979                        Collection<? extends OsmPrimitive> selection) {
    8080                // Enable button if there is either a selection or at least a data set
    81                 setEnabled(     selection != null && !selection.isEmpty() ||
     81                setEnabled( selection != null && !selection.isEmpty() ||
    8282                                        (getCurrentDataSet() != null));
    8383        }
     
    8787        @SuppressWarnings("unused")
    8888        private void generateTagCode(AddressEditContainer addrVisitor) {
    89                
     89
    9090                for (String tag : addrVisitor.getTags()) {
    9191                        String methodName = createMethodName(tag);
     
    109109                                        .toUpperCase().replaceAll(":", "_"), tag));
    110110                }
    111                                
     111
    112112                for (String value : addrVisitor.getValues().keySet()) {
    113113                        String tag = addrVisitor.getValues().get(value);
    114                        
    115                         String tags = tag.toUpperCase().replaceAll(":", "_"); 
     114
     115                        String tags = tag.toUpperCase().replaceAll(":", "_");
    116116                        String values = value.toUpperCase().replaceAll(":", "_");
    117117                        System.out.println(String.format(
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/GuessAddressRunnable.java

    r24209 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3535/**
    3636 * The class GuessAddressRunnable scans the data set to find the best guess for a missing address field.
    37  * 
    38  * The guessing procedure itself is implemented by defining "guessers" using the {@link GuessedValueHandler} 
    39  * class. A guessed field does not modify the corresponding property of {@link OSMAddress} itself, but 
    40  * adds the guessed value to a shadowed field by calling {@link OSMAddress#setGuessedValue(String, String)}. 
     37 *
     38 * The guessing procedure itself is implemented by defining "guessers" using the {@link GuessedValueHandler}
     39 * class. A guessed field does not modify the corresponding property of {@link OSMAddress} itself, but
     40 * adds the guessed value to a shadowed field by calling {@link OSMAddress#setGuessedValue(String, String)}.
    4141 */
    4242public class GuessAddressRunnable extends PleaseWaitRunnable implements Visitor {
     
    4545        private double minDist;
    4646        private OSMAddress curAddressNode;
    47         private boolean isRunning = false;     
     47        private boolean isRunning = false;
    4848        private boolean cancelled;
    49        
    50        
     49
     50
    5151        /**
    5252         * Instantiates a new guess address runnable.
     
    5757        public GuessAddressRunnable(List<OSMAddress> addresses, String title) {
    5858                super(title != null ? title : tr("Searching"));
    59                 setAddressEditContainer(addresses);             
     59                setAddressEditContainer(addresses);
    6060        }
    6161
     
    6969                        throw new ConcurrentModificationException();
    7070                }
    71                 this.addressesToGuess = nodes;         
     71                this.addressesToGuess = nodes;
    7272        }
    7373
     
    8686                return isRunning;
    8787        }
    88        
     88
    8989        /**
    9090         * Adds a finish listener.
     
    9595                finishListeners.add(l);
    9696        }
    97        
     97
    9898        /**
    9999         * Removes a finish listener.
     
    127127                LatLon ll = curAddressNode.getCoor();
    128128                if (ll == null) return;
    129                
     129
    130130                double dist = ll.greatCircleDistance(n.getCoor());
    131                
     131
    132132                if (dist < minDist) {
    133133                        minDist = dist;
     
    141141        public void visit(Way w) {
    142142                // skip non-streets and streets without name
    143                 if (!TagUtils.hasHighwayTag(w)) return;         
     143                if (!TagUtils.hasHighwayTag(w)) return;
    144144                if (!TagUtils.hasNameTag(w)) return;
    145                
     145
    146146                for (Node node : w.getNodes()) {
    147147                        visit(node);
    148                 }               
     148                }
    149149        }
    150150
     
    154154        @Override
    155155        public void visit(Relation e) {
    156                 // nothing to do yet           
     156                // nothing to do yet
    157157        }
    158158
     
    170170        @Override
    171171        protected void cancel() {
    172                 cancelled = true;               
     172                cancelled = true;
    173173        }
    174174
     
    191191                isRunning = true;
    192192                cancelled = false;
    193                
     193
    194194                // Start progress monitor to guess address values
    195195                progressMonitor.subTask(tr("Searching") + "...");
    196                
     196
    197197                try {
    198198                        progressMonitor.setTicksCount(addressesToGuess.size());
    199                        
    200                        
    201                        
     199
     200
     201
    202202                        List<OSMAddress> shadowCopy = new ArrayList<OSMAddress>(addressesToGuess);
    203                         for (OSMAddress aNode : shadowCopy) {                                   
     203                        for (OSMAddress aNode : shadowCopy) {
    204204                                minDist = Double.MAX_VALUE;
    205205                                curAddressNode = aNode;
    206                                
     206
    207207                                // setup guessing handlers for address tags
    208208                                GuessedValueHandler[] guessers = new GuessedValueHandler[]{
    209                                                 new GuessStreetValueHandler(TagUtils.ADDR_STREET_TAG, aNode),                                           
     209                                                new GuessStreetValueHandler(TagUtils.ADDR_STREET_TAG, aNode),
    210210                                                new GuessedValueHandler(TagUtils.ADDR_POSTCODE_TAG, aNode, 500.0),
    211211                                                new GuessedValueHandler(TagUtils.ADDR_CITY_TAG, aNode, 5000.0),
     
    214214                                                new GuessedValueHandler(TagUtils.ADDR_CITY_TAG, aNode, 2000.0)
    215215                                };
    216                                
    217                                 if (!aNode.needsGuess()) { // nothing to do 
     216
     217                                if (!aNode.needsGuess()) { // nothing to do
    218218                                        progressMonitor.worked(1);
    219219                                        continue;
    220220                                }
    221                                
     221
    222222                                // check for cancel
    223223                                if (cancelled) {
     
    232232                                                break;
    233233                                        }
    234                                        
    235                                         // guess values 
     234
     235                                        // guess values
    236236                                        for (int i = 0; i < guessers.length; i++) {
    237237                                                osmPrimitive.visit(guessers[i]);
    238                                                
     238
    239239                                                if (guessers[i].currentValue == null && i == 0) {
    240240                                                        //System.err.println("Guess #" + i + " failed for " + aNode);
     
    242242                                        }
    243243                                }
    244                                
     244
    245245                                // report progress
    246                                 progressMonitor.worked(1);                             
     246                                progressMonitor.worked(1);
    247247                        }
    248248                } finally {
     
    251251                }
    252252        }
    253        
     253
    254254        private class GuessStreetValueHandler extends GuessedValueHandler {
    255255
     
    270270                 */
    271271                @Override
    272                 public void visit(Way w) {                     
     272                public void visit(Way w) {
    273273                        if (TagUtils.isStreetSupportingHousenumbers(w)) {
    274274                                OSMAddress aNode = getAddressNode();
    275275                                double dist = OsmUtils.getMinimumDistanceToWay(aNode.getCoor(), w);
    276                                
     276
    277277                                if (dist < minDist && dist < getMaxDistance()) {
    278278                                        //System.out.println(String.format("New guess %s: %4.2f m", TagUtils.getNameValue(w), dist));
    279279                                        minDist = dist;
    280                                         currentValue = TagUtils.getNameValue(w);                               
     280                                        currentValue = TagUtils.getNameValue(w);
    281281                                        aNode.setGuessedValue(getTag(), currentValue, w);
    282282                                } else {
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/GuessedValueHandler.java

    r24209 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2424 * The guess is determined by finding the closest way/node with the given tag. If no appropriate node
    2525 * is found within maximum distance, no guess is made.
    26  * 
     26 *
    2727 * The default maximum distance is 100m.
    2828 */
    2929public class GuessedValueHandler implements Visitor {
    30        
     30
    3131        /** Default maximum distance (100m) */
    3232        private static final double DEFAULT_MAX_DIST = 100.0;
    33        
     33
    3434        private String tag;
    3535        protected double minDist;
     
    3737        private OSMAddress aNode;
    3838        private double maxDist = DEFAULT_MAX_DIST;
    39        
     39
    4040        /**
    4141         * Instantiates a new guessed value handler.
     
    4848                this(tag, aNode, DEFAULT_MAX_DIST);
    4949        }
    50        
     50
    5151        /**
    5252         * Instantiates a new guessed value handler.
     
    5858        public GuessedValueHandler(String tag, OSMAddress aNode, double maxDist) {
    5959                super();
    60                
     60
    6161                if (StringUtils.isNullOrEmpty(tag)) {
    6262                        throw new RuntimeException("Tag must not be empty or null!");
    6363                }
    64                
     64
    6565                if (aNode == null) {
    66                         throw new RuntimeException("Address node must not be null!");                   
     66                        throw new RuntimeException("Address node must not be null!");
    6767                }
    68                
     68
    6969                if (maxDist < 1.0) { // clip value
    7070                        maxDist = 1.0;
    7171                }
    7272                this.tag = tag;
    73                
     73
    7474                minDist = Double.MAX_VALUE;
    7575                this.aNode = aNode;
    76                 this.maxDist = maxDist; 
     76                this.maxDist = maxDist;
    7777        }
    78        
     78
    7979        /**
    8080         * Gets the address node to make the guess for.
     
    8787
    8888        /**
    89          * Gets the max distance allowed to consider a node as guess. 
    90          * If the distance of the node is greater than maxDist, the 
     89         * Gets the max distance allowed to consider a node as guess.
     90         * If the distance of the node is greater than maxDist, the
    9191         * node/way will be ignored.
    9292         *
     
    123123                return currentValue;
    124124        }
    125        
     125
    126126        /**
    127127         * Check if we need to visit the OSM data
     
    132132                return aNode.needsGuessedValue(tag);
    133133        }
    134        
     134
    135135        /* (non-Javadoc)
    136136         * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Node)
     
    142142                        if (dist < minDist && dist < maxDist) {
    143143                                minDist = dist;
    144                                 currentValue = n.get(tag);                     
     144                                currentValue = n.get(tag);
    145145                                aNode.setGuessedValue(tag, currentValue, n);
    146146                        }
     
    157157                        if (dist < minDist && dist < maxDist) {
    158158                                minDist = dist;
    159                                 currentValue = w.get(tag);                             
     159                                currentValue = w.get(tag);
    160160                                aNode.setGuessedValue(tag, currentValue, w);
    161161                        }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IAddressEditContainerListener.java

    r24089 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2121         */
    2222        public void containerChanged(AddressEditContainer container);
    23        
     23
    2424        /**
    2525         * Notifies clients that an entity has been changed.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IAllKnowingTrashHeap.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    1717
    1818public interface IAllKnowingTrashHeap {
    19        
     19
    2020        /**
    2121         * Gets the list containing the best matching (closest) street names.
     
    2626         */
    2727        public List<String> getClosestStreetNames(String name, int maxEntries);
    28        
     28
    2929        /**
    3030         * Gets the closest street name to the given name.
     
    3434         */
    3535        public String getClosestStreetName(String name);
    36        
     36
    3737        /**
    3838         * Checks if the given street name is valid.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/ICommandListener.java

    r24089 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IOSMEntity.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2323 * around OSM objects in order to ease up some tasks like tag handling.
    2424 * @author Oliver Wieland <oliver.wieland@online.de>
    25  * 
     25 *
    2626 */
    2727
     
    3232         */
    3333        public OsmPrimitive getOsmObject();
    34        
     34
    3535        /**
    3636         * Checks if underlying OSM object has a name.
     
    3838         */
    3939        public boolean hasName();
    40        
     40
    4141        /**
    4242         * Gets the name of the entity node.
     
    4444         */
    4545        public String getName();
    46        
     46
    4747        /**
    4848         * Gets the children of the entity node.
     
    5050         */
    5151        public List<IOSMEntity> getChildren();
    52        
     52
    5353        /**
    5454         * Gets the coordinate of the node. If the the underlying object is a
    55          * node, it just returns the node coordinate. For ways and areas, this 
    56          * method returns the coordinate of the center (balance point). 
     55         * node, it just returns the node coordinate. For ways and areas, this
     56         * method returns the coordinate of the center (balance point).
    5757         * @return
    5858         */
    5959        public LatLon getCoor();
    60        
     60
    6161        /**
    6262         * Adds a command listener.
     
    6464         */
    6565        public void addCommandListener(ICommandListener listener);
    66        
     66
    6767        /**
    6868         * Removes a command listener.
     
    7070         */
    7171        public void removeCommandListener(ICommandListener listener);
    72        
     72
    7373        /**
    7474         * Collects problems and possible solutions.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IProblem.java

    r24978 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    1717
    1818public interface IProblem {
    19        
     19
    2020        /**
    2121         * Gets the OSM entity which causes the problem.
     
    2424         */
    2525        public IOSMEntity getSource();
    26        
     26
    2727        /**
    2828         * Gets the problem description.
     
    3131         */
    3232        public String getDescription();
    33        
     33
    3434        /**
    3535         * Gets the problem type.
     
    3838         */
    3939        public ProblemType getType();
    40        
     40
    4141        /**
    4242         * Gets the available solutions for this problem.
     
    4545         */
    4646        public List<ISolution> getSolutions();
    47        
     47
    4848        /**
    4949         * Adds a possible solution to the problem.
     
    5252         */
    5353        public void addSolution(ISolution solution);
    54        
     54
    5555        /**
    5656         * Removes a solution from this problem.
     
    5959         */
    6060        public void removeSolution(ISolution solution);
    61        
     61
    6262        /**
    6363         * Removes all solutions from this problem.
    6464         */
    6565        public void clearSolutions();
    66        
     66
    6767        /**
    6868         * Applies a {@link ISolution} instance on the problem.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IProblemVisitor.java

    r24978 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2222         */
    2323        public void addProblem(IProblem problem);
    24        
     24
    2525        /**
    2626         * Removes the problems of the given source.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IProgressMonitorFinishedListener.java

    r24023 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/ISolution.java

    r24978 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    1717
    1818public interface ISolution {
    19        
     19
    2020        /**
    2121         * Gets the description of the solution.
     
    2424         */
    2525        public String getDescription();
    26        
     26
    2727        /**
    2828         * Gets the action to execute for solving the problem.
     
    3131         */
    3232        public JosmAction getAction();
    33        
     33
    3434        /**
    3535         * Gets the solution type.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMAddress.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2424
    2525/**
    26  * The class OSMAddress represents a single address node of OSM. It is a lightweight 
     26 * The class OSMAddress represents a single address node of OSM. It is a lightweight
    2727 * wrapper for a OSM node in order to simplify tag handling.
    2828 */
     
    3030        public static final String MISSING_TAG = "?";
    3131        public static final String INTERPOLATION_TAG = "x..y";
    32        
    33        
    34         /** True, if address is part of an address interpolation. */ 
    35         private boolean isPartOfInterpolation; 
    36         /**
    37          * True, if address has derived values from an associated street relation. 
     32
     33
     34        /** True, if address is part of an address interpolation. */
     35        private boolean isPartOfInterpolation;
     36        /**
     37         * True, if address has derived values from an associated street relation.
    3838         */
    3939        private boolean isPartOfAssocStreetRel;
    40        
     40
    4141        /** The dictionary containing guessed values. */
    4242        private HashMap<String, String> guessedValues = new HashMap<String, String>();
     
    4949                super(osmObject);
    5050        }
    51        
     51
    5252        /* (non-Javadoc)
    5353         * @see org.openstreetmap.josm.plugins.addressEdit.NodeEntityBase#setOsmObject(org.openstreetmap.josm.data.osm.OsmPrimitive)
     
    5656        public void setOsmObject(OsmPrimitive osmObject) {
    5757                super.setOsmObject(osmObject);
    58                
    59                 isPartOfInterpolation = OsmUtils.getValuesFromAddressInterpolation(this);               
     58
     59                isPartOfInterpolation = OsmUtils.getValuesFromAddressInterpolation(this);
    6060                isPartOfAssocStreetRel = OsmUtils.getValuesFromRelation(this);
    6161        }
    62        
     62
    6363        /**
    6464         * Checks if the underlying address node has all tags usually needed to describe an address.
     
    6666         */
    6767        public boolean isComplete() {
    68                 boolean isComplete =    hasCity() &&
     68                boolean isComplete =    hasCity() &&
    6969                                                                hasHouseNumber() &&
    70                                                                 (hasPostalCode() &&
    71                                                                 PostalCodeChecker.hasValidPostalCode(this)) &&
    72                                                                 hasCity() && 
     70                                                                (hasPostalCode() &&
     71                                                                PostalCodeChecker.hasValidPostalCode(this)) &&
     72                                                                hasCity() &&
    7373                                                                hasStreetName();
    74                
     74
    7575                // Check, if "addr:state" is required (US and AU)
    7676                if (TagUtils.isStateRequired()) {
    7777                        isComplete = isComplete && hasState();
    7878                }
    79                
     79
    8080                return isComplete;
    8181        }
    82        
     82
    8383        /**
    8484         * Gets the name of the street associated with this address.
     
    8888                return getTagValueWithGuess(TagUtils.ADDR_STREET_TAG);
    8989        }
    90        
     90
    9191        /**
    9292         * Gets the tag value with guess. If the object does not have the given tag, this method looks for
     
    9999                if (StringUtils.isNullOrEmpty(tag)) return MISSING_TAG;
    100100                if (osmObject == null) return MISSING_TAG;
    101                
     101
    102102                if (!osmObject.hasKey(tag) || StringUtils.isNullOrEmpty(osmObject.get(tag))) {
    103103                        if (!hasDerivedValue(tag)) {
     
    109109                                        return MISSING_TAG;
    110110                                }
    111                         } else { // ok, use derived value known via associated relation or way 
     111                        } else { // ok, use derived value known via associated relation or way
    112112                                return getDerivedValue(tag);
    113113                        }
    114114                } else { // get existing tag value
    115                         return osmObject.get(tag);                     
    116                 }
    117         }
    118        
     115                        return osmObject.get(tag);
     116                }
     117        }
     118
    119119        /**
    120120         * Returns <tt>true</tt>, if this address node has a street name.
     
    124124                return hasTag(TagUtils.ADDR_STREET_TAG);
    125125        }
    126        
     126
    127127        /**
    128128         * Returns the street name guessed by the nearest-neighbor search.
     
    142142                setGuessedValue(TagUtils.ADDR_STREET_TAG, guessedStreetName, srcObj);
    143143        }
    144        
     144
    145145        /**
    146146         * Checks for a guessed street name.
     
    151151                return hasGuessedValue(TagUtils.ADDR_STREET_TAG);
    152152        }
    153        
     153
    154154        /**
    155155         * @return the guessedPostCode
     
    168168                setGuessedValue(TagUtils.ADDR_POSTCODE_TAG, guessedPostCode, srcObj);
    169169        }
    170        
     170
    171171        /**
    172172         * Checks for a guessed post code.
     
    209209         */
    210210        public boolean hasGuesses() {
    211                 return guessedValues.size() > 0; 
    212         }
    213        
     211                return guessedValues.size() > 0;
     212        }
     213
    214214        /**
    215215         * Applies all guessed tags for this node.
     
    219219                        applyGuessForTag(tag);
    220220                }
    221                
     221
    222222                // Clear all guesses
    223223                guessedValues.clear();
    224224                guessedObjects.clear();
    225225        }
    226        
     226
    227227        /**
    228228         * Apply the guessed value for the given tag.
     
    234234                        String val = guessedValues.get(tag);
    235235                        if (!StringUtils.isNullOrEmpty(val)) {
    236                                 setOSMTag(tag, val);                           
     236                                setOSMTag(tag, val);
    237237                        }
    238238                }
     
    245245        public String getPostalCode() {
    246246                String pc = getTagValueWithGuess(TagUtils.ADDR_POSTCODE_TAG);
    247                
    248                
     247
     248
    249249                if (!MISSING_TAG.equals(pc) && !PostalCodeChecker.hasValidPostalCode(getCountry(), pc)) {
    250250                        pc = "(!)" + pc;
     
    252252                return pc;
    253253        }
    254        
     254
    255255        /**
    256256         * Checks if this instance has a valid postal code.
     
    261261                return PostalCodeChecker.hasValidPostalCode(this);
    262262        }
    263        
     263
    264264        /**
    265265         * Checks for post code tag.
     
    270270                return hasTag(TagUtils.ADDR_POSTCODE_TAG);
    271271        }
    272        
     272
    273273        /**
    274274         * Gets the name of the house number associated with this address.
     
    285285                return TagUtils.getAddrHousenumberValue(osmObject);
    286286        }
    287        
     287
    288288        /**
    289289         * Checks for house number.
     
    294294                return TagUtils.hasAddrHousenumberTag(osmObject) || isPartOfInterpolation;
    295295        }
    296        
     296
    297297        /* (non-Javadoc)
    298298         * @see org.openstreetmap.josm.plugins.fixAddresses.OSMEntityBase#getName()
     
    303303                        return TagUtils.getAddrHousenameValue(osmObject);
    304304                }
    305                
     305
    306306                return "";
    307307        }
    308                
     308
    309309        /**
    310310         * Checks if this address is part of a address interpolation.
     
    315315                return isPartOfInterpolation;
    316316        }
    317        
     317
    318318        /**
    319319         * Checks if this address is part of an 'associated street' relation.
     
    332332                return getTagValueWithGuess(TagUtils.ADDR_CITY_TAG);
    333333        }
    334        
     334
    335335        /**
    336336         * Checks for city tag.
     
    341341                return hasTag(TagUtils.ADDR_CITY_TAG);
    342342        }
    343        
     343
    344344        /**
    345345         * Gets the name of the state associated with this address.
     
    349349                return getTagValueWithGuess(TagUtils.ADDR_STATE_TAG);
    350350        }
    351        
     351
    352352        /**
    353353         * Checks for state tag.
     
    366366                return getTagValueWithGuess(TagUtils.ADDR_COUNTRY_TAG);
    367367        }
    368        
     368
    369369        /**
    370370         * Checks for country tag.
     
    375375                return hasTag(TagUtils.ADDR_COUNTRY_TAG);
    376376        }
    377        
     377
    378378        /**
    379379         * Removes all address-related tags from the node or way.
     
    387387                removeOSMTag(TagUtils.ADDR_STREET_TAG);
    388388        }
    389        
     389
    390390        /**
    391391         * Checks if the associated OSM object has the given tag or if the tag is available via a referrer.
     
    396396        public boolean hasTag(String tag) {
    397397                if (StringUtils.isNullOrEmpty(tag)) return false;
    398                
     398
    399399                return TagUtils.hasTag(osmObject, tag) || hasDerivedValue(tag);
    400400        }
    401        
     401
    402402        /* (non-Javadoc)
    403403         * @see org.openstreetmap.josm.plugins.addressEdit.NodeEntityBase#compareTo(org.openstreetmap.josm.plugins.addressEdit.INodeEntity)
     
    409409                }
    410410                OSMAddress other = (OSMAddress) o;
    411                
     411
    412412                int cc = 0;
    413413                cc = this.getCountry().compareTo(other.getCountry());
    414414                if ( cc  == 0) {
    415                         cc = this.getState().compareTo(other.getState());                       
     415                        cc = this.getState().compareTo(other.getState());
    416416                        if (cc  == 0) {
    417                                 cc = this.getCity().compareTo(other.getCity());                         
     417                                cc = this.getCity().compareTo(other.getCity());
    418418                                if (cc  == 0) {
    419                                         cc = this.getStreetName().compareTo(other.getStreetName());                                     
     419                                        cc = this.getStreetName().compareTo(other.getStreetName());
    420420                                        if (cc  == 0) {
    421                                                 if (hasGuessedStreetName()) {                                                   
     421                                                if (hasGuessedStreetName()) {
    422422                                                        if (other.hasStreetName()) {
    423423                                                                // Compare guessed name with the real name
     
    441441                        }
    442442                }
    443                
     443
    444444                return cc;
    445445        }
    446        
     446
    447447        /**
    448448         * Applies the street name from the specified street node.
     
    451451        public void assignStreet(OSMStreet node) {
    452452                if (node == null || !node.hasName()) return;
    453                
     453
    454454                if (!node.getName().equals(getStreetName())) {
    455                         setStreetName(node.getName());                 
     455                        setStreetName(node.getName());
    456456                        node.addAddress(this);
    457457                        fireEntityChanged(this);
    458458                }
    459459        }
    460        
     460
    461461        /**
    462462         * Gets the guessed value for the given tag.
     
    467467        public String getGuessedValue(String tag) {
    468468                CheckParameterUtil.ensureParameterNotNull(tag, "tag");
    469                
     469
    470470                if (!hasGuessedValue(tag)) {
    471                         return null;                   
     471                        return null;
    472472                }
    473473                return guessedValues.get(tag);
    474474        }
    475        
     475
    476476        /**
    477477         * Gets the guessed object.
     
    482482        public OsmPrimitive getGuessedObject(String tag) {
    483483                CheckParameterUtil.ensureParameterNotNull(tag, "tag");
    484                
     484
    485485                if (guessedObjects.containsKey(tag)) {
    486486                        return guessedObjects.get(tag);
     
    488488                return null;
    489489        }
    490        
     490
    491491        /**
    492492         * Gets all guessed objects or an empty list, if no guesses have been made yet.
     
    496496        public Collection<OsmPrimitive> getGuessedObjects() {
    497497                if (guessedObjects == null) return null;
    498                
     498
    499499                return guessedObjects.values();
    500500        }
    501        
     501
    502502        /**
    503503         * Check if this instance needs guessed values. This is the case, if the underlying OSM node
     
    506506         * @return true, if this instance needs at least one guessed value.
    507507         */
    508         public boolean needsGuess() {           
    509                 return  needsGuessedValue(TagUtils.ADDR_CITY_TAG) ||
     508        public boolean needsGuess() {
     509                return  needsGuessedValue(TagUtils.ADDR_CITY_TAG) ||
    510510                                needsGuessedValue(TagUtils.ADDR_POSTCODE_TAG) ||
    511511                                needsGuessedValue(TagUtils.ADDR_COUNTRY_TAG) ||
     
    513513                                needsGuessedValue(TagUtils.ADDR_STREET_TAG);
    514514        }
    515        
     515
    516516        /**
    517517         * Check if this instance needs guessed value for a given tag.
     
    521521                return MISSING_TAG.equals(getTagValueWithGuess(tag));
    522522        }
    523        
     523
    524524        /**
    525525         * Clears all guessed values.
     
    528528                guessedValues.clear();
    529529        }
    530        
     530
    531531        /**
    532532         * Checks if given tag has a guessed value (tag exists and has a non-empty value).
     
    537537        private boolean hasGuessedValue(String tag) {
    538538                CheckParameterUtil.ensureParameterNotNull(tag, "tag");
    539                
    540                 return guessedValues.containsKey(tag) && 
     539
     540                return guessedValues.containsKey(tag) &&
    541541                        !StringUtils.isNullOrEmpty(guessedValues.get(tag));
    542542        }
    543        
     543
    544544        /**
    545545         * Sets the guessed value with the given tag.
     
    559559                }
    560560        }
    561        
     561
    562562        /**
    563563         * Checks if given tag has a derived value (value is available via a referrer).
     
    568568        private boolean hasDerivedValue(String tag) {
    569569                CheckParameterUtil.ensureParameterNotNull(tag, "tag");
    570                
    571                 return derivedValues.containsKey(tag) && 
     570
     571                return derivedValues.containsKey(tag) &&
    572572                        !StringUtils.isNullOrEmpty(derivedValues.get(tag));
    573573        }
    574        
     574
    575575        /**
    576576         * Returns true, if this instance has derived values from any referrer.
     
    578578         */
    579579        public boolean hasDerivedValues() {
    580                 return derivedValues.size() > 0; 
    581         }
    582        
     580                return derivedValues.size() > 0;
     581        }
     582
    583583        /**
    584584         * Gets the derived value for the given tag.
     
    588588        public String getDerivedValue(String tag) {
    589589                if (!hasDerivedValue(tag)) {
    590                         return null;                   
     590                        return null;
    591591                }
    592592                return derivedValues.get(tag);
    593593        }
    594                
     594
    595595        /**
    596596         * Sets the value known indirectly via a referrer with the given tag.
     
    600600         */
    601601        public void setDerivedValue(String tag, String value) {
    602                 derivedValues.put(tag, value);         
    603         }       
    604        
     602                derivedValues.put(tag, value);
     603        }
     604
    605605        /**
    606606         * Sets the street name of the address node.
     
    609609        public void setStreetName(String streetName) {
    610610                if (streetName != null && streetName.length() == 0) return;
    611                
     611
    612612                setOSMTag(TagUtils.ADDR_STREET_TAG, streetName);
    613613        }
    614614
    615        
     615
    616616        /**
    617617         * Sets the state of the address node.
     
    620620        public void setState(String state) {
    621621                if (state != null && state.length() == 0) return;
    622                
     622
    623623                setOSMTag(TagUtils.ADDR_STATE_TAG, state);
    624624        }
    625        
     625
    626626        /**
    627627         * Sets the country of the address node.
     
    630630        public void setCountry(String country) {
    631631                if (country != null && country.length() == 0) return;
    632                
     632
    633633                setOSMTag(TagUtils.ADDR_COUNTRY_TAG, country);
    634634        }
    635        
     635
    636636        /**
    637637         * Sets the post code of the address node.
     
    640640        public void setPostCode(String postCode) {
    641641                if (postCode != null && postCode.length() == 0) return;
    642                
     642
    643643                setOSMTag(TagUtils.ADDR_POSTCODE_TAG, postCode);
    644644        }
    645        
     645
    646646        /* (non-Javadoc)
    647647         * @see org.openstreetmap.josm.plugins.fixAddresses.OSMEntityBase#visit(org.openstreetmap.josm.plugins.fixAddresses.IProblemVisitor)
     
    650650        public void visit(IAllKnowingTrashHeap trashHeap, IProblemVisitor visitor) {
    651651                CheckParameterUtil.ensureParameterNotNull(visitor, "visitor");
    652                
     652
    653653                // Check for street
    654654                if (!hasStreetName()) {
     
    664664                        AddressProblem p = new AddressProblem(this, tr("Address has no valid street"));
    665665                        String match = trashHeap.getClosestStreetName(getStreetName());
    666                        
     666
    667667                        if (!StringUtils.isNullOrEmpty(match)) {
    668668                                setGuessedStreetName(match, null);
     
    671671                        visitor.addProblem(p);
    672672                }
    673                
     673
    674674                // Check for postal code
    675675                if (!hasPostalCode()) {
     
    682682                        visitor.addProblem(p);
    683683                }
    684                
     684
    685685                // Check for city
    686686                if (!hasCity()) {
     
    693693                        visitor.addProblem(p);
    694694                }
    695                
     695
    696696                // Check for country
    697697                if (!hasCountry()) {
     
    711711        private void addGuessValueSolution(AddressProblem p, String tag) {
    712712                AddressSolution s = new AddressSolution(
    713                                 String.format("%s '%s'", tr("Assign to"), getGuessedValue(tag)), 
     713                                String.format("%s '%s'", tr("Assign to"), getGuessedValue(tag)),
    714714                                new ApplyAllGuessesAction(tag),
    715715                                SolutionType.Change);
    716                
     716
    717717                p.addSolution(s);
    718718        }
    719        
     719
    720720        /**
    721721         * Adds the remove address tags solution entry to a problem.
     
    725725        private void addRemoveAddressTagsSolution(IProblem problem) {
    726726                CheckParameterUtil.ensureParameterNotNull(problem, "problem");
    727                
     727
    728728                AddressSolution s = new AddressSolution(
    729                                                 tr("Remove all address tags"), 
     729                                                tr("Remove all address tags"),
    730730                                                new RemoveAddressTagsAction(),
    731731                                                SolutionType.Remove);
    732732                problem.addSolution(s);
    733733        }
    734        
     734
    735735        /* (non-Javadoc)
    736736         * @see org.openstreetmap.josm.plugins.fixAddresses.OSMEntityBase#toString()
     
    754754                if (!StringUtils.isNullOrEmpty(guessed) && MISSING_TAG.equals(sName)) {
    755755                        sName = String.format("(%s)", guessed);
    756                 }       
    757                
    758                 return String.format("%s %s, %s-%s %s (%s) ", 
     756                }
     757
     758                return String.format("%s %s, %s-%s %s (%s) ",
    759759                                sName,
    760760                                node.getHouseNumber(),
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMEntityBase.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3030/**
    3131 * The class OSMEntityBase provides a base implementation for the {@link IOSMEntity} interface.
    32  * 
     32 *
    3333 * The implementation comprises
    3434 * <ol>
     
    4242        private static List<IAddressEditContainerListener> containerListeners = new ArrayList<IAddressEditContainerListener>();
    4343        private List<ICommandListener> cmdListeners = new ArrayList<ICommandListener>();
    44        
     44
    4545        protected OsmPrimitive osmObject;
    46        
     46
    4747        /**
    4848         * @param osmObject
     
    5252                this.osmObject = osmObject;
    5353        }
    54        
     54
    5555        /**
    5656         * @param osmObject the osmObject to set
     
    6969                containerListeners.add(listener);
    7070        }
    71        
     71
    7272        /**
    7373         * Removes a change listener.
     
    7878                containerListeners.remove(listener);
    7979        }
    80        
     80
    8181        /**
    8282         * Notifies clients that the address container changed.
     
    8888                }
    8989        }
    90        
     90
    9191        /**
    9292         * Adds a command listener.
     
    9797                cmdListeners.add(listener);
    9898        }
    99        
     99
    100100        /**
    101101         * Removes a command listener.
     
    106106                cmdListeners.remove(listener);
    107107        }
    108        
     108
    109109        /**
    110110         * Notifies clients that an entity has issued a command.
     
    118118                        throw new RuntimeException("Object has no TX context: " + this);
    119119                }
    120                
     120
    121121                for (ICommandListener l : cmdListeners) {
    122122                        l.commandIssued(this, command);
    123123                }
    124         }       
     124        }
    125125
    126126        public OsmPrimitive getOsmObject() {
     
    144144                return "";
    145145        }
    146        
     146
    147147        /* (non-Javadoc)
    148148         * @see org.openstreetmap.josm.plugins.addressEdit.INodeEntity#hasName()
     
    152152                return TagUtils.hasNameTag(osmObject);
    153153        }
    154        
     154
    155155        /**
    156156         * Internal helper method which changes the given property and
     
    162162         */
    163163        protected void setOSMTag(String tag, String newValue) {
    164                 CheckParameterUtil.ensureParameterNotNull(tag, "tag");         
     164                CheckParameterUtil.ensureParameterNotNull(tag, "tag");
    165165                if (StringUtils.isNullOrEmpty(tag)) return;
    166                
     166
    167167                if (osmObject != null) {
    168                         if ((osmObject.hasKey(tag) && newValue == null) || newValue != null) {                 
     168                        if ((osmObject.hasKey(tag) && newValue == null) || newValue != null) {
    169169                                fireCommandIssued(new ChangePropertyCommand(osmObject, tag, newValue));
    170170                                fireEntityChanged(this);
    171171                        }
    172                 } 
    173         }
    174        
     172                }
     173        }
     174
    175175        /**
    176176         * Removes the given tag from the OSM object.
     
    202202                return this.getName().compareTo(o.getName());
    203203        }
    204        
     204
    205205        /* (non-Javadoc)
    206206         * @see org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity#visit(org.openstreetmap.josm.plugins.fixAddresses.IAllKnowingTrashHeap, org.openstreetmap.josm.plugins.fixAddresses.IProblemVisitor)
     
    218218                OsmPrimitive osm = getOsmObject();
    219219                if (osm == null) return null;
    220                
     220
    221221                if (osm instanceof Node) {
    222222                        return ((Node)osm).getCoor();
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMStreet.java

    r24107 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2424 * This class is the container for all street segments with the same name. Every street
    2525 * consists at least of one segment.
    26  * 
     26 *
    2727 * @author Oliver Wieland <oliver.wieland@online.de>
    2828 */
     
    3030        private List<IOSMEntity> children;
    3131        private List<OSMAddress> addresses;
    32                        
     32
    3333        /**
    3434         * @param osmPrimitive
     
    4141                return children;
    4242        }
    43        
     43
    4444        /**
    4545         * Adds a street segment to the street node.
     
    4848        public void addStreetSegment(OSMStreetSegment segment) {
    4949                lazyCreateChildren();
    50                
     50
    5151                children.add(segment);
    5252                Collections.sort(children);
    5353        }
    54        
     54
    5555        /**
    5656         * Lazy creation of children list.
     
    6161                }
    6262        }
    63        
     63
    6464        /**
    6565         * Adds an associated address to the street.
     
    6969        public void addAddress(OSMAddress aNode) {
    7070                lazyCreateAddresses();
    71                 addresses.add(aNode);           
     71                addresses.add(aNode);
    7272        }
    7373
     
    8080                }
    8181        }
    82        
     82
    8383        /**
    8484         * Checks for addresses.
     
    8989                return addresses != null && addresses.size() > 0;
    9090        }
    91        
     91
    9292        public List<OSMAddress> getAddresses() {
    9393                return addresses;
    9494        }
    95        
     95
    9696        public void setAddresses(List<OSMAddress> addresses) {
    9797                this.addresses = addresses;
    9898        }
    99        
     99
    100100        /**
    101101         * Gets the number of addresses associated with this street.
     
    104104        public int getNumberOfAddresses() {
    105105                if (addresses == null) return 0;
    106                
     106
    107107                return addresses.size();
    108108        }
    109        
     109
    110110        /**
    111111         * Gets the number of street segments of this street.
     
    114114        public int getNumberOfSegments() {
    115115                if (children == null) return 0;
    116                
     116
    117117                int sc = 0;
    118118                for (IOSMEntity node : children) {
     
    123123                return sc;
    124124        }
    125        
     125
    126126        /**
    127127         * Gets the road type(s) of this street. If the street has different types,
    128          * they are separated by comma. 
     128         * they are separated by comma.
    129129         * @return
    130130         */
    131131        public String getType() {
    132132                List<String> types = new ArrayList<String>();
    133                
     133
    134134                for (IOSMEntity seg : getChildren()) {
    135135                        OsmPrimitive osmPrim = seg.getOsmObject();
     
    141141                        }
    142142                }
    143                
     143
    144144                StringBuffer sb = new StringBuffer(20);
    145145                for (String string : types) {
     
    148148                        }
    149149                        sb.append(string);
    150                        
     150
    151151                }
    152152                return sb.toString();
    153153        }
    154        
     154
    155155        /**
    156156         * Checks if the attached way has an associated street relation.
     
    170170                return false;
    171171        }
    172        
     172
    173173        /* (non-Javadoc)
    174174         * @see org.openstreetmap.josm.plugins.addressEdit.NodeEntityBase#toString()
     
    177177        public String toString() {
    178178                StringBuffer sb = new StringBuffer(getName());
    179                
     179
    180180                if (children != null) {
    181181                        sb.append(String.format(", %d segments", children.size()));
    182182                }
    183                
     183
    184184                if (addresses != null) {
    185185                        sb.append(String.format(", %d address entries", addresses.size()));
    186186                }
    187                
     187
    188188                return sb.toString();
    189189        }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMStreetSegment.java

    r24094 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2121 * Represents a single segment of a street. In many cases a segment may represent the complete street, but
    2222 * sometimes a street is separated into many segments, e. g. due to different speed limits, bridges, etc..
    23  * 
     23 *
    2424 * @author Oliver Wieland <oliver.wieland@online.de>
    25  * 
     25 *
    2626 */
    2727
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmFactory.java

    r24095 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2121public class OsmFactory {
    2222        private static HashMap<String, OSMAddress> addressCache = new HashMap<String, OSMAddress>();
    23        
     23
    2424        /**
    2525         * Creates an address node from an OSM node, if possible.
     
    3030                if (TagUtils.isAddress(node)) {
    3131                        String aid = "" + node.getId();
    32                        
     32
    3333                        OSMAddress aNode = lookup(aid);
    3434                        if (aNode == null) {
     
    4040                        return aNode;
    4141                }
    42                
     42
    4343                return null;
    4444        }
    45        
     45
    4646        /**
    4747         * Creates an node entity from an OSM way, if possible.
     
    5353                        return new OSMStreetSegment(way);
    5454                }
    55                
     55
    5656                // Check for building with address
    5757                if (way.isClosed() && TagUtils.hasBuildingTag(way)  && TagUtils.isAddress(way)) {
    5858                        String aid = "" + way.getId();
    59                        
     59
    6060                        OSMAddress aNode = lookup(aid);
    6161                        if (aNode == null) {
     
    6565                                aNode.setOsmObject(way);
    6666                        }
    67        
    68                         return aNode; 
     67
     68                        return aNode;
    6969                }
    7070                return null;
    7171        }
    72        
    73         private static OSMAddress lookup(String aid) {                         
     72
     73        private static OSMAddress lookup(String aid) {
    7474                if (addressCache.containsKey(aid)) {
    75                         return addressCache.get(aid);                   
     75                        return addressCache.get(aid);
    7676                }
    7777                return null;
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmUtils.java

    r24946 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3434 */
    3535public class OsmUtils {
    36        
     36
    3737        /**
    3838         * Instantiates a new osm utils.
    3939         */
    4040        private OsmUtils() {}
    41        
     41
    4242        /** The cached locale. */
    4343        private static String cachedLocale = null;
    44        
     44
    4545        /**
    4646         * Gets the minimum distance of single coordinate to a way.
     
    5252        public static double getMinimumDistanceToWay(LatLon coor, Way w) {
    5353                if (coor == null || w == null) return Double.POSITIVE_INFINITY;
    54                
     54
    5555                double minDist = Double.MAX_VALUE;
    5656                List<Pair<Node,Node>> x = w.getNodePairs(true);
    57                
     57
    5858                for (Pair<Node, Node> pair : x) {
    5959                        LatLon ap = pair.a.getCoor();
    6060                        LatLon bp = pair.b.getCoor();
    61                        
     61
    6262                        double dist = findMinimum(ap, bp, coor);
    6363                        if (dist < minDist) {
     
    6767                return minDist;
    6868        }
    69        
     69
    7070        /**
    7171         * Find the minimum distance between a point and two way coordinates recursively.
     
    8080                CheckParameterUtil.ensureParameterNotNull(b, "b");
    8181                CheckParameterUtil.ensureParameterNotNull(a, "a");
    82                
     82
    8383                LatLon mid = new LatLon((a.lat() + b.lat()) / 2, (a.lon() + b.lon()) / 2);
    84                
     84
    8585                double ac = a.greatCircleDistance(c);
    8686                double bc = b.greatCircleDistance(c);
    8787                double mc = mid.greatCircleDistance(c);
    88                
     88
    8989                double min = Math.min(Math.min(ac, mc), bc);
    90                
    91                                
     90
     91
    9292                if (min < 5.0) { // close enough?
    9393                        return min;
    9494                }
    95                
    96                 if (mc < ac && mc < bc) { 
     95
     96                if (mc < ac && mc < bc) {
    9797                        // mid point has lower distance than a and b
    9898                        if (ac > bc) { // recurse
     
    105105                }
    106106        }
    107        
     107
    108108        /**
    109109         * Checks, if the given address has a relation hosting the address values. This method looks
    110110         * for a relation of type 'associatedStreet' and checks the members for address values, if present.
    111111         * If the member has address values, this methods sets the derived properties of the address
    112          * node accordingly. 
     112         * node accordingly.
    113113         *
    114114         * @param address The address to check.
     
    119119                        return false;
    120120                }
    121                
     121
    122122                boolean hasValuesFromRel = false; /* true, if we applied some address props from the relation */
    123123                OsmPrimitive addrNode = address.getOsmObject();
    124                
     124
    125125                // check all referrers of the node
    126126                for (OsmPrimitive osm : addrNode.getReferrers()) {
     
    129129                                // Relation has the right type?
    130130                                if (!TagUtils.isAssociatedStreetRelation(r)) continue;
    131                                
    132                                 // check for 'street' members 
     131
     132                                // check for 'street' members
    133133                                for (RelationMember rm : r.getMembers()) {
    134134                                        if (TagUtils.isStreetMember(rm)) {
    135135                                                OsmPrimitive street = rm.getMember();
    136                                                 if (TagUtils.hasHighwayTag(street)) {                                                   
     136                                                if (TagUtils.hasHighwayTag(street)) {
    137137                                                        String streetName = TagUtils.getNameValue(street);
    138138                                                        if (!StringUtils.isNullOrEmpty(streetName)) {
     
    142142                                                                break;
    143143                                                        } // else: Street has no name: Ooops
    144                                                 } // else: Street member, but no highway tag: Ooops                                             
     144                                                } // else: Street member, but no highway tag: Ooops
    145145                                        }
    146146                                }
    147                                
     147
    148148                                // Check for other address properties
    149149                                if (TagUtils.hasAddrCityTag(r)) { // city
     
    163163                return hasValuesFromRel;
    164164        }
    165        
     165
    166166        /**
    167167         * Gets the tag values from an address interpolation ref, if present.
     
    172172        public static boolean getValuesFromAddressInterpolation(OSMAddress address) {
    173173                if (address == null) return false;
    174                
     174
    175175                OsmPrimitive osmAddr = address.getOsmObject();
    176                
     176
    177177                for (OsmPrimitive osm : osmAddr.getReferrers()) {
    178178                        if (osm instanceof Way) {
     
    188188                        }
    189189                }
    190                
     190
    191191                return false;
    192192        }
    193        
     193
    194194        /**
    195195         * Gets the local code as string.
     
    205205                return cachedLocale;
    206206        }
    207        
     207
    208208        /**
    209209         * Zooms to the given addresses.
     
    213213        public static void zoomAddresses(List<OSMAddress> addressList) {
    214214                CheckParameterUtil.ensureParameterNotNull(addressList, "addressList");
    215                
    216                 if (Main.map == null && Main.map.mapView == null) return;       // nothing to do
    217                 if (addressList.size() == 0) return;                                            // dto.
    218                        
     215
     216                if (Main.map == null && Main.map.mapView == null) return;   // nothing to do
     217                if (addressList.size() == 0) return;                        // dto.
     218
    219219                // compute bounding box
    220220                BoundingXYVisitor bbox = new BoundingXYVisitor();
    221         for (OSMAddress source : addressList) {
    222                 OsmPrimitive osm = source.getOsmObject();
    223                 Bounds b = new Bounds(osm.getBBox().getTopLeft(), osm.getBBox().getBottomRight());
    224             bbox.visit(b);
    225         }
    226        
    227         if (bbox.getBounds() != null) {
    228                 //      zoom to calculated bounding box       
    229                 Main.map.mapView.zoomTo(bbox.getBounds());
    230         }
     221                for (OSMAddress source : addressList) {
     222                        OsmPrimitive osm = source.getOsmObject();
     223                        Bounds b = new Bounds(osm.getBBox().getTopLeft(), osm.getBBox().getBottomRight());
     224                        bbox.visit(b);
     225                }
     226
     227                if (bbox.getBounds() != null) {
     228                        //  zoom to calculated bounding box
     229                        Main.map.mapView.zoomTo(bbox.getBounds());
     230                }
    231231        }
    232232
     
    241241                CheckParameterUtil.ensureParameterNotNull(address, "address");
    242242                CheckParameterUtil.ensureParameterNotNull(w, "way");
    243                
    244                 if (!address.hasTag(tag) && TagUtils.hasTag(w, tag)) {                                         
     243
     244                if (!address.hasTag(tag) && TagUtils.hasTag(w, tag)) {
    245245                        address.setDerivedValue(tag, w.get(tag));
    246246                }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/PostalCodeChecker.java

    r24321 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2424public class PostalCodeChecker {
    2525        private static HashMap<String, String> postalCodePatternMap = new HashMap<String, String>();
    26        
     26
    2727        static {
    2828                fillMap();
    2929        }
    30        
     30
    3131        /**
    3232         * Checks if given address has a valid postal code.
    3333         *
    3434         * @param address the address to check the postal code for
    35          * @return true, if postal code is valid (this implies 
     35         * @return true, if postal code is valid (this implies
    3636         * also that a country is NOT supported); otherwise false.
    3737         */
    3838        public static boolean hasValidPostalCode(OSMAddress address) {
    3939                CheckParameterUtil.ensureParameterNotNull(address, "address");
    40                
     40
    4141                if (!address.hasPostalCode()) {
    4242                        return false; // no postal code available
    4343                }
    44                
     44
    4545                String ctry = getCountry(address);
    4646                String postalCode = address.getPostalCode();
    47                
     47
    4848                return hasValidPostalCode(ctry, postalCode);
    4949        }
    50        
     50
    5151        /**
    5252         * Checks if postal code is valid for the country reported by the Java VM.
     
    6868        public static boolean hasValidPostalCode(String country, String postalCode) {
    6969                // Get country-specific pattern for postal code
    70                 if (postalCodePatternMap.containsKey(country)) {                       
     70                if (postalCodePatternMap.containsKey(country)) {
    7171                        String pattern = postalCodePatternMap.get(country);
    7272                        // Check if postal code matches pattern
     
    7474                } else {
    7575                        // we cannot validate; assume postal code as valid until we know better
    76                         return true; 
    77                 }
    78         }
    79        
     76                        return true;
     77                }
     78        }
     79
    8080        /**
    8181         * Checks if validation for the given country is supported.
     
    8888                return postalCodePatternMap.containsKey(country.toUpperCase());
    8989        }
    90        
     90
    9191        /**
    9292         * Checks if validation for the given address is supported.
     
    9797        public static boolean isValidationSupported(OSMAddress address) {
    9898                CheckParameterUtil.ensureParameterNotNull(address, "address");
    99                                
     99
    100100                String ctry = getCountry(address);
    101101                return postalCodePatternMap.containsKey(ctry);
    102102        }
    103        
     103
    104104        /**
    105105         * Gets the current country.
     
    126126                return ctry;
    127127        }
    128        
     128
    129129        /**
    130130         * Fills the country-postal code pattern map.
     
    133133                /*
    134134                String[] countries = Locale.getISOCountries();
    135                
     135
    136136                for (int i = 0; i < countries.length; i++) {
    137137                        System.out.println("//postalCodePatternMap.put(\"" + countries[i] + "\", \"[0-9]{5}\");");
    138138                }
    139                
     139
    140140                String x = "A9999AAA";
    141                
     141
    142142                if (x.matches("[A-Z]{1}[0-9]{4}[A-Z]{3}")) {
    143143                        System.out.println("YES");
    144144                }
    145                
     145
    146146                String xx = "99999-999";
    147                 // "[0-9]{5}\-[0-9]{3}"); // 
     147                // "[0-9]{5}\-[0-9]{3}"); //
    148148                if (xx.matches("[0-9]{5}-[0-9]{3}")) {
    149149                        System.out.println("YES");
    150150                }
    151                
    152                
    153                 String[] xxx = new String[]{"A9 9AA", "A99 9AA", "A9A 9AA",     "AA9 9AA", "AA99 9AA", "AA9A 9AA"};
     151
     152
     153                String[] xxx = new String[]{"A9 9AA", "A99 9AA", "A9A 9AA", "AA9 9AA", "AA99 9AA", "AA9A 9AA"};
    154154                for (int i = 0; i < xxx.length; i++) {
    155155                        if (!xxx[i].matches("[A-Z]{1,2}[0-9]{1,2}[A-Z]? [0-9]{1}[A-Z]{2}")) {
     
    158158                }*/
    159159                // see http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html for country codes
    160                 // 
    161                
     160                //
     161
    162162                //postalCodePatternMap.put("AD", "[0-9]{5}");
    163163                //postalCodePatternMap.put("AE", "[0-9]{5}");
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/ProblemType.java

    r24978 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/SolutionType.java

    r24978 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/StringUtils.java

    r23933 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    1919        /**
    2020         * Checks, if a string is either null or empty.
    21          * 
     21         *
    2222         * @param txt
    2323         *            Text to check
     
    3030        /**
    3131         * Gets the length of the longest common substring of a and b
    32          * 
     32         *
    3333         * @param a
    3434         *            First string
     
    8383        /**
    8484         * Gets the longest common substring of a and b.
    85          * 
     85         *
    8686         * @param a The first string.
    8787         * @param b The second string.
     
    117117                return sb.toString();
    118118        }
    119                
     119
    120120        /**
    121121         * @param needle The string to find the best match for.
     
    127127                String bestMatch = null;
    128128                double maxRatio = Double.MIN_VALUE;
    129                                
     129
    130130                if (StringUtils.isNullOrEmpty(needle)) {
    131131                        return null;
     
    134134                        return null;
    135135                }
    136                
     136
    137137                int lNeedle = needle.length();
    138138                for (String curString : haystack) {
     
    143143                                bestMatch = curString;
    144144                        }
    145                        
     145
    146146                }
    147                
     147
    148148                return bestMatch;
    149149        }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/TagUtils.java

    r24208 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2222 * Contains the tags used within OSM. FIXME: Maybe there is a class or similar
    2323 * within JOSM which already defines them, but I have not found it so far.
    24  * 
     24 *
    2525 * @author Oliver Wieland <oliver.wieland@online.de>
    26  * 
     26 *
    2727 */
    2828public final class TagUtils {
    2929        private static String COUNTRIES_REQUIRE_STATE[] = {
    30                 "en_US",        /* USA */
    31                 "en_AU" /* Australia */
     30                "en_US",    /* USA */
     31                "en_AU" /* Australia */
    3232        };
    33        
     33
    3434        /**
    3535         * Checks if the given OSM object has a (non-empty) value for the given tag.
     
    3737         * @param osm the osm object to inspect.
    3838         * @param tag the tag to look for.
    39          * @return true, if osm object has a non-empty value for this tag 
     39         * @return true, if osm object has a non-empty value for this tag
    4040         */
    4141        public static boolean hasTag(OsmPrimitive osm, String tag) {
    4242                return osm != null && !StringUtils.isNullOrEmpty(osm.get(tag));
    4343        }
    44        
     44
    4545        /**
    4646         * Checks if the given OSM primitive is an address node.
     
    4848         */
    4949        public static boolean isAddress(OsmPrimitive osmObject) {
    50                 return  TagUtils.hasAddrCityTag(osmObject) || TagUtils.hasAddrCountryTag(osmObject) ||
     50                return  TagUtils.hasAddrCityTag(osmObject) || TagUtils.hasAddrCountryTag(osmObject) ||
    5151                                TagUtils.hasAddrHousenumberTag(osmObject) || TagUtils.hasAddrPostcodeTag(osmObject) ||
    5252                                TagUtils.hasAddrStateTag(osmObject) || TagUtils.hasAddrStreetTag(osmObject);
    5353        }
    54        
     54
    5555        /**
    5656         * Check if OSM primitive has a tag 'parking'.
    57          * 
     57         *
    5858         * @param osmPrimitive
    5959         *            The OSM entity to check.
     
    6565        /**
    6666         * Gets the value of tag 'parking'.
    67          * 
     67         *
    6868         * @param osmPrimitive
    6969         *            The OSM entity to check.
     
    7575        /**
    7676         * Check if OSM primitive has a tag 'shop'.
    77          * 
     77         *
    7878         * @param osmPrimitive
    7979         *            The OSM entity to check.
     
    8585        /**
    8686         * Gets the value of tag 'shop'.
    87          * 
     87         *
    8888         * @param osmPrimitive
    8989         *            The OSM entity to check.
     
    9595        /**
    9696         * Check if OSM primitive has a tag 'craft'.
    97          * 
     97         *
    9898         * @param osmPrimitive
    9999         *            The OSM entity to check.
     
    105105        /**
    106106         * Gets the value of tag 'craft'.
    107          * 
     107         *
    108108         * @param osmPrimitive
    109109         *            The OSM entity to check.
     
    115115        /**
    116116         * Check if OSM primitive has a tag 'surface'.
    117          * 
     117         *
    118118         * @param osmPrimitive
    119119         *            The OSM entity to check.
     
    125125        /**
    126126         * Gets the value of tag 'surface'.
    127          * 
     127         *
    128128         * @param osmPrimitive
    129129         *            The OSM entity to check.
     
    135135        /**
    136136         * Check if OSM primitive has a tag 'cuisine'.
    137          * 
     137         *
    138138         * @param osmPrimitive
    139139         *            The OSM entity to check.
     
    145145        /**
    146146         * Gets the value of tag 'cuisine'.
    147          * 
     147         *
    148148         * @param osmPrimitive
    149149         *            The OSM entity to check.
     
    155155        /**
    156156         * Check if OSM primitive has a tag 'wood'.
    157          * 
     157         *
    158158         * @param osmPrimitive
    159159         *            The OSM entity to check.
     
    165165        /**
    166166         * Gets the value of tag 'wood'.
    167          * 
     167         *
    168168         * @param osmPrimitive
    169169         *            The OSM entity to check.
     
    175175        /**
    176176         * Check if OSM primitive has a tag 'foot'.
    177          * 
     177         *
    178178         * @param osmPrimitive
    179179         *            The OSM entity to check.
     
    185185        /**
    186186         * Gets the value of tag 'foot'.
    187          * 
     187         *
    188188         * @param osmPrimitive
    189189         *            The OSM entity to check.
     
    195195        /**
    196196         * Check if OSM primitive has a tag 'name:de'.
    197          * 
     197         *
    198198         * @param osmPrimitive
    199199         *            The OSM entity to check.
     
    205205        /**
    206206         * Gets the value of tag 'name:de'.
    207          * 
     207         *
    208208         * @param osmPrimitive
    209209         *            The OSM entity to check.
     
    215215        /**
    216216         * Check if OSM primitive has a tag 'nat_ref'.
    217          * 
     217         *
    218218         * @param osmPrimitive
    219219         *            The OSM entity to check.
     
    225225        /**
    226226         * Gets the value of tag 'nat_ref'.
    227          * 
     227         *
    228228         * @param osmPrimitive
    229229         *            The OSM entity to check.
     
    235235        /**
    236236         * Check if OSM primitive has a tag 'note:de'.
    237          * 
     237         *
    238238         * @param osmPrimitive
    239239         *            The OSM entity to check.
     
    245245        /**
    246246         * Gets the value of tag 'note:de'.
    247          * 
     247         *
    248248         * @param osmPrimitive
    249249         *            The OSM entity to check.
     
    255255        /**
    256256         * Check if OSM primitive has a tag 'addr:street'.
    257          * 
     257         *
    258258         * @param osmPrimitive
    259259         *            The OSM entity to check.
     
    266266        /**
    267267         * Gets the value of tag 'addr:street'.
    268          * 
     268         *
    269269         * @param osmPrimitive
    270270         *            The OSM entity to check.
     
    276276        /**
    277277         * Check if OSM primitive has a tag 'type'.
    278          * 
     278         *
    279279         * @param osmPrimitive
    280280         *            The OSM entity to check.
     
    286286        /**
    287287         * Gets the value of tag 'type'.
    288          * 
     288         *
    289289         * @param osmPrimitive
    290290         *            The OSM entity to check.
     
    296296        /**
    297297         * Check if OSM primitive has a tag 'addr:city'.
    298          * 
     298         *
    299299         * @param osmPrimitive
    300300         *            The OSM entity to check.
     
    307307        /**
    308308         * Gets the value of tag 'addr:city'.
    309          * 
     309         *
    310310         * @param osmPrimitive
    311311         *            The OSM entity to check.
     
    317317        /**
    318318         * Check if OSM primitive has a tag 'boundary'.
    319          * 
     319         *
    320320         * @param osmPrimitive
    321321         *            The OSM entity to check.
     
    327327        /**
    328328         * Gets the value of tag 'boundary'.
    329          * 
     329         *
    330330         * @param osmPrimitive
    331331         *            The OSM entity to check.
     
    337337        /**
    338338         * Check if OSM primitive has a tag 'smoothness'.
    339          * 
     339         *
    340340         * @param osmPrimitive
    341341         *            The OSM entity to check.
     
    348348        /**
    349349         * Gets the value of tag 'smoothness'.
    350          * 
     350         *
    351351         * @param osmPrimitive
    352352         *            The OSM entity to check.
     
    358358        /**
    359359         * Check if OSM primitive has a tag 'opening_hours'.
    360          * 
     360         *
    361361         * @param osmPrimitive
    362362         *            The OSM entity to check.
     
    369369        /**
    370370         * Gets the value of tag 'opening_hours'.
    371          * 
     371         *
    372372         * @param osmPrimitive
    373373         *            The OSM entity to check.
     
    380380        /**
    381381         * Check if OSM primitive has a tag 'bicycle'.
    382          * 
     382         *
    383383         * @param osmPrimitive
    384384         *            The OSM entity to check.
     
    390390        /**
    391391         * Gets the value of tag 'bicycle'.
    392          * 
     392         *
    393393         * @param osmPrimitive
    394394         *            The OSM entity to check.
     
    400400        /**
    401401         * Check if OSM primitive has a tag 'religion'.
    402          * 
     402         *
    403403         * @param osmPrimitive
    404404         *            The OSM entity to check.
     
    410410        /**
    411411         * Gets the value of tag 'religion'.
    412          * 
     412         *
    413413         * @param osmPrimitive
    414414         *            The OSM entity to check.
     
    420420        /**
    421421         * Check if OSM primitive has a tag 'barrier'.
    422          * 
     422         *
    423423         * @param osmPrimitive
    424424         *            The OSM entity to check.
     
    430430        /**
    431431         * Gets the value of tag 'barrier'.
    432          * 
     432         *
    433433         * @param osmPrimitive
    434434         *            The OSM entity to check.
     
    440440        /**
    441441         * Check if OSM primitive has a tag 'power'.
    442          * 
     442         *
    443443         * @param osmPrimitive
    444444         *            The OSM entity to check.
     
    450450        /**
    451451         * Gets the value of tag 'power'.
    452          * 
     452         *
    453453         * @param osmPrimitive
    454454         *            The OSM entity to check.
     
    460460        /**
    461461         * Check if OSM primitive has a tag 'landuse'.
    462          * 
     462         *
    463463         * @param osmPrimitive
    464464         *            The OSM entity to check.
     
    470470        /**
    471471         * Gets the value of tag 'landuse'.
    472          * 
     472         *
    473473         * @param osmPrimitive
    474474         *            The OSM entity to check.
     
    480480        /**
    481481         * Check if OSM primitive has a tag 'fireplace'.
    482          * 
     482         *
    483483         * @param osmPrimitive
    484484         *            The OSM entity to check.
     
    491491        /**
    492492         * Gets the value of tag 'fireplace'.
    493          * 
     493         *
    494494         * @param osmPrimitive
    495495         *            The OSM entity to check.
     
    501501        /**
    502502         * Check if OSM primitive has a tag 'int_ref'.
    503          * 
     503         *
    504504         * @param osmPrimitive
    505505         *            The OSM entity to check.
     
    511511        /**
    512512         * Gets the value of tag 'int_ref'.
    513          * 
     513         *
    514514         * @param osmPrimitive
    515515         *            The OSM entity to check.
     
    521521        /**
    522522         * Check if OSM primitive has a tag 'whitewater:section_grade'.
    523          * 
     523         *
    524524         * @param osmPrimitive
    525525         *            The OSM entity to check.
     
    532532        /**
    533533         * Gets the value of tag 'whitewater:section_grade'.
    534          * 
     534         *
    535535         * @param osmPrimitive
    536536         *            The OSM entity to check.
     
    544544        /**
    545545         * Check if OSM primitive has a tag 'denomination'.
    546          * 
     546         *
    547547         * @param osmPrimitive
    548548         *            The OSM entity to check.
     
    555555        /**
    556556         * Gets the value of tag 'denomination'.
    557          * 
     557         *
    558558         * @param osmPrimitive
    559559         *            The OSM entity to check.
     
    565565        /**
    566566         * Check if OSM primitive has a tag 'addr:postcode'.
    567          * 
     567         *
    568568         * @param osmPrimitive
    569569         *            The OSM entity to check.
     
    576576        /**
    577577         * Gets the value of tag 'addr:postcode'.
    578          * 
     578         *
    579579         * @param osmPrimitive
    580580         *            The OSM entity to check.
     
    587587        /**
    588588         * Check if OSM primitive has a tag 'wires'.
    589          * 
     589         *
    590590         * @param osmPrimitive
    591591         *            The OSM entity to check.
     
    597597        /**
    598598         * Gets the value of tag 'wires'.
    599          * 
     599         *
    600600         * @param osmPrimitive
    601601         *            The OSM entity to check.
     
    607607        /**
    608608         * Check if OSM primitive has a tag 'loc_ref'.
    609          * 
     609         *
    610610         * @param osmPrimitive
    611611         *            The OSM entity to check.
     
    617617        /**
    618618         * Gets the value of tag 'loc_ref'.
    619          * 
     619         *
    620620         * @param osmPrimitive
    621621         *            The OSM entity to check.
     
    627627        /**
    628628         * Check if OSM primitive has a tag 'width'.
    629          * 
     629         *
    630630         * @param osmPrimitive
    631631         *            The OSM entity to check.
     
    637637        /**
    638638         * Gets the value of tag 'width'.
    639          * 
     639         *
    640640         * @param osmPrimitive
    641641         *            The OSM entity to check.
     
    647647        /**
    648648         * Check if OSM primitive has a tag 'tourism'.
    649          * 
     649         *
    650650         * @param osmPrimitive
    651651         *            The OSM entity to check.
     
    657657        /**
    658658         * Gets the value of tag 'tourism'.
    659          * 
     659         *
    660660         * @param osmPrimitive
    661661         *            The OSM entity to check.
     
    667667        /**
    668668         * Check if OSM primitive has a tag 'leisure'.
    669          * 
     669         *
    670670         * @param osmPrimitive
    671671         *            The OSM entity to check.
     
    677677        /**
    678678         * Gets the value of tag 'leisure'.
    679          * 
     679         *
    680680         * @param osmPrimitive
    681681         *            The OSM entity to check.
     
    687687        /**
    688688         * Check if OSM primitive has a tag 'electrified'.
    689          * 
     689         *
    690690         * @param osmPrimitive
    691691         *            The OSM entity to check.
     
    698698        /**
    699699         * Gets the value of tag 'electrified'.
    700          * 
     700         *
    701701         * @param osmPrimitive
    702702         *            The OSM entity to check.
     
    708708        /**
    709709         * Check if OSM primitive has a tag 'junction'.
    710          * 
     710         *
    711711         * @param osmPrimitive
    712712         *            The OSM entity to check.
     
    718718        /**
    719719         * Gets the value of tag 'junction'.
    720          * 
     720         *
    721721         * @param osmPrimitive
    722722         *            The OSM entity to check.
     
    728728        /**
    729729         * Check if OSM primitive has a tag 'railway'.
    730          * 
     730         *
    731731         * @param osmPrimitive
    732732         *            The OSM entity to check.
     
    738738        /**
    739739         * Gets the value of tag 'railway'.
    740          * 
     740         *
    741741         * @param osmPrimitive
    742742         *            The OSM entity to check.
     
    748748        /**
    749749         * Check if OSM primitive has a tag 'voltage'.
    750          * 
     750         *
    751751         * @param osmPrimitive
    752752         *            The OSM entity to check.
     
    758758        /**
    759759         * Gets the value of tag 'voltage'.
    760          * 
     760         *
    761761         * @param osmPrimitive
    762762         *            The OSM entity to check.
     
    768768        /**
    769769         * Check if OSM primitive has a tag 'bridge'.
    770          * 
     770         *
    771771         * @param osmPrimitive
    772772         *            The OSM entity to check.
     
    778778        /**
    779779         * Gets the value of tag 'bridge'.
    780          * 
     780         *
    781781         * @param osmPrimitive
    782782         *            The OSM entity to check.
     
    788788        /**
    789789         * Check if OSM primitive has a tag 'motor_vehicle'.
    790          * 
     790         *
    791791         * @param osmPrimitive
    792792         *            The OSM entity to check.
     
    799799        /**
    800800         * Gets the value of tag 'motor_vehicle'.
    801          * 
     801         *
    802802         * @param osmPrimitive
    803803         *            The OSM entity to check.
     
    810810        /**
    811811         * Check if OSM primitive has a tag 'comment'.
    812          * 
     812         *
    813813         * @param osmPrimitive
    814814         *            The OSM entity to check.
     
    820820        /**
    821821         * Gets the value of tag 'comment'.
    822          * 
     822         *
    823823         * @param osmPrimitive
    824824         *            The OSM entity to check.
     
    830830        /**
    831831         * Check if OSM primitive has a tag 'maxspeed'.
    832          * 
     832         *
    833833         * @param osmPrimitive
    834834         *            The OSM entity to check.
     
    840840        /**
    841841         * Gets the value of tag 'maxspeed'.
    842          * 
     842         *
    843843         * @param osmPrimitive
    844844         *            The OSM entity to check.
     
    850850        /**
    851851         * Check if OSM primitive has a tag 'natural'.
    852          * 
     852         *
    853853         * @param osmPrimitive
    854854         *            The OSM entity to check.
     
    860860        /**
    861861         * Gets the value of tag 'natural'.
    862          * 
     862         *
    863863         * @param osmPrimitive
    864864         *            The OSM entity to check.
     
    870870        /**
    871871         * Check if OSM primitive has a tag 'sac_scale'.
    872          * 
     872         *
    873873         * @param osmPrimitive
    874874         *            The OSM entity to check.
     
    881881        /**
    882882         * Gets the value of tag 'sac_scale'.
    883          * 
     883         *
    884884         * @param osmPrimitive
    885885         *            The OSM entity to check.
     
    891891        /**
    892892         * Check if OSM primitive has a tag 'tunnel'.
    893          * 
     893         *
    894894         * @param osmPrimitive
    895895         *            The OSM entity to check.
     
    901901        /**
    902902         * Gets the value of tag 'tunnel'.
    903          * 
     903         *
    904904         * @param osmPrimitive
    905905         *            The OSM entity to check.
     
    911911        /**
    912912         * Check if OSM primitive has a tag 'waterway'.
    913          * 
     913         *
    914914         * @param osmPrimitive
    915915         *            The OSM entity to check.
     
    921921        /**
    922922         * Gets the value of tag 'waterway'.
    923          * 
     923         *
    924924         * @param osmPrimitive
    925925         *            The OSM entity to check.
     
    931931        /**
    932932         * Check if OSM primitive has a tag 'trail_visibility'.
    933          * 
     933         *
    934934         * @param osmPrimitive
    935935         *            The OSM entity to check.
     
    942942        /**
    943943         * Gets the value of tag 'trail_visibility'.
    944          * 
     944         *
    945945         * @param osmPrimitive
    946946         *            The OSM entity to check.
     
    953953        /**
    954954         * Check if OSM primitive has a tag 'highway'.
    955          * 
     955         *
    956956         * @param osmPrimitive
    957957         *            The OSM entity to check.
     
    963963        /**
    964964         * Gets the value of tag 'highway'.
    965          * 
     965         *
    966966         * @param osmPrimitive
    967967         *            The OSM entity to check.
     
    973973        /**
    974974         * Check if OSM primitive has a tag 'vehicle'.
    975          * 
     975         *
    976976         * @param osmPrimitive
    977977         *            The OSM entity to check.
     
    983983        /**
    984984         * Gets the value of tag 'vehicle'.
    985          * 
     985         *
    986986         * @param osmPrimitive
    987987         *            The OSM entity to check.
     
    993993        /**
    994994         * Check if OSM primitive has a tag 'horse'.
    995          * 
     995         *
    996996         * @param osmPrimitive
    997997         *            The OSM entity to check.
     
    10031003        /**
    10041004         * Gets the value of tag 'horse'.
    1005          * 
     1005         *
    10061006         * @param osmPrimitive
    10071007         *            The OSM entity to check.
     
    10131013        /**
    10141014         * Check if OSM primitive has a tag 'goods'.
    1015          * 
     1015         *
    10161016         * @param osmPrimitive
    10171017         *            The OSM entity to check.
     
    10231023        /**
    10241024         * Gets the value of tag 'goods'.
    1025          * 
     1025         *
    10261026         * @param osmPrimitive
    10271027         *            The OSM entity to check.
     
    10331033        /**
    10341034         * Check if OSM primitive has a tag 'frequency'.
    1035          * 
     1035         *
    10361036         * @param osmPrimitive
    10371037         *            The OSM entity to check.
     
    10441044        /**
    10451045         * Gets the value of tag 'frequency'.
    1046          * 
     1046         *
    10471047         * @param osmPrimitive
    10481048         *            The OSM entity to check.
     
    10541054        /**
    10551055         * Check if OSM primitive has a tag 'man_made'.
    1056          * 
     1056         *
    10571057         * @param osmPrimitive
    10581058         *            The OSM entity to check.
     
    10641064        /**
    10651065         * Gets the value of tag 'man_made'.
    1066          * 
     1066         *
    10671067         * @param osmPrimitive
    10681068         *            The OSM entity to check.
     
    10741074        /**
    10751075         * Check if OSM primitive has a tag 'addr:housenumber'.
    1076          * 
     1076         *
    10771077         * @param osmPrimitive
    10781078         *            The OSM entity to check.
     
    10851085        /**
    10861086         * Gets the value of tag 'addr:housenumber'.
    1087          * 
     1087         *
    10881088         * @param osmPrimitive
    10891089         *            The OSM entity to check.
     
    10931093                                : null;
    10941094        }
    1095        
     1095
    10961096        /**
    10971097         * Check if OSM primitive has a tag 'addr:housename'.
    1098          * 
     1098         *
    10991099         * @param osmPrimitive
    11001100         *            The OSM entity to check.
     
    11071107        /**
    11081108         * Gets the value of tag 'addr:housename'.
    1109          * 
     1109         *
    11101110         * @param osmPrimitive
    11111111         *            The OSM entity to check.
     
    11181118        /**
    11191119         * Check if OSM primitive has a tag 'area'.
    1120          * 
     1120         *
    11211121         * @param osmPrimitive
    11221122         *            The OSM entity to check.
     
    11281128        /**
    11291129         * Gets the value of tag 'area'.
    1130          * 
     1130         *
    11311131         * @param osmPrimitive
    11321132         *            The OSM entity to check.
     
    11381138        /**
    11391139         * Check if OSM primitive has a tag 'building:levels'.
    1140          * 
     1140         *
    11411141         * @param osmPrimitive
    11421142         *            The OSM entity to check.
     
    11491149        /**
    11501150         * Gets the value of tag 'building:levels'.
    1151          * 
     1151         *
    11521152         * @param osmPrimitive
    11531153         *            The OSM entity to check.
     
    11601160        /**
    11611161         * Check if OSM primitive has a tag 'wheelchair'.
    1162          * 
     1162         *
    11631163         * @param osmPrimitive
    11641164         *            The OSM entity to check.
     
    11711171        /**
    11721172         * Gets the value of tag 'wheelchair'.
    1173          * 
     1173         *
    11741174         * @param osmPrimitive
    11751175         *            The OSM entity to check.
     
    11811181        /**
    11821182         * Check if OSM primitive has a tag 'name'.
    1183          * 
     1183         *
    11841184         * @param osmPrimitive
    11851185         *            The OSM entity to check.
     
    11911191        /**
    11921192         * Gets the value of tag 'name'.
    1193          * 
     1193         *
    11941194         * @param osmPrimitive
    11951195         *            The OSM entity to check.
     
    12011201        /**
    12021202         * Check if OSM primitive has a tag 'oneway'.
    1203          * 
     1203         *
    12041204         * @param osmPrimitive
    12051205         *            The OSM entity to check.
     
    12111211        /**
    12121212         * Gets the value of tag 'oneway'.
    1213          * 
     1213         *
    12141214         * @param osmPrimitive
    12151215         *            The OSM entity to check.
     
    12211221        /**
    12221222         * Check if OSM primitive has a tag 'FIXME'.
    1223          * 
     1223         *
    12241224         * @param osmPrimitive
    12251225         *            The OSM entity to check.
     
    12311231        /**
    12321232         * Gets the value of tag 'FIXME'.
    1233          * 
     1233         *
    12341234         * @param osmPrimitive
    12351235         *            The OSM entity to check.
     
    12411241        /**
    12421242         * Check if OSM primitive has a tag 'capacity'.
    1243          * 
     1243         *
    12441244         * @param osmPrimitive
    12451245         *            The OSM entity to check.
     
    12511251        /**
    12521252         * Gets the value of tag 'capacity'.
    1253          * 
     1253         *
    12541254         * @param osmPrimitive
    12551255         *            The OSM entity to check.
     
    12611261        /**
    12621262         * Check if OSM primitive has a tag 'motorcycle'.
    1263          * 
     1263         *
    12641264         * @param osmPrimitive
    12651265         *            The OSM entity to check.
     
    12721272        /**
    12731273         * Gets the value of tag 'motorcycle'.
    1274          * 
     1274         *
    12751275         * @param osmPrimitive
    12761276         *            The OSM entity to check.
     
    12821282        /**
    12831283         * Check if OSM primitive has a tag 'hgv'.
    1284          * 
     1284         *
    12851285         * @param osmPrimitive
    12861286         *            The OSM entity to check.
     
    12921292        /**
    12931293         * Gets the value of tag 'hgv'.
    1294          * 
     1294         *
    12951295         * @param osmPrimitive
    12961296         *            The OSM entity to check.
     
    13021302        /**
    13031303         * Check if OSM primitive has a tag 'construction'.
    1304          * 
     1304         *
    13051305         * @param osmPrimitive
    13061306         *            The OSM entity to check.
     
    13131313        /**
    13141314         * Gets the value of tag 'construction'.
    1315          * 
     1315         *
    13161316         * @param osmPrimitive
    13171317         *            The OSM entity to check.
     
    13231323        /**
    13241324         * Check if OSM primitive has a tag 'addr:state'.
    1325          * 
     1325         *
    13261326         * @param osmPrimitive
    13271327         *            The OSM entity to check.
     
    13341334        /**
    13351335         * Gets the value of tag 'addr:state'.
    1336          * 
     1336         *
    13371337         * @param osmPrimitive
    13381338         *            The OSM entity to check.
     
    13441344        /**
    13451345         * Check if OSM primitive has a tag 'lanes'.
    1346          * 
     1346         *
    13471347         * @param osmPrimitive
    13481348         *            The OSM entity to check.
     
    13541354        /**
    13551355         * Gets the value of tag 'lanes'.
    1356          * 
     1356         *
    13571357         * @param osmPrimitive
    13581358         *            The OSM entity to check.
     
    13641364        /**
    13651365         * Check if OSM primitive has a tag 'note'.
    1366          * 
     1366         *
    13671367         * @param osmPrimitive
    13681368         *            The OSM entity to check.
     
    13741374        /**
    13751375         * Gets the value of tag 'note'.
    1376          * 
     1376         *
    13771377         * @param osmPrimitive
    13781378         *            The OSM entity to check.
     
    13841384        /**
    13851385         * Check if OSM primitive has a tag 'lit'.
    1386          * 
     1386         *
    13871387         * @param osmPrimitive
    13881388         *            The OSM entity to check.
     
    13941394        /**
    13951395         * Gets the value of tag 'lit'.
    1396          * 
     1396         *
    13971397         * @param osmPrimitive
    13981398         *            The OSM entity to check.
     
    14041404        /**
    14051405         * Check if OSM primitive has a tag 'building'.
    1406          * 
     1406         *
    14071407         * @param osmPrimitive
    14081408         *            The OSM entity to check.
     
    14141414        /**
    14151415         * Gets the value of tag 'building'.
    1416          * 
     1416         *
    14171417         * @param osmPrimitive
    14181418         *            The OSM entity to check.
     
    14241424        /**
    14251425         * Check if OSM primitive has a tag 'segregated'.
    1426          * 
     1426         *
    14271427         * @param osmPrimitive
    14281428         *            The OSM entity to check.
     
    14351435        /**
    14361436         * Gets the value of tag 'segregated'.
    1437          * 
     1437         *
    14381438         * @param osmPrimitive
    14391439         *            The OSM entity to check.
     
    14451445        /**
    14461446         * Check if OSM primitive has a tag 'addr:inclusion'.
    1447          * 
     1447         *
    14481448         * @param osmPrimitive
    14491449         *            The OSM entity to check.
     
    14561456        /**
    14571457         * Gets the value of tag 'addr:inclusion'.
    1458          * 
     1458         *
    14591459         * @param osmPrimitive
    14601460         *            The OSM entity to check.
     
    14671467        /**
    14681468         * Check if OSM primitive has a tag 'layer'.
    1469          * 
     1469         *
    14701470         * @param osmPrimitive
    14711471         *            The OSM entity to check.
     
    14771477        /**
    14781478         * Gets the value of tag 'layer'.
    1479          * 
     1479         *
    14801480         * @param osmPrimitive
    14811481         *            The OSM entity to check.
     
    14871487        /**
    14881488         * Check if OSM primitive has a tag 'sport'.
    1489          * 
     1489         *
    14901490         * @param osmPrimitive
    14911491         *            The OSM entity to check.
     
    14971497        /**
    14981498         * Gets the value of tag 'sport'.
    1499          * 
     1499         *
    15001500         * @param osmPrimitive
    15011501         *            The OSM entity to check.
     
    15071507        /**
    15081508         * Check if OSM primitive has a tag 'addr:interpolation'.
    1509          * 
     1509         *
    15101510         * @param osmPrimitive
    15111511         *            The OSM entity to check.
     
    15181518        /**
    15191519         * Gets the value of tag 'addr:interpolation'.
    1520          * 
     1520         *
    15211521         * @param osmPrimitive
    15221522         *            The OSM entity to check.
     
    15291529        /**
    15301530         * Check if OSM primitive has a tag 'cutting'.
    1531          * 
     1531         *
    15321532         * @param osmPrimitive
    15331533         *            The OSM entity to check.
     
    15391539        /**
    15401540         * Gets the value of tag 'cutting'.
    1541          * 
     1541         *
    15421542         * @param osmPrimitive
    15431543         *            The OSM entity to check.
     
    15491549        /**
    15501550         * Check if OSM primitive has a tag 'amenity'.
    1551          * 
     1551         *
    15521552         * @param osmPrimitive
    15531553         *            The OSM entity to check.
     
    15591559        /**
    15601560         * Gets the value of tag 'amenity'.
    1561          * 
     1561         *
    15621562         * @param osmPrimitive
    15631563         *            The OSM entity to check.
     
    15691569        /**
    15701570         * Check if OSM primitive has a tag 'access'.
    1571          * 
     1571         *
    15721572         * @param osmPrimitive
    15731573         *            The OSM entity to check.
     
    15791579        /**
    15801580         * Gets the value of tag 'access'.
    1581          * 
     1581         *
    15821582         * @param osmPrimitive
    15831583         *            The OSM entity to check.
     
    15891589        /**
    15901590         * Check if OSM primitive has a tag 'agricultural'.
    1591          * 
     1591         *
    15921592         * @param osmPrimitive
    15931593         *            The OSM entity to check.
     
    16001600        /**
    16011601         * Gets the value of tag 'agricultural'.
    1602          * 
     1602         *
    16031603         * @param osmPrimitive
    16041604         *            The OSM entity to check.
     
    16101610        /**
    16111611         * Check if OSM primitive has a tag 'capacity:disabled'.
    1612          * 
     1612         *
    16131613         * @param osmPrimitive
    16141614         *            The OSM entity to check.
     
    16211621        /**
    16221622         * Gets the value of tag 'capacity:disabled'.
    1623          * 
     1623         *
    16241624         * @param osmPrimitive
    16251625         *            The OSM entity to check.
     
    16321632        /**
    16331633         * Check if OSM primitive has a tag 'operator'.
    1634          * 
     1634         *
    16351635         * @param osmPrimitive
    16361636         *            The OSM entity to check.
     
    16421642        /**
    16431643         * Gets the value of tag 'operator'.
    1644          * 
     1644         *
    16451645         * @param osmPrimitive
    16461646         *            The OSM entity to check.
     
    16521652        /**
    16531653         * Check if OSM primitive has a tag 'ref'.
    1654          * 
     1654         *
    16551655         * @param osmPrimitive
    16561656         *            The OSM entity to check.
     
    16621662        /**
    16631663         * Gets the value of tag 'ref'.
    1664          * 
     1664         *
    16651665         * @param osmPrimitive
    16661666         *            The OSM entity to check.
     
    16721672        /**
    16731673         * Check if OSM primitive has a tag 'noexit'.
    1674          * 
     1674         *
    16751675         * @param osmPrimitive
    16761676         *            The OSM entity to check.
     
    16821682        /**
    16831683         * Gets the value of tag 'noexit'.
    1684          * 
     1684         *
    16851685         * @param osmPrimitive
    16861686         *            The OSM entity to check.
     
    16921692        /**
    16931693         * Check if OSM primitive has a tag 'admin_level'.
    1694          * 
     1694         *
    16951695         * @param osmPrimitive
    16961696         *            The OSM entity to check.
     
    17031703        /**
    17041704         * Gets the value of tag 'admin_level'.
    1705          * 
     1705         *
    17061706         * @param osmPrimitive
    17071707         *            The OSM entity to check.
     
    17131713        /**
    17141714         * Check if OSM primitive has a tag 'source'.
    1715          * 
     1715         *
    17161716         * @param osmPrimitive
    17171717         *            The OSM entity to check.
     
    17231723        /**
    17241724         * Gets the value of tag 'source'.
    1725          * 
     1725         *
    17261726         * @param osmPrimitive
    17271727         *            The OSM entity to check.
     
    17331733        /**
    17341734         * Check if OSM primitive has a tag 'tracktype'.
    1735          * 
     1735         *
    17361736         * @param osmPrimitive
    17371737         *            The OSM entity to check.
     
    17441744        /**
    17451745         * Gets the value of tag 'tracktype'.
    1746          * 
     1746         *
    17471747         * @param osmPrimitive
    17481748         *            The OSM entity to check.
     
    17541754        /**
    17551755         * Check if OSM primitive has a tag 'addr:country'.
    1756          * 
     1756         *
    17571757         * @param osmPrimitive
    17581758         *            The OSM entity to check.
     
    17651765        /**
    17661766         * Gets the value of tag 'addr:country'.
    1767          * 
     1767         *
    17681768         * @param osmPrimitive
    17691769         *            The OSM entity to check.
     
    17751775        /**
    17761776         * Check if OSM primitive has a tag 'route'.
    1777          * 
     1777         *
    17781778         * @param osmPrimitive
    17791779         *            The OSM entity to check.
     
    17851785        /**
    17861786         * Gets the value of tag 'route'.
    1787          * 
     1787         *
    17881788         * @param osmPrimitive
    17891789         *            The OSM entity to check.
     
    17951795        /**
    17961796         * Check if OSM primitive has a tag 'cables'.
    1797          * 
     1797         *
    17981798         * @param osmPrimitive
    17991799         *            The OSM entity to check.
     
    18051805        /**
    18061806         * Gets the value of tag 'cables'.
    1807          * 
     1807         *
    18081808         * @param osmPrimitive
    18091809         *            The OSM entity to check.
     
    18151815        /**
    18161816         * Check if OSM primitive has a tag 'service'.
    1817          * 
     1817         *
    18181818         * @param osmPrimitive
    18191819         *            The OSM entity to check.
     
    18251825        /**
    18261826         * Gets the value of tag 'service'.
    1827          * 
     1827         *
    18281828         * @param osmPrimitive
    18291829         *            The OSM entity to check.
     
    18351835        /**
    18361836         * Check if OSM primitive has a tag 'motorcar'.
    1837          * 
     1837         *
    18381838         * @param osmPrimitive
    18391839         *            The OSM entity to check.
     
    18451845        /**
    18461846         * Gets the value of tag 'motorcar'.
    1847          * 
     1847         *
    18481848         * @param osmPrimitive
    18491849         *            The OSM entity to check.
     
    18551855        /**
    18561856         * Check if OSM primitive has a tag 'whitewater'.
    1857          * 
     1857         *
    18581858         * @param osmPrimitive
    18591859         *            The OSM entity to check.
     
    18661866        /**
    18671867         * Gets the value of tag 'whitewater'.
    1868          * 
     1868         *
    18691869         * @param osmPrimitive
    18701870         *            The OSM entity to check.
     
    18761876        /**
    18771877         * Check if OSM primitive has a tag 'embankment'.
    1878          * 
     1878         *
    18791879         * @param osmPrimitive
    18801880         *            The OSM entity to check.
     
    18871887        /**
    18881888         * Gets the value of tag 'embankment'.
    1889          * 
     1889         *
    18901890         * @param osmPrimitive
    18911891         *            The OSM entity to check.
     
    18941894                return osmPrimitive != null ? osmPrimitive.get(EMBANKMENT_TAG) : null;
    18951895        }
    1896        
    1897         /**
    1898          * Checks if the given street supporting housenumbers. Usually motor ways and primary roads have 
     1896
     1897        /**
     1898         * Checks if the given street supporting housenumbers. Usually motor ways and primary roads have
    18991899         * no addresses, also no paths or tracks.
    19001900         *
     
    19071907                        return false;
    19081908                }
    1909                
     1909
    19101910                // TODO: Should be configurable
    1911                                        
     1911
    19121912                /* Allow everything until this can be configured */
    19131913                return true;
    19141914                /*
    19151915                String hwType = getHighwayValue(w);
    1916                 return  !(TagUtils.HIGHWAY_MOTORWAY_LINK_VALUE.equals(hwType) ||
     1916                return  !(TagUtils.HIGHWAY_MOTORWAY_LINK_VALUE.equals(hwType) ||
    19171917                                TagUtils.HIGHWAY_MOTORWAY_VALUE.equals(hwType) ||
    19181918                                TagUtils.HIGHWAY_FOOTWAY_VALUE.equals(hwType) ||
    1919                                 TagUtils.HIGHWAY_TRACK_VALUE.equals(hwType) 
     1919                                TagUtils.HIGHWAY_TRACK_VALUE.equals(hwType)
    19201920                                );*/
    19211921        }
    1922        
     1922
    19231923        // Relation support
    1924        
     1924
    19251925        /**
    19261926         * Check if OSM relation is a 'associatedStreet' relation.
    1927          * 
     1927         *
    19281928         * @param osmPrimitive
    19291929         *            The OSM entity to check.
    19301930         */
    19311931        public static boolean isAssociatedStreetRelation(Relation rel) {
    1932                 return rel != null && 
    1933                         rel.hasKey(RELATION_TYPE) && 
     1932                return rel != null &&
     1933                        rel.hasKey(RELATION_TYPE) &&
    19341934                        ASSOCIATEDSTREET_RELATION_TYPE.equals(rel.get(RELATION_TYPE));
    19351935        }
    1936        
     1936
    19371937        /**
    19381938         * Checks if given relation member has role "street".
     
    19441944                return relMember != null && STREET_RELATION_ROLE.equals(relMember.getRole());
    19451945        }
    1946        
     1946
    19471947        /**
    19481948         * Checks if given relation member has role "house".
     
    19541954                return relMember != null && STREET_RELATION_ROLE.equals(relMember.getRole());
    19551955        }
    1956        
    1957        
    1958        
     1956
     1957
     1958
    19591959        /**
    19601960         * Checks if "addr:state" tag is required.
     
    19641964        public static boolean isStateRequired() {
    19651965                String loc = OsmUtils.getLocale();
    1966                
    1967                 for (int i = 0; i < COUNTRIES_REQUIRE_STATE.length; i++) {                     
     1966
     1967                for (int i = 0; i < COUNTRIES_REQUIRE_STATE.length; i++) {
    19681968                        if (COUNTRIES_REQUIRE_STATE[i].equals(loc)) {
    19691969                                return true;
    19701970                        }
    19711971                }
    1972                
     1972
    19731973                return false;
    19741974        }
     
    20652065        public static final String EMBANKMENT_TAG = "embankment";
    20662066        public static final String ADDR_HOUSENAME_TAG = "addr:housename";
    2067        
     2067
    20682068        /* Highway types */
    20692069        public static final String HIGHWAY_CYCLEWAY_VALUE = "cycleway";
     
    20852085
    20862086        /* Relation keys */
    2087        
     2087
    20882088        // Associated street: See http://wiki.openstreetmap.org/wiki/Proposed_features/De:Hausnummern
    20892089        public static final String RELATION_TYPE = "type";
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditDialog.java

    r24944 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    7474        private static final String OK_COMMAND = tr("Close");
    7575        private static final String SELECT_AND_CLOSE = tr("Select and close");
    76        
     76
    7777        private AddressEditContainer editContainer;
    7878        private JTable unresolvedTable;
    7979        private JTable streetTable;
    80        
     80
    8181        /* Actions */
    8282        private AssignAddressToStreetAction resolveAction = new AssignAddressToStreetAction();
     
    8787        private ConvertToRelationAction convertToRelationAction = new ConvertToRelationAction();
    8888        private ConvertAllToRelationAction convertAllToRelationAction = new ConvertAllToRelationAction();
    89        
     89
    9090        private AbstractAddressEditAction[] actions = new AbstractAddressEditAction[] {
    9191                resolveAction,
     
    100100        private JLabel unresolvedAddressesLabel;
    101101        private JMapViewer mapViewer;
    102        
    103        
     102
     103
    104104        /**
    105105         * @param arg0
     
    108108        public AddressEditDialog(AddressEditContainer addressEditContainer) throws HeadlessException  {
    109109                super(JOptionPane.getFrameForComponent(Main.parent), tr("Fix unresolved addresses"), false);
    110        
    111                 this.editContainer = addressEditContainer; 
     110
     111                this.editContainer = addressEditContainer;
    112112                this.editContainer.addChangedListener(this);
    113113                setLayout(new BorderLayout());
    114114                setSize(1024,600);
    115115                setLocationRelativeTo(null);
    116                
     116
    117117                if (addressEditContainer != null) {
    118118                        /* Panel for street table */
     
    122122                        streetTable.getSelectionModel().addListSelectionListener(this);
    123123                        streetTable.addKeyListener(new JumpToEntryListener(1));
    124                        
     124
    125125                        JScrollPane scroll1 = new JScrollPane(streetTable);
    126126                        streetPanel.add(scroll1, BorderLayout.CENTER);
    127                        
     127
    128128                        streetLabel = createHeaderLabel(STREET_HEADER_FMT,
    129129                                        tr(STREETS),
    130130                                        editContainer.getNumberOfStreets());
    131                        
     131
    132132                        JPanel headerPanel = new JPanel(new GridLayout(1, 4));
    133133                        headerPanel.setMinimumSize(new Dimension(100, 30));
    134134                        headerPanel.add(streetLabel);
    135                        
     135
    136136                        /*
    137137                        JPanel streetButtonPanel = new JPanel(new GridLayout(1, 3));
    138                         SideButton convertToRel = new SideButton(convertToRelationAction);                                                                                                                         
     138                        SideButton convertToRel = new SideButton(convertToRelationAction);
    139139                        streetButtonPanel.add(convertToRel);
    140                         // SideButton convertAllToRel = new SideButton(convertAllToRelationAction);                                                                                                                       
     140                        // SideButton convertAllToRel = new SideButton(convertAllToRelationAction);
    141141                        // streetButtonPanel.add(convertAllToRel);
    142142                        // add filler
    143143                        streetButtonPanel.add(new JPanel());
    144144                        streetButtonPanel.add(new JPanel());
    145                        
    146                        
     145
     146
    147147                        streetPanel.add(streetButtonPanel, BorderLayout.SOUTH);
    148148                        */
    149149                        streetPanel.add(headerPanel, BorderLayout.NORTH);
    150150                        streetPanel.setMinimumSize(new Dimension(500, 200));
    151                        
     151
    152152                        /* Panel for unresolved addresses table */
    153153                        JPanel unresolvedPanel = new JPanel(new BorderLayout());
     
    158158                        unresolvedTable.getSelectionModel().addListSelectionListener(new IncompleteAddressListener());
    159159                        unresolvedTable.addMouseListener(applyAllGuessesAction);
    160                        
     160
    161161                        JTableHeader header = unresolvedTable.getTableHeader();
    162162                        header.addMouseListener(uaModel.new ColumnListener(unresolvedTable));
    163                        
     163
    164164                        JScrollPane scroll2 = new JScrollPane(unresolvedTable);
    165165                        unresolvedPanel.add(scroll2, BorderLayout.CENTER);
    166166                        unresolvedAddressesLabel = createHeaderLabel(
    167                                         UNRESOLVED_HEADER_FMT, 
    168                                         tr(UNRESOLVED_ADDRESS), 
     167                                        UNRESOLVED_HEADER_FMT,
     168                                        tr(UNRESOLVED_ADDRESS),
    169169                                        editContainer.getNumberOfUnresolvedAddresses());
    170                        
     170
    171171                        JPanel headerPanel2 = new JPanel(new GridLayout(1, 4));
    172172                        headerPanel2.setMinimumSize(new Dimension(100, 30));
     
    174174                        unresolvedPanel.add(headerPanel2 , BorderLayout.NORTH);
    175175                        unresolvedPanel.setMinimumSize(new Dimension(500, 200));
    176                        
    177                        
     176
     177
    178178                        try {
    179179                                JPanel unresolvedButtons = new JPanel(new GridLayout(2,5, 5, 5));
    180                                 SideButton assign = new SideButton(resolveAction);                                                                                                                         
     180                                SideButton assign = new SideButton(resolveAction);
    181181                                unresolvedButtons.add(assign);
    182                                
    183                                 SideButton guess = new SideButton(guessAddressAction);                                                                                                                     
     182
     183                                SideButton guess = new SideButton(guessAddressAction);
    184184                                unresolvedButtons.add(guess);
    185                                 SideButton applyAllGuesses = new SideButton(applyAllGuessesAction);                                                                                                                       
     185                                SideButton applyAllGuesses = new SideButton(applyAllGuessesAction);
    186186                                unresolvedButtons.add(applyAllGuesses);
    187                                
    188                                 SideButton removeAddressTags = new SideButton(removeAddressTagsAction);                                                                                                                   
     187
     188                                SideButton removeAddressTags = new SideButton(removeAddressTagsAction);
    189189                                unresolvedButtons.add(removeAddressTags);
    190                                
     190
    191191                                unresolvedButtons.add(new JPanel());
    192                                
    193                                 SideButton selectInMap = new SideButton(selectAddressesInMapAction);                                                                                                                       
     192
     193                                SideButton selectInMap = new SideButton(selectAddressesInMapAction);
    194194                                unresolvedButtons.add(selectInMap);
    195195                                headerPanel2.setMinimumSize(new Dimension(100, 70));
    196                                
    197                                 unresolvedPanel.add(unresolvedButtons, BorderLayout.SOUTH);                             
    198                         } catch (Exception e) {                         
     196
     197                                unresolvedPanel.add(unresolvedButtons, BorderLayout.SOUTH);
     198                        } catch (Exception e) {
    199199                                e.printStackTrace();
    200                         }                       
    201                        
     200                        }
     201
    202202                        /* Map Panel */
    203203                        JPanel mapPanel = new JPanel(new BorderLayout());
     
    206206                        mapPanel.setMinimumSize(new Dimension(200, 200));
    207207                        mapViewer.setVisible(false);
    208                        
     208
    209209                        JPanel mapControl = new JPanel(new GridLayout(1, 4));
    210210                        JLabel mapL1 = new JLabel(tr("Complete Addresses"));
    211211                        mapL1.setForeground(Color.BLUE);
    212212                        mapControl.add(mapL1);
    213                        
     213
    214214                        JLabel mapL2 = new JLabel(tr("Incomplete Addresses"));
    215215                        mapL2.setForeground(Color.RED);
    216216                        mapControl.add(mapL2);
    217                        
     217
    218218                        JLabel mapL3 = new JLabel(tr("Selected Addresses"));
    219219                        mapL3.setForeground(Color.ORANGE);
    220220                        mapControl.add(mapL3);
    221                        
     221
    222222                        JLabel mapL4 = new JLabel(tr("Selected Street"));
    223223                        mapL4.setForeground(Color.GREEN);
    224224                        mapControl.add(mapL4);
    225                        
     225
    226226                        mapPanel.add(mapControl, BorderLayout.SOUTH);
    227                                                
     227
    228228                        /* Combine panels */
    229                         JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel);                                           
     229                        JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel);
    230230                        JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, mapPanel);
    231                        
     231
    232232                        this.getContentPane().add(pane, BorderLayout.CENTER);
    233233                        //this.getContentPane().add(mapPanel, BorderLayout.SOUTH);
     
    235235                        this.getContentPane().add(new JLabel(tr("(No data)")), BorderLayout.CENTER);
    236236                }
    237                
     237
    238238                for (int i = 0; i < actions.length; i++) {
    239239                        actions[i].setContainer(addressEditContainer);
    240240                }
    241                
     241
    242242                JPanel buttonPanel = new JPanel(new GridLayout(1,10));
    243243                JButton ok = new JButton(OK_COMMAND, ImageProvider.getIfAvailable(null, "ok"));
     
    245245                JButton selectAndClose = new JButton(SELECT_AND_CLOSE);
    246246                selectAndClose.addActionListener(this);
    247                
     247
    248248                // Murks
    249249                for (int i = 0; i < 8; i++) {
     
    252252
    253253                buttonPanel.add(ok);
    254                
    255                
     254
     255
    256256                this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    257257        }
    258258
    259259        /**
    260          * Creates a header label in the form "title (number)" with bold font. 
     260         * Creates a header label in the form "title (number)" with bold font.
    261261         * @param fmtString The format string having a string and a numeric placeholder.
    262262         * @param title The title of the header.
     
    270270                return label;
    271271        }
    272        
     272
    273273        /**
    274274         * Updates the list headings.
     
    299299        @Override
    300300        public void valueChanged(ListSelectionEvent e) {
    301                
     301
    302302                AddressEditSelectionEvent ev = new AddressEditSelectionEvent(e.getSource(),
    303303                                streetTable, unresolvedTable, null, editContainer);
    304                
     304
    305305                for (AbstractAddressEditAction action : actions) {
    306306                        action.setEvent(ev);
    307307                }
    308                
     308
    309309                clearMapViewer();
    310310                OSMStreet sNode = ev.getSelectedStreet();
    311311                if (sNode != null) {
    312                                                
     312
    313313                        //mapViewer.addMapRectangle(new BBoxMapRectangle(bb));
    314314                        for (IOSMEntity seg : sNode.getChildren()) {
    315315                                Way way = (Way) seg.getOsmObject();
    316316                                //BBox bb = way.getBBox();
    317                                
     317
    318318                                for (Node node : way.getNodes()) {
    319319                                        mapViewer.addMapMarker(new MapMarkerDot(Color.GREEN, node.getCoor().lat(), node.getCoor().lon()));
    320320                                }
    321                         }       
    322                        
     321                        }
     322
    323323                        // show addresses as blue marker
    324324                        if (sNode.hasAddresses()) {
     
    331331                                }
    332332                        }
    333                 } 
    334                
     333                }
     334
    335335                List<OSMAddress> unrAddresses = ev.getSelectedUnresolvedAddresses();
    336336                if (unrAddresses != null) {
    337                         for (OSMAddress aNode : unrAddresses) {                                 
     337                        for (OSMAddress aNode : unrAddresses) {
    338338                                mapViewer.addMapMarker(new MapMarkerDot(Color.ORANGE, aNode.getCoor().lat(), aNode.getCoor().lon()));
    339339                        }
     
    356356        public void containerChanged(AddressEditContainer container) {
    357357                updateHeaders();
    358                
     358
    359359                for (int i = 0; i < actions.length; i++) {
    360360                        actions[i].setEvent(null);
     
    367367                updateHeaders();
    368368        }
    369        
    370         /**
    371          * Special listener to react on selection changes in the incomplete address list. 
     369
     370        /**
     371         * Special listener to react on selection changes in the incomplete address list.
    372372         * It searches the street table for the streets which matches best matching to the
    373373         * street name given in the address.
    374          *   
    375          * @author Oliver Wieland <oliver.wieland@online.de> 
    376          */     
     374         *
     375         * @author Oliver Wieland <oliver.wieland@online.de>
     376         */
    377377        class IncompleteAddressListener implements ListSelectionListener {
    378378
     
    382382                                String streetOfAddr = (String) unresolvedTable.
    383383                                                                                        getModel().getValueAt(unresolvedTable.getSelectedRow(), 0);
    384                                
     384
    385385                                int maxScore = 0, score = 0, row = -1;
    386386                                for (int i = 0; i < streetTable.getRowCount(); i++) {
    387387                                        String streetName = (String) streetTable.getModel().getValueAt(i, 1);
    388                                        
     388
    389389                                        score = StringUtils.lcsLength(streetOfAddr, streetName);
    390390                                        if (score > maxScore) {
    391391                                                maxScore = score;
    392                                                 row = i; 
     392                                                row = i;
    393393                                        }
    394394                                }
    395                                
     395
    396396                                if (row > 0) {
    397397                                        streetTable.getSelectionModel().clearSelection();
     
    399399                                        streetTable.scrollRectToVisible(streetTable.getCellRect(row, 0, true));
    400400                                }
    401                         }                       
    402                 }
    403                
    404         }
    405        
     401                        }
     402                }
     403
     404        }
     405
    406406        /**
    407407         * The listener interface for receiving key events of a table.
     
    416416         */
    417417        class JumpToEntryListener implements KeyListener {
    418                 private int column; 
    419                
     418                private int column;
     419
    420420                /**
    421421                 * Instantiates a new jump-to-entry listener.
     
    430430                public void keyPressed(KeyEvent arg0) {
    431431                        // TODO Auto-generated method stub
    432                        
     432
    433433                }
    434434
     
    436436                public void keyReleased(KeyEvent arg0) {
    437437                        // TODO Auto-generated method stub
    438                        
     438
    439439                }
    440440
     
    442442                public void keyTyped(KeyEvent arg0) {
    443443                        JTable table  = (JTable) arg0.getSource();
    444                        
     444
    445445                        if (table == null) return;
    446                        
     446
    447447                        TableModel model = table.getModel();
    448                        
     448
    449449                        if (model == null || model.getColumnCount() == 0) {
    450450                                return;
     
    452452                        // clip column
    453453                        if (column < 0 || column >= model.getColumnCount()) {
    454                                 column = 0; // use the first column                             
    455                         }
    456                        
     454                                column = 0; // use the first column
     455                        }
     456
    457457                        char firstChar = Character.toLowerCase(arg0.getKeyChar());
    458458
     
    469469                                        }
    470470                                }
    471                         }                       
     471                        }
    472472                }
    473473        }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditModel.java

    r24093 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3333        private DefaultMutableTreeNode unresolvedRoot;
    3434        private DefaultMutableTreeNode incompleteRoot;
    35        
     35
    3636        /**
    3737         * @param streets
     
    4444                this.unresolvedAddresses = unresolvedAddresses;
    4545        }
    46        
     46
    4747        public TreeNode getStreetsTree() {
    4848                if (streets == null) return new DefaultMutableTreeNode(tr("(No data)"));
    49                
     49
    5050                if (streetRoot == null) {
    5151                        streetRoot = new DefaultMutableTreeNode();
    5252                        for (OSMStreet sNode : streets) {
    5353                                DefaultMutableTreeNode treeStreetNode = new DefaultMutableTreeNode(sNode);
    54                                
     54
    5555                                DefaultMutableTreeNode segmentsNode = new DefaultMutableTreeNode(tr("Segments"));
    5656                                treeStreetNode.add(segmentsNode);
    57                                
     57
    5858                                // Add street segment(s)
    5959                                for (IOSMEntity child : sNode.getChildren()) {
    6060                                        segmentsNode.add(new DefaultMutableTreeNode(child));
    6161                                }
    62                                
     62
    6363                                if (sNode.hasAddresses()) {
    6464                                        // Add address nodes
    6565                                        DefaultMutableTreeNode addressNode = new DefaultMutableTreeNode(tr("Addresses"));
    6666                                        treeStreetNode.add(addressNode);
    67                                        
     67
    6868                                        for (OSMAddress addr : sNode.getAddresses()) {
    6969                                                addressNode.add(new DefaultMutableTreeNode(addr));
     
    7676                        }
    7777                }
    78                
     78
    7979                return streetRoot;
    8080        }
    81        
     81
    8282        /**
    8383         * Gets the tree node containing all unresolved addresses.
     
    8989                if (unresolvedRoot == null) {
    9090                        unresolvedRoot = new DefaultMutableTreeNode();
    91                        
     91
    9292                        for (OSMAddress addr : unresolvedAddresses) {
    93                                 // Add address nodes                           
     93                                // Add address nodes
    9494                                unresolvedRoot.add(new DefaultMutableTreeNode(addr));
    9595                        }
    9696                }
    97                
     97
    9898                return unresolvedRoot;
    9999        }
    100        
     100
    101101        /**
    102102         * Gets the tree node containing all incomplete addresses.
     
    108108                if (incompleteRoot == null) {
    109109                        incompleteRoot = new DefaultMutableTreeNode();
    110                        
     110
    111111                        for (OSMAddress addr : incompleteAddresses) {
    112                                 // Add address nodes                           
     112                                // Add address nodes
    113113                                incompleteRoot.add(new DefaultMutableTreeNode(addr));
    114114                        }
    115115                }
    116                
     116
    117117                return incompleteRoot;
    118118        }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditSelectionEvent.java

    r24129 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2626public class AddressEditSelectionEvent extends ActionEvent {
    2727        /**
    28          * 
     28         *
    2929         */
    3030        private static final long serialVersionUID = -93034483427803409L;
     
    3333        private JTable incompleteAddressTable;
    3434        private AddressEditContainer addressContainer;
    35        
     35
    3636        private List<OSMAddress> unresolvedCache;
    3737        private List<OSMAddress> incompleteCache;
    38        
     38
    3939        /**
    4040         * Creates a new 'AddressEditSelectionEvent'.
     
    5252                this.addressContainer = container;
    5353        }
    54        
     54
    5555        /**
    5656         * Gets the street table component.
     
    6868                return unresolvedAddressTable;
    6969        }
    70        
     70
    7171        /**
    7272         * @return the incompleteAddressTable
     
    8484                return addressContainer;
    8585        }
    86        
     86
    8787        /**
    8888         * Gets the selected street of the street table.
     
    9292                if (streetTable != null && addressContainer != null && addressContainer.getStreetList() != null) {
    9393                        int selRows = streetTable.getSelectedRow();
    94                        
     94
    9595                        if (selRows < 0 || selRows >= addressContainer.getNumberOfStreets()) {
    9696                                return null;
    9797                        }
    98                        
     98
    9999                        return addressContainer.getStreetList().get(selRows);
    100100                }
    101101                return null;
    102102        }
    103        
     103
    104104        /**
    105105         * Checks for addresses.
     
    110110                return hasIncompleteAddresses() || hasUnresolvedAddresses();
    111111        }
    112        
     112
    113113        /**
    114114         * Checks for incomplete addresses.
     
    119119                return getSelectedIncompleteAddresses() != null;
    120120        }
    121        
     121
    122122        /**
    123123         * Checks for unresolved addresses.
     
    128128                return getSelectedUnresolvedAddresses() != null;
    129129        }
    130        
     130
    131131        /**
    132132         * Checks for addresses with guesses.
     
    142142                        }
    143143                }
    144                
     144
    145145                if (hasUnresolvedAddresses()) {
    146146                        for (OSMAddress addr : getSelectedUnresolvedAddresses()) {
     
    150150                        }
    151151                }
    152                
     152
    153153                return false;
    154154        }
    155        
     155
    156156        /**
    157157         * Gets the list containing the selected items of the 'unresolved addresses ' table.
     
    159159         */
    160160        public List<OSMAddress> getSelectedUnresolvedAddresses() {
    161                 if (unresolvedAddressTable != null && 
    162                                 addressContainer != null && 
     161                if (unresolvedAddressTable != null &&
     162                                addressContainer != null &&
    163163                                unresolvedCache == null) {
    164                        
     164
    165165                        int[] selRows = unresolvedAddressTable.getSelectedRows();
    166                        
     166
    167167                        unresolvedCache = new ArrayList<OSMAddress>();
    168168                        for (int i = 0; i < selRows.length; i++) {
     
    176176                }
    177177        }
    178        
     178
    179179        /**
    180180         * Gets the selected incomplete addresses.
     
    183183         */
    184184        public List<OSMAddress> getSelectedIncompleteAddresses() {
    185                 if (incompleteAddressTable != null && 
    186                                 addressContainer != null && 
     185                if (incompleteAddressTable != null &&
     186                                addressContainer != null &&
    187187                                incompleteCache == null) {
    188                        
     188
    189189                        int[] selRows = incompleteAddressTable.getSelectedRows();
    190                        
     190
    191191                        incompleteCache = new ArrayList<OSMAddress>();
    192192                        for (int i = 0; i < selRows.length; i++) {
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditTableModel.java

    r24174 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3131public abstract class AddressEditTableModel extends DefaultTableModel implements
    3232                IAddressEditContainerListener {
    33        
     33
    3434        protected AddressEditContainer addressContainer;
    3535        protected int sortCol = 0;
     
    5858         * Gets the node entity for the given row or null; if row contains no
    5959         * entity.
    60          * 
     60         *
    6161         * @param row
    6262         *            The row to get the entity object for.
     
    6868         * Gets the row for the given node entity or -1; if the model does not
    6969         * contain the entity.
    70          * 
     70         *
    7171         * @param entity
    7272         *            The entity to get the row for.
     
    7777        /**
    7878         * Sorts the model data by the given column.
    79          * 
     79         *
    8080         * @param column
    8181         *            the column
     
    8585        protected abstract void sortByColumn(int column, boolean ascending);
    8686
    87        
     87
    8888        /**
    8989         * The listener interface for receiving column events.
     
    135135
    136136                        //Collections.sort(addressContainer, new MyComparator(isSortAsc));
    137                        
     137
    138138                        sortByColumn(sortCol, isSortAsc);
    139139                        table.tableChanged(new TableModelEvent(AddressEditTableModel.this));
     
    141141                }
    142142        }
    143        
     143
    144144        /**
    145145         * Internal base class to sort items by different columns.
     
    148148                private int column;
    149149                private boolean ascending;
    150                
     150
    151151                /**
    152152                 * Instantiates a new address sorter.
     
    159159                        this.ascending = ascending;
    160160                }
    161                
     161
    162162                /**
    163163                 * Gets the index of the column to sort.
     
    168168                        return column;
    169169                }
    170                                
     170
    171171                /**
    172172                 * Checks if sort mode is ascending or not.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/BBoxMapRectangle.java

    r23931 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2323public class BBoxMapRectangle implements MapRectangle {
    2424        private BBox bbox;
    25        
     25
    2626        /**
    2727         * @param bbox
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesDialog.java

    r24942 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    5959        private ApplyAllGuessesAction applyGuessesAction = new ApplyAllGuessesAction();
    6060        private RemoveAddressTagsAction removeTagsAction = new RemoveAddressTagsAction();
    61        
     61
    6262        // Array containing the available actions
    6363        private AbstractAddressEditAction[] actions = new AbstractAddressEditAction[]{
     
    7070
    7171        private JTable incompleteAddr;
    72        
     72
    7373        /**
    7474         * Instantiates a new "incomplete addresses" dialog.
     
    7777        public IncompleteAddressesDialog() {
    7878                super(FIXED_DIALOG_TITLE, "incompleteaddress_24", tr("Show incomplete addresses"), null, 150);
    79                
     79
    8080                this.container = new AddressEditContainer();
    8181                container.addChangedListener(this);
     
    8585                IncompleteAddressesTableModel model = new IncompleteAddressesTableModel(container);
    8686                incompleteAddr = new JTable(model);
    87             JTableHeader header = incompleteAddr.getTableHeader();
     87                JTableHeader header = incompleteAddr.getTableHeader();
    8888                header.addMouseListener(model.new ColumnListener(incompleteAddr));
    8989                incompleteAddr.getSelectionModel().addListSelectionListener(this);
    90                
     90
    9191                // Scroll pane hosting the table
    9292                JScrollPane sp = new JScrollPane(incompleteAddr);
    9393                p.add(sp, BorderLayout.CENTER);
    9494                this.add(p);
    95                
     95
    9696                // Button panel containing the commands
    9797                JPanel buttonPanel = getButtonPanel(actions.length);
    98                
     98
    9999                // Populate panel with actions
    100100                for (int i = 0; i < actions.length; i++) {
     
    102102                        buttonPanel.add(sb);
    103103                }
    104                
     104
    105105                this.add(buttonPanel, BorderLayout.SOUTH);
    106                
     106
    107107                // Link actions with address container
    108108                for (AbstractAddressEditAction action : actions) {
     
    110110                }
    111111        }
    112        
     112
    113113        /* (non-Javadoc)
    114114         * @see org.openstreetmap.josm.gui.dialogs.ToggleDialog#hideNotify()
     
    133133         */
    134134        @Override
    135         public void dataChanged(DataChangedEvent event) {               
     135        public void dataChanged(DataChangedEvent event) {
    136136                container.invalidate();
    137137        }
     
    142142        @Override
    143143        public void nodeMoved(NodeMovedEvent event) {
    144                
     144
    145145        }
    146146
     
    151151        public void otherDatasetChange(AbstractDatasetChangedEvent event) {
    152152                // TODO Auto-generated method stub
    153                
     153
    154154        }
    155155
     
    160160        public void primtivesAdded(PrimitivesAddedEvent event) {
    161161                container.invalidate();
    162                
     162
    163163        }
    164164
     
    168168        @Override
    169169        public void primtivesRemoved(PrimitivesRemovedEvent event) {
    170                 container.invalidate();         
     170                container.invalidate();
    171171        }
    172172
     
    176176        @Override
    177177        public void relationMembersChanged(RelationMembersChangedEvent event) {
    178                 container.invalidate();         
     178                container.invalidate();
    179179        }
    180180
     
    185185        public void tagsChanged(TagsChangedEvent event) {
    186186                container.invalidate();
    187                
     187
    188188        }
    189189
     
    193193        @Override
    194194        public void wayNodesChanged(WayNodesChangedEvent event) {
    195                 container.invalidate();         
     195                container.invalidate();
    196196        }
    197197
     
    202202        public void valueChanged(ListSelectionEvent e) {
    203203                AddressEditSelectionEvent event = new AddressEditSelectionEvent(e, null, null, incompleteAddr, container);
    204                
     204
    205205                for (AbstractAddressEditAction action : actions) {
    206206                        action.setEvent(event);
    207                 }       
    208                
     207                }
     208
    209209                OsmUtils.zoomAddresses(event.getSelectedIncompleteAddresses());
    210210        }
     
    218218                        setTitle(String.format("%s (%d %s)", FIXED_DIALOG_TITLE, container.getNumberOfIncompleteAddresses(), tr("items")));
    219219                } else {
    220                         setTitle(String.format("%s (%s)", FIXED_DIALOG_TITLE, tr("no items")));                 
     220                        setTitle(String.format("%s (%s)", FIXED_DIALOG_TITLE, tr("no items")));
    221221                }
    222222        }
     
    228228        public void entityChanged(IOSMEntity node) {
    229229                // TODO Auto-generated method stub
    230                
     230
    231231        }
    232232}
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesTableModel.java

    r24942 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2424public class IncompleteAddressesTableModel extends AddressEditTableModel  {
    2525        /**
    26          * 
     26         *
    2727         */
    2828        private static final long serialVersionUID = -5951629033395186324L;
    29        
     29
    3030        // TODO: Add "state" column, if required
    3131        private static final int NUMBER_OF_COLUMNS = 5;
    32         private static final String[] COLUMN_NAMES = new String[]{tr("Country"), tr("City"), tr("Postcode"), tr("Street"), tr("Number")}; 
     32        private static final String[] COLUMN_NAMES = new String[]{tr("Country"), tr("City"), tr("Postcode"), tr("Street"), tr("Number")};
    3333        private static final Class<?>[] COLUMN_CLASSES = new Class<?>[]{
    3434                String.class, String.class, String.class, String.class, String.class, String.class};
    35        
    36        
     35
     36
    3737        /**
    3838         * Instantiates a new incomplete addresses table model.
     
    7575         */
    7676        @Override
    77         public Object getValueAt(int row, int column) {         
     77        public Object getValueAt(int row, int column) {
    7878                OSMAddress aNode = (OSMAddress) getEntityOfRow(row);
    79                
     79
    8080                if (aNode == null) {
    8181                        return null;
    8282                }
    83                
     83
    8484                switch (column) {
    8585                case 0:
     
    9090                        return aNode.getPostalCode();
    9191                case 3:
    92                         return aNode.getStreetName();                   
     92                        return aNode.getStreetName();
    9393                case 4:
    9494                        return aNode.getHouseNumber();
     
    9696                        throw new RuntimeException("Invalid column index: " + column);
    9797                }
    98                
    99         }
    100        
     98
     99        }
     100
    101101        /* (non-Javadoc)
    102102         * @see javax.swing.table.AbstractTableModel#getColumnClass(int)
     
    137137                        return -1;
    138138                }
    139                
     139
    140140                return addressContainer.getIncompleteAddresses().indexOf(entity);
    141141        }
    142        
     142
    143143
    144144        /* (non-Javadoc)
     
    148148        protected void sortByColumn(int column, boolean ascending) {
    149149                if (addressContainer.getNumberOfIncompleteAddresses() == 0) return;
    150                
    151                 Collections.sort(addressContainer.getIncompleteAddresses(), 
     150
     151                Collections.sort(addressContainer.getIncompleteAddresses(),
    152152                                new IncompleteAddressModelSorter(column, ascending));
    153153        }
    154        
     154
    155155        /**
    156156         * Internal class StreetModelSorter.
     
    174174                public int compare(OSMAddress arg0, OSMAddress arg1) {
    175175                        int cc = 0;
    176                        
     176
    177177                        switch (getColumn()) {
    178                         case 0:                                                         
     178                        case 0:
    179179                                cc=arg0.getCountry().compareTo(arg1.getCountry());
    180180                                break;
     
    193193                        default:
    194194                                throw new RuntimeException("Invalid column index: " + getColumn());
    195                         }               
    196                        
     195                        }
     196
    197197                        if (!isAscending()) {
    198198                                cc = -cc;
    199199                        }
    200                        
     200
    201201                        return cc;
    202202                }
    203203        }
    204        
    205        
     204
     205
    206206}
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/StreetTableModel.java

    r24174 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2525public class StreetTableModel extends AddressEditTableModel {
    2626        private static final int NUMBER_OF_COLUMNS = 3;
    27         private static final String[] COLUMN_NAMES = new String[]{tr("Type"), tr("Name"), tr("Addresses")}; 
     27        private static final String[] COLUMN_NAMES = new String[]{tr("Type"), tr("Name"), tr("Addresses")};
    2828        private static final Class<?>[] COLUMN_CLASSES = new Class<?>[]{String.class, String.class, Integer.class};
    2929        /**
     
    5050                return COLUMN_NAMES[column];
    5151        }
    52        
     52
    5353        /* (non-Javadoc)
    5454         * @see javax.swing.table.AbstractTableModel#getColumnClass(int)
     
    7474         */
    7575        @Override
    76         public Object getValueAt(int row, int column) {         
     76        public Object getValueAt(int row, int column) {
    7777                OSMStreet sNode = (OSMStreet) getEntityOfRow(row);
    78                
     78
    7979                if (sNode == null) {
    8080                        return null;
    8181                }
    82                
     82
    8383                switch (column) {
    8484                case 0:
     
    9595                        throw new RuntimeException("Invalid column index: " + column);
    9696                }
    97                
     97
    9898        }
    9999
     
    112112                        return null;
    113113                }
    114                 return addressContainer.getStreetList().get(row);       
     114                return addressContainer.getStreetList().get(row);
    115115        }
    116        
     116
    117117        @Override
    118118        public int getRowOfEntity(IOSMEntity entity) {
     
    120120                        return -1;
    121121                }
    122                
     122
    123123                return addressContainer.getStreetList().indexOf(entity);
    124124        }
     
    131131                Collections.sort(addressContainer.getStreetList(), new StreetModelSorter(column, ascending));
    132132        }
    133        
     133
    134134        /**
    135135         * Internal class StreetModelSorter.
     
    143143                public int compare(OSMStreet arg0, OSMStreet arg1) {
    144144                        if (arg0 == null || arg1 == null) return 0;
    145                        
     145
    146146                        switch (getColumn()) {
    147147                        case 0:
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/UnresolvedAddressesTableModel.java

    r24227 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
    1414/**
    15  * This program is free software: you can redistribute it and/or modify it under 
    16  * the terms of the GNU General Public License as published by the 
    17  * Free Software Foundation, either version 3 of the License, or 
    18  * (at your option) any later version. 
    19  * 
    20  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    21  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    22  * See the GNU General Public License for more details. 
    23  * 
    24  * You should have received a copy of the GNU General Public License along with this program. 
     15 * This program is free software: you can redistribute it and/or modify it under
     16 * the terms of the GNU General Public License as published by the
     17 * Free Software Foundation, either version 3 of the License, or
     18 * (at your option) any later version.
     19 *
     20 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     21 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     22 * See the GNU General Public License for more details.
     23 *
     24 * You should have received a copy of the GNU General Public License along with this program.
    2525 * If not, see <http://www.gnu.org/licenses/>.
    2626 */
     
    3939/**
    4040 * Provides a table model to show unresolved addresses.
    41  * 
     41 *
    4242 * @author Oliver Wieland <oliver.wieland@online.de>
    43  * 
     43 *
    4444 */
    4545
     
    5555
    5656        /**
    57          * 
     57         *
    5858         */
    5959        private static final long serialVersionUID = 424009321818130586L;
     
    6868        /*
    6969         * (non-Javadoc)
    70          * 
     70         *
    7171         * @see javax.swing.table.DefaultTableModel#getColumnCount()
    7272         */
     
    7878        /*
    7979         * (non-Javadoc)
    80          * 
     80         *
    8181         * @see javax.swing.table.DefaultTableModel#getColumnName(int)
    8282         */
     
    8888        /*
    8989         * (non-Javadoc)
    90          * 
     90         *
    9191         * @see javax.swing.table.DefaultTableModel#getRowCount()
    9292         */
     
    102102        /*
    103103         * (non-Javadoc)
    104          * 
     104         *
    105105         * @see javax.swing.table.DefaultTableModel#getValueAt(int, int)
    106106         */
     
    132132        /*
    133133         * (non-Javadoc)
    134          * 
     134         *
    135135         * @see javax.swing.table.AbstractTableModel#getColumnClass(int)
    136136         */
     
    142142        /*
    143143         * (non-Javadoc)
    144          * 
     144         *
    145145         * @see javax.swing.table.DefaultTableModel#isCellEditable(int, int)
    146146         */
     
    152152        /*
    153153         * (non-Javadoc)
    154          * 
     154         *
    155155         * @see
    156156         * org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel
     
    181181        /*
    182182         * (non-Javadoc)
    183          * 
     183         *
    184184         * @see
    185185         * org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel
     
    206206                /*
    207207                 * (non-Javadoc)
    208                  * 
     208                 *
    209209                 * @see
    210210                 * org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/AbstractAddressEditAction.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3737 * Most actions will work in both cases, so it is recommended to have one single method which
    3838 * accepts a list of addresses or streets and executes the tasks to be done by this action.
    39  * 
     39 *
    4040 * @author Oliver Wieland <oliver.wieland@online.de>
    4141 */
    4242
    4343@SuppressWarnings("serial")
    44 public abstract class AbstractAddressEditAction extends JosmAction implements IAddressEditContainerListener, ICommandListener { 
     44public abstract class AbstractAddressEditAction extends JosmAction implements IAddressEditContainerListener, ICommandListener {
    4545        private AddressEditSelectionEvent event;
    4646        protected AddressEditContainer container;
     
    5454        public AbstractAddressEditAction(String name, String iconName, String tooltip) {
    5555                super(name, iconName, tooltip, null, true);
    56                
     56
    5757                setEnabled(false);
    5858        }
     
    6464                this(name, null, "");
    6565        }
    66        
     66
    6767        /**
    6868         * Gets the current address container.
     
    101101                updateEnabledState();
    102102        }
    103        
     103
    104104        /* (non-Javadoc)
    105105         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     
    108108        public void actionPerformed(ActionEvent arg0) {
    109109                if (event != null) { // use the event acquired previously.
    110                         addressEditActionPerformed(event);     
     110                        addressEditActionPerformed(event);
    111111                        event = null; // consume event
    112112                } else {
    113113                        if (container != null) {
    114114                                addressEditActionPerformed(container);
    115                         } else { 
     115                        } else {
    116116                                throw new RuntimeException("AbstractAddressEditAction has no container or event");
    117117                        }
     
    141141         */
    142142        protected abstract void updateEnabledState(AddressEditContainer container);
    143        
     143
    144144        /**
    145145         * Updates 'enabled' state depending on the current selection.
     
    154154         */
    155155        public abstract void addressEditActionPerformed(AddressEditSelectionEvent ev);
    156        
     156
    157157        /**
    158158         * Redirected action handler for doing actions on an address container.
     
    160160         */
    161161        public abstract void addressEditActionPerformed(AddressEditContainer container);
    162        
    163        
     162
     163
    164164        /* (non-Javadoc)
    165165         * @see org.openstreetmap.josm.plugins.fixAddresses.IAddressEditContainerListener#containerChanged(org.openstreetmap.josm.plugins.fixAddresses.AddressEditContainer)
     
    176176        public void entityChanged(IOSMEntity node) {
    177177                container.removeProblemsOfSource(node); // clear problems of changed node...
    178                 node.visit(container, container);                                       // .. and revisit it.
    179                 updateEnabledState();           
    180         }
    181        
     178                node.visit(container, container);                   // .. and revisit it.
     179                updateEnabledState();
     180        }
     181
    182182        /**
    183183         * Begins the transaction (command sequence). Must be called by every subclass before
     
    190190                        throw new RuntimeException("TX has not been closed (missing finishTransaction?)");
    191191                }
    192                
     192
    193193                commands = new ArrayList<Command>();
    194194                if (StringUtils.isNullOrEmpty(txName)) {
     
    197197                this.txName = txName;
    198198        }
    199        
     199
    200200        /**
    201201         * Finishes the transaction and passes the command sequence to the framework.
     
    210210                container.invalidate();
    211211        }
    212        
     212
    213213        /**
    214214         * Begins the transaction for a single object.
     
    223223                }
    224224        }
    225        
     225
    226226        /**
    227227         * Finishes the transaction for a single object.
     
    236236                }
    237237        }
    238        
     238
    239239        /* (non-Javadoc)
    240240         * @see org.openstreetmap.josm.plugins.fixAddresses.ICommandListener#commandIssued(org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity, org.openstreetmap.josm.command.Command)
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/ApplyAllGuessesAction.java

    r24982 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3232
    3333/**
    34  * Applies the guessed values for a set of addresses. 
     34 * Applies the guessed values for a set of addresses.
    3535 * @author Oliver Wieland <oliver.wieland@online.de>
    36  * 
     36 *
    3737 */
    3838
     
    4343         * Instantiates a new "apply all guesses" action.
    4444         */
    45         public ApplyAllGuessesAction(String tag) {     
     45        public ApplyAllGuessesAction(String tag) {
    4646                super(tr("Apply"), "applyguesses_24", tr("Turns all guesses into the corresponding tag values."));
    4747                this.tag = tag;
    4848        }
    49        
     49
    5050        /**
    5151         * Instantiates a new "apply all guesses" action.
    5252         */
    53         public ApplyAllGuessesAction() {       
     53        public ApplyAllGuessesAction() {
    5454                this(null);
    5555        }
     
    6161        public void addressEditActionPerformed(AddressEditSelectionEvent ev) {
    6262                if (ev == null) return;
    63                
     63
    6464                if (ev.getSelectedUnresolvedAddresses() != null) {
    6565                        List<OSMAddress> addrToFix = ev.getSelectedUnresolvedAddresses();
    6666                        applyGuesses(addrToFix);
    6767                }
    68                
     68
    6969                if (ev.getSelectedIncompleteAddresses() != null) {
    7070                        List<OSMAddress> addrToFix = ev.getSelectedIncompleteAddresses();
     
    9191                for (OSMAddress aNode : addrToFixShadow) {
    9292                        beginObjectTransaction(aNode);
    93                        
     93
    9494                        if (StringUtils.isNullOrEmpty(tag)) { // tag given?
    9595                                aNode.applyAllGuesses(); // no -> apply all guesses
     
    116116        public void addressEditActionPerformed(AddressEditContainer container) {
    117117                if (container == null || container.getNumberOfIncompleteAddresses() == 0) return;
    118                
     118
    119119                List<OSMAddress> addrToFix = container.getUnresolvedAddresses();
    120                 applyGuesses(addrToFix);               
    121                
     120                applyGuesses(addrToFix);
     121
    122122                addrToFix = container.getIncompleteAddresses();
    123123                applyGuesses(addrToFix);
     
    131131                JTable table = (JTable)e.getSource();
    132132                Point p = e.getPoint();
    133                 if(e.getClickCount() == 2) {                                           
     133                if(e.getClickCount() == 2) {
    134134                        AddressEditTableModel model = (AddressEditTableModel) table.getModel();
    135135                        if (model != null) {
     
    140140                                        beginObjectTransaction(node);
    141141                                        OSMAddress aNode = (OSMAddress) node;
    142                                                                                
     142
    143143                                        aNode.applyAllGuesses();
    144                                        
     144
    145145                                        finishObjectTransaction(node);
    146146                                        finishTransaction();
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/AssignAddressToStreetAction.java

    r24165 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2222
    2323/**
    24  * Assigns one or more selected addresses to a street, i. e. the name of the street is 
    25  * used as value for the addr:street tag. 
     24 * Assigns one or more selected addresses to a street, i. e. the name of the street is
     25 * used as value for the addr:street tag.
    2626 * @author Oliver Wieland <oliver.wieland@online.de>
    27  * 
     27 *
    2828 */
    2929public class AssignAddressToStreetAction extends AbstractAddressEditAction  {
     
    3333         */
    3434        public AssignAddressToStreetAction() {
    35                 super(tr("Assign address to street"), "assignstreet_24", 
     35                super(tr("Assign address to street"), "assignstreet_24",
    3636                                tr("Assign the selected address(es) to the selected street."));
    3737        }
    3838
    3939        /**
    40          * 
     40         *
    4141         */
    4242        private static final long serialVersionUID = -6180491357232121384L;
     
    4646         */
    4747        @Override
    48         public void addressEditActionPerformed(AddressEditSelectionEvent ev) {         
     48        public void addressEditActionPerformed(AddressEditSelectionEvent ev) {
    4949                OSMStreet streetNode = ev.getSelectedStreet();
    50                                                
     50
    5151                if (streetNode != null && ev.getSelectedUnresolvedAddresses() != null) {
    5252                        beginTransaction(tr("Set street name") + " '" + streetNode.getName() + "'");
     
    5858                        finishTransaction();
    5959                }
    60                
     60
    6161        }
    6262
     
    7777        @Override
    7878        public void addressEditActionPerformed(AddressEditContainer container) {
    79                 // we only accept a selection: nothing to do here               
     79                // we only accept a selection: nothing to do here
    8080        }
    8181
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/ConvertAllToRelationAction.java

    r24165 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2323public class ConvertAllToRelationAction extends ConvertToRelationAction {
    2424        public ConvertAllToRelationAction() {
    25                 super(tr("Convert ALL streets."), "convert2rel_24", 
     25                super(tr("Convert ALL streets."), "convert2rel_24",
    2626                                tr("Create relation between street and related addresses for ALL streets in the current layer."));
    2727        }
    28        
     28
    2929        @Override
    3030        public void addressEditActionPerformed(AddressEditSelectionEvent ev) {
     
    5050                setEnabled(hasStreetsToConvert());
    5151        }
    52        
     52
    5353        /**
    5454         * Checks for streets to convert to a relation.
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/ConvertToRelationAction.java

    r24165 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    3030
    3131        public ConvertToRelationAction() {
    32                 super(tr("Convert to relation."), "convert2rel_24", 
     32                super(tr("Convert to relation."), "convert2rel_24",
    3333                                tr("Create relation between street and related addresses."));
    3434        }
    35        
     35
    3636        /**
    3737         * Instantiates a new convert to relation action.
     
    4242         */
    4343        public ConvertToRelationAction(String name, String iconName, String tooltip) {
    44                 super(name, iconName, tooltip);         
     44                super(name, iconName, tooltip);
    4545        }
    4646
     
    5151        public void addressEditActionPerformed(AddressEditSelectionEvent ev) {
    5252                OSMStreet streetNode = ev.getSelectedStreet();
    53                
     53
    5454                if (streetNode != null) {
    5555                        createRelationForStreet(streetNode);
     
    6565        protected void createRelationForStreet(OSMStreet streetNode) {
    6666                if (streetNode == null || !streetNode.hasAddresses()) return;
    67                
     67
    6868                beginTransaction(tr("Create address relation for ") + " '" + streetNode.getName() + "'");
    6969                // Create the relation
     
    7474                // add street with role 'street'
    7575                r.addMember(new RelationMember(TagUtils.STREET_RELATION_ROLE, streetNode.getOsmObject()));
    76                
     76
    7777                // add address members
    7878                for (OSMAddress addrNode : streetNode.getAddresses()) {
    79                         beginObjectTransaction(addrNode);                               
     79                        beginObjectTransaction(addrNode);
    8080                        r.addMember(new RelationMember(TagUtils.HOUSE_RELATION_ROLE, addrNode.getOsmObject()));
    8181                        addrNode.setStreetName(null); // remove street name
     
    107107        protected void updateEnabledState(AddressEditSelectionEvent event) {
    108108                if (event == null) return;
    109                
     109
    110110                OSMStreet street = event.getSelectedStreet();
    111111                setEnabled(street != null && street.hasAddresses() && !street.hasAssociatedStreetRelation());
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/GuessAddressDataAction.java

    r24231 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2828 * Guesses address tags by picking the closest street node with a name. The same is done
    2929 * with city, post code, state,... However, I strongly encourage you to check the result.
    30  * 
     30 *
    3131 * @author Oliver Wieland <oliver.wieland@online.de>
    3232 */
     
    6464        public void addressEditActionPerformed(AddressEditContainer container) {
    6565                if (container == null || container.getNumberOfInvalidAddresses() == 0) return;
    66                                                
     66
    6767                internalGuessAddresses(container.getAllAddressesToFix());
    6868        }
     
    7474        public void addressEditActionPerformed(AddressEditSelectionEvent ev) {
    7575                if (ev == null || !ev.hasAddresses()) return;
    76                
    77                 // guess tags for selected addresses only                               
     76
     77                // guess tags for selected addresses only
    7878                internalGuessAddresses(ev.getSelectedIncompleteAddresses());
    7979                internalGuessAddresses(ev.getSelectedUnresolvedAddresses());
    8080        }
    81        
     81
    8282        /**
    8383         * Internal method to start several threads guessing tag values for the given list of addresses.
     
    8686        private void internalGuessAddresses(List<OSMAddress> nodes) {
    8787                if (nodes == null) return;
    88                
     88
    8989                // Launch address guessing thread
    9090                GuessAddressRunnable aft = new GuessAddressRunnable(nodes, tr("Guessing address values"));
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/RemoveAddressTagsAction.java

    r24231 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    4343                                aNode.removeAllAddressTags();
    4444                                finishObjectTransaction(aNode);
    45                         }                                       
     45                        }
    4646                }
    4747                finishTransaction();
     
    6363                        setEnabled(false);
    6464                }
    65                
     65
    6666                setEnabled(event.hasAddresses());
    6767        }
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/SelectAddressesInMapAction.java

    r24210 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
    1414/**
    15  * This program is free software: you can redistribute it and/or modify it under 
    16  * the terms of the GNU General Public License as published by the 
    17  * Free Software Foundation, either version 3 of the License, or 
    18  * (at your option) any later version. 
    19  * 
    20  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    21  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    22  * See the GNU General Public License for more details. 
    23  * 
    24  * You should have received a copy of the GNU General Public License along with this program. 
     15 * This program is free software: you can redistribute it and/or modify it under
     16 * the terms of the GNU General Public License as published by the
     17 * Free Software Foundation, either version 3 of the License, or
     18 * (at your option) any later version.
     19 *
     20 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     21 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     22 * See the GNU General Public License for more details.
     23 *
     24 * You should have received a copy of the GNU General Public License along with this program.
    2525 * If not, see <http://www.gnu.org/licenses/>.
    2626 */
     
    4343 *
    4444 * @author Oliver Wieland <oliver.wieland@online.de>
    45  * 
     45 *
    4646 */
    4747
     
    6262        public void addressEditActionPerformed(AddressEditSelectionEvent ev) {
    6363                if (ev == null) return;
    64                
     64
    6565                if (ev.hasUnresolvedAddresses()) {
    6666                        internalSelectAddresses(ev.getSelectedUnresolvedAddresses());
     
    7272        @Override
    7373        public void addressEditActionPerformed(AddressEditContainer container) {
    74                 // do nothing           
     74                // do nothing
    7575        }
    7676
     
    9292
    9393        /**
    94          * Internal helper to select the given addresses in the map. 
     94         * Internal helper to select the given addresses in the map.
    9595         * @param addrToSel
    9696         */
    9797        private void internalSelectAddresses(List<OSMAddress> addrToSel) {
    9898                if (addrToSel == null) return;
    99                
     99
    100100                List<OsmPrimitive> sel = new ArrayList<OsmPrimitive>();
    101                
     101
    102102                getCurrentDataSet().clearSelection();
    103103                for (OSMAddress aNode : addrToSel) {
    104104                        sel.add(aNode.getOsmObject());
    105                        
     105
    106106                        // Select also guessed objects, if wished
    107107                        if (FixAddressesPlugin.getPreferences().isSelectGuessedObjects()) {
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/SelectIncompleteAddressesAction.java

    r24977 r25373  
    11/*
    2  * This program is free software: you can redistribute it and/or modify it under 
    3  * the terms of the GNU General Public License as published by the 
    4  * Free Software Foundation, either version 3 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
    8  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    9  * See the GNU General Public License for more details. 
    10  * 
    11  * You should have received a copy of the GNU General Public License along with this program. 
     2 * This program is free software: you can redistribute it and/or modify it under
     3 * the terms of the GNU General Public License as published by the
     4 * Free Software Foundation, either version 3 of the License, or
     5 * (at your option) any later version.
     6 *
     7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
     8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9 * See the GNU General Public License for more details.
     10 *
     11 * You should have received a copy of the GNU General Public License along with this program.
    1212 * If not, see <http://www.gnu.org/licenses/>.
    1313 */
     
    2828public class SelectIncompleteAddressesAction extends JosmAction {
    2929
    30        
     30
    3131        private AddressEditContainer addressEditContainer;
    32        
     32
    3333        public SelectIncompleteAddressesAction() {
    3434                super(tr("Select incomplete addresses"), "select_invaddr_24",
    35                                 tr("Selects all addresses with incomplete data."), null, false);       
     35                                tr("Selects all addresses with incomplete data."), null, false);
    3636        }
    3737
     
    4040                addressEditContainer = new AddressEditContainer();
    4141                addressEditContainer.invalidate();
    42                
     42
    4343                if (addressEditContainer.getIncompleteAddresses() != null) {
    4444                        List<OsmPrimitive> osms = new ArrayList<OsmPrimitive>();
    45                        
     45
    4646                        for (OSMAddress aNode : addressEditContainer.getIncompleteAddresses()) {
    4747                                osms.add(aNode.getOsmObject());
Note: See TracChangeset for help on using the changeset viewer.