| 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.SeaMap.*; | 
|---|
| 22 | import symbols.*; | 
|---|
| 23 | import symbols.Symbols.*; | 
|---|
| 24 |  | 
|---|
| 25 | public 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 shoreline(Feature feature) { | 
|---|
| 104 | if (zoom >= 12) { | 
|---|
| 105 | switch ((CatSLC) Renderer.getAttVal(feature, feature.type, 0, Att.CATSLC)) { | 
|---|
| 106 | case SLC_TWAL: | 
|---|
| 107 | WatLEV lev = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV); | 
|---|
| 108 | if (lev == WatLEV.LEV_CVRS) { | 
|---|
| 109 | Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); | 
|---|
| 110 | if (zoom >= 15) | 
|---|
| 111 | Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), 0.5, 20); | 
|---|
| 112 | } else { | 
|---|
| 113 | Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null)); | 
|---|
| 114 | } | 
|---|
| 115 | if (zoom >= 15) | 
|---|
| 116 | Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), 0.5, -20); | 
|---|
| 117 | } | 
|---|
| 118 | } | 
|---|
| 119 | } | 
|---|
| 120 | private static void pipelines(Feature feature) { | 
|---|
| 121 | if (zoom >= 14) { | 
|---|
| 122 | if (feature.type == Obj.PIPSOL) { | 
|---|
| 123 | Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, 0); | 
|---|
| 124 | } else if (feature.type == Obj.PIPOHD) { | 
|---|
| 125 |  | 
|---|
| 126 | } | 
|---|
| 127 | } | 
|---|
| 128 | } | 
|---|
| 129 | private static void cables(Feature feature) { | 
|---|
| 130 | if (zoom >= 14) { | 
|---|
| 131 | if (feature.type == Obj.CBLSUB) { | 
|---|
| 132 | Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, 0); | 
|---|
| 133 | } else if (feature.type == Obj.CBLOHD) { | 
|---|
| 134 |  | 
|---|
| 135 | } | 
|---|
| 136 | } | 
|---|
| 137 | } | 
|---|
| 138 | private static void separation(Feature feature) { | 
|---|
| 139 | switch (feature.type) { | 
|---|
| 140 | case TSEZNE: | 
|---|
| 141 | case TSSCRS: | 
|---|
| 142 | case TSSRON: | 
|---|
| 143 | if (zoom <= 15) | 
|---|
| 144 | Renderer.lineVector(feature, new LineStyle(null, 0, null, new Color(0x80c480ff, true))); | 
|---|
| 145 | else | 
|---|
| 146 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c480ff, true), 20, null, null)); | 
|---|
| 147 | AttItem name = feature.atts.get(Att.OBJNAM); | 
|---|
| 148 | if ((zoom >= 10) && (name != null)) | 
|---|
| 149 | Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 150), new Color(0x80c480ff), null); | 
|---|
| 150 | break; | 
|---|
| 151 | case TSELNE: | 
|---|
| 152 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c480ff, true), 20, null, null)); | 
|---|
| 153 | break; | 
|---|
| 154 | case TSSLPT: | 
|---|
| 155 | Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, 0); | 
|---|
| 156 | break; | 
|---|
| 157 | case TSSBND: | 
|---|
| 158 | Renderer.lineVector(feature, new LineStyle(new Color(0x80c480ff, true), 20, new float[] { 40, 40 }, null)); | 
|---|
| 159 | break; | 
|---|
| 160 | } | 
|---|
| 161 | } | 
|---|
| 162 | private static void areas(Feature feature) { | 
|---|
| 163 | AttItem name = feature.atts.get(Att.OBJNAM); | 
|---|
| 164 | switch (feature.type) { | 
|---|
| 165 | case SPLARE: | 
|---|
| 166 | if (zoom >= 12) { | 
|---|
| 167 | Renderer.symbol(feature, Areas.Plane, Obj.SPLARE, null); | 
|---|
| 168 | Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, 10); | 
|---|
| 169 | } | 
|---|
| 170 | if ((zoom >= 15) && (name != null)) | 
|---|
| 171 | Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90))); | 
|---|
| 172 | break; | 
|---|
| 173 | case MARCUL: | 
|---|
| 174 | if (zoom >= 14) | 
|---|
| 175 | Renderer.symbol(feature, Areas.MarineFarm, Obj.MARCUL, null); | 
|---|
| 176 | if (zoom >= 16) | 
|---|
| 177 | Renderer.lineVector(feature, new LineStyle( Color.black, 4, new float[] { 10, 10 }, null)); | 
|---|
| 178 | break; | 
|---|
| 179 | case FAIRWY: | 
|---|
| 180 | if (feature.area > 2.0) { | 
|---|
| 181 | if (zoom < 16) | 
|---|
| 182 | Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 8, new float[] { 50, 50 }, new Color(0x40ffffff, true))); | 
|---|
| 183 | else | 
|---|
| 184 | Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 8, new float[] { 50, 50 }, null)); | 
|---|
| 185 | } else { | 
|---|
| 186 | if (zoom >= 14) | 
|---|
| 187 | Renderer.lineVector(feature, new LineStyle(new Color(0x40ffffff, true), 0, null, null)); | 
|---|
| 188 | } | 
|---|
| 189 | break; | 
|---|
| 190 | case DRGARE: | 
|---|
| 191 | if (zoom < 16) | 
|---|
| 192 | Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true))); | 
|---|
| 193 | else | 
|---|
| 194 | Renderer.lineVector(feature, new LineStyle(Color.black, 8, new float[] { 25, 25 }, null)); | 
|---|
| 195 | if ((zoom >= 12) && (name != null)) | 
|---|
| 196 | Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.PLAIN, 100), Color.black, null); | 
|---|
| 197 | break; | 
|---|
| 198 | case RESARE: | 
|---|
| 199 | if (zoom >= 12) { | 
|---|
| 200 | Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, 0); | 
|---|
| 201 | //                              if ((CatREA)Renderer.getAttVal(feature, feature.type, 0, Att.CATREA) == CatREA.REA_NWAK) | 
|---|
| 202 | //                                      Renderer.symbol(feature, Areas.NoWake, Obj.RESARE, null); | 
|---|
| 203 | } | 
|---|
| 204 | break; | 
|---|
| 205 | case OSPARE: | 
|---|
| 206 | if ((CatPRA)Renderer.getAttVal(feature, feature.type, 0, Att.CATPRA) == CatPRA.PRA_WFRM) { | 
|---|
| 207 | Renderer.symbol(feature, Areas.WindFarm, Obj.OSPARE, null); | 
|---|
| 208 | Renderer.lineVector(feature, new LineStyle(Color.black, 20, new float[] { 40, 40 }, null)); | 
|---|
| 209 | if ((zoom >= 15) && (name != null)) | 
|---|
| 210 | Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10))); | 
|---|
| 211 | } | 
|---|
| 212 | break; | 
|---|
| 213 | case SEAARE: | 
|---|
| 214 | switch ((CatSEA) Renderer.getAttVal(feature, feature.type, 0, Att.CATSEA)) { | 
|---|
| 215 | case SEA_RECH: | 
|---|
| 216 | break; | 
|---|
| 217 | case SEA_BAY: | 
|---|
| 218 | break; | 
|---|
| 219 | case SEA_SHOL: | 
|---|
| 220 | break; | 
|---|
| 221 | case SEA_GAT: | 
|---|
| 222 | case SEA_NRRW: | 
|---|
| 223 | break; | 
|---|
| 224 | } | 
|---|
| 225 | break; | 
|---|
| 226 | case SNDWAV: | 
|---|
| 227 | //        if (zoom>=12)) area("fill:url(#sandwaves)"); | 
|---|
| 228 | break; | 
|---|
| 229 | } | 
|---|
| 230 | /* | 
|---|
| 231 | if (is_type("sea_area")) { | 
|---|
| 232 | if (has_attribute("category")) { | 
|---|
| 233 | make_string(""); | 
|---|
| 234 | attribute_switch("category") | 
|---|
| 235 | attribute_case("reach") { if (zoom >= 10) add_string("font-family:Arial;font-weight:normal;font-style:italic;font-size:150;text-anchor:middle") } | 
|---|
| 236 | attribute_case("bay") { if (zoom >= 12) add_string("font-family:Arial;font-weight:normal;font-style:italic;font-size:150;text-anchor:middle") } | 
|---|
| 237 | attribute_case("shoal") { if (zoom >= 14) { | 
|---|
| 238 | if (is_area) { | 
|---|
| 239 | area("stroke:#c480ff;stroke-width:4;stroke-dasharray:25,25;fill:none"); | 
|---|
| 240 | 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); | 
|---|
| 241 | text("(Shoal)", "font-family:Arial;font-weight:normal;font-size:60;text-anchor:middle", 0, 0); | 
|---|
| 242 | } else if (is_line) { | 
|---|
| 243 | 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")); | 
|---|
| 244 | way_text("(Shoal)", "font-family:Arial;font-weight:normal;font-size:60;text-anchor:middle", 0.5, 0, line("stroke:none;fill:none")); | 
|---|
| 245 | } else { | 
|---|
| 246 | 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); | 
|---|
| 247 | text("(Shoal)", "font-family:Arial;font-weight:normal;font-size:60;text-anchor:middle", 0, 0); | 
|---|
| 248 | } | 
|---|
| 249 | } | 
|---|
| 250 | } | 
|---|
| 251 | attribute_case("gat|narrows") { if (zoom >= 12) add_string("font-family:Arial;font-weight:normal;font-style:italic;font-size:100;text-anchor:middle") } | 
|---|
| 252 | end_switch | 
|---|
| 253 | if ((strlen(string) > 0) && !attribute_test("category", "shoal")) { | 
|---|
| 254 | int ref = line("stroke:none;fill:none"); | 
|---|
| 255 | if (ref != 0) { | 
|---|
| 256 | if (has_item_attribute("name")) way_text(item_attribute("name"), string, 0.5, 0, ref); | 
|---|
| 257 | } else { | 
|---|
| 258 | if (has_item_attribute("name")) text(item_attribute("name"), string, 0, 0); | 
|---|
| 259 | } | 
|---|
| 260 | } | 
|---|
| 261 | free_string | 
|---|
| 262 | } | 
|---|
| 263 | } | 
|---|
| 264 | */ | 
|---|
| 265 | } | 
|---|
| 266 |  | 
|---|
| 267 | private static void obstructions(Feature feature) { | 
|---|
| 268 | if ((zoom >= 14) && (feature.type == Obj.UWTROC)) { | 
|---|
| 269 | WatLEV lvl = (WatLEV) Renderer.getAttVal(feature, feature.type, 0, Att.WATLEV); | 
|---|
| 270 | switch (lvl) { | 
|---|
| 271 | case LEV_CVRS: | 
|---|
| 272 | Renderer.symbol(feature, Areas.RockC, null, null); | 
|---|
| 273 | break; | 
|---|
| 274 | case LEV_AWSH: | 
|---|
| 275 | Renderer.symbol(feature, Areas.RockA, null, null); | 
|---|
| 276 | break; | 
|---|
| 277 | default: | 
|---|
| 278 | Renderer.symbol(feature, Areas.Rock, null, null); | 
|---|
| 279 | } | 
|---|
| 280 | } else { | 
|---|
| 281 | Renderer.symbol(feature, Areas.Rock, null, null); | 
|---|
| 282 | } | 
|---|
| 283 | } | 
|---|
| 284 | private static void waterways(Feature feature) { | 
|---|
| 285 | if ((zoom >= 14) && (feature.atts.get(Att.OBJNAM) != null)) { | 
|---|
| 286 | // lineText(item_attribute("name"), "font-family:Arial;font-weight:bold;font-size:80;text-anchor:middle", 0.5, 15, line("stroke:none;fill:none")); | 
|---|
| 287 | } | 
|---|
| 288 | } | 
|---|
| 289 | private static void transits(Feature feature) { | 
|---|
| 290 | } | 
|---|
| 291 | private static void harbours(Feature feature) { | 
|---|
| 292 | AttItem name = feature.atts.get(Att.OBJNAM); | 
|---|
| 293 | switch (feature.type) { | 
|---|
| 294 | case ACHARE: | 
|---|
| 295 | if (zoom >= 12) { | 
|---|
| 296 | Renderer.symbol(feature, Harbours.Anchorage, null, null); | 
|---|
| 297 | Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, 10); | 
|---|
| 298 | if ((zoom >= 15) && ((name) != null)) { | 
|---|
| 299 | Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), new Color(0x80c480ff), null); | 
|---|
| 300 | } | 
|---|
| 301 | } | 
|---|
| 302 | break; | 
|---|
| 303 | } | 
|---|
| 304 | } | 
|---|
| 305 | /* | 
|---|
| 306 | *   if ((zoom >= 12) && is_type("anchorage")) { | 
|---|
| 307 | symbol("anchorage"); | 
|---|
| 308 | if ((zoom >= 15) && (has_item_attribute("name"))) | 
|---|
| 309 | text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:middle", 0, -90); | 
|---|
| 310 | if ((zoom >= 12) && (is_area)) line_symbols("restricted_line", 0.5, "line_anchor", 10); | 
|---|
| 311 | } | 
|---|
| 312 | if ((zoom >= 16) && is_type("anchor_berth")) symbol("anchor_berth"); | 
|---|
| 313 | if ((zoom >= 12) && is_type("harbour")) { | 
|---|
| 314 | if (has_attribute("category")) { | 
|---|
| 315 | attribute_switch("category") | 
|---|
| 316 | attribute_case("marina|yacht") symbol("marina"); | 
|---|
| 317 | attribute_case("marina_no_facilities") symbol("marina_nf"); | 
|---|
| 318 | attribute_default symbol("harbour"); | 
|---|
| 319 | end_switch | 
|---|
| 320 | } else symbol("harbour"); | 
|---|
| 321 | if ((zoom >= 15) && (has_item_attribute("name"))) | 
|---|
| 322 | text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:middle", 0, -90); | 
|---|
| 323 | } | 
|---|
| 324 |  | 
|---|
| 325 | */ | 
|---|
| 326 | private static void locks(Feature feature) { | 
|---|
| 327 | } | 
|---|
| 328 | private static void distances(Feature feature) { | 
|---|
| 329 | } | 
|---|
| 330 | private static void ports(Feature feature) { | 
|---|
| 331 | } | 
|---|
| 332 | private static void landmarks(Feature feature) { | 
|---|
| 333 | ArrayList<CatLMK> cats = (ArrayList<CatLMK>) Renderer.getAttVal(feature, feature.type, 0, Att.CATLMK); | 
|---|
| 334 | Symbol catSym = Landmarks.Shapes.get(cats.get(0)); | 
|---|
| 335 | ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Renderer.getAttVal(feature, feature.type, 0, Att.FUNCTN); | 
|---|
| 336 | Symbol fncSym = Landmarks.Funcs.get(fncs.get(0)); | 
|---|
| 337 | if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR)) | 
|---|
| 338 | catSym = Landmarks.ChurchTower; | 
|---|
| 339 | if ((cats.get(0) == CatLMK.LMK_UNKN) && (fncs.get(0) == FncFNC.FNC_UNKN) && (feature.objs.get(Obj.LIGHTS) != null)) | 
|---|
| 340 | catSym = Beacons.LightMajor; | 
|---|
| 341 | if (cats.get(0) == CatLMK.LMK_RADR) | 
|---|
| 342 | fncSym = Landmarks.RadioTV; | 
|---|
| 343 | Renderer.symbol(feature, catSym, null, null); | 
|---|
| 344 | Renderer.symbol(feature, fncSym, null, null); | 
|---|
| 345 | } | 
|---|
| 346 | private static void moorings(Feature feature) { | 
|---|
| 347 | CatMOR cat = (CatMOR) Renderer.getAttVal(feature, feature.type, 0, Att.CATMOR); | 
|---|
| 348 | switch (cat) { | 
|---|
| 349 | case MOR_DLPN: | 
|---|
| 350 | Renderer.symbol(feature, Harbours.Dolphin, null, null); | 
|---|
| 351 | break; | 
|---|
| 352 | case MOR_DDPN: | 
|---|
| 353 | Renderer.symbol(feature, Harbours.DeviationDolphin, null, null); | 
|---|
| 354 | break; | 
|---|
| 355 | case MOR_BLRD: | 
|---|
| 356 | case MOR_POST: | 
|---|
| 357 | Renderer.symbol(feature, Harbours.Bollard, null, null); | 
|---|
| 358 | break; | 
|---|
| 359 | case MOR_BUOY: | 
|---|
| 360 | BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP); | 
|---|
| 361 | if (shape == BoySHP.BOY_UNKN) | 
|---|
| 362 | shape = BoySHP.BOY_SPHR; | 
|---|
| 363 | Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type, null); | 
|---|
| 364 | break; | 
|---|
| 365 | } | 
|---|
| 366 | } | 
|---|
| 367 | private static void notices(Feature feature) { | 
|---|
| 368 | } | 
|---|
| 369 | private static void marinas(Feature feature) { | 
|---|
| 370 | } | 
|---|
| 371 | private static void bridges(Feature feature) { | 
|---|
| 372 | } | 
|---|
| 373 | private static void wrecks(Feature feature) { | 
|---|
| 374 | if (zoom >= 14) { | 
|---|
| 375 | CatWRK cat = (CatWRK) Renderer.getAttVal(feature, feature.type, 0, Att.CATWRK); | 
|---|
| 376 | switch (cat) { | 
|---|
| 377 | case WRK_DNGR: | 
|---|
| 378 | case WRK_MSTS: | 
|---|
| 379 | Renderer.symbol(feature, Areas.WreckD, null, null); | 
|---|
| 380 | break; | 
|---|
| 381 | case WRK_HULS: | 
|---|
| 382 | Renderer.symbol(feature, Areas.WreckS, null, null); | 
|---|
| 383 | break; | 
|---|
| 384 | default: | 
|---|
| 385 | Renderer.symbol(feature, Areas.WreckND, null, null); | 
|---|
| 386 | } | 
|---|
| 387 | } else { | 
|---|
| 388 | Renderer.symbol(feature, Areas.WreckND, null, null); | 
|---|
| 389 | } | 
|---|
| 390 | } | 
|---|
| 391 | private static void gauges(Feature feature) { | 
|---|
| 392 | } | 
|---|
| 393 | private static void lights(Feature feature) { | 
|---|
| 394 | switch (feature.type) { | 
|---|
| 395 | case LITMAJ: | 
|---|
| 396 | Renderer.symbol(feature, Beacons.LightMajor, null, null); | 
|---|
| 397 | break; | 
|---|
| 398 | case LITMIN: | 
|---|
| 399 | case LIGHTS: | 
|---|
| 400 | Renderer.symbol(feature, Beacons.LightMinor, null, null); | 
|---|
| 401 | break; | 
|---|
| 402 | } | 
|---|
| 403 | } | 
|---|
| 404 | private static void signals(Feature feature) { | 
|---|
| 405 | switch (feature.type) { | 
|---|
| 406 | case SISTAT: | 
|---|
| 407 | case SISTAW: | 
|---|
| 408 | Renderer.symbol(feature, Harbours.SignalStation, null, null); | 
|---|
| 409 | break; | 
|---|
| 410 | case RDOSTA: | 
|---|
| 411 | Renderer.symbol(feature, Harbours.SignalStation, null, null); | 
|---|
| 412 | break; | 
|---|
| 413 | case RADSTA: | 
|---|
| 414 | Renderer.symbol(feature, Harbours.SignalStation, null, null); | 
|---|
| 415 | Renderer.symbol(feature, Beacons.RadarStation, null, null); | 
|---|
| 416 | break; | 
|---|
| 417 | case PILBOP: | 
|---|
| 418 | Renderer.symbol(feature, Harbours.Pilot, null, null); | 
|---|
| 419 | break; | 
|---|
| 420 | case CGUSTA: | 
|---|
| 421 | Renderer.symbol(feature, Harbours.SignalStation, null, null); | 
|---|
| 422 | break; | 
|---|
| 423 | case RSCSTA: | 
|---|
| 424 | Renderer.symbol(feature, Harbours.Rescue, null, null); | 
|---|
| 425 | break; | 
|---|
| 426 | } | 
|---|
| 427 | } | 
|---|
| 428 | private static void floats(Feature feature) { | 
|---|
| 429 | switch (feature.type) { | 
|---|
| 430 | case LITVES: | 
|---|
| 431 | Renderer.symbol(feature, Buoys.Super, feature.type, null); | 
|---|
| 432 | break; | 
|---|
| 433 | case LITFLT: | 
|---|
| 434 | Renderer.symbol(feature, Buoys.Float, feature.type, null); | 
|---|
| 435 | break; | 
|---|
| 436 | case BOYINB: | 
|---|
| 437 | Renderer.symbol(feature, Buoys.Storage, feature.type, null); | 
|---|
| 438 | break; | 
|---|
| 439 | } | 
|---|
| 440 | if (feature.objs.get(Obj.TOPMAR) != null) | 
|---|
| 441 | Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR, Topmarks.Floats); | 
|---|
| 442 | } | 
|---|
| 443 | private static void platforms(Feature feature) { | 
|---|
| 444 | Renderer.symbol(feature, Landmarks.Platform, null, null); | 
|---|
| 445 | } | 
|---|
| 446 | private static void buoys(Feature feature) { | 
|---|
| 447 | BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP); | 
|---|
| 448 | Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type, null); | 
|---|
| 449 | if (feature.objs.get(Obj.TOPMAR) != null) { | 
|---|
| 450 | Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR, Topmarks.Buoys.get(shape)); | 
|---|
| 451 | } | 
|---|
| 452 | } | 
|---|
| 453 | private static void beacons(Feature feature) { | 
|---|
| 454 | BcnSHP shape = (BcnSHP) Renderer.getAttVal(feature, feature.type, 0, Att.BCNSHP); | 
|---|
| 455 | if (((shape == BcnSHP.BCN_PRCH) || (shape == BcnSHP.BCN_WTHY)) && (feature.type == Obj.BCNLAT)) { | 
|---|
| 456 | CatLAM cat = (CatLAM) Renderer.getAttVal(feature, feature.type, 0, Att.CATLAM); | 
|---|
| 457 | switch (cat) { | 
|---|
| 458 | case LAM_PORT: | 
|---|
| 459 | if (shape == BcnSHP.BCN_PRCH) | 
|---|
| 460 | Renderer.symbol(feature, Beacons.PerchPort, null, null); | 
|---|
| 461 | else | 
|---|
| 462 | Renderer.symbol(feature, Beacons.WithyPort, null, null); | 
|---|
| 463 | break; | 
|---|
| 464 | case LAM_STBD: | 
|---|
| 465 | if (shape == BcnSHP.BCN_PRCH) | 
|---|
| 466 | Renderer.symbol(feature, Beacons.PerchStarboard, null, null); | 
|---|
| 467 | else | 
|---|
| 468 | Renderer.symbol(feature, Beacons.WithyStarboard, null, null); | 
|---|
| 469 | break; | 
|---|
| 470 | default: | 
|---|
| 471 | Renderer.symbol(feature, Beacons.Stake, feature.type, null); | 
|---|
| 472 | } | 
|---|
| 473 | } else { | 
|---|
| 474 | Renderer.symbol(feature, Beacons.Shapes.get(shape), feature.type, null); | 
|---|
| 475 | if (feature.objs.get(Obj.TOPMAR) != null) | 
|---|
| 476 | Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Obj.TOPMAR, Topmarks.Beacons); | 
|---|
| 477 | } | 
|---|
| 478 | } | 
|---|
| 479 | } | 
|---|