1 | /* Copyright 2012 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 |
|
---|
10 | package symbols;
|
---|
11 |
|
---|
12 | import java.awt.BasicStroke;
|
---|
13 | import java.awt.Color;
|
---|
14 | import java.awt.geom.Ellipse2D;
|
---|
15 | import java.awt.geom.GeneralPath;
|
---|
16 | import java.awt.geom.Line2D;
|
---|
17 | import java.awt.geom.Path2D;
|
---|
18 | import java.util.ArrayList;
|
---|
19 | import java.util.EnumMap;
|
---|
20 |
|
---|
21 | import symbols.Symbols.Instr;
|
---|
22 | import symbols.Symbols.Prim;
|
---|
23 |
|
---|
24 | import s57.S57val.*;
|
---|
25 |
|
---|
26 | public class Beacons {
|
---|
27 |
|
---|
28 | public static final ArrayList<Instr> Beacon = new ArrayList<Instr>();
|
---|
29 | static {
|
---|
30 | ArrayList<Instr> colours = new ArrayList<Instr>();
|
---|
31 | 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();
|
---|
32 | colours.add(new Instr(Prim.P1, p));
|
---|
33 | 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();
|
---|
34 | colours.add(new Instr(Prim.H2, p));
|
---|
35 | 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();
|
---|
36 | colours.add(new Instr(Prim.H3, p));
|
---|
37 | 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();
|
---|
38 | colours.add(new Instr(Prim.H4, p));
|
---|
39 | 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();
|
---|
40 | colours.add(new Instr(Prim.H5, p));
|
---|
41 | 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();
|
---|
42 | colours.add(new Instr(Prim.V2, p));
|
---|
43 | Beacon.add(new Instr(Prim.COLR, colours));
|
---|
44 | Beacon.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
45 | Beacon.add(new Instr(Prim.FILL, Color.black));
|
---|
46 | Beacon.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
|
---|
47 | Beacon.add(new Instr(Prim.LINE, new Line2D.Double(-20,0,-10,0)));
|
---|
48 | Beacon.add(new Instr(Prim.LINE, new Line2D.Double(10,0,20,0)));
|
---|
49 | 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);
|
---|
50 | Beacon.add(new Instr(Prim.PLIN, p));
|
---|
51 | }
|
---|
52 | public static final ArrayList<Instr> Cairn = new ArrayList<Instr>();
|
---|
53 | static {
|
---|
54 | Cairn.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
55 | Cairn.add(new Instr(Prim.FILL, Color.black));
|
---|
56 | Cairn.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
|
---|
57 | Cairn.add(new Instr(Prim.LINE, new Line2D.Double(-40,0,-10,0)));
|
---|
58 | Cairn.add(new Instr(Prim.LINE, new Line2D.Double(10,0,40,0)));
|
---|
59 | Cairn.add(new Instr(Prim.ELPS, new Ellipse2D.Double(3,-40,40,40)));
|
---|
60 | Cairn.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-43,-40,40,40)));
|
---|
61 | Cairn.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-18,-70,36,36)));
|
---|
62 | }
|
---|
63 | public static final ArrayList<Instr> LightMajor = new ArrayList<Instr>();
|
---|
64 | static {
|
---|
65 | LightMajor.add(new Instr(Prim.FILL, Color.black));
|
---|
66 | Path2D.Double p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_NON_ZERO);
|
---|
67 | 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();
|
---|
68 | p.moveTo(0.0,-35.5); p.lineTo(8.0,-11.2); p.lineTo(33.5,-11.2); p.lineTo(12.8,4.0);
|
---|
69 | 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();
|
---|
70 | LightMajor.add(new Instr(Prim.PGON, p));
|
---|
71 | }
|
---|
72 | public static final ArrayList<Instr> LightMinor = new ArrayList<Instr>();
|
---|
73 | static {
|
---|
74 | LightMinor.add(new Instr(Prim.FILL, Color.black));
|
---|
75 | 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);
|
---|
76 | 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();
|
---|
77 | LightMinor.add(new Instr(Prim.PGON, p));
|
---|
78 | }
|
---|
79 | public static final ArrayList<Instr> PerchPort = new ArrayList<Instr>();
|
---|
80 | static {
|
---|
81 | PerchPort.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
82 | PerchPort.add(new Instr(Prim.FILL, Color.black));
|
---|
83 | PerchPort.add(new Instr(Prim.LINE, new Line2D.Double(-10,0,10,0)));
|
---|
84 | PerchPort.add(new Instr(Prim.LINE, new Line2D.Double(0,0,0,-40)));
|
---|
85 | PerchPort.add(new Instr(Prim.LINE, new Line2D.Double(25,-70,0,-40)));
|
---|
86 | PerchPort.add(new Instr(Prim.LINE, new Line2D.Double(-25,-70,0,-40)));
|
---|
87 | }
|
---|
88 | public static final ArrayList<Instr> PerchStarboard = new ArrayList<Instr>();
|
---|
89 | static {
|
---|
90 | PerchStarboard.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
91 | PerchStarboard.add(new Instr(Prim.FILL, Color.black));
|
---|
92 | PerchStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-10,0,10,0)));
|
---|
93 | PerchStarboard.add(new Instr(Prim.LINE, new Line2D.Double(0,0,0,-70)));
|
---|
94 | PerchStarboard.add(new Instr(Prim.LINE, new Line2D.Double(25,-40,0,-68.7)));
|
---|
95 | PerchStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-25,-40,0,-68.7)));
|
---|
96 | }
|
---|
97 | public static final ArrayList<Instr> Stake = new ArrayList<Instr>();
|
---|
98 | static {
|
---|
99 | Stake.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
100 | Stake.add(new Instr(Prim.FILL, Color.black));
|
---|
101 | Stake.add(new Instr(Prim.LINE, new Line2D.Double(0,0,0,-70)));
|
---|
102 | ArrayList<Instr> colours = new ArrayList<Instr>();
|
---|
103 | 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();
|
---|
104 | colours.add(new Instr(Prim.P1, p));
|
---|
105 | 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();
|
---|
106 | colours.add(new Instr(Prim.H2, p));
|
---|
107 | 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();
|
---|
108 | colours.add(new Instr(Prim.H3, p));
|
---|
109 | 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();
|
---|
110 | colours.add(new Instr(Prim.H4, p));
|
---|
111 | 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 | colours.add(new Instr(Prim.H5, p));
|
---|
113 | Stake.add(new Instr(Prim.COLR, colours));
|
---|
114 | Stake.add(new Instr(Prim.FILL, Color.black));
|
---|
115 | Stake.add(new Instr(Prim.LINE, new Line2D.Double(-10,0,10,0)));
|
---|
116 | }
|
---|
117 | public static final ArrayList<Instr> Tower = new ArrayList<Instr>();
|
---|
118 | static {
|
---|
119 | ArrayList<Instr> colours = new ArrayList<Instr>();
|
---|
120 | 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();
|
---|
121 | colours.add(new Instr(Prim.P1, p));
|
---|
122 | 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();
|
---|
123 | colours.add(new Instr(Prim.H2, p));
|
---|
124 | 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();
|
---|
125 | colours.add(new Instr(Prim.H3, p));
|
---|
126 | 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();
|
---|
127 | colours.add(new Instr(Prim.H4, p));
|
---|
128 | 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();
|
---|
129 | colours.add(new Instr(Prim.H5, p));
|
---|
130 | 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();
|
---|
131 | colours.add(new Instr(Prim.V2, p));
|
---|
132 | Tower.add(new Instr(Prim.COLR, colours));
|
---|
133 | Tower.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
134 | Tower.add(new Instr(Prim.FILL, Color.black));
|
---|
135 | Tower.add(new Instr(Prim.ELPS, new Ellipse2D.Double(-10,-10,20,20)));
|
---|
136 | Tower.add(new Instr(Prim.LINE, new Line2D.Double(-35,0,-10,0)));
|
---|
137 | Tower.add(new Instr(Prim.LINE, new Line2D.Double(10,0,35,0)));
|
---|
138 | 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);
|
---|
139 | Tower.add(new Instr(Prim.PLIN, p));
|
---|
140 | }
|
---|
141 | public static final ArrayList<Instr> WithyPort = new ArrayList<Instr>();
|
---|
142 | static {
|
---|
143 | WithyPort.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
144 | WithyPort.add(new Instr(Prim.FILL, Color.black));
|
---|
145 | WithyPort.add(new Instr(Prim.LINE, new Line2D.Double(-10,0,10,0)));
|
---|
146 | WithyPort.add(new Instr(Prim.LINE, new Line2D.Double(0,0,0,-70)));
|
---|
147 | WithyPort.add(new Instr(Prim.LINE, new Line2D.Double(20,-60,0,-50)));
|
---|
148 | WithyPort.add(new Instr(Prim.LINE, new Line2D.Double(-20,-60,0,-50)));
|
---|
149 | WithyPort.add(new Instr(Prim.LINE, new Line2D.Double(30,-35,0,-21)));
|
---|
150 | WithyPort.add(new Instr(Prim.LINE, new Line2D.Double(-30,-35,0,-21)));
|
---|
151 | }
|
---|
152 | public static final ArrayList<Instr> WithyStarboard = new ArrayList<Instr>();
|
---|
153 | static {
|
---|
154 | WithyStarboard.add(new Instr(Prim.STRK, new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
|
---|
155 | WithyStarboard.add(new Instr(Prim.FILL, Color.black));
|
---|
156 | WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-10,0,10,0)));
|
---|
157 | WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(0,0,0,-70)));
|
---|
158 | WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(20,-50,0,-60)));
|
---|
159 | WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-20,-50,0,-60)));
|
---|
160 | WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(30,-21,0,-35)));
|
---|
161 | WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-30,-21,0,-35)));
|
---|
162 | }
|
---|
163 |
|
---|
164 | public static final EnumMap<BcnSHP, ArrayList<Instr>> Shapes = new EnumMap<BcnSHP, ArrayList<Instr>>(BcnSHP.class);
|
---|
165 | static {
|
---|
166 | Shapes.put(BcnSHP.BCN_UNKN, Beacons.Beacon); Shapes.put(BcnSHP.BCN_STAK, Beacons.Stake); Shapes.put(BcnSHP.BCN_TOWR, Beacons.Tower);
|
---|
167 | Shapes.put(BcnSHP.BCN_LATT, Beacons.Beacon); Shapes.put(BcnSHP.BCN_PILE, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POLE, Beacons.Stake);
|
---|
168 | Shapes.put(BcnSHP.BCN_CARN, Beacons.Cairn); Shapes.put(BcnSHP.BCN_BUOY, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POST, Beacons.Stake);
|
---|
169 | }
|
---|
170 | }
|
---|