Changeset 30020 in osm for applications/editors/josm/plugins/smed2/src/seamap
- Timestamp:
- 2013-10-12T12:50:40+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/seamap
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29992 r30020 13 13 import java.awt.font.*; 14 14 import java.awt.geom.*; 15 import java.awt.image.*; 15 16 import java.util.*; 16 17 … … 270 271 } 271 272 } 273 274 public static void fillPattern(Feature feature, BufferedImage image) { 275 Path2D.Double p = new Path2D.Double(); 276 p.setWindingRule(GeneralPath.WIND_EVEN_ODD); 277 Point2D point; 278 switch (feature.flag) { 279 case POINT: 280 point = helper.getPoint(feature.centre); 281 g2.drawImage(image, new AffineTransformOp(AffineTransform.getScaleInstance(sScale, sScale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR), 282 (int)(point.getX() - (50 * sScale)), (int)(point.getY() - (50 * sScale))); 283 break; 284 case AREA: 285 for (Bound bound : map.areas.get(feature.refs)) { 286 BoundIterator bit = map.new BoundIterator(bound); 287 point = helper.getPoint(bit.next()); 288 p.moveTo(point.getX(), point.getY()); 289 while (bit.hasNext()) { 290 point = helper.getPoint(bit.next()); 291 p.lineTo(point.getX(), point.getY()); 292 } 293 } 294 g2.setPaint(new TexturePaint(image, new Rectangle(0, 0, 1 + (int)(100 * sScale), 1 + (int)(100 * sScale)))); 295 g2.fill(p); 296 break; 297 } 298 } 272 299 273 300 public static void labelText(Feature feature, String str, Font font, Color colour, Delta delta) { -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r29992 r30020 105 105 AttItem name = feature.atts.get(Att.OBJNAM); 106 106 switch (feature.type) { 107 case SPLARE: 108 if (zoom >= 12) { 109 Renderer.symbol(feature, Areas.Plane, Obj.SPLARE, null, null); 110 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, 10); 111 } 112 if ((zoom >= 15) && (name != null)) 113 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 114 break; 115 case MARCUL: 116 if (zoom >= 14) 117 Renderer.symbol(feature, Areas.MarineFarm, Obj.MARCUL, null, null); 118 if (zoom >= 16) 119 Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null)); 107 case DRGARE: 108 if (zoom < 16) 109 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true))); 110 else 111 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null)); 112 if ((zoom >= 12) && (name != null)) 113 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), Color.black, null); 120 114 break; 121 115 case FAIRWY: … … 130 124 } 131 125 break; 132 case DRGARE: 133 if (zoom < 16) 134 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true))); 135 else 136 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null)); 137 if ((zoom >= 12) && (name != null)) 138 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), Color.black, null); 139 break; 140 case RESARE: 141 if (zoom >= 12) { 142 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, 0); 143 // if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK) 144 // Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null); 145 } 126 case MARCUL: 127 if (zoom >= 14) 128 Renderer.symbol(feature, Areas.MarineFarm, Obj.MARCUL, null, null); 129 if (zoom >= 16) 130 Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null)); 146 131 break; 147 132 case OSPARE: … … 153 138 } 154 139 break; 140 case RESARE: 141 if (zoom >= 12) { 142 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, 0); 143 // if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK) 144 // Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null); 145 } 146 break; 155 147 case SEAARE: 156 148 switch ((CatSEA) Renderer.getAttVal(feature, feature.type, 0, Att.CATSEA)) { … … 166 158 } 167 159 break; 168 case SNDWAV:169 // if (zoom>=12)) area("fill:url(#sandwaves)");170 break;171 }172 160 /* 173 161 if (is_type("sea_area")) { … … 205 193 } 206 194 */ 207 } 195 case SNDWAV: 196 if (zoom >= 12) Renderer.fillPattern(feature, Areas.Sandwaves); 197 break; 198 case SPLARE: 199 if (zoom >= 12) { 200 Renderer.symbol(feature, Areas.Plane, Obj.SPLARE, null, null); 201 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, 10); 202 } 203 if ((zoom >= 15) && (name != null)) 204 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 205 break; 206 } 207 } 208 208 209 private static void beacons(Feature feature) { 209 210 BcnSHP shape = (BcnSHP) Renderer.getAttVal(feature, feature.type, 0, Att.BCNSHP);
Note:
See TracChangeset
for help on using the changeset viewer.