source: osm/applications/editors/josm/plugins/smed2/src/seamap/Rules.java@ 29287

Last change on this file since 29287 was 29287, checked in by stoecker, 13 years ago

fix illegal character

File size: 29.0 KB
Line 
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
10package seamap;
11
12import java.awt.Color;
13import java.awt.Font;
14import java.awt.geom.AffineTransform;
15import java.util.ArrayList;
16
17import s57.S57val.*;
18import s57.S57att.*;
19import s57.S57obj.*;
20
21import seamap.SeaMap.*;
22import symbols.*;
23import symbols.Symbols.*;
24
25public class Rules {
26
27 static SeaMap map;
28 static int zoom;
29
30 public static void rules (SeaMap m, int z) {
31 map = m;
32 zoom = z;
33 ArrayList<Feature> objects;
34 if ((objects = map.features.get(Obj.SLCONS)) != null) for (Feature feature : objects) shoreline(feature);
35 if ((objects = map.features.get(Obj.SLCONS)) != null) for (Feature feature : objects) shoreline(feature);;
36 if ((objects = map.features.get(Obj.PIPSOL)) != null) for (Feature feature : objects) pipelines(feature);
37 if ((objects = map.features.get(Obj.CBLSUB)) != null) for (Feature feature : objects) cables(feature);
38 if ((objects = map.features.get(Obj.PIPOHD)) != null) for (Feature feature : objects) pipelines(feature);
39 if ((objects = map.features.get(Obj.CBLOHD)) != null) for (Feature feature : objects) cables(feature);
40 if ((objects = map.features.get(Obj.TSEZNE)) != null) for (Feature feature : objects) separation(feature);
41 if ((objects = map.features.get(Obj.TSSCRS)) != null) for (Feature feature : objects) separation(feature);
42 if ((objects = map.features.get(Obj.TSSRON)) != null) for (Feature feature : objects) separation(feature);
43 if ((objects = map.features.get(Obj.TSELNE)) != null) for (Feature feature : objects) separation(feature);
44 if ((objects = map.features.get(Obj.TSSLPT)) != null) for (Feature feature : objects) separation(feature);
45 if ((objects = map.features.get(Obj.TSSBND)) != null) for (Feature feature : objects) separation(feature);
46 if ((objects = map.features.get(Obj.SNDWAV)) != null) for (Feature feature : objects) areas(feature);
47 if ((objects = map.features.get(Obj.OSPARE)) != null) for (Feature feature : objects) areas(feature);
48 if ((objects = map.features.get(Obj.FAIRWY)) != null) for (Feature feature : objects) areas(feature);
49 if ((objects = map.features.get(Obj.DRGARE)) != null) for (Feature feature : objects) areas(feature);
50 if ((objects = map.features.get(Obj.RESARE)) != null) for (Feature feature : objects) areas(feature);
51 if ((objects = map.features.get(Obj.SPLARE)) != null) for (Feature feature : objects) areas(feature);
52 if ((objects = map.features.get(Obj.SEAARE)) != null) for (Feature feature : objects) areas(feature);
53 if ((objects = map.features.get(Obj.OBSTRN)) != null) for (Feature feature : objects) obstructions(feature);
54 if ((objects = map.features.get(Obj.UWTROC)) != null) for (Feature feature : objects) obstructions(feature);
55 if ((objects = map.features.get(Obj.MARCUL)) != null) for (Feature feature : objects) areas(feature);
56 if ((objects = map.features.get(Obj.WTWAXS)) != null) for (Feature feature : objects) waterways(feature);
57 if ((objects = map.features.get(Obj.RECTRC)) != null) for (Feature feature : objects) transits(feature);
58 if ((objects = map.features.get(Obj.NAVLNE)) != null) for (Feature feature : objects) transits(feature);
59 if ((objects = map.features.get(Obj.HRBFAC)) != null) for (Feature feature : objects) harbours(feature);
60 if ((objects = map.features.get(Obj.ACHARE)) != null) for (Feature feature : objects) harbours(feature);
61 if ((objects = map.features.get(Obj.ACHBRT)) != null) for (Feature feature : objects) harbours(feature);
62 if ((objects = map.features.get(Obj.LOKBSN)) != null) for (Feature feature : objects) locks(feature);
63 if ((objects = map.features.get(Obj.LKBSPT)) != null) for (Feature feature : objects) locks(feature);
64 if ((objects = map.features.get(Obj.GATCON)) != null) for (Feature feature : objects) locks(feature);
65 if ((objects = map.features.get(Obj.DISMAR)) != null) for (Feature feature : objects) distances(feature);
66 if ((objects = map.features.get(Obj.HULKES)) != null) for (Feature feature : objects) ports(feature);
67 if ((objects = map.features.get(Obj.CRANES)) != null) for (Feature feature : objects) ports(feature);
68 if ((objects = map.features.get(Obj.LNDMRK)) != null) for (Feature feature : objects) landmarks(feature);
69 if ((objects = map.features.get(Obj.MORFAC)) != null) for (Feature feature : objects) moorings(feature);
70 if ((objects = map.features.get(Obj.NOTMRK)) != null) for (Feature feature : objects) notices(feature);
71 if ((objects = map.features.get(Obj.SMCFAC)) != null) for (Feature feature : objects) marinas(feature);
72 if ((objects = map.features.get(Obj.BRIDGE)) != null) for (Feature feature : objects) bridges(feature);
73 if ((objects = map.features.get(Obj.LITMAJ)) != null) for (Feature feature : objects) lights(feature);
74 if ((objects = map.features.get(Obj.LITMIN)) != null) for (Feature feature : objects) lights(feature);
75 if ((objects = map.features.get(Obj.LIGHTS)) != null) for (Feature feature : objects) lights(feature);
76 if ((objects = map.features.get(Obj.SISTAT)) != null) for (Feature feature : objects) signals(feature);
77 if ((objects = map.features.get(Obj.SISTAW)) != null) for (Feature feature : objects) signals(feature);
78 if ((objects = map.features.get(Obj.CGUSTA)) != null) for (Feature feature : objects) signals(feature);
79 if ((objects = map.features.get(Obj.RDOSTA)) != null) for (Feature feature : objects) signals(feature);
80 if ((objects = map.features.get(Obj.RADSTA)) != null) for (Feature feature : objects) signals(feature);
81 if ((objects = map.features.get(Obj.RSCSTA)) != null) for (Feature feature : objects) signals(feature);
82 if ((objects = map.features.get(Obj.PILBOP)) != null) for (Feature feature : objects) signals(feature);
83 if ((objects = map.features.get(Obj.WTWGAG)) != null) for (Feature feature : objects) gauges(feature);
84 if ((objects = map.features.get(Obj.OFSPLF)) != null) for (Feature feature : objects) platforms(feature);
85 if ((objects = map.features.get(Obj.WRECKS)) != null) for (Feature feature : objects) wrecks(feature);
86 if ((objects = map.features.get(Obj.LITVES)) != null) for (Feature feature : objects) floats(feature);
87 if ((objects = map.features.get(Obj.LITFLT)) != null) for (Feature feature : objects) floats(feature);
88 if ((objects = map.features.get(Obj.BOYINB)) != null) for (Feature feature : objects) floats(feature);
89 if ((objects = map.features.get(Obj.BOYLAT)) != null) for (Feature feature : objects) buoys(feature);
90 if ((objects = map.features.get(Obj.BOYCAR)) != null) for (Feature feature : objects) buoys(feature);
91 if ((objects = map.features.get(Obj.BOYISD)) != null) for (Feature feature : objects) buoys(feature);
92 if ((objects = map.features.get(Obj.BOYSAW)) != null) for (Feature feature : objects) buoys(feature);
93 if ((objects = map.features.get(Obj.BOYSPP)) != null) for (Feature feature : objects) buoys(feature);
94 if ((objects = map.features.get(Obj.BOYWTW)) != null) for (Feature feature : objects) buoys(feature);
95 if ((objects = map.features.get(Obj.BCNLAT)) != null) for (Feature feature : objects) beacons(feature);
96 if ((objects = map.features.get(Obj.BCNCAR)) != null) for (Feature feature : objects) beacons(feature);
97 if ((objects = map.features.get(Obj.BCNISD)) != null) for (Feature feature : objects) beacons(feature);
98 if ((objects = map.features.get(Obj.BCNSAW)) != null) for (Feature feature : objects) beacons(feature);
99 if ((objects = map.features.get(Obj.BCNSPP)) != null) for (Feature feature : objects) beacons(feature);
100 if ((objects = map.features.get(Obj.BCNWTW)) != null) for (Feature feature : objects) beacons(feature);
101 }
102
103 private static void areas(Feature feature) {
104 AttItem name = feature.atts.get(Att.OBJNAM);
105 switch (feature.type) {
106 case SPLARE:
107 if (zoom >= 12) {
108 Renderer.symbol(feature, Areas.Plane, Obj.SPLARE, null);
109 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, 10);
110 }
111 if ((zoom >= 15) && (name != null))
112 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
113 break;
114 case MARCUL:
115 if (zoom >= 14)
116 Renderer.symbol(feature, Areas.MarineFarm, Obj.MARCUL, null);
117 if (zoom >= 16)
118 Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null));
119 break;
120 case FAIRWY:
121 if (feature.area > 2.0) {
122 if (zoom < 16)
123 Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
124 else
125 Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 8, new float[] { 50, 50 }, null));
126 } else {
127 if (zoom >= 14)
128 Renderer.lineVector(feature, new LineStyle(new Color(0x40ffffff, true), 0, null, null));
129 }
130 break;
131 case DRGARE:
132 if (zoom < 16)
133 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true)));
134 else
135 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null));
136 if ((zoom >= 12) && (name != null))
137 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), Color.black, null);
138 break;
139 case RESARE:
140 if (zoom >= 12) {
141 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, 0);
142// if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK)
143// Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null);
144 }
145 break;
146 case OSPARE:
147 if ((CatPRA)Renderer.getAttVal(feature, feature.type, 0, Att.CATPRA) == CatPRA.PRA_WFRM) {
148 Renderer.symbol(feature, Areas.WindFarm, Obj.OSPARE, null);
149 Renderer.lineVector(feature, new LineStyle(Color.black, 20, new float[] { 40, 40 }, null));
150 if ((zoom >= 15) && (name != null))
151 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10)));
152 }
153 break;
154 case SEAARE:
155 switch ((CatSEA) Renderer.getAttVal(feature, feature.type, 0, Att.CATSEA)) {
156 case SEA_RECH:
157 break;
158 case SEA_BAY:
159 break;
160 case SEA_SHOL:
161 break;
162 case SEA_GAT:
163 case SEA_NRRW:
164 break;
165 }
166 break;
167 case SNDWAV:
168// if (zoom>=12)) area("fill:url(#sandwaves)");
169 break;
170 }
171/*
172 if (is_type("sea_area")) {
173 if (has_attribute("category")) {
174 make_string("");
175 attribute_switch("category")
176 attribute_case("reach") { if (zoom >= 10) add_string("font-family:Arial;font-weight:normal;font-style:italic;font-size:150;text-anchor:middle") }
177 attribute_case("bay") { if (zoom >= 12) add_string("font-family:Arial;font-weight:normal;font-style:italic;font-size:150;text-anchor:middle") }
178 attribute_case("shoal") { if (zoom >= 14) {
179 if (is_area) {
180 area("stroke:#c480ff;stroke-width:4;stroke-dasharray:25,25;fill:none");
181 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);
182 text("(Shoal)", "font-family:Arial;font-weight:normal;font-size:60;text-anchor:middle", 0, 0);
183 } else if (is_line) {
184 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"));
185 way_text("(Shoal)", "font-family:Arial;font-weight:normal;font-size:60;text-anchor:middle", 0.5, 0, line("stroke:none;fill:none"));
186 } else {
187 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);
188 text("(Shoal)", "font-family:Arial;font-weight:normal;font-size:60;text-anchor:middle", 0, 0);
189 }
190 }
191 }
192 attribute_case("gat|narrows") { if (zoom >= 12) add_string("font-family:Arial;font-weight:normal;font-style:italic;font-size:100;text-anchor:middle") }
193 end_switch
194 if ((strlen(string) > 0) && !attribute_test("category", "shoal")) {
195 int ref = line("stroke:none;fill:none");
196 if (ref != 0) {
197 if (has_item_attribute("name")) way_text(item_attribute("name"), string, 0.5, 0, ref);
198 } else {
199 if (has_item_attribute("name")) text(item_attribute("name"), string, 0, 0);
200 }
201 }
202 free_string
203 }
204 }
205 */
206 }
207 private static void beacons(Feature feature) {
208 BcnSHP shape = (BcnSHP) Renderer.getAttVal(feature, feature.type, 0, Att.BCNSHP);
209 if (((shape == BcnSHP.BCN_PRCH) || (shape == BcnSHP.BCN_WTHY)) && (feature.type == Obj.BCNLAT)) {
210 CatLAM cat = (CatLAM) Renderer.getAttVal(feature, feature.type, 0, Att.CATLAM);
211 switch (cat) {
212 case LAM_PORT:
213 if (shape == BcnSHP.BCN_PRCH)
214 Renderer.symbol(feature, Beacons.PerchPort, null, null);
215 else
216 Renderer.symbol(feature, Beacons.WithyPort, null, null);
217 break;
218 case LAM_STBD:
219 if (shape == BcnSHP.BCN_PRCH)
220 Renderer.symbol(feature, Beacons.PerchStarboard, null, null);
221 else
222 Renderer.symbol(feature, Beacons.WithyStarboard, null, null);
223 break;
224 default:
225 Renderer.symbol(feature, Beacons.Stake, feature.type, null);
226 }
227 } else {
228 Renderer.symbol(feature, Beacons.Shapes.get(shape), feature.type, null);
229 if (feature.objs.get(Obj.TOPMAR) != null)
230 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR, Topmarks.Beacons);
231 }
232 }
233 private static void buoys(Feature feature) {
234 BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP);
235 Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type, null);
236 if (feature.objs.get(Obj.TOPMAR) != null) {
237 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR, Topmarks.Buoys.get(shape));
238 }
239 }
240 private static void bridges(Feature feature) {
241 if (zoom >= 16) {
242
243 }
244/* Att_t *attv = getAtt(getObj(item, BRIDGE, 0), VERCLR);
245 if (attv == NULL) attv = getAtt(getObj(item, BRIDGE, 0), VERCSA);
246 Att_t *attc = getAtt(getObj(item, BRIDGE, 0), VERCCL);
247 Att_t *atto = getAtt(getObj(item, BRIDGE, 0), VERCOP);
248 if (attv != NULL) {
249 renderSymbol(item, obja, "clear_v", "", "", CC, 0, 0, 0);
250 drawText(item, stringValue(attv->val), "font-family:Arial; font-weight:normal; font-size:70; text-anchor:middle", 0, 12);
251 }
252 else if ((attc != NULL) && (atto == NULL)) {
253 renderSymbol(item, obja, "clear_v", "", "", CC, 0, 0, 0);
254 drawText(item, stringValue(attc->val), "font-family:Arial; font-weight:normal; font-size:70; text-anchor:middle", 0, 12);
255 }
256 else if ((attc != NULL) && (atto != NULL)) {
257 renderSymbol(item, obja, "clear_v", "", "", RC, 5, 0, 0);
258 drawText(item, stringValue(attc->val), "font-family:Arial; font-weight:normal; font-size:70; text-anchor:middle", -35, 12);
259 renderSymbol(item, obja, "clear_v", "", "", LC, -5, 0, 0);
260 drawText(item, stringValue(atto->val), "font-family:Arial; font-weight:normal; font-size:70; text-anchor:middle", 35, 12);
261 }
262 }
263*/
264 }
265 private static void cables(Feature feature) {
266 if (zoom >= 14) {
267 if (feature.type == Obj.CBLSUB) {
268 Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, 0);
269 } else if (feature.type == Obj.CBLOHD) {
270
271 }
272 }
273 }
274 private static void distances(Feature feature) {
275/*object_rules(distances) {
276 if ((zoom>=16) && (has_attribute("category"))) {
277 attribute_switch("category")
278 attribute_case("installed") symbol("distance_i");
279 attribute_default symbol("distance_u");
280 end_switch
281 }
282}
283*/
284 }
285 private static void floats(Feature feature) {
286 switch (feature.type) {
287 case LITVES:
288 Renderer.symbol(feature, Buoys.Super, feature.type, null);
289 break;
290 case LITFLT:
291 Renderer.symbol(feature, Buoys.Float, feature.type, null);
292 break;
293 case BOYINB:
294 Renderer.symbol(feature, Buoys.Storage, feature.type, null);
295 break;
296 }
297 if (feature.objs.get(Obj.TOPMAR) != null)
298 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR, Topmarks.Floats);
299 }
300 private static void gauges(Feature feature) {
301/*object_rules(gauge) {
302 if (zoom >= 14) symbol("tide_gauge");
303}
304*/
305 }
306 private static void harbours(Feature feature) {
307 AttItem name = feature.atts.get(Att.OBJNAM);
308 switch (feature.type) {
309 case ACHARE:
310 if (zoom >= 12) {
311 if (feature.flag != Fflag.LINE)
312 Renderer.symbol(feature, Harbours.Anchorage, null, null);
313 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, 10);
314 if ((zoom >= 15) && ((name) != null)) {
315 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), new Color(0x80c480ff), null);
316 }
317 }
318 break;
319 }
320 }
321/*
322 * if ((zoom >= 12) && is_type("anchorage")) {
323 symbol("anchorage");
324 if ((zoom >= 15) && (has_item_attribute("name")))
325 text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:middle", 0, -90);
326 if ((zoom >= 12) && (is_area)) line_symbols("restricted_line", 0.5, "line_anchor", 10);
327 }
328 if ((zoom >= 16) && is_type("anchor_berth")) symbol("anchor_berth");
329 if ((zoom >= 12) && is_type("harbour")) {
330 if (has_attribute("category")) {
331 attribute_switch("category")
332 attribute_case("marina|yacht") symbol("marina");
333 attribute_case("marina_no_facilities") symbol("marina_nf");
334 attribute_default symbol("harbour");
335 end_switch
336 } else symbol("harbour");
337 if ((zoom >= 15) && (has_item_attribute("name")))
338 text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:middle", 0, -90);
339 }
340*/
341 private static void landmarks(Feature feature) {
342 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) Renderer.getAttVal(feature, feature.type, 0, Att.CATLMK);
343 Symbol catSym = Landmarks.Shapes.get(cats.get(0));
344 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Renderer.getAttVal(feature, feature.type, 0, Att.FUNCTN);
345 Symbol fncSym = Landmarks.Funcs.get(fncs.get(0));
346 if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR))
347 catSym = Landmarks.ChurchTower;
348 if ((cats.get(0) == CatLMK.LMK_UNKN) && (fncs.get(0) == FncFNC.FNC_UNKN) && (feature.objs.get(Obj.LIGHTS) != null))
349 catSym = Beacons.LightMajor;
350 if (cats.get(0) == CatLMK.LMK_RADR)
351 fncSym = Landmarks.RadioTV;
352 Renderer.symbol(feature, catSym, null, null);
353 Renderer.symbol(feature, fncSym, null, null);
354/* if (!has_attribute("function") && !has_attribute("category") && has_object("light")) {
355 symbol("lighthouse");
356 if ((zoom >= 15) && has_item_attribute("name"))
357 text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:middle", 0, -70);
358 } else {
359 if ((zoom >= 15) && has_item_attribute("name"))
360 text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:start", 60, -50);
361 }
362 if (has_object("fog_signal")) object(fogs);
363 if (has_object("radar_transponder")) object(rtbs);
364 if (has_object("radar_station") && (zoom >= 12)) symbol("radar_station");
365 if (has_object("light")) object(lights);
366}
367*/
368 }
369 private static void lights(Feature feature) {
370 switch (feature.type) {
371 case LITMAJ:
372 Renderer.symbol(feature, Beacons.LightMajor, null, null);
373 break;
374 case LITMIN:
375 case LIGHTS:
376 Renderer.symbol(feature, Beacons.LightMinor, null, null);
377 break;
378 }
379 }
380 private static void locks(Feature feature) {
381/*object_rules(locks) {
382 if ((zoom>=13) && is_type("lock_basin|lock_basin_part")) symbol("lock");
383 if ((zoom>=15) && is_type("gate")) symbol("lock_gate");
384}
385*/
386 }
387 private static void marinas(Feature feature) {
388 if (zoom >= 16) {
389
390 }
391/* int n = countObjects(item, type);
392 Atta_t atta = enumAttribute("category", obja);
393 char **map = cluster_map(obja);
394 if (map == NULL) return;
395 switch (n) {
396 case 0: {
397 Obj_t *obj = getObj(item, obja, 0);
398 int n = countValues(getAtt(obj, atta));
399 switch (n) {
400 case 1:
401 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", CC, 0, 0, 0);
402 break;
403 case 2:
404 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", RC, 0, 0, 0);
405 renderSymbol(item, obja, map[getAttEnum(obj, atta, 1)], "", "", LC, 0, 0, 0);
406 break;
407 case 3:
408 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", BC, 0, 0, 0);
409 renderSymbol(item, obja, map[getAttEnum(obj, atta, 1)], "", "", TR, 0, 0, 0);
410 renderSymbol(item, obja, map[getAttEnum(obj, atta, 2)], "", "", TL, 0, 0, 0);
411 break;
412 case 4:
413 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", BR, 0, 0, 0);
414 renderSymbol(item, obja, map[getAttEnum(obj, atta, 1)], "", "", BL, 0, 0, 0);
415 renderSymbol(item, obja, map[getAttEnum(obj, atta, 2)], "", "", TR, 0, 0, 0);
416 renderSymbol(item, obja, map[getAttEnum(obj, atta, 3)], "", "", TL, 0, 0, 0);
417 break;
418 }
419 }
420 break;
421 case 1:
422 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", CC, 0, 0, 0);
423 break;
424 case 2:
425 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", RC, 0, 0, 0);
426 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 2), atta, 0)], "", "", LC, 0, 0, 0);
427 break;
428 case 3:
429 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", BC, 0, 0, 0);
430 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 2), atta, 0)], "", "", TR, 0, 0, 0);
431 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 3), atta, 0)], "", "", TL, 0, 0, 0);
432 break;
433 case 4:
434 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", BR, 0, 0, 0);
435 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 2), atta, 0)], "", "", BL, 0, 0, 0);
436 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 3), atta, 0)], "", "", TR, 0, 0, 0);
437 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 4), atta, 0)], "", "", TL, 0, 0, 0);
438 break;
439 }
440*/
441 }
442 private static void moorings(Feature feature) {
443 CatMOR cat = (CatMOR) Renderer.getAttVal(feature, feature.type, 0, Att.CATMOR);
444 switch (cat) {
445 case MOR_DLPN:
446 Renderer.symbol(feature, Harbours.Dolphin, null, null);
447 break;
448 case MOR_DDPN:
449 Renderer.symbol(feature, Harbours.DeviationDolphin, null, null);
450 break;
451 case MOR_BLRD:
452 case MOR_POST:
453 Renderer.symbol(feature, Harbours.Bollard, null, null);
454 break;
455 case MOR_BUOY:
456 BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP);
457 if (shape == BoySHP.BOY_UNKN)
458 shape = BoySHP.BOY_SPHR;
459 Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type, null);
460 break;
461 }
462/* if (has_object("fog_signal")) object(fogs);
463 if (has_object("radar_transponder")) object(rtbs);
464 if (has_object("light")) object(lights);
465}
466*/
467 }
468 private static void notices(Feature feature) {
469 if (zoom >= 14) {
470 }
471 }
472 private static void obstructions(Feature feature) {
473 if ((zoom >= 14) && (feature.type == Obj.UWTROC)) {
474 WatLEV lvl = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV);
475 switch (lvl) {
476 case LEV_CVRS:
477 Renderer.symbol(feature, Areas.RockC, null, null);
478 break;
479 case LEV_AWSH:
480 Renderer.symbol(feature, Areas.RockA, null, null);
481 break;
482 default:
483 Renderer.symbol(feature, Areas.Rock, null, null);
484 }
485 } else {
486 Renderer.symbol(feature, Areas.Rock, null, null);
487 }
488 }
489 private static void pipelines(Feature feature) {
490 if (zoom >= 14) {
491 if (feature.type == Obj.PIPSOL) {
492 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, 0);
493 } else if (feature.type == Obj.PIPOHD) {
494
495 }
496 }
497 }
498 private static void platforms(Feature feature) {
499 Renderer.symbol(feature, Landmarks.Platform, null, null);
500/*object_rules(platforms) {
501 if (has_attribute("category")) {
502 attribute_switch("category")
503 attribute_case("fpso") symbol("storage");
504 attribute_default symbol("platform");
505 end_switch
506 } else {
507 symbol("platform");
508 }
509 if ((zoom >= 15) && has_item_attribute("name"))
510 text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:start", 60, -50);
511 if (has_object("fog_signal")) object(fogs);
512 if (has_object("radar_transponder")) object(rtbs);
513 if (has_object("light")) object(lights);
514}
515*/
516 }
517 private static void ports(Feature feature) {
518/*object_rules(ports) {
519 if (zoom>=14) {
520 if (is_type("crane")) {
521 if (attribute_test("category", "container_crane")) symbol("container_crane");
522 else symbol("port_crane");
523 }
524 if (is_type("hulk")) {
525 area("fill:#ffe000;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-opacity:1");
526 if ((zoom >= 15) && (has_item_attribute("name")))
527 text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:70; text-anchor:middle", 0, 0);
528 }
529 }
530}
531*/
532 }
533 private static void separation(Feature feature) {
534 switch (feature.type) {
535 case TSEZNE:
536 case TSSCRS:
537 case TSSRON:
538 if (zoom <= 15)
539 Renderer.lineVector(feature, new LineStyle(null, 0, null, new Color(0x80c480ff, true)));
540 else
541 Renderer.lineVector(feature, new LineStyle(new Color(0x80c480ff, true), 20, null, null));
542 AttItem name = feature.atts.get(Att.OBJNAM);
543 if ((zoom >= 10) && (name != null))
544 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 150), new Color(0x80c480ff), null);
545 break;
546 case TSELNE:
547 Renderer.lineVector(feature, new LineStyle(new Color(0x80c480ff, true), 20, null, null));
548 break;
549 case TSSLPT:
550 Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, 0);
551 break;
552 case TSSBND:
553 Renderer.lineVector(feature, new LineStyle(new Color(0x80c480ff, true), 20, new float[] { 40, 40 }, null));
554 break;
555 }
556 }
557 private static void shoreline(Feature feature) {
558 if (zoom >= 12) {
559 switch ((CatSLC) Renderer.getAttVal(feature, feature.type, 0, Att.CATSLC)) {
560 case SLC_TWAL:
561 WatLEV lev = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV);
562 if (lev == WatLEV.LEV_CVRS) {
563 Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
564 if (zoom >= 15)
565 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), 0.5, 20);
566 } else {
567 Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
568 }
569 if (zoom >= 15)
570 Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), 0.5, -20);
571 }
572 }
573 }
574 private static void signals(Feature feature) {
575 switch (feature.type) {
576 case SISTAT:
577 case SISTAW:
578 Renderer.symbol(feature, Harbours.SignalStation, null, null);
579 break;
580 case RDOSTA:
581 Renderer.symbol(feature, Harbours.SignalStation, null, null);
582 break;
583 case RADSTA:
584 Renderer.symbol(feature, Harbours.SignalStation, null, null);
585 Renderer.symbol(feature, Beacons.RadarStation, null, null);
586 break;
587 case PILBOP:
588 Renderer.symbol(feature, Harbours.Pilot, null, null);
589 break;
590 case CGUSTA:
591 Renderer.symbol(feature, Harbours.SignalStation, null, null);
592 break;
593 case RSCSTA:
594 Renderer.symbol(feature, Harbours.Rescue, null, null);
595 break;
596 }
597/* if (has_object("fog_signal")) object(fogs);
598 if (has_object("radar_transponder")) object(rtbs);
599 if (has_object("light")) object(lights);
600}
601*/
602 }
603 private static void transits(Feature feature) {
604/*object_rules(transits) {
605 int ref;
606 if (zoom >= 12) {
607 if (is_type("recommended_track")) ref = line("stroke-width:8; stroke:#000000; stroke-linecap:butt; fill:none");
608 else if (is_type("navigation_line")) ref = line("stroke-width:8; stroke-dasharray:20,20; stroke:#000000; stroke-linecap:butt; fill:none");
609 }
610 if (zoom >= 15) {
611 make_string("");
612 if (has_object("name")) {
613 add_string(item_attribute("name"));
614 add_string(" ");
615 }
616 if (has_attribute("orientation")) {
617 add_string(attribute("orientation"));
618 add_string("\u00A1");
619 }
620 if (has_attribute("category")) {
621 add_string(" (");
622 add_string(attribute("category"));
623 add_string(")");
624 }
625 line_text(string, "font-family:Arial; font-weight:normal; font-size:80; text-anchor:middle", 0.5, -20, ref);
626 free_string
627 }
628}
629*/
630 }
631 private static void waterways(Feature feature) {
632 if ((zoom >= 14) && (feature.atts.get(Att.OBJNAM) != null)) {
633 // lineText(item_attribute("name"), "font-family:Arial;font-weight:bold;font-size:80;text-anchor:middle", 0.5, 15, line("stroke:none;fill:none"));
634 }
635 }
636 private static void wrecks(Feature feature) {
637 if (zoom >= 14) {
638 CatWRK cat = (CatWRK) Renderer.getAttVal(feature, feature.type, 0, Att.CATWRK);
639 switch (cat) {
640 case WRK_DNGR:
641 case WRK_MSTS:
642 Renderer.symbol(feature, Areas.WreckD, null, null);
643 break;
644 case WRK_HULS:
645 Renderer.symbol(feature, Areas.WreckS, null, null);
646 break;
647 default:
648 Renderer.symbol(feature, Areas.WreckND, null, null);
649 }
650 } else {
651 Renderer.symbol(feature, Areas.WreckND, null, null);
652 }
653 }
654}
Note: See TracBrowser for help on using the repository browser.