Changeset 30123 in osm for applications
- Timestamp:
- 2013-12-10T22:02:45+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r30119 r30123 20 20 import seamap.SeaMap.*; 21 21 import seamap.SeaMap.Area; 22 import symbols.Areas; 23 import symbols.Harbours; 22 24 import symbols.Symbols; 23 25 import symbols.Symbols.*; … … 62 64 } 63 65 64 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, HCLR } 66 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, PCLR, HCLR } 65 67 66 68 static MapContext context; … … 446 448 label.add(new Instr(Prim.PLIN, p)); 447 449 break; 450 case PCLR: 451 width += height * 1.0; 452 height *= 2.0; 453 if (width < height) width = height; 454 lx = -width / 2; 455 ly = -height / 2; 456 tx = lx + (height * 0.27); 457 ty = ly + (height * 0.25); 458 label.add(new Instr(Prim.BBOX, new Rectangle2D.Double(lx,ly,width,height))); 459 label.add(new Instr(Prim.FILL, bg)); 460 label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(lx,ly,width,height,height,height))); 461 label.add(new Instr(Prim.FILL, fg)); 462 sw = 1 + (int)(height/10); 463 po = sw / 2; 464 label.add(new Instr(Prim.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 465 p = new Path2D.Double(); p.moveTo(-height*0.2,-ly-po); p.lineTo(height*0.2,-ly-po); p.moveTo(0,-ly-po); p.lineTo(0,-ly-po-(height*0.15)); 466 p.moveTo(-height*0.2,ly+po); p.lineTo((height*0.2),ly+po); p.moveTo(0,ly+po); p.lineTo(0,ly+po+(height*0.15)); 467 label.add(new Instr(Prim.PLIN, p)); 468 label.add(new Instr(Prim.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, new Delta(Handle.CC, new AffineTransform(0,-1,1,0,-width/2,0))))); 469 label.add(new Instr(Prim.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, new Delta(Handle.CC, new AffineTransform(0,-1,1,0,width/2,0))))); 470 break; 448 471 case HCLR: 449 472 width += height * 1.5; -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r30120 r30123 381 381 Renderer.lineSymbols(feature, Areas.CableDash, 0, Areas.CableDot, null, 2, Color.black); 382 382 } 383 if (atts != null) { 384 if (atts.containsKey(Att.VERCLR)) { 385 Renderer.labelText(feature, String.valueOf((Double) atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25))); 386 } else if (atts.containsKey(Att.VERCSA)) { 387 Renderer.labelText(feature, String.valueOf((Double) atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25))); 388 } 389 } 383 390 } 384 391 } … … 876 883 877 884 private static void pipelines(Feature feature) { 878 if (zoom >= 1 4) {885 if ((zoom >= 16) && (feature.length < 2)) { 879 886 if (feature.type == Obj.PIPSOL) { 880 887 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Renderer.Mline); 881 888 } else if (feature.type == Obj.PIPOHD) { 882 889 Renderer.lineVector(feature, new LineStyle(Color.black, 8)); 890 AttMap atts = feature.objs.get(Obj.PIPOHD).get(0); 891 double verclr = 0; 892 if (atts != null) { 893 if (atts.containsKey(Att.VERCLR)) { 894 verclr = (Double) atts.get(Att.VERCLR).val; 895 } else { 896 verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0; 897 } 898 if (verclr > 0) { 899 Renderer.labelText(feature, String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25))); 900 } 901 } 883 902 } 884 903 } … … 961 980 private static void stations(Feature feature) { 962 981 if (zoom >= 14) { 982 String str = ""; 963 983 switch (feature.type) { 964 984 case SISTAT: 965 985 case SISTAW: 966 986 Renderer.symbol(feature, Harbours.SignalStation); 967 Stringstr = "SS";987 str = "SS"; 968 988 // Append (cat) to str 969 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(30, 0)));970 989 break; 971 990 case RDOSTA: … … 982 1001 case CGUSTA: 983 1002 Renderer.symbol(feature, Harbours.SignalStation); 984 Renderer.labelText(feature, "CG", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(30, 0)));1003 str = "CG"; 985 1004 break; 986 1005 case RSCSTA: 987 1006 Renderer.symbol(feature, Harbours.Rescue); 988 1007 break; 1008 } 1009 if ((zoom >= 15) && !str.isEmpty()) { 1010 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(30, 0))); 989 1011 } 990 1012 } -
applications/editors/josm/plugins/smed2/src/seamap/Signals.java
r30046 r30123 15 15 import java.util.ArrayList; 16 16 17 import s57.S57att. Att;18 import s57.S57obj. Obj;19 import s57.S57val. CatROS;20 import seamap.Renderer. LabelStyle;17 import s57.S57att.*; 18 import s57.S57obj.*; 19 import s57.S57val.*; 20 import seamap.Renderer.*; 21 21 import seamap.SeaMap.*; 22 22 import symbols.Beacons; 23 23 import symbols.Topmarks; 24 import symbols.Symbols.Delta; 25 import symbols.Symbols.Handle; 24 import symbols.Symbols.*; 26 25 27 26 public class Signals { 28 27 29 28 public static void addSignals(Feature feature) { 30 if (feature.objs.containsKey(Obj.FOGSIG)) Signals.fogSignals(feature);31 if (feature.objs.containsKey(Obj.RTPBCN)) Signals.radarStations(feature);32 if (feature.objs.containsKey(Obj.RADSTA)) Signals.radarStations(feature);33 if (feature.objs.containsKey(Obj.RDOSTA)) Signals.radioStations(feature);34 if (feature.objs.containsKey(Obj.LIGHTS)) Signals.lights(feature);29 if (feature.objs.containsKey(Obj.FOGSIG)) fogSignals(feature); 30 if (feature.objs.containsKey(Obj.RTPBCN)) radarStations(feature); 31 if (feature.objs.containsKey(Obj.RADSTA)) radarStations(feature); 32 if (feature.objs.containsKey(Obj.RDOSTA)) radioStations(feature); 33 if (feature.objs.containsKey(Obj.LIGHTS)) lights(feature); 35 34 } 36 35 … … 41 40 public static void radarStations(Feature feature) { 42 41 Renderer.symbol(feature, Beacons.RadarStation); 42 String bstr = ""; 43 CatRTB cat = (CatRTB) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.CATRTB); 44 switch (cat) { 45 case RTB_RAMK: 46 bstr += " Ramark"; 47 break; 48 case RTB_RACN: 49 bstr += " Racon"; 50 String astr = (String) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGGRP); 51 if (!astr.isEmpty()) { 52 bstr += "(" + astr + ")"; 53 } 54 Double per = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGPER); 55 Double mxr = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.VALMXR); 56 if ((per != 0) || (mxr != 0)) { 57 bstr += (astr.isEmpty() ? " " : ""); 58 bstr += (per != 0) ? per.toString() + "s" : ""; 59 bstr += (mxr != 0) ? mxr.toString() + "M" : ""; 60 } 61 break; 62 default: 63 break; 64 } 65 if ((Renderer.zoom >= 15) && !bstr.isEmpty()) { 66 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -30))); 67 } 68 } 69 70 public static void radioStations(Feature feature) { 71 Renderer.symbol(feature, Beacons.RadarStation); 43 72 ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttVal(feature, Obj.RDOSTA, 0, Att.CATROS); 44 String str = ""; 73 boolean vais = false; 74 String bstr = ""; 45 75 for (CatROS ros : cats) { 46 76 switch (ros) { 47 77 case ROS_OMNI: 48 str += " RC"; 78 bstr += " RC"; 49 79 break; 50 80 case ROS_DIRL: 51 str += " RD"; 81 bstr += " RD"; 52 82 break; 53 83 case ROS_ROTP: 54 str += " RW"; 84 bstr += " RW"; 55 85 break; 56 86 case ROS_CNSL: 57 str += " Consol"; 87 bstr += " Consol"; 58 88 break; 59 89 case ROS_RDF: 60 str += " RG"; 90 bstr += " RG"; 61 91 break; 62 92 case ROS_QTA: 63 str += " R"; 93 bstr += " R"; 64 94 break; 65 95 case ROS_AERO: 66 str += " AeroRC"; 96 bstr += " AeroRC"; 67 97 break; 68 98 case ROS_DECA: 69 str += " Decca"; 99 bstr += " Decca"; 70 100 break; 71 101 case ROS_LORN: 72 str += " Loran"; 102 bstr += " Loran"; 73 103 break; 74 104 case ROS_DGPS: 75 str += " DGPS"; 105 bstr += " DGPS"; 76 106 break; 77 107 case ROS_TORN: 78 str += " Toran"; 108 bstr += " Toran"; 79 109 break; 80 110 case ROS_OMGA: 81 str += " Omega"; 111 bstr += " Omega"; 82 112 break; 83 113 case ROS_SYLD: 84 str += " Syledis"; 114 bstr += " Syledis"; 85 115 break; 86 116 case ROS_CHKA: 87 str += " Chiaka"; 117 bstr += " Chiaka"; 88 118 break; 89 119 case ROS_PCOM: … … 94 124 case ROS_PAIS: 95 125 case ROS_SAIS: 96 str += " AIS"; 126 bstr += " AIS"; 97 127 break; 98 128 case ROS_VAIS: 99 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));129 vais = true; 100 130 break; 101 131 case ROS_VANC: 102 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));132 vais = true; 103 133 Renderer.symbol(feature, Topmarks.TopNorth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 104 134 break; 105 135 case ROS_VASC: 106 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));136 vais = true; 107 137 Renderer.symbol(feature, Topmarks.TopSouth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 108 138 break; 109 139 case ROS_VAEC: 110 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));140 vais = true; 111 141 Renderer.symbol(feature, Topmarks.TopEast, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 112 142 break; 113 143 case ROS_VAWC: 114 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));144 vais = true; 115 145 Renderer.symbol(feature, Topmarks.TopWest, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 116 146 break; 117 147 case ROS_VAPL: 118 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));148 vais = true; 119 149 Renderer.symbol(feature, Topmarks.TopCan, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 120 150 break; 121 151 case ROS_VASL: 122 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));152 vais = true; 123 153 Renderer.symbol(feature, Topmarks.TopCone, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 124 154 break; 125 155 case ROS_VAID: 126 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));156 vais = true; 127 157 Renderer.symbol(feature, Topmarks.TopIsol, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 128 158 break; 129 159 case ROS_VASW: 130 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));160 vais = true; 131 161 Renderer.symbol(feature, Topmarks.TopSphere, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 132 162 break; 133 163 case ROS_VASP: 134 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));164 vais = true; 135 165 Renderer.symbol(feature, Topmarks.TopX, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 136 166 break; 137 167 case ROS_VAWK: 138 Renderer.labelText(feature, " V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));168 vais = true; 139 169 Renderer.symbol(feature, Topmarks.TopCross, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25))); 140 170 break; … … 143 173 } 144 174 } 145 if (!str.isEmpty()) Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -70))); 146 } 147 148 public static void radioStations(Feature feature) { 149 175 if (Renderer.zoom >= 15) { 176 if (vais) { 177 Renderer.labelText(feature, "V-AIS", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70))); 178 } 179 if (!bstr.isEmpty()) { 180 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -70))); 181 } 182 } 150 183 } 151 184 … … 334 367 if ((att = getAtt(obj, CATFOG)) != NULL) 335 368 strcat(string1, fog_signals[att->val.val.e]); 336 if ((att = getAtt(obj, SIGGRP)) != NULL)337 sprintf(strchr(string1, 0), "(%s)", stringValue(att->val));338 else339 strcat(string1, " ");340 if ((att = getAtt(obj, SIGPER)) != NULL)341 sprintf(strchr(string1, 0), "%ss ", stringValue(att->val));342 if ((att = getAtt(obj, VALMXR)) != NULL)343 sprintf(strchr(string1, 0), "%sM", stringValue(att->val));344 }345 break;346 case RTPBCN:347 if (obj != NULL) {348 if ((att = getAtt(obj, CATRTB)) != NULL)349 strcat(string1, rtb_map[att->val.val.e]);350 369 if ((att = getAtt(obj, SIGGRP)) != NULL) 351 370 sprintf(strchr(string1, 0), "(%s)", stringValue(att->val)); -
applications/editors/josm/plugins/smed2/src/smed2/MapImage.java
r30033 r30123 92 92 width = Main.map.mapView.getBounds().getWidth(); 93 93 height = Main.map.mapView.getBounds().getHeight(); 94 zoom = ((int) Math.min(18, Math.max(9, Math.round(Math.floor(Math.log( 4096/ bounds.asRect().width) / Math.log(2))))));94 zoom = ((int) Math.min(18, Math.max(9, Math.round(Math.floor(Math.log(1024 / bounds.asRect().height) / Math.log(2)))))); 95 95 } 96 96 }
Note:
See TracChangeset
for help on using the changeset viewer.