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