source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java@ 3827

Last change on this file since 3827 was 3827, checked in by bastiK, 13 years ago

IconElemStyle: delay the loading of imagage icon until it is actually displayed on screen

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint.xml;
3
4import org.openstreetmap.josm.gui.mappaint.IconElemStyle;
5import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
6import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
7import org.openstreetmap.josm.gui.mappaint.NodeElemStyle;
8import org.openstreetmap.josm.gui.mappaint.SimpleNodeElemStyle;
9
10public class IconPrototype extends Prototype {
11
12 public IconReference icon;
13 public boolean annotate;
14
15 public IconPrototype (IconPrototype i, long maxScale, long minScale) {
16 super(maxScale, minScale);
17 this.icon = i.icon;
18 this.annotate = i.annotate;
19 this.priority = i.priority;
20 this.conditions = i.conditions;
21 }
22
23 public IconPrototype() { init(); }
24
25 public void init() {
26 icon = null;
27 priority = 0;
28 annotate = true;
29 }
30
31 public NodeElemStyle createStyle() {
32 if (icon == null) {
33 return SimpleNodeElemStyle.INSTANCE;
34 } else {
35 IconElemStyle i = new IconElemStyle(minScale, maxScale, MapPaintStyles.getIcon(icon));
36 i.annotate = annotate;
37 return i;
38 }
39 }
40}
Note: See TracBrowser for help on using the repository browser.