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