Changeset 15584 in osm for applications/editors


Ignore:
Timestamp:
2009-06-04T01:11:51+02:00 (15 years ago)
Author:
rcernoch
Message:

CzechAddress: Now 0.2.0 is really almost ready

Location:
applications/editors/josm/plugins/czechaddress
Files:
3 added
4 edited
1 moved

Legend:

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

    r15582 r15584  
    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;
    72
     
    105
    116/**
    12  *
     7 * Utilities for handling {@link OsmPrimitive}s.
     8 *
    139 * @author Radomír Černoch, radomir.cernoch@gmail.com
    1410 */
     
    4541
    4642                int val = o1.get(key).compareTo(o2.get(key));
    47                 if (val != 0) {
    48                     return val;
    49                 }
     43                if (val != 0) return val;
    5044            }
    5145
    52             return o1.toString().compareTo(o2.toString());
     46            /*int val = o1.toString().compareTo(o2.toString());
     47            if (val != 0) return val;*/
    5348
    54             /*LatLon pos1 = null;
    55             LatLon pos2 = null;
    56             if (o1 instanceof Node) pos1 = ((Node) o1).coor;
    57             if (o1 instanceof Way)  pos1 = ((Way)  o1).lastNode().coor;
    58             if (o2 instanceof Node) pos1 = ((Node) o2).coor;
    59             if (o2 instanceof Way)  pos1 = ((Way)  o2).lastNode().coor;
    60 
    61             if (pos1 != null && pos2 != null) {
    62             if (pos1.lat() < pos2.lat()) return -1;
    63             if (pos1.lat() > pos2.lat()) return  1;
    64             if (pos1.lon() < pos2.lon()) return -1;
    65             if (pos1.lon() > pos2.lon()) return  1;
    66             }*/
     49            return o1.compareTo(o2);
    6750        }
    6851    };
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java

    r15582 r15584  
    55import org.openstreetmap.josm.data.osm.OsmPrimitive;
    66import org.openstreetmap.josm.data.osm.Way;
     7import org.openstreetmap.josm.plugins.czechaddress.PrimUtils;
    78import org.openstreetmap.josm.plugins.czechaddress.StringUtils;
    89import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
     
    6162
    6263    public static String getName(OsmPrimitive prim) {
    63         String cp     = prim.get("addr:alternatenumber");
    64         String co     = prim.get("addr:housenumber");
    65         String street = prim.get("addr:street");
    66         String city   = prim.get("addr:city");
    67         String name   = prim.get("name");
     64        String cp     = prim.get(PrimUtils.KEY_ADDR_CP);
     65        String co     = prim.get(PrimUtils.KEY_ADDR_CO);
     66        String street = prim.get(PrimUtils.KEY_ADDR_STREET);
     67        String city   = prim.get(PrimUtils.KEY_ADDR_CITY);
     68        String name   = prim.get(PrimUtils.KEY_NAME);
    6869
    6970        String result = "";
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java

    r15582 r15584  
    1414import org.openstreetmap.josm.plugins.czechaddress.CzechAddressPlugin;
    1515import org.openstreetmap.josm.plugins.czechaddress.NotNullList;
     16import org.openstreetmap.josm.plugins.czechaddress.PrimUtils;
    1617import org.openstreetmap.josm.plugins.czechaddress.StatusListener;
    1718import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement;
     
    6869        matchesComboBox.setRenderer(new UniversalListRenderer());
    6970
    70         if (primitive.get("addr:alternatenumber") != null) {
    71             alternateNumberEdit.setText(primitive.get("addr:alternatenumber"));
     71        if (primitive.get(PrimUtils.KEY_ADDR_CP) != null) {
     72            alternateNumberEdit.setText(primitive.get(PrimUtils.KEY_ADDR_CP));
    7273            updateMatches();
    7374        }
     
    133134            r.openTransaction();
    134135            prim.keys = null;
    135             prim.put("addr:alternatenumber", alternateNumberEdit.getText());
     136            prim.put(PrimUtils.KEY_ADDR_CP, alternateNumberEdit.getText());
    136137            r.update(prim);
    137138            elems.addAll(r.getCandidates(prim));
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ProposalContainer.java

    r15582 r15584  
    181181    @Override
    182182    public String toString() {
    183         /*if (target.keySet().contains("name"))
    184             return target.get("name");
    185 
    186         if (   target.keySet().contains("addr:alternatenumber")
    187             || target.keySet().contains("addr:housenumber")) {
    188 
    189             String cp = target.get("addr:alternatenumber");
    190             String co = target.get("addr:housenumber");
    191             String ul = target.get("addr:street");
    192 
    193             if (cp == null) cp = "?";
    194             if (co == null) co = "?";
    195             if (ul == null) ul = "" ; else ul = " " + ul;
    196 
    197             return "Dům " + String.valueOf(cp) + "/" + String.valueOf(co) + ul;
    198         }*/
    199 
    200183        return target.toString();
    201184    }
Note: See TracChangeset for help on using the changeset viewer.