source: osm/applications/editors/josm/plugins/smed/src/seamarks/SeaMark.java@ 30287

Last change on this file since 30287 was 30287, checked in by malcolmh, 11 years ago

New release

  • Property svn:executable set to *
File size: 82.7 KB
Line 
1package seamarks;
2
3import javax.swing.*;
4
5import java.awt.*;
6import java.awt.geom.Arc2D;
7
8import java.util.*;
9
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.data.osm.*;
12import org.openstreetmap.josm.command.ChangePropertyCommand;
13
14import panels.PanelMain;
15
16import messages.Messages;
17import smed.SmedAction;
18
19public class SeaMark extends JPanel {
20
21 public SmedAction dlg = null;
22
23 public SeaMark(SmedAction dia) {
24 dlg = dia;
25 clrLight();
26 }
27
28 public enum Reg {
29 A, B, C, R, X
30 }
31
32 public static final EnumMap<Reg, String> RegSTR = new EnumMap<Reg, String>(Reg.class);
33 static {
34 RegSTR.put(Reg.A, "iala-a");
35 RegSTR.put(Reg.B, "iala-b");
36 RegSTR.put(Reg.C, "cevni");
37 RegSTR.put(Reg.R, "riwr");
38 RegSTR.put(Reg.X, "other");
39 }
40
41 private Reg region = Reg.A;
42
43 public Reg getRegion() {
44 return region;
45 }
46
47 public void setRegion(Reg reg) {
48 region = reg;
49 }
50
51 private String name = "";
52
53 public String getName() {
54 return name;
55 }
56
57 public void setName(String str) {
58 name = str.trim();
59 repaint();
60 }
61
62 public enum Obj {
63 UNKOBJ, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP,
64 BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, NOTMRK,
65 FLTCAR, FLTISD, FLTLAT, FLTSAW, FLTSPP,
66 LITMAJ, LITMIN, LITFLT, LITVES, LITHSE, LNDMRK,
67 MORFAC, BOYINB, SISTAW, SISTAT, OFSPLF,
68 CGUSTA, PILBOP, RSCSTA, RDOSTA, RADSTA
69 }
70
71 public static final EnumMap<Obj, String> ObjSTR = new EnumMap<Obj, String>(Obj.class);
72 static {
73 ObjSTR.put(Obj.BCNCAR, "beacon_cardinal");
74 ObjSTR.put(Obj.BCNISD, "beacon_isolated_danger");
75 ObjSTR.put(Obj.BCNLAT, "beacon_lateral");
76 ObjSTR.put(Obj.BCNSAW, "beacon_safe_water");
77 ObjSTR.put(Obj.BCNSPP, "beacon_special_purpose");
78 ObjSTR.put(Obj.BOYCAR, "buoy_cardinal");
79 ObjSTR.put(Obj.BOYISD, "buoy_isolated_danger");
80 ObjSTR.put(Obj.BOYLAT, "buoy_lateral");
81 ObjSTR.put(Obj.BOYSAW, "buoy_safe_water");
82 ObjSTR.put(Obj.BOYSPP, "buoy_special_purpose");
83 ObjSTR.put(Obj.FLTCAR, "light_float");
84 ObjSTR.put(Obj.FLTLAT, "light_float");
85 ObjSTR.put(Obj.FLTSAW, "light_float");
86 ObjSTR.put(Obj.FLTISD, "light_float");
87 ObjSTR.put(Obj.FLTSPP, "light_float");
88 ObjSTR.put(Obj.LITMAJ, "light_major");
89 ObjSTR.put(Obj.LITMIN, "light_minor");
90 ObjSTR.put(Obj.LITFLT, "light_float");
91 ObjSTR.put(Obj.LITVES, "light_vessel");
92 ObjSTR.put(Obj.NOTMRK, "notice");
93 ObjSTR.put(Obj.LNDMRK, "landmark");
94 ObjSTR.put(Obj.LITHSE, "landmark");
95 ObjSTR.put(Obj.MORFAC, "mooring");
96 ObjSTR.put(Obj.BOYINB, "buoy_installation");
97 ObjSTR.put(Obj.OFSPLF, "platform");
98 ObjSTR.put(Obj.SISTAW, "signal_station_warning");
99 ObjSTR.put(Obj.SISTAT, "signal_station_traffic");
100 ObjSTR.put(Obj.CGUSTA, "coastguard_station");
101 ObjSTR.put(Obj.PILBOP, "pilot_boarding");
102 ObjSTR.put(Obj.RSCSTA, "rescue_station");
103 ObjSTR.put(Obj.RDOSTA, "radio_station");
104 ObjSTR.put(Obj.RADSTA, "radar_station");
105 }
106
107 private Obj object = Obj.UNKOBJ;
108
109 public Obj getObject() {
110 return object;
111 }
112
113 public void setObject(Obj obj) {
114 object = obj;
115 if (obj == Obj.UNKOBJ) {
116 setCategory(Cat.NOCAT);
117 setFunc(Fnc.UNKFNC);
118 setShape(Shp.UNKSHP);
119 setColour(Ent.BODY, Col.UNKCOL);
120 setPattern(Ent.BODY, Pat.NOPAT);
121 setTopmark(Top.NOTOP);
122 setColour(Ent.TOPMARK, Col.UNKCOL);
123 setPattern(Ent.TOPMARK, Pat.NOPAT);
124 }
125 repaint();
126 }
127
128 public enum Ent {
129 BODY, BUOY, BEACON, LFLOAT, TOPMARK, LIGHT, MOORING, STATION, PLATFORM, NOTICE
130 }
131
132 public static final EnumMap<Obj, Ent> EntMAP = new EnumMap<Obj, Ent>(Obj.class);
133 static {
134 EntMAP.put(Obj.BCNCAR, Ent.BEACON);
135 EntMAP.put(Obj.BCNISD, Ent.BEACON);
136 EntMAP.put(Obj.BCNLAT, Ent.BEACON);
137 EntMAP.put(Obj.BCNSAW, Ent.BEACON);
138 EntMAP.put(Obj.BCNSPP, Ent.BEACON);
139 EntMAP.put(Obj.BOYCAR, Ent.BUOY);
140 EntMAP.put(Obj.BOYISD, Ent.BUOY);
141 EntMAP.put(Obj.BOYLAT, Ent.BUOY);
142 EntMAP.put(Obj.BOYSAW, Ent.BUOY);
143 EntMAP.put(Obj.BOYSPP, Ent.BUOY);
144 EntMAP.put(Obj.LITMAJ, Ent.LIGHT);
145 EntMAP.put(Obj.LITMIN, Ent.LIGHT);
146 EntMAP.put(Obj.LITFLT, Ent.LFLOAT);
147 EntMAP.put(Obj.FLTCAR, Ent.LFLOAT);
148 EntMAP.put(Obj.FLTLAT, Ent.LFLOAT);
149 EntMAP.put(Obj.FLTSAW, Ent.LFLOAT);
150 EntMAP.put(Obj.FLTISD, Ent.LFLOAT);
151 EntMAP.put(Obj.FLTSPP, Ent.LFLOAT);
152 EntMAP.put(Obj.LITVES, Ent.LFLOAT);
153 EntMAP.put(Obj.LITHSE, Ent.LIGHT);
154 EntMAP.put(Obj.LNDMRK, Ent.LIGHT);
155 EntMAP.put(Obj.MORFAC, Ent.MOORING);
156 EntMAP.put(Obj.BOYINB, Ent.MOORING);
157 EntMAP.put(Obj.OFSPLF, Ent.PLATFORM);
158 EntMAP.put(Obj.SISTAW, Ent.STATION);
159 EntMAP.put(Obj.SISTAT, Ent.STATION);
160 EntMAP.put(Obj.CGUSTA, Ent.STATION);
161 EntMAP.put(Obj.PILBOP, Ent.STATION);
162 EntMAP.put(Obj.RSCSTA, Ent.STATION);
163 EntMAP.put(Obj.RDOSTA, Ent.STATION);
164 EntMAP.put(Obj.RADSTA, Ent.STATION);
165 EntMAP.put(Obj.NOTMRK, Ent.NOTICE);
166 }
167
168 public enum Grp {
169 NUL, LAT, CAR, SAW, ISD, SPP, LGT, STN, PLF, NTC
170 }
171
172 public static final EnumMap<Obj, Grp> GrpMAP = new EnumMap<Obj, Grp>(Obj.class);
173 static {
174 GrpMAP.put(Obj.UNKOBJ, Grp.NUL);
175 GrpMAP.put(Obj.BCNCAR, Grp.CAR);
176 GrpMAP.put(Obj.BCNISD, Grp.ISD);
177 GrpMAP.put(Obj.BCNLAT, Grp.LAT);
178 GrpMAP.put(Obj.BCNSAW, Grp.SAW);
179 GrpMAP.put(Obj.BCNSPP, Grp.SPP);
180 GrpMAP.put(Obj.BOYCAR, Grp.CAR);
181 GrpMAP.put(Obj.BOYISD, Grp.ISD);
182 GrpMAP.put(Obj.BOYLAT, Grp.LAT);
183 GrpMAP.put(Obj.BOYSAW, Grp.SAW);
184 GrpMAP.put(Obj.BOYSPP, Grp.SPP);
185 GrpMAP.put(Obj.FLTCAR, Grp.CAR);
186 GrpMAP.put(Obj.FLTLAT, Grp.LAT);
187 GrpMAP.put(Obj.FLTSAW, Grp.SAW);
188 GrpMAP.put(Obj.FLTISD, Grp.ISD);
189 GrpMAP.put(Obj.FLTSPP, Grp.SPP);
190 GrpMAP.put(Obj.LITFLT, Grp.LGT);
191 GrpMAP.put(Obj.LITMAJ, Grp.LGT);
192 GrpMAP.put(Obj.LITMIN, Grp.LGT);
193 GrpMAP.put(Obj.LITVES, Grp.LGT);
194 GrpMAP.put(Obj.LITHSE, Grp.LGT);
195 GrpMAP.put(Obj.LNDMRK, Grp.LGT);
196 GrpMAP.put(Obj.MORFAC, Grp.SPP);
197 GrpMAP.put(Obj.BOYINB, Grp.SPP);
198 GrpMAP.put(Obj.OFSPLF, Grp.PLF);
199 GrpMAP.put(Obj.SISTAW, Grp.STN);
200 GrpMAP.put(Obj.SISTAT, Grp.STN);
201 GrpMAP.put(Obj.CGUSTA, Grp.STN);
202 GrpMAP.put(Obj.PILBOP, Grp.STN);
203 GrpMAP.put(Obj.RSCSTA, Grp.STN);
204 GrpMAP.put(Obj.RDOSTA, Grp.STN);
205 GrpMAP.put(Obj.RADSTA, Grp.STN);
206 GrpMAP.put(Obj.NOTMRK, Grp.NTC);
207 }
208
209 public enum Cat {
210 NOCAT, LAM_PORT, LAM_STBD, LAM_PPORT, LAM_PSTBD, CAM_NORTH, CAM_EAST, CAM_SOUTH, CAM_WEST,
211 ACH_URST, ACH_DEEP, ACH_TANK, ACH_EXPL, ACH_QUAR, ACH_SPLN, ACH_SCAN, ACH_SCMO, ACH_T24H, ACH_TLIM,
212 SPM_UNKN, SPM_WARN, SPM_CHBF, SPM_YCHT, SPM_CABL, SPM_OFAL, SPM_ODAS, SPM_RECN, SPM_MOOR, SPM_LNBY,
213 SPM_LDNG, SPM_NOTC, SPM_TSS, SPM_FOUL, SPM_DIVE, SPM_FRRY, SPM_ANCH,
214 MOR_DLPN, MOR_DDPN, MOR_BLRD, MOR_WALL, MOR_POST, MOR_CHWR, MOR_ROPE, MOR_AUTO, MOR_BUOY, INB_CALM, INB_SBM,
215 SIS_PTCL, SIS_PTED, SIS_IPT, SIS_BRTH, SIS_DOCK, SIS_LOCK, SIS_FBAR, SIS_BRDG, SIS_DRDG, SIS_TRFC,
216 SIS_DNGR, SIS_OBST, SIS_CABL, SIS_MILY, SIS_DSTR, SIS_WTHR, SIS_STRM, SIS_ICE, SIS_TIME, SIS_TIDE,
217 SIS_TSTM, SIS_TGAG, SIS_TSCL, SIS_DIVE, SIS_LGAG, LIT_DIRF, LIT_LEDG,
218 LMK_CHMY, LMK_CARN, LMK_DSHA, LMK_FLGS, LMK_FLRS, LMK_MNMT, LMK_TOWR, LMK_WNDM, LMK_WTRT, LMK_MNRT,
219 LMK_MAST, LMK_WNDS, LMK_CLMN, LMK_OBLK, LMK_STAT, LMK_CROS, LMK_DOME, LMK_SCNR, LMK_WNDL, LMK_SPIR,
220 OFP_OIL, OFP_PRD, OFP_OBS, OFP_ALP, OFP_SALM, OFP_MOR, OFP_ISL, OFP_FPSO, OFP_ACC, OFP_NCCB,
221 RSC_LFB, RSC_RKT, RSC_RSW, RSC_RIT, RSC_MLB, RSC_RAD, RSC_FAE, RSC_SPL, RSC_AIR, RSC_TUG,
222 RAS_SRV, RAS_CST, PIL_VESS, PIL_HELI, PIL_SHORE,
223 NTC_A1, NTC_A1a, NTC_A2, NTC_A3, NTC_A4, NTC_A4_1, NTC_A5, NTC_A5_1, NTC_A6, NTC_A7, NTC_A8, NTC_A9,
224 NTC_A10a, NTC_A10b, NTC_A12, NTC_A13, NTC_A14, NTC_A15, NTC_A16, NTC_A17, NTC_A18, NTC_A19, NTC_A20,
225 NTC_B1a, NTC_B1b, NTC_B2a, NTC_B2b, NTC_B3a, NTC_B3b, NTC_B4a, NTC_B4b, NTC_B5, NTC_B6, NTC_B7, NTC_B8, NTC_B9a, NTC_B9b, NTC_B11,
226 NTC_C1, NTC_C2, NTC_C3, NTC_C4, NTC_C5a, NTC_C5b, NTC_D1a, NTC_D1b, NTC_D2a, NTC_D2b, NTC_D3a, NTC_D3b,
227 NOROS, ROS_UNKN, ROS_OMNI, ROS_DIRL, ROS_ROTP, ROS_CNSL, ROS_RDF, ROS_QTG, ROS_AERO, ROS_DECA, ROS_LORN, ROS_DGPS, ROS_TORN, ROS_OMGA, ROS_SYLD, ROS_CHKA,
228 ROS_PCOM, ROS_COMB, ROS_FACS, ROS_TIME, ROS_PAIS, ROS_SAIS, ROS_VAIS, ROS_VANC, ROS_VASC, ROS_VAEC, ROS_VAWC, ROS_VAPL, ROS_VASL, ROS_VAID, ROS_VASW, ROS_VASP, ROS_VAWK
229 }
230
231 public static final EnumMap<Cat, String> CatSTR = new EnumMap<Cat, String>(Cat.class);
232 static {
233 CatSTR.put(Cat.LAM_PORT, "port");
234 CatSTR.put(Cat.LAM_STBD, "starboard");
235 CatSTR.put(Cat.LAM_PPORT, "preferred_channel_port");
236 CatSTR.put(Cat.LAM_PSTBD, "preferred_channel_starboard");
237 CatSTR.put(Cat.CAM_NORTH, "north");
238 CatSTR.put(Cat.CAM_EAST, "east");
239 CatSTR.put(Cat.CAM_SOUTH, "south");
240 CatSTR.put(Cat.CAM_WEST, "west");
241 CatSTR.put(Cat.SPM_UNKN, "unknown_purpose");
242 CatSTR.put(Cat.SPM_WARN, "warning");
243 CatSTR.put(Cat.SPM_CHBF, "channel_separation");
244 CatSTR.put(Cat.SPM_YCHT, "yachting");
245 CatSTR.put(Cat.SPM_CABL, "cable");
246 CatSTR.put(Cat.SPM_OFAL, "outfall");
247 CatSTR.put(Cat.SPM_ODAS, "odas");
248 CatSTR.put(Cat.SPM_RECN, "recreation_zone");
249 CatSTR.put(Cat.SPM_MOOR, "mooring");
250 CatSTR.put(Cat.SPM_LNBY, "lanby");
251 CatSTR.put(Cat.SPM_LDNG, "leading");
252 CatSTR.put(Cat.SPM_NOTC, "notice");
253 CatSTR.put(Cat.SPM_TSS, "tss");
254 CatSTR.put(Cat.SPM_FOUL, "foul_ground");
255 CatSTR.put(Cat.SPM_DIVE, "diving");
256 CatSTR.put(Cat.SPM_FRRY, "ferry_crossing");
257 CatSTR.put(Cat.SPM_ANCH, "anchorage");
258 CatSTR.put(Cat.MOR_DLPN, "dolphin");
259 CatSTR.put(Cat.MOR_DDPN, "deviation_dolphin");
260 CatSTR.put(Cat.MOR_BLRD, "bollard");
261 CatSTR.put(Cat.MOR_WALL, "wall");
262 CatSTR.put(Cat.MOR_POST, "post");
263 CatSTR.put(Cat.MOR_CHWR, "chain");
264 CatSTR.put(Cat.MOR_ROPE, "shore_rope");
265 CatSTR.put(Cat.MOR_AUTO, "automatic");
266 CatSTR.put(Cat.MOR_BUOY, "buoy");
267 CatSTR.put(Cat.INB_CALM, "calm");
268 CatSTR.put(Cat.INB_SBM, "sbm");
269 CatSTR.put(Cat.SIS_PTCL, "port_control");
270 CatSTR.put(Cat.SIS_PTED, "port_entry");
271 CatSTR.put(Cat.SIS_IPT, "ipt");
272 CatSTR.put(Cat.SIS_BRTH, "berthing");
273 CatSTR.put(Cat.SIS_DOCK, "dock");
274 CatSTR.put(Cat.SIS_LOCK, "lock");
275 CatSTR.put(Cat.SIS_FBAR, "barrage");
276 CatSTR.put(Cat.SIS_BRDG, "bridge");
277 CatSTR.put(Cat.SIS_DRDG, "dredging");
278 CatSTR.put(Cat.SIS_TRFC, "traffic");
279 CatSTR.put(Cat.SIS_DNGR, "danger");
280 CatSTR.put(Cat.SIS_OBST, "obstruction");
281 CatSTR.put(Cat.SIS_CABL, "cable");
282 CatSTR.put(Cat.SIS_MILY, "military");
283 CatSTR.put(Cat.SIS_DSTR, "distress");
284 CatSTR.put(Cat.SIS_WTHR, "weather");
285 CatSTR.put(Cat.SIS_STRM, "storm");
286 CatSTR.put(Cat.SIS_ICE, "ice");
287 CatSTR.put(Cat.SIS_TIME, "time");
288 CatSTR.put(Cat.SIS_TIDE, "tide");
289 CatSTR.put(Cat.SIS_TSTM, "stream");
290 CatSTR.put(Cat.SIS_TGAG, "gauge");
291 CatSTR.put(Cat.SIS_TSCL, "scale");
292 CatSTR.put(Cat.SIS_DIVE, "diving");
293 CatSTR.put(Cat.SIS_LGAG, "level");
294 CatSTR.put(Cat.LMK_CHMY, "chimney");
295 CatSTR.put(Cat.LMK_CARN, "cairn");
296 CatSTR.put(Cat.LMK_DSHA, "dish_aerial");
297 CatSTR.put(Cat.LMK_FLGS, "flagstaff");
298 CatSTR.put(Cat.LMK_FLRS, "flare_stack");
299 CatSTR.put(Cat.LMK_MNMT, "monument");
300 CatSTR.put(Cat.LMK_TOWR, "tower");
301 CatSTR.put(Cat.LMK_WNDM, "windmotor");
302 CatSTR.put(Cat.LMK_WTRT, "water_tower");
303 CatSTR.put(Cat.LMK_MAST, "mast");
304 CatSTR.put(Cat.LMK_WNDS, "windsock");
305 CatSTR.put(Cat.LMK_CLMN, "column");
306 CatSTR.put(Cat.LMK_OBLK, "obelisk");
307 CatSTR.put(Cat.LMK_STAT, "statue");
308 CatSTR.put(Cat.LMK_CROS, "cross");
309 CatSTR.put(Cat.LMK_DOME, "dome");
310 CatSTR.put(Cat.LMK_SCNR, "radar_scanner");
311 CatSTR.put(Cat.LMK_WNDL, "windmill");
312 CatSTR.put(Cat.LMK_SPIR, "spire");
313 CatSTR.put(Cat.LMK_MNRT, "minaret");
314 CatSTR.put(Cat.OFP_OIL, "oil");
315 CatSTR.put(Cat.OFP_PRD, "production");
316 CatSTR.put(Cat.OFP_OBS, "observation");
317 CatSTR.put(Cat.OFP_ALP, "alp");
318 CatSTR.put(Cat.OFP_SALM, "salm");
319 CatSTR.put(Cat.OFP_MOR, "mooring");
320 CatSTR.put(Cat.OFP_ISL, "island");
321 CatSTR.put(Cat.OFP_FPSO, "fpso");
322 CatSTR.put(Cat.OFP_ACC, "accommodation");
323 CatSTR.put(Cat.OFP_NCCB, "nccb");
324 CatSTR.put(Cat.PIL_VESS, "cruising_vessel");
325 CatSTR.put(Cat.PIL_HELI, "helicopter");
326 CatSTR.put(Cat.PIL_SHORE, "from_shore");
327 CatSTR.put(Cat.RSC_LFB, "lifeboat");
328 CatSTR.put(Cat.RSC_RKT, "rocket");
329 CatSTR.put(Cat.RSC_RSW, "refuge_shipwrecked");
330 CatSTR.put(Cat.RSC_RIT, "refuge_intertidal");
331 CatSTR.put(Cat.RSC_MLB, "lifeboat_moored");
332 CatSTR.put(Cat.RSC_RAD, "radio");
333 CatSTR.put(Cat.RSC_FAE, "firstaid");
334 CatSTR.put(Cat.RSC_SPL, "seaplane");
335 CatSTR.put(Cat.RSC_AIR, "aircraft");
336 CatSTR.put(Cat.RSC_TUG, "tug");
337 CatSTR.put(Cat.RAS_SRV, "surveillance");
338 CatSTR.put(Cat.RAS_CST, "coast");
339 CatSTR.put(Cat.ROS_OMNI, "omnidirectional");
340 CatSTR.put(Cat.ROS_DIRL, "directional");
341 CatSTR.put(Cat.ROS_ROTP, "rotating_pattern");
342 CatSTR.put(Cat.ROS_CNSL, "consol");
343 CatSTR.put(Cat.ROS_RDF, "rdf");
344 CatSTR.put(Cat.ROS_QTG, "qtg");
345 CatSTR.put(Cat.ROS_AERO, "aeronautical");
346 CatSTR.put(Cat.ROS_DECA, "decca");
347 CatSTR.put(Cat.ROS_LORN, "loran");
348 CatSTR.put(Cat.ROS_DGPS, "dgps");
349 CatSTR.put(Cat.ROS_TORN, "toran");
350 CatSTR.put(Cat.ROS_OMGA, "omega");
351 CatSTR.put(Cat.ROS_SYLD, "syledis");
352 CatSTR.put(Cat.ROS_CHKA, "chiaka");
353 CatSTR.put(Cat.ROS_PCOM, "public_communication");
354 CatSTR.put(Cat.ROS_COMB, "commercial_broadcast");
355 CatSTR.put(Cat.ROS_FACS, "facsimile");
356 CatSTR.put(Cat.ROS_TIME, "time_signal");
357 CatSTR.put(Cat.ROS_PAIS, "ais");
358 CatSTR.put(Cat.ROS_SAIS, "s-ais");
359 CatSTR.put(Cat.ROS_VAIS, "v-ais");
360 CatSTR.put(Cat.ROS_VANC, "v-ais_north_cardinal");
361 CatSTR.put(Cat.ROS_VASC, "v-ais_south_cardinal");
362 CatSTR.put(Cat.ROS_VAEC, "v-ais_east_cardinal");
363 CatSTR.put(Cat.ROS_VAWC, "v-ais_west_cardinal");
364 CatSTR.put(Cat.ROS_VAPL, "v-ais_port_lateral");
365 CatSTR.put(Cat.ROS_VASL, "v-ais_starboard_lateral");
366 CatSTR.put(Cat.ROS_VAID, "v-ais_isolated_danger");
367 CatSTR.put(Cat.ROS_VASW, "v-ais_safe_water");
368 CatSTR.put(Cat.ROS_VASP, "v-ais_special_purpose");
369 CatSTR.put(Cat.ROS_VAWK, "v-ais_wreck");
370 CatSTR.put(Cat.NTC_A1, "no_entry");
371 CatSTR.put(Cat.NTC_A1a, "closed_area");
372 CatSTR.put(Cat.NTC_A2, "no_overtaking");
373 CatSTR.put(Cat.NTC_A3, "no_convoy_overtaking");
374 CatSTR.put(Cat.NTC_A4, "no_passing");
375 CatSTR.put(Cat.NTC_A4, "no_convoy_passing");
376 CatSTR.put(Cat.NTC_A5, "no_berthing");
377 CatSTR.put(Cat.NTC_A5_1, "no_berthing_lateral_limit");
378 CatSTR.put(Cat.NTC_A6, "no_anchoring");
379 CatSTR.put(Cat.NTC_A7, "no_mooring");
380 CatSTR.put(Cat.NTC_A8, "no_turning");
381 CatSTR.put(Cat.NTC_A9, "no_wash");
382 CatSTR.put(Cat.NTC_A10a, "no_passage_left");
383 CatSTR.put(Cat.NTC_A10b, "no_passage_right");
384 CatSTR.put(Cat.NTC_A12, "no_motor_craft");
385 CatSTR.put(Cat.NTC_A13, "no_sport_craft");
386 CatSTR.put(Cat.NTC_A14, "no_waterskiing");
387 CatSTR.put(Cat.NTC_A15, "no_sailing_craft");
388 CatSTR.put(Cat.NTC_A16, "no_unpowered_craft");
389 CatSTR.put(Cat.NTC_A17, "no_sailboards");
390 CatSTR.put(Cat.NTC_A18, "no_high_speeds");
391 CatSTR.put(Cat.NTC_A19, "no_launching_beaching");
392 CatSTR.put(Cat.NTC_A20, "no_waterbikes");
393 CatSTR.put(Cat.NTC_B1a, "");
394 CatSTR.put(Cat.NTC_B1b, "");
395 CatSTR.put(Cat.NTC_B2a, "");
396 CatSTR.put(Cat.NTC_B2a, "");
397 CatSTR.put(Cat.NTC_B3a, "");
398 CatSTR.put(Cat.NTC_B3a, "");
399 CatSTR.put(Cat.NTC_B4a, "");
400 CatSTR.put(Cat.NTC_B4a, "");
401 CatSTR.put(Cat.NTC_B5, "");
402 CatSTR.put(Cat.NTC_B6, "");
403 CatSTR.put(Cat.NTC_B7, "");
404 CatSTR.put(Cat.NTC_B8, "");
405 CatSTR.put(Cat.NTC_B9a, "");
406 CatSTR.put(Cat.NTC_B9b, "");
407 CatSTR.put(Cat.NTC_B11, "");
408 CatSTR.put(Cat.NTC_C1, "");
409 CatSTR.put(Cat.NTC_C2, "");
410 CatSTR.put(Cat.NTC_C3, "");
411 CatSTR.put(Cat.NTC_C4, "");
412 CatSTR.put(Cat.NTC_C5a, "");
413 CatSTR.put(Cat.NTC_C5b, "");
414 CatSTR.put(Cat.NTC_D1a, "");
415 CatSTR.put(Cat.NTC_D1b, "");
416 CatSTR.put(Cat.NTC_D2a, "");
417 CatSTR.put(Cat.NTC_D2b, "");
418 CatSTR.put(Cat.NTC_D3a, "");
419 CatSTR.put(Cat.NTC_D3b, "");
420 }
421
422 private Cat category = Cat.NOCAT;
423
424 public Cat getCategory() {
425 return category;
426 }
427
428 public void setCategory(Cat cat) {
429 category = cat;
430 repaint();
431 }
432
433 public enum Shp {
434 UNKSHP, PILLAR, SPAR, CAN, CONI, SPHERI, BARREL, FLOAT, SUPER, BUOYANT, CAIRN, PILE, LATTICE, TOWER, STAKE, POLE, POST, PERCH, BUOY, BEACON
435 }
436
437 public static final EnumMap<Shp, String> ShpSTR = new EnumMap<Shp, String>(Shp.class);
438 static {
439 ShpSTR.put(Shp.PILLAR, "pillar");
440 ShpSTR.put(Shp.SPAR, "spar");
441 ShpSTR.put(Shp.CAN, "can");
442 ShpSTR.put(Shp.CONI, "conical");
443 ShpSTR.put(Shp.SPHERI, "spherical");
444 ShpSTR.put(Shp.BARREL, "barrel");
445 ShpSTR.put(Shp.FLOAT, "float");
446 ShpSTR.put(Shp.SUPER, "super-buoy");
447 ShpSTR.put(Shp.BUOYANT, "buoyant");
448 ShpSTR.put(Shp.CAIRN, "cairn");
449 ShpSTR.put(Shp.PILE, "pile");
450 ShpSTR.put(Shp.LATTICE, "lattice");
451 ShpSTR.put(Shp.TOWER, "tower");
452 ShpSTR.put(Shp.STAKE, "stake");
453 ShpSTR.put(Shp.PERCH, "perch");
454 }
455
456 private Shp shape = Shp.UNKSHP;
457
458 public Shp getShape() {
459 return shape;
460 }
461
462 public void setShape(Shp shp) {
463 shape = shp;
464 repaint();
465 }
466
467 public enum Col {
468 UNKCOL, BLANK, WHITE, RED, ORANGE, AMBER, YELLOW, GREEN, BLUE, VIOLET, BLACK, GREY, BROWN, MAGENTA, PINK
469 }
470
471 public static final EnumMap<Col, Color> ColMAP = new EnumMap<Col, Color>(Col.class);
472 static {
473 ColMAP.put(Col.UNKCOL, new Color(0xc0c0c0));
474 ColMAP.put(Col.WHITE, Color.WHITE);
475 ColMAP.put(Col.RED, Color.RED);
476 ColMAP.put(Col.ORANGE, Color.ORANGE);
477 ColMAP.put(Col.AMBER, new Color(0xfbf00f));
478 ColMAP.put(Col.YELLOW, Color.YELLOW);
479 ColMAP.put(Col.GREEN, Color.GREEN);
480 ColMAP.put(Col.BLUE, Color.BLUE);
481 ColMAP.put(Col.VIOLET, new Color(0x8f00ff));
482 ColMAP.put(Col.BLACK, Color.BLACK);
483 ColMAP.put(Col.GREY, Color.GRAY);
484 ColMAP.put(Col.BROWN, new Color(0xa45a58));
485 ColMAP.put(Col.MAGENTA, Color.MAGENTA);
486 ColMAP.put(Col.PINK, Color.PINK);
487 }
488
489 public static final EnumMap<Col, String> ColSTR = new EnumMap<Col, String>(Col.class);
490 static {
491 ColSTR.put(Col.WHITE, "white");
492 ColSTR.put(Col.RED, "red");
493 ColSTR.put(Col.ORANGE, "orange");
494 ColSTR.put(Col.AMBER, "amber");
495 ColSTR.put(Col.YELLOW, "yellow");
496 ColSTR.put(Col.GREEN, "green");
497 ColSTR.put(Col.BLUE, "blue");
498 ColSTR.put(Col.VIOLET, "violet");
499 ColSTR.put(Col.BLACK, "black");
500 ColSTR.put(Col.GREY, "grey");
501 ColSTR.put(Col.BROWN, "brown");
502 ColSTR.put(Col.MAGENTA, "magenta");
503 ColSTR.put(Col.PINK, "pink");
504 }
505
506 public Col getColour(Ent ent, int idx) {
507 if (ent == Ent.BODY)
508 return getObjColour(idx);
509 else
510 return getTopColour(idx);
511 }
512
513 public void setColour(Ent ent, Col col) {
514 if (ent == Ent.BODY)
515 setObjColour(col);
516 else
517 setTopColour(col);
518 }
519
520 public void setColour(Ent ent, int idx, Col col) {
521 if (ent == Ent.BODY)
522 setObjColour(idx, col);
523 else
524 setTopColour(idx, col);
525 }
526
527 public void addColour(Ent ent, int idx, Col col) {
528 if (ent == Ent.BODY)
529 addObjColour(idx, col);
530 else
531 addTopColour(idx, col);
532 }
533
534 public void subColour(Ent ent, int idx) {
535 if (ent == Ent.BODY)
536 subObjColour(idx);
537 else
538 subTopColour(idx);
539 }
540
541 private ArrayList<Col> bodyColour = new ArrayList<Col>();
542
543 public Col getObjColour(int i) {
544 if (i < bodyColour.size())
545 return bodyColour.get(i);
546 else
547 return Col.UNKCOL;
548 }
549
550 public void setObjColour(Col col) {
551 bodyColour.clear();
552 bodyColour.add(col);
553 repaint();
554 }
555
556 public void setObjColour(int i, Col col) {
557 if (i < bodyColour.size())
558 bodyColour.set(i, col);
559 repaint();
560 }
561
562 public void addObjColour(int i, Col col) {
563 if (bodyColour.size() >= i)
564 bodyColour.add(i, col);
565 repaint();
566 }
567
568 public void addObjColour(Col col) {
569 bodyColour.add(col);
570 repaint();
571 }
572
573 public void subObjColour(int i) {
574 if (bodyColour.size() > i)
575 bodyColour.remove(i);
576 repaint();
577 }
578
579 private ArrayList<Col> topmarkColour = new ArrayList<Col>();
580
581 public Col getTopColour(int i) {
582 if (i < topmarkColour.size())
583 return topmarkColour.get(i);
584 else
585 return Col.UNKCOL;
586 }
587
588 public void setTopColour(Col col) {
589 topmarkColour.clear();
590 topmarkColour.add(col);
591 repaint();
592 }
593
594 public void setTopColour(int i, Col col) {
595 if (topmarkColour.size() > i)
596 topmarkColour.set(i, col);
597 repaint();
598 }
599
600 public void addTopColour(int i, Col col) {
601 if (topmarkColour.size() >= i)
602 topmarkColour.add(i, col);
603 repaint();
604 }
605
606 public void addTopColour(Col col) {
607 topmarkColour.add(col);
608 repaint();
609 }
610
611 public void subTopColour(int i) {
612 if (topmarkColour.size() > i)
613 topmarkColour.remove(i);
614 repaint();
615 }
616
617 public enum Chr {
618 UNKCHR, FIXED, FLASH, LFLASH, QUICK, VQUICK, UQUICK, ISOPHASED, OCCULTING, MORSE, ALTERNATING, IQUICK, IVQUICK, IUQUICK
619 }
620
621 public static final Map<EnumSet<Chr>, String> ChrMAP = new HashMap<EnumSet<Chr>, String>();
622 static {
623 ChrMAP.put(EnumSet.of(Chr.FIXED), "F");
624 ChrMAP.put(EnumSet.of(Chr.FLASH), "Fl");
625 ChrMAP.put(EnumSet.of(Chr.LFLASH), "LFl");
626 ChrMAP.put(EnumSet.of(Chr.QUICK), "Q");
627 ChrMAP.put(EnumSet.of(Chr.VQUICK), "VQ");
628 ChrMAP.put(EnumSet.of(Chr.UQUICK), "UQ");
629 ChrMAP.put(EnumSet.of(Chr.ISOPHASED), "Iso");
630 ChrMAP.put(EnumSet.of(Chr.OCCULTING), "Oc");
631 ChrMAP.put(EnumSet.of(Chr.IQUICK), "IQ");
632 ChrMAP.put(EnumSet.of(Chr.IVQUICK), "IVQ");
633 ChrMAP.put(EnumSet.of(Chr.IUQUICK), "IUQ");
634 ChrMAP.put(EnumSet.of(Chr.MORSE), "Mo");
635 ChrMAP.put(EnumSet.of(Chr.FIXED, Chr.FLASH), "FFl");
636 ChrMAP.put(EnumSet.of(Chr.FLASH, Chr.LFLASH), "FlLFl");
637 ChrMAP.put(EnumSet.of(Chr.FIXED, Chr.OCCULTING), "FOc");
638 ChrMAP.put(EnumSet.of(Chr.FIXED, Chr.LFLASH), "FLFl");
639 ChrMAP.put(EnumSet.of(Chr.OCCULTING, Chr.FLASH), "OcFl");
640 ChrMAP.put(EnumSet.of(Chr.QUICK, Chr.LFLASH), "Q+LFl");
641 ChrMAP.put(EnumSet.of(Chr.VQUICK, Chr.LFLASH), "VQ+LFl");
642 ChrMAP.put(EnumSet.of(Chr.UQUICK, Chr.LFLASH), "UQ+LFl");
643 ChrMAP.put(EnumSet.of(Chr.ALTERNATING), "Al");
644 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.OCCULTING), "Al.Oc");
645 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.LFLASH), "Al.LFl");
646 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.FLASH), "Al.Fl");
647 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.FIXED), "Al.F");
648 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.FIXED, Chr.FLASH), "Al.FFl");
649 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.ISOPHASED), "Al.Iso");
650 }
651
652 public enum Vis {
653 UNKVIS, HIGH, LOW, FAINT, INTEN, UNINTEN, REST, OBS, PARTOBS
654 }
655
656 public static final EnumMap<Vis, String> VisSTR = new EnumMap<Vis, String>(Vis.class);
657 static {
658 VisSTR.put(Vis.HIGH, "high");
659 VisSTR.put(Vis.LOW, "low");
660 VisSTR.put(Vis.FAINT, "faint");
661 VisSTR.put(Vis.INTEN, "intensified");
662 VisSTR.put(Vis.UNINTEN, "unintensified");
663 VisSTR.put(Vis.REST, "restricted");
664 VisSTR.put(Vis.OBS, "obscured");
665 VisSTR.put(Vis.PARTOBS, "part_obscured");
666 }
667
668 public enum Lit {
669 UNKLIT, VERT, HORIZ, DIR, UPPER, LOWER, LEAD, REAR, FRONT, AERO, AIROBS, FOGDET, FLOOD, STRIP, SUBS, SPOT, MOIRE, EMERG, BEAR
670 }
671
672 public static final EnumMap<Lit, String> LitSTR = new EnumMap<Lit, String>(Lit.class);
673 static {
674 LitSTR.put(Lit.VERT, "vertical");
675 LitSTR.put(Lit.HORIZ, "horizontal");
676 LitSTR.put(Lit.DIR, "directional");
677 LitSTR.put(Lit.UPPER, "upper");
678 LitSTR.put(Lit.LOWER, "lower");
679 LitSTR.put(Lit.LEAD, "leading");
680 LitSTR.put(Lit.REAR, "rear");
681 LitSTR.put(Lit.FRONT, "front");
682 LitSTR.put(Lit.AERO, "aero");
683 LitSTR.put(Lit.AIROBS, "air_obstruction");
684 LitSTR.put(Lit.FOGDET, "fog_detector");
685 LitSTR.put(Lit.FLOOD, "floodlight");
686 LitSTR.put(Lit.STRIP, "striplight");
687 LitSTR.put(Lit.SUBS, "subsidairy");
688 LitSTR.put(Lit.SPOT, "spotlight");
689 LitSTR.put(Lit.MOIRE, "moire");
690 LitSTR.put(Lit.EMERG, "emergency");
691 LitSTR.put(Lit.BEAR, "bearing");
692 }
693
694 public enum Exh {
695 UNKEXH, H24, DAY, NIGHT, FOG, WARN, STORM
696 }
697
698 public static final EnumMap<Exh, String> ExhSTR = new EnumMap<Exh, String>(Exh.class);
699 static {
700 ExhSTR.put(Exh.H24, "24h");
701 ExhSTR.put(Exh.DAY, "day");
702 ExhSTR.put(Exh.NIGHT, "night");
703 ExhSTR.put(Exh.FOG, "fog");
704 ExhSTR.put(Exh.WARN, "warning");
705 ExhSTR.put(Exh.STORM, "storm");
706 }
707
708 public enum Att {
709 COL, CHR, GRP, SEQ, PER, LIT, BEG, END, RAD, HGT, RNG, VIS, EXH, ORT, MLT, ALT
710 }
711
712 public Object[] sector = { Col.UNKCOL, "", "", "", "", Lit.UNKLIT, "", "",
713 "", "", "", Vis.UNKVIS, Exh.UNKEXH, "", "", Col.UNKCOL };
714
715 private ArrayList<Object[]> sectors = new ArrayList<Object[]>();
716
717 public int getSectorCount() {
718 return sectors.size();
719 }
720
721 public boolean isSectored() {
722 return (sectors.size() > 1);
723 }
724
725 public Object getLightAtt(Att att, int i) {
726 return getLightAtt(att.ordinal(), i);
727 }
728
729 public Object getLightAtt(int att, int i) {
730 if (i < sectors.size())
731 return sectors.get(i)[att];
732 else
733 return null;
734 }
735
736 public void setLightAtt(Att att, int i, Object obj) {
737 setLightAtt(att.ordinal(), i, obj);
738 }
739
740 public void setLightAtt(int att, int i, Object obj) {
741 if (sectors.size() == i)
742 addLight(i);
743 if (sectors.size() > i)
744 switch (att) {
745 case 4:
746 case 8:
747 case 9:
748 case 10:
749 sectors.get(i)[att] = validDecimal((String)obj);
750 break;
751 case 6:
752 case 7:
753 case 13:
754 sectors.get(i)[att] = validDecimal((String)obj, 360);
755 break;
756 default:
757 sectors.get(i)[att] = obj;
758 }
759 repaint();
760 }
761
762 public void addLight(int i) {
763 if (sectors.size() >= i) {
764 if (sectors.size() == 0)
765 sectors.add(sector.clone());
766 else
767 sectors.add(i, sectors.get(0).clone());
768 }
769 }
770
771 public void nulLight(int i) {
772 if (i == 0) {
773 clrLight();
774 } else {
775 sectors.add(i, sector.clone());
776 }
777 }
778
779 public void addLight() {
780 if (sectors.size() == 0)
781 sectors.add(sector.clone());
782 else
783 sectors.add(sectors.get(0).clone());
784 }
785
786 public void delLight(int i) {
787 if (sectors.size() > i)
788 sectors.remove(i);
789 repaint();
790 }
791
792 public void clrLight() {
793 sectors.clear();
794 addLight();
795 setLightRef("");
796 repaint();
797 }
798
799 public enum Pat {
800 NOPAT, HSTRP, VSTRP, DIAG, SQUARED, BORDER, CROSS, SALTIRE
801 }
802
803 public static final EnumMap<Pat, String> PatSTR = new EnumMap<Pat, String>(Pat.class);
804 static {
805 PatSTR.put(Pat.HSTRP, "horizontal");
806 PatSTR.put(Pat.VSTRP, "vertical");
807 PatSTR.put(Pat.DIAG, "diagonal");
808 PatSTR.put(Pat.SQUARED, "squared");
809 PatSTR.put(Pat.BORDER, "border");
810 PatSTR.put(Pat.CROSS, "cross");
811 PatSTR.put(Pat.SALTIRE, "saltire");
812 }
813
814 public Pat getPattern(Ent ent) {
815 if (ent == Ent.BODY)
816 return getObjPattern();
817 else
818 return getTopPattern();
819 }
820
821 public void setPattern(Ent ent, Pat pat) {
822 if (ent == Ent.BODY)
823 setObjPattern(pat);
824 else
825 setTopPattern(pat);
826 }
827
828 private Pat bodyPattern = Pat.NOPAT;
829
830 public Pat getObjPattern() {
831 return bodyPattern;
832 }
833
834 public void setObjPattern(Pat pat) {
835 bodyPattern = pat;
836 }
837
838 private Pat topPattern = Pat.NOPAT;
839
840 public Pat getTopPattern() {
841 return topPattern;
842 }
843
844 public void setTopPattern(Pat pat) {
845 topPattern = pat;
846 }
847
848 public enum Top {
849 NOTOP, CYL, CONE, SPHERE, X_SHAPE, NORTH, SOUTH, EAST, WEST, SPHERES2, BOARD, RHOMBUS, CIRCLE, TRIANGLE, TRIANGLE_INV, SQUARE
850 }
851
852 public static final EnumMap<Top, String> TopSTR = new EnumMap<Top, String>(Top.class);
853 static {
854 TopSTR.put(Top.CYL, "cylinder");
855 TopSTR.put(Top.CONE, "cone, point up");
856 TopSTR.put(Top.SPHERE, "sphere");
857 TopSTR.put(Top.X_SHAPE, "x-shape");
858 TopSTR.put(Top.NORTH, "2 cones up");
859 TopSTR.put(Top.SOUTH, "2 cones down");
860 TopSTR.put(Top.EAST, "2 cones base together");
861 TopSTR.put(Top.WEST, "2 cones point together");
862 TopSTR.put(Top.SPHERES2, "2 spheres");
863 TopSTR.put(Top.BOARD, "board");
864 TopSTR.put(Top.RHOMBUS, "rhombus");
865 TopSTR.put(Top.CIRCLE, "circle");
866 TopSTR.put(Top.TRIANGLE, "triangle, point up");
867 TopSTR.put(Top.TRIANGLE_INV, "triangle, point down");
868 TopSTR.put(Top.SQUARE, "square");
869 }
870
871 private Top topShape = Top.NOTOP;
872
873 public Top getTopmark() {
874 return topShape;
875 }
876
877 public void setTopmark(Top top) {
878 topShape = top;
879 repaint();
880 }
881
882 private Cat RoType = Cat.NOROS;
883
884 public Cat getRadio() {
885 return RoType;
886 }
887
888 public void setRadio(Cat type) {
889 RoType = type;
890 repaint();
891 }
892
893 public enum Rtb {
894 NORTB, REFLECTOR, RACON, RAMARK, LEADING
895 }
896
897 public static final EnumMap<Rtb, String> RtbSTR = new EnumMap<Rtb, String>(Rtb.class);
898 static {
899 RtbSTR.put(Rtb.RACON, "racon");
900 RtbSTR.put(Rtb.RAMARK, "ramark");
901 RtbSTR.put(Rtb.LEADING, "leading");
902 }
903
904 private Rtb RaType = Rtb.NORTB;
905
906 public Rtb getRadar() {
907 return RaType;
908 }
909
910 public void setRadar(Rtb type) {
911 RaType = type;
912 if (type == Rtb.NORTB) {
913 setRaconGroup("");
914 setRaconSequence("");
915 setRaconPeriod("");
916 setRaconRange("");
917 setRaconSector1("");
918 setRaconSector2("");
919 }
920 repaint();
921 }
922
923 private String raconGroup = "";
924
925 public String getRaconGroup() {
926 return raconGroup;
927 }
928
929 public void setRaconGroup(String grp) {
930 raconGroup = grp;
931 repaint();
932 }
933
934 private String raconSequence = "";
935
936 public String getRaconSequence() {
937 return raconSequence;
938 }
939
940 public void setRaconSequence(String seq) {
941 raconSequence = seq;
942 repaint();
943 }
944
945 private String raconPeriod = "";
946
947 public String getRaconPeriod() {
948 return raconPeriod;
949 }
950
951 public void setRaconPeriod(String per) {
952 raconPeriod = validDecimal(per);
953 repaint();
954 }
955
956 private String raconRange = "";
957
958 public String getRaconRange() {
959 return raconRange;
960 }
961
962 public void setRaconRange(String rng) {
963 raconRange = validDecimal(rng);
964 repaint();
965 }
966
967 private String raconSector1 = "";
968
969 public String getRaconSector1() {
970 return raconSector1;
971 }
972
973 public void setRaconSector1(String sec) {
974 raconSector1 = validDecimal(sec);
975 repaint();
976 }
977
978 private String raconSector2 = "";
979
980 public String getRaconSector2() {
981 return raconSector2;
982 }
983
984 public void setRaconSector2(String sec) {
985 raconSector2 = validDecimal(sec);
986 repaint();
987 }
988
989 public enum Fog {
990 NOFOG, FOGSIG, HORN, SIREN, DIA, BELL, WHIS, GONG, EXPLOS
991 }
992
993 public static final EnumMap<Fog, String> FogSTR = new EnumMap<Fog, String>(Fog.class);
994 static {
995 FogSTR.put(Fog.FOGSIG, "yes");
996 FogSTR.put(Fog.HORN, "horn");
997 FogSTR.put(Fog.SIREN, "siren");
998 FogSTR.put(Fog.DIA, "diaphone");
999 FogSTR.put(Fog.BELL, "bell");
1000 FogSTR.put(Fog.WHIS, "whistle");
1001 FogSTR.put(Fog.GONG, "gong");
1002 FogSTR.put(Fog.EXPLOS, "explosion");
1003 }
1004
1005 private Fog fogSound = Fog.NOFOG;
1006
1007 public Fog getFogSound() {
1008 return fogSound;
1009 }
1010
1011 public void setFogSound(Fog sound) {
1012 fogSound = sound;
1013 if (sound == Fog.NOFOG) {
1014 setFogGroup("");
1015 setFogSequence("");
1016 setFogPeriod("");
1017 setFogRange("");
1018 }
1019 repaint();
1020 }
1021
1022 private String fogGroup = "";
1023
1024 public String getFogGroup() {
1025 return fogGroup;
1026 }
1027
1028 public void setFogGroup(String grp) {
1029 fogGroup = grp;
1030 repaint();
1031 }
1032
1033 private String fogSequence = "";
1034
1035 public String getFogSequence() {
1036 return fogSequence;
1037 }
1038
1039 public void setFogSequence(String seq) {
1040 fogSequence = seq;
1041 repaint();
1042 }
1043
1044 private String fogRange = "";
1045
1046 public String getFogRange() {
1047 return fogRange;
1048 }
1049
1050 public void setFogRange(String rng) {
1051 fogRange = validDecimal(rng);
1052 repaint();
1053 }
1054
1055 private String fogPeriod = "";
1056
1057 public String getFogPeriod() {
1058 return fogPeriod;
1059 }
1060
1061 public void setFogPeriod(String per) {
1062 fogPeriod = validDecimal(per);
1063 repaint();
1064 }
1065
1066 public enum Sts {
1067 UNKSTS, PERM, OCC, REC, NIU, INT, RESV, TEMP, PRIV, MAND, DEST, EXT, ILLUM, HIST, PUB, SYNC, WATCH, UNWAT, DOUBT
1068 }
1069
1070 public static final EnumMap<Sts, String> StsSTR = new EnumMap<Sts, String>(Sts.class);
1071 static {
1072 StsSTR.put(Sts.PERM, "permanent");
1073 StsSTR.put(Sts.OCC, "occasional");
1074 StsSTR.put(Sts.REC, "recommended");
1075 StsSTR.put(Sts.NIU, "not_in_use");
1076 StsSTR.put(Sts.INT, "intermittent");
1077 StsSTR.put(Sts.RESV, "reserved");
1078 StsSTR.put(Sts.TEMP, "tempory");
1079 StsSTR.put(Sts.PRIV, "private");
1080 StsSTR.put(Sts.MAND, "mandatory");
1081 StsSTR.put(Sts.DEST, "destroyed");
1082 StsSTR.put(Sts.EXT, "extinguished");
1083 StsSTR.put(Sts.ILLUM, "illuminated");
1084 StsSTR.put(Sts.HIST, "historic");
1085 StsSTR.put(Sts.PUB, "public");
1086 StsSTR.put(Sts.SYNC, "synchronized");
1087 StsSTR.put(Sts.WATCH, "watched");
1088 StsSTR.put(Sts.UNWAT, "unwatched");
1089 StsSTR.put(Sts.DOUBT, "existence_doubtful");
1090 }
1091
1092 private Sts status = Sts.UNKSTS;
1093
1094 public Sts getStatus() {
1095 return status;
1096 }
1097
1098 public void setStatus(Sts sts) {
1099 status = sts;
1100 }
1101
1102 public enum Cns {
1103 UNKCNS, BRICK, CONC, BOULD, HSURF, USURF, WOOD, METAL, GLAS, PAINT
1104 }
1105
1106 public static final EnumMap<Cns, String> CnsSTR = new EnumMap<Cns, String>(Cns.class);
1107 static {
1108 CnsSTR.put(Cns.BRICK, "masonry");
1109 CnsSTR.put(Cns.CONC, "concreted");
1110 CnsSTR.put(Cns.BOULD, "boulders");
1111 CnsSTR.put(Cns.HSURF, "hard_surfaced");
1112 CnsSTR.put(Cns.USURF, "unsurfaced");
1113 CnsSTR.put(Cns.WOOD, "wooden");
1114 CnsSTR.put(Cns.METAL, "metal");
1115 CnsSTR.put(Cns.GLAS, "grp");
1116 CnsSTR.put(Cns.PAINT, "painted");
1117 }
1118
1119 private Cns construction = Cns.UNKCNS;
1120
1121 public Cns getConstr() {
1122 return construction;
1123 }
1124
1125 public void setConstr(Cns cns) {
1126 construction = cns;
1127 }
1128
1129 public enum Con {
1130 UNKCON, CONSP, NCONS, REFL
1131 }
1132
1133 public static final EnumMap<Con, String> ConSTR = new EnumMap<Con, String>(Con.class);
1134 static {
1135 ConSTR.put(Con.CONSP, "conspicuous");
1136 ConSTR.put(Con.NCONS, "not_conspicuous");
1137 ConSTR.put(Con.REFL, "reflector");
1138 }
1139
1140 private Con conspicuity = Con.UNKCON;
1141
1142 public Con getConsp() {
1143 return conspicuity;
1144 }
1145
1146 public void setConsp(Con con) {
1147 conspicuity = con;
1148 }
1149
1150 private Con reflectivity = Con.UNKCON;
1151
1152 public Con getRefl() {
1153 return reflectivity;
1154 }
1155
1156 public void setRefl(Con con) {
1157 reflectivity = con;
1158 }
1159
1160 public enum Fnc {
1161 UNKFNC, HMO, CSTM, HLTH, HOSP, POFF, HOTEL, RWSTA, POLICE, WPOL, PILO, PILL, BANK, DCHQ, TRNS, FACT, PWRS, ADMIN, EDUC, CHCH, CHPL,
1162 TMPL, PGDA, SHSH, BTMP, MOSQ, MRBT, LOOK, COMS, TV, RADO, RADR, LSUP, MWAV, COOL, OBSV, TIMB, CLK, CTRL, AMOR, STAD, BUSS,
1163 PRHB, RGLN, RSTN, RCMD, INFO
1164 }
1165
1166 public static final EnumMap<Fnc, String> FncSTR = new EnumMap<Fnc, String>(Fnc.class);
1167 static {
1168 FncSTR.put(Fnc.UNKFNC, "");
1169 FncSTR.put(Fnc.HMO, "harbour-master");
1170 FncSTR.put(Fnc.CSTM, "customs");
1171 FncSTR.put(Fnc.HLTH, "health");
1172 FncSTR.put(Fnc.HOSP, "hospital");
1173 FncSTR.put(Fnc.POFF, "post_office");
1174 FncSTR.put(Fnc.HOTEL, "hotel");
1175 FncSTR.put(Fnc.RWSTA, "railway_station");
1176 FncSTR.put(Fnc.POLICE, "police_station");
1177 FncSTR.put(Fnc.WPOL, "water-police_station");
1178 FncSTR.put(Fnc.PILO, "pilot_office");
1179 FncSTR.put(Fnc.PILL, "pilot_lookout");
1180 FncSTR.put(Fnc.BANK, "bank");
1181 FncSTR.put(Fnc.DCHQ, "district_control");
1182 FncSTR.put(Fnc.TRNS, "transit_shed");
1183 FncSTR.put(Fnc.FACT, "factory");
1184 FncSTR.put(Fnc.PWRS, "power_station");
1185 FncSTR.put(Fnc.ADMIN, "administrative");
1186 FncSTR.put(Fnc.EDUC, "educational");
1187 FncSTR.put(Fnc.CHCH, "church");
1188 FncSTR.put(Fnc.CHPL, "chapel");
1189 FncSTR.put(Fnc.TMPL, "temple");
1190 FncSTR.put(Fnc.PGDA, "pagoda");
1191 FncSTR.put(Fnc.SHSH, "shinto_shrine");
1192 FncSTR.put(Fnc.BTMP, "buddhist_temple");
1193 FncSTR.put(Fnc.MOSQ, "mosque");
1194 FncSTR.put(Fnc.MRBT, "marabout");
1195 FncSTR.put(Fnc.LOOK, "lookout");
1196 FncSTR.put(Fnc.COMS, "communication");
1197 FncSTR.put(Fnc.TV, "television");
1198 FncSTR.put(Fnc.RADO, "radio");
1199 FncSTR.put(Fnc.RADR, "radar");
1200 FncSTR.put(Fnc.LSUP, "light_support");
1201 FncSTR.put(Fnc.MWAV, "microwave");
1202 FncSTR.put(Fnc.COOL, "cooling");
1203 FncSTR.put(Fnc.OBSV, "observation");
1204 FncSTR.put(Fnc.TIMB, "time_ball");
1205 FncSTR.put(Fnc.CLK, "clock");
1206 FncSTR.put(Fnc.CTRL, "control");
1207 FncSTR.put(Fnc.AMOR, "airship_mooring");
1208 FncSTR.put(Fnc.STAD, "stadium");
1209 FncSTR.put(Fnc.BUSS, "bus_station");
1210 FncSTR.put(Fnc.PRHB, "prohibition");
1211 FncSTR.put(Fnc.RGLN, "regulation");
1212 FncSTR.put(Fnc.RSTN, "restriction");
1213 FncSTR.put(Fnc.RCMD, "recommendation");
1214 FncSTR.put(Fnc.INFO, "information");
1215 }
1216
1217 private Fnc function = Fnc.UNKFNC;
1218
1219 public Fnc getFunc() {
1220 return function;
1221 }
1222
1223 public void setFunc(Fnc fnc) {
1224 function = fnc;
1225 repaint();
1226 }
1227
1228 public String information = "";
1229
1230 public String getInfo() {
1231 return information;
1232 }
1233
1234 public void setInfo(String str) {
1235 information = str.trim();
1236 }
1237
1238 public String source = "";
1239
1240 public String getSource() {
1241 return source;
1242 }
1243
1244 public void setSource(String str) {
1245 source = str.trim();
1246 }
1247
1248 public String elevation = "";
1249
1250 public String getElevation() {
1251 return elevation;
1252 }
1253
1254 public void setElevation(String str) {
1255 elevation = validDecimal(str);
1256 }
1257
1258 public String height = "";
1259
1260 public String getObjectHeight() {
1261 return height;
1262 }
1263
1264 public void setObjectHeight(String str) {
1265 height = validDecimal(str);
1266 }
1267
1268 private String channel = "";
1269
1270 public String getChannel() {
1271 return channel;
1272 }
1273
1274 public void setChannel(String per) {
1275 channel = validDecimal(per);
1276 repaint();
1277 }
1278
1279 public String ref = "";
1280
1281 public String getRef() {
1282 return ref;
1283 }
1284
1285 public void setRef(String str) {
1286 ref = str;
1287 }
1288
1289 public String lightRef = "";
1290
1291 public String getLightRef() {
1292 return lightRef;
1293 }
1294
1295 public void setLightRef(String str) {
1296 lightRef = str;
1297 }
1298
1299 public String fixme = "";
1300
1301 public String getFixme() {
1302 return fixme;
1303 }
1304
1305 public void setFixme(String str) {
1306 fixme = str;
1307 }
1308
1309 public boolean testValid() {
1310 if (dlg.node == null) return false;
1311 boolean tmp = false;
1312 PanelMain.messageBar.setText("");
1313 switch (getObject()) {
1314 case BCNCAR:
1315 case BCNLAT:
1316 case BOYCAR:
1317 case BOYLAT:
1318 if ((getCategory() != Cat.NOCAT) && (getShape() != Shp.UNKSHP))
1319 tmp = true;
1320 break;
1321 case BCNISD:
1322 case BCNSAW:
1323 case BCNSPP:
1324 case BOYISD:
1325 case BOYSAW:
1326 case BOYSPP:
1327 if (getShape() != Shp.UNKSHP)
1328 tmp = true;
1329 break;
1330 case FLTCAR:
1331 case FLTISD:
1332 case FLTLAT:
1333 case FLTSAW:
1334 case FLTSPP:
1335 if (getObjColour(0) != Col.UNKCOL)
1336 tmp = true;
1337 break;
1338 case LITMAJ:
1339 case LITMIN:
1340 case LITFLT:
1341 case LITVES:
1342 case LITHSE:
1343 case SISTAW:
1344 case SISTAT:
1345 case OFSPLF:
1346 case MORFAC:
1347 case BOYINB:
1348 case PILBOP:
1349 case RSCSTA:
1350 case RDOSTA:
1351 case RADSTA:
1352 tmp = true;
1353 break;
1354 case NOTMRK:
1355 if (getCategory() != Cat.NOCAT)
1356 tmp = true;
1357 case LNDMRK:
1358 if ((getCategory() != Cat.NOCAT) || (getFunc() != Fnc.UNKFNC))
1359 tmp = true;
1360 break;
1361 }
1362 if (tmp) {
1363 dlg.panelMain.moreButton.setVisible(true);
1364 dlg.panelMain.saveButton.setEnabled(true);
1365 dlg.panelMain.topButton.setEnabled(true);
1366 dlg.panelMain.fogButton.setEnabled(true);
1367 dlg.panelMain.radButton.setEnabled(true);
1368 dlg.panelMain.litButton.setEnabled(true);
1369 return true;
1370 } else {
1371 dlg.panelMain.moreButton.setVisible(false);
1372 dlg.panelMain.moreButton.setText(">>");
1373 dlg.panelMain.topButton.setEnabled(false);
1374 dlg.panelMain.fogButton.setEnabled(false);
1375 dlg.panelMain.radButton.setEnabled(false);
1376 dlg.panelMain.litButton.setEnabled(false);
1377 PanelMain.messageBar.setText("Seamark not recognised");
1378 return false;
1379 }
1380 }
1381
1382 public void clrMark() {
1383 setName("");
1384 setObject(Obj.UNKOBJ);
1385 clrLight();
1386 setFogSound(Fog.NOFOG);
1387 setRadar(Rtb.NORTB);
1388 setRadio(Cat.NOROS);
1389 setStatus(Sts.UNKSTS);
1390 setConstr(Cns.UNKCNS);
1391 setConsp(Con.UNKCON);
1392 setRefl(Con.UNKCON);
1393 setRef("");
1394 setObjectHeight("");
1395 setElevation("");
1396 setChannel("");
1397 setInfo("");
1398 setSource("");
1399 setFixme("");
1400 dlg.panelMain.syncPanel();
1401 repaint();
1402 }
1403
1404 public String validDecimal(String str) {
1405 str = str.trim().replace(',', '.');
1406 if (!(str.isEmpty()) && !(str.matches("^[+-]??\\d+(\\.\\d+)??$"))) {
1407 PanelMain.messageBar.setText(Messages.getString("NotDecimal"));
1408 return "";
1409 } else {
1410 PanelMain.messageBar.setText("");
1411 return str;
1412 }
1413 }
1414
1415 public String validDecimal(String str, float max) {
1416 str = validDecimal(str);
1417 if (!(str.isEmpty()) && (new Float(str) > max)) {
1418 PanelMain.messageBar.setText(Messages.getString("TooBig") + " (" + max + ")");
1419 return "";
1420 } else {
1421 PanelMain.messageBar.setText("");
1422 return str;
1423 }
1424 }
1425
1426 public void parseMark(OsmPrimitive node) {
1427 PanelMain.messageBar.setText("");
1428 String str = Main.pref.get("smedplugin.IALA");
1429 if (str.equals("C"))
1430 setRegion(Reg.C);
1431 else if (str.equals("B"))
1432 setRegion(Reg.B);
1433 else
1434 setRegion(Reg.A);
1435
1436 Map<String, String> keys = node.getKeys();
1437
1438 str = "";
1439 if (keys.containsKey("seamark:type"))
1440 str = keys.get("seamark:type");
1441
1442 clrMark();
1443 for (Obj obj : ObjSTR.keySet()) {
1444 if (ObjSTR.get(obj).equals(str)) {
1445 setObject(obj);
1446 }
1447 }
1448
1449 if (str.equals("")) {
1450 PanelMain.messageBar.setText("No seamark");
1451 }
1452 if (getObject() == Obj.UNKOBJ) {
1453 PanelMain.messageBar.setText("Seamark not recognised");
1454 }
1455
1456 setName("");
1457 for (Obj obj : ObjSTR.keySet()) {
1458 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":name")) {
1459 str = keys.get("seamark:" + ObjSTR.get(obj) + ":name");
1460 setName(str);
1461 }
1462 }
1463 if (keys.containsKey("seamark:name")) {
1464 str = keys.get("seamark:name");
1465 setName(str);
1466 }
1467
1468 for (Obj obj : ObjSTR.keySet()) {
1469 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":category")) {
1470 str = keys.get("seamark:" + ObjSTR.get(obj) + ":category");
1471 if (obj == getObject()) {
1472 setCategory(Cat.NOCAT);
1473 for (Cat cat : CatSTR.keySet()) {
1474 if (CatSTR.get(cat).equals(str)) {
1475 setCategory(cat);
1476 }
1477 }
1478 }
1479 }
1480 }
1481
1482 for (Obj obj : ObjSTR.keySet()) {
1483 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":shape")) {
1484 str = keys.get("seamark:" + ObjSTR.get(obj) + ":shape");
1485 setShape(Shp.UNKSHP);
1486 for (Shp shp : ShpSTR.keySet()) {
1487 if (ShpSTR.get(shp).equals(str)) {
1488 setShape(shp);
1489 }
1490 }
1491 }
1492 }
1493 if (getShape() == Shp.UNKSHP) {
1494 if (EntMAP.get(getObject()) == Ent.BUOY)
1495 setShape(Shp.BUOY);
1496 if (EntMAP.get(getObject()) == Ent.BEACON)
1497 setShape(Shp.BEACON);
1498 if (EntMAP.get(getObject()) == Ent.LFLOAT)
1499 if (getObject() == Obj.LITVES)
1500 setShape(Shp.SUPER);
1501 else
1502 setShape(Shp.FLOAT);
1503 }
1504
1505 for (Obj obj : ObjSTR.keySet()) {
1506 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":colour")) {
1507 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour");
1508 bodyColour.clear();
1509 for (String item : str.split(";")) {
1510 for (Col col : ColSTR.keySet()) {
1511 if (ColSTR.get(col).equals(item)) {
1512 bodyColour.add(col);
1513 }
1514 }
1515 }
1516 }
1517 }
1518
1519 for (Obj obj : ObjSTR.keySet()) {
1520 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":colour_pattern")) {
1521 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour_pattern");
1522 setObjPattern(Pat.NOPAT);
1523 for (Pat pat : PatSTR.keySet()) {
1524 if (PatSTR.get(pat).equals(str)) {
1525 setObjPattern(pat);
1526 }
1527 }
1528 }
1529
1530 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":height")) {
1531 setObjectHeight(keys.get("seamark:" + ObjSTR.get(obj) + ":height"));
1532 }
1533 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":elevation")) {
1534 setElevation(keys.get("seamark:" + ObjSTR.get(obj) + ":elevation"));
1535 }
1536 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":channel")) {
1537 setChannel(keys.get("seamark:" + ObjSTR.get(obj) + ":channel"));
1538 }
1539 }
1540
1541 for (Obj obj : ObjSTR.keySet()) {
1542 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":function")) {
1543 str = keys.get("seamark:" + ObjSTR.get(obj) + ":function");
1544 setFunc(Fnc.UNKFNC);
1545 for (Fnc fnc : FncSTR.keySet()) {
1546 if (FncSTR.get(fnc).equals(str)) {
1547 setFunc(fnc);
1548 }
1549 }
1550 }
1551 }
1552
1553 if ((getObject() == Obj.LNDMRK) && (getCategory() == Cat.NOCAT) && (getFunc() == Fnc.UNKFNC)) {
1554 setObject(Obj.LITHSE);
1555 }
1556
1557 if (getObject() == Obj.LITFLT) {
1558 switch (getObjColour(0)) {
1559 case RED:
1560 if ((getObjColour(1) == Col.WHITE) && (getObjColour(2) == Col.UNKCOL)) {
1561 setObject(Obj.FLTSAW);
1562 setCategory(Cat.NOCAT);
1563 } else if (getObjColour(1) == Col.UNKCOL) {
1564 setObject(Obj.FLTLAT);
1565 if (getRegion() == Reg.B) {
1566 setCategory(Cat.LAM_STBD);
1567 } else {
1568 setCategory(Cat.LAM_PORT);
1569 }
1570 } else if ((getObjColour(1) == Col.GREEN)
1571 && (getObjColour(2) == Col.RED)) {
1572 setObject(Obj.FLTLAT);
1573 if (getRegion() == Reg.B) {
1574 setCategory(Cat.LAM_PSTBD);
1575 } else {
1576 setCategory(Cat.LAM_PPORT);
1577 }
1578 } else if ((getObjColour(1) == Col.WHITE)
1579 && (getObjColour(2) == Col.RED)) {
1580 setObject(Obj.FLTLAT);
1581 setCategory(Cat.LAM_PORT);
1582 } else {
1583 setObject(Obj.FLTSPP);
1584 setCategory(Cat.NOCAT);
1585 }
1586 break;
1587 case GREEN:
1588 if (getObjColour(1) == Col.UNKCOL) {
1589 setObject(Obj.FLTLAT);
1590 if (getRegion() == Reg.B) {
1591 setCategory(Cat.LAM_PORT);
1592 } else {
1593 setCategory(Cat.LAM_STBD);
1594 }
1595 } else if ((getObjColour(1) == Col.RED)
1596 && (getObjColour(2) == Col.GREEN)) {
1597 setObject(Obj.FLTLAT);
1598 if (getRegion() == Reg.B) {
1599 setCategory(Cat.LAM_PPORT);
1600 } else {
1601 setCategory(Cat.LAM_PSTBD);
1602 }
1603 } else if ((getObjColour(1) == Col.WHITE)
1604 && (getObjColour(2) == Col.GREEN)) {
1605 setObject(Obj.FLTLAT);
1606 setCategory(Cat.LAM_STBD);
1607 } else {
1608 setObject(Obj.FLTSPP);
1609 setCategory(Cat.NOCAT);
1610 }
1611 break;
1612 case YELLOW:
1613 if (getObjColour(1) == Col.BLACK) {
1614 setObject(Obj.FLTCAR);
1615 if (getObjColour(2) == Col.YELLOW) {
1616 setCategory(Cat.CAM_WEST);
1617 } else {
1618 setCategory(Cat.CAM_SOUTH);
1619 }
1620 } else {
1621 setObject(Obj.FLTSPP);
1622 setCategory(Cat.NOCAT);
1623 }
1624 break;
1625 case BLACK:
1626 if (getObjColour(1) == Col.RED) {
1627 setObject(Obj.FLTISD);
1628 setCategory(Cat.NOCAT);
1629 } else if (getObjColour(1) == Col.YELLOW) {
1630 setObject(Obj.FLTCAR);
1631 if (getObjColour(2) == Col.BLACK) {
1632 setCategory(Cat.CAM_EAST);
1633 } else {
1634 setCategory(Cat.CAM_NORTH);
1635 }
1636 } else {
1637 setObject(Obj.FLTSPP);
1638 setCategory(Cat.NOCAT);
1639 }
1640 break;
1641 default:
1642 setCategory(Cat.NOCAT);
1643 }
1644 }
1645
1646 for (Obj obj : ObjSTR.keySet()) {
1647 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":system")) {
1648 str = keys.get("seamark:" + ObjSTR.get(obj) + ":system");
1649 if (str.equals("iala-a"))
1650 setRegion(Reg.A);
1651 else if (str.equals("iala-b"))
1652 setRegion(Reg.B);
1653 else
1654 setRegion(Reg.C);
1655 } else if (GrpMAP.get(object) == Grp.LAT) {
1656 switch (getCategory()) {
1657 case LAM_PORT:
1658 if (getObjColour(0) == Col.RED) {
1659 if (getObjColour(1) == Col.WHITE)
1660 setRegion(Reg.C);
1661 else
1662 setRegion(Reg.A);
1663 }
1664 if (getObjColour(0) == Col.GREEN)
1665 setRegion(Reg.B);
1666 break;
1667 case LAM_PPORT:
1668 if (getObjColour(0) == Col.RED) {
1669 if (getObjColour(3) == Col.GREEN)
1670 setRegion(Reg.C);
1671 else
1672 setRegion(Reg.B);
1673 }
1674 if (getObjColour(0) == Col.GREEN)
1675 setRegion(Reg.A);
1676 break;
1677 case LAM_STBD:
1678 if (getObjColour(0) == Col.GREEN) {
1679 if (getObjColour(1) == Col.WHITE)
1680 setRegion(Reg.C);
1681 else
1682 setRegion(Reg.A);
1683 }
1684 if (getObjColour(0) == Col.RED)
1685 setRegion(Reg.B);
1686 break;
1687 case LAM_PSTBD:
1688 if (getObjColour(0) == Col.GREEN)
1689 setRegion(Reg.B);
1690 if (getObjColour(0) == Col.RED) {
1691 if (getObjColour(3) == Col.GREEN)
1692 setRegion(Reg.C);
1693 else
1694 setRegion(Reg.A);
1695 }
1696 break;
1697 }
1698 }
1699 }
1700
1701 if (keys.containsKey("seamark:topmark:shape")) {
1702 str = keys.get("seamark:topmark:shape");
1703 setTopmark(Top.NOTOP);
1704 for (Top top : TopSTR.keySet()) {
1705 if (TopSTR.get(top).equals(str)) {
1706 setTopmark(top);
1707 }
1708 }
1709 }
1710 if (keys.containsKey("seamark:topmark:colour")) {
1711 str = keys.get("seamark:topmark:colour");
1712 setTopColour(Col.UNKCOL);
1713 for (Col col : ColSTR.keySet()) {
1714 if (ColSTR.get(col).equals(str)) {
1715 setTopColour(col);
1716 }
1717 }
1718 }
1719 if (keys.containsKey("seamark:topmark:colour_pattern")) {
1720 str = keys.get("seamark:topmark:colour_pattern");
1721 setTopPattern(Pat.NOPAT);
1722 for (Pat pat : PatSTR.keySet()) {
1723 if (PatSTR.get(pat).equals(str)) {
1724 setTopPattern(pat);
1725 }
1726 }
1727 }
1728
1729 clrLight();
1730 for (int i = 0; i < 30; i++) {
1731 String secStr = (i == 0) ? "" : (":" + Integer.toString(i));
1732 if (keys.containsKey("seamark:light" + secStr + ":colour")) {
1733 nulLight(i);
1734 str = keys.get("seamark:light" + secStr + ":colour");
1735 if (str.contains(";")) {
1736 String strs[] = str.split(";");
1737 for (Col col : ColSTR.keySet())
1738 if ((strs.length > 1) && ColSTR.get(col).equals(strs[1]))
1739 setLightAtt(Att.ALT, i, col);
1740 str = strs[0];
1741 }
1742 for (Col col : ColSTR.keySet())
1743 if (ColSTR.get(col).equals(str))
1744 setLightAtt(Att.COL, i, col);
1745 }
1746 if (keys.containsKey("seamark:light" + secStr + ":character")) {
1747 str = keys.get("seamark:light" + secStr + ":character");
1748 if (str.contains("(") && str.contains(")")) {
1749 int i1 = str.indexOf("(");
1750 int i2 = str.indexOf(")");
1751 setLightAtt(Att.GRP, i, str.substring((i1+1), i2));
1752 str = str.substring(0, i1) + str.substring((i2+1), str.length());
1753 }
1754 setLightAtt(Att.CHR, i, str);
1755 }
1756 if (keys.containsKey("seamark:light" + secStr + ":group"))
1757 setLightAtt(Att.GRP, i, keys.get("seamark:light" + secStr + ":group"));
1758 if (keys.containsKey("seamark:light" + secStr + ":sequence"))
1759 setLightAtt(Att.SEQ, i, keys.get("seamark:light" + secStr + ":sequence"));
1760 if (keys.containsKey("seamark:light" + secStr + ":period"))
1761 setLightAtt(Att.PER, i, keys.get("seamark:light" + secStr + ":period"));
1762 if (keys.containsKey("seamark:light" + secStr + ":category")) {
1763 str = keys.get("seamark:light" + secStr + ":category");
1764 if (str.equals("vert"))
1765 str = "vertical";
1766 if (str.equals("horiz"))
1767 str = "horizontal";
1768 for (Lit lit : LitSTR.keySet())
1769 if (LitSTR.get(lit).equals(str))
1770 setLightAtt(Att.LIT, i, lit);
1771 }
1772 if (keys.containsKey("seamark:light" + secStr + ":sector_start"))
1773 setLightAtt(Att.BEG, i, keys.get("seamark:light" + secStr + ":sector_start"));
1774 if (keys.containsKey("seamark:light" + secStr + ":sector_end"))
1775 setLightAtt(Att.END, i, keys.get("seamark:light" + secStr + ":sector_end"));
1776 if (keys.containsKey("seamark:light" + secStr + ":radius"))
1777 setLightAtt(Att.RAD, i, keys.get("seamark:light" + secStr + ":radius"));
1778 if (keys.containsKey("seamark:light" + secStr + ":height"))
1779 setLightAtt(Att.HGT, i, keys.get("seamark:light" + secStr + ":height"));
1780 if (keys.containsKey("seamark:light" + secStr + ":range"))
1781 setLightAtt(Att.RNG, i, keys.get("seamark:light" + secStr + ":range"));
1782 if (keys.containsKey("seamark:light" + secStr + ":visibility")) {
1783 str = keys.get("seamark:light" + secStr + ":visibility");
1784 for (Vis vis : VisSTR.keySet())
1785 if (VisSTR.get(vis).equals(str))
1786 setLightAtt(Att.VIS, i, vis);
1787 }
1788 if (keys.containsKey("seamark:light" + secStr + ":exhibition")) {
1789 str = keys.get("seamark:light" + secStr + ":exhibition");
1790 for (Exh exh : ExhSTR.keySet())
1791 if (ExhSTR.get(exh).equals(str))
1792 setLightAtt(Att.EXH, i, exh);
1793 }
1794 if (keys.containsKey("seamark:light" + secStr + ":orientation"))
1795 setLightAtt(Att.ORT, i, keys.get("seamark:light" + secStr + ":orientation"));
1796 if (keys.containsKey("seamark:light" + secStr + ":multiple"))
1797 setLightAtt(Att.MLT, i, keys.get("seamark:light" + secStr + ":multiple"));
1798
1799 if (sectors.size() == i)
1800 break;
1801 }
1802
1803 if (keys.containsKey("seamark:fog_signal")) {
1804 setFogSound(Fog.FOGSIG);
1805 }
1806 if (keys.containsKey("seamark:fog_signal:category")) {
1807 str = keys.get("seamark:fog_signal:category");
1808 setFogSound(Fog.NOFOG);
1809 for (Fog fog : FogSTR.keySet()) {
1810 if (FogSTR.get(fog).equals(str)) {
1811 setFogSound(fog);
1812 }
1813 }
1814 }
1815 if (keys.containsKey("seamark:fog_signal:group")) {
1816 setFogGroup(keys.get("seamark:fog_signal:group"));
1817 }
1818 if (keys.containsKey("seamark:fog_signal:period")) {
1819 setFogPeriod(keys.get("seamark:fog_signal:period"));
1820 }
1821 if (keys.containsKey("seamark:fog_signal:sequence")) {
1822 setFogSequence(keys.get("seamark:fog_signal:sequence"));
1823 }
1824 if (keys.containsKey("seamark:fog_signal:range")) {
1825 setFogRange(keys.get("seamark:fog_signal:range"));
1826 }
1827
1828 if (keys.containsKey("seamark:radio_station:category")) {
1829 str = keys.get("seamark:radio_station:category");
1830 setRadio(Cat.NOROS);
1831 for (Cat rdo : CatSTR.keySet()) {
1832 if (CatSTR.get(rdo).equals(str)) {
1833 setRadio(rdo);
1834 }
1835 }
1836 }
1837
1838 if (keys.containsKey("seamark:radar_reflector")) {
1839 setRadar(Rtb.REFLECTOR);
1840 }
1841 if (keys.containsKey("seamark:radar_transponder:category")) {
1842 str = keys.get("seamark:radar_transponder:category");
1843 setRadar(Rtb.NORTB);
1844 for (Rtb rtb : RtbSTR.keySet()) {
1845 if (RtbSTR.get(rtb).equals(str)) {
1846 setRadar(rtb);
1847 }
1848 }
1849 }
1850 if (keys.containsKey("seamark:radar_transponder:group")) {
1851 setRaconGroup(keys.get("seamark:radar_transponder:group"));
1852 }
1853 if (keys.containsKey("seamark:radar_transponder:period")) {
1854 setRaconPeriod(keys.get("seamark:radar_transponder:period"));
1855 }
1856 if (keys.containsKey("seamark:radar_transponder:sequence")) {
1857 setRaconSequence(keys.get("seamark:radar_transponder:sequence"));
1858 }
1859 if (keys.containsKey("seamark:radar_transponder:range")) {
1860 setRaconRange(keys.get("seamark:radar_transponder:range"));
1861 }
1862 if (keys.containsKey("seamark:radar_transponder:sector_start")) {
1863 setRaconSector1(keys.get("seamark:radar_transponder:sector_start"));
1864 }
1865 if (keys.containsKey("seamark:radar_transponder:sector_end")) {
1866 setRaconSector2(keys.get("seamark:radar_transponder:sector_end"));
1867 }
1868
1869 if (keys.containsKey("seamark:information")) {
1870 setInfo(keys.get("seamark:information"));
1871 }
1872 if (keys.containsKey("seamark:light:information")) {
1873 setInfo(getInfo() + keys.get("seamark:light:information"));
1874 }
1875 if (keys.containsKey("seamark:" + ObjSTR.get(getObject()) + "information")) {
1876 setInfo(getInfo() + keys.get("seamark:" + ObjSTR.get(getObject()) + "information"));
1877 }
1878 if (keys.containsKey("seamark:source")) {
1879 setSource(keys.get("seamark:source"));
1880 }
1881 if (keys.containsKey("seamark:light:source")) {
1882 setSource(getSource() + keys.get("seamark:light:source"));
1883 }
1884 if (keys.containsKey("seamark:" + ObjSTR.get(getObject()) + "source")) {
1885 setSource(getSource() + keys.get("seamark:" + ObjSTR.get(getObject()) + "source"));
1886 }
1887 if (keys.containsKey("seamark:height")) {
1888 setObjectHeight(keys.get("seamark:height"));
1889 }
1890 if (keys.containsKey("seamark:elevation")) {
1891 setElevation(keys.get("seamark:elevation"));
1892 }
1893 if (keys.containsKey("seamark:status")) {
1894 str = keys.get("seamark:status");
1895 setStatus(Sts.UNKSTS);
1896 for (Sts sts : StsSTR.keySet()) {
1897 if (StsSTR.get(sts).equals(str)) {
1898 setStatus(sts);
1899 }
1900 }
1901 }
1902 if (keys.containsKey("seamark:construction")) {
1903 str = keys.get("seamark:construction");
1904 setConstr(Cns.UNKCNS);
1905 for (Cns cns : CnsSTR.keySet()) {
1906 if (CnsSTR.get(cns).equals(str)) {
1907 setConstr(cns);
1908 }
1909 }
1910 }
1911 if (keys.containsKey("seamark:conspicuity")) {
1912 str = keys.get("seamark:conspicuity");
1913 setConsp(Con.UNKCON);
1914 for (Con con : ConSTR.keySet()) {
1915 if (ConSTR.get(con).equals(str)) {
1916 setConsp(con);
1917 }
1918 }
1919 }
1920 if (keys.containsKey("seamark:reflectivity")) {
1921 str = keys.get("seamark:reflectivity");
1922 setRefl(Con.UNKCON);
1923 for (Con con : ConSTR.keySet()) {
1924 if (ConSTR.get(con).equals(str)) {
1925 setRefl(con);
1926 }
1927 }
1928 }
1929
1930 if (keys.containsKey("seamark:ref")) {
1931 setRef(keys.get("seamark:ref"));
1932 }
1933 if (keys.containsKey("seamark:reference")) {
1934 setRef(keys.get("seamark:reference"));
1935 }
1936 if (keys.containsKey("seamark:light:ref")) {
1937 setLightRef(keys.get("seamark:light:ref"));
1938 }
1939 if (keys.containsKey("seamark:light:reference")) {
1940 setLightRef(keys.get("seamark:light:reference"));
1941 }
1942 if (keys.containsKey("seamark:fixme")) {
1943 setFixme(keys.get("seamark:fixme"));
1944 }
1945
1946 dlg.panelMain.syncPanel();
1947 }
1948
1949 public void paintComponent(Graphics g) {
1950 super.paintComponent(g);
1951
1952 if (dlg.node == null) return;
1953
1954 Graphics2D g2 = (Graphics2D) g;
1955
1956 String colStr;
1957 String lblStr;
1958 String imgStr = "/images/";
1959 if (getShape() != Shp.UNKSHP) {
1960 switch (getShape()) {
1961 case TOWER:
1962 imgStr += "Tower";
1963 break;
1964 case BUOY:
1965 case PILLAR:
1966 imgStr += "Pillar";
1967 break;
1968 case SPAR:
1969 imgStr += "Spar";
1970 break;
1971 case CAN:
1972 imgStr += "Can";
1973 break;
1974 case CONI:
1975 imgStr += "Cone";
1976 break;
1977 case SPHERI:
1978 imgStr += "Sphere";
1979 break;
1980 case BARREL:
1981 imgStr += "Barrel";
1982 break;
1983 case CAIRN:
1984 imgStr += "Cairn";
1985 break;
1986 case FLOAT:
1987 imgStr += "Float";
1988 break;
1989 case BEACON:
1990 case PILE:
1991 case LATTICE:
1992 case BUOYANT:
1993 imgStr += "Beacon";
1994 break;
1995 case SUPER:
1996 imgStr += "Super";
1997 break;
1998 case STAKE:
1999 case POLE:
2000 case POST:
2001 imgStr += "Stake";
2002 break;
2003 case PERCH:
2004 if (getCategory() == Cat.LAM_PORT) {
2005 imgStr += "Perch_Port";
2006 } else {
2007 imgStr += "Perch_Starboard";
2008 }
2009 break;
2010 }
2011 colStr = imgStr;
2012 lblStr = "";
2013 for (Col col : bodyColour) {
2014 switch (col) {
2015 case WHITE:
2016 colStr += "_White";
2017 lblStr += "W";
2018 break;
2019 case RED:
2020 colStr += "_Red";
2021 lblStr += "R";
2022 break;
2023 case ORANGE:
2024 colStr += "_Orange";
2025 lblStr += "Or";
2026 break;
2027 case AMBER:
2028 colStr += "_Amber";
2029 lblStr += "Am";
2030 break;
2031 case YELLOW:
2032 colStr += "_Yellow";
2033 lblStr += "Y";
2034 break;
2035 case GREEN:
2036 colStr += "_Green";
2037 lblStr += "G";
2038 break;
2039 case BLUE:
2040 colStr += "_Blue";
2041 lblStr += "Bu";
2042 break;
2043 case VIOLET:
2044 colStr += "_Violet";
2045 lblStr += "Vi";
2046 break;
2047 case BLACK:
2048 colStr += "_Black";
2049 lblStr += "B";
2050 break;
2051 case GREY:
2052 colStr += "_Grey";
2053 lblStr += "Gr";
2054 break;
2055 case BROWN:
2056 colStr += "_Brown";
2057 lblStr += "Br";
2058 break;
2059 case MAGENTA:
2060 colStr += "_Magenta";
2061 lblStr += "Mg";
2062 break;
2063 case PINK:
2064 colStr += "_Pink";
2065 lblStr += "Pk";
2066 break;
2067 }
2068 }
2069 if (!imgStr.equals("/images/")) {
2070 colStr += ".png";
2071 if (getClass().getResource(colStr) == null) {
2072 System.out.println("Missing image1: " + colStr);
2073 imgStr += ".png";
2074 if (getClass().getResource(imgStr) == null) {
2075 System.out.println("Missing image2: " + imgStr);
2076 } else {
2077 g2.drawImage(new ImageIcon(getClass().getResource(imgStr)).getImage(), 7, -15, null);
2078 g2.drawString(lblStr, 75, 110);
2079 }
2080 } else {
2081 g2.drawImage(new ImageIcon(getClass().getResource(colStr)).getImage(), 7, -15, null);
2082 }
2083 }
2084 } else if (getObject() != Obj.UNKOBJ) {
2085 switch (getObject()) {
2086 case LNDMRK:
2087 switch (getCategory()) {
2088 case LMK_CHMY:
2089 imgStr += "Chimney";
2090 break;
2091 case LMK_CARN:
2092 imgStr += "Cairn";
2093 break;
2094 case LMK_DSHA:
2095 imgStr += "DishAerial";
2096 break;
2097 case LMK_FLGS:
2098 imgStr += "Flagstaff";
2099 break;
2100 case LMK_FLRS:
2101 imgStr += "FlareStack";
2102 break;
2103 case LMK_MNMT:
2104 case LMK_CLMN:
2105 case LMK_OBLK:
2106 case LMK_STAT:
2107 imgStr += "Monument";
2108 break;
2109 case LMK_MAST:
2110 imgStr += "RadioMast";
2111 break;
2112 case LMK_TOWR:
2113 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL))
2114 imgStr += "ChurchTower";
2115 else
2116 imgStr += "LandTower";
2117 break;
2118 case LMK_WNDM:
2119 imgStr += "Wind_Motor";
2120 break;
2121 case LMK_WTRT:
2122 imgStr += "WaterTower";
2123 break;
2124 case LMK_DOME:
2125 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL))
2126 imgStr += "ChurchDome";
2127 else
2128 imgStr += "Dome";
2129 break;
2130 case LMK_SPIR:
2131 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL))
2132 imgStr += "ChurchSpire";
2133 else
2134 imgStr += "Spire";
2135 break;
2136 case LMK_MNRT:
2137 imgStr += "Minaret";
2138 break;
2139 case LMK_WNDS:
2140 imgStr += "Windsock";
2141 break;
2142 case LMK_CROS:
2143 imgStr += "Cross";
2144 break;
2145 case LMK_SCNR:
2146 imgStr += "Signal_Station";
2147 break;
2148 case LMK_WNDL:
2149 imgStr += "Windmill";
2150 break;
2151 case NOCAT:
2152 switch (getFunc()) {
2153 case CHCH:
2154 case CHPL:
2155 imgStr += "Church";
2156 break;
2157 case TMPL:
2158 case PGDA:
2159 case SHSH:
2160 case BTMP:
2161 imgStr += "Temple";
2162 break;
2163 case MOSQ:
2164 imgStr += "Minaret";
2165 break;
2166 case MRBT:
2167 imgStr += "Spire";
2168 break;
2169 }
2170 }
2171 break;
2172 case LITHSE:
2173 imgStr += "Light_House";
2174 break;
2175 case LITMAJ:
2176 imgStr += "Light_Major";
2177 break;
2178 case LITMIN:
2179 imgStr += "Light_Minor";
2180 break;
2181 case LITFLT:
2182 imgStr += "Float";
2183 break;
2184 case LITVES:
2185 imgStr += "Super";
2186 break;
2187 case SISTAW:
2188 imgStr += "Signal_Station";
2189 break;
2190 case SISTAT:
2191 imgStr += "Signal_Station";
2192 break;
2193 case OFSPLF:
2194 if (getCategory() == Cat.OFP_FPSO)
2195 imgStr += "Storage";
2196 else
2197 imgStr += "Platform";
2198 break;
2199 case MORFAC:
2200 switch (getCategory()) {
2201 case MOR_DLPN:
2202 imgStr += "Dolphin";
2203 break;
2204 case MOR_DDPN:
2205 imgStr += "DeviationDolphin";
2206 break;
2207 case MOR_POST:
2208 imgStr += "Post";
2209 break;
2210 case MOR_BUOY:
2211 imgStr += "Sphere";
2212 break;
2213 }
2214 break;
2215 case BOYINB:
2216 imgStr += "Super";
2217 break;
2218 case CGUSTA:
2219 imgStr += "Signal_Station";
2220 break;
2221 case PILBOP:
2222 imgStr += "Pilot";
2223 break;
2224 case RSCSTA:
2225 imgStr += "Rescue";
2226 break;
2227 case RDOSTA:
2228 case RADSTA:
2229 imgStr += "Signal_Station";
2230 g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Station.png")).getImage(), 7, -15, null);
2231 break;
2232 }
2233 if (!imgStr.equals("/images/")) {
2234 imgStr += ".png";
2235 if (getClass().getResource(imgStr) == null) {
2236 System.out.println("Missing image3: " + imgStr);
2237 } else {
2238 g2.drawImage(new ImageIcon(getClass().getResource(imgStr)).getImage(), 7, -15, null);
2239 }
2240 }
2241 }
2242
2243 if (getTopmark() != Top.NOTOP) {
2244 imgStr = "/images/Top_";
2245 switch (getTopmark()) {
2246 case CYL:
2247 imgStr += "Can";
2248 break;
2249 case CONE:
2250 imgStr += "Cone";
2251 break;
2252 case SPHERE:
2253 imgStr += "Sphere";
2254 break;
2255 case X_SHAPE:
2256 imgStr += "X";
2257 break;
2258 case NORTH:
2259 imgStr += "North";
2260 break;
2261 case SOUTH:
2262 imgStr += "South";
2263 break;
2264 case EAST:
2265 imgStr += "East";
2266 break;
2267 case WEST:
2268 imgStr += "West";
2269 break;
2270 case SPHERES2:
2271 imgStr += "Isol";
2272 break;
2273 }
2274 colStr = imgStr;
2275 for (Col col : topmarkColour) {
2276 switch (col) {
2277 case WHITE:
2278 colStr += "_White";
2279 break;
2280 case RED:
2281 colStr += "_Red";
2282 break;
2283 case ORANGE:
2284 colStr += "_Orange";
2285 break;
2286 case AMBER:
2287 colStr += "_Amber";
2288 break;
2289 case YELLOW:
2290 colStr += "_Yellow";
2291 break;
2292 case GREEN:
2293 colStr += "_Green";
2294 break;
2295 case BLUE:
2296 colStr += "_Blue";
2297 break;
2298 case VIOLET:
2299 colStr += "_Violet";
2300 break;
2301 case BLACK:
2302 colStr += "_Black";
2303 break;
2304 }
2305 }
2306 switch (getShape()) {
2307 case CAN:
2308 case CONI:
2309 case SPHERI:
2310 case BARREL:
2311 imgStr += "_Buoy_Small";
2312 colStr += "_Buoy_Small";
2313 break;
2314 case PILLAR:
2315 case SPAR:
2316 imgStr += "_Buoy";
2317 colStr += "_Buoy";
2318 break;
2319 case FLOAT:
2320 case SUPER:
2321 imgStr += "_Float";
2322 colStr += "_Float";
2323 break;
2324 case BUOYANT:
2325 case CAIRN:
2326 case PILE:
2327 case LATTICE:
2328 case TOWER:
2329 case STAKE:
2330 case POLE:
2331 case POST:
2332 case BEACON:
2333 imgStr += "_Beacon";
2334 colStr += "_Beacon";
2335 break;
2336 }
2337 colStr += ".png";
2338 if (getClass().getResource(colStr) == null) {
2339 System.out.println("Missing image4: " + colStr);
2340 imgStr += ".png";
2341 if (getClass().getResource(imgStr) == null) {
2342 System.out.println("Missing image5: " + imgStr);
2343 return;
2344 } else {
2345 g2.drawImage(new ImageIcon(getClass().getResource(imgStr)).getImage(), 7, -15, null);
2346 }
2347 } else {
2348 g2.drawImage(new ImageIcon(getClass().getResource(colStr)).getImage(), 7, -15, null);
2349 }
2350 } else {
2351 if ((getObject() == Obj.BOYINB) || ((getObject() == Obj.MORFAC) && (getCategory() == Cat.MOR_BUOY))) {
2352 imgStr = "/images/Top_Mooring";
2353 switch (getShape()) {
2354 case CAN:
2355 case CONI:
2356 case SPHERI:
2357 case BARREL:
2358 imgStr += "_Buoy_Small";
2359 break;
2360 case FLOAT:
2361 case SUPER:
2362 imgStr += "_Float";
2363 break;
2364 default:
2365 if (getObject() == Obj.MORFAC) {
2366 imgStr += "_Buoy_Small";
2367 } else {
2368 imgStr += "_Float";
2369 }
2370 break;
2371 }
2372 imgStr += ".png";
2373 if (getClass().getResource(imgStr) == null) {
2374 System.out.println("Missing image6: " + imgStr);
2375 return;
2376 } else {
2377 g2.drawImage(new ImageIcon(getClass().getResource(imgStr)).getImage(), 7, -15, null);
2378 }
2379 }
2380 }
2381
2382 for (int i = 1; i < sectors.size(); i++) {
2383 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
2384 g2.setStroke(new BasicStroke(6.0f));
2385 if (!((String)getLightAtt(Att.BEG, i)).isEmpty() && !((String)getLightAtt(Att.END, i)).isEmpty()) {
2386 if (getLightAtt(Att.COL, i) != Col.UNKCOL) {
2387 g2.setPaint(ColMAP.get(getLightAtt(Att.COL, i)));
2388 Double a0 = 270 - Double.parseDouble((String)getLightAtt(Att.BEG, i));
2389 Double da = 270 - Double.parseDouble((String)getLightAtt(Att.END, i)) - a0;
2390 da -= da > 0 ? 360 : 0;
2391 g2.draw(new Arc2D.Double(12, 15, 140, 140, a0, da, Arc2D.OPEN));
2392 }
2393 if (getLightAtt(Att.ALT, i) != Col.UNKCOL) {
2394 g2.setPaint(ColMAP.get(getLightAtt(Att.ALT, i)));
2395 Double a0 = 270 - Double.parseDouble((String)getLightAtt(Att.BEG, i));
2396 Double da = 270 - Double.parseDouble((String)getLightAtt(Att.END, i)) - a0;
2397 da -= da > 0 ? 360 : 0;
2398 g2.draw(new Arc2D.Double(17, 20, 130, 130, a0, da, Arc2D.OPEN));
2399 }
2400 } else if ((getLightAtt(Att.LIT, i) == Lit.DIR) && !((String)getLightAtt(Att.ORT, i)).isEmpty()) {
2401 if (getLightAtt(Att.COL, i) != Col.UNKCOL) {
2402 g2.setPaint(ColMAP.get(getLightAtt(Att.COL, i)));
2403 Double a0 = 270 - Double.parseDouble((String)getLightAtt(Att.ORT, i)) + 2.0;
2404 Double da = -4.0;
2405 g2.draw(new Arc2D.Double(12, 15, 140, 140, a0, da, Arc2D.OPEN));
2406 }
2407 if (getLightAtt(Att.ALT, i) != Col.UNKCOL) {
2408 g2.setPaint(ColMAP.get(getLightAtt(Att.ALT, i)));
2409 Double a0 = 270 - Double.parseDouble((String)getLightAtt(Att.ORT, i)) + 2.0;
2410 Double da = -4.0;
2411 g2.draw(new Arc2D.Double(17, 20, 130, 130, a0, da, Arc2D.OPEN));
2412 }
2413 }
2414 }
2415 g2.setPaint(Color.BLACK);
2416 if ((getLightAtt(Att.COL, 0) != Col.UNKCOL) || !(((String)getLightAtt(Att.CHR, 0)).isEmpty())) {
2417 if (sectors.size() == 1) {
2418 if (((String) getLightAtt(Att.CHR, 0)).contains("Al")) {
2419 g2.drawImage(new ImageIcon(getClass().getResource("/images/Light_Magenta_120.png")).getImage(), 7, -15, null);
2420 } else {
2421 switch ((Col) getLightAtt(Att.COL, 0)) {
2422 case RED:
2423 g2.drawImage(new ImageIcon(getClass().getResource("/images/Light_Red_120.png")).getImage(), 7, -15, null);
2424 break;
2425 case GREEN:
2426 g2.drawImage(new ImageIcon(getClass().getResource("/images/Light_Green_120.png")).getImage(), 7, -15, null);
2427 break;
2428 case WHITE:
2429 case YELLOW:
2430 g2.drawImage(new ImageIcon(getClass().getResource("/images/Light_White_120.png")).getImage(), 7, -15, null);
2431 break;
2432 default:
2433 g2.drawImage(new ImageIcon(getClass().getResource("/images/Light_Magenta_120.png")).getImage(), 7, -15, null);
2434 }
2435 }
2436 }
2437 String c = (String) getLightAtt(Att.CHR, 0);
2438 String tmp = "";
2439 if (c.contains("+")) {
2440 int i1 = c.indexOf("+");
2441 tmp = c.substring(i1, c.length());
2442 c = c.substring(0, i1);
2443 if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) {
2444 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")";
2445 }
2446 if (tmp != null)
2447 c += tmp;
2448 } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty())
2449 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")";
2450 switch ((Col) getLightAtt(Att.COL, 0)) {
2451 case WHITE:
2452 c += ".W";
2453 break;
2454 case YELLOW:
2455 c += ".Y";
2456 break;
2457 case RED:
2458 c += ".R";
2459 break;
2460 case GREEN:
2461 c += ".G";
2462 break;
2463 case AMBER:
2464 c += ".Am";
2465 break;
2466 case ORANGE:
2467 c += ".Or";
2468 break;
2469 case BLUE:
2470 c += ".Bu";
2471 break;
2472 case VIOLET:
2473 c += ".Vi";
2474 break;
2475 }
2476 switch ((Col) getLightAtt(Att.ALT, 0)) {
2477 case WHITE:
2478 c += "W";
2479 break;
2480 case YELLOW:
2481 c += "Y";
2482 break;
2483 case RED:
2484 c += "R";
2485 break;
2486 case GREEN:
2487 c += "G";
2488 break;
2489 case AMBER:
2490 c += "Am";
2491 break;
2492 case ORANGE:
2493 c += "Or";
2494 break;
2495 case BLUE:
2496 c += "Bu";
2497 break;
2498 case VIOLET:
2499 c += "Vi";
2500 break;
2501 }
2502 tmp = (String) getLightAtt(Att.MLT, 0);
2503 if (!tmp.isEmpty())
2504 c = tmp + c;
2505 if (getLightAtt(Att.LIT, 0) != Lit.UNKLIT) {
2506 switch ((Lit)getLightAtt(Att.LIT, 0)) {
2507 case VERT:
2508 c += "(Vert)";
2509 break;
2510 case HORIZ:
2511 c += "(Horiz)";
2512 break;
2513 }
2514 }
2515 tmp = (String) getLightAtt(Att.PER, 0);
2516 if (!tmp.isEmpty())
2517 c += " " + tmp + "s";
2518 g2.drawString(c, 100, 70);
2519 }
2520
2521 if (getFogSound() != Fog.NOFOG) {
2522 g2.drawImage(new ImageIcon(getClass().getResource("/images/Fog_Signal.png")).getImage(), 7, -15, null);
2523 String str = "";
2524 if (getFogSound() != Fog.FOGSIG)
2525 switch (getFogSound()) {
2526 case HORN:
2527 str = "Horn";
2528 break;
2529 case SIREN:
2530 str = "Siren";
2531 break;
2532 case DIA:
2533 str = "Dia";
2534 break;
2535 case BELL:
2536 str = "Bell";
2537 break;
2538 case WHIS:
2539 str = "Whis";
2540 break;
2541 case GONG:
2542 str = "Gong";
2543 break;
2544 case EXPLOS:
2545 str = "Explos";
2546 break;
2547 }
2548 if (!getFogGroup().isEmpty())
2549 str += ("(" + getFogGroup() + ")");
2550 else
2551 str += " ";
2552 if (!getFogPeriod().isEmpty())
2553 str += getFogPeriod() + "s";
2554 g2.drawString(str, 0, 70);
2555 }
2556
2557 if (RaType != Rtb.NORTB) {
2558 if (getRadar() == Rtb.REFLECTOR) {
2559 g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png")).getImage(), 7, -15, null);
2560 } else {
2561 g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Station.png")).getImage(), 7, -15, null);
2562 String str = "";
2563 if (getRadar() == Rtb.RAMARK)
2564 str += "Ramark";
2565 else
2566 str += "Racon";
2567 if (!getRaconGroup().isEmpty())
2568 str += ("(" + getRaconGroup() + ")");
2569 else
2570 str += " ";
2571 if (!getRaconPeriod().isEmpty())
2572 str += getRaconPeriod() + "s";
2573 g2.drawString(str, 0, 50);
2574 }
2575 }
2576
2577 if (RoType != Cat.NOROS) {
2578 g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Station.png")).getImage(), 7, -15, null);
2579 g2.drawString("AIS", 0, 30);
2580 }
2581 }
2582
2583 public void saveSign(OsmPrimitive node) {
2584
2585 if (getObject() != Obj.UNKOBJ) {
2586
2587 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A"));
2588
2589 for (String str : node.getKeys().keySet()) {
2590 if (str.trim().matches("^seamark:\\S+"))
2591 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));
2592 }
2593
2594 if (!getName().isEmpty())
2595 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName()));
2596
2597 String objStr = ObjSTR.get(object);
2598 if (objStr != null) {
2599 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr));
2600
2601 if (getShape() != Shp.FLOAT) {
2602 String str = CatSTR.get(getCategory());
2603 if (str != null)
2604 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str));
2605 if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON))
2606 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpSTR.get(getShape())));
2607 }
2608
2609 if ((getObjColour(0) != Col.UNKCOL) && getShape() != Shp.PERCH) {
2610 String str = ColSTR.get(getObjColour(0));
2611 for (int i = 1; bodyColour.size() > i; i++) {
2612 str += (";" + ColSTR.get(getObjColour(i)));
2613 }
2614 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str));
2615 }
2616
2617 if (getObjPattern() != Pat.NOPAT) {
2618 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", PatSTR.get(getObjPattern())));
2619 }
2620
2621 if (getFunc() != Fnc.UNKFNC) {
2622 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":function", FncSTR.get(getFunc())));
2623 }
2624
2625 if ((GrpMAP.get(object) == Grp.LAT) && (getShape() != Shp.PERCH)
2626 || (getObject() == Obj.FLTLAT)) {
2627 switch (region) {
2628 case A:
2629 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-a"));
2630 break;
2631 case B:
2632 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-b"));
2633 break;
2634 case C:
2635 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "other"));
2636 break;
2637 }
2638 }
2639 if (!getObjectHeight().isEmpty()) {
2640 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":height", getObjectHeight()));
2641 }
2642 if (!getElevation().isEmpty()) {
2643 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":elevation", getElevation()));
2644 }
2645 if (!getChannel().isEmpty()) {
2646 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":channel", getChannel()));
2647 }
2648 }
2649 if (getTopmark() != Top.NOTOP) {
2650 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", TopSTR.get(getTopmark())));
2651 if (getTopPattern() != Pat.NOPAT)
2652 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour_pattern", PatSTR.get(getTopPattern())));
2653 if (getTopColour(0) != Col.UNKCOL) {
2654 String str = ColSTR.get(getTopColour(0));
2655 for (int i = 1; topmarkColour.size() > i; i++) {
2656 str += (";" + ColSTR.get(getTopColour(i)));
2657 }
2658 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour", str));
2659 }
2660 }
2661
2662 for (int i = (sectors.size() > 1 ? 1 : 0); i < sectors.size(); i++) {
2663 String secStr = (i == 0) ? "" : (":" + Integer.toString(i));
2664 if (sectors.get(i)[0] != Col.UNKCOL)
2665 if ((sectors.get(i)[15] != Col.UNKCOL) && ((String)sectors.get(i)[1]).contains("Al"))
2666 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", (ColSTR.get(sectors.get(i)[0])) + ";" + ColSTR.get(sectors.get(i)[15])));
2667 else
2668 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", ColSTR.get(sectors.get(i)[0])));
2669 if (!((String) sectors.get(i)[1]).isEmpty())
2670 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String) sectors.get(i)[1]));
2671 else if (!((String) sectors.get(0)[1]).isEmpty())
2672 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String) sectors.get(0)[1]));
2673 if (!((String) sectors.get(i)[2]).isEmpty())
2674 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String) sectors.get(i)[2]));
2675 else if (!((String) sectors.get(0)[2]).isEmpty())
2676 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String) sectors.get(0)[2]));
2677 if (!((String) sectors.get(i)[3]).isEmpty())
2678 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String) sectors.get(i)[3]));
2679 else if (!((String) sectors.get(0)[3]).isEmpty())
2680 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String) sectors.get(0)[3]));
2681 if (!((String) sectors.get(i)[4]).isEmpty())
2682 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String) sectors.get(i)[4]));
2683 else if (!((String) sectors.get(0)[4]).isEmpty())
2684 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String) sectors.get(0)[4]));
2685 if (sectors.get(i)[5] != Lit.UNKLIT)
2686 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5])));
2687 else if (sectors.get(0)[5] != Lit.UNKLIT)
2688 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(0)[5])));
2689 if (!((String) sectors.get(i)[6]).isEmpty())
2690 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String) sectors.get(i)[6]));
2691 if (!((String) sectors.get(i)[7]).isEmpty())
2692 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String) sectors.get(i)[7]));
2693 if (!((String) sectors.get(i)[8]).isEmpty())
2694 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String) sectors.get(i)[8]));
2695 else if (!((String) sectors.get(0)[8]).isEmpty())
2696 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String) sectors.get(0)[8]));
2697 if (!((String) sectors.get(i)[9]).isEmpty())
2698 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String) sectors.get(i)[9]));
2699 else if (!((String) sectors.get(0)[9]).isEmpty())
2700 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String) sectors.get(0)[9]));
2701 if (!((String) sectors.get(i)[10]).isEmpty())
2702 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String) sectors.get(i)[10]));
2703 else if (!((String) sectors.get(0)[10]).isEmpty())
2704 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String) sectors.get(0)[10]));
2705 if (sectors.get(i)[11] != Vis.UNKVIS)
2706 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11])));
2707 else if (sectors.get(0)[11] != Vis.UNKVIS)
2708 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(0)[11])));
2709 if (sectors.get(i)[12] != Exh.UNKEXH)
2710 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12])));
2711 else if (sectors.get(0)[12] != Exh.UNKEXH)
2712 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(0)[12])));
2713 if (!((String) sectors.get(i)[13]).isEmpty())
2714 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String) sectors.get(i)[13]));
2715 if (!((String) sectors.get(i)[14]).isEmpty())
2716 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String) sectors.get(i)[14]));
2717 else if (!((String) sectors.get(0)[14]).isEmpty())
2718 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String) sectors.get(0)[14]));
2719 }
2720
2721 if (getFogSound() != Fog.NOFOG) {
2722 if (getFogSound() == Fog.FOGSIG)
2723 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal", "yes"));
2724 else
2725 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", FogSTR.get(getFogSound())));
2726 if (!getFogGroup().isEmpty()) {
2727 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:group", getFogGroup()));
2728 }
2729 if (!getFogPeriod().isEmpty()) {
2730 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:period", getFogPeriod()));
2731 }
2732 if (!getFogSequence().isEmpty()) {
2733 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:sequence", getFogSequence()));
2734 }
2735 if (!getFogRange().isEmpty()) {
2736 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:range", getFogRange()));
2737 }
2738 }
2739
2740 if (RoType != Cat.NOROS) {
2741 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radio_station:category", CatSTR.get(getRadio())));
2742 }
2743
2744 if (RaType != Rtb.NORTB) {
2745 if (getRadar() == Rtb.REFLECTOR) {
2746 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes"));
2747 } else {
2748 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", RtbSTR.get(getRadar())));
2749 if (!getRaconGroup().isEmpty()) {
2750 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:group", getRaconGroup()));
2751 }
2752 if (!getRaconPeriod().isEmpty()) {
2753 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:period", getRaconPeriod()));
2754 }
2755 if (!getRaconSequence().isEmpty()) {
2756 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sequence", getRaconSequence()));
2757 }
2758 if (!getRaconRange().isEmpty()) {
2759 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:range", getRaconRange()));
2760 }
2761 if ((!getRaconSector1().isEmpty()) && (!getRaconSector2().isEmpty())) {
2762 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_start", getRaconSector1()));
2763 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_end", getRaconSector2()));
2764 }
2765 }
2766 }
2767
2768 if (!getInfo().isEmpty()) {
2769 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:information", getInfo()));
2770 }
2771 if (!getSource().isEmpty()) {
2772 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:source", getSource()));
2773 }
2774 if (getStatus() != Sts.UNKSTS) {
2775 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:status", StsSTR.get(getStatus())));
2776 }
2777 if (getConstr() != Cns.UNKCNS) {
2778 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:construction", CnsSTR.get(getConstr())));
2779 }
2780 if (getConsp() != Con.UNKCON) {
2781 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:conspicuity", ConSTR.get(getConsp())));
2782 }
2783 if (getRefl() != Con.UNKCON) {
2784 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:reflectivity", ConSTR.get(getRefl())));
2785 }
2786 if (!getRef().isEmpty()) {
2787 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:reference", getRef()));
2788 }
2789 if (!getLightRef().isEmpty()) {
2790 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:reference", getLightRef()));
2791 }
2792 if (!getFixme().isEmpty()) {
2793 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fixme", getFixme()));
2794 }
2795 }
2796 }
2797
2798}
Note: See TracBrowser for help on using the repository browser.