Changeset 25905 in osm for applications


Ignore:
Timestamp:
2011-04-26T10:05:44+02:00 (14 years ago)
Author:
upliner
Message:

buildings_tools: use all address nodes, not just building=*

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java

    r25893 r25905  
    1212import java.util.LinkedList;
    1313import java.util.List;
     14import java.util.Map.Entry;
    1415
    1516import javax.swing.JOptionPane;
     
    220221
    221222    /**
    222      * Returns a node with "building=yes" tag under the building
     223     * Returns a node with address tags under the building
    223224     *
    224225     * @return
     
    231232        nodesloop:
    232233        for (Node n : Main.main.getCurrentDataSet().searchNodes(bbox)) {
    233             if (!n.isUsable() || n.getKeys().get("building") == null)
     234            if (!n.isUsable())
    234235                continue;
     236            tagcheck: do {
     237                for (String key : n.getKeys().keySet()) {
     238                    if (key.equals("building") || key.startsWith("addr:"))
     239                        break tagcheck;
     240                }
     241                continue nodesloop;
     242            } while (false);
    235243            double x = projection1(latlon2eastNorth(n.getCoor()));
    236244            double y = projection2(latlon2eastNorth(n.getCoor()));
     
    289297                cmds.add(new AddCommand(nodes[i]));
    290298        }
     299        w.setKeys(ToolSettings.getTags());
    291300        cmds.add(new AddCommand(w));
    292301        Node addrNode;
    293302        if (ToolSettings.PROP_USE_ADDR_NODE.get() && (addrNode = getAddressNode()) != null) {
    294             w.setKeys(addrNode.getKeys());
     303            for (Entry<String, String> entry : addrNode.getKeys().entrySet()) {
     304                w.put(entry.getKey(), entry.getValue());
     305            }
    295306            for (OsmPrimitive p : addrNode.getReferrers()) {
    296307                Relation r = (Relation) p;
     
    306317            }
    307318            cmds.add(new DeleteCommand(addrNode));
    308         } else {
    309             w.setKeys(ToolSettings.getTags());
    310319        }
    311320        Command c = new SequenceCommand(tr("Create building"), cmds);
Note: See TracChangeset for help on using the changeset viewer.