1 | /* Copyright 2013 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 render;
|
---|
11 |
|
---|
12 | import java.awt.Color;
|
---|
13 | import java.awt.Font;
|
---|
14 | import java.awt.geom.AffineTransform;
|
---|
15 | import java.util.ArrayList;
|
---|
16 | import java.util.HashMap;
|
---|
17 |
|
---|
18 | import s57.S57val;
|
---|
19 | import s57.S57val.*;
|
---|
20 | import s57.S57att.*;
|
---|
21 | import s57.S57obj.*;
|
---|
22 | import s57.S57map.*;
|
---|
23 | import render.Renderer.*;
|
---|
24 | import symbols.*;
|
---|
25 | import symbols.Symbols.*;
|
---|
26 |
|
---|
27 | public class Rules {
|
---|
28 |
|
---|
29 | public static final Color Yland = new Color(0x50b0ff);
|
---|
30 | public static final Color Mline = new Color(0xc480ff);
|
---|
31 | public static final Color Msymb = new Color(0xa30075);
|
---|
32 |
|
---|
33 | static String getName(Feature feature) {
|
---|
34 | AttVal<?> name = feature.atts.get(Att.OBJNAM);
|
---|
35 | if (name == null) {
|
---|
36 | AttMap atts = feature.objs.get(feature.type).get(0);
|
---|
37 | if (atts != null) {
|
---|
38 | name = atts.get(Att.OBJNAM);
|
---|
39 | }
|
---|
40 | }
|
---|
41 | return (name != null) ? (String)name.val: null;
|
---|
42 | }
|
---|
43 |
|
---|
44 | static AttMap getAtts(Feature feature, Obj obj, int idx) {
|
---|
45 | HashMap<Integer, AttMap> objs = feature.objs.get(obj);
|
---|
46 | if (objs == null)
|
---|
47 | return null;
|
---|
48 | else
|
---|
49 | return objs.get(idx);
|
---|
50 | }
|
---|
51 |
|
---|
52 | public static Object getAttVal(Feature feature, Obj obj, int idx, Att att) {
|
---|
53 | AttMap atts = null;
|
---|
54 | HashMap<Integer, AttMap> objs = feature.objs.get(obj);
|
---|
55 | if (objs != null)
|
---|
56 | atts = objs.get(idx);
|
---|
57 | if (atts == null)
|
---|
58 | return S57val.nullVal(att);
|
---|
59 | else {
|
---|
60 | AttVal<?> item = atts.get(att);
|
---|
61 | if (item == null)
|
---|
62 | return S57val.nullVal(att);
|
---|
63 | return item.val;
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | static Scheme getScheme(Feature feature, Obj obj) {
|
---|
68 | ArrayList<Color> colours = new ArrayList<Color>();
|
---|
69 | for (ColCOL col : (ArrayList<ColCOL>)getAttVal(feature, obj, 0, Att.COLOUR)) {
|
---|
70 | colours.add(Renderer.bodyColours.get(col));
|
---|
71 | }
|
---|
72 | ArrayList<Patt> patterns = new ArrayList<Patt>();
|
---|
73 | for(ColPAT pat: (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT)) {
|
---|
74 | patterns.add(Renderer.pattMap.get(pat));
|
---|
75 | }
|
---|
76 | return new Scheme(patterns, colours);
|
---|
77 | }
|
---|
78 |
|
---|
79 | static boolean hasObject(Feature feature, Obj obj) {
|
---|
80 | return (feature.objs.containsKey(obj));
|
---|
81 | }
|
---|
82 |
|
---|
83 | static boolean hasAttribute(Feature feature, Obj obj, Att att) {
|
---|
84 | AttMap atts = getAtts(feature, obj, 0);
|
---|
85 | return ((atts != null) && (atts.containsKey(att)));
|
---|
86 | }
|
---|
87 |
|
---|
88 | static boolean testAttribute(Feature feature, Obj obj, Att att, Object val) {
|
---|
89 | AttMap atts = getAtts(feature, obj, 0);
|
---|
90 | if (atts != null) {
|
---|
91 | AttVal item = atts.get(att);
|
---|
92 | if (item != null) {
|
---|
93 | switch (item.conv) {
|
---|
94 | case S:
|
---|
95 | case A:
|
---|
96 | return ((String)item.val).equals(val);
|
---|
97 | case L:
|
---|
98 | return ((ArrayList<?>)item.val).contains(val);
|
---|
99 | case E:
|
---|
100 | case F:
|
---|
101 | case I:
|
---|
102 | return item.val.equals(val);
|
---|
103 | }
|
---|
104 | }
|
---|
105 | }
|
---|
106 | return false;
|
---|
107 | }
|
---|
108 |
|
---|
109 | public static void rules () {
|
---|
110 | ArrayList<Feature> objects;
|
---|
111 | if ((objects = Renderer.map.features.get(Obj.SLCONS)) != null) for (Feature feature : objects) shoreline(feature);
|
---|
112 | if ((objects = Renderer.map.features.get(Obj.PIPSOL)) != null) for (Feature feature : objects) pipelines(feature);
|
---|
113 | if ((objects = Renderer.map.features.get(Obj.CBLSUB)) != null) for (Feature feature : objects) cables(feature);
|
---|
114 | if ((objects = Renderer.map.features.get(Obj.PIPOHD)) != null) for (Feature feature : objects) pipelines(feature);
|
---|
115 | if ((objects = Renderer.map.features.get(Obj.CBLOHD)) != null) for (Feature feature : objects) cables(feature);
|
---|
116 | if ((objects = Renderer.map.features.get(Obj.TSEZNE)) != null) for (Feature feature : objects) separation(feature);
|
---|
117 | if ((objects = Renderer.map.features.get(Obj.TSSCRS)) != null) for (Feature feature : objects) separation(feature);
|
---|
118 | if ((objects = Renderer.map.features.get(Obj.TSSRON)) != null) for (Feature feature : objects) separation(feature);
|
---|
119 | if ((objects = Renderer.map.features.get(Obj.TSELNE)) != null) for (Feature feature : objects) separation(feature);
|
---|
120 | if ((objects = Renderer.map.features.get(Obj.TSSLPT)) != null) for (Feature feature : objects) separation(feature);
|
---|
121 | if ((objects = Renderer.map.features.get(Obj.TSSBND)) != null) for (Feature feature : objects) separation(feature);
|
---|
122 | if ((objects = Renderer.map.features.get(Obj.ISTZNE)) != null) for (Feature feature : objects) separation(feature);
|
---|
123 | if ((objects = Renderer.map.features.get(Obj.SNDWAV)) != null) for (Feature feature : objects) areas(feature);
|
---|
124 | if ((objects = Renderer.map.features.get(Obj.OSPARE)) != null) for (Feature feature : objects) areas(feature);
|
---|
125 | if ((objects = Renderer.map.features.get(Obj.FAIRWY)) != null) for (Feature feature : objects) areas(feature);
|
---|
126 | if ((objects = Renderer.map.features.get(Obj.DRGARE)) != null) for (Feature feature : objects) areas(feature);
|
---|
127 | if ((objects = Renderer.map.features.get(Obj.RESARE)) != null) for (Feature feature : objects) areas(feature);
|
---|
128 | if ((objects = Renderer.map.features.get(Obj.SPLARE)) != null) for (Feature feature : objects) areas(feature);
|
---|
129 | if ((objects = Renderer.map.features.get(Obj.SEAARE)) != null) for (Feature feature : objects) areas(feature);
|
---|
130 | if ((objects = Renderer.map.features.get(Obj.OBSTRN)) != null) for (Feature feature : objects) obstructions(feature);
|
---|
131 | if ((objects = Renderer.map.features.get(Obj.UWTROC)) != null) for (Feature feature : objects) obstructions(feature);
|
---|
132 | if ((objects = Renderer.map.features.get(Obj.MARCUL)) != null) for (Feature feature : objects) areas(feature);
|
---|
133 | if ((objects = Renderer.map.features.get(Obj.WTWAXS)) != null) for (Feature feature : objects) waterways(feature);
|
---|
134 | if ((objects = Renderer.map.features.get(Obj.RECTRC)) != null) for (Feature feature : objects) transits(feature);
|
---|
135 | if ((objects = Renderer.map.features.get(Obj.NAVLNE)) != null) for (Feature feature : objects) transits(feature);
|
---|
136 | if ((objects = Renderer.map.features.get(Obj.HRBFAC)) != null) for (Feature feature : objects) harbours(feature);
|
---|
137 | if ((objects = Renderer.map.features.get(Obj.ACHARE)) != null) for (Feature feature : objects) harbours(feature);
|
---|
138 | if ((objects = Renderer.map.features.get(Obj.ACHBRT)) != null) for (Feature feature : objects) harbours(feature);
|
---|
139 | if ((objects = Renderer.map.features.get(Obj.BERTHS)) != null) for (Feature feature : objects) harbours(feature);
|
---|
140 | if ((objects = Renderer.map.features.get(Obj.LOKBSN)) != null) for (Feature feature : objects) locks(feature);
|
---|
141 | if ((objects = Renderer.map.features.get(Obj.LKBSPT)) != null) for (Feature feature : objects) locks(feature);
|
---|
142 | if ((objects = Renderer.map.features.get(Obj.GATCON)) != null) for (Feature feature : objects) locks(feature);
|
---|
143 | if ((objects = Renderer.map.features.get(Obj.DISMAR)) != null) for (Feature feature : objects) distances(feature);
|
---|
144 | if ((objects = Renderer.map.features.get(Obj.HULKES)) != null) for (Feature feature : objects) ports(feature);
|
---|
145 | if ((objects = Renderer.map.features.get(Obj.CRANES)) != null) for (Feature feature : objects) ports(feature);
|
---|
146 | if ((objects = Renderer.map.features.get(Obj.LNDMRK)) != null) for (Feature feature : objects) landmarks(feature);
|
---|
147 | if ((objects = Renderer.map.features.get(Obj.BUISGL)) != null) for (Feature feature : objects) harbours(feature);
|
---|
148 | if ((objects = Renderer.map.features.get(Obj.MORFAC)) != null) for (Feature feature : objects) moorings(feature);
|
---|
149 | if ((objects = Renderer.map.features.get(Obj.NOTMRK)) != null) for (Feature feature : objects) notices(feature);
|
---|
150 | if ((objects = Renderer.map.features.get(Obj.SMCFAC)) != null) for (Feature feature : objects) marinas(feature);
|
---|
151 | if ((objects = Renderer.map.features.get(Obj.BRIDGE)) != null) for (Feature feature : objects) bridges(feature);
|
---|
152 | if ((objects = Renderer.map.features.get(Obj.PILPNT)) != null) for (Feature feature : objects) lights(feature);
|
---|
153 | if ((objects = Renderer.map.features.get(Obj.LITMIN)) != null) for (Feature feature : objects) lights(feature);
|
---|
154 | if ((objects = Renderer.map.features.get(Obj.LITMAJ)) != null) for (Feature feature : objects) lights(feature);
|
---|
155 | if ((objects = Renderer.map.features.get(Obj.LIGHTS)) != null) for (Feature feature : objects) lights(feature);
|
---|
156 | if ((objects = Renderer.map.features.get(Obj.SISTAT)) != null) for (Feature feature : objects) stations(feature);
|
---|
157 | if ((objects = Renderer.map.features.get(Obj.SISTAW)) != null) for (Feature feature : objects) stations(feature);
|
---|
158 | if ((objects = Renderer.map.features.get(Obj.CGUSTA)) != null) for (Feature feature : objects) stations(feature);
|
---|
159 | if ((objects = Renderer.map.features.get(Obj.RDOSTA)) != null) for (Feature feature : objects) stations(feature);
|
---|
160 | if ((objects = Renderer.map.features.get(Obj.RADSTA)) != null) for (Feature feature : objects) stations(feature);
|
---|
161 | if ((objects = Renderer.map.features.get(Obj.RSCSTA)) != null) for (Feature feature : objects) stations(feature);
|
---|
162 | if ((objects = Renderer.map.features.get(Obj.PILBOP)) != null) for (Feature feature : objects) stations(feature);
|
---|
163 | if ((objects = Renderer.map.features.get(Obj.WTWGAG)) != null) for (Feature feature : objects) gauges(feature);
|
---|
164 | if ((objects = Renderer.map.features.get(Obj.OFSPLF)) != null) for (Feature feature : objects) platforms(feature);
|
---|
165 | if ((objects = Renderer.map.features.get(Obj.WRECKS)) != null) for (Feature feature : objects) wrecks(feature);
|
---|
166 | if ((objects = Renderer.map.features.get(Obj.LITVES)) != null) for (Feature feature : objects) floats(feature);
|
---|
167 | if ((objects = Renderer.map.features.get(Obj.LITFLT)) != null) for (Feature feature : objects) floats(feature);
|
---|
168 | if ((objects = Renderer.map.features.get(Obj.BOYINB)) != null) for (Feature feature : objects) floats(feature);
|
---|
169 | if ((objects = Renderer.map.features.get(Obj.BOYLAT)) != null) for (Feature feature : objects) buoys(feature);
|
---|
170 | if ((objects = Renderer.map.features.get(Obj.BOYCAR)) != null) for (Feature feature : objects) buoys(feature);
|
---|
171 | if ((objects = Renderer.map.features.get(Obj.BOYISD)) != null) for (Feature feature : objects) buoys(feature);
|
---|
172 | if ((objects = Renderer.map.features.get(Obj.BOYSAW)) != null) for (Feature feature : objects) buoys(feature);
|
---|
173 | if ((objects = Renderer.map.features.get(Obj.BOYSPP)) != null) for (Feature feature : objects) buoys(feature);
|
---|
174 | if ((objects = Renderer.map.features.get(Obj.BOYWTW)) != null) for (Feature feature : objects) buoys(feature);
|
---|
175 | if ((objects = Renderer.map.features.get(Obj.BCNLAT)) != null) for (Feature feature : objects) beacons(feature);
|
---|
176 | if ((objects = Renderer.map.features.get(Obj.BCNCAR)) != null) for (Feature feature : objects) beacons(feature);
|
---|
177 | if ((objects = Renderer.map.features.get(Obj.BCNISD)) != null) for (Feature feature : objects) beacons(feature);
|
---|
178 | if ((objects = Renderer.map.features.get(Obj.BCNSAW)) != null) for (Feature feature : objects) beacons(feature);
|
---|
179 | if ((objects = Renderer.map.features.get(Obj.BCNSPP)) != null) for (Feature feature : objects) beacons(feature);
|
---|
180 | if ((objects = Renderer.map.features.get(Obj.BCNWTW)) != null) for (Feature feature : objects) beacons(feature);
|
---|
181 | }
|
---|
182 |
|
---|
183 | private static void areas(Feature feature) {
|
---|
184 | String name = getName(feature);
|
---|
185 | switch (feature.type) {
|
---|
186 | case DRGARE:
|
---|
187 | if (Renderer.zoom < 16)
|
---|
188 | Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true)));
|
---|
189 | else
|
---|
190 | Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }));
|
---|
191 | if ((Renderer.zoom >= 12) && (name != null))
|
---|
192 | Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 100), Color.black);
|
---|
193 | break;
|
---|
194 | case FAIRWY:
|
---|
195 | if (feature.area > 2.0) {
|
---|
196 | if (Renderer.zoom < 16)
|
---|
197 | Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
|
---|
198 | else
|
---|
199 | Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }));
|
---|
200 | } else {
|
---|
201 | if (Renderer.zoom >= 14)
|
---|
202 | Renderer.lineVector(feature, new LineStyle(null, 0, new Color(0x40ffffff, true)));
|
---|
203 | }
|
---|
204 | break;
|
---|
205 | case MARCUL:
|
---|
206 | if (Renderer.zoom >= 12) {
|
---|
207 | if (Renderer.zoom >= 14) {
|
---|
208 | Renderer.symbol(feature, Areas.MarineFarm);
|
---|
209 | }
|
---|
210 | if ((feature.area > 0.2) || ((feature.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.area > 0.005) && (Renderer.zoom >= 16))) {
|
---|
211 | Renderer.lineVector(feature, new LineStyle(Color.black, 4, new float[] { 10, 10 }));
|
---|
212 | }
|
---|
213 | }
|
---|
214 | break;
|
---|
215 | case OSPARE:
|
---|
216 | if (testAttribute(feature, feature.type, Att.CATPRA, CatPRA.PRA_WFRM)) {
|
---|
217 | Renderer.symbol(feature, Areas.WindFarm);
|
---|
218 | Renderer.lineVector(feature, new LineStyle(Color.black, 20, new float[] { 40, 40 }));
|
---|
219 | if ((Renderer.zoom >= 15) && (name != null))
|
---|
220 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10)));
|
---|
221 | }
|
---|
222 | break;
|
---|
223 | case RESARE:
|
---|
224 | if (Renderer.zoom >= 12) {
|
---|
225 | Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Mline);
|
---|
226 | if (testAttribute(feature, feature.type, Att.CATREA, CatREA.REA_NWAK)) {
|
---|
227 | Renderer.symbol(feature, Areas.NoWake);
|
---|
228 | }
|
---|
229 | }
|
---|
230 | break;
|
---|
231 | case SEAARE:
|
---|
232 | switch ((CatSEA) getAttVal(feature, feature.type, 0, Att.CATSEA)) {
|
---|
233 | case SEA_RECH:
|
---|
234 | if ((Renderer.zoom >= 10) && (name != null))
|
---|
235 | if (feature.geom.prim == Pflag.LINE) {
|
---|
236 | Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
|
---|
237 | } else {
|
---|
238 | Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
---|
239 | }
|
---|
240 | break;
|
---|
241 | case SEA_BAY:
|
---|
242 | if ((Renderer.zoom >= 12) && (name != null))
|
---|
243 | if (feature.geom.prim == Pflag.LINE) {
|
---|
244 | Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
|
---|
245 | } else {
|
---|
246 | Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
---|
247 | }
|
---|
248 | break;
|
---|
249 | case SEA_SHOL:
|
---|
250 | if (Renderer.zoom >= 14) {
|
---|
251 | if (feature.geom.prim == Pflag.AREA) {
|
---|
252 | Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 }));
|
---|
253 | if (name != null) {
|
---|
254 | Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
---|
255 | Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
|
---|
256 | }
|
---|
257 | } else if (feature.geom.prim == Pflag.LINE) {
|
---|
258 | if (name != null) {
|
---|
259 | Renderer.lineText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40);
|
---|
260 | Renderer.lineText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0);
|
---|
261 | }
|
---|
262 | } else {
|
---|
263 | if (name != null) {
|
---|
264 | Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
---|
265 | Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
|
---|
266 | }
|
---|
267 | }
|
---|
268 | }
|
---|
269 | break;
|
---|
270 | case SEA_GAT:
|
---|
271 | case SEA_NRRW:
|
---|
272 | if ((Renderer.zoom >= 12) && (name != null))
|
---|
273 | Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 100), Color.black);
|
---|
274 | break;
|
---|
275 | default:
|
---|
276 | break;
|
---|
277 | }
|
---|
278 | break;
|
---|
279 | case SNDWAV:
|
---|
280 | if (Renderer.zoom >= 12) Renderer.fillPattern(feature, Areas.Sandwaves);
|
---|
281 | break;
|
---|
282 | case SPLARE:
|
---|
283 | if (Renderer.zoom >= 12) {
|
---|
284 | Renderer.symbol(feature, Areas.Plane, new Scheme(Msymb));
|
---|
285 | Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Mline);
|
---|
286 | }
|
---|
287 | if ((Renderer.zoom >= 15) && (name != null))
|
---|
288 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
|
---|
289 | break;
|
---|
290 | default:
|
---|
291 | break;
|
---|
292 | }
|
---|
293 | }
|
---|
294 |
|
---|
295 | private static void beacons(Feature feature) {
|
---|
296 | if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BCNLAT) || (feature.type == Obj.BCNCAR)))) {
|
---|
297 | BcnSHP shape = (BcnSHP) getAttVal(feature, feature.type, 0,
|
---|
298 | Att.BCNSHP);
|
---|
299 | if (((shape == BcnSHP.BCN_PRCH) || (shape == BcnSHP.BCN_WTHY))
|
---|
300 | && (feature.type == Obj.BCNLAT)) {
|
---|
301 | CatLAM cat = (CatLAM) getAttVal(feature, feature.type, 0,
|
---|
302 | Att.CATLAM);
|
---|
303 | switch (cat) {
|
---|
304 | case LAM_PORT:
|
---|
305 | if (shape == BcnSHP.BCN_PRCH)
|
---|
306 | Renderer.symbol(feature, Beacons.PerchPort);
|
---|
307 | else
|
---|
308 | Renderer.symbol(feature, Beacons.WithyPort);
|
---|
309 | break;
|
---|
310 | case LAM_STBD:
|
---|
311 | if (shape == BcnSHP.BCN_PRCH)
|
---|
312 | Renderer.symbol(feature, Beacons.PerchStarboard);
|
---|
313 | else
|
---|
314 | Renderer.symbol(feature, Beacons.WithyStarboard);
|
---|
315 | break;
|
---|
316 | default:
|
---|
317 | Renderer.symbol(feature, Beacons.Stake,
|
---|
318 | getScheme(feature, feature.type));
|
---|
319 | }
|
---|
320 | } else {
|
---|
321 | Renderer.symbol(feature, Beacons.Shapes.get(shape),
|
---|
322 | getScheme(feature, feature.type));
|
---|
323 | if (feature.objs.get(Obj.TOPMAR) != null)
|
---|
324 | Renderer.symbol(
|
---|
325 | feature,
|
---|
326 | Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR)
|
---|
327 | .get(0).get(Att.TOPSHP).val),
|
---|
328 | getScheme(feature, Obj.TOPMAR),
|
---|
329 | Topmarks.BeaconDelta);
|
---|
330 | }
|
---|
331 | Signals.addSignals(feature);
|
---|
332 | }
|
---|
333 | }
|
---|
334 |
|
---|
335 | private static void buoys(Feature feature) {
|
---|
336 | if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BOYLAT) || (feature.type == Obj.BOYCAR)))) {
|
---|
337 | BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
|
---|
338 | Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
|
---|
339 | if (hasObject(feature, Obj.TOPMAR)) {
|
---|
340 | Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val),
|
---|
341 | getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
|
---|
342 | }
|
---|
343 | Signals.addSignals(feature);
|
---|
344 | }
|
---|
345 | }
|
---|
346 |
|
---|
347 | private static void bridges(Feature feature) {
|
---|
348 | if (Renderer.zoom >= 16) {
|
---|
349 | double verclr, verccl, vercop, horclr;
|
---|
350 | AttMap atts = feature.objs.get(Obj.BRIDGE).get(0);
|
---|
351 | String vstr = "";
|
---|
352 | String hstr = "";
|
---|
353 | if (atts != null) {
|
---|
354 | if (atts.containsKey(Att.HORCLR)) {
|
---|
355 | horclr = (Double) atts.get(Att.HORCLR).val;
|
---|
356 | hstr = String.valueOf(horclr);
|
---|
357 | }
|
---|
358 | if (atts.containsKey(Att.VERCLR)) {
|
---|
359 | verclr = (Double) atts.get(Att.VERCLR).val;
|
---|
360 | } else {
|
---|
361 | verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
|
---|
362 | }
|
---|
363 | verccl = atts.containsKey(Att.VERCCL) ? (Double) atts.get(Att.VERCCL).val : 0;
|
---|
364 | vercop = atts.containsKey(Att.VERCOP) ? (Double) atts.get(Att.VERCOP).val : 0;
|
---|
365 | if (verclr > 0) {
|
---|
366 | vstr += String.valueOf(verclr);
|
---|
367 | } else if (verccl > 0) {
|
---|
368 | if (vercop == 0) {
|
---|
369 | vstr += String.valueOf(verccl) + "/-";
|
---|
370 | } else {
|
---|
371 | vstr += String.valueOf(verccl) + "/" + String.valueOf(vercop);
|
---|
372 | }
|
---|
373 | }
|
---|
374 | if (hstr.isEmpty() && !vstr.isEmpty()) {
|
---|
375 | Renderer.labelText(feature, vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC));
|
---|
376 | } else if (!hstr.isEmpty() && !vstr.isEmpty()) {
|
---|
377 | Renderer.labelText(feature, vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC));
|
---|
378 | Renderer.labelText(feature, hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC));
|
---|
379 | } else if (!hstr.isEmpty() && vstr.isEmpty()) {
|
---|
380 | Renderer.labelText(feature, hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC));
|
---|
381 | }
|
---|
382 | }
|
---|
383 | }
|
---|
384 | }
|
---|
385 |
|
---|
386 | private static void cables(Feature feature) {
|
---|
387 | if ((Renderer.zoom >= 16) && (feature.length < 2)) {
|
---|
388 | if (feature.type == Obj.CBLSUB) {
|
---|
389 | Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Mline);
|
---|
390 | } else if (feature.type == Obj.CBLOHD) {
|
---|
391 | AttMap atts = feature.objs.get(Obj.CBLOHD).get(0);
|
---|
392 | if ((atts != null) && (atts.containsKey(Att.CATCBL)) && (atts.get(Att.CATCBL).val == CatCBL.CBL_POWR)) {
|
---|
393 | Renderer.lineSymbols(feature, Areas.CableDash, 0, Areas.CableDot, Areas.CableFlash, 2, Color.black);
|
---|
394 | } else {
|
---|
395 | Renderer.lineSymbols(feature, Areas.CableDash, 0, Areas.CableDot, null, 2, Color.black);
|
---|
396 | }
|
---|
397 | if (atts != null) {
|
---|
398 | if (atts.containsKey(Att.VERCLR)) {
|
---|
399 | Renderer.labelText(feature, String.valueOf((Double) atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25)));
|
---|
400 | } else if (atts.containsKey(Att.VERCSA)) {
|
---|
401 | Renderer.labelText(feature, String.valueOf((Double) atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25)));
|
---|
402 | }
|
---|
403 | }
|
---|
404 | }
|
---|
405 | }
|
---|
406 | }
|
---|
407 |
|
---|
408 | private static void distances(Feature feature) {
|
---|
409 | if (Renderer.zoom >= 14) {
|
---|
410 | if (!testAttribute(feature, Obj.DISMAR, Att.CATDIS, CatDIS.DIS_NONI)) {
|
---|
411 | Renderer.symbol(feature, Harbours.DistanceI);
|
---|
412 | } else {
|
---|
413 | Renderer.symbol(feature, Harbours.DistanceU);
|
---|
414 | }
|
---|
415 | if ((Renderer.zoom >=15) && hasAttribute(feature, Obj.DISMAR, Att.WTWDIS)) {
|
---|
416 | AttMap atts = feature.objs.get(Obj.DISMAR).get(0);
|
---|
417 | Double dist = (Double) atts.get(Att.WTWDIS).val;
|
---|
418 | String str = "";
|
---|
419 | if (atts.containsKey(Att.HUNITS)) {
|
---|
420 | switch ((UniHLU) atts.get(Att.HUNITS).val) {
|
---|
421 | case HLU_METR:
|
---|
422 | str += "m ";
|
---|
423 | break;
|
---|
424 | case HLU_FEET:
|
---|
425 | str += "ft ";
|
---|
426 | break;
|
---|
427 | case HLU_HMTR:
|
---|
428 | str += "hm ";
|
---|
429 | break;
|
---|
430 | case HLU_KMTR:
|
---|
431 | str += "km ";
|
---|
432 | break;
|
---|
433 | case HLU_SMIL:
|
---|
434 | str += "M ";
|
---|
435 | break;
|
---|
436 | case HLU_NMIL:
|
---|
437 | str += "NM ";
|
---|
438 | break;
|
---|
439 | default:
|
---|
440 | break;
|
---|
441 | }
|
---|
442 | }
|
---|
443 | str += String.format("%1.0f", dist);
|
---|
444 | Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45)));
|
---|
445 | }
|
---|
446 | }
|
---|
447 | }
|
---|
448 |
|
---|
449 | private static void floats(Feature feature) {
|
---|
450 | switch (feature.type) {
|
---|
451 | case LITVES:
|
---|
452 | Renderer.symbol(feature, Buoys.Super, getScheme(feature, feature.type));
|
---|
453 | break;
|
---|
454 | case LITFLT:
|
---|
455 | Renderer.symbol(feature, Buoys.Float, getScheme(feature, feature.type));
|
---|
456 | break;
|
---|
457 | case BOYINB:
|
---|
458 | Renderer.symbol(feature, Buoys.Super, getScheme(feature, feature.type));
|
---|
459 | break;
|
---|
460 | default:
|
---|
461 | break;
|
---|
462 | }
|
---|
463 | if (feature.objs.get(Obj.TOPMAR) != null)
|
---|
464 | Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.FloatDelta);
|
---|
465 | Signals.addSignals(feature);
|
---|
466 | }
|
---|
467 |
|
---|
468 | private static void gauges(Feature feature) {
|
---|
469 | if (Renderer.zoom >= 14) {
|
---|
470 | Renderer.symbol(feature, Harbours.TideGauge);
|
---|
471 | Signals.addSignals(feature);
|
---|
472 | }
|
---|
473 | }
|
---|
474 |
|
---|
475 | private static void harbours(Feature feature) {
|
---|
476 | String name = getName(feature);
|
---|
477 | switch (feature.type) {
|
---|
478 | case ACHBRT:
|
---|
479 | if (Renderer.zoom >= 14) {
|
---|
480 | Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline));
|
---|
481 | Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Msymb, LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC));
|
---|
482 | }
|
---|
483 | double radius = (Double)getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS);
|
---|
484 | if (radius != 0) {
|
---|
485 | UniHLU units = (UniHLU)getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS);
|
---|
486 | Renderer.lineCircle (feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units);
|
---|
487 | }
|
---|
488 | break;
|
---|
489 | case ACHARE:
|
---|
490 | if (Renderer.zoom >= 12) {
|
---|
491 | if (feature.geom.prim != Pflag.AREA) {
|
---|
492 | Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Color.black));
|
---|
493 | } else {
|
---|
494 | Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline));
|
---|
495 | Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Mline);
|
---|
496 | }
|
---|
497 | if ((Renderer.zoom >= 15) && ((name) != null)) {
|
---|
498 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 60), Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
|
---|
499 | }
|
---|
500 | ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttVal(feature, Obj.ACHARE, 0, Att.STATUS);
|
---|
501 | if ((Renderer.zoom >= 15) && (sts != null) && (sts.contains(StsSTS.STS_RESV))) {
|
---|
502 | Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
|
---|
503 | }
|
---|
504 | }
|
---|
505 | ArrayList<CatACH> cats = (ArrayList<CatACH>)getAttVal(feature, Obj.ACHARE, 0, Att.CATACH);
|
---|
506 | int dy = (cats.size() - 1) * -30;
|
---|
507 | for (CatACH cat : cats) {
|
---|
508 | switch (cat) {
|
---|
509 | case ACH_DEEP:
|
---|
510 | Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
---|
511 | dy += 60;
|
---|
512 | break;
|
---|
513 | case ACH_TANK:
|
---|
514 | Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
---|
515 | dy += 60;
|
---|
516 | break;
|
---|
517 | case ACH_H24P:
|
---|
518 | Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
---|
519 | dy += 60;
|
---|
520 | break;
|
---|
521 | case ACH_EXPL:
|
---|
522 | Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
---|
523 | dy += 60;
|
---|
524 | break;
|
---|
525 | case ACH_QUAR:
|
---|
526 | Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
---|
527 | dy += 60;
|
---|
528 | break;
|
---|
529 | case ACH_SEAP:
|
---|
530 | Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
---|
531 | dy += 60;
|
---|
532 | break;
|
---|
533 | default:
|
---|
534 | }
|
---|
535 | }
|
---|
536 | break;
|
---|
537 | case BERTHS:
|
---|
538 | if (Renderer.zoom >= 14) {
|
---|
539 | Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Msymb, LabelStyle.RRCT, Mline, Color.white, null);
|
---|
540 | }
|
---|
541 | break;
|
---|
542 | case BUISGL:
|
---|
543 | if (Renderer.zoom >= 16) {
|
---|
544 | ArrayList<Symbol> symbols = new ArrayList<Symbol>();
|
---|
545 | ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN);
|
---|
546 | for (FncFNC fnc : fncs) {
|
---|
547 | symbols.add(Landmarks.Funcs.get(fnc));
|
---|
548 | }
|
---|
549 | if (feature.objs.containsKey(Obj.SMCFAC)) {
|
---|
550 | ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF);
|
---|
551 | for (CatSCF scf : scfs) {
|
---|
552 | symbols.add(Facilities.Cats.get(scf));
|
---|
553 | }
|
---|
554 | }
|
---|
555 | Renderer.cluster(feature, symbols);
|
---|
556 | }
|
---|
557 | break;
|
---|
558 | case HRBFAC:
|
---|
559 | if (Renderer.zoom >= 12) {
|
---|
560 | ArrayList<CatHAF> cathaf = (ArrayList<CatHAF>) getAttVal(feature, Obj.HRBFAC, 0, Att.CATHAF);
|
---|
561 | if (cathaf.size() == 1) {
|
---|
562 | switch (cathaf.get(0)) {
|
---|
563 | case HAF_MRNA:
|
---|
564 | Renderer.symbol(feature, Harbours.Marina);
|
---|
565 | break;
|
---|
566 | case HAF_MANF:
|
---|
567 | Renderer.symbol(feature, Harbours.MarinaNF);
|
---|
568 | break;
|
---|
569 | case HAF_FISH:
|
---|
570 | Renderer.symbol(feature, Harbours.Fishing);
|
---|
571 | break;
|
---|
572 | default:
|
---|
573 | Renderer.symbol(feature, Harbours.Harbour);
|
---|
574 | break;
|
---|
575 | }
|
---|
576 | } else {
|
---|
577 | Renderer.symbol(feature, Harbours.Harbour);
|
---|
578 | }
|
---|
579 | }
|
---|
580 | break;
|
---|
581 | default:
|
---|
582 | break;
|
---|
583 | }
|
---|
584 | }
|
---|
585 |
|
---|
586 | private static void landmarks(Feature feature) {
|
---|
587 | ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttVal(feature, feature.type, 0, Att.CATLMK);
|
---|
588 | Symbol catSym = Landmarks.Shapes.get(cats.get(0));
|
---|
589 | ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttVal(feature, feature.type, 0, Att.FUNCTN);
|
---|
590 | Symbol fncSym = Landmarks.Funcs.get(fncs.get(0));
|
---|
591 | if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR))
|
---|
592 | catSym = Landmarks.ChurchTower;
|
---|
593 | if ((cats.get(0) == CatLMK.LMK_UNKN) && (fncs.get(0) == FncFNC.FNC_UNKN) && (feature.objs.get(Obj.LIGHTS) != null))
|
---|
594 | catSym = Beacons.LightMajor;
|
---|
595 | if (cats.get(0) == CatLMK.LMK_RADR)
|
---|
596 | fncSym = Landmarks.RadioTV;
|
---|
597 | Renderer.symbol(feature, catSym);
|
---|
598 | Renderer.symbol(feature, fncSym);
|
---|
599 | /* if (!has_attribute("function") && !has_attribute("category") && has_object("light")) {
|
---|
600 | symbol("lighthouse");
|
---|
601 | if ((zoom >= 15) && has_item_attribute("name"))
|
---|
602 | text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:middle", 0, -70);
|
---|
603 | } else {
|
---|
604 | if ((zoom >= 15) && has_item_attribute("name"))
|
---|
605 | text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:start", 60, -50);
|
---|
606 | }
|
---|
607 | }
|
---|
608 | */
|
---|
609 | Signals.addSignals(feature);
|
---|
610 | }
|
---|
611 |
|
---|
612 | private static void buildings(Feature feature) {
|
---|
613 | }
|
---|
614 |
|
---|
615 | private static void lights(Feature feature) {
|
---|
616 | switch (feature.type) {
|
---|
617 | case LITMAJ:
|
---|
618 | Renderer.symbol(feature, Beacons.LightMajor);
|
---|
619 | break;
|
---|
620 | case LITMIN:
|
---|
621 | case LIGHTS:
|
---|
622 | Renderer.symbol(feature, Beacons.LightMinor);
|
---|
623 | break;
|
---|
624 | case PILPNT:
|
---|
625 | if (hasObject(feature, Obj.LIGHTS))
|
---|
626 | Renderer.symbol(feature, Beacons.LightMinor);
|
---|
627 | else
|
---|
628 | Renderer.symbol(feature, Harbours.Post);
|
---|
629 | break;
|
---|
630 | }
|
---|
631 | Signals.addSignals(feature);
|
---|
632 | }
|
---|
633 |
|
---|
634 | private static void locks(Feature feature) {
|
---|
635 | }
|
---|
636 |
|
---|
637 | private static void marinas(Feature feature) {
|
---|
638 | if (Renderer.zoom >= 16) {
|
---|
639 |
|
---|
640 | }
|
---|
641 | }
|
---|
642 | private static void moorings(Feature feature) {
|
---|
643 | switch ((CatMOR) getAttVal(feature, feature.type, 0, Att.CATMOR)) {
|
---|
644 | case MOR_DLPN:
|
---|
645 | Renderer.symbol(feature, Harbours.Dolphin);
|
---|
646 | break;
|
---|
647 | case MOR_DDPN:
|
---|
648 | Renderer.symbol(feature, Harbours.DeviationDolphin);
|
---|
649 | break;
|
---|
650 | case MOR_BLRD:
|
---|
651 | case MOR_POST:
|
---|
652 | Renderer.symbol(feature, Harbours.Bollard);
|
---|
653 | break;
|
---|
654 | case MOR_BUOY:
|
---|
655 | BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
|
---|
656 | if (shape == BoySHP.BOY_UNKN)
|
---|
657 | shape = BoySHP.BOY_SPHR;
|
---|
658 | Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
|
---|
659 | break;
|
---|
660 | }
|
---|
661 | Signals.addSignals(feature);
|
---|
662 | }
|
---|
663 |
|
---|
664 | private static void notices(Feature feature) {
|
---|
665 | if (Renderer.zoom >= 14) {
|
---|
666 | double dx = 0.0, dy = 0.0;
|
---|
667 | switch (feature.type) {
|
---|
668 | case BCNCAR:
|
---|
669 | case BCNISD:
|
---|
670 | case BCNLAT:
|
---|
671 | case BCNSAW:
|
---|
672 | case BCNSPP:
|
---|
673 | case BCNWTW:
|
---|
674 | dy = 45.0;
|
---|
675 | break;
|
---|
676 | case NOTMRK:
|
---|
677 | dy = 0.0;
|
---|
678 | break;
|
---|
679 | default:
|
---|
680 | return;
|
---|
681 | }
|
---|
682 | Symbol s1 = null, s2 = null;
|
---|
683 | MarSYS sys = MarSYS.SYS_CEVN;
|
---|
684 | BnkWTW bnk = BnkWTW.BWW_UNKN;
|
---|
685 | AttVal att = feature.atts.get(Att.MARSYS);
|
---|
686 | if (att != null) sys = (MarSYS)att.val;
|
---|
687 | ObjTab objs = feature.objs.get(Obj.NOTMRK);
|
---|
688 | int n = objs.size();
|
---|
689 | if (n > 2) {
|
---|
690 | s1 = Notices.Notice;
|
---|
691 | n = 1;
|
---|
692 | } else {
|
---|
693 | for (AttMap atts : objs.values()) {
|
---|
694 | if (atts.get(Att.MARSYS) != null) sys = (MarSYS)atts.get(Att.MARSYS).val;
|
---|
695 | CatNMK cat = CatNMK.NMK_UNKN;
|
---|
696 | if (atts.get(Att.CATNMK) != null) cat = (CatNMK)atts.get(Att.CATNMK).val;
|
---|
697 | s2 = Notices.getNotice(cat, sys);
|
---|
698 | }
|
---|
699 | }
|
---|
700 | /* Obj_t *obj = getObj(item, NOTMRK, i);
|
---|
701 | if (obj == NULL) continue;
|
---|
702 | Atta_t add;
|
---|
703 | int idx = 0;
|
---|
704 | while ((add = getAttEnum(obj, ADDMRK, idx++)) != MRK_UNKN) {
|
---|
705 | if ((add == MRK_LTRI) && (i == 2)) swap = true;
|
---|
706 | if ((add == MRK_RTRI) && (i != 2)) swap = true;
|
---|
707 | }
|
---|
708 | }
|
---|
709 | } else {
|
---|
710 |
|
---|
711 | }
|
---|
712 | for (int i = 0; i <=2; i++) {
|
---|
713 | Obj_t *obj = getObj(item, NOTMRK, i);
|
---|
714 | if (obj == NULL) continue;
|
---|
715 | Atta_t category = getAttEnum(obj, CATNMK, i);
|
---|
716 | Atta_t add;
|
---|
717 | int idx = 0;
|
---|
718 | int top=0, bottom=0, left=0, right=0;
|
---|
719 | while ((add = getAttEnum(obj, ADDMRK, idx++)) != MRK_UNKN) {
|
---|
720 | switch (add) {
|
---|
721 | case MRK_TOPB:
|
---|
722 | top = add;
|
---|
723 | break;
|
---|
724 | case MRK_BOTB:
|
---|
725 | case MRK_BTRI:
|
---|
726 | bottom = add;
|
---|
727 | break;
|
---|
728 | case MRK_LTRI:
|
---|
729 | left = add;
|
---|
730 | break;
|
---|
731 | case MRK_RTRI:
|
---|
732 | right = add;
|
---|
733 | break;
|
---|
734 | default:
|
---|
735 | break;
|
---|
736 | }
|
---|
737 | }
|
---|
738 | double orient = getAtt(obj, ORIENT) != NULL ? getAtt(obj, ORIENT)->val.val.f : 0.0;
|
---|
739 | int system = getAtt(obj, MARSYS) != NULL ? getAtt(obj, MARSYS)->val.val.e : 0;
|
---|
740 | double flip = 0.0;
|
---|
741 | char *symb = "";
|
---|
742 | char *base = "";
|
---|
743 | char *colour = "black";
|
---|
744 | if ((system == SYS_BWR2) || (system == SYS_BNWR)) {
|
---|
745 | symb = bniwr_map[category];
|
---|
746 | switch (category) {
|
---|
747 | case NMK_NANK:
|
---|
748 | case NMK_LMHR:
|
---|
749 | case NMK_KTPM...NMK_RSPD:
|
---|
750 | {
|
---|
751 | int bank = getAtt(obj, BNKWTW) != NULL ? getAtt(obj, BNKWTW)->val.val.e : 0;
|
---|
752 | switch (bank) {
|
---|
753 | case BWW_LEFT:
|
---|
754 | base = "notice_blb";
|
---|
755 | colour = "red";
|
---|
756 | break;
|
---|
757 | case BWW_RGHT:
|
---|
758 | base = "notice_brb";
|
---|
759 | colour = "green";
|
---|
760 | break;
|
---|
761 | default:
|
---|
762 | base = "notice_bsi";
|
---|
763 | colour = "black";
|
---|
764 | break;
|
---|
765 | }
|
---|
766 | }
|
---|
767 | default:
|
---|
768 | break;
|
---|
769 | }
|
---|
770 | } else if (system == SYS_PPWB) {
|
---|
771 | int bank = getAtt(obj, BNKWTW) != NULL ? getAtt(obj, BNKWTW)->val.val.e : 0;
|
---|
772 | if (bank != 0) {
|
---|
773 | switch (category) {
|
---|
774 | case NMK_WLAR:
|
---|
775 | if (bank == BNK_LEFT)
|
---|
776 | base = "notice_pwlarl";
|
---|
777 | else
|
---|
778 | base = "notice_pwlarr";
|
---|
779 | break;
|
---|
780 | case NMK_WRAL:
|
---|
781 | if (bank == BNK_LEFT)
|
---|
782 | base = "notice_pwrall";
|
---|
783 | else
|
---|
784 | base = "notice_pwralr";
|
---|
785 | break;
|
---|
786 | case NMK_KTPM:
|
---|
787 | if (bank == BNK_LEFT)
|
---|
788 | base = "notice_ppml";
|
---|
789 | else
|
---|
790 | base = "notice_ppmr";
|
---|
791 | break;
|
---|
792 | case NMK_KTSM:
|
---|
793 | if (bank == BNK_LEFT)
|
---|
794 | base = "notice_psml";
|
---|
795 | else
|
---|
796 | base = "notice_psmr";
|
---|
797 | break;
|
---|
798 | case NMK_KTMR:
|
---|
799 | if (bank == BNK_LEFT)
|
---|
800 | base = "notice_pmrl";
|
---|
801 | else
|
---|
802 | base = "notice_pmrr";
|
---|
803 | break;
|
---|
804 | case NMK_CRTP:
|
---|
805 | if (bank == BNK_LEFT)
|
---|
806 | base = "notice_pcpl";
|
---|
807 | else
|
---|
808 | base = "notice_pcpr";
|
---|
809 | break;
|
---|
810 | case NMK_CRTS:
|
---|
811 | if (bank == BNK_LEFT)
|
---|
812 | base = "notice_pcsl";
|
---|
813 | else
|
---|
814 | base = "notice_pcsr";
|
---|
815 | break;
|
---|
816 | default:
|
---|
817 | break;
|
---|
818 | }
|
---|
819 | }
|
---|
820 | } else {
|
---|
821 | symb = notice_map[category];
|
---|
822 | switch (category) {
|
---|
823 | case NMK_NOVK...NMK_NWSH:
|
---|
824 | case NMK_NMTC...NMK_NLBG:
|
---|
825 | base = "notice_a";
|
---|
826 | break;
|
---|
827 | case NMK_MVTL...NMK_CHDR:
|
---|
828 | base = "notice_b";
|
---|
829 | break;
|
---|
830 | case NMK_PRTL...NMK_PRTR:
|
---|
831 | case NMK_OVHC...NMK_LBGP:
|
---|
832 | base = "notice_e";
|
---|
833 | colour = "white";
|
---|
834 | break;
|
---|
835 | default:
|
---|
836 | break;
|
---|
837 | }
|
---|
838 | switch (category) {
|
---|
839 | case NMK_MVTL:
|
---|
840 | case NMK_ANKP:
|
---|
841 | case NMK_PRTL:
|
---|
842 | case NMK_MWAL:
|
---|
843 | case NMK_MWAR:
|
---|
844 | flip = 180.0;
|
---|
845 | break;
|
---|
846 | case NMK_SWWR:
|
---|
847 | case NMK_WRSL:
|
---|
848 | case NMK_WARL:
|
---|
849 | flip = -90.0;
|
---|
850 | break;
|
---|
851 | case NMK_SWWC:
|
---|
852 | case NMK_SWWL:
|
---|
853 | case NMK_WLSR:
|
---|
854 | case NMK_WALR:
|
---|
855 | flip = 90.0;
|
---|
856 | break;
|
---|
857 | default:
|
---|
858 | break;
|
---|
859 | }
|
---|
860 | }
|
---|
861 | if (n == 2) {
|
---|
862 | dx = (((i != 2) && swap) || ((i == 2) && !swap)) ? -30.0 : 30.0;
|
---|
863 | }
|
---|
864 | if (top == MRK_TOPB)
|
---|
865 | renderSymbol(item, NOTMRK, "notice_board", "", "", BC, dx, dy, orient);
|
---|
866 | if (bottom == MRK_BOTB)
|
---|
867 | renderSymbol(item, NOTMRK, "notice_board", "", "", BC, dx, dy, orient+180);
|
---|
868 | if (bottom == MRK_BTRI)
|
---|
869 | renderSymbol(item, NOTMRK, "notice_triangle", "", "", BC, dx, dy, orient+180);
|
---|
870 | if (left == MRK_LTRI)
|
---|
871 | renderSymbol(item, NOTMRK, "notice_triangle", "", "", BC, dx, dy, orient-90);
|
---|
872 | if (right == MRK_RTRI)
|
---|
873 | renderSymbol(item, NOTMRK, "notice_triangle", "", "", BC, dx, dy, orient+90);
|
---|
874 | renderSymbol(item, NOTMRK, base, "", "", CC, dx, dy, orient);
|
---|
875 | renderSymbol(item, NOTMRK, symb, "", colour, CC, dx, dy, orient+flip);
|
---|
876 | }
|
---|
877 | */
|
---|
878 | }
|
---|
879 | }
|
---|
880 |
|
---|
881 | private static void obstructions(Feature feature) {
|
---|
882 | if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) {
|
---|
883 | WatLEV lvl = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV);
|
---|
884 | switch (lvl) {
|
---|
885 | case LEV_CVRS:
|
---|
886 | Renderer.symbol(feature, Areas.RockC);
|
---|
887 | break;
|
---|
888 | case LEV_AWSH:
|
---|
889 | Renderer.symbol(feature, Areas.RockA);
|
---|
890 | break;
|
---|
891 | default:
|
---|
892 | Renderer.symbol(feature, Areas.Rock);
|
---|
893 | }
|
---|
894 | } else {
|
---|
895 | Renderer.symbol(feature, Areas.Rock);
|
---|
896 | }
|
---|
897 | }
|
---|
898 |
|
---|
899 | private static void pipelines(Feature feature) {
|
---|
900 | if ((Renderer.zoom >= 16) && (feature.length < 2)) {
|
---|
901 | if (feature.type == Obj.PIPSOL) {
|
---|
902 | Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Mline);
|
---|
903 | } else if (feature.type == Obj.PIPOHD) {
|
---|
904 | Renderer.lineVector(feature, new LineStyle(Color.black, 8));
|
---|
905 | AttMap atts = feature.objs.get(Obj.PIPOHD).get(0);
|
---|
906 | double verclr = 0;
|
---|
907 | if (atts != null) {
|
---|
908 | if (atts.containsKey(Att.VERCLR)) {
|
---|
909 | verclr = (Double) atts.get(Att.VERCLR).val;
|
---|
910 | } else {
|
---|
911 | verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
|
---|
912 | }
|
---|
913 | if (verclr > 0) {
|
---|
914 | Renderer.labelText(feature, String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25)));
|
---|
915 | }
|
---|
916 | }
|
---|
917 | }
|
---|
918 | }
|
---|
919 | }
|
---|
920 |
|
---|
921 | private static void platforms(Feature feature) {
|
---|
922 | ArrayList<CatOFP> cats = (ArrayList<CatOFP>)getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP);
|
---|
923 | if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
|
---|
924 | Renderer.symbol(feature, Buoys.Storage);
|
---|
925 | else
|
---|
926 | Renderer.symbol(feature, Landmarks.Platform);
|
---|
927 | String name = getName(feature);
|
---|
928 | if ((Renderer.zoom >= 15) && (name != null))
|
---|
929 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 40), Color.black, new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
|
---|
930 | Signals.addSignals(feature);
|
---|
931 | }
|
---|
932 |
|
---|
933 | private static void ports(Feature feature) {
|
---|
934 | if (Renderer.zoom >= 14) {
|
---|
935 | if (feature.type == Obj.CRANES) {
|
---|
936 | if ((CatCRN) getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
|
---|
937 | Renderer.symbol(feature, Harbours.ContainerCrane);
|
---|
938 | else
|
---|
939 | Renderer.symbol(feature, Harbours.PortCrane);
|
---|
940 | } else if (feature.type == Obj.HULKES) {
|
---|
941 | Renderer.lineVector(feature, new LineStyle(Color.black, 4, null, new Color(0xffe000)));
|
---|
942 | String name = getName(feature);
|
---|
943 | if ((Renderer.zoom >= 15) && (name != null))
|
---|
944 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), Color.black);
|
---|
945 | }
|
---|
946 | }
|
---|
947 | }
|
---|
948 |
|
---|
949 | private static void separation(Feature feature) {
|
---|
950 | switch (feature.type) {
|
---|
951 | case TSEZNE:
|
---|
952 | case TSSCRS:
|
---|
953 | case TSSRON:
|
---|
954 | if (Renderer.zoom <= 15)
|
---|
955 | Renderer.lineVector(feature, new LineStyle(null, 0, null, new Color(0x80c48080, true)));
|
---|
956 | else
|
---|
957 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
|
---|
958 | String name = getName(feature);
|
---|
959 | if ((Renderer.zoom >= 10) && (name != null))
|
---|
960 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 150), new Color(0x80c48080, true));
|
---|
961 | break;
|
---|
962 | case TSELNE:
|
---|
963 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
|
---|
964 | break;
|
---|
965 | case TSSLPT:
|
---|
966 | Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, null, 0, new Color(0x80c48080, true));
|
---|
967 | break;
|
---|
968 | case TSSBND:
|
---|
969 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, new float[] { 40, 40 }, null));
|
---|
970 | break;
|
---|
971 | case ISTZNE:
|
---|
972 | Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, new Color(0x80c48080, true));
|
---|
973 | break;
|
---|
974 | }
|
---|
975 | }
|
---|
976 |
|
---|
977 | private static void shoreline(Feature feature) {
|
---|
978 | if (Renderer.zoom >= 12) {
|
---|
979 | switch ((CatSLC) getAttVal(feature, feature.type, 0, Att.CATSLC)) {
|
---|
980 | case SLC_TWAL:
|
---|
981 | WatLEV lev = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV);
|
---|
982 | if (lev == WatLEV.LEV_CVRS) {
|
---|
983 | Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
|
---|
984 | if (Renderer.zoom >= 15)
|
---|
985 | Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 20);
|
---|
986 | } else {
|
---|
987 | Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
|
---|
988 | }
|
---|
989 | if (Renderer.zoom >= 15)
|
---|
990 | Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
|
---|
991 | }
|
---|
992 | }
|
---|
993 | }
|
---|
994 |
|
---|
995 | private static void stations(Feature feature) {
|
---|
996 | if (Renderer.zoom >= 14) {
|
---|
997 | String str = "";
|
---|
998 | switch (feature.type) {
|
---|
999 | case SISTAT:
|
---|
1000 | case SISTAW:
|
---|
1001 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1002 | str = "SS";
|
---|
1003 | // Append (cat) to str
|
---|
1004 | break;
|
---|
1005 | case RDOSTA:
|
---|
1006 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1007 | Renderer.symbol(feature, Beacons.RadarStation);
|
---|
1008 | break;
|
---|
1009 | case RADSTA:
|
---|
1010 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1011 | Renderer.symbol(feature, Beacons.RadarStation);
|
---|
1012 | break;
|
---|
1013 | case PILBOP:
|
---|
1014 | Renderer.symbol(feature, Harbours.Pilot);
|
---|
1015 | break;
|
---|
1016 | case CGUSTA:
|
---|
1017 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1018 | str = "CG";
|
---|
1019 | break;
|
---|
1020 | case RSCSTA:
|
---|
1021 | Renderer.symbol(feature, Harbours.Rescue);
|
---|
1022 | break;
|
---|
1023 | }
|
---|
1024 | if ((Renderer.zoom >= 15) && !str.isEmpty()) {
|
---|
1025 | Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(30, 0)));
|
---|
1026 | }
|
---|
1027 | Signals.addSignals(feature);
|
---|
1028 | }
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | private static void transits(Feature feature) {
|
---|
1032 | if (Renderer.zoom >= 12) {
|
---|
1033 | if (feature.type == Obj.RECTRC) Renderer.lineVector (feature, new LineStyle(Color.black, 10, null, null));
|
---|
1034 | else if (feature.type == Obj.NAVLNE) Renderer.lineVector (feature, new LineStyle(Color.black, 10, new float[] { 25, 25 }, null));
|
---|
1035 | }
|
---|
1036 | if (Renderer.zoom >= 15) {
|
---|
1037 | String str = "";
|
---|
1038 | String name = getName(feature);
|
---|
1039 | if (name != null) str += name + " ";
|
---|
1040 | Double ort = (Double) getAttVal(feature, feature.type, 0, Att.ORIENT);
|
---|
1041 | if (ort != null) str += ort.toString() + "\u0152";
|
---|
1042 | if (!str.isEmpty()) Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
|
---|
1043 | }
|
---|
1044 | }
|
---|
1045 |
|
---|
1046 | private static void waterways(Feature feature) {
|
---|
1047 |
|
---|
1048 | }
|
---|
1049 |
|
---|
1050 | private static void wrecks(Feature feature) {
|
---|
1051 | if (Renderer.zoom >= 14) {
|
---|
1052 | CatWRK cat = (CatWRK) getAttVal(feature, feature.type, 0, Att.CATWRK);
|
---|
1053 | switch (cat) {
|
---|
1054 | case WRK_DNGR:
|
---|
1055 | case WRK_MSTS:
|
---|
1056 | Renderer.symbol(feature, Areas.WreckD);
|
---|
1057 | break;
|
---|
1058 | case WRK_HULS:
|
---|
1059 | Renderer.symbol(feature, Areas.WreckS);
|
---|
1060 | break;
|
---|
1061 | default:
|
---|
1062 | Renderer.symbol(feature, Areas.WreckND);
|
---|
1063 | }
|
---|
1064 | }
|
---|
1065 | }
|
---|
1066 | }
|
---|