Changeset 2708 in osm for applications/editors/josm
- Timestamp:
- 2007-05-01T23:02:45+02:00 (18 years ago)
- Location:
- applications/editors/josm/plugins/mappaint
- Files:
-
- 41 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mappaint/build.xml
r2687 r2708 19 19 20 20 <target name="build" depends="compile"> 21 <copy todir="build/ images">22 <fileset dir=" images"></fileset>21 <copy todir="build/standard/icons"> 22 <fileset dir="styles/standard/icons"></fileset> 23 23 </copy> 24 24 <jar destfile="dist/mappaint.jar" basedir="build"> -
applications/editors/josm/plugins/mappaint/src/mappaint/ElemStyleHandler.java
r1501 r2708 1 1 package mappaint; 2 2 3 import java.io.File; 3 4 import java.awt.Color; 4 5 import java.awt.Toolkit; … … 8 9 9 10 import org.openstreetmap.josm.tools.ColorHelper; 11 import org.openstreetmap.josm.plugins.Plugin; 10 12 import org.xml.sax.Attributes; 11 13 import org.xml.sax.helpers.DefaultHandler; … … 96 98 { 97 99 if(atts.getQName(count).equals("src")) { 98 URL path = getClass().getResource("/images/nodes/"+atts.getValue(count)); 99 curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path)); 100 String imageFile = MapPaintPlugin.getIconsDir()+atts.getValue(count); 101 File f = new File(imageFile); 102 if (f.exists()){ 103 //open icon from user directory 104 curIcon = new ImageIcon(imageFile); 105 } else { 106 URL path = getClass().getResource("/standard/icons/"+atts.getValue(count)); 107 if (path != null ) { 108 curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path)); 109 } else{ 110 path = getClass().getResource("/standard/icons/amenity.png"); 111 curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path)); 112 } 113 } 100 114 } else if (atts.getQName(count).equals("annotate")) 101 115 curAnnotate = Boolean.parseBoolean -
applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintPlugin.java
r1436 r2708 16 16 17 17 public static ElemStyles elemStyles = new ElemStyles(); 18 19 public static String iconsDir; 20 21 public static String getIconsDir(){ 22 return iconsDir; 23 } 18 24 19 25 public MapPaintPlugin() { 26 iconsDir = getPluginDir()+"icons/"; //some day we will support diferent icon directories over options 20 27 String elemStylesFile = getPluginDir()+"elemstyles.xml"; 21 28 File f = new File(elemStylesFile); -
applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java
r2688 r2708 35 35 // Altered from SimplePaintVisitor 36 36 @Override public void visit(Node n) { 37 if (!n.shown) { 38 ElemStyle nodeStyle = MapPaintPlugin.elemStyles.getStyle(n); 39 if(nodeStyle!=null && Main.map.mapView.zoom()>=nodeStyle.getMinZoom()){ 40 if(nodeStyle instanceof IconElemStyle) { 41 drawNode(n, ((IconElemStyle)nodeStyle).getIcon()); 42 } else { 43 // throw some sort of exception 44 } 37 ElemStyle nodeStyle = MapPaintPlugin.elemStyles.getStyle(n); 38 if(nodeStyle!=null && Main.map.mapView.zoom()>=nodeStyle.getMinZoom()){ 39 if(nodeStyle instanceof IconElemStyle) { 40 drawNode(n, ((IconElemStyle)nodeStyle).getIcon()); 45 41 } else { 46 drawNode(n, n.selected ? getPreferencesColor("selected", 47 Color.YELLOW) 48 : getPreferencesColor("node", Color.RED)); 49 } 42 // throw some sort of exception 43 } 44 } else { 45 drawNode(n, n.selected ? getPreferencesColor("selected", 46 Color.YELLOW) 47 : getPreferencesColor("node", Color.RED)); 50 48 } 51 49 } … … 135 133 // NEW 136 134 protected void drawNode(Node n, ImageIcon icon) { 137 if (n.shown) return;138 n.shown=true;139 135 Point p = nc.getPoint(n.eastNorth); 140 136 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; … … 221 217 osm.shown=false; 222 218 223 for (final OsmPrimitive osm : data.nodes)224 if (!osm.deleted)225 osm.shown=false;226 227 219 for (final OsmPrimitive osm : data.ways) 228 220 if (!osm.deleted && MapPaintPlugin.elemStyles.isArea(osm))
Note:
See TracChangeset
for help on using the changeset viewer.