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