1 | /* Copyright 2014 Malcolm Herring
|
---|
2 | *
|
---|
3 | * This is free software: you can redistribute it and/or modify
|
---|
4 | * it under the terms of the GNU General Public License as published by
|
---|
5 | * the Free Software Foundation, version 3 of the License.
|
---|
6 | *
|
---|
7 | * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
|
---|
8 | */
|
---|
9 |
|
---|
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) if (feature.reln == Rflag.MASTER) shoreline(feature);
|
---|
112 | if ((objects = Renderer.map.features.get(Obj.PIPSOL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) pipelines(feature);
|
---|
113 | if ((objects = Renderer.map.features.get(Obj.CBLSUB)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) cables(feature);
|
---|
114 | if ((objects = Renderer.map.features.get(Obj.PIPOHD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) pipelines(feature);
|
---|
115 | if ((objects = Renderer.map.features.get(Obj.CBLOHD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) cables(feature);
|
---|
116 | if ((objects = Renderer.map.features.get(Obj.TSEZNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
117 | if ((objects = Renderer.map.features.get(Obj.TSSCRS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
118 | if ((objects = Renderer.map.features.get(Obj.TSSRON)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
119 | if ((objects = Renderer.map.features.get(Obj.TSELNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
120 | if ((objects = Renderer.map.features.get(Obj.TSSLPT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
121 | if ((objects = Renderer.map.features.get(Obj.TSSBND)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
122 | if ((objects = Renderer.map.features.get(Obj.ISTZNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) separation(feature);
|
---|
123 | if ((objects = Renderer.map.features.get(Obj.SNDWAV)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
124 | if ((objects = Renderer.map.features.get(Obj.OSPARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
125 | if ((objects = Renderer.map.features.get(Obj.FAIRWY)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
126 | if ((objects = Renderer.map.features.get(Obj.DRGARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
127 | if ((objects = Renderer.map.features.get(Obj.RESARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
128 | if ((objects = Renderer.map.features.get(Obj.SPLARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
129 | if ((objects = Renderer.map.features.get(Obj.SEAARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
130 | if ((objects = Renderer.map.features.get(Obj.OBSTRN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) obstructions(feature);
|
---|
131 | if ((objects = Renderer.map.features.get(Obj.UWTROC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) obstructions(feature);
|
---|
132 | if ((objects = Renderer.map.features.get(Obj.MARCUL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
|
---|
133 | if ((objects = Renderer.map.features.get(Obj.WTWAXS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) waterways(feature);
|
---|
134 | if ((objects = Renderer.map.features.get(Obj.RECTRC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) transits(feature);
|
---|
135 | if ((objects = Renderer.map.features.get(Obj.NAVLNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) transits(feature);
|
---|
136 | if ((objects = Renderer.map.features.get(Obj.HRBFAC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
|
---|
137 | if ((objects = Renderer.map.features.get(Obj.ACHARE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
|
---|
138 | if ((objects = Renderer.map.features.get(Obj.ACHBRT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
|
---|
139 | if ((objects = Renderer.map.features.get(Obj.BERTHS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
|
---|
140 | if ((objects = Renderer.map.features.get(Obj.LOKBSN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) locks(feature);
|
---|
141 | if ((objects = Renderer.map.features.get(Obj.LKBSPT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) locks(feature);
|
---|
142 | if ((objects = Renderer.map.features.get(Obj.GATCON)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) locks(feature);
|
---|
143 | if ((objects = Renderer.map.features.get(Obj.DISMAR)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) distances(feature);
|
---|
144 | if ((objects = Renderer.map.features.get(Obj.HULKES)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) ports(feature);
|
---|
145 | if ((objects = Renderer.map.features.get(Obj.CRANES)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) ports(feature);
|
---|
146 | if ((objects = Renderer.map.features.get(Obj.LNDMRK)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) landmarks(feature);
|
---|
147 | if ((objects = Renderer.map.features.get(Obj.BUISGL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) harbours(feature);
|
---|
148 | if ((objects = Renderer.map.features.get(Obj.MORFAC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) moorings(feature);
|
---|
149 | if ((objects = Renderer.map.features.get(Obj.NOTMRK)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) notices(feature);
|
---|
150 | if ((objects = Renderer.map.features.get(Obj.SMCFAC)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) marinas(feature);
|
---|
151 | if ((objects = Renderer.map.features.get(Obj.BRIDGE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) bridges(feature);
|
---|
152 | if ((objects = Renderer.map.features.get(Obj.PILPNT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
|
---|
153 | if ((objects = Renderer.map.features.get(Obj.LITMIN)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
|
---|
154 | if ((objects = Renderer.map.features.get(Obj.LITMAJ)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
|
---|
155 | if ((objects = Renderer.map.features.get(Obj.LIGHTS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) lights(feature);
|
---|
156 | if ((objects = Renderer.map.features.get(Obj.SISTAT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
157 | if ((objects = Renderer.map.features.get(Obj.SISTAW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
158 | if ((objects = Renderer.map.features.get(Obj.CGUSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
159 | if ((objects = Renderer.map.features.get(Obj.RDOSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
160 | if ((objects = Renderer.map.features.get(Obj.RADSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
161 | if ((objects = Renderer.map.features.get(Obj.RSCSTA)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
162 | if ((objects = Renderer.map.features.get(Obj.PILBOP)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) stations(feature);
|
---|
163 | if ((objects = Renderer.map.features.get(Obj.WTWGAG)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) gauges(feature);
|
---|
164 | if ((objects = Renderer.map.features.get(Obj.OFSPLF)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) platforms(feature);
|
---|
165 | if ((objects = Renderer.map.features.get(Obj.WRECKS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) wrecks(feature);
|
---|
166 | if ((objects = Renderer.map.features.get(Obj.LITVES)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) floats(feature);
|
---|
167 | if ((objects = Renderer.map.features.get(Obj.LITFLT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) floats(feature);
|
---|
168 | if ((objects = Renderer.map.features.get(Obj.BOYINB)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) floats(feature);
|
---|
169 | if ((objects = Renderer.map.features.get(Obj.BOYLAT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
|
---|
170 | if ((objects = Renderer.map.features.get(Obj.BOYCAR)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
|
---|
171 | if ((objects = Renderer.map.features.get(Obj.BOYISD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
|
---|
172 | if ((objects = Renderer.map.features.get(Obj.BOYSAW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
|
---|
173 | if ((objects = Renderer.map.features.get(Obj.BOYSPP)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
|
---|
174 | if ((objects = Renderer.map.features.get(Obj.BOYWTW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) buoys(feature);
|
---|
175 | if ((objects = Renderer.map.features.get(Obj.BCNLAT)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
|
---|
176 | if ((objects = Renderer.map.features.get(Obj.BCNCAR)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
|
---|
177 | if ((objects = Renderer.map.features.get(Obj.BCNISD)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
|
---|
178 | if ((objects = Renderer.map.features.get(Obj.BCNSAW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
|
---|
179 | if ((objects = Renderer.map.features.get(Obj.BCNSPP)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) beacons(feature);
|
---|
180 | if ((objects = Renderer.map.features.get(Obj.BCNWTW)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) 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.geom.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.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.geom.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.geom.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 | default:
|
---|
631 | break;
|
---|
632 | }
|
---|
633 | Signals.addSignals(feature);
|
---|
634 | }
|
---|
635 |
|
---|
636 | private static void locks(Feature feature) {
|
---|
637 | }
|
---|
638 |
|
---|
639 | private static void marinas(Feature feature) {
|
---|
640 | if (Renderer.zoom >= 16) {
|
---|
641 |
|
---|
642 | }
|
---|
643 | }
|
---|
644 | private static void moorings(Feature feature) {
|
---|
645 | switch ((CatMOR) getAttVal(feature, feature.type, 0, Att.CATMOR)) {
|
---|
646 | case MOR_DLPN:
|
---|
647 | Renderer.symbol(feature, Harbours.Dolphin);
|
---|
648 | break;
|
---|
649 | case MOR_DDPN:
|
---|
650 | Renderer.symbol(feature, Harbours.DeviationDolphin);
|
---|
651 | break;
|
---|
652 | case MOR_BLRD:
|
---|
653 | case MOR_POST:
|
---|
654 | Renderer.symbol(feature, Harbours.Bollard);
|
---|
655 | break;
|
---|
656 | case MOR_BUOY:
|
---|
657 | BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
|
---|
658 | if (shape == BoySHP.BOY_UNKN)
|
---|
659 | shape = BoySHP.BOY_SPHR;
|
---|
660 | Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
|
---|
661 | break;
|
---|
662 | }
|
---|
663 | Signals.addSignals(feature);
|
---|
664 | }
|
---|
665 |
|
---|
666 | private static void notices(Feature feature) {
|
---|
667 | if (Renderer.zoom >= 14) {
|
---|
668 | double dx = 0.0, dy = 0.0;
|
---|
669 | switch (feature.type) {
|
---|
670 | case BCNCAR:
|
---|
671 | case BCNISD:
|
---|
672 | case BCNLAT:
|
---|
673 | case BCNSAW:
|
---|
674 | case BCNSPP:
|
---|
675 | case BCNWTW:
|
---|
676 | dy = 45.0;
|
---|
677 | break;
|
---|
678 | case NOTMRK:
|
---|
679 | dy = 0.0;
|
---|
680 | break;
|
---|
681 | default:
|
---|
682 | return;
|
---|
683 | }
|
---|
684 | Symbol s1 = null, s2 = null;
|
---|
685 | MarSYS sys = MarSYS.SYS_CEVN;
|
---|
686 | BnkWTW bnk = BnkWTW.BWW_UNKN;
|
---|
687 | AttVal att = feature.atts.get(Att.MARSYS);
|
---|
688 | if (att != null) sys = (MarSYS)att.val;
|
---|
689 | ObjTab objs = feature.objs.get(Obj.NOTMRK);
|
---|
690 | int n = objs.size();
|
---|
691 | if (n > 2) {
|
---|
692 | s1 = Notices.Notice;
|
---|
693 | n = 1;
|
---|
694 | } else {
|
---|
695 | for (AttMap atts : objs.values()) {
|
---|
696 | if (atts.get(Att.MARSYS) != null) sys = (MarSYS)atts.get(Att.MARSYS).val;
|
---|
697 | CatNMK cat = CatNMK.NMK_UNKN;
|
---|
698 | if (atts.get(Att.CATNMK) != null) cat = (CatNMK)atts.get(Att.CATNMK).val;
|
---|
699 | s2 = Notices.getNotice(cat, sys);
|
---|
700 | }
|
---|
701 | }
|
---|
702 | /* Obj_t *obj = getObj(item, NOTMRK, i);
|
---|
703 | if (obj == NULL) continue;
|
---|
704 | Atta_t add;
|
---|
705 | int idx = 0;
|
---|
706 | while ((add = getAttEnum(obj, ADDMRK, idx++)) != MRK_UNKN) {
|
---|
707 | if ((add == MRK_LTRI) && (i == 2)) swap = true;
|
---|
708 | if ((add == MRK_RTRI) && (i != 2)) swap = true;
|
---|
709 | }
|
---|
710 | }
|
---|
711 | } else {
|
---|
712 |
|
---|
713 | }
|
---|
714 | for (int i = 0; i <=2; i++) {
|
---|
715 | Obj_t *obj = getObj(item, NOTMRK, i);
|
---|
716 | if (obj == NULL) continue;
|
---|
717 | Atta_t category = getAttEnum(obj, CATNMK, i);
|
---|
718 | Atta_t add;
|
---|
719 | int idx = 0;
|
---|
720 | int top=0, bottom=0, left=0, right=0;
|
---|
721 | while ((add = getAttEnum(obj, ADDMRK, idx++)) != MRK_UNKN) {
|
---|
722 | switch (add) {
|
---|
723 | case MRK_TOPB:
|
---|
724 | top = add;
|
---|
725 | break;
|
---|
726 | case MRK_BOTB:
|
---|
727 | case MRK_BTRI:
|
---|
728 | bottom = add;
|
---|
729 | break;
|
---|
730 | case MRK_LTRI:
|
---|
731 | left = add;
|
---|
732 | break;
|
---|
733 | case MRK_RTRI:
|
---|
734 | right = add;
|
---|
735 | break;
|
---|
736 | default:
|
---|
737 | break;
|
---|
738 | }
|
---|
739 | }
|
---|
740 | double orient = getAtt(obj, ORIENT) != NULL ? getAtt(obj, ORIENT)->val.val.f : 0.0;
|
---|
741 | int system = getAtt(obj, MARSYS) != NULL ? getAtt(obj, MARSYS)->val.val.e : 0;
|
---|
742 | double flip = 0.0;
|
---|
743 | char *symb = "";
|
---|
744 | char *base = "";
|
---|
745 | char *colour = "black";
|
---|
746 | if ((system == SYS_BWR2) || (system == SYS_BNWR)) {
|
---|
747 | symb = bniwr_map[category];
|
---|
748 | switch (category) {
|
---|
749 | case NMK_NANK:
|
---|
750 | case NMK_LMHR:
|
---|
751 | case NMK_KTPM...NMK_RSPD:
|
---|
752 | {
|
---|
753 | int bank = getAtt(obj, BNKWTW) != NULL ? getAtt(obj, BNKWTW)->val.val.e : 0;
|
---|
754 | switch (bank) {
|
---|
755 | case BWW_LEFT:
|
---|
756 | base = "notice_blb";
|
---|
757 | colour = "red";
|
---|
758 | break;
|
---|
759 | case BWW_RGHT:
|
---|
760 | base = "notice_brb";
|
---|
761 | colour = "green";
|
---|
762 | break;
|
---|
763 | default:
|
---|
764 | base = "notice_bsi";
|
---|
765 | colour = "black";
|
---|
766 | break;
|
---|
767 | }
|
---|
768 | }
|
---|
769 | default:
|
---|
770 | break;
|
---|
771 | }
|
---|
772 | } else if (system == SYS_PPWB) {
|
---|
773 | int bank = getAtt(obj, BNKWTW) != NULL ? getAtt(obj, BNKWTW)->val.val.e : 0;
|
---|
774 | if (bank != 0) {
|
---|
775 | switch (category) {
|
---|
776 | case NMK_WLAR:
|
---|
777 | if (bank == BNK_LEFT)
|
---|
778 | base = "notice_pwlarl";
|
---|
779 | else
|
---|
780 | base = "notice_pwlarr";
|
---|
781 | break;
|
---|
782 | case NMK_WRAL:
|
---|
783 | if (bank == BNK_LEFT)
|
---|
784 | base = "notice_pwrall";
|
---|
785 | else
|
---|
786 | base = "notice_pwralr";
|
---|
787 | break;
|
---|
788 | case NMK_KTPM:
|
---|
789 | if (bank == BNK_LEFT)
|
---|
790 | base = "notice_ppml";
|
---|
791 | else
|
---|
792 | base = "notice_ppmr";
|
---|
793 | break;
|
---|
794 | case NMK_KTSM:
|
---|
795 | if (bank == BNK_LEFT)
|
---|
796 | base = "notice_psml";
|
---|
797 | else
|
---|
798 | base = "notice_psmr";
|
---|
799 | break;
|
---|
800 | case NMK_KTMR:
|
---|
801 | if (bank == BNK_LEFT)
|
---|
802 | base = "notice_pmrl";
|
---|
803 | else
|
---|
804 | base = "notice_pmrr";
|
---|
805 | break;
|
---|
806 | case NMK_CRTP:
|
---|
807 | if (bank == BNK_LEFT)
|
---|
808 | base = "notice_pcpl";
|
---|
809 | else
|
---|
810 | base = "notice_pcpr";
|
---|
811 | break;
|
---|
812 | case NMK_CRTS:
|
---|
813 | if (bank == BNK_LEFT)
|
---|
814 | base = "notice_pcsl";
|
---|
815 | else
|
---|
816 | base = "notice_pcsr";
|
---|
817 | break;
|
---|
818 | default:
|
---|
819 | break;
|
---|
820 | }
|
---|
821 | }
|
---|
822 | } else {
|
---|
823 | symb = notice_map[category];
|
---|
824 | switch (category) {
|
---|
825 | case NMK_NOVK...NMK_NWSH:
|
---|
826 | case NMK_NMTC...NMK_NLBG:
|
---|
827 | base = "notice_a";
|
---|
828 | break;
|
---|
829 | case NMK_MVTL...NMK_CHDR:
|
---|
830 | base = "notice_b";
|
---|
831 | break;
|
---|
832 | case NMK_PRTL...NMK_PRTR:
|
---|
833 | case NMK_OVHC...NMK_LBGP:
|
---|
834 | base = "notice_e";
|
---|
835 | colour = "white";
|
---|
836 | break;
|
---|
837 | default:
|
---|
838 | break;
|
---|
839 | }
|
---|
840 | switch (category) {
|
---|
841 | case NMK_MVTL:
|
---|
842 | case NMK_ANKP:
|
---|
843 | case NMK_PRTL:
|
---|
844 | case NMK_MWAL:
|
---|
845 | case NMK_MWAR:
|
---|
846 | flip = 180.0;
|
---|
847 | break;
|
---|
848 | case NMK_SWWR:
|
---|
849 | case NMK_WRSL:
|
---|
850 | case NMK_WARL:
|
---|
851 | flip = -90.0;
|
---|
852 | break;
|
---|
853 | case NMK_SWWC:
|
---|
854 | case NMK_SWWL:
|
---|
855 | case NMK_WLSR:
|
---|
856 | case NMK_WALR:
|
---|
857 | flip = 90.0;
|
---|
858 | break;
|
---|
859 | default:
|
---|
860 | break;
|
---|
861 | }
|
---|
862 | }
|
---|
863 | if (n == 2) {
|
---|
864 | dx = (((i != 2) && swap) || ((i == 2) && !swap)) ? -30.0 : 30.0;
|
---|
865 | }
|
---|
866 | if (top == MRK_TOPB)
|
---|
867 | renderSymbol(item, NOTMRK, "notice_board", "", "", BC, dx, dy, orient);
|
---|
868 | if (bottom == MRK_BOTB)
|
---|
869 | renderSymbol(item, NOTMRK, "notice_board", "", "", BC, dx, dy, orient+180);
|
---|
870 | if (bottom == MRK_BTRI)
|
---|
871 | renderSymbol(item, NOTMRK, "notice_triangle", "", "", BC, dx, dy, orient+180);
|
---|
872 | if (left == MRK_LTRI)
|
---|
873 | renderSymbol(item, NOTMRK, "notice_triangle", "", "", BC, dx, dy, orient-90);
|
---|
874 | if (right == MRK_RTRI)
|
---|
875 | renderSymbol(item, NOTMRK, "notice_triangle", "", "", BC, dx, dy, orient+90);
|
---|
876 | renderSymbol(item, NOTMRK, base, "", "", CC, dx, dy, orient);
|
---|
877 | renderSymbol(item, NOTMRK, symb, "", colour, CC, dx, dy, orient+flip);
|
---|
878 | }
|
---|
879 | */
|
---|
880 | }
|
---|
881 | }
|
---|
882 |
|
---|
883 | private static void obstructions(Feature feature) {
|
---|
884 | if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) {
|
---|
885 | WatLEV lvl = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV);
|
---|
886 | switch (lvl) {
|
---|
887 | case LEV_CVRS:
|
---|
888 | Renderer.symbol(feature, Areas.RockC);
|
---|
889 | break;
|
---|
890 | case LEV_AWSH:
|
---|
891 | Renderer.symbol(feature, Areas.RockA);
|
---|
892 | break;
|
---|
893 | default:
|
---|
894 | Renderer.symbol(feature, Areas.Rock);
|
---|
895 | }
|
---|
896 | } else {
|
---|
897 | Renderer.symbol(feature, Areas.Rock);
|
---|
898 | }
|
---|
899 | }
|
---|
900 |
|
---|
901 | private static void pipelines(Feature feature) {
|
---|
902 | if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
|
---|
903 | if (feature.type == Obj.PIPSOL) {
|
---|
904 | Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Mline);
|
---|
905 | } else if (feature.type == Obj.PIPOHD) {
|
---|
906 | Renderer.lineVector(feature, new LineStyle(Color.black, 8));
|
---|
907 | AttMap atts = feature.atts;
|
---|
908 | double verclr = 0;
|
---|
909 | if (atts != null) {
|
---|
910 | if (atts.containsKey(Att.VERCLR)) {
|
---|
911 | verclr = (Double) atts.get(Att.VERCLR).val;
|
---|
912 | } else {
|
---|
913 | verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
|
---|
914 | }
|
---|
915 | if (verclr > 0) {
|
---|
916 | 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)));
|
---|
917 | }
|
---|
918 | }
|
---|
919 | }
|
---|
920 | }
|
---|
921 | }
|
---|
922 |
|
---|
923 | private static void platforms(Feature feature) {
|
---|
924 | ArrayList<CatOFP> cats = (ArrayList<CatOFP>)getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP);
|
---|
925 | if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
|
---|
926 | Renderer.symbol(feature, Buoys.Storage);
|
---|
927 | else
|
---|
928 | Renderer.symbol(feature, Landmarks.Platform);
|
---|
929 | String name = getName(feature);
|
---|
930 | if ((Renderer.zoom >= 15) && (name != null))
|
---|
931 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 40), Color.black, new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
|
---|
932 | Signals.addSignals(feature);
|
---|
933 | }
|
---|
934 |
|
---|
935 | private static void ports(Feature feature) {
|
---|
936 | if (Renderer.zoom >= 14) {
|
---|
937 | if (feature.type == Obj.CRANES) {
|
---|
938 | if ((CatCRN) getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
|
---|
939 | Renderer.symbol(feature, Harbours.ContainerCrane);
|
---|
940 | else
|
---|
941 | Renderer.symbol(feature, Harbours.PortCrane);
|
---|
942 | } else if (feature.type == Obj.HULKES) {
|
---|
943 | Renderer.lineVector(feature, new LineStyle(Color.black, 4, null, new Color(0xffe000)));
|
---|
944 | String name = getName(feature);
|
---|
945 | if ((Renderer.zoom >= 15) && (name != null))
|
---|
946 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), Color.black);
|
---|
947 | }
|
---|
948 | }
|
---|
949 | }
|
---|
950 |
|
---|
951 | private static void separation(Feature feature) {
|
---|
952 | switch (feature.type) {
|
---|
953 | case TSEZNE:
|
---|
954 | case TSSCRS:
|
---|
955 | case TSSRON:
|
---|
956 | if (Renderer.zoom <= 15)
|
---|
957 | Renderer.lineVector(feature, new LineStyle(null, 0, null, new Color(0x80c48080, true)));
|
---|
958 | else
|
---|
959 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
|
---|
960 | String name = getName(feature);
|
---|
961 | if ((Renderer.zoom >= 10) && (name != null))
|
---|
962 | Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 150), new Color(0x80c48080, true));
|
---|
963 | break;
|
---|
964 | case TSELNE:
|
---|
965 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
|
---|
966 | break;
|
---|
967 | case TSSLPT:
|
---|
968 | Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, null, 0, new Color(0x80c48080, true));
|
---|
969 | break;
|
---|
970 | case TSSBND:
|
---|
971 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, new float[] { 40, 40 }, null));
|
---|
972 | break;
|
---|
973 | case ISTZNE:
|
---|
974 | Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, new Color(0x80c48080, true));
|
---|
975 | break;
|
---|
976 | }
|
---|
977 | }
|
---|
978 |
|
---|
979 | private static void shoreline(Feature feature) {
|
---|
980 | if (Renderer.zoom >= 12) {
|
---|
981 | switch ((CatSLC) getAttVal(feature, feature.type, 0, Att.CATSLC)) {
|
---|
982 | case SLC_TWAL:
|
---|
983 | WatLEV lev = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV);
|
---|
984 | if (lev == WatLEV.LEV_CVRS) {
|
---|
985 | Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
|
---|
986 | if (Renderer.zoom >= 15)
|
---|
987 | Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 20);
|
---|
988 | } else {
|
---|
989 | Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
|
---|
990 | }
|
---|
991 | if (Renderer.zoom >= 15)
|
---|
992 | Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
|
---|
993 | }
|
---|
994 | }
|
---|
995 | }
|
---|
996 |
|
---|
997 | private static void stations(Feature feature) {
|
---|
998 | if (Renderer.zoom >= 14) {
|
---|
999 | String str = "";
|
---|
1000 | switch (feature.type) {
|
---|
1001 | case SISTAT:
|
---|
1002 | case SISTAW:
|
---|
1003 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1004 | str = "SS";
|
---|
1005 | // Append (cat) to str
|
---|
1006 | break;
|
---|
1007 | case RDOSTA:
|
---|
1008 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1009 | Renderer.symbol(feature, Beacons.RadarStation);
|
---|
1010 | break;
|
---|
1011 | case RADSTA:
|
---|
1012 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1013 | Renderer.symbol(feature, Beacons.RadarStation);
|
---|
1014 | break;
|
---|
1015 | case PILBOP:
|
---|
1016 | Renderer.symbol(feature, Harbours.Pilot);
|
---|
1017 | break;
|
---|
1018 | case CGUSTA:
|
---|
1019 | Renderer.symbol(feature, Harbours.SignalStation);
|
---|
1020 | str = "CG";
|
---|
1021 | break;
|
---|
1022 | case RSCSTA:
|
---|
1023 | Renderer.symbol(feature, Harbours.Rescue);
|
---|
1024 | break;
|
---|
1025 | }
|
---|
1026 | if ((Renderer.zoom >= 15) && !str.isEmpty()) {
|
---|
1027 | Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(30, 0)));
|
---|
1028 | }
|
---|
1029 | Signals.addSignals(feature);
|
---|
1030 | }
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | private static void transits(Feature feature) {
|
---|
1034 | if (Renderer.zoom >= 12) {
|
---|
1035 | if (feature.type == Obj.RECTRC) Renderer.lineVector (feature, new LineStyle(Color.black, 10, null, null));
|
---|
1036 | else if (feature.type == Obj.NAVLNE) Renderer.lineVector (feature, new LineStyle(Color.black, 10, new float[] { 25, 25 }, null));
|
---|
1037 | }
|
---|
1038 | if (Renderer.zoom >= 15) {
|
---|
1039 | String str = "";
|
---|
1040 | String name = getName(feature);
|
---|
1041 | if (name != null) str += name + " ";
|
---|
1042 | Double ort = (Double) getAttVal(feature, feature.type, 0, Att.ORIENT);
|
---|
1043 | if (ort != null) str += ort.toString() + "\u0152";
|
---|
1044 | if (!str.isEmpty()) Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
|
---|
1045 | }
|
---|
1046 | }
|
---|
1047 |
|
---|
1048 | private static void waterways(Feature feature) {
|
---|
1049 |
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 | private static void wrecks(Feature feature) {
|
---|
1053 | if (Renderer.zoom >= 14) {
|
---|
1054 | CatWRK cat = (CatWRK) getAttVal(feature, feature.type, 0, Att.CATWRK);
|
---|
1055 | switch (cat) {
|
---|
1056 | case WRK_DNGR:
|
---|
1057 | case WRK_MSTS:
|
---|
1058 | Renderer.symbol(feature, Areas.WreckD);
|
---|
1059 | break;
|
---|
1060 | case WRK_HULS:
|
---|
1061 | Renderer.symbol(feature, Areas.WreckS);
|
---|
1062 | break;
|
---|
1063 | default:
|
---|
1064 | Renderer.symbol(feature, Areas.WreckND);
|
---|
1065 | }
|
---|
1066 | }
|
---|
1067 | }
|
---|
1068 | }
|
---|