Package org.openstreetmap.josm.command

Examples of org.openstreetmap.josm.command.ChangePropertyCommand


        public TestError getTestError(final OsmPrimitive p, final String key) {
            if (prettifiedValue == null) {
                return new TestError(OpeningHourTest.this, severity, message, 2901, p);
            } else {
                return new FixableTestError(OpeningHourTest.this, severity, message, 2901, p,
                        new ChangePropertyCommand(p, key, prettifiedValue));
            }
        }
View Full Code Here


    }

    public static Command createCommand(Collection<OsmPrimitive> sel, List<Tag> changedTags) {
        List<Command> cmds = new ArrayList<>();
        for (Tag tag: changedTags) {
            cmds.add(new ChangePropertyCommand(sel, tag.getKey(), tag.getValue()));
        }

        if (cmds.size() == 0)
            return null;
        else if (cmds.size() == 1)
View Full Code Here

    public Command fixError(TestError testError) {
        if (testError instanceof PowerLineError && isFixable(testError)) {
            // primitives list can be empty if all primitives have been purged
            Iterator<? extends OsmPrimitive> it = testError.getPrimitives().iterator();
            if (it.hasNext()) {
                return new ChangePropertyCommand(it.next(),
                        "power", towerPoleTagMap.get(((PowerLineError)testError).line));
            }
        }
        return null;
    }
View Full Code Here

    public Command fixError(TestError testError) {
        if (testError instanceof WrongRoundaboutHighway) {
            // primitives list can be empty if all primitives have been purged
            Iterator<? extends OsmPrimitive> it = testError.getPrimitives().iterator();
            if (it.hasNext()) {
                return new ChangePropertyCommand(it.next(),
                        "highway", ((WrongRoundaboutHighway) testError).correctValue);
            }
        }
        return null;
    }
View Full Code Here

        // tag name holds an empty key. Don't apply it to the selection.
        //
        if (tag.getName().trim().isEmpty())
            return null;

        return new ChangePropertyCommand(primitives, tag.getName(), tag.getValue());
    }
View Full Code Here

        ArrayList<Command> commands = new ArrayList<>();

        for (OsmPrimitive primitive : primitives) {
            for (String oldkey : primitive.keySet()) {
                if (!currentkeys.contains(oldkey)) {
                    ChangePropertyCommand deleteCommand =
                        new ChangePropertyCommand(primitive,oldkey,null);
                    commands.add(deleteCommand);
                }
            }
        }
View Full Code Here

        if (!TextTagParser.validateTags(tags)) return false;

        List<Command> commands = new ArrayList<>(tags.size());
        for (Entry<String, String> entry: tags.entrySet()) {
            String v = entry.getValue();
            commands.add(new ChangePropertyCommand(selection, entry.getKey(), "".equals(v)?null:v));
        }
        commitCommands(selection, commands);
        return !commands.isEmpty();
    }
View Full Code Here

        if (directlyAdded==null || directlyAdded.isEmpty()) return false;

        PasteTagsAction.TagPaster tagPaster = new PasteTagsAction.TagPaster(directlyAdded, selection);
        List<Command> commands = new ArrayList<>();
        for (Tag tag : tagPaster.execute()) {
            commands.add(new ChangePropertyCommand(selection, tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue()));
        }
        commitCommands(selection, commands);
        return true;
    }
View Full Code Here

                }
            }

            if (!affectedWays.isEmpty()) {
                // reset key tag on affected ways
                commands.add(new ChangePropertyCommand(affectedWays, key, null));
            }
        }

        if (moveTags) {
            // add those tag values to the relation
View Full Code Here

            for (Entry<String, String> prop: tags.entrySet()) {
                String key = prop.getKey();
                String value = prop.getValue();
                if (value == null || value.trim().length() == 0) {
                    commands.add(new ChangePropertyCommand(p, key, null));
                } else if (value.startsWith(" ") || value.endsWith(" ")) {
                    commands.add(new ChangePropertyCommand(p, key, Tag.removeWhiteSpaces(value)));
                } else if (key.startsWith(" ") || key.endsWith(" ")) {
                    commands.add(new ChangePropertyKeyCommand(p, key, Tag.removeWhiteSpaces(key)));
                } else {
                    String evalue = entities.unescape(value);
                    if (!evalue.equals(value)) {
                        commands.add(new ChangePropertyCommand(p, key, evalue));
                    } else {
                        String replacementKey = spellCheckKeyData.get(key);
                        if (replacementKey != null) {
                            commands.add(new ChangePropertyKeyCommand(p, key, replacementKey));
                        }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.command.ChangePropertyCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.