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