Changeset 30325 in osm for applications/editors/josm/plugins/smed2/src
- Timestamp:
- 2014-03-16T14:21:57+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/panels/PanelMain.java
r30315 r30325 143 143 Renderer.reRender(g2, Integer.parseInt(zt.getText()), Integer.parseInt(ft.getText()), Smed2Action.map, Smed2Action.rendering); 144 144 try { 145 ImageIO.write(img, "png", new File( "/Users/mherring/Desktop/export.png"));145 ImageIO.write(img, "png", new File(System.getProperty("user.home") + "/Desktop/export.png")); 146 146 } catch (Exception x) { 147 147 System.out.println("Exception"); -
applications/editors/josm/plugins/smed2/src/panels/PanelS57.java
r30324 r30325 41 41 ArrayList<Obj> types = new ArrayList<Obj>(); 42 42 S57map map; 43 HashMap<Long, Long> done= new HashMap<Long, Long>();43 HashMap<Long, Long> uids = new HashMap<Long, Long>(); 44 44 45 45 public PanelS57() { … … 82 82 Snode snode; 83 83 while ((snode = map.nodes.get(ref)) != null) { 84 if (! done.containsKey(ref)) {84 if (!uids.containsKey(ref)) { 85 85 Node node = new Node(0, 1); 86 86 node.setCoor((new LatLon(Math.toDegrees(snode.lat), Math.toDegrees(snode.lon)))); 87 87 data.addPrimitive(node); 88 88 addKeys(node, feature, type); 89 done.put(ref, node.getUniqueId());89 uids.put(ref, node.getUniqueId()); 90 90 } 91 91 ref++; … … 110 110 long ref = git.nextRef(); 111 111 Snode snode = map.nodes.get(ref); 112 if (! done.containsKey(ref)) {112 if (!uids.containsKey(ref)) { 113 113 Node node = new Node(0, 1); 114 114 node.setCoor((new LatLon(Math.toDegrees(snode.lat), Math.toDegrees(snode.lon)))); 115 115 data.addPrimitive(node); 116 done.put(ref, node.getUniqueId());116 uids.put(ref, node.getUniqueId()); 117 117 } 118 118 } … … 121 121 git = map.new GeomIterator(feature.geom); 122 122 while (git.hasComp()) { 123 long edge =git.nextComp();123 git.nextComp(); 124 124 Way way = new Way(0, 1); 125 125 data.addPrimitive(way); … … 128 128 while (git.hasNode()) { 129 129 long ref = git.nextRef(); 130 way.addNode((Node)data.getPrimitiveById( done.get(ref), OsmPrimitiveType.NODE));130 way.addNode((Node)data.getPrimitiveById(uids.get(ref), OsmPrimitiveType.NODE)); 131 131 } 132 132 } … … 142 142 long ref = git.nextRef(); 143 143 Snode snode = map.nodes.get(ref); 144 if (! done.containsKey(ref)) {144 if (!uids.containsKey(ref)) { 145 145 Node node = new Node(0, 1); 146 146 node.setCoor((new LatLon(Math.toDegrees(snode.lat), Math.toDegrees(snode.lon)))); 147 147 data.addPrimitive(node); 148 done.put(ref, node.getUniqueId());148 uids.put(ref, node.getUniqueId()); 149 149 } 150 150 } … … 155 155 long ref = git.nextComp(); 156 156 Way way = new Way(0, 1); 157 done.put(ref, way.getUniqueId());157 uids.put(ref, way.getUniqueId()); 158 158 data.addPrimitive(way); 159 159 while (git.hasEdge()) { … … 161 161 while (git.hasNode()) { 162 162 ref = git.nextRef(); 163 way.addNode((Node) data.getPrimitiveById( done.get(ref), OsmPrimitiveType.NODE));163 way.addNode((Node) data.getPrimitiveById(uids.get(ref), OsmPrimitiveType.NODE)); 164 164 } 165 165 } … … 172 172 long ref = git.nextComp(); 173 173 if (outers-- > 0) { 174 rel.addMember(new RelationMember("outer", (Way) data.getPrimitiveById( done.get(ref), OsmPrimitiveType.WAY)));174 rel.addMember(new RelationMember("outer", (Way) data.getPrimitiveById(uids.get(ref), OsmPrimitiveType.WAY))); 175 175 } else { 176 rel.addMember(new RelationMember("inner", (Way) data.getPrimitiveById( done.get(ref), OsmPrimitiveType.WAY)));176 rel.addMember(new RelationMember("inner", (Way) data.getPrimitiveById(uids.get(ref), OsmPrimitiveType.WAY))); 177 177 } 178 178 } -
applications/editors/josm/plugins/smed2/src/render/Rules.java
r30323 r30325 351 351 } 352 352 } else { 353 Renderer.symbol(feature, Beacons.Shapes.get(shape), 354 getScheme(feature, feature.type)); 355 if (feature.objs.get(Obj.TOPMAR) != null) 356 Renderer.symbol( 357 feature, 358 Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR) 359 .get(0).get(Att.TOPSHP).val), 360 getScheme(feature, Obj.TOPMAR), 361 Topmarks.BeaconDelta); 353 Renderer.symbol(feature, Beacons.Shapes.get(shape), getScheme(feature, feature.type)); 354 if (hasObject(feature, Obj.TOPMAR)) { 355 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val); 356 if (topmark != null) 357 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta); 358 } else if (hasObject(feature, Obj.DAYMAR)) { 359 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val); 360 if (topmark != null) 361 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta); 362 } 362 363 } 363 364 Signals.addSignals(feature); … … 370 371 Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type)); 371 372 if (hasObject(feature, Obj.TOPMAR)) { 372 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), 373 getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 373 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val); 374 if (topmark != null) 375 Renderer.symbol(feature, topmark, getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 376 } else if (hasObject(feature, Obj.DAYMAR)) { 377 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val); 378 if (topmark != null) 379 Renderer.symbol(feature, topmark, getScheme(feature, Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape)); 374 380 } 375 381 Signals.addSignals(feature); … … 511 517 if (Renderer.zoom >= 14) { 512 518 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline)); 513 Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Msymb, LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC)); 519 if (Renderer.zoom >= 15) { 520 Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Msymb, LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC)); 521 } 514 522 } 515 523 double radius = (Double)getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS); -
applications/editors/josm/plugins/smed2/src/symbols/Harbours.java
r30285 r30325 104 104 public static final Symbol Fishing = new Symbol(); 105 105 static { 106 Fishing.add(new Instr(Form.STRK, new BasicStroke(1 5, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));106 Fishing.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 107 107 Fishing.add(new Instr(Form.FILL, Rules.Msymb)); 108 Fishing.add(new Instr(Form.EARC, new Arc2D.Double(- 75,-75,150,150,15,140,Arc2D.OPEN)));109 Fishing.add(new Instr(Form.EARC, new Arc2D.Double(- 75,-75,150,150,-15,-140,Arc2D.OPEN)));108 Fishing.add(new Instr(Form.EARC, new Arc2D.Double(-50,-50,100,100,15,140,Arc2D.OPEN))); 109 Fishing.add(new Instr(Form.EARC, new Arc2D.Double(-50,-50,100,100,-15,-140,Arc2D.OPEN))); 110 110 Path2D.Double p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_EVEN_ODD); 111 p.moveTo(- 40,5); p.curveTo(20,40,50,25,80,0); p.curveTo(50,-25,20,-40,-40,-5);112 p.lineTo(- 75,-25); p.quadTo(-80, 0, -75, 25); p.closePath();113 p.moveTo( 42, 0); p.curveTo(42, 10, 56, 10, 56, 0); p.curveTo(56, -10, 42, -10, 42, 0); p.closePath();111 p.moveTo(-24,3); p.curveTo(12,24,30,15,48,0); p.curveTo(30,-15,12,-24,-24,-3); 112 p.lineTo(-45,-15); p.quadTo(-48, 0, -45, 15); p.closePath(); 113 p.moveTo(25, 0); p.curveTo(25, 6, 34, 6, 34, 0); p.curveTo(34, -6, 25, -6, 25, 0); p.closePath(); 114 114 Fishing.add(new Instr(Form.PGON, p)); 115 115 } 116 116 public static final Symbol Harbour = new Symbol(); 117 117 static { 118 Harbour.add(new Instr(Form.STRK, new BasicStroke(1 5, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));118 Harbour.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 119 119 Harbour.add(new Instr(Form.FILL, Rules.Msymb)); 120 Harbour.add(new Instr(Form.ELPS, new Ellipse2D.Double(- 75,-75,150,150)));121 Harbour.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 1.0, 0, 0, new Scheme(Rules.Msymb), null)));120 Harbour.add(new Instr(Form.ELPS, new Ellipse2D.Double(-50,-50,100,100))); 121 Harbour.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 0.6, 0, 0, new Scheme(Rules.Msymb), null))); 122 122 } 123 123 public static final Symbol HarbourMaster = new Symbol(); … … 148 148 public static final Symbol Marina = new Symbol(); 149 149 static { 150 Marina.add(new Instr(Form.STRK, new BasicStroke(1 5, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));150 Marina.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 151 151 Marina.add(new Instr(Form.FILL, Rules.Msymb)); 152 Marina.add(new Instr(Form. SYMB, new Symbols.SubSymbol(Harbours.Yacht, 1.0, 0, 0, new Scheme(Rules.Msymb), null)));153 Marina.add(new Instr(Form. EARC, new Arc2D.Double(-80.0,-80.0,160.0,160.0,215.0,-250.0,Arc2D.OPEN)));152 Marina.add(new Instr(Form.EARC, new Arc2D.Double(-50.0,-50.0,100.0,100.0,215.0,-250.0,Arc2D.OPEN))); 153 Marina.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 0.6, 0, 0, new Scheme(Rules.Msymb), null))); 154 154 } 155 155 public static final Symbol MarinaNF = new Symbol(); 156 156 static { 157 MarinaNF.add(new Instr(Form.STRK, new BasicStroke(15, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 158 MarinaNF.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 1.0, 0, 0, new Scheme(Rules.Msymb), null))); 157 MarinaNF.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 0.6, 0, 0, new Scheme(Rules.Msymb), null))); 159 158 } 160 159 public static final Symbol Pilot = new Symbol(); -
applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
r30285 r30325 21 21 22 22 public enum Form { 23 BBOX, STRK, COLR, FILL, LINE, RECT, RRCT, ELPS, EARC, PLIN, PGON, RSHP, TEXT, SYMB, P1, P2, H2, H3, H4, H5, V2, D2, D3, D4, B2, S2, S3, S4, C2, X2 23 BBOX, STRK, COLR, FILL, LINE, RECT, RRCT, ELPS, EARC, PLIN, PGON, RSHP, TEXT, SYMB, P1, P2, H2, H3, H4, H5, V2, V3, D2, D3, D4, B2, S2, S3, S4, C2, X2 24 24 } 25 25 … … 260 260 } 261 261 break; 262 case V3: 263 if ((cn == 3) && (cs.pat.get(0) == Patt.V)) { 264 g2.setPaint(cs.col.get(1)); 265 g2.fill((Path2D.Double) patch.params); 266 } 267 break; 262 268 default: 263 269 break; -
applications/editors/josm/plugins/smed2/src/symbols/Topmarks.java
r30285 r30325 92 92 TopEast.add(new Instr(Form.PLIN, p)); 93 93 } 94 public static final Symbol TopIcone = new Symbol(); 95 static { 96 TopIcone.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80))); 97 Symbol colours = new Symbol(); 98 Path2D.Double p = new Path2D.Double(); p.moveTo(-15.0,-45.0); p.lineTo(0.0,-15.0); p.lineTo(15.0,-45.0); p.closePath(); 99 colours.add(new Instr(Form.P1, p)); 100 TopIcone.add(new Instr(Form.COLR, colours)); 101 TopIcone.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 102 TopIcone.add(new Instr(Form.FILL, Color.black)); 103 TopIcone.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-15))); 104 p = new Path2D.Double(); p.moveTo(-15.0,-45.0); p.lineTo(0.0,-15.0); p.lineTo(15.0,-45.0); p.closePath(); 105 TopIcone.add(new Instr(Form.PLIN, p)); 106 } 94 107 public static final Symbol TopIsol = new Symbol(); 95 108 static { … … 169 182 Path2D.Double p = new Path2D.Double(); p.moveTo(-13.0,-1.0); p.lineTo(-13.0,-27.0); p.lineTo(13.0,-27.0); p.lineTo(13.0,-1.0); p.closePath(); 170 183 colours.add(new Instr(Form.P1, p)); 184 p = new Path2D.Double(); p.moveTo(-13.0,-15.0); p.lineTo(-13.0,-1.0); p.lineTo(13.0,-1.0); p.lineTo(13.0,-15.0); p.closePath(); 185 colours.add(new Instr(Form.H2, p)); 186 p = new Path2D.Double(); p.moveTo(-13.0,-19.3); p.lineTo(-13.0,-10.7); p.lineTo(13.0,-10.7); p.lineTo(13.0,-19.3); p.closePath(); 187 colours.add(new Instr(Form.H3, p)); 188 p = new Path2D.Double(); p.moveTo(0.0,-1.0); p.lineTo(0.0,-27.0); p.lineTo(13.0,-27.0); p.lineTo(13.0,-1.0); p.closePath(); 189 colours.add(new Instr(Form.V2, p)); 190 p = new Path2D.Double(); p.moveTo(-4.3,-1.0); p.lineTo(-4.3,-27.0); p.lineTo(4.3,-27.0); p.lineTo(4.3,-1.0); p.closePath(); 191 colours.add(new Instr(Form.V3, p)); 171 192 TopSquare.add(new Instr(Form.COLR, colours)); 172 193 TopSquare.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); … … 175 196 TopSquare.add(new Instr(Form.PLIN, p)); 176 197 } 198 public static final Symbol TopRhombus = new Symbol(); 199 static { 200 TopRhombus.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80))); 201 Symbol colours = new Symbol(); 202 Path2D.Double p = new Path2D.Double(); p.moveTo(0.0,-29.0); p.lineTo(-15.0,-15.0); p.lineTo(0.0,-1.0); p.lineTo(15.0,-15.0); p.closePath(); 203 colours.add(new Instr(Form.P1, p)); 204 p = new Path2D.Double(); p.moveTo(-15.0,-15.0); p.lineTo(0.0,-1.0); p.lineTo(15.0,-15.0); p.closePath(); 205 colours.add(new Instr(Form.H2, p)); 206 p = new Path2D.Double(); p.moveTo(-10.0,-19.7); p.lineTo(-15.0,-15.0); p.lineTo(-10.0,-10.3); p.lineTo(10.0,-10.3); p.lineTo(15.0,-15.0); p.lineTo(10.0,-19.7); p.closePath(); 207 colours.add(new Instr(Form.H3, p)); 208 TopRhombus.add(new Instr(Form.COLR, colours)); 209 TopRhombus.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 210 TopRhombus.add(new Instr(Form.FILL, Color.black)); 211 p = new Path2D.Double(); p.moveTo(0.0,-29.0); p.lineTo(-15.0,-15.0); p.lineTo(0.0,-1.0); p.lineTo(15.0,-15.0); p.closePath(); 212 TopRhombus.add(new Instr(Form.PLIN, p)); 213 } 177 214 public static final Symbol TopTriangle = new Symbol(); 178 215 static { … … 186 223 p = new Path2D.Double(); p.moveTo(-15.0,-1.0); p.lineTo(0.0,-29.0); p.lineTo(15.0,-1.0); p.closePath(); 187 224 TopTriangle.add(new Instr(Form.PLIN, p)); 225 } 226 public static final Symbol TopItriangle = new Symbol(); 227 static { 228 TopItriangle.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80))); 229 Symbol colours = new Symbol(); 230 Path2D.Double p = new Path2D.Double(); p.moveTo(-15.0,-29.0); p.lineTo(0.0,-1.0); p.lineTo(15.0,-29.0); p.closePath(); 231 colours.add(new Instr(Form.P1, p)); 232 TopItriangle.add(new Instr(Form.COLR, colours)); 233 TopItriangle.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 234 TopItriangle.add(new Instr(Form.FILL, Color.black)); 235 p = new Path2D.Double(); p.moveTo(-15.0,-29.0); p.lineTo(0.0,-1.0); p.lineTo(15.0,-29.0); p.closePath(); 236 TopItriangle.add(new Instr(Form.PLIN, p)); 188 237 } 189 238 public static final Symbol TopWest = new Symbol(); … … 224 273 static { 225 274 Shapes.put(TopSHP.TOP_BORD, TopBoard); Shapes.put(TopSHP.TOP_CAN, TopCan); Shapes.put(TopSHP.TOP_CONE, TopCone); Shapes.put(TopSHP.TOP_CROS, TopCross); 226 th); Shapes.put(TopSHP.TOP_SOUTH, TopSouth);227 Shapes.put(TopSHP.TOP_SPHR, TopSphere); Shapes.put(TopSHP.TOP_SQUR, TopSquare); Shapes.put(TopSHP.TOP_TRI, TopTriangle ); Shapes.put(TopSHP.TOP_WEST, TopWest);228 Shapes.put(TopSHP.TOP_SALT, TopX); 275 Shapes.put(TopSHP.TOP_EAST, TopEast); Shapes.put(TopSHP.TOP_ICONE, TopIcone); Shapes.put(TopSHP.TOP_ISD, TopIsol); Shapes.put(TopSHP.TOP_NORTH, TopNorth); 276 Shapes.put(TopSHP.TOP_SOUTH, TopSouth); Shapes.put(TopSHP.TOP_SPHR, TopSphere); Shapes.put(TopSHP.TOP_SQUR, TopSquare); Shapes.put(TopSHP.TOP_TRI, TopTriangle); 277 Shapes.put(TopSHP.TOP_ITRI, TopItriangle); Shapes.put(TopSHP.TOP_WEST, TopWest); Shapes.put(TopSHP.TOP_SALT, TopX); Shapes.put(TopSHP.TOP_RHOM, TopRhombus); 229 278 } 230 279 public static final EnumMap<BoySHP, Delta> BuoyDeltas = new EnumMap<BoySHP, Delta>(BoySHP.class); … … 232 281 BuoyDeltas.put(BoySHP.BOY_PILR, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 31.5, -95.0))); 233 282 BuoyDeltas.put(BoySHP.BOY_SPAR, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 31.5, -95.0))); 234 BuoyDeltas.put(BoySHP.BOY_CAN, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 283 BuoyDeltas.put(BoySHP.BOY_CAN, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 235 284 BuoyDeltas.put(BoySHP.BOY_CONE, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9))); 236 285 BuoyDeltas.put(BoySHP.BOY_SPHR, new Delta(Handle.BC, new AffineTransform(0.948324, 0.317305, -0.3173047, 0.948324, 12.7, -37.9)));
Note:
See TracChangeset
for help on using the changeset viewer.