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