Ignore:
Timestamp:
2009-06-04T01:45:05+02:00 (16 years ago)
Author:
rcernoch
Message:

CzechAddress: cleanup and documentation

Location:
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress
Files:
3 deleted
25 edited
3 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/MapUtils.java

    r15166 r15585  
    2020public abstract class MapUtils {
    2121
    22     static final double NODE_ZOOM_LEVEL = 0.00000007;
     22    /**
     23     * Zoom level used for zooming to a single node.
     24     */
     25    public static final double NODE_ZOOM_LEVEL = 0.00000007;
    2326
    2427
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/NotNullList.java

    r15166 r15585  
    3131    }
    3232
     33    /**
     34     * Checks each item and if it isn't {@code null}, it is added.
     35     */
    3336    @Override
    3437    public boolean addAll(Collection<? extends E> c) {
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/PrimUtils.java

    r15584 r15585  
    2727         KEY_ADDR_STREET, KEY_ADDR_CO, KEY_ADDR_CP };
    2828
     29    /**
     30     * Comparator for {@link OsmPrimitive}, which looks at 'addr:*' tags.
     31     */
    2932    public static final Comparator<OsmPrimitive> comparator =
    3033        new Comparator<OsmPrimitive>() {
    31 
    3234        public int compare(OsmPrimitive o1, OsmPrimitive o2) {
    3335
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StatusListener.java

    r15558 r15585  
    33import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement;
    44import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Database;
    5 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
    65
    76/**
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/ManagerAction.java

    r15582 r15585  
    88
    99/**
     10 * Shows the manager window for editing the database.
    1011 *
    1112 * @author Radomír Černoch, radomir.cernoch@gmail.com
     13 *
     14 * @see ManagerDialog
    1215 */
    1316public class ManagerAction extends JosmAction {
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java

    r15584 r15585  
    1313 * The most general element of the houses and streets database.
    1414 *
    15  * <p>Every element must hav a name and may have a parent element.</p>
     15 * <p>Every element must have a <i>name</i> and may have a <i>parent</i>.</p>
    1616 *
    1717 * @author Radomír Černoch radomir.cernoch@gmail.com
     
    193193    }
    194194
     195    /**
     196     * Does the same as {@code matchField()}, but allows the string to contain
     197     * abbreviations.
     198     *
     199     * <p>For detailed description see {@code matchField()}.</p>
     200     */
    195201    public static int matchFieldAbbrev(String elemValue, String primValue) {
    196202
     
    212218    }
    213219
     220    /**
     221     * Makes the given primitive have the same key-values as the current element.
     222     */
    214223    public List<Proposal> getDiff(OsmPrimitive prim) {
    215224        return null;
    216225    }
    217226
     227    /**
     228     * Returns the "quality" of a element-primitive match.
     229     *
     230     * <p>Returns a value from {@link Reasoner}{@code .MATCH_*}, which
     231     * describes how well does the given primitive match to this element.</p>
     232     */
    218233    public int getQ(OsmPrimitive primitive) {
    219234       
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Database.java

    r15558 r15585  
    22
    33import java.util.ArrayList;
     4import org.openstreetmap.josm.plugins.czechaddress.parser.DatabaseParser;
    45
    56/**
    6  * Stores the whole database of all regions, municipalities, suburbs, streets
    7  * and houses in the Czech republic. The database can be feeded via
    8  * XML and is capable of downloading it from www.mvcr.cz
     7 * Stores the whole database.
     8 *
     9 * <p>Contains the tree of all regions, municipalities, suburbs, streets
     10 * and houses in the Czech republic.</p>
    911 *
    1012 * @see AddressElement
    1113 * @see DatabaseParser
    1214
    13  * @author Radomir Cernoch radomir.cernoch@gmail.com
     15 * @author Radomír Černoch radomir.cernoch@gmail.com
    1416 */
    1517public class Database {
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithStreets.java

    r15582 r15585  
    1 /*
    2  * To change this template, choose Tools | Templates
    3  * and open the template in the editor.
    4  */
    5 
    61package org.openstreetmap.josm.plugins.czechaddress.addressdatabase;
    72
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java

    r15582 r15585  
    200200    }
    201201
     202    /**
     203     * Determies whether the given primitive can be matched to a House.
     204     */
    202205    public static boolean isMatchable(OsmPrimitive prim) {
    203206        for (String key : prim.keySet())
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ParentResolver.java

    r15582 r15585  
    1 /*
    2  * To change this template, choose Tools | Templates
    3  * and open the template in the editor.
    4  */
    5 
    61package org.openstreetmap.josm.plugins.czechaddress.addressdatabase;
    72
    83/**
     4 * Disassemles the <i>parent</i>-><i>parent</i>... branch of an AddressElement.
    95 *
    106 * @author Radomír Černoch, radomir.cernoch@gmail.com
     
    4036    }
    4137
     38    /**
     39     * Returns the value for the 'is_in=*' tag.
     40     */
    4241    public String getIsIn() {
    4342        String result = "";
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Region.java

    r15582 r15585  
    22
    33import java.util.ArrayList;
    4 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    54
    65/**
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ConflictResolver.java

    r15582 r15585  
    11package org.openstreetmap.josm.plugins.czechaddress.gui;
    22
    3 import java.awt.Component;
    4 import java.awt.Font;
    53import java.util.ArrayList;
    64import java.util.Collections;
     
    1210import javax.swing.ComboBoxModel;
    1311import javax.swing.DefaultComboBoxModel;
    14 import javax.swing.JList;
    1512import javax.swing.event.ListDataListener;
    1613import javax.swing.Icon;
     
    2421import org.openstreetmap.josm.plugins.czechaddress.PrimUtils;
    2522import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement;
    26 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ElementWithHouses;
    2723import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House;
    2824import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Street;
     
    3329
    3430/**
    35  * Dialog for displaying and handling getConflicts.
     31 * Dialog for displaying and handling conflicts.
    3632 *
    3733 * @author Radomír Černoch, radomir.cernoch@gmail.com
     
    5753
    5854        mainField.setModel(conflictModel);
    59 //        conflictModel.addListDataListener(mainField);
    60 
    6155        Reasoner.getInstance().addListener(new ReasonerHook());
    6256
     
    297291//==============================================================================
    298292
     293    /**
     294     * Listenes to the {@link Reasoner} and updates data models.
     295     */
    299296    private class ReasonerHook implements ReasonerListener {
    300297
     
    567564        }
    568565    }
    569 
    570     private class CandidatesRenderer extends UniversalListRenderer {
    571 
    572         @Override
    573         public Component getListCellRendererComponent(JList list, Object value,
    574                         int index, boolean isSelected, boolean cellHasFocus) {
    575             Component c = super.getListCellRendererComponent(list, value, index,
    576                             isSelected, cellHasFocus);
    577 
    578             if (   (value instanceof AddressElement &&
    579                     Reasoner.getInstance().translate((AddressElement) value) != null)
    580                 || (value instanceof OsmPrimitive &&
    581                     Reasoner.getInstance().translate((OsmPrimitive) value) != null) )
    582                 setFont(getFont().deriveFont(Font.BOLD));
    583                
    584             return c;
    585         }
    586     }
    587 
    588 /*
    589     private class ElemTreeModel extends HalfCookedTreeModel {
    590 
    591         public ElemTreeModel() {
    592             root = "Konflikty podle objektů v databázi";
    593         }
    594 
    595         public Object getChild(Object parent, int index) {
    596             try {
    597                 Reasoner r = CzechAddressPlugin.getReasoner();
    598 
    599                 if (parent == root)
    600                     return r.getElementsInConflict().get(index);
    601 
    602                 if (parent instanceof AddressElement)
    603                     return r.getConflicts((AddressElement) parent).get(index).prim;
    604 
    605             } catch (Exception e) {  }
    606             return null;
    607         }
    608 
    609         public int getChildCount(Object parent) {
    610             try {
    611                 Reasoner r = CzechAddressPlugin.getReasoner();
    612 
    613                 if (parent == root)
    614                     return r.getElementsInConflict().size();
    615 
    616                 if (parent instanceof AddressElement)
    617                     return r.getConflicts((AddressElement) parent).size();
    618                
    619             } catch (Exception exp) { }
    620             return 0;
    621         }
    622 
    623         public int getIndexOfChild(Object parent, Object child) {
    624             try{
    625                 Reasoner r = CzechAddressPlugin.getReasoner();
    626 
    627                 if (parent == root)
    628                     return r.getElementsInConflict().indexOf(child);
    629 
    630                 if (parent instanceof AddressElement)
    631                     return r.getConflicts((AddressElement) parent).indexOf(child);
    632                
    633             } catch (Exception exp) { }
    634             return -1;
    635         }
    636     }
    637 
    638 
    639     private class PrimTreeModel extends HalfCookedTreeModel {
    640 
    641         public PrimTreeModel() {
    642             root = "Podle objeků databáze";
    643         }
    644 
    645         public Object getChild(Object parent, int index) {
    646             try {
    647                 Reasoner r = CzechAddressPlugin.getReasoner();
    648 
    649                 if (parent == root)
    650                     return r.getPrimitivesInConflict().get(index);
    651 
    652                 if (parent instanceof OsmPrimitive)
    653                     return r.getConflictsconflictsve) parent).get(index).elem;
    654                
    655             } catch (Exception exp) { }
    656             return null;
    657         }
    658 
    659         public int getChildCount(Object parent) {
    660 
    661             try {
    662                 Reasoner r = CzechAddressPlugin.getReasoner();
    663 
    664                 if (parent == root)
    665                     return r.getPrimitivesInConflict().size();
    666                 if (parent instanceof OsmPrimitive)
    667                     return r.getConflictsconflictsve) parent).size();
    668 
    669             } catch (Exception exp) { }
    670             return 0;
    671         }
    672 
    673         public int getIndexOfChild(Object parent, Object child) {
    674            
    675             try {
    676                 Reasoner r = CzechAddressPlugin.getReasoner();
    677 
    678                 if (parent == root) {
    679                     return r.getPrimitivesInConflict().indexOf(child);
    680 
    681                 } else if (parent instanceof OsmPrimitive)
    682                     return r.getConflictsconflictsve) parent).indexOf(child);
    683                
    684             } catch (Exception exp) { }
    685             return -1;
    686         }
    687     }*/
    688566}
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/FactoryDialog.java

    r15582 r15585  
    11package org.openstreetmap.josm.plugins.czechaddress.gui;
    22
     3import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedListModel;
     4import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedComboBoxModel;
    35import org.openstreetmap.josm.plugins.czechaddress.StringUtils;
    46import java.awt.Component;
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/GroupManipulatorDialog.java

    r15582 r15585  
    1010import org.openstreetmap.josm.gui.ExtendedDialog;
    1111import org.openstreetmap.josm.plugins.czechaddress.CzechAddressPlugin;
    12 import org.openstreetmap.josm.plugins.czechaddress.StatusListener;
    1312import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
    1413import org.openstreetmap.josm.plugins.czechaddress.intelligence.ReasonerListener;
     
    2120 * proposals, delete or confirm them.
    2221 *
    23  * Apart from proposals, it also shows a list of conflicts, which arouse
    24  * during the address completion.
     22 * <p>Apart from proposals, it also shows a list of conflicts, which arouse
     23 * during the address completion.</p>
    2524 *
    2625 * @author Radomír Černoch radomir.cernoch@gmail.com
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java

    r15582 r15585  
    6666
    6767    /**
     68     * Hardly ever working method for autodetecting the current location.
     69     *
    6870     * @deprecated
    6971     */
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java

    r15582 r15585  
    11package org.openstreetmap.josm.plugins.czechaddress.gui;
    22
    3 import java.awt.Component;
    4 import java.awt.event.MouseEvent;
     3import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedTreeModel;
    54import java.util.ArrayList;
    65import java.util.List;
    7 import javax.swing.DefaultComboBoxModel;
    8 import javax.swing.JComboBox;
    9 import javax.swing.JTable;
    106import javax.swing.event.TableModelListener;
    117import javax.swing.table.DefaultTableCellRenderer;
    128import javax.swing.table.TableModel;
    13 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalTreeRenderer;
    149import org.openstreetmap.josm.Main;
    1510import org.openstreetmap.josm.gui.ExtendedDialog;
     
    2318import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ViToCi;
    2419import org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors.StreetEditor;
     20import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalTreeRenderer;
    2521import org.openstreetmap.josm.plugins.czechaddress.intelligence.Capitalizator;
    2622import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
    2723
     24/**
     25 * Editing the database of {@link AddressElement}s.
     26 *
     27 * <p>Currently allows to display the current location + its children and
     28 * automatic street renaming.</p>
     29 *
     30 * @author Radomír Černoch radomir.cernoch@gmail.com
     31 */
    2832public class ManagerDialog extends ExtendedDialog {
    2933
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java

    r15584 r15585  
    11package org.openstreetmap.josm.plugins.czechaddress.gui;
    22
     3import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedComboBoxModel;
    34import java.awt.event.ActionEvent;
    45import java.awt.event.KeyEvent;
     
    2223import org.openstreetmap.josm.plugins.czechaddress.proposal.Proposal;
    2324import org.openstreetmap.josm.plugins.czechaddress.proposal.ProposalContainer;
    24 import org.openstreetmap.josm.tools.ImageProvider;
    2525
    2626/**
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/StreetEditor.form

    r15584 r15585  
    11<?xml version="1.0" encoding="UTF-8" ?>
    22
    3 <Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     3<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
     4  <SyntheticProperties>
     5    <SyntheticProperty name="formSizePolicy" type="int" value="2"/>
     6  </SyntheticProperties>
    47  <AuxValues>
    58    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/StreetEditor.java

    r15584 r15585  
    1 /*
    2  * To change this template, choose Tools | Templates
    3  * and open the template in the editor.
    4  */
    5 
    6 /*
    7  * StreetEditor.java
    8  *
    9  * Created on 3.6.2009, 20:50:45
    10  */
    11 
    121package org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors;
    132
     
    209
    2110/**
     11 * Dialog for editing a {@link Street}
    2212 *
    23  * @author radek
     13 * @author Radomír Černoch radomir.cernoch@gmail.com
    2414 */
    2515public class StreetEditor extends ExtendedDialog {
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/HalfCookedComboBoxModel.java

    r15460 r15585  
    1 package org.openstreetmap.josm.plugins.czechaddress.gui;
     1package org.openstreetmap.josm.plugins.czechaddress.gui.utils;
    22
    33import java.util.ArrayList;
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/HalfCookedListModel.java

    r15460 r15585  
    1 package org.openstreetmap.josm.plugins.czechaddress.gui;
     1package org.openstreetmap.josm.plugins.czechaddress.gui.utils;
    22
    33import java.util.ArrayList;
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/HalfCookedTreeModel.java

    r15460 r15585  
    1 package org.openstreetmap.josm.plugins.czechaddress.gui;
     1package org.openstreetmap.josm.plugins.czechaddress.gui.utils;
    22
    33import java.util.ArrayList;
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalListRenderer.java

    r15558 r15585  
    1 /*
    2  * To change this template, choose Tools | Templates
    3  * and open the template in the editor.
    4  */
    5 
    61package org.openstreetmap.josm.plugins.czechaddress.gui.utils;
    72
     
    116
    127/**
     8 * List renderer for AddressElements and OsmPrimitives.
    139 *
    1410 * @author Radomír Černoch, radomir.cernoch@gmail.com
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalRenderer.java

    r15558 r15585  
    1 /*
    2  * To change this template, choose Tools | Templates
    3  * and open the template in the editor.
    4  */
    5 
    61package org.openstreetmap.josm.plugins.czechaddress.gui.utils;
    72
     
    2116
    2217/**
     18 * Helper for getting icons and texts for {@code Universal*} renderers.
    2319 *
    2420 * @author Radomír Černoch, radomir.cernoch@gmail.com
     
    3127    private static final ImageIcon nodeIcon      = ImageProvider.get("data/node.png");
    3228    private static final ImageIcon wayIcon       = ImageProvider.get("data/way.png");
    33 //  private static final ImageIcon closedWayIcon = ImageProvider.get("Mf_closedway.png");
    3429    private static final ImageIcon relationIcon  = ImageProvider.get("data/relation.png");
    3530
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalTreeRenderer.java

    r15582 r15585  
    66import org.openstreetmap.josm.data.osm.OsmPrimitive;
    77import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement;
    8 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalRenderer;
    98
    109/**
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/ReasonerListener.java

    r15558 r15585  
    55
    66/**
     7 * Interface capable of sensing changes in the {@link Reasoner}.
    78 *
    89 * @author Radomír Černoch, radomir.cernoch@gmail.com
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/SelectionMonitor.java

    r15582 r15585  
    1010
    1111/**
    12  * Listenes to the current selection for reasoning
     12 * Listenes to the current selection and updates all selected elements.
    1313 *
    1414 * <p>Currently JOSM has no way of giving notice about a changed or deleted
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/XMLParser.java

    r15166 r15585  
    11package org.openstreetmap.josm.plugins.czechaddress.parser;
    22
    3 import org.openstreetmap.josm.plugins.czechaddress.parser.DatabaseParser;
    43import java.io.IOException;
    54import org.openstreetmap.josm.plugins.czechaddress.DatabaseLoadException;
Note: See TracChangeset for help on using the changeset viewer.