| 1 | /* Copyright 2014 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 render;
|
|---|
| 11 |
|
|---|
| 12 | import java.awt.Color;
|
|---|
| 13 | import java.awt.Font;
|
|---|
| 14 | import java.awt.geom.AffineTransform;
|
|---|
| 15 | import java.text.DecimalFormat;
|
|---|
| 16 | import java.util.ArrayList;
|
|---|
| 17 | import java.util.EnumMap;
|
|---|
| 18 | import java.util.HashMap;
|
|---|
| 19 |
|
|---|
| 20 | import s57.S57val;
|
|---|
| 21 | import s57.S57val.*;
|
|---|
| 22 | import s57.S57att.*;
|
|---|
| 23 | import s57.S57obj.*;
|
|---|
| 24 | import s57.S57map.*;
|
|---|
| 25 | import render.ChartContext.RuleSet;
|
|---|
| 26 | import render.Renderer.*;
|
|---|
| 27 | import symbols.*;
|
|---|
| 28 | import symbols.Symbols.*;
|
|---|
| 29 |
|
|---|
| 30 | public class Rules {
|
|---|
| 31 |
|
|---|
| 32 | static final DecimalFormat df = new DecimalFormat("#.#");
|
|---|
| 33 |
|
|---|
| 34 | static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class);
|
|---|
| 35 | static {
|
|---|
| 36 | bodyColours.put(ColCOL.COL_UNK, new Color(0, true));
|
|---|
| 37 | bodyColours.put(ColCOL.COL_WHT, new Color(0xffffff));
|
|---|
| 38 | bodyColours.put(ColCOL.COL_BLK, new Color(0x000000));
|
|---|
| 39 | bodyColours.put(ColCOL.COL_RED, new Color(0xd40000));
|
|---|
| 40 | bodyColours.put(ColCOL.COL_GRN, new Color(0x00d400));
|
|---|
| 41 | bodyColours.put(ColCOL.COL_BLU, Color.blue);
|
|---|
| 42 | bodyColours.put(ColCOL.COL_YEL, new Color(0xffd400));
|
|---|
| 43 | bodyColours.put(ColCOL.COL_GRY, Color.gray);
|
|---|
| 44 | bodyColours.put(ColCOL.COL_BRN, new Color(0x8b4513));
|
|---|
| 45 | bodyColours.put(ColCOL.COL_AMB, new Color(0xfbf00f));
|
|---|
| 46 | bodyColours.put(ColCOL.COL_VIO, new Color(0xee82ee));
|
|---|
| 47 | bodyColours.put(ColCOL.COL_ORG, Color.orange);
|
|---|
| 48 | bodyColours.put(ColCOL.COL_MAG, new Color(0xf000f0));
|
|---|
| 49 | bodyColours.put(ColCOL.COL_PNK, Color.pink);
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | static final EnumMap<ColPAT, Patt> pattMap = new EnumMap<ColPAT, Patt>(ColPAT.class);
|
|---|
| 53 | static {
|
|---|
| 54 | pattMap.put(ColPAT.PAT_UNKN, Patt.Z);
|
|---|
| 55 | pattMap.put(ColPAT.PAT_HORI, Patt.H);
|
|---|
| 56 | pattMap.put(ColPAT.PAT_VERT, Patt.V);
|
|---|
| 57 | pattMap.put(ColPAT.PAT_DIAG, Patt.D);
|
|---|
| 58 | pattMap.put(ColPAT.PAT_BRDR, Patt.B);
|
|---|
| 59 | pattMap.put(ColPAT.PAT_SQUR, Patt.S);
|
|---|
| 60 | pattMap.put(ColPAT.PAT_CROS, Patt.C);
|
|---|
| 61 | pattMap.put(ColPAT.PAT_SALT, Patt.X);
|
|---|
| 62 | pattMap.put(ColPAT.PAT_STRP, Patt.H);
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | static String getName() {
|
|---|
| 66 | AttVal<?> name = feature.atts.get(Att.OBJNAM);
|
|---|
| 67 | if (name == null) {
|
|---|
| 68 | AttMap atts = feature.objs.get(feature.type).get(0);
|
|---|
| 69 | if (atts != null) {
|
|---|
| 70 | name = atts.get(Att.OBJNAM);
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | return (name != null) ? (String)name.val: null;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | public static void addName(int z, Font font) {
|
|---|
| 77 | addName(z, font, Color.black, new Delta(Handle.CC, new AffineTransform()));
|
|---|
| 78 | }
|
|---|
| 79 | public static void addName(int z, Font font, Color colour) {
|
|---|
| 80 | addName(z, font, colour, new Delta(Handle.CC, new AffineTransform()));
|
|---|
| 81 | }
|
|---|
| 82 | public static void addName(int z, Font font, Delta delta) {
|
|---|
| 83 | addName(z, font, Color.black, delta);
|
|---|
| 84 | }
|
|---|
| 85 | public static void addName(int z, Font font, Color colour, Delta delta) {
|
|---|
| 86 | if (Renderer.zoom >= z) {
|
|---|
| 87 | String name = getName();
|
|---|
| 88 | if (name != null) {
|
|---|
| 89 | Renderer.labelText(name, font, colour, delta);
|
|---|
| 90 | }
|
|---|
| 91 | }
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | static AttMap getAtts(Obj obj, int idx) {
|
|---|
| 95 | HashMap<Integer, AttMap> objs = feature.objs.get(obj);
|
|---|
| 96 | if (objs == null)
|
|---|
| 97 | return null;
|
|---|
| 98 | else
|
|---|
| 99 | return objs.get(idx);
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | public static Object getAttVal(Obj obj, Att att) {
|
|---|
| 103 | AttMap atts;
|
|---|
| 104 | HashMap<Integer, AttMap> objs;
|
|---|
| 105 | AttVal<?> item;
|
|---|
| 106 | if ((objs = feature.objs.get(obj)) != null)
|
|---|
| 107 | atts = objs.get(0);
|
|---|
| 108 | else
|
|---|
| 109 | return null;
|
|---|
| 110 | if ((item = atts.get(att)) == null)
|
|---|
| 111 | return null;
|
|---|
| 112 | else
|
|---|
| 113 | return item.val;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | public static String getAttStr(Obj obj, Att att) {
|
|---|
| 117 | String str = (String)getAttVal(obj, att);
|
|---|
| 118 | if (str != null) {
|
|---|
| 119 | return str;
|
|---|
| 120 | }
|
|---|
| 121 | return "";
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | @SuppressWarnings("unchecked")
|
|---|
| 125 | public static Enum<?> getAttEnum(Obj obj, Att att) {
|
|---|
| 126 | ArrayList<?> list = (ArrayList<?>)getAttVal(obj, att);
|
|---|
| 127 | if (list != null) {
|
|---|
| 128 | return ((ArrayList<Enum<?>>)list).get(0);
|
|---|
| 129 | }
|
|---|
| 130 | return S57val.unknAtt(att);
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | @SuppressWarnings("unchecked")
|
|---|
| 134 | public static ArrayList<?> getAttList(Obj obj, Att att) {
|
|---|
| 135 | ArrayList<Enum<?>> list = (ArrayList<Enum<?>>)getAttVal(obj, att);
|
|---|
| 136 | if (list != null) {
|
|---|
| 137 | return list;
|
|---|
| 138 | }
|
|---|
| 139 | list = new ArrayList<>();
|
|---|
| 140 | list.add(S57val.unknAtt(att));
|
|---|
| 141 | return list;
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | @SuppressWarnings("unchecked")
|
|---|
| 145 | static Scheme getScheme(Obj obj) {
|
|---|
| 146 | ArrayList<Color> colours = new ArrayList<Color>();
|
|---|
| 147 | for (ColCOL col : (ArrayList<ColCOL>) getAttList(obj, Att.COLOUR)) {
|
|---|
| 148 | colours.add(bodyColours.get(col));
|
|---|
| 149 | }
|
|---|
| 150 | ArrayList<Patt> patterns = new ArrayList<Patt>();
|
|---|
| 151 | for (ColPAT pat : (ArrayList<ColPAT>) getAttList(obj, Att.COLPAT)) {
|
|---|
| 152 | patterns.add(pattMap.get(pat));
|
|---|
| 153 | }
|
|---|
| 154 | return new Scheme(patterns, colours);
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | static boolean hasAttribute(Obj obj, int idx, Att att) {
|
|---|
| 158 | AttMap atts;
|
|---|
| 159 | if ((atts = getAtts(obj, idx)) != null) {
|
|---|
| 160 | AttVal<?> item = atts.get(att);
|
|---|
| 161 | return item != null;
|
|---|
| 162 | }
|
|---|
| 163 | return false;
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | static boolean testAttribute(Obj obj, Att att, Object val) {
|
|---|
| 167 | AttMap atts;
|
|---|
| 168 | if ((atts = getAtts(obj, 0)) != null) {
|
|---|
| 169 | AttVal<?> item = atts.get(att);
|
|---|
| 170 | if (item != null) {
|
|---|
| 171 | switch (item.conv) {
|
|---|
| 172 | case S:
|
|---|
| 173 | case A:
|
|---|
| 174 | return ((String)item.val).equals(val);
|
|---|
| 175 | case E:
|
|---|
| 176 | case L:
|
|---|
| 177 | return ((ArrayList<?>)item.val).contains(val);
|
|---|
| 178 | case F:
|
|---|
| 179 | case I:
|
|---|
| 180 | return item.val == val;
|
|---|
| 181 | }
|
|---|
| 182 | }
|
|---|
| 183 | }
|
|---|
| 184 | return false;
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 | public static Feature feature;
|
|---|
| 188 | static ArrayList<Feature> objects;
|
|---|
| 189 |
|
|---|
| 190 | static boolean testObject(Obj obj) {
|
|---|
| 191 | return ((objects = Renderer.map.features.get(obj)) != null);
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | static boolean testFeature(Feature f) {
|
|---|
| 195 | return ((feature = f).reln == Rflag.MASTER);
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | public static void rules () {
|
|---|
| 199 | if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) {
|
|---|
| 200 | if (testObject(Obj.LNDARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 201 | if (testObject(Obj.BUAARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 202 | if (testObject(Obj.HRBFAC)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 203 | if (testObject(Obj.HRBBSN)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 204 | if (testObject(Obj.LOKBSN)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 205 | if (testObject(Obj.LKBSPT)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 206 | if (testObject(Obj.LAKARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 207 | if (testObject(Obj.RIVERS)) for (Feature f : objects) if (testFeature(f)) waterways();
|
|---|
| 208 | if (testObject(Obj.CANALS)) for (Feature f : objects) if (testFeature(f)) waterways();
|
|---|
| 209 | if (testObject(Obj.DEPARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 210 | if (testObject(Obj.COALNE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 211 | if (testObject(Obj.ROADWY)) for (Feature f : objects) if (testFeature(f)) highways();
|
|---|
| 212 | if (testObject(Obj.RAILWY)) for (Feature f : objects) if (testFeature(f)) highways();
|
|---|
| 213 | }
|
|---|
| 214 | if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline();
|
|---|
| 215 | if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.SEAMARK)) {
|
|---|
| 216 | if (testObject(Obj.PIPSOL)) for (Feature f : objects) if (testFeature(f)) pipelines();
|
|---|
| 217 | if (testObject(Obj.CBLSUB)) for (Feature f : objects) if (testFeature(f)) cables();
|
|---|
| 218 | if (testObject(Obj.PIPOHD)) for (Feature f : objects) if (testFeature(f)) pipelines();
|
|---|
| 219 | if (testObject(Obj.CBLOHD)) for (Feature f : objects) if (testFeature(f)) cables();
|
|---|
| 220 | if (testObject(Obj.TSEZNE)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 221 | if (testObject(Obj.TSSCRS)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 222 | if (testObject(Obj.TSSRON)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 223 | if (testObject(Obj.TSELNE)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 224 | if (testObject(Obj.TSSLPT)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 225 | if (testObject(Obj.TSSBND)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 226 | if (testObject(Obj.ISTZNE)) for (Feature f : objects) if (testFeature(f)) separation();
|
|---|
| 227 | if (testObject(Obj.SNDWAV)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 228 | if (testObject(Obj.OSPARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 229 | if (testObject(Obj.FAIRWY)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 230 | if (testObject(Obj.DRGARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 231 | if (testObject(Obj.RESARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 232 | if (testObject(Obj.PRCARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 233 | if (testObject(Obj.SPLARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 234 | if (testObject(Obj.SEAARE)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 235 | if (testObject(Obj.OBSTRN)) for (Feature f : objects) if (testFeature(f)) obstructions();
|
|---|
| 236 | if (testObject(Obj.UWTROC)) for (Feature f : objects) if (testFeature(f)) obstructions();
|
|---|
| 237 | if (testObject(Obj.MARCUL)) for (Feature f : objects) if (testFeature(f)) areas();
|
|---|
| 238 | if (testObject(Obj.RECTRC)) for (Feature f : objects) if (testFeature(f)) transits();
|
|---|
| 239 | if (testObject(Obj.NAVLNE)) for (Feature f : objects) if (testFeature(f)) transits();
|
|---|
| 240 | if (testObject(Obj.HRBFAC)) for (Feature f : objects) if (testFeature(f)) harbours();
|
|---|
| 241 | if (testObject(Obj.ACHARE)) for (Feature f : objects) if (testFeature(f)) harbours();
|
|---|
| 242 | if (testObject(Obj.ACHBRT)) for (Feature f : objects) if (testFeature(f)) harbours();
|
|---|
| 243 | if (testObject(Obj.BERTHS)) for (Feature f : objects) if (testFeature(f)) harbours();
|
|---|
| 244 | if (testObject(Obj.DISMAR)) for (Feature f : objects) if (testFeature(f)) distances();
|
|---|
| 245 | if (testObject(Obj.HULKES)) for (Feature f : objects) if (testFeature(f)) ports();
|
|---|
| 246 | if (testObject(Obj.CRANES)) for (Feature f : objects) if (testFeature(f)) ports();
|
|---|
| 247 | if (testObject(Obj.LNDMRK)) for (Feature f : objects) if (testFeature(f)) landmarks();
|
|---|
| 248 | if (testObject(Obj.BUISGL)) for (Feature f : objects) if (testFeature(f)) harbours();
|
|---|
| 249 | if (testObject(Obj.MORFAC)) for (Feature f : objects) if (testFeature(f)) moorings();
|
|---|
| 250 | if (testObject(Obj.NOTMRK)) for (Feature f : objects) if (testFeature(f)) notices();
|
|---|
| 251 | if (testObject(Obj.SMCFAC)) for (Feature f : objects) if (testFeature(f)) marinas();
|
|---|
| 252 | if (testObject(Obj.BRIDGE)) for (Feature f : objects) if (testFeature(f)) bridges();
|
|---|
| 253 | if (testObject(Obj.PILPNT)) for (Feature f : objects) if (testFeature(f)) lights();
|
|---|
| 254 | if (testObject(Obj.RDOCAL)) for (Feature f : objects) if (testFeature(f)) callpoint();
|
|---|
| 255 | if (testObject(Obj.LITMIN)) for (Feature f : objects) if (testFeature(f)) lights();
|
|---|
| 256 | if (testObject(Obj.LITMAJ)) for (Feature f : objects) if (testFeature(f)) lights();
|
|---|
| 257 | if (testObject(Obj.LIGHTS)) for (Feature f : objects) if (testFeature(f)) lights();
|
|---|
| 258 | if (testObject(Obj.SISTAT)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 259 | if (testObject(Obj.SISTAW)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 260 | if (testObject(Obj.CGUSTA)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 261 | if (testObject(Obj.RDOSTA)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 262 | if (testObject(Obj.RADRFL)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 263 | if (testObject(Obj.RADSTA)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 264 | if (testObject(Obj.RTPBCN)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 265 | if (testObject(Obj.RSCSTA)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 266 | if (testObject(Obj.PILBOP)) for (Feature f : objects) if (testFeature(f)) stations();
|
|---|
| 267 | if (testObject(Obj.WTWGAG)) for (Feature f : objects) if (testFeature(f)) gauges();
|
|---|
| 268 | if (testObject(Obj.OFSPLF)) for (Feature f : objects) if (testFeature(f)) platforms();
|
|---|
| 269 | if (testObject(Obj.WRECKS)) for (Feature f : objects) if (testFeature(f)) wrecks();
|
|---|
| 270 | if (testObject(Obj.LITVES)) for (Feature f : objects) if (testFeature(f)) floats();
|
|---|
| 271 | if (testObject(Obj.LITFLT)) for (Feature f : objects) if (testFeature(f)) floats();
|
|---|
| 272 | if (testObject(Obj.BOYINB)) for (Feature f : objects) if (testFeature(f)) floats();
|
|---|
| 273 | if (testObject(Obj.BOYLAT)) for (Feature f : objects) if (testFeature(f)) buoys();
|
|---|
| 274 | if (testObject(Obj.BOYCAR)) for (Feature f : objects) if (testFeature(f)) buoys();
|
|---|
| 275 | if (testObject(Obj.BOYISD)) for (Feature f : objects) if (testFeature(f)) buoys();
|
|---|
| 276 | if (testObject(Obj.BOYSAW)) for (Feature f : objects) if (testFeature(f)) buoys();
|
|---|
| 277 | if (testObject(Obj.BOYSPP)) for (Feature f : objects) if (testFeature(f)) buoys();
|
|---|
| 278 | if (testObject(Obj.BCNLAT)) for (Feature f : objects) if (testFeature(f)) beacons();
|
|---|
| 279 | if (testObject(Obj.BCNCAR)) for (Feature f : objects) if (testFeature(f)) beacons();
|
|---|
| 280 | if (testObject(Obj.BCNISD)) for (Feature f : objects) if (testFeature(f)) beacons();
|
|---|
| 281 | if (testObject(Obj.BCNSAW)) for (Feature f : objects) if (testFeature(f)) beacons();
|
|---|
| 282 | if (testObject(Obj.BCNSPP)) for (Feature f : objects) if (testFeature(f)) beacons();
|
|---|
| 283 | }
|
|---|
| 284 | }
|
|---|
| 285 |
|
|---|
| 286 | private static void areas() {
|
|---|
| 287 | String name = getName();
|
|---|
| 288 | switch (feature.type) {
|
|---|
| 289 | case BUAARE:
|
|---|
| 290 | Renderer.lineVector(new LineStyle(new Color(0x20000000, true)));
|
|---|
| 291 | break;
|
|---|
| 292 | case COALNE:
|
|---|
| 293 | if (Renderer.zoom >= 12)
|
|---|
| 294 | Renderer.lineVector(new LineStyle(Color.black, 10));
|
|---|
| 295 | break;
|
|---|
| 296 | case DEPARE:
|
|---|
| 297 | Double depmax = 0.0;
|
|---|
| 298 | if (((depmax = (Double) getAttVal(Obj.DEPARE, Att.DRVAL2)) != null) && (depmax <= 0.0)) {
|
|---|
| 299 | Renderer.lineVector(new LineStyle(Symbols.Gdries));
|
|---|
| 300 | }
|
|---|
| 301 | break;
|
|---|
| 302 | case LAKARE:
|
|---|
| 303 | if ((Renderer.zoom >= 12) || (feature.geom.area > 10.0))
|
|---|
| 304 | Renderer.lineVector(new LineStyle(Symbols.Bwater));
|
|---|
| 305 | break;
|
|---|
| 306 | case DRGARE:
|
|---|
| 307 | if (Renderer.zoom < 16)
|
|---|
| 308 | Renderer.lineVector(new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true)));
|
|---|
| 309 | else
|
|---|
| 310 | Renderer.lineVector(new LineStyle(Color.black, 8, new float[] { 25, 25 }));
|
|---|
| 311 | addName(12, new Font("Arial", Font.PLAIN, 100), new Delta(Handle.CC, new AffineTransform()));
|
|---|
| 312 | break;
|
|---|
| 313 | case FAIRWY:
|
|---|
| 314 | if (feature.geom.area > 2.0) {
|
|---|
| 315 | if (Renderer.zoom < 16)
|
|---|
| 316 | Renderer.lineVector(new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
|
|---|
| 317 | else
|
|---|
| 318 | Renderer.lineVector(new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 }));
|
|---|
| 319 | } else {
|
|---|
| 320 | if (Renderer.zoom >= 14)
|
|---|
| 321 | Renderer.lineVector(new LineStyle(new Color(0x40ffffff, true)));
|
|---|
| 322 | }
|
|---|
| 323 | break;
|
|---|
| 324 | case LKBSPT:
|
|---|
| 325 | case LOKBSN:
|
|---|
| 326 | case HRBBSN:
|
|---|
| 327 | if (Renderer.zoom >= 12) {
|
|---|
| 328 | Renderer.lineVector(new LineStyle(Color.black, 10, Symbols.Bwater));
|
|---|
| 329 | } else {
|
|---|
| 330 | Renderer.lineVector(new LineStyle(Symbols.Bwater));
|
|---|
| 331 | }
|
|---|
| 332 | break;
|
|---|
| 333 | case HRBFAC:
|
|---|
| 334 | if (feature.objs.get(Obj.HRBBSN) != null) {
|
|---|
| 335 | if (Renderer.zoom >= 12) {
|
|---|
| 336 | Renderer.lineVector(new LineStyle(Color.black, 10, Symbols.Bwater));
|
|---|
| 337 | } else {
|
|---|
| 338 | Renderer.lineVector(new LineStyle(Symbols.Bwater));
|
|---|
| 339 | }
|
|---|
| 340 | }
|
|---|
| 341 | break;
|
|---|
| 342 | case LNDARE:
|
|---|
| 343 | Renderer.lineVector(new LineStyle(Symbols.Yland));
|
|---|
| 344 | break;
|
|---|
| 345 | case MARCUL:
|
|---|
| 346 | if (Renderer.zoom >= 12) {
|
|---|
| 347 | if (Renderer.zoom >= 14) {
|
|---|
| 348 | Renderer.symbol(Areas.MarineFarm);
|
|---|
| 349 | }
|
|---|
| 350 | if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) {
|
|---|
| 351 | Renderer.lineVector(new LineStyle(Color.black, 4, new float[] { 10, 10 }));
|
|---|
| 352 | }
|
|---|
| 353 | }
|
|---|
| 354 | break;
|
|---|
| 355 | case OSPARE:
|
|---|
| 356 | if (testAttribute(feature.type, Att.CATPRA, CatPRA.PRA_WFRM)) {
|
|---|
| 357 | Renderer.symbol(Areas.WindFarm);
|
|---|
| 358 | Renderer.lineVector(new LineStyle(Color.black, 20, new float[] { 40, 40 }));
|
|---|
| 359 | addName(15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 10)));
|
|---|
| 360 | }
|
|---|
| 361 | break;
|
|---|
| 362 | case RESARE:
|
|---|
| 363 | case MIPARE:
|
|---|
| 364 | if (Renderer.zoom >= 12) {
|
|---|
| 365 | Renderer.lineSymbols(Areas.Restricted, 1.0, null, null, 0, Symbols.Mline);
|
|---|
| 366 | if (testAttribute(feature.type, Att.CATREA, CatREA.REA_NWAK)) {
|
|---|
| 367 | Renderer.symbol(Areas.NoWake);
|
|---|
| 368 | }
|
|---|
| 369 | }
|
|---|
| 370 | break;
|
|---|
| 371 | case PRCARE:
|
|---|
| 372 | if (Renderer.zoom >= 12) {
|
|---|
| 373 | Renderer.lineVector(new LineStyle(Symbols.Mline, 10, new float[] { 40, 40 }));
|
|---|
| 374 | }
|
|---|
| 375 | break;
|
|---|
| 376 | case SEAARE:
|
|---|
| 377 | switch ((CatSEA) getAttEnum(feature.type, Att.CATSEA)) {
|
|---|
| 378 | case SEA_RECH:
|
|---|
| 379 | if ((Renderer.zoom >= 10) && (name != null))
|
|---|
| 380 | if (feature.geom.prim == Pflag.LINE) {
|
|---|
| 381 | Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
|
|---|
| 382 | } else {
|
|---|
| 383 | Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
|---|
| 384 | }
|
|---|
| 385 | break;
|
|---|
| 386 | case SEA_BAY:
|
|---|
| 387 | if ((Renderer.zoom >= 12) && (name != null))
|
|---|
| 388 | if (feature.geom.prim == Pflag.LINE) {
|
|---|
| 389 | Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
|
|---|
| 390 | } else {
|
|---|
| 391 | Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
|---|
| 392 | }
|
|---|
| 393 | break;
|
|---|
| 394 | case SEA_SHOL:
|
|---|
| 395 | if (Renderer.zoom >= 14) {
|
|---|
| 396 | if (feature.geom.prim == Pflag.AREA) {
|
|---|
| 397 | Renderer.lineVector(new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 }));
|
|---|
| 398 | if (name != null) {
|
|---|
| 399 | Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
|---|
| 400 | Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
|
|---|
| 401 | }
|
|---|
| 402 | } else if (feature.geom.prim == Pflag.LINE) {
|
|---|
| 403 | if (name != null) {
|
|---|
| 404 | Renderer.lineText(name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40);
|
|---|
| 405 | Renderer.lineText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0);
|
|---|
| 406 | }
|
|---|
| 407 | } else {
|
|---|
| 408 | if (name != null) {
|
|---|
| 409 | Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
|
|---|
| 410 | Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
|
|---|
| 411 | }
|
|---|
| 412 | }
|
|---|
| 413 | }
|
|---|
| 414 | break;
|
|---|
| 415 | case SEA_GAT:
|
|---|
| 416 | case SEA_NRRW:
|
|---|
| 417 | addName(12, new Font("Arial", Font.PLAIN, 100));
|
|---|
| 418 | break;
|
|---|
| 419 | default:
|
|---|
| 420 | break;
|
|---|
| 421 | }
|
|---|
| 422 | break;
|
|---|
| 423 | case SNDWAV:
|
|---|
| 424 | if (Renderer.zoom >= 12) Renderer.fillPattern(Areas.Sandwaves);
|
|---|
| 425 | break;
|
|---|
| 426 | case SPLARE:
|
|---|
| 427 | if (Renderer.zoom >= 12) {
|
|---|
| 428 | Renderer.symbol(Areas.Plane, new Scheme(Symbols.Msymb));
|
|---|
| 429 | Renderer.lineSymbols(Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Symbols.Mline);
|
|---|
| 430 | }
|
|---|
| 431 | addName(15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
|
|---|
| 432 | break;
|
|---|
| 433 | default:
|
|---|
| 434 | break;
|
|---|
| 435 | }
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 | @SuppressWarnings("unchecked")
|
|---|
| 439 | private static void beacons() {
|
|---|
| 440 | if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BCNLAT) || (feature.type == Obj.BCNCAR)))) {
|
|---|
| 441 | BcnSHP shape = (BcnSHP)getAttEnum(feature.type, Att.BCNSHP);
|
|---|
| 442 | if (shape == BcnSHP.BCN_UNKN)
|
|---|
| 443 | shape = BcnSHP.BCN_PILE;
|
|---|
| 444 | if ((shape == BcnSHP.BCN_WTHY) && (feature.type == Obj.BCNLAT)) {
|
|---|
| 445 | switch ((CatLAM) getAttEnum(feature.type, Att.CATLAM)) {
|
|---|
| 446 | case LAM_PORT:
|
|---|
| 447 | Renderer.symbol(Beacons.WithyPort);
|
|---|
| 448 | break;
|
|---|
| 449 | case LAM_STBD:
|
|---|
| 450 | Renderer.symbol(Beacons.WithyStarboard);
|
|---|
| 451 | break;
|
|---|
| 452 | default:
|
|---|
| 453 | Renderer.symbol(Beacons.Stake, getScheme(feature.type));
|
|---|
| 454 | }
|
|---|
| 455 | } else if ((shape == BcnSHP.BCN_PRCH) && (feature.type == Obj.BCNLAT) && !(feature.objs.containsKey(Obj.TOPMAR))) {
|
|---|
| 456 | switch ((CatLAM) getAttEnum(feature.type, Att.CATLAM)) {
|
|---|
| 457 | case LAM_PORT:
|
|---|
| 458 | Renderer.symbol(Beacons.PerchPort);
|
|---|
| 459 | break;
|
|---|
| 460 | case LAM_STBD:
|
|---|
| 461 | Renderer.symbol(Beacons.PerchStarboard);
|
|---|
| 462 | break;
|
|---|
| 463 | default:
|
|---|
| 464 | Renderer.symbol(Beacons.Stake, getScheme(feature.type));
|
|---|
| 465 | }
|
|---|
| 466 | } else {
|
|---|
| 467 | Renderer.symbol(Beacons.Shapes.get(shape), getScheme(feature.type));
|
|---|
| 468 | if (feature.objs.containsKey(Obj.TOPMAR)) {
|
|---|
| 469 | AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
|
|---|
| 470 | if (topmap.containsKey(Att.TOPSHP)) {
|
|---|
| 471 | Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.BeaconDelta);
|
|---|
| 472 | }
|
|---|
| 473 | } else if (feature.objs.containsKey(Obj.DAYMAR)) {
|
|---|
| 474 | AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
|
|---|
| 475 | if (topmap.containsKey(Att.TOPSHP)) {
|
|---|
| 476 | Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.BeaconDelta);
|
|---|
| 477 | }
|
|---|
| 478 | }
|
|---|
| 479 | }
|
|---|
| 480 | addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
|
|---|
| 481 | Signals.addSignals();
|
|---|
| 482 | }
|
|---|
| 483 | }
|
|---|
| 484 |
|
|---|
| 485 | @SuppressWarnings("unchecked")
|
|---|
| 486 | private static void buoys() {
|
|---|
| 487 | if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BOYLAT) || (feature.type == Obj.BOYCAR)))) {
|
|---|
| 488 | BoySHP shape = (BoySHP) getAttEnum(feature.type, Att.BOYSHP);
|
|---|
| 489 | if (shape == BoySHP.BOY_UNKN) shape = BoySHP.BOY_PILR;
|
|---|
| 490 | Renderer.symbol(Buoys.Shapes.get(shape), getScheme(feature.type));
|
|---|
| 491 | if (feature.objs.containsKey(Obj.TOPMAR)) {
|
|---|
| 492 | AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
|
|---|
| 493 | if (topmap.containsKey(Att.TOPSHP)) {
|
|---|
| 494 | Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
|
|---|
| 495 | }
|
|---|
| 496 | } else if (feature.objs.containsKey(Obj.DAYMAR)) {
|
|---|
| 497 | AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
|
|---|
| 498 | if (topmap.containsKey(Att.TOPSHP)) {
|
|---|
| 499 | Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape));
|
|---|
| 500 | }
|
|---|
| 501 | }
|
|---|
| 502 | addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
|
|---|
| 503 | Signals.addSignals();
|
|---|
| 504 | }
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | private static void bridges() {
|
|---|
| 508 | if (Renderer.zoom >= 16) {
|
|---|
| 509 | double verclr, verccl, vercop, horclr;
|
|---|
| 510 | AttMap atts = feature.objs.get(Obj.BRIDGE).get(0);
|
|---|
| 511 | String vstr = "";
|
|---|
| 512 | String hstr = "";
|
|---|
| 513 | if (atts != null) {
|
|---|
| 514 | if (atts.containsKey(Att.HORCLR)) {
|
|---|
| 515 | horclr = (Double) atts.get(Att.HORCLR).val;
|
|---|
| 516 | hstr = String.valueOf(horclr);
|
|---|
| 517 | }
|
|---|
| 518 | if (atts.containsKey(Att.VERCLR)) {
|
|---|
| 519 | verclr = (Double) atts.get(Att.VERCLR).val;
|
|---|
| 520 | } else {
|
|---|
| 521 | verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
|
|---|
| 522 | }
|
|---|
| 523 | verccl = atts.containsKey(Att.VERCCL) ? (Double) atts.get(Att.VERCCL).val : 0;
|
|---|
| 524 | vercop = atts.containsKey(Att.VERCOP) ? (Double) atts.get(Att.VERCOP).val : 0;
|
|---|
| 525 | if (verclr > 0) {
|
|---|
| 526 | vstr += String.valueOf(verclr);
|
|---|
| 527 | } else if (verccl > 0) {
|
|---|
| 528 | if (vercop == 0) {
|
|---|
| 529 | vstr += String.valueOf(verccl) + "/-";
|
|---|
| 530 | } else {
|
|---|
| 531 | vstr += String.valueOf(verccl) + "/" + String.valueOf(vercop);
|
|---|
| 532 | }
|
|---|
| 533 | }
|
|---|
| 534 | if (hstr.isEmpty() && !vstr.isEmpty()) {
|
|---|
| 535 | Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC));
|
|---|
| 536 | } else if (!hstr.isEmpty() && !vstr.isEmpty()) {
|
|---|
| 537 | Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC));
|
|---|
| 538 | Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC));
|
|---|
| 539 | } else if (!hstr.isEmpty() && vstr.isEmpty()) {
|
|---|
| 540 | Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC));
|
|---|
| 541 | }
|
|---|
| 542 | }
|
|---|
| 543 | }
|
|---|
| 544 | }
|
|---|
| 545 |
|
|---|
| 546 | private static void cables() {
|
|---|
| 547 | if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
|
|---|
| 548 | if (feature.type == Obj.CBLSUB) {
|
|---|
| 549 | Renderer.lineSymbols(Areas.Cable, 0.0, null, null, 0, Symbols.Mline);
|
|---|
| 550 | } else if (feature.type == Obj.CBLOHD) {
|
|---|
| 551 | AttMap atts = feature.objs.get(Obj.CBLOHD).get(0);
|
|---|
| 552 | if ((atts != null) && (atts.containsKey(Att.CATCBL)) && (atts.get(Att.CATCBL).val == CatCBL.CBL_POWR)) {
|
|---|
| 553 | Renderer.lineSymbols(Areas.CableDash, 0, Areas.CableDot, Areas.CableFlash, 2, Color.black);
|
|---|
| 554 | } else {
|
|---|
| 555 | Renderer.lineSymbols(Areas.CableDash, 0, Areas.CableDot, null, 2, Color.black);
|
|---|
| 556 | }
|
|---|
| 557 | if (atts != null) {
|
|---|
| 558 | if (atts.containsKey(Att.VERCLR)) {
|
|---|
| 559 | Renderer.labelText(String.valueOf((Double) atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25)));
|
|---|
| 560 | } else if (atts.containsKey(Att.VERCSA)) {
|
|---|
| 561 | Renderer.labelText(String.valueOf((Double) atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25)));
|
|---|
| 562 | }
|
|---|
| 563 | }
|
|---|
| 564 | }
|
|---|
| 565 | }
|
|---|
| 566 | }
|
|---|
| 567 |
|
|---|
| 568 | private static void callpoint() {
|
|---|
| 569 | if (Renderer.zoom >= 14) {
|
|---|
| 570 | Symbol symb = Harbours.CallPoint2;
|
|---|
| 571 | TrfTRF trf = (TrfTRF) getAttEnum(feature.type, Att.TRAFIC);
|
|---|
| 572 | if (trf != TrfTRF.TRF_TWOW) {
|
|---|
| 573 | symb = Harbours.CallPoint1;
|
|---|
| 574 | }
|
|---|
| 575 | Double orient = 0.0;
|
|---|
| 576 | if ((orient = (Double) getAttVal(feature.type, Att.ORIENT)) == null) {
|
|---|
| 577 | orient = 0.0;
|
|---|
| 578 | }
|
|---|
| 579 | Renderer.symbol(symb, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(orient))));
|
|---|
| 580 | String chn;
|
|---|
| 581 | if (!(chn = getAttStr(feature.type, Att.COMCHA)).isEmpty()) {
|
|---|
| 582 | Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,50)));
|
|---|
| 583 | }
|
|---|
| 584 | }
|
|---|
| 585 | }
|
|---|
| 586 |
|
|---|
| 587 | private static void distances() {
|
|---|
| 588 | if (Renderer.zoom >= 14) {
|
|---|
| 589 | if (!testAttribute(Obj.DISMAR, Att.CATDIS, CatDIS.DIS_NONI)) {
|
|---|
| 590 | Renderer.symbol(Harbours.DistanceI);
|
|---|
| 591 | } else {
|
|---|
| 592 | Renderer.symbol(Harbours.DistanceU);
|
|---|
| 593 | }
|
|---|
| 594 | if (Renderer.zoom >= 15) {
|
|---|
| 595 | AttMap atts = getAtts(Obj.DISMAR, 0);
|
|---|
| 596 | if ((atts != null) && (atts.containsKey(Att.WTWDIS))) {
|
|---|
| 597 | Double dist = (Double) atts.get(Att.WTWDIS).val;
|
|---|
| 598 | String str = "";
|
|---|
| 599 | if (atts.containsKey(Att.HUNITS)) {
|
|---|
| 600 | switch ((UniHLU) atts.get(Att.HUNITS).val) {
|
|---|
| 601 | case HLU_METR:
|
|---|
| 602 | str += "m ";
|
|---|
| 603 | break;
|
|---|
| 604 | case HLU_FEET:
|
|---|
| 605 | str += "ft ";
|
|---|
| 606 | break;
|
|---|
| 607 | case HLU_HMTR:
|
|---|
| 608 | str += "hm ";
|
|---|
| 609 | break;
|
|---|
| 610 | case HLU_KMTR:
|
|---|
| 611 | str += "km ";
|
|---|
| 612 | break;
|
|---|
| 613 | case HLU_SMIL:
|
|---|
| 614 | str += "M ";
|
|---|
| 615 | break;
|
|---|
| 616 | case HLU_NMIL:
|
|---|
| 617 | str += "NM ";
|
|---|
| 618 | break;
|
|---|
| 619 | default:
|
|---|
| 620 | break;
|
|---|
| 621 | }
|
|---|
| 622 | }
|
|---|
| 623 | str += String.format("%1.0f", dist);
|
|---|
| 624 | Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45)));
|
|---|
| 625 | }
|
|---|
| 626 | }
|
|---|
| 627 | }
|
|---|
| 628 | }
|
|---|
| 629 |
|
|---|
| 630 | private static void floats() {
|
|---|
| 631 | if (Renderer.zoom >= 12) {
|
|---|
| 632 | switch (feature.type) {
|
|---|
| 633 | case LITVES:
|
|---|
| 634 | Renderer.symbol(Buoys.Super, getScheme(feature.type));
|
|---|
| 635 | break;
|
|---|
| 636 | case LITFLT:
|
|---|
| 637 | Renderer.symbol(Buoys.Float, getScheme(feature.type));
|
|---|
| 638 | break;
|
|---|
| 639 | case BOYINB:
|
|---|
| 640 | Renderer.symbol(Buoys.Super, getScheme(feature.type));
|
|---|
| 641 | break;
|
|---|
| 642 | default:
|
|---|
| 643 | break;
|
|---|
| 644 | }
|
|---|
| 645 | if (feature.objs.get(Obj.TOPMAR) != null)
|
|---|
| 646 | Renderer.symbol(Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(Obj.TOPMAR), Topmarks.FloatDelta);
|
|---|
| 647 | addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
|
|---|
| 648 | Signals.addSignals();
|
|---|
| 649 | }
|
|---|
| 650 | }
|
|---|
| 651 |
|
|---|
| 652 | private static void gauges() {
|
|---|
| 653 | if (Renderer.zoom >= 14) {
|
|---|
| 654 | Renderer.symbol(Harbours.TideGauge);
|
|---|
| 655 | addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
|
|---|
| 656 | Signals.addSignals();
|
|---|
| 657 | }
|
|---|
| 658 | }
|
|---|
| 659 |
|
|---|
| 660 | @SuppressWarnings("unchecked")
|
|---|
| 661 | private static void harbours() {
|
|---|
| 662 | String name = getName();
|
|---|
| 663 | switch (feature.type) {
|
|---|
| 664 | case ACHBRT:
|
|---|
| 665 | if (Renderer.zoom >= 14) {
|
|---|
| 666 | Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline));
|
|---|
| 667 | if (Renderer.zoom >= 15) {
|
|---|
| 668 | Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white, new Delta(Handle.BC));
|
|---|
| 669 | }
|
|---|
| 670 | }
|
|---|
| 671 | if (getAttVal(Obj.ACHBRT, Att.RADIUS) != null) {
|
|---|
| 672 | double radius;
|
|---|
| 673 | if ((radius = (Double) getAttVal(Obj.ACHBRT, Att.RADIUS)) != 0) {
|
|---|
| 674 | UniHLU units = (UniHLU) getAttEnum(Obj.ACHBRT, Att.HUNITS);
|
|---|
| 675 | if (units == UniHLU.HLU_UNKN) {
|
|---|
| 676 | units = UniHLU.HLU_METR;
|
|---|
| 677 | }
|
|---|
| 678 | Renderer.lineCircle(new LineStyle(Symbols.Mline, 4, new float[] { 10, 10 }, null), radius, units);
|
|---|
| 679 | }
|
|---|
| 680 | }
|
|---|
| 681 | break;
|
|---|
| 682 | case ACHARE:
|
|---|
| 683 | if (Renderer.zoom >= 12) {
|
|---|
| 684 | if (feature.geom.prim != Pflag.AREA) {
|
|---|
| 685 | Renderer.symbol(Harbours.Anchorage, new Scheme(Color.black));
|
|---|
| 686 | } else {
|
|---|
| 687 | Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline));
|
|---|
| 688 | Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Symbols.Mline);
|
|---|
| 689 | }
|
|---|
| 690 | addName(15, new Font("Arial", Font.BOLD, 60), Symbols.Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
|
|---|
| 691 | ArrayList<StsSTS> sts = (ArrayList<StsSTS>) getAttList(Obj.ACHARE, Att.STATUS);
|
|---|
| 692 | if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) {
|
|---|
| 693 | Renderer.labelText("Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
|
|---|
| 694 | }
|
|---|
| 695 | ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(Obj.ACHARE, Att.CATACH);
|
|---|
| 696 | int dy = (cats.size() - 1) * -30;
|
|---|
| 697 | for (CatACH cat : cats) {
|
|---|
| 698 | switch (cat) {
|
|---|
| 699 | case ACH_DEEP:
|
|---|
| 700 | Renderer.labelText("DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
|---|
| 701 | dy += 60;
|
|---|
| 702 | break;
|
|---|
| 703 | case ACH_TANK:
|
|---|
| 704 | Renderer.labelText("Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
|---|
| 705 | dy += 60;
|
|---|
| 706 | break;
|
|---|
| 707 | case ACH_H24P:
|
|---|
| 708 | Renderer.labelText("24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
|---|
| 709 | dy += 60;
|
|---|
| 710 | break;
|
|---|
| 711 | case ACH_EXPL:
|
|---|
| 712 | Renderer.symbol(Harbours.Explosives, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
|---|
| 713 | dy += 60;
|
|---|
| 714 | break;
|
|---|
| 715 | case ACH_QUAR:
|
|---|
| 716 | Renderer.symbol(Harbours.Hospital, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
|---|
| 717 | dy += 60;
|
|---|
| 718 | break;
|
|---|
| 719 | case ACH_SEAP:
|
|---|
| 720 | Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
|
|---|
| 721 | dy += 60;
|
|---|
| 722 | break;
|
|---|
| 723 | default:
|
|---|
| 724 | }
|
|---|
| 725 | }
|
|---|
| 726 | }
|
|---|
| 727 | break;
|
|---|
| 728 | case BERTHS:
|
|---|
| 729 | if (Renderer.zoom >= 14) {
|
|---|
| 730 | Renderer.lineVector(new LineStyle(Symbols.Mline, 6, new float[] { 20, 20 }));
|
|---|
| 731 | Renderer.labelText(name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white);
|
|---|
| 732 | }
|
|---|
| 733 | break;
|
|---|
| 734 | case BUISGL:
|
|---|
| 735 | if (Renderer.zoom >= 16) {
|
|---|
| 736 | ArrayList<Symbol> symbols = new ArrayList<Symbol>();
|
|---|
| 737 | ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(Obj.BUISGL, Att.FUNCTN);
|
|---|
| 738 | for (FncFNC fnc : fncs) {
|
|---|
| 739 | symbols.add(Landmarks.Funcs.get(fnc));
|
|---|
| 740 | }
|
|---|
| 741 | if (feature.objs.containsKey(Obj.SMCFAC)) {
|
|---|
| 742 | ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(Obj.SMCFAC, Att.CATSCF);
|
|---|
| 743 | for (CatSCF scf : scfs) {
|
|---|
| 744 | symbols.add(Facilities.Cats.get(scf));
|
|---|
| 745 | }
|
|---|
| 746 | }
|
|---|
| 747 | Renderer.cluster(symbols);
|
|---|
| 748 | }
|
|---|
| 749 | break;
|
|---|
| 750 | case HRBFAC:
|
|---|
| 751 | if (Renderer.zoom >= 12) {
|
|---|
| 752 | ArrayList<CatHAF> cathaf = (ArrayList<CatHAF>) getAttList(Obj.HRBFAC, Att.CATHAF);
|
|---|
| 753 | if (cathaf.size() == 1) {
|
|---|
| 754 | switch (cathaf.get(0)) {
|
|---|
| 755 | case HAF_MRNA:
|
|---|
| 756 | Renderer.symbol(Harbours.Marina);
|
|---|
| 757 | break;
|
|---|
| 758 | case HAF_MANF:
|
|---|
| 759 | Renderer.symbol(Harbours.MarinaNF);
|
|---|
| 760 | break;
|
|---|
| 761 | case HAF_FISH:
|
|---|
| 762 | Renderer.symbol(Harbours.Fishing);
|
|---|
| 763 | break;
|
|---|
| 764 | default:
|
|---|
| 765 | Renderer.symbol(Harbours.Harbour);
|
|---|
| 766 | break;
|
|---|
| 767 | }
|
|---|
| 768 | } else {
|
|---|
| 769 | Renderer.symbol(Harbours.Harbour);
|
|---|
| 770 | }
|
|---|
| 771 | }
|
|---|
| 772 | break;
|
|---|
| 773 | default:
|
|---|
| 774 | break;
|
|---|
| 775 | }
|
|---|
| 776 | }
|
|---|
| 777 |
|
|---|
| 778 | @SuppressWarnings("unchecked")
|
|---|
| 779 | private static void highways() {
|
|---|
| 780 | switch (feature.type) {
|
|---|
| 781 | case ROADWY:
|
|---|
| 782 | ArrayList<CatROD> cat = (ArrayList<CatROD>) (getAttList(Obj.ROADWY, Att.CATROD));
|
|---|
| 783 | if (cat.size() > 0) {
|
|---|
| 784 | switch (cat.get(0)) {
|
|---|
| 785 | case ROD_MWAY:
|
|---|
| 786 | Renderer.lineVector(new LineStyle(Color.black, 20));
|
|---|
| 787 | break;
|
|---|
| 788 | case ROD_MAJR:
|
|---|
| 789 | Renderer.lineVector(new LineStyle(Color.black, 15));
|
|---|
| 790 | break;
|
|---|
| 791 | case ROD_MINR:
|
|---|
| 792 | Renderer.lineVector(new LineStyle(Color.black, 10));
|
|---|
| 793 | break;
|
|---|
| 794 | default:
|
|---|
| 795 | Renderer.lineVector(new LineStyle(Color.black, 5));
|
|---|
| 796 | }
|
|---|
| 797 | } else {
|
|---|
| 798 | Renderer.lineVector(new LineStyle(Color.black, 5));
|
|---|
| 799 | }
|
|---|
| 800 | break;
|
|---|
| 801 | case RAILWY:
|
|---|
| 802 | Renderer.lineVector(new LineStyle(Color.gray, 10));
|
|---|
| 803 | Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 30, 30 }));
|
|---|
| 804 | break;
|
|---|
| 805 | default:
|
|---|
| 806 | }
|
|---|
| 807 | }
|
|---|
| 808 |
|
|---|
| 809 | @SuppressWarnings("unchecked")
|
|---|
| 810 | private static void landmarks() {
|
|---|
| 811 | if (Renderer.zoom >= 12) {
|
|---|
| 812 | ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttList(feature.type, Att.CATLMK);
|
|---|
| 813 | Symbol catSym = Landmarks.Shapes.get(cats.get(0));
|
|---|
| 814 | ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(feature.type, Att.FUNCTN);
|
|---|
| 815 | Symbol fncSym = Landmarks.Funcs.get(fncs.get(0));
|
|---|
| 816 | if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR))
|
|---|
| 817 | catSym = Landmarks.ChurchTower;
|
|---|
| 818 | if ((cats.get(0) == CatLMK.LMK_UNKN) && (fncs.get(0) == FncFNC.FNC_UNKN) && (feature.objs.get(Obj.LIGHTS) != null))
|
|---|
| 819 | catSym = Beacons.LightMajor;
|
|---|
| 820 | if (cats.get(0) == CatLMK.LMK_RADR)
|
|---|
| 821 | fncSym = Landmarks.RadioTV;
|
|---|
| 822 | Renderer.symbol(catSym);
|
|---|
| 823 | Renderer.symbol(fncSym);
|
|---|
| 824 | if (Renderer.zoom >= 15)
|
|---|
| 825 | addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
|
|---|
| 826 | Signals.addSignals();
|
|---|
| 827 | }
|
|---|
| 828 | }
|
|---|
| 829 |
|
|---|
| 830 | @SuppressWarnings("unchecked")
|
|---|
| 831 | private static void lights() {
|
|---|
| 832 | switch (feature.type) {
|
|---|
| 833 | case LITMAJ:
|
|---|
| 834 | Renderer.symbol(Beacons.LightMajor);
|
|---|
| 835 | break;
|
|---|
| 836 | case LITMIN:
|
|---|
| 837 | case LIGHTS:
|
|---|
| 838 | Renderer.symbol(Beacons.LightMinor);
|
|---|
| 839 | break;
|
|---|
| 840 | case PILPNT:
|
|---|
| 841 | if (feature.objs.containsKey(Obj.LIGHTS))
|
|---|
| 842 | Renderer.symbol(Beacons.LightMinor);
|
|---|
| 843 | else
|
|---|
| 844 | Renderer.symbol(Harbours.Post);
|
|---|
| 845 | break;
|
|---|
| 846 | default:
|
|---|
| 847 | break;
|
|---|
| 848 | }
|
|---|
| 849 | if (feature.objs.containsKey(Obj.TOPMAR)) {
|
|---|
| 850 | AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
|
|---|
| 851 | if (topmap.containsKey(Att.TOPSHP)) {
|
|---|
| 852 | Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.LightDelta);
|
|---|
| 853 | }
|
|---|
| 854 | } else if (feature.objs.containsKey(Obj.DAYMAR)) {
|
|---|
| 855 | AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
|
|---|
| 856 | if (topmap.containsKey(Att.TOPSHP)) {
|
|---|
| 857 | Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.LightDelta);
|
|---|
| 858 | }
|
|---|
| 859 | }
|
|---|
| 860 | Signals.addSignals();
|
|---|
| 861 | }
|
|---|
| 862 |
|
|---|
| 863 | @SuppressWarnings("unchecked")
|
|---|
| 864 | private static void marinas() {
|
|---|
| 865 | if (Renderer.zoom >= 16) {
|
|---|
| 866 | ArrayList<Symbol> symbols = new ArrayList<Symbol>();
|
|---|
| 867 | ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(Obj.SMCFAC, Att.CATSCF);
|
|---|
| 868 | for (CatSCF scf : scfs) {
|
|---|
| 869 | symbols.add(Facilities.Cats.get(scf));
|
|---|
| 870 | }
|
|---|
| 871 | Renderer.cluster(symbols);
|
|---|
| 872 | }
|
|---|
| 873 | }
|
|---|
| 874 |
|
|---|
| 875 | private static void moorings() {
|
|---|
| 876 | if (Renderer.zoom >= 14) {
|
|---|
| 877 | switch ((CatMOR) getAttEnum(feature.type, Att.CATMOR)) {
|
|---|
| 878 | case MOR_DLPN:
|
|---|
| 879 | Renderer.symbol(Harbours.Dolphin);
|
|---|
| 880 | break;
|
|---|
| 881 | case MOR_DDPN:
|
|---|
| 882 | Renderer.symbol(Harbours.DeviationDolphin);
|
|---|
| 883 | break;
|
|---|
| 884 | case MOR_BLRD:
|
|---|
| 885 | case MOR_POST:
|
|---|
| 886 | Renderer.symbol(Harbours.Bollard);
|
|---|
| 887 | break;
|
|---|
| 888 | case MOR_BUOY:
|
|---|
| 889 | BoySHP shape = (BoySHP) getAttEnum(feature.type, Att.BOYSHP);
|
|---|
| 890 | if (shape == BoySHP.BOY_UNKN) {
|
|---|
| 891 | shape = BoySHP.BOY_SPHR;
|
|---|
| 892 | }
|
|---|
| 893 | Renderer.symbol(Buoys.Shapes.get(shape), getScheme(feature.type));
|
|---|
| 894 | Renderer.symbol(Topmarks.TopMooring, Topmarks.BuoyDeltas.get(shape));
|
|---|
| 895 | break;
|
|---|
| 896 | default:
|
|---|
| 897 | break;
|
|---|
| 898 | }
|
|---|
| 899 | Signals.addSignals();
|
|---|
| 900 | }
|
|---|
| 901 | }
|
|---|
| 902 |
|
|---|
| 903 | private static void notices() {
|
|---|
| 904 | if (Renderer.zoom >= 14) {
|
|---|
| 905 | double dx = 0.0, dy = 0.0;
|
|---|
| 906 | switch (feature.type) {
|
|---|
| 907 | case BCNCAR:
|
|---|
| 908 | case BCNISD:
|
|---|
| 909 | case BCNLAT:
|
|---|
| 910 | case BCNSAW:
|
|---|
| 911 | case BCNSPP:
|
|---|
| 912 | dy = 45.0;
|
|---|
| 913 | break;
|
|---|
| 914 | case NOTMRK:
|
|---|
| 915 | dy = 0.0;
|
|---|
| 916 | break;
|
|---|
| 917 | default:
|
|---|
| 918 | return;
|
|---|
| 919 | }
|
|---|
| 920 | MarSYS sys = MarSYS.SYS_CEVN;
|
|---|
| 921 | // BnkWTW bnk = BnkWTW.BWW_UNKN;
|
|---|
| 922 | AttVal<?> att = feature.atts.get(Att.MARSYS);
|
|---|
| 923 | if (att != null) sys = (MarSYS)att.val;
|
|---|
| 924 | ObjTab objs = feature.objs.get(Obj.NOTMRK);
|
|---|
| 925 | int n = objs.size();
|
|---|
| 926 | if (n > 5) {
|
|---|
| 927 | Renderer.symbol(Notices.Notice, new Delta(Handle.CC, AffineTransform.getTranslateInstance(dx, dy)));
|
|---|
| 928 | } else {
|
|---|
| 929 | int i = 0;
|
|---|
| 930 | for (AttMap atts : objs.values()) {
|
|---|
| 931 | if (atts.get(Att.MARSYS) != null) sys = (MarSYS)(atts.get(Att.MARSYS).val);
|
|---|
| 932 | CatNMK cat = CatNMK.NMK_UNKN;
|
|---|
| 933 | if (atts.get(Att.CATNMK) != null) cat = (CatNMK)(atts.get(Att.CATNMK).val);
|
|---|
| 934 | Symbol sym = Notices.getNotice(cat, sys);
|
|---|
| 935 | Handle h = Handle.CC;
|
|---|
| 936 | switch (i) {
|
|---|
| 937 | case 0:
|
|---|
| 938 | if (n != 1) h = null;
|
|---|
| 939 | break;
|
|---|
| 940 | case 1:
|
|---|
| 941 | if (n <= 3)
|
|---|
| 942 | h = Handle.RC;
|
|---|
| 943 | else
|
|---|
| 944 | h = Handle.BR;
|
|---|
| 945 | break;
|
|---|
| 946 | case 2:
|
|---|
| 947 | if (n <= 3)
|
|---|
| 948 | h = Handle.LC;
|
|---|
| 949 | else
|
|---|
| 950 | h = Handle.BL;
|
|---|
| 951 | break;
|
|---|
| 952 | case 3:
|
|---|
| 953 | if (n == 4)
|
|---|
| 954 | h = Handle.TC;
|
|---|
| 955 | else
|
|---|
| 956 | h = Handle.TR;
|
|---|
| 957 | break;
|
|---|
| 958 | case 4:
|
|---|
| 959 | h = Handle.TL;
|
|---|
| 960 | break;
|
|---|
| 961 | }
|
|---|
| 962 | if (h != null) Renderer.symbol(sym, new Delta(h, AffineTransform.getTranslateInstance(dx, dy)));
|
|---|
| 963 | i++;
|
|---|
| 964 | }
|
|---|
| 965 | }
|
|---|
| 966 | }
|
|---|
| 967 | }
|
|---|
| 968 |
|
|---|
| 969 | private static void obstructions() {
|
|---|
| 970 | if ((Renderer.zoom >= 12) && (feature.type == Obj.OBSTRN)) {
|
|---|
| 971 | switch ((CatOBS) getAttEnum(feature.type, Att.CATOBS)) {
|
|---|
| 972 | case OBS_BOOM:
|
|---|
| 973 | Renderer.lineVector(new LineStyle(Color.black, 5, new float[] { 20, 20 }, null));
|
|---|
| 974 | if (Renderer.zoom >= 15) {
|
|---|
| 975 | Renderer.lineText("Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
|
|---|
| 976 | }
|
|---|
| 977 | default:
|
|---|
| 978 | break;
|
|---|
| 979 | }
|
|---|
| 980 | }
|
|---|
| 981 | if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) {
|
|---|
| 982 | switch ((WatLEV) getAttEnum(feature.type, Att.WATLEV)) {
|
|---|
| 983 | case LEV_CVRS:
|
|---|
| 984 | Renderer.symbol(Areas.RockC);
|
|---|
| 985 | break;
|
|---|
| 986 | case LEV_AWSH:
|
|---|
| 987 | Renderer.symbol(Areas.RockA);
|
|---|
| 988 | break;
|
|---|
| 989 | default:
|
|---|
| 990 | Renderer.symbol(Areas.Rock);
|
|---|
| 991 | }
|
|---|
| 992 | } else {
|
|---|
| 993 | Renderer.symbol(Areas.Rock);
|
|---|
| 994 | }
|
|---|
| 995 | }
|
|---|
| 996 |
|
|---|
| 997 | private static void pipelines() {
|
|---|
| 998 | if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
|
|---|
| 999 | if (feature.type == Obj.PIPSOL) {
|
|---|
| 1000 | Renderer.lineSymbols(Areas.Pipeline, 1.0, null, null, 0, Symbols.Mline);
|
|---|
| 1001 | } else if (feature.type == Obj.PIPOHD) {
|
|---|
| 1002 | Renderer.lineVector(new LineStyle(Color.black, 8));
|
|---|
| 1003 | AttMap atts = feature.atts;
|
|---|
| 1004 | double verclr = 0;
|
|---|
| 1005 | if (atts != null) {
|
|---|
| 1006 | if (atts.containsKey(Att.VERCLR)) {
|
|---|
| 1007 | verclr = (Double) atts.get(Att.VERCLR).val;
|
|---|
| 1008 | } else {
|
|---|
| 1009 | verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
|
|---|
| 1010 | }
|
|---|
| 1011 | if (verclr > 0) {
|
|---|
| 1012 | Renderer.labelText(String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,25)));
|
|---|
| 1013 | }
|
|---|
| 1014 | }
|
|---|
| 1015 | }
|
|---|
| 1016 | }
|
|---|
| 1017 | }
|
|---|
| 1018 |
|
|---|
| 1019 | @SuppressWarnings("unchecked")
|
|---|
| 1020 | private static void platforms() {
|
|---|
| 1021 | ArrayList<CatOFP> cats = (ArrayList<CatOFP>) getAttList(Obj.OFSPLF, Att.CATOFP);
|
|---|
| 1022 | if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
|
|---|
| 1023 | Renderer.symbol(Buoys.Storage);
|
|---|
| 1024 | else
|
|---|
| 1025 | Renderer.symbol(Landmarks.Platform);
|
|---|
| 1026 | addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
|
|---|
| 1027 | Signals.addSignals();
|
|---|
| 1028 | }
|
|---|
| 1029 |
|
|---|
| 1030 | private static void ports() {
|
|---|
| 1031 | if (Renderer.zoom >= 14) {
|
|---|
| 1032 | if (feature.type == Obj.CRANES) {
|
|---|
| 1033 | if ((CatCRN) getAttEnum(feature.type, Att.CATCRN) == CatCRN.CRN_CONT)
|
|---|
| 1034 | Renderer.symbol(Harbours.ContainerCrane);
|
|---|
| 1035 | else
|
|---|
| 1036 | Renderer.symbol(Harbours.PortCrane);
|
|---|
| 1037 | } else if (feature.type == Obj.HULKES) {
|
|---|
| 1038 | Renderer.lineVector(new LineStyle(Color.black, 4, null, new Color(0xffe000)));
|
|---|
| 1039 | addName(15, new Font("Arial", Font.BOLD, 40));
|
|---|
| 1040 | }
|
|---|
| 1041 | }
|
|---|
| 1042 | }
|
|---|
| 1043 |
|
|---|
| 1044 | private static void separation() {
|
|---|
| 1045 | switch (feature.type) {
|
|---|
| 1046 | case TSEZNE:
|
|---|
| 1047 | case TSSCRS:
|
|---|
| 1048 | case TSSRON:
|
|---|
| 1049 | if (Renderer.zoom <= 15)
|
|---|
| 1050 | Renderer.lineVector(new LineStyle(Symbols.Mtss));
|
|---|
| 1051 | else
|
|---|
| 1052 | Renderer.lineVector(new LineStyle(Symbols.Mtss, 20, null, null));
|
|---|
| 1053 | addName(10, new Font("Arial", Font.BOLD, 150), Symbols.Mline);
|
|---|
| 1054 | break;
|
|---|
| 1055 | case TSELNE:
|
|---|
| 1056 | Renderer.lineVector(new LineStyle(Symbols.Mtss, 20, null, null));
|
|---|
| 1057 | break;
|
|---|
| 1058 | case TSSLPT:
|
|---|
| 1059 | Renderer.lineSymbols(Areas.LaneArrow, 0.5, null, null, 0, Symbols.Mtss);
|
|---|
| 1060 | break;
|
|---|
| 1061 | case TSSBND:
|
|---|
| 1062 | Renderer.lineVector(new LineStyle(Symbols.Mtss, 20, new float[] { 40, 40 }, null));
|
|---|
| 1063 | break;
|
|---|
| 1064 | case ISTZNE:
|
|---|
| 1065 | Renderer.lineSymbols(Areas.Restricted, 1.0, null, null, 0, Symbols.Mtss);
|
|---|
| 1066 | break;
|
|---|
| 1067 | default:
|
|---|
| 1068 | break;
|
|---|
| 1069 | }
|
|---|
| 1070 | }
|
|---|
| 1071 |
|
|---|
| 1072 | @SuppressWarnings("unchecked")
|
|---|
| 1073 | private static void shoreline() {
|
|---|
| 1074 | CatSLC cat = (CatSLC) getAttEnum(feature.type, Att.CATSLC);
|
|---|
| 1075 | if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) {
|
|---|
| 1076 | if ((cat != CatSLC.SLC_SWAY) && (cat != CatSLC.SLC_TWAL)) {
|
|---|
| 1077 | if (Renderer.zoom >= 12) {
|
|---|
| 1078 | Renderer.lineVector(new LineStyle(Color.black, 10, Symbols.Yland));
|
|---|
| 1079 | } else {
|
|---|
| 1080 | Renderer.lineVector(new LineStyle(Symbols.Yland));
|
|---|
| 1081 | }
|
|---|
| 1082 | }
|
|---|
| 1083 | }
|
|---|
| 1084 | if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.SEAMARK)) {
|
|---|
| 1085 | if (Renderer.zoom >= 12) {
|
|---|
| 1086 | switch (cat) {
|
|---|
| 1087 | case SLC_TWAL:
|
|---|
| 1088 | WatLEV lev = (WatLEV) getAttEnum(feature.type, Att.WATLEV);
|
|---|
| 1089 | if (lev == WatLEV.LEV_CVRS) {
|
|---|
| 1090 | Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
|
|---|
| 1091 | if (Renderer.zoom >= 15)
|
|---|
| 1092 | Renderer.lineText("(covers)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 80);
|
|---|
| 1093 | } else {
|
|---|
| 1094 | Renderer.lineVector(new LineStyle(Color.black, 10, null, null));
|
|---|
| 1095 | }
|
|---|
| 1096 | if (Renderer.zoom >= 15)
|
|---|
| 1097 | Renderer.lineText("Training Wall", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, -30);
|
|---|
| 1098 | break;
|
|---|
| 1099 | case SLC_SWAY:
|
|---|
| 1100 | Renderer.lineVector(new LineStyle(Color.black, 2, null, new Color(0xffe000)));
|
|---|
| 1101 | if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) {
|
|---|
| 1102 | ArrayList<Symbol> symbols = new ArrayList<Symbol>();
|
|---|
| 1103 | ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(Obj.SMCFAC, Att.CATSCF);
|
|---|
| 1104 | for (CatSCF scf : scfs) {
|
|---|
| 1105 | symbols.add(Facilities.Cats.get(scf));
|
|---|
| 1106 | }
|
|---|
| 1107 | Renderer.cluster(symbols);
|
|---|
| 1108 | }
|
|---|
| 1109 | break;
|
|---|
| 1110 | default:
|
|---|
| 1111 | break;
|
|---|
| 1112 | }
|
|---|
| 1113 | }
|
|---|
| 1114 | }
|
|---|
| 1115 | }
|
|---|
| 1116 |
|
|---|
| 1117 | @SuppressWarnings("unchecked")
|
|---|
| 1118 | private static void stations() {
|
|---|
| 1119 | if (Renderer.zoom >= 14) {
|
|---|
| 1120 | String str = "";
|
|---|
| 1121 | switch (feature.type) {
|
|---|
| 1122 | case SISTAT:
|
|---|
| 1123 | Renderer.symbol(Harbours.SignalStation);
|
|---|
| 1124 | str = "SS";
|
|---|
| 1125 | ArrayList<CatSIT> tcats = (ArrayList<CatSIT>) getAttList(Obj.SISTAT, Att.CATSIT);
|
|---|
| 1126 | switch (tcats.get(0)) {
|
|---|
| 1127 | case SIT_IPT:
|
|---|
| 1128 | str += "(INT)";
|
|---|
| 1129 | break;
|
|---|
| 1130 | case SIT_PRTE:
|
|---|
| 1131 | str += "(Traffic)";
|
|---|
| 1132 | break;
|
|---|
| 1133 | case SIT_PRTC:
|
|---|
| 1134 | str += "(Port Control)";
|
|---|
| 1135 | break;
|
|---|
| 1136 | case SIT_LOCK:
|
|---|
| 1137 | str += "(Lock)";
|
|---|
| 1138 | break;
|
|---|
| 1139 | case SIT_BRDG:
|
|---|
| 1140 | str += "(Bridge)";
|
|---|
| 1141 | break;
|
|---|
| 1142 | default:
|
|---|
| 1143 | break;
|
|---|
| 1144 | }
|
|---|
| 1145 | break;
|
|---|
| 1146 | case SISTAW:
|
|---|
| 1147 | Renderer.symbol(Harbours.SignalStation);
|
|---|
| 1148 | str = "SS";
|
|---|
| 1149 | str = "SS";
|
|---|
| 1150 | ArrayList<CatSIW> wcats = (ArrayList<CatSIW>) getAttList(Obj.SISTAW, Att.CATSIW);
|
|---|
| 1151 | switch (wcats.get(0)) {
|
|---|
| 1152 | case SIW_STRM:
|
|---|
| 1153 | str += "(Storm)";
|
|---|
| 1154 | break;
|
|---|
| 1155 | case SIW_WTHR:
|
|---|
| 1156 | str += "(Weather)";
|
|---|
| 1157 | break;
|
|---|
| 1158 | case SIW_ICE:
|
|---|
| 1159 | str += "(Ice)";
|
|---|
| 1160 | break;
|
|---|
| 1161 | case SIW_TIDG:
|
|---|
| 1162 | str = "Tide gauge";
|
|---|
| 1163 | break;
|
|---|
| 1164 | case SIW_TIDS:
|
|---|
| 1165 | str = "Tide scale";
|
|---|
| 1166 | break;
|
|---|
| 1167 | case SIW_TIDE:
|
|---|
| 1168 | str += "(Tide)";
|
|---|
| 1169 | break;
|
|---|
| 1170 | case SIW_TSTR:
|
|---|
| 1171 | str += "(Stream)";
|
|---|
| 1172 | break;
|
|---|
| 1173 | case SIW_DNGR:
|
|---|
| 1174 | str += "(Danger)";
|
|---|
| 1175 | break;
|
|---|
| 1176 | case SIW_MILY:
|
|---|
| 1177 | str += "(Firing)";
|
|---|
| 1178 | break;
|
|---|
| 1179 | case SIW_TIME:
|
|---|
| 1180 | str += "(Time)";
|
|---|
| 1181 | break;
|
|---|
| 1182 | default:
|
|---|
| 1183 | break;
|
|---|
| 1184 | }
|
|---|
| 1185 | break;
|
|---|
| 1186 | case RDOSTA:
|
|---|
| 1187 | case RTPBCN:
|
|---|
| 1188 | Renderer.symbol(Harbours.SignalStation);
|
|---|
| 1189 | Renderer.symbol(Beacons.RadarStation);
|
|---|
| 1190 | break;
|
|---|
| 1191 | case RADRFL:
|
|---|
| 1192 | Renderer.symbol(Topmarks.RadarReflector);
|
|---|
| 1193 | break;
|
|---|
| 1194 | case RADSTA:
|
|---|
| 1195 | Renderer.symbol(Harbours.SignalStation);
|
|---|
| 1196 | Renderer.symbol(Beacons.RadarStation);
|
|---|
| 1197 | Renderer.labelText("Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
|
|---|
| 1198 | break;
|
|---|
| 1199 | case PILBOP:
|
|---|
| 1200 | Renderer.symbol(Harbours.Pilot);
|
|---|
| 1201 | addName(15, new Font("Arial", Font.BOLD, 40), Symbols.Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
|
|---|
| 1202 | CatPIL cat = (CatPIL) getAttEnum(feature.type, Att.CATPIL);
|
|---|
| 1203 | if (cat == CatPIL.PIL_HELI) {
|
|---|
| 1204 | Renderer.labelText("H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
|
|---|
| 1205 | }
|
|---|
| 1206 | break;
|
|---|
| 1207 | case CGUSTA:
|
|---|
| 1208 | Renderer.symbol(Harbours.SignalStation);
|
|---|
| 1209 | str = "CG";
|
|---|
| 1210 | if (feature.objs.containsKey(Obj.RSCSTA)) Renderer.symbol(Harbours.Rescue, new Delta(Handle.CC, AffineTransform.getTranslateInstance(130, 0)));
|
|---|
| 1211 | break;
|
|---|
| 1212 | case RSCSTA:
|
|---|
| 1213 | Renderer.symbol(Harbours.Rescue);
|
|---|
| 1214 | break;
|
|---|
| 1215 | default:
|
|---|
| 1216 | break;
|
|---|
| 1217 | }
|
|---|
| 1218 | if ((Renderer.zoom >= 15) && !str.isEmpty()) {
|
|---|
| 1219 | Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(40, 0)));
|
|---|
| 1220 | }
|
|---|
| 1221 | Signals.addSignals();
|
|---|
| 1222 | }
|
|---|
| 1223 | }
|
|---|
| 1224 |
|
|---|
| 1225 | private static void transits() {
|
|---|
| 1226 | if (Renderer.zoom >= 14) {
|
|---|
| 1227 | if (feature.type == Obj.RECTRC) Renderer.lineVector (new LineStyle(Color.black, 10, null, null));
|
|---|
| 1228 | else if (feature.type == Obj.NAVLNE) Renderer.lineVector (new LineStyle(Color.black, 10, new float[] { 25, 25 }, null));
|
|---|
| 1229 | }
|
|---|
| 1230 | if (Renderer.zoom >= 15) {
|
|---|
| 1231 | String str = "";
|
|---|
| 1232 | String name = getName();
|
|---|
| 1233 | if (name != null)
|
|---|
| 1234 | str += name + " ";
|
|---|
| 1235 | Double ort;
|
|---|
| 1236 | if ((ort = (Double) getAttVal(feature.type, Att.ORIENT)) != null) {
|
|---|
| 1237 | str += df.format(ort) + "ΒΊ";
|
|---|
| 1238 | if (!str.isEmpty())
|
|---|
| 1239 | Renderer.lineText(str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
|
|---|
| 1240 | }
|
|---|
| 1241 | }
|
|---|
| 1242 | }
|
|---|
| 1243 |
|
|---|
| 1244 | private static void waterways() {
|
|---|
| 1245 | Renderer.lineVector(new LineStyle(Symbols.Bwater, 20, (feature.geom.prim == Pflag.AREA) ? Symbols.Bwater : null));
|
|---|
| 1246 | }
|
|---|
| 1247 |
|
|---|
| 1248 | private static void wrecks() {
|
|---|
| 1249 | if (Renderer.zoom >= 14) {
|
|---|
| 1250 | switch ((CatWRK) getAttEnum(feature.type, Att.CATWRK)) {
|
|---|
| 1251 | case WRK_DNGR:
|
|---|
| 1252 | case WRK_MSTS:
|
|---|
| 1253 | Renderer.symbol(Areas.WreckD);
|
|---|
| 1254 | break;
|
|---|
| 1255 | case WRK_HULS:
|
|---|
| 1256 | Renderer.symbol(Areas.WreckS);
|
|---|
| 1257 | break;
|
|---|
| 1258 | default:
|
|---|
| 1259 | Renderer.symbol(Areas.WreckND);
|
|---|
| 1260 | }
|
|---|
| 1261 | }
|
|---|
| 1262 | }
|
|---|
| 1263 | }
|
|---|