Search in sources :

Example 1 with DeleteAction

use of uk.me.parabola.mkgmap.osmstyle.actions.DeleteAction in project mkgmap by openstreetmap.

the class RuleFileReader method possiblyChanged.

/**
 * Check if the expression depends on tags modified by an action in the action list.
 * @param expr the expression to check
 * @param actionList the ActionList
 * @return true if the value of the expression depends on one or more of the changeable tags
 */
private boolean possiblyChanged(Op expr, ActionList actionList) {
    Set<String> evaluated = expr.getEvaluatedTagKeys();
    if (evaluated.isEmpty())
        return false;
    for (String tagKey : evaluated) {
        for (String s : actionList.getChangeableTags()) {
            int pos = s.indexOf("=");
            String key = pos > 0 ? s.substring(0, pos) : s;
            if (tagKey.equals(key)) {
                return true;
            }
        }
        for (Action a : actionList.getList()) {
            if (a instanceof DeleteAction) {
                if (a.toString().contains(tagKey)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : DeleteAction(uk.me.parabola.mkgmap.osmstyle.actions.DeleteAction) AddTagAction(uk.me.parabola.mkgmap.osmstyle.actions.AddTagAction) Action(uk.me.parabola.mkgmap.osmstyle.actions.Action) DeleteAction(uk.me.parabola.mkgmap.osmstyle.actions.DeleteAction)

Aggregations

Action (uk.me.parabola.mkgmap.osmstyle.actions.Action)1 AddTagAction (uk.me.parabola.mkgmap.osmstyle.actions.AddTagAction)1 DeleteAction (uk.me.parabola.mkgmap.osmstyle.actions.DeleteAction)1