Subversion Repositories mkgmap

Rev

Rev 2579 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2011 - 2012.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 or
 * 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.
 */


package uk.me.parabola.mkgmap.reader.osm;

import uk.me.parabola.mkgmap.osmstyle.StyleImpl;
import uk.me.parabola.util.EnhancedProperties;

/**
 * This hook applies the relation rules of the style system.
 * @author WanMil
 */

public class RelationStyleHook extends OsmReadingHooksAdaptor {

        private Style style;
        private ElementSaver saver;
       
        public RelationStyleHook() {
        }

        public boolean init(ElementSaver saver, EnhancedProperties props) {
                this.saver = saver;
                style = StyleImpl.readStyle(props);
                return super.init(saver, props);
        }

        public void end() {
                Rule relationRules = style.getRelationRules();
                for (Relation rel : saver.getRelations().values()) {
                        relationRules.resolveType(rel, TypeResult.NULL_RESULT);
                }
                super.end();
               
                style = null;
        }

       
       
}