source: osm/applications/editors/josm/plugins/seachart/src/symbols/Beacons.java@ 31044

Last change on this file since 31044 was 30894, checked in by malcolmh, 10 years ago

Add SeaChart plugin

File size: 11.3 KB
Line 
1/* Copyright 2014 Malcolm Herring
2 *
3 * This is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License.
6 *
7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
8 */
9
10package symbols;
11
12import java.awt.BasicStroke;
13import java.awt.Color;
14import java.awt.geom.*;
15import java.util.EnumMap;
16
17import symbols.Symbols.*;
18import s57.S57val.*;
19
20public class Beacons {
21
22 public static final Symbol Beacon = new Symbol();
23 static {
24 Symbol colours = new Symbol();
25 Path2D.Double p = new Path2D.Double(); p.moveTo(-6.0,-8.5); p.lineTo(-6.0,-70.0); p.lineTo(6.0,-70.0); p.lineTo(6.0,-8.5); p.curveTo(6.0,-10.0,-6.0,-10.0,-6.0,-8.5); p.closePath();
26 colours.add(new Instr(Form.P1, p));
27 p = new Path2D.Double(); p.moveTo(-6.0,-8.5); p.lineTo(-6.0,-40.0); p.lineTo(6.0,-40.0); p.lineTo(6.0,-8.5); p.curveTo(6.0,-10.0,-6.0,-10.0,-6.0,-8.5); p.closePath();
28 colours.add(new Instr(Form.H2, p));
29 p = new Path2D.Double(); p.moveTo(-6.0,-30.0); p.lineTo(-6.0,-50.0); p.lineTo(6.0,-50.0); p.lineTo(6.0,-30.0); p.closePath();
30 colours.add(new Instr(Form.H3, p));
31 p = new Path2D.Double(); p.moveTo(-6.0,-40.0); p.lineTo(-6.0,-55.0); p.lineTo(6.0,-55.0); p.lineTo(6.0,-40.0); p.closePath();
32 colours.add(new Instr(Form.H4, p));
33 p = new Path2D.Double(); p.moveTo(-6.0,-25.0); p.lineTo(-6.0,-40.0); p.lineTo(6.0,-40.0); p.lineTo(6.0,-25.0); p.closePath();
34 colours.add(new Instr(Form.H5, p));
35 p = new Path2D.Double(); p.moveTo(0.0,-70.0); p.lineTo(6.0,-70.0); p.lineTo(6.0,-8.5); p.quadTo(3.0,-9.3,0.0,-10.0); p.closePath();
36 colours.add(new Instr(Form.V2, p));
37 Beacon.add(new Instr(Form.COLR, colours));
38 Beacon.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
39 Beacon.add(new Instr(Form.FILL, Color.black));
40 Beacon.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
41 Beacon.add(new Instr(Form.LINE, new Line2D.Double(-20,0,-10,0)));
42 Beacon.add(new Instr(Form.LINE, new Line2D.Double(10,0,20,0)));
43 p = new Path2D.Double(); p.moveTo(-6.0,-8.5); p.lineTo(-6.0,-70.0); p.lineTo(6.0,-70.0); p.lineTo(6.0,-8.5);
44 Beacon.add(new Instr(Form.PLIN, p));
45 }
46 public static final Symbol Cairn = new Symbol();
47 static {
48 Cairn.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
49 Cairn.add(new Instr(Form.FILL, Color.black));
50 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
51 Cairn.add(new Instr(Form.LINE, new Line2D.Double(-40,0,-10,0)));
52 Cairn.add(new Instr(Form.LINE, new Line2D.Double(10,0,40,0)));
53 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(3,-40,40,40)));
54 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(-43,-40,40,40)));
55 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(-18,-70,36,36)));
56 }
57 public static final Symbol FogSignal = new Symbol();
58 static {
59 FogSignal.add(new Instr(Form.STRK, new BasicStroke(3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
60 FogSignal.add(new Instr(Form.FILL, Color.black));
61 FogSignal.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
62 FogSignal.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
63 FogSignal.add(new Instr(Form.FILL, new Color(0xd400d4)));
64 FogSignal.add(new Instr(Form.EARC, new Arc2D.Double(-120.0,-120.0,240.0,240.0,190.0,50.0,Arc2D.OPEN)));
65 FogSignal.add(new Instr(Form.EARC, new Arc2D.Double(-92.5,-92.5,185.0,185.0,190.0,50.0,Arc2D.OPEN)));
66 FogSignal.add(new Instr(Form.EARC, new Arc2D.Double(-65.0,-65.0,130.0,130.0,190.0,50.0,Arc2D.OPEN)));
67 }
68 public static final Symbol LightFlare = new Symbol();
69 static {
70 LightFlare.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-100,40,100)));
71 LightFlare.add(new Instr(Form.RSHP, new Ellipse2D.Double(-3,-3,6,6)));
72 Path2D.Double p = new Path2D.Double();
73 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);
74 p.closePath();
75 LightFlare.add(new Instr(Form.PGON, p));
76 }
77 public static final Symbol LightMajor = new Symbol();
78 static {
79 LightMajor.add(new Instr(Form.FILL, Color.black));
80 Path2D.Double p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_NON_ZERO);
81 p.moveTo(0.0,-7.0); p.curveTo(-9.3,-6.5,-9.3,6.5,0.0,7.0); p.curveTo(9.3,6.5,9.3,-6.5,0.0,-7.0); p.closePath();
82 p.moveTo(0.0,-35.5); p.lineTo(8.0,-11.2); p.lineTo(33.5,-11.2); p.lineTo(12.8,4.0);
83 p.lineTo(20.5,28.5); p.lineTo(0.0,13.0); p.lineTo(-20.5,28.5); p.lineTo(-12.8,4.0); p.lineTo(-33.5,-11.2); p.lineTo(-8.0,-11.2); p.closePath();
84 LightMajor.add(new Instr(Form.PGON, p));
85 }
86 public static final Symbol LightMinor = new Symbol();
87 static {
88 LightMinor.add(new Instr(Form.FILL, Color.black));
89 Path2D.Double p = new Path2D.Double(); p.moveTo(0.0,-26.5); p.lineTo(6.0,-8.4); p.lineTo(25.1,-8.4); p.lineTo(9.6,3.0);
90 p.lineTo(15.4,21.4); p.lineTo(0.0,9.8); p.lineTo(-15.4,21.4); p.lineTo(-9.6,3.0); p.lineTo(-25.1,-8.4); p.lineTo(-6.0,-8.4); p.closePath();
91 LightMinor.add(new Instr(Form.PGON, p));
92 }
93 public static final Symbol PerchPort = new Symbol();
94 static {
95 PerchPort.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
96 PerchPort.add(new Instr(Form.FILL, Color.black));
97 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(-10,0,10,0)));
98 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-40)));
99 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(25,-70,0,-40)));
100 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(-25,-70,0,-40)));
101 }
102 public static final Symbol PerchStarboard = new Symbol();
103 static {
104 PerchStarboard.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
105 PerchStarboard.add(new Instr(Form.FILL, Color.black));
106 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(-10,0,10,0)));
107 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-70)));
108 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(25,-40,0,-68.7)));
109 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(-25,-40,0,-68.7)));
110 }
111 public static final Symbol RadarStation = new Symbol();
112 static {
113 RadarStation.add(new Instr(Form.STRK, new BasicStroke(2.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
114 RadarStation.add(new Instr(Form.FILL, new Color(0xd400d4)));
115 RadarStation.add(new Instr(Form.ELPS, new Ellipse2D.Double(-125,-125,250,250)));
116 }
117 public static final Symbol Stake = new Symbol();
118 static {
119 Stake.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
120 Stake.add(new Instr(Form.FILL, Color.black));
121 Stake.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-70)));
122 Symbol colours = new Symbol();
123 Path2D.Double p = new Path2D.Double(); p.moveTo(-2.0,0.0); p.lineTo(-2.0,-70.0); p.lineTo(2.0,-70.0); p.lineTo(2.0,0.0); p.closePath();
124 colours.add(new Instr(Form.P1, p));
125 p = new Path2D.Double(); p.moveTo(-2.0,0.0); p.lineTo(-2.0,-35.0); p.lineTo(2.0,-35.0); p.lineTo(2.0,0.0); p.closePath();
126 colours.add(new Instr(Form.H2, p));
127 p = new Path2D.Double(); p.moveTo(-2.0,-23.3); p.lineTo(-2.0,-46.7); p.lineTo(2.0,-46.7); p.lineTo(2.0,-23.3); p.closePath();
128 colours.add(new Instr(Form.H3, p));
129 p = new Path2D.Double(); p.moveTo(-2.0,-35.0); p.lineTo(-2.0,-52.5); p.lineTo(2.0,-52.5); p.lineTo(2.0,-35.0); p.closePath();
130 colours.add(new Instr(Form.H4, p));
131 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();
132 colours.add(new Instr(Form.H5, p));
133 Stake.add(new Instr(Form.COLR, colours));
134 Stake.add(new Instr(Form.FILL, Color.black));
135 Stake.add(new Instr(Form.LINE, new Line2D.Double(-10,0,10,0)));
136 }
137 public static final Symbol Tower = new Symbol();
138 static {
139 Symbol colours = new Symbol();
140 Path2D.Double p = new Path2D.Double(); p.moveTo(-25.0,0.0); p.lineTo(-20.0,-70.0); p.lineTo(20.0,-70.0); p.lineTo(25.0,0.0); p.lineTo(10.0,0.0); p.curveTo(10.0,-13.3,-10.0,-13.3,-10.0,0.0); p.closePath();
141 colours.add(new Instr(Form.P1, p));
142 p = new Path2D.Double(); p.moveTo(-25.0,0.0); p.lineTo(-22.5,-35.0); p.lineTo(22.5,-35.0); p.lineTo(25.0,0.0); p.lineTo(10.0,0.0); p.curveTo(10.0,-13.3,-10.0,-13.3,-10.0,0.0); p.closePath();
143 colours.add(new Instr(Form.H2, p));
144 p = new Path2D.Double(); p.moveTo(-23.3,-23.3); p.lineTo(-21.7,-46.7); p.lineTo(21.7,-46.7); p.lineTo(23.3,-23.3); p.closePath();
145 colours.add(new Instr(Form.H3, p));
146 p = new Path2D.Double(); p.moveTo(-22.5,-35.0); p.lineTo(-21.0,-52.5); p.lineTo(21.0,-52.5); p.lineTo(22.5,-35.0); p.closePath();
147 colours.add(new Instr(Form.H4, p));
148 p = new Path2D.Double(); p.moveTo(-23.6,-17.5); p.lineTo(-22.5,-35.0); p.lineTo(22.5,-35.0); p.lineTo(23.6,-17.5); p.closePath();
149 colours.add(new Instr(Form.H5, p));
150 p = new Path2D.Double(); p.moveTo(0.0,-70.0); p.lineTo(20.0,-70.0); p.lineTo(25.0,0.0); p.lineTo(10.0,0.0); p.quadTo(10.0,-10.0,0.0,-10.0); p.closePath();
151 colours.add(new Instr(Form.V2, p));
152 Tower.add(new Instr(Form.COLR, colours));
153 Tower.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
154 Tower.add(new Instr(Form.FILL, Color.black));
155 Tower.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
156 Tower.add(new Instr(Form.LINE, new Line2D.Double(-35,0,-10,0)));
157 Tower.add(new Instr(Form.LINE, new Line2D.Double(10,0,35,0)));
158 p = new Path2D.Double(); p.moveTo(-25.0,0.0); p.lineTo(-20.0,-70.0); p.lineTo(20.0,-70.0); p.lineTo(25.0,0.0);
159 Tower.add(new Instr(Form.PLIN, p));
160 }
161 public static final Symbol WithyPort = new Symbol();
162 static {
163 WithyPort.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
164 WithyPort.add(new Instr(Form.FILL, Color.black));
165 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(-10,0,10,0)));
166 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-70)));
167 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(20,-60,0,-50)));
168 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(-20,-60,0,-50)));
169 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(30,-35,0,-21)));
170 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(-30,-35,0,-21)));
171 }
172 public static final Symbol WithyStarboard = new Symbol();
173 static {
174 WithyStarboard.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
175 WithyStarboard.add(new Instr(Form.FILL, Color.black));
176 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(-10,0,10,0)));
177 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-70)));
178 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(20,-50,0,-60)));
179 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(-20,-50,0,-60)));
180 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(30,-21,0,-35)));
181 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(-30,-21,0,-35)));
182 }
183
184 public static final EnumMap<BcnSHP, Symbol> Shapes = new EnumMap<BcnSHP, Symbol>(BcnSHP.class);
185 static {
186 Shapes.put(BcnSHP.BCN_UNKN, Beacons.Beacon); Shapes.put(BcnSHP.BCN_STAK, Beacons.Stake); Shapes.put(BcnSHP.BCN_TOWR, Beacons.Tower);
187 Shapes.put(BcnSHP.BCN_LATT, Beacons.Beacon); Shapes.put(BcnSHP.BCN_PILE, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POLE, Beacons.Stake);
188 Shapes.put(BcnSHP.BCN_CARN, Beacons.Cairn); Shapes.put(BcnSHP.BCN_BUOY, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POST, Beacons.Stake);
189 Shapes.put(BcnSHP.BCN_PRCH, Beacons.Stake);
190 }
191}
Note: See TracBrowser for help on using the repository browser.