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