- Timestamp:
- 2016-01-03T23:58:14+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/taginfoextract.groovy
r9283 r9289 22 22 import org.openstreetmap.josm.data.coor.LatLon 23 23 import org.openstreetmap.josm.data.osm.Node 24 import org.openstreetmap.josm.data.osm.OsmPrimitive 24 25 import org.openstreetmap.josm.data.osm.Way 25 26 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings … … 34 35 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector 35 36 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser 37 import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement 36 38 import org.openstreetmap.josm.gui.mappaint.styleelement.LineElement 39 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement 37 40 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference 38 41 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset … … 52 55 MapCSSStyleSource style_source 53 56 FileWriter output_file 54 defbase_dir = "."55 def tags = [] as Set57 String base_dir = "." 58 Set tags = [] 56 59 57 60 private def cached_svnrev … … 63 66 64 67 def tag 65 defosm68 OsmPrimitive osm 66 69 67 70 Checker(tag) { … … 69 72 } 70 73 71 def apply_stylesheet(osm) {74 Environment apply_stylesheet(OsmPrimitive osm) { 72 75 osm.put(tag[0], tag[1]) 73 defmc = new MultiCascade()74 75 defenv = new Environment(osm, mc, null, style_source)76 MultiCascade mc = new MultiCascade() 77 78 Environment env = new Environment(osm, mc, null, style_source) 76 79 for (def r in style_source.rules) { 77 80 env.clearSelectorMatchingInformation() … … 89 92 90 93 /** 91 * Create image file from ElemStyle.94 * Create image file from StyleElement. 92 95 * @return the URL 93 96 */ 94 def create_image( elem_style, type, nc) {97 def create_image(StyleElement elem_style, type, nc) { 95 98 def img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB) 96 99 def g = img.createGraphics() … … 142 145 def n1 = new Node(nc.getLatLon(2,8)) 143 146 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) 146 149 def env = apply_stylesheet(osm) 147 150 def les = LineElement.createLine(env) … … 165 168 def n3 = new Node(nc.getLatLon(14,14)) 166 169 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) 172 175 def env = apply_stylesheet(osm) 173 def aes = AreaElem Style.create(env)176 def aes = AreaElement.create(env) 174 177 if (aes != null) { 175 178 if (!generate_image) return true … … 389 392 * Determine full image url (can refer to JOSM or OSM repository). 390 393 */ 391 def find_image_url( path) {394 def find_image_url(String path) { 392 395 def f = new File("${base_dir}/images/styles/standard/${path}") 393 396 if (f.exists()) {
Note:
See TracChangeset
for help on using the changeset viewer.