Steve Ratcliffe wrote:

There is nothing wrong with this and I would like it to work.

However what currently happens is that for each node/way/relation I go
through the tags exactly once and find the earliest rule that matches.
Rules with actions have the actions run when seen.  So in this case I
believe that ncn is already set and has been processed so the change is too
late.

Ah, that makes sense. Thanks very much for the tips - should really help in finding a way around it.

A final fix would either be about enforcing and clarifying restriction
or would probably be slower.  But as long as the normal case is a
similar speed I don't mind.

I wonder if a "continue" action might be the most efficient way of doing it - i.e. only have the slow behaviour if explicitly requested?

(As you can see I added an echo statement to aid debugging... thatÂ’s
about the limit of my Java. :) )

Hey, that looks useful, could you send a patch?

EchoAction.java attached (to go in osmstyle/actions, of course). It's a bit of a worksforme so apologies for any inelegance. The only other change needed is to add

                        } else if ("echo".equals(cmd)) {
                                String str = scanner.nextWord();
                                actions.add(new EchoAction(str));

in readActions (ActionReader.java).

cheers
Richard
/*
 * Copyright (C) 2008 Steve Ratcliffe
 * 
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 * 
 * Author: Steve Ratcliffe
 * Create date: 29-Nov-2008
 */
package uk.me.parabola.mkgmap.osmstyle.actions;

import uk.me.parabola.mkgmap.reader.osm.Element;

/**
 * Sends a message to the console.
 * 
 * @author Richard Fairhurst
 */
public class EchoAction implements Action {
	private final ValueBuilder value;

	public EchoAction(String str) {
		this.value = new ValueBuilder(str);
	}

	public void perform(Element el) {
		String e=value.build(el);
		System.err.println(el.getId()+": "+e);
	}
}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to