Changeset 29202 in osm for applications/editors/josm/plugins/smed2/src/seamap
- Timestamp:
- 2013-01-17T12:08:28+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/seamap
- Files:
-
- 3 edited
-
Renderer.java (modified) (7 diffs)
-
Rules.java (modified) (6 diffs)
-
SeaMap.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29200 r29202 11 11 12 12 import java.awt.BasicStroke; 13 import java.awt.Color; 14 import java.awt.Font; 13 15 import java.awt.Graphics2D; 16 import java.awt.Rectangle; 14 17 import java.awt.RenderingHints; 18 import java.awt.font.TextLayout; 15 19 import java.awt.geom.GeneralPath; 16 20 import java.awt.geom.Path2D; … … 25 29 import seamap.SeaMap; 26 30 import seamap.SeaMap.*; 31 import symbols.Areas; 27 32 import symbols.Symbols; 28 33 import symbols.Symbols.*; … … 69 74 public static double calcArea(Feature feature) { 70 75 if (feature.flag == Fflag.AREA) { 71 ArrayList<Long> way = map.ways.get(feature.refs); 76 ArrayList<Long> way; 77 if (map.mpolys.containsKey(feature.refs)) { 78 way = map.ways.get(map.mpolys.get(feature.refs)); 79 } else { 80 way = map.ways.get(feature.refs); 81 } 72 82 Coord coord = map.nodes.get(way.get(0)); 73 83 double llon = coord.lon; … … 89 99 public static Coord findCentroid(Feature feature) { 90 100 Coord coord; 91 ArrayList<Long> way = map.ways.get(feature.refs); 101 ArrayList<Long> way; 102 if (map.mpolys.containsKey(feature.refs)) { 103 way = map.ways.get(map.mpolys.get(feature.refs)); 104 } else { 105 way = map.ways.get(feature.refs); 106 } 92 107 switch (feature.flag) { 93 108 case NODE: … … 142 157 public static void lineVector (Feature feature, LineStyle style) { 143 158 if (feature.flag != Fflag.NODE) { 144 Long mpoly = map.outers.get(feature.refs);145 159 ArrayList<Long> ways = new ArrayList<Long>(); 146 if (m poly != null) {147 ways.addAll(map.mpolys.get(m poly));160 if (map.outers.containsKey(feature.refs)) { 161 ways.addAll(map.mpolys.get(map.outers.get(feature.refs))); 148 162 } else { 149 ways.add(feature.refs); 163 if (map.mpolys.containsKey(feature.refs)) { 164 ways.addAll(map.mpolys.get(feature.refs)); 165 } else { 166 ways.add(feature.refs); 167 } 150 168 } 151 169 Path2D.Double p = new Path2D.Double(); … … 168 186 System.arraycopy(style.dash, 0, dash, 0, style.dash.length); 169 187 for (int i = 0; i < style.dash.length; i++) { 170 dash[i] *= (float) (sScale);188 dash[i] *= (float) sScale; 171 189 } 172 190 g2.setStroke(new BasicStroke((float) (style.width * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1, dash, 0)); … … 184 202 } 185 203 186 public static void labelText (Feature feature, String str, TextStyle style, Delta delta) { 204 public static void labelText (Feature feature, String str, Font font, Delta delta) { 205 Symbol label = new Symbol(); 206 label.add(new Instr(Prim.FILL, Color.black)); 207 label.add(new Instr(Prim.TEXT, new Caption(str, font, delta))); 208 Point2D point = helper.getPoint(findCentroid(feature)); 209 Symbols.drawSymbol(g2, label, tScale, point.getX(), point.getY(), delta, null); 210 } 211 212 public static void lineText (Feature feature, String str, Font font, double offset, double dy) { 187 213 188 214 } 189 190 public static void lineText (Feature feature, String str, TextStyle style, double offset, Delta delta) {191 192 }193 215 } -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r29199 r29202 103 103 104 104 private static void shoreline(Feature feature) { 105 CatSLC cat = (CatSLC) Renderer.getAttVal(feature, feature.type, 0, Att.CATSLC);106 105 if (zoom >= 12) { 107 switch ( cat) {106 switch ((CatSLC) Renderer.getAttVal(feature, feature.type, 0, Att.CATSLC)) { 108 107 case SLC_TWAL: 109 108 WatLEV lev = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV); … … 111 110 Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); 112 111 if (zoom >= 15) 113 Renderer.lineText(feature, "(covers)", new TextStyle(newFont("Arial", Font.PLAIN, 80)), 0.5,new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 20)));112 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), 0.5, 20); 114 113 } else { 115 114 Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null)); 116 115 } 117 116 if (zoom >= 15) 118 Renderer.lineText(feature, "Training Wall", new TextStyle(newFont("Arial", Font.PLAIN, 80)), 0.5,new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -20)));117 Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), 0.5, -20); 119 118 } 120 119 } … … 149 148 AttItem name = feature.atts.get(Att.OBJNAM); 150 149 if ((zoom >= 10) && (name != null)) 151 Renderer.labelText(feature, (String) name.val, new TextStyle(newFont("Arial", Font.BOLD, 150)), null);150 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 150), null); 152 151 break; 153 152 case TSELNE: … … 171 170 } 172 171 if ((zoom >= 15) && (name != null)) 173 Renderer.labelText(feature, (String) name.val, new TextStyle(newFont("Arial", Font.BOLD, 80)), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));172 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 174 173 break; 175 174 case MARCUL: … … 196 195 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null)); 197 196 if ((zoom >= 12) && (name != null)) 198 Renderer.labelText(feature, (String) name.val, new TextStyle(newFont("Arial", Font.PLAIN, 100)), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 0)));197 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 0))); 199 198 break; 200 199 case RESARE: … … 210 209 Renderer.lineVector(feature, new LineStyle(Color.black, 20, new float[] { 40, 40 }, null)); 211 210 if ((zoom >= 15) && (name != null)) 212 Renderer.labelText(feature, (String) name.val, new TextStyle(newFont("Arial", Font.BOLD, 80)), new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10)));211 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10))); 213 212 } 214 213 break; 215 214 case SEAARE: 215 switch ((CatSEA) Renderer.getAttVal(feature, feature.type, 0, Att.CATSEA)) { 216 case SEA_RECH: 217 break; 218 case SEA_BAY: 219 break; 220 case SEA_SHOL: 221 break; 222 case SEA_GAT: 223 case SEA_NRRW: 224 break; 225 } 216 226 break; 217 227 case SNDWAV: -
applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
r29200 r29202 120 120 private Feature feature; 121 121 private ArrayList<Long> list; 122 private long mpid;123 122 124 123 public SeaMap() { … … 154 153 list = new ArrayList<Long>(); 155 154 mpolys.put(id, list); 156 mpid = id; 155 feature = new Feature(); 156 feature.refs = id; 157 feature.flag = Fflag.AREA; 157 158 } 158 159 … … 164 165 if (outer) { 165 166 list.add(0, way); 166 outers.put(way, mpid);167 outers.put(way, feature.refs); 167 168 } else { 168 169 list.add(way);
Note:
See TracChangeset
for help on using the changeset viewer.
