Changeset 30119 in osm
- Timestamp:
- 2013-12-08T20:52:05+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/s57/S57att.java
r30046 r30119 118 118 AttStr.put(Att.ELEVAT, "elevation"); AttStr.put(Att.ESTRNG, "estimated_range"); AttStr.put(Att.EXCLIT, "exhibition"); AttStr.put(Att.EXPSOU, "exposition"); 119 119 AttStr.put(Att.FUNCTN, "function"); AttStr.put(Att.HEIGHT, "height"); AttStr.put(Att.HUNITS, "units"); AttStr.put(Att.HORACC, "accuracy"); 120 AttStr.put(Att.HORCLR, "clearance"); AttStr.put(Att.HORLEN, "length"); AttStr.put(Att.HORWID, "width"); AttStr.put(Att.ICEFAC, "factor"); 120 AttStr.put(Att.HORCLR, "clearance_width"); AttStr.put(Att.HORLEN, "length"); AttStr.put(Att.HORWID, "width"); AttStr.put(Att.ICEFAC, "factor"); 121 121 AttStr.put(Att.INFORM, "information"); AttStr.put(Att.JRSDTN, "jurisdiction"); AttStr.put(Att.LIFCAP, "maximum_load"); AttStr.put(Att.LITCHR, "character"); 122 122 AttStr.put(Att.LITVIS, "visibility"); AttStr.put(Att.MARSYS, "system"); AttStr.put(Att.MLTYLT, "multiple"); AttStr.put(Att.NATION, "nationality"); … … 144 144 AttStr.put(Att.BUNVES, "availability"); AttStr.put(Att.CATBRT, "category"); AttStr.put(Att.CATBUN, "category"); AttStr.put(Att.CATCCL, "category"); 145 145 AttStr.put(Att.CATHBR, "category"); AttStr.put(Att.CATRFD, "category"); AttStr.put(Att.CATTML, "category"); AttStr.put(Att.COMCTN, "communication"); 146 AttStr.put(Att.HORCLL, "clearance_length"); AttStr.put(Att.HORCLW, "clearance_width"); AttStr.put(Att.TRSHGD, "goods"); AttStr.put(Att.UNLOCD, "locode"); 146 AttStr.put(Att.HORCLL, "horizontal_clearance_length"); AttStr.put(Att.HORCLW, "horizontal_clearance_width"); AttStr.put(Att.TRSHGD, "goods"); AttStr.put(Att.UNLOCD, "locode"); 147 147 AttStr.put(Att.CATGAG, "category"); AttStr.put(Att.HIGWAT, "high_value"); AttStr.put(Att.HIGNAM, "high_name"); AttStr.put(Att.LOWWAT, "low_value"); 148 148 AttStr.put(Att.LOWNAM, "low_name"); AttStr.put(Att.MEAWAT, "mean_value"); AttStr.put(Att.MEANAM, "mean_name"); AttStr.put(Att.OTHWAT, "local_value"); -
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r30046 r30119 28 28 29 29 public static final Color Yland = new Color(0x50b0ff); 30 public static final Color Mline = new Color(0x 80c480);30 public static final Color Mline = new Color(0xc480ff); 31 31 public static final Color Msymb = new Color(0xa30075); 32 32 … … 446 446 label.add(new Instr(Prim.PLIN, p)); 447 447 break; 448 case HCLR: 449 width += height * 1.5; 450 height *= 1.5; 451 if (width < height) width = height; 452 lx = -width / 2; 453 ly = -height / 2; 454 tx = lx + (height * 0.5); 455 ty = ly + (height * 0.17); 456 label.add(new Instr(Prim.BBOX, new Rectangle2D.Double(lx,ly,width,height))); 457 label.add(new Instr(Prim.FILL, bg)); 458 label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(lx,ly,width,height,height,height))); 459 label.add(new Instr(Prim.FILL, fg)); 460 sw = 1 + (int)(height/10); 461 double vo = height / 4; 462 label.add(new Instr(Prim.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 463 p = new Path2D.Double(); p.moveTo(-width*0.4-sw,-ly-vo); p.lineTo(-width*0.4-sw,ly+vo); p.moveTo(-width*0.4-sw,0); p.lineTo(-width*0.4+sw,0); 464 p.moveTo(width*0.4+sw,-ly-vo); p.lineTo(width*0.4+sw,ly+vo); p.moveTo(width*0.4-sw,0); p.lineTo(width*0.4+sw,0); 465 label.add(new Instr(Prim.PLIN, p)); 466 break; 448 467 default: 449 468 lx = -width / 2; -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r30046 r30119 33 33 AttItem name = feature.atts.get(Att.OBJNAM); 34 34 if (name == null) { 35 name = feature.objs.get(feature.type).get(0).get(Att.OBJNAM); 36 } 37 if (name != null) return (String)name.val; 38 return null; 35 AttMap atts = feature.objs.get(feature.type).get(0); 36 if (atts != null) { 37 name = atts.get(Att.OBJNAM); 38 } 39 } 40 return (name != null) ? (String)name.val: null; 39 41 } 40 42 … … 203 205 break; 204 206 case MARCUL: 205 if (zoom >= 14) 206 Renderer.symbol(feature, Areas.MarineFarm); 207 if (zoom >= 16) 208 Renderer.lineVector(feature, new LineStyle(Color.black, 4, new float[] { 10, 10 })); 207 if (zoom >= 12) { 208 if (zoom >= 14) { 209 Renderer.symbol(feature, Areas.MarineFarm); 210 } 211 if ((feature.area > 0.2) || ((feature.area > 0.05) && (zoom >= 14)) || ((feature.area > 0.005) && (zoom >= 16))) { 212 Renderer.lineVector(feature, new LineStyle(Color.black, 4, new float[] { 10, 10 })); 213 } 214 } 209 215 break; 210 216 case OSPARE: … … 219 225 if (zoom >= 12) { 220 226 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Renderer.Mline); 221 if (testAttribute(feature, feature.type, Att.CAT PRA, CatREA.REA_NWAK)) {227 if (testAttribute(feature, feature.type, Att.CATREA, CatREA.REA_NWAK)) { 222 228 Renderer.symbol(feature, Areas.NoWake); 223 229 } … … 277 283 case SPLARE: 278 284 if (zoom >= 12) { 279 Renderer.symbol(feature, Areas.Plane); 285 Renderer.symbol(feature, Areas.Plane, new Scheme(Renderer.Msymb)); 280 286 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Renderer.Mline); 281 287 } … … 327 333 private static void bridges(Feature feature) { 328 334 if (zoom >= 16) { 329 double verclr, verccl, vercop; 335 double verclr, verccl, vercop, horclr; 330 336 AttMap atts = feature.objs.get(Obj.BRIDGE).get(0); 331 String str = ""; 337 String vstr = ""; 338 String hstr = ""; 332 339 if (atts != null) { 333 if (atts.containsKey(Att.VERCLR)) { 334 verclr = (Double) atts.get(Att.VERCLR).val; 340 if (atts.containsKey(Att.HORCLR)) { 341 horclr = (Double) atts.get(Att.HORCLR).val; 342 hstr = String.valueOf(horclr); 343 } 344 if (atts.containsKey(Att.VERCLR)) { 345 verclr = (Double) atts.get(Att.VERCLR).val; 335 346 } else { 336 347 verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0; … … 339 350 vercop = atts.containsKey(Att.VERCOP) ? (Double) atts.get(Att.VERCOP).val : 0; 340 351 if (verclr > 0) { 341 str += String.valueOf(verclr); 352 vstr += String.valueOf(verclr); 342 353 } else if (verccl > 0) { 343 354 if (vercop == 0) { 344 str += String.valueOf(verccl) + "/-"; 355 vstr += String.valueOf(verccl) + "/-"; 345 356 } else { 346 str += String.valueOf(verccl) + "/" + String.valueOf(vercop); 357 vstr += String.valueOf(verccl) + "/" + String.valueOf(vercop); 347 358 } 348 359 } 349 if (!str.isEmpty()) 350 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC)); 360 if (hstr.isEmpty() && !vstr.isEmpty()) { 361 Renderer.labelText(feature, vstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC)); 362 } else if (!hstr.isEmpty() && !vstr.isEmpty()) { 363 Renderer.labelText(feature, vstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC)); 364 Renderer.labelText(feature, hstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC)); 365 } else if (!hstr.isEmpty() && vstr.isEmpty()) { 366 Renderer.labelText(feature, hstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC)); 367 } 351 368 } 352 369 } -
applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
r29995 r30119 22 22 23 23 public enum Nflag { 24 ANON, ISOL, CONN 25 } 26 27 public class Snode { 28 public double lat; 29 public double lon; 30 public Nflag flg; 24 ANON, // Edge inner nodes 25 ISOL, // Node not part of Edge 26 CONN // Edge first and last nodes 27 } 28 29 public class Snode { // All coordinates in map 30 public double lat; // Latitude 31 public double lon; // Longitude 32 public Nflag flg; // Role of node 31 33 32 34 public Snode() { … … 35 37 lon = 0; 36 38 } 37 38 39 public Snode(double ilat, double ilon) { 39 40 flg = Nflag.ANON; … … 41 42 lon = ilon; 42 43 } 43 44 44 public Snode(double ilat, double ilon, Nflag iflg) { 45 45 lat = ilat; … … 49 49 } 50 50 51 public class Edge { 52 public boolean forward; 53 public long first; 54 public long last; 55 public ArrayList<Long> nodes; 51 public class Edge { // A polyline segment 52 public long first; // First CONN node 53 public long last; // Last CONN node 54 public ArrayList<Long> nodes; // Inner ANON nodes 56 55 57 56 public Edge() { 58 forward = true;59 57 first = 0; 60 58 last = 0; … … 63 61 } 64 62 65 public class Side { 66 Edge edge; 67 boolean forward; 63 public class Side { // An edge as used in a line or area feature 64 Edge edge; // Side is formed by this Edge... 65 boolean forward; // ... in this direction 68 66 69 67 public Side(Edge iedge, boolean ifwd) { … … 73 71 } 74 72 75 public class Bound { 76 public boolean outer; 77 ArrayList<Side> sides; 73 public class Bound { // A single closed area 74 public boolean outer; // Role 75 ArrayList<Side> sides; // Sides that make up this area 78 76 79 77 public Bound() { … … 81 79 sides = new ArrayList<Side>(); 82 80 } 83 84 81 public Bound(Side iside, boolean irole) { 85 82 outer = irole; … … 89 86 } 90 87 91 public class Area extends ArrayList<Bound> { 88 public class Area extends ArrayList<Bound> { // The collection of bounds for an area. 92 89 public Area() { 93 90 super(); … … 389 386 nodes.get(edge.first).flg = Nflag.CONN; 390 387 nodes.get(edge.last).flg = Nflag.CONN; 391 Bound ebound = (new Bound(new Side(edge, edge.forward), true));388 Bound ebound = (new Bound(new Side(edge, true), true)); 392 389 feature.length = calcLength(ebound); 393 390 if (edge.first == edge.last) { … … 410 407 long node1 = edge.first; 411 408 long node2 = edge.last; 412 bound = new Bound(new Side(edge, edge.forward), (role == outers));409 bound = new Bound(new Side(edge, true), (role == outers)); 413 410 if (node1 != node2) { 414 411 for (ListIterator<Long> it = role.listIterator(0); it.hasNext();) { … … 551 548 } else { 552 549 double arc = (Math.acos(Math.cos(lon - llon) * Math.cos(lat - llat))); 553 slat += ( lat* arc);554 slon += ( lon* arc);550 slat += ((lat + llat) / 2 * arc); 551 slon += ((lon + llon) / 2 * arc); 555 552 sarc += arc; 556 553 } -
applications/editors/josm/plugins/smed2/src/symbols/Areas.java
r30033 r30119 65 65 public static final Symbol LinePlane = new Symbol(); 66 66 static { 67 LinePlane.add(new Instr(Prim.BBOX, new Rectangle2D.Double(-30,-60,60,90))); 67 68 LinePlane.add(new Instr(Prim.FILL, new Color(0xc480ff))); 68 69 LinePlane.add(new Instr(Prim.SYMB, new Symbols.SubSymbol(Areas.Plane, 0.5, 0, 0, null, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(-90.0))))));
Note:
See TracChangeset
for help on using the changeset viewer.