Changeset 30036 in osm for applications/editors/josm/plugins/smed2/src/seamap/Rules.java
- Timestamp:
- 2013-11-02T17:09:51+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r30033 r30036 108 108 109 109 private static void areas(Feature feature) { 110 AttItemname = feature.atts.get(Att.OBJNAM);110 String name = Util.getName(feature); 111 111 switch (feature.type) { 112 112 case DRGARE: … … 116 116 Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null)); 117 117 if ((zoom >= 12) && (name != null)) 118 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), LabelStyle.NONE, Color.black, null, null);118 Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 100), LabelStyle.NONE, Color.black, null, null); 119 119 break; 120 120 case FAIRWY: … … 131 131 case MARCUL: 132 132 if (zoom >= 14) 133 Renderer.symbol(feature, Areas.MarineFarm , Obj.MARCUL, null, null);133 Renderer.symbol(feature, Areas.MarineFarm); 134 134 if (zoom >= 16) 135 135 Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null)); 136 136 break; 137 137 case OSPARE: 138 if ( (CatPRA)Renderer.getAttVal(feature, feature.type,0,Att.CATPRA) ==CatPRA.PRA_WFRM) {139 Renderer.symbol(feature, Areas.WindFarm , Obj.OSPARE, null, null);138 if (Util.testAttribute(feature, feature.type, Att.CATPRA, CatPRA.PRA_WFRM)) { 139 Renderer.symbol(feature, Areas.WindFarm); 140 140 Renderer.lineVector(feature, new LineStyle(Color.black, 20, new float[] { 40, 40 }, null)); 141 141 if ((zoom >= 15) && (name != null)) 142 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)));142 Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), LabelStyle.NONE, Color.black, null, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10))); 143 143 } 144 144 break; … … 146 146 if (zoom >= 12) { 147 147 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Mline); 148 // if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK) 149 // Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null); 148 if (Util.testAttribute(feature, feature.type, Att.CATPRA, CatREA.REA_NWAK)) { 149 Renderer.symbol(feature, Areas.NoWake); 150 } 150 151 } 151 152 break; 152 153 case SEAARE: 153 switch ((CatSEA) Renderer.getAttVal(feature, feature.type, 0, Att.CATSEA)) {154 switch ((CatSEA) Util.getAttVal(feature, feature.type, 0, Att.CATSEA)) { 154 155 case SEA_RECH: 155 156 break; … … 160 161 case SEA_GAT: 161 162 case SEA_NRRW: 163 break; 164 default: 162 165 break; 163 166 } … … 203 206 case SPLARE: 204 207 if (zoom >= 12) { 205 Renderer.symbol(feature, Areas.Plane , Obj.SPLARE, null, null);208 Renderer.symbol(feature, Areas.Plane); 206 209 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Mline); 207 210 } 208 211 if ((zoom >= 15) && (name != null)) 209 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)));212 Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), LabelStyle.NONE, Color.black, null, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); 210 213 break; 211 214 default: … … 215 218 216 219 private static void beacons(Feature feature) { 217 BcnSHP shape = (BcnSHP) Renderer.getAttVal(feature, feature.type, 0, Att.BCNSHP);220 BcnSHP shape = (BcnSHP) Util.getAttVal(feature, feature.type, 0, Att.BCNSHP); 218 221 if (((shape == BcnSHP.BCN_PRCH) || (shape == BcnSHP.BCN_WTHY)) && (feature.type == Obj.BCNLAT)) { 219 CatLAM cat = (CatLAM) Renderer.getAttVal(feature, feature.type, 0, Att.CATLAM);222 CatLAM cat = (CatLAM) Util.getAttVal(feature, feature.type, 0, Att.CATLAM); 220 223 switch (cat) { 221 224 case LAM_PORT: 222 225 if (shape == BcnSHP.BCN_PRCH) 223 Renderer.symbol(feature, Beacons.PerchPort , null, null, null);226 Renderer.symbol(feature, Beacons.PerchPort); 224 227 else 225 Renderer.symbol(feature, Beacons.WithyPort , null, null, null);228 Renderer.symbol(feature, Beacons.WithyPort); 226 229 break; 227 230 case LAM_STBD: 228 231 if (shape == BcnSHP.BCN_PRCH) 229 Renderer.symbol(feature, Beacons.PerchStarboard , null, null, null);232 Renderer.symbol(feature, Beacons.PerchStarboard); 230 233 else 231 Renderer.symbol(feature, Beacons.WithyStarboard , null, null, null);234 Renderer.symbol(feature, Beacons.WithyStarboard); 232 235 break; 233 236 default: 234 Renderer.symbol(feature, Beacons.Stake, feature.type , null, null);237 Renderer.symbol(feature, Beacons.Stake, Util.getScheme(feature, feature.type)); 235 238 } 236 239 } else { 237 Renderer.symbol(feature, Beacons.Shapes.get(shape), feature.type , null, null);240 Renderer.symbol(feature, Beacons.Shapes.get(shape), Util.getScheme(feature, feature.type)); 238 241 if (feature.objs.get(Obj.TOPMAR) != null) 239 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR , null, Topmarks.Beacons);242 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Util.getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta); 240 243 } 241 244 Signals.addSignals(feature); … … 243 246 244 247 private static void buoys(Feature feature) { 245 BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP);246 Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type , null, null);247 if (feature .objs.get(Obj.TOPMAR)!= null) {248 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR , null, Topmarks.Buoys.get(shape));248 BoySHP shape = (BoySHP) Util.getAttVal(feature, feature.type, 0, Att.BOYSHP); 249 Renderer.symbol(feature, Buoys.Shapes.get(shape), Util.getScheme(feature, feature.type)); 250 if (Util.hasObject(feature, Obj.TOPMAR)) { 251 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Util.getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 249 252 } 250 253 Signals.addSignals(feature); … … 296 299 private static void distances(Feature feature) { 297 300 if (zoom >= 14) { 298 if (! ((CatDIS)Renderer.getAttVal(feature, Obj.DISMAR,0,Att.CATDIS) ==CatDIS.DIS_NONI)) {299 Renderer.symbol(feature, Harbours.DistanceI , null, null, null);301 if (!Util.testAttribute(feature, Obj.DISMAR, Att.CATDIS, CatDIS.DIS_NONI)) { 302 Renderer.symbol(feature, Harbours.DistanceI); 300 303 } else { 301 Renderer.symbol(feature, Harbours.DistanceU, null, null, null); 302 } 303 AttMap atts = feature.objs.get(Obj.DISMAR).get(0); 304 if ((atts != null) && (atts.containsKey(Att.WTWDIS)) && (zoom >=15)) { 305 Double dist = (Double)atts.get(Att.WTWDIS).val; 306 String str = ""; 307 if (atts.containsKey(Att.HUNITS)) { 308 switch ((UniHLU)atts.get(Att.HUNITS).val) { 309 case HLU_METR: 310 str += "m "; 311 break; 312 case HLU_FEET: 313 str += "ft "; 314 break; 315 case HLU_HMTR: 316 str += "hm "; 317 break; 318 case HLU_KMTR: 319 str += "km "; 320 break; 321 case HLU_SMIL: 322 str += "M "; 323 break; 324 case HLU_NMIL: 325 str += "NM "; 326 break; 327 } 328 } 329 str += String.format("%1.0f", dist); 330 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45))); 304 Renderer.symbol(feature, Harbours.DistanceU); 305 } 306 if ((zoom >=15) && Util.hasAttribute(feature, Obj.DISMAR, Att.WTWDIS)) { 307 AttMap atts = feature.objs.get(Obj.DISMAR).get(0); 308 Double dist = (Double) atts.get(Att.WTWDIS).val; 309 String str = ""; 310 if (atts.containsKey(Att.HUNITS)) { 311 switch ((UniHLU) atts.get(Att.HUNITS).val) { 312 case HLU_METR: 313 str += "m "; 314 break; 315 case HLU_FEET: 316 str += "ft "; 317 break; 318 case HLU_HMTR: 319 str += "hm "; 320 break; 321 case HLU_KMTR: 322 str += "km "; 323 break; 324 case HLU_SMIL: 325 str += "M "; 326 break; 327 case HLU_NMIL: 328 str += "NM "; 329 break; 330 default: 331 break; 332 } 333 } 334 str += String.format("%1.0f", dist); 335 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45))); 331 336 } 332 337 } … … 336 341 switch (feature.type) { 337 342 case LITVES: 338 Renderer.symbol(feature, Buoys.Super, feature.type , null, null);343 Renderer.symbol(feature, Buoys.Super, Util.getScheme(feature, feature.type)); 339 344 break; 340 345 case LITFLT: 341 Renderer.symbol(feature, Buoys.Float, feature.type , null, null);346 Renderer.symbol(feature, Buoys.Float, Util.getScheme(feature, feature.type)); 342 347 break; 343 348 case BOYINB: 344 Renderer.symbol(feature, Buoys.Super, feature.type, null, null); 349 Renderer.symbol(feature, Buoys.Super, Util.getScheme(feature, feature.type)); 350 break; 351 default: 345 352 break; 346 353 } 347 354 if (feature.objs.get(Obj.TOPMAR) != null) 348 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR , null, Topmarks.Floats);355 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Util.getScheme(feature, Obj.TOPMAR), Topmarks.FloatDelta); 349 356 Signals.addSignals(feature); 350 357 } … … 359 366 360 367 private static void harbours(Feature feature) { 361 AttItemname = feature.atts.get(Att.OBJNAM);368 String name = Util.getName(feature); 362 369 switch (feature.type) { 363 370 case ACHBRT: 364 371 if (zoom >= 14) { 365 Renderer.symbol(feature, Harbours.Anchorage, n ull, new Scheme(Mline), null);366 Renderer.labelText(feature, name == null ? "" : (String) name.val, new Font("Arial", Font.PLAIN, 30), LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC));367 } 368 double radius = (Double) Renderer.getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS);372 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline)); 373 Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC)); 374 } 375 double radius = (Double)Util.getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS); 369 376 if (radius != 0) { 370 UniHLU units = (UniHLU) Renderer.getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS);377 UniHLU units = (UniHLU)Util.getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS); 371 378 Renderer.lineCircle (feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units); 372 379 } … … 375 382 if (zoom >= 12) { 376 383 if (feature.flag != Fflag.AREA) { 377 Renderer.symbol(feature, Harbours.Anchorage, n ull, new Scheme(Color.black), null);384 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Color.black)); 378 385 } else { 379 Renderer.symbol(feature, Harbours.Anchorage, n ull, new Scheme(Mline), null);386 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline)); 380 387 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Mline); 381 388 } 382 389 if ((zoom >= 15) && ((name) != null)) { 383 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 60), LabelStyle.NONE, Mline, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));384 } 385 ArrayList<StsSTS> sts = (ArrayList<StsSTS>) Renderer.getAttVal(feature, Obj.ACHARE, 0, Att.STATUS);390 Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 60), LabelStyle.NONE, Mline, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0))); 391 } 392 ArrayList<StsSTS> sts = (ArrayList<StsSTS>)Util.getAttVal(feature, Obj.ACHARE, 0, Att.STATUS); 386 393 if ((zoom >= 15) && (sts != null) && (sts.contains(StsSTS.STS_RESV))) { 387 394 Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), LabelStyle.NONE, Mline, null, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60))); 388 395 } 389 396 } 390 ArrayList<CatACH> cats = (ArrayList<CatACH>) Renderer.getAttVal(feature, Obj.ACHARE, 0, Att.CATACH);397 ArrayList<CatACH> cats = (ArrayList<CatACH>)Util.getAttVal(feature, Obj.ACHARE, 0, Att.CATACH); 391 398 int dy = (cats.size() - 1) * -30; 392 399 for (CatACH cat : cats) { … … 405 412 break; 406 413 case ACH_EXPL: 407 Renderer.symbol(feature, Harbours.Explosives, n ull, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));414 Renderer.symbol(feature, Harbours.Explosives, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 408 415 dy += 60; 409 416 break; 410 417 case ACH_QUAR: 411 Renderer.symbol(feature, Harbours.Hospital, n ull, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));418 Renderer.symbol(feature, Harbours.Hospital, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 412 419 dy += 60; 413 420 break; 414 421 case ACH_SEAP: 415 Renderer.symbol(feature, Areas.Seaplane, n ull, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));422 Renderer.symbol(feature, Areas.Seaplane, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy))); 416 423 dy += 60; 417 424 break; … … 421 428 case BERTHS: 422 429 if (zoom >= 14) { 423 Renderer.labelText(feature, name == null ? " " : (String) name.val, new Font("Arial", Font.PLAIN, 40), LabelStyle.RRCT, Mline, Color.white, null);430 Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), LabelStyle.RRCT, Mline, Color.white, null); 424 431 } 425 432 break; … … 427 434 if (zoom >= 16) { 428 435 ArrayList<Symbol> symbols = new ArrayList(); 429 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Renderer.getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN);436 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Util.getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN); 430 437 for (FncFNC fnc : fncs) { 431 438 symbols.add(Landmarks.Funcs.get(fnc)); 432 439 } 433 440 if (feature.objs.containsKey(Obj.SMCFAC)) { 434 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) Renderer.getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF);441 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) Util.getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF); 435 442 for (CatSCF scf : scfs) { 436 443 symbols.add(Facilities.Cats.get(scf)); … … 439 446 Renderer.cluster(feature, symbols); 440 447 } 448 break; 449 default: 441 450 break; 442 451 } … … 457 466 458 467 private static void landmarks(Feature feature) { 459 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) Renderer.getAttVal(feature, feature.type, 0, Att.CATLMK);468 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) Util.getAttVal(feature, feature.type, 0, Att.CATLMK); 460 469 Symbol catSym = Landmarks.Shapes.get(cats.get(0)); 461 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Renderer.getAttVal(feature, feature.type, 0, Att.FUNCTN);470 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Util.getAttVal(feature, feature.type, 0, Att.FUNCTN); 462 471 Symbol fncSym = Landmarks.Funcs.get(fncs.get(0)); 463 472 if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR)) … … 467 476 if (cats.get(0) == CatLMK.LMK_RADR) 468 477 fncSym = Landmarks.RadioTV; 469 Renderer.symbol(feature, catSym , null, null, null);470 Renderer.symbol(feature, fncSym , null, null, null);478 Renderer.symbol(feature, catSym); 479 Renderer.symbol(feature, fncSym); 471 480 /* if (!has_attribute("function") && !has_attribute("category") && has_object("light")) { 472 481 symbol("lighthouse"); … … 488 497 switch (feature.type) { 489 498 case LITMAJ: 490 Renderer.symbol(feature, Beacons.LightMajor , null, null, null);499 Renderer.symbol(feature, Beacons.LightMajor); 491 500 break; 492 501 case LITMIN: 493 502 case LIGHTS: 494 Renderer.symbol(feature, Beacons.LightMinor , null, null, null);503 Renderer.symbol(feature, Beacons.LightMinor); 495 504 break; 496 505 } … … 499 508 500 509 private static void locks(Feature feature) { 501 /*object_rules(locks) {502 if ((zoom>=13) && is_type("lock_basin|lock_basin_part")) symbol("lock");503 if ((zoom>=15) && is_type("gate")) symbol("lock_gate");504 }505 */506 510 } 507 511 private static void marinas(Feature feature) { … … 509 513 510 514 } 511 /* int n = countObjects(item, type);512 Atta_t atta = enumAttribute("category", obja);513 char **map = cluster_map(obja);514 if (map == NULL) return;515 switch (n) {516 case 0: {517 Obj_t *obj = getObj(item, obja, 0);518 int n = countValues(getAtt(obj, atta));519 switch (n) {520 case 1:521 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", CC, 0, 0, 0);522 break;523 case 2:524 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", RC, 0, 0, 0);525 renderSymbol(item, obja, map[getAttEnum(obj, atta, 1)], "", "", LC, 0, 0, 0);526 break;527 case 3:528 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", BC, 0, 0, 0);529 renderSymbol(item, obja, map[getAttEnum(obj, atta, 1)], "", "", TR, 0, 0, 0);530 renderSymbol(item, obja, map[getAttEnum(obj, atta, 2)], "", "", TL, 0, 0, 0);531 break;532 case 4:533 renderSymbol(item, obja, map[getAttEnum(obj, atta, 0)], "", "", BR, 0, 0, 0);534 renderSymbol(item, obja, map[getAttEnum(obj, atta, 1)], "", "", BL, 0, 0, 0);535 renderSymbol(item, obja, map[getAttEnum(obj, atta, 2)], "", "", TR, 0, 0, 0);536 renderSymbol(item, obja, map[getAttEnum(obj, atta, 3)], "", "", TL, 0, 0, 0);537 break;538 }539 }540 break;541 case 1:542 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", CC, 0, 0, 0);543 break;544 case 2:545 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", RC, 0, 0, 0);546 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 2), atta, 0)], "", "", LC, 0, 0, 0);547 break;548 case 3:549 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", BC, 0, 0, 0);550 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 2), atta, 0)], "", "", TR, 0, 0, 0);551 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 3), atta, 0)], "", "", TL, 0, 0, 0);552 break;553 case 4:554 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 1), atta, 0)], "", "", BR, 0, 0, 0);555 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 2), atta, 0)], "", "", BL, 0, 0, 0);556 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 3), atta, 0)], "", "", TR, 0, 0, 0);557 renderSymbol(item, obja, map[getAttEnum(getObj(item, obja, 4), atta, 0)], "", "", TL, 0, 0, 0);558 break;559 }560 */561 515 } 562 516 563 517 private static void moorings(Feature feature) { 564 CatMOR cat = (CatMOR) Renderer.getAttVal(feature, feature.type, 0, Att.CATMOR);518 CatMOR cat = (CatMOR) Util.getAttVal(feature, feature.type, 0, Att.CATMOR); 565 519 switch (cat) { 566 520 case MOR_DLPN: 567 Renderer.symbol(feature, Harbours.Dolphin , null, null, null);521 Renderer.symbol(feature, Harbours.Dolphin); 568 522 break; 569 523 case MOR_DDPN: 570 Renderer.symbol(feature, Harbours.DeviationDolphin , null, null, null);524 Renderer.symbol(feature, Harbours.DeviationDolphin); 571 525 break; 572 526 case MOR_BLRD: 573 527 case MOR_POST: 574 Renderer.symbol(feature, Harbours.Bollard , null, null, null);528 Renderer.symbol(feature, Harbours.Bollard); 575 529 break; 576 530 case MOR_BUOY: 577 BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP);531 BoySHP shape = (BoySHP) Util.getAttVal(feature, feature.type, 0, Att.BOYSHP); 578 532 if (shape == BoySHP.BOY_UNKN) 579 533 shape = BoySHP.BOY_SPHR; 580 Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type , null, null);534 Renderer.symbol(feature, Buoys.Shapes.get(shape), Util.getScheme(feature, feature.type)); 581 535 break; 582 536 } … … 802 756 private static void obstructions(Feature feature) { 803 757 if ((zoom >= 14) && (feature.type == Obj.UWTROC)) { 804 WatLEV lvl = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV);758 WatLEV lvl = (WatLEV) Util.getAttVal(feature, feature.type, 0, Att.WATLEV); 805 759 switch (lvl) { 806 760 case LEV_CVRS: 807 Renderer.symbol(feature, Areas.RockC , null, null, null);761 Renderer.symbol(feature, Areas.RockC); 808 762 break; 809 763 case LEV_AWSH: 810 Renderer.symbol(feature, Areas.RockA , null, null, null);764 Renderer.symbol(feature, Areas.RockA); 811 765 break; 812 766 default: 813 Renderer.symbol(feature, Areas.Rock , null, null, null);767 Renderer.symbol(feature, Areas.Rock); 814 768 } 815 769 } else { 816 Renderer.symbol(feature, Areas.Rock , null, null, null);770 Renderer.symbol(feature, Areas.Rock); 817 771 } 818 772 } … … 827 781 } 828 782 private static void platforms(Feature feature) { 829 ArrayList<CatOFP> cats = (ArrayList<CatOFP>) Renderer.getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP);783 ArrayList<CatOFP> cats = (ArrayList<CatOFP>)Util.getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP); 830 784 if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO) 831 Renderer.symbol(feature, Buoys.Storage , null, null, null);785 Renderer.symbol(feature, Buoys.Storage); 832 786 else 833 Renderer.symbol(feature, Landmarks.Platform , null, null, null);834 AttItemname = feature.atts.get(Att.OBJNAM);787 Renderer.symbol(feature, Landmarks.Platform); 788 String name = Util.getName(feature); 835 789 if ((zoom >= 15) && (name != null)) 836 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));790 Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50))); 837 791 /*object_rules(platforms) { 838 792 if (has_object("fog_signal")) object(fogs); … … 845 799 if (zoom >= 14) { 846 800 if (feature.type == Obj.CRANES) { 847 if ((CatCRN) Renderer.getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)848 Renderer.symbol(feature, Harbours.ContainerCrane , null, null, null);801 if ((CatCRN) Util.getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT) 802 Renderer.symbol(feature, Harbours.ContainerCrane); 849 803 else 850 Renderer.symbol(feature, Harbours.PortCrane , null, null, null);804 Renderer.symbol(feature, Harbours.PortCrane); 851 805 } else if (feature.type == Obj.HULKES) { 852 806 Renderer.lineVector(feature, new LineStyle(Color.black, 4, null, new Color(0xffe000))); 853 AttItemname = feature.atts.get(Att.OBJNAM);807 String name = Util.getName(feature); 854 808 if ((zoom >= 15) && (name != null)) 855 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), LabelStyle.NONE, Color.black, null, null);809 Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), LabelStyle.NONE, Color.black, null, null); 856 810 } 857 811 } … … 866 820 else 867 821 Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null)); 868 AttItemname = feature.atts.get(Att.OBJNAM);822 String name = Util.getName(feature); 869 823 if ((zoom >= 10) && (name != null)) 870 Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 150), LabelStyle.NONE, new Color(0x80c48080, true), null, null);824 Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 150), LabelStyle.NONE, new Color(0x80c48080, true), null, null); 871 825 break; 872 826 case TSELNE: … … 886 840 private static void shoreline(Feature feature) { 887 841 if (zoom >= 12) { 888 switch ((CatSLC) Renderer.getAttVal(feature, feature.type, 0, Att.CATSLC)) {842 switch ((CatSLC) Util.getAttVal(feature, feature.type, 0, Att.CATSLC)) { 889 843 case SLC_TWAL: 890 WatLEV lev = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV);844 WatLEV lev = (WatLEV) Util.getAttVal(feature, feature.type, 0, Att.WATLEV); 891 845 if (lev == WatLEV.LEV_CVRS) { 892 846 Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); … … 907 861 case SISTAT: 908 862 case SISTAW: 909 Renderer.symbol(feature, Harbours.SignalStation , null, null, null);863 Renderer.symbol(feature, Harbours.SignalStation); 910 864 String str = "SS"; 911 865 // Append (cat) to str … … 913 867 break; 914 868 case RDOSTA: 915 Renderer.symbol(feature, Harbours.SignalStation , null, null, null);916 Renderer.symbol(feature, Beacons.RadarStation , null, null, null);869 Renderer.symbol(feature, Harbours.SignalStation); 870 Renderer.symbol(feature, Beacons.RadarStation); 917 871 break; 918 872 case RADSTA: 919 Renderer.symbol(feature, Harbours.SignalStation , null, null, null);920 Renderer.symbol(feature, Beacons.RadarStation , null, null, null);873 Renderer.symbol(feature, Harbours.SignalStation); 874 Renderer.symbol(feature, Beacons.RadarStation); 921 875 break; 922 876 case PILBOP: 923 Renderer.symbol(feature, Harbours.Pilot , null, null, null);877 Renderer.symbol(feature, Harbours.Pilot); 924 878 break; 925 879 case CGUSTA: 926 Renderer.symbol(feature, Harbours.SignalStation , null, null, null);880 Renderer.symbol(feature, Harbours.SignalStation); 927 881 Renderer.labelText(feature, "CG", new Font("Arial", Font.PLAIN, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(30, 0))); 928 882 break; 929 883 case RSCSTA: 930 Renderer.symbol(feature, Harbours.Rescue , null, null, null);884 Renderer.symbol(feature, Harbours.Rescue); 931 885 break; 932 886 } … … 942 896 if (zoom >= 15) { 943 897 String str = ""; 944 AttItemname = feature.atts.get(Att.OBJNAM);945 if (name != null) str += (String)name.val+ " ";946 Double ort = (Double) Renderer.getAttVal(feature, feature.type, 0, Att.ORIENT);898 String name = Util.getName(feature); 899 if (name != null) str += name + " "; 900 Double ort = (Double) Util.getAttVal(feature, feature.type, 0, Att.ORIENT); 947 901 if (ort != null) str += ort.toString() + "\u0152"; 948 902 if (!str.isEmpty()) Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20); … … 950 904 } 951 905 private static void waterways(Feature feature) { 906 952 907 } 953 908 954 909 private static void wrecks(Feature feature) { 955 910 if (zoom >= 14) { 956 CatWRK cat = (CatWRK) Renderer.getAttVal(feature, feature.type, 0, Att.CATWRK);911 CatWRK cat = (CatWRK) Util.getAttVal(feature, feature.type, 0, Att.CATWRK); 957 912 switch (cat) { 958 913 case WRK_DNGR: 959 914 case WRK_MSTS: 960 Renderer.symbol(feature, Areas.WreckD , null, null, null);915 Renderer.symbol(feature, Areas.WreckD); 961 916 break; 962 917 case WRK_HULS: 963 Renderer.symbol(feature, Areas.WreckS , null, null, null);918 Renderer.symbol(feature, Areas.WreckS); 964 919 break; 965 920 default: 966 Renderer.symbol(feature, Areas.WreckND , null, null, null);921 Renderer.symbol(feature, Areas.WreckND); 967 922 } 968 923 }
Note:
See TracChangeset
for help on using the changeset viewer.