Changeset 29199 in osm for applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
- Timestamp:
- 2013-01-15T15:08:25+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29198 r29199 10 10 package seamap; 11 11 12 import java.awt.BasicStroke; 12 13 import java.awt.Graphics2D; 13 14 import java.awt.RenderingHints; 15 import java.awt.geom.GeneralPath; 16 import java.awt.geom.Path2D; 14 17 import java.awt.geom.Point2D; 15 18 import java.util.ArrayList; … … 20 23 import s57.S57val.*; 21 24 import s57.S57val; 25 import seamap.SeaMap; 22 26 import seamap.SeaMap.*; 23 27 import symbols.Symbols; … … 31 35 static double tScale; 32 36 static Graphics2D g2; 37 static int zoom; 33 38 34 public static void reRender(Graphics2D g, int z oom, double factor, SeaMap m, MapHelper h) {39 public static void reRender(Graphics2D g, int z, double factor, SeaMap m, MapHelper h) { 35 40 g2 = g; 41 zoom = z; 36 42 helper = h; 37 43 map = m; … … 115 121 public static void symbol(Feature feature, Symbol symbol, Obj obj, Delta delta) { 116 122 Point2D point = helper.getPoint(findCentroid(feature)); 117 ArrayList<ColCOL> colours = (ArrayList<ColCOL>) getAttVal(feature, obj, 0, Att.COLOUR); 118 ArrayList<ColPAT> pattern = (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT); 119 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), delta, new Scheme(pattern, colours)); 123 if (obj == null) { 124 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), delta, null); 125 } else { 126 ArrayList<ColCOL> colours = (ArrayList<ColCOL>) getAttVal(feature, obj, 0, Att.COLOUR); 127 ArrayList<ColPAT> pattern = (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT); 128 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), delta, new Scheme(pattern, colours)); 129 } 120 130 } 121 131 … … 131 141 132 142 public static void lineVector (Feature feature, LineStyle style) { 133 143 if (feature.flag != Fflag.NODE) { 144 ArrayList<Long> nodes = map.ways.get(feature.refs); 145 Path2D.Double p = new Path2D.Double(); 146 p.setWindingRule(GeneralPath.WIND_NON_ZERO); 147 boolean first = true; 148 for (long node : nodes) { 149 Point2D point = helper.getPoint(map.nodes.get(node)); 150 if (first) { 151 p.moveTo(point.getX(), point.getY()); 152 first = false; 153 } else { 154 p.lineTo(point.getX(), point.getY()); 155 } 156 } 157 if (style.line != null) { 158 if (style.dash != null) { 159 float[] dash = new float[style.dash.length]; 160 System.arraycopy(style.dash, 0, dash, 0, style.dash.length); 161 for (int i = 0; i < style.dash.length; i++) { 162 dash[i] *= (float) (sScale); 163 } 164 g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1, dash, 0)); 165 } else { 166 g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); 167 } 168 g2.setPaint(style.line); 169 g2.draw(p); 170 } 171 if (style.fill != null) { 172 g2.setPaint(style.fill); 173 g2.fill(p); 174 } 175 } 134 176 } 135 177
Note:
See TracChangeset
for help on using the changeset viewer.
