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