Ignore:
Timestamp:
2016-01-03T23:58:14+01:00 (8 years ago)
Author:
Don-vip
Message:

fix taginfo groovy script broken by r9278

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/taginfoextract.groovy

    r9283 r9289  
    2222import org.openstreetmap.josm.data.coor.LatLon
    2323import org.openstreetmap.josm.data.osm.Node
     24import org.openstreetmap.josm.data.osm.OsmPrimitive
    2425import org.openstreetmap.josm.data.osm.Way
    2526import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings
     
    3435import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector
    3536import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser
     37import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement
    3638import org.openstreetmap.josm.gui.mappaint.styleelement.LineElement
     39import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement
    3740import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference
    3841import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
     
    5255    MapCSSStyleSource style_source
    5356    FileWriter output_file
    54     def base_dir = "."
    55     def tags = [] as Set
     57    String base_dir = "."
     58    Set tags = []
    5659
    5760    private def cached_svnrev
     
    6366
    6467        def tag
    65         def osm
     68        OsmPrimitive osm
    6669
    6770        Checker(tag) {
     
    6972        }
    7073
    71         def apply_stylesheet(osm) {
     74        Environment apply_stylesheet(OsmPrimitive osm) {
    7275            osm.put(tag[0], tag[1])
    73             def mc = new MultiCascade()
    74 
    75             def env = new Environment(osm, mc, null, style_source)
     76            MultiCascade mc = new MultiCascade()
     77
     78            Environment env = new Environment(osm, mc, null, style_source)
    7679            for (def r in style_source.rules) {
    7780                env.clearSelectorMatchingInformation()
     
    8992
    9093        /**
    91          * Create image file from ElemStyle.
     94         * Create image file from StyleElement.
    9295         * @return the URL
    9396         */
    94         def create_image(elem_style, type, nc) {
     97        def create_image(StyleElement elem_style, type, nc) {
    9598            def img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB)
    9699            def g = img.createGraphics()
     
    142145            def n1 = new Node(nc.getLatLon(2,8))
    143146            def n2 = new Node(nc.getLatLon(14,8))
    144             osm.addNode(n1)
    145             osm.addNode(n2)
     147            ((Way)osm).addNode(n1)
     148            ((Way)osm).addNode(n2)
    146149            def env = apply_stylesheet(osm)
    147150            def les = LineElement.createLine(env)
     
    165168            def n3 = new Node(nc.getLatLon(14,14))
    166169            def n4 = new Node(nc.getLatLon(2,14))
    167             osm.addNode(n1)
    168             osm.addNode(n2)
    169             osm.addNode(n3)
    170             osm.addNode(n4)
    171             osm.addNode(n1)
     170            ((Way)osm).addNode(n1)
     171            ((Way)osm).addNode(n2)
     172            ((Way)osm).addNode(n3)
     173            ((Way)osm).addNode(n4)
     174            ((Way)osm).addNode(n1)
    172175            def env = apply_stylesheet(osm)
    173             def aes = AreaElemStyle.create(env)
     176            def aes = AreaElement.create(env)
    174177            if (aes != null) {
    175178                if (!generate_image) return true
     
    389392     * Determine full image url (can refer to JOSM or OSM repository).
    390393     */
    391     def find_image_url(path) {
     394    def find_image_url(String path) {
    392395        def f = new File("${base_dir}/images/styles/standard/${path}")
    393396        if (f.exists()) {
Note: See TracChangeset for help on using the changeset viewer.