Changeset 29185 in osm for applications/editors
- Timestamp:
- 2013-01-10T00:56:38+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29184 r29185 54 54 public static Object getAttVal(Feature feature, Obj obj, int idx, Att att) { 55 55 AttMap atts = getAtts(feature, obj, idx); 56 if (atts == null) return 56 if (atts == null) return S57val.nullVal(att); 57 57 else { 58 58 AttItem item = atts.get(att); … … 62 62 } 63 63 64 public static double calcArea(Feature feature) { 65 if (feature.flag == Fflag.AREA) { 66 ArrayList<Long> way = map.ways.get(feature.refs); 67 Coord coord = map.nodes.get(way.get(0)); 68 double llat = coord.lat; 69 double llon = coord.lon; 70 double area = 0.0; 71 for (long node : way) { 72 coord = map.nodes.get(node); 73 area += ((llon * coord.lat) - (llat * coord.lon)); 74 llat = coord.lat; 75 llon = coord.lon; 76 } 77 return Math.abs(area) / 2.0 * 60.0 * 60.0; 78 } 79 return 0.0; 80 } 81 64 82 public static Coord findCentroid(Feature feature) { 83 Coord coord; 84 ArrayList<Long> way = map.ways.get(feature.refs); 85 switch (feature.flag) { 86 case NODE: 87 return map.nodes.get(feature.refs); 88 case WAY: 89 coord = map.nodes.get(way.get(1)); 90 break; 91 case AREA: 92 default: 93 coord = map.nodes.get(way.get(0)); 94 } 95 double slat = 0.0; 65 96 double slon = 0.0; 66 double slat = 0.0;67 97 double sarc = 0.0; 68 double llon = 0.0; 69 double llat = 0.0; 70 if (feature.flag == Fflag.NODE) { 71 return map.nodes.get(feature.refs); 72 } 73 ArrayList<Long> way = map.ways.get(feature.refs); 74 if (feature.flag == Fflag.WAY) { 75 llon = map.nodes.get(way.get(1)).lon; 76 llat = map.nodes.get(way.get(1)).lat; 77 } else { 78 llon = map.nodes.get(way.get(0)).lon; 79 llat = map.nodes.get(way.get(0)).lat; 80 } 98 double llat = coord.lat; 99 double llon = coord.lon; 81 100 for (long node : way) { 82 double lon = map.nodes.get(node).lon; 83 double lat = map.nodes.get(node).lat; 101 coord = map.nodes.get(node); 102 double lon = coord.lon; 103 double lat = coord.lat; 84 104 double arc = Math.sqrt(Math.pow((lon-llon), 2) + Math.pow((lat-llat), 2)); 105 slat += (lat * arc); 85 106 slon += (lon * arc); 86 slat += (lat * arc);87 107 sarc += arc; 108 llat = lat; 88 109 llon = lon; 89 llat = lat;90 110 } 91 111 return map.new Coord((sarc > 0.0 ? slat/sarc : 0.0), (sarc > 0.0 ? slon/sarc : 0.0)); -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r29184 r29185 123 123 ArrayList<Instr> fncSym = Landmarks.Funcs.get(fncs.get(0)); 124 124 if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR)) catSym = Landmarks.ChurchTower; 125 if ((cats.get(0) == CatLMK.LMK_UNKN) && (fncs.get(0) == FncFNC.FNC_UNKN)) catSym = Beacons.LightMajor; 125 if ((cats.get(0) == CatLMK.LMK_UNKN) && (fncs.get(0) == FncFNC.FNC_UNKN) && (feature.objs.get(Obj.LIGHTS) != null)) catSym = Beacons.LightMajor; 126 if (cats.get(0) == CatLMK.LMK_RADR) fncSym = Landmarks.RadioTV; 126 127 Renderer.symbol(feature, catSym, feature.type); 127 128 Renderer.symbol(feature, fncSym, feature.type); -
applications/editors/josm/plugins/smed2/src/symbols/Beacons.java
r29176 r29185 12 12 import java.awt.BasicStroke; 13 13 import java.awt.Color; 14 import java.awt.geom.Arc2D; 14 15 import java.awt.geom.Ellipse2D; 15 16 import java.awt.geom.GeneralPath; … … 61 62 Cairn.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-18,-70,36,36))); 62 63 } 64 public static final ArrayList<Instr> FogSignal = new ArrayList<Instr>(); 65 static { 66 FogSignal.add(new Instr(Prim.STRK, new BasicStroke(3.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND))); 67 FogSignal.add(new Instr(Prim.FILL, Color.black)); 68 FogSignal.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-10,-10,20,20))); 69 FogSignal.add(new Instr(Prim.STRK, new BasicStroke(10.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND))); 70 FogSignal.add(new Instr(Prim.FILL, new Color(0xd400d4))); 71 FogSignal.add(new Instr(Prim.EARC, new Arc2D.Double(-120.0,-120.0,240.0,240.0,190.0,50.0,Arc2D.OPEN))); 72 FogSignal.add(new Instr(Prim.EARC, new Arc2D.Double(-92.5,-92.5,185.0,185.0,190.0,50.0,Arc2D.OPEN))); 73 FogSignal.add(new Instr(Prim.EARC, new Arc2D.Double(-65.0,-65.0,130.0,130.0,190.0,50.0,Arc2D.OPEN))); 74 } 75 public static final ArrayList<Instr> LightFlare = new ArrayList<Instr>(); 76 static { 77 LightFlare.add(new Instr(Prim.RSHP, new Ellipse2D.Double(-3,-3,6,6))); 78 Path2D.Double p = new Path2D.Double(); 79 p.moveTo(0.0,-25.0); p.lineTo(15.0,-95.0); p.curveTo(20.0,-123.0,-20.0,-123.0,-15.0,-95.0); 80 p.closePath(); 81 LightFlare.add(new Instr(Prim.PGON, p)); 82 } 63 83 public static final ArrayList<Instr> LightMajor = new ArrayList<Instr>(); 64 84 static { … … 95 115 PerchStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-25,-40,0,-68.7))); 96 116 } 117 public static final ArrayList<Instr> RadarStation = new ArrayList<Instr>(); 118 static { 119 RadarStation.add(new Instr(Prim.STRK, new BasicStroke(2.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND))); 120 RadarStation.add(new Instr(Prim.FILL, new Color(0xd400d4))); 121 RadarStation.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-125,-125,250,250))); 122 } 97 123 public static final ArrayList<Instr> Stake = new ArrayList<Instr>(); 98 124 static { … … 111 137 p = new Path2D.Double(); p.moveTo(-2.0,-17.5); p.lineTo(-2.0,-35.0); p.lineTo(2.0,-35.0); p.lineTo(2.0,-17.5); p.closePath(); 112 138 colours.add(new Instr(Prim.H5, p)); 113 139 Stake.add(new Instr(Prim.COLR, colours)); 114 140 Stake.add(new Instr(Prim.FILL, Color.black)); 115 141 Stake.add(new Instr(Prim.LINE, new Line2D.Double(-10,0,10,0))); -
applications/editors/josm/plugins/smed2/src/symbols/Landmarks.java
r29176 r29185 122 122 Mast.add(new Instr(Prim.PLIN, p)); 123 123 } 124 public static final ArrayList<Instr> RadioMast = new ArrayList<Instr>();125 static {126 RadioMast.add(new Instr(Prim.SYMB, new Symbols.Symbol(Landmarks.Mast, 1.0, 0, 0, null, null)));127 RadioMast.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)));128 RadioMast.add(new Instr(Prim.FILL, Color.black));129 RadioMast.add(new Instr(Prim.EARC, new Arc2D.Double(-30.0,-180.0,60.0,60.0,45.0,-90.0,Arc2D.OPEN)));130 RadioMast.add(new Instr(Prim.EARC, new Arc2D.Double(-45.0,-195.0,90.0,90.0,45.0,-90.0,Arc2D.OPEN)));131 RadioMast.add(new Instr(Prim.EARC, new Arc2D.Double(-30.0,-180.0,60.0,60.0,225.0,-90.0,Arc2D.OPEN)));132 RadioMast.add(new Instr(Prim.EARC, new Arc2D.Double(-45.0,-195.0,90.0,90.0,225.0,-90.0,Arc2D.OPEN)));133 }134 124 public static final ArrayList<Instr> Monument = new ArrayList<Instr>(); 135 125 static { … … 147 137 Platform.add(new Instr(Prim.RECT, new Rectangle2D.Double(-48,-48,96,96))); 148 138 Platform.add(new Instr(Prim.RSHP, new Ellipse2D.Double(-4,-4,8,8))); 139 } 140 public static final ArrayList<Instr> RadioTV = new ArrayList<Instr>(); 141 static { 142 RadioTV.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL))); 143 RadioTV.add(new Instr(Prim.FILL, Color.black)); 144 RadioTV.add(new Instr(Prim.EARC, new Arc2D.Double(-30.0,-180.0,60.0,60.0,45.0,-90.0,Arc2D.OPEN))); 145 RadioTV.add(new Instr(Prim.EARC, new Arc2D.Double(-45.0,-195.0,90.0,90.0,45.0,-90.0,Arc2D.OPEN))); 146 RadioTV.add(new Instr(Prim.EARC, new Arc2D.Double(-30.0,-180.0,60.0,60.0,225.0,-90.0,Arc2D.OPEN))); 147 RadioTV.add(new Instr(Prim.EARC, new Arc2D.Double(-45.0,-195.0,90.0,90.0,225.0,-90.0,Arc2D.OPEN))); 149 148 } 150 149 public static final ArrayList<Instr> Spire = new ArrayList<Instr>(); … … 220 219 Shapes.put(CatLMK.LMK_CLMN, Landmarks.Monument); Shapes.put(CatLMK.LMK_MEML, Landmarks.Monument); Shapes.put(CatLMK.LMK_OBLK, Landmarks.Monument); 221 220 Shapes.put(CatLMK.LMK_STAT, Landmarks.Monument); Shapes.put(CatLMK.LMK_CROS, Landmarks.Cross); Shapes.put(CatLMK.LMK_DOME, Landmarks.Dome); 222 Shapes.put(CatLMK.LMK_RADR, Landmarks. RadioMast); Shapes.put(CatLMK.LMK_TOWR, Landmarks.LandTower); Shapes.put(CatLMK.LMK_WNDM, Landmarks.Windmill);221 Shapes.put(CatLMK.LMK_RADR, Landmarks.Mast); Shapes.put(CatLMK.LMK_TOWR, Landmarks.LandTower); Shapes.put(CatLMK.LMK_WNDM, Landmarks.Windmill); 223 222 Shapes.put(CatLMK.LMK_WNDG, Landmarks.WindMotor); Shapes.put(CatLMK.LMK_SPIR, Landmarks.Spire); Shapes.put(CatLMK.LMK_BLDR, Beacons.Cairn); 224 223 Shapes.put(CatLMK.LMK_MNRT, Landmarks.Minaret); Shapes.put(CatLMK.LMK_WTRT, Landmarks.WaterTower); … … 229 228 Funcs.put(FncFNC.FNC_CHCH, Landmarks.Church); Funcs.put(FncFNC.FNC_CHPL, Landmarks.Church); Funcs.put(FncFNC.FNC_TMPL, Landmarks.Temple); 230 229 Funcs.put(FncFNC.FNC_PGDA, Landmarks.Temple); Funcs.put(FncFNC.FNC_SHSH, Landmarks.Temple); Funcs.put(FncFNC.FNC_BTMP, Landmarks.Temple); 231 Funcs.put(FncFNC.FNC_MOSQ, Landmarks.Minaret); Funcs.put(FncFNC.FNC_MRBT, Landmarks.Spire); Funcs.put(FncFNC.FNC_COMM, Landmarks.Radio Mast);232 Funcs.put(FncFNC.FNC_TV, Landmarks.Radio Mast); Funcs.put(FncFNC.FNC_RADO, Landmarks.RadioMast); Funcs.put(FncFNC.FNC_RADR, Landmarks.RadioMast);233 Funcs.put(FncFNC.FNC_LGHT, Beacons.LightMajor); Funcs.put(FncFNC.FNC_MCWV, Landmarks.Radio Mast);230 Funcs.put(FncFNC.FNC_MOSQ, Landmarks.Minaret); Funcs.put(FncFNC.FNC_MRBT, Landmarks.Spire); Funcs.put(FncFNC.FNC_COMM, Landmarks.RadioTV); 231 Funcs.put(FncFNC.FNC_TV, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_RADO, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_RADR, Landmarks.RadioTV); 232 Funcs.put(FncFNC.FNC_LGHT, Beacons.LightMajor); Funcs.put(FncFNC.FNC_MCWV, Landmarks.RadioTV); 234 233 } 235 234 } -
applications/editors/josm/plugins/smed2/src/symbols/Topmarks.java
r29126 r29185 13 13 import java.awt.Color; 14 14 import java.awt.Rectangle; 15 import java.awt.geom.AffineTransform; 15 16 import java.awt.geom.Ellipse2D; 16 17 import java.awt.geom.Line2D; 17 18 import java.awt.geom.Path2D; 18 19 import java.util.ArrayList; 19 20 import symbols.Symbols.Instr; 21 import symbols.Symbols.Prim; 20 import java.util.EnumMap; 21 22 import s57.S57val.*; 23 import symbols.Symbols.*; 22 24 23 25 public class Topmarks { … … 226 228 TopX.add(new Instr(Prim.PLIN, p)); 227 229 } 230 231 public static final EnumMap<BoySHP, Delta> Buoys = new EnumMap<BoySHP, Delta>(BoySHP.class); 232 static { 233 Buoys.put(BoySHP.BOY_PILR, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 31.5, -95.0))); 234 Buoys.put(BoySHP.BOY_SPAR, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 31.5, -95.0))); 235 Buoys.put(BoySHP.BOY_CAN, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 236 Buoys.put(BoySHP.BOY_CONE, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 237 Buoys.put(BoySHP.BOY_SPHR, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 238 Buoys.put(BoySHP.BOY_BARL, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 239 Buoys.put(BoySHP.BOY_SUPR, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0.0, -42.0))); 240 Buoys.put(BoySHP.BOY_ICE, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0.0, -25.0))); 241 } 242 public static final Delta Floats = new Delta(Handle.BC, AffineTransform.getTranslateInstance(0.0, -70.0)); 243 228 244 }
Note:
See TracChangeset
for help on using the changeset viewer.