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