Changeset 29176 in osm for applications/editors/josm
- Timestamp:
- 2013-01-06T19:35:09+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r29175 r29176 16 16 import s57.S57obj.*; 17 17 18 import seamap.SeaMap.AttItem; 19 import seamap.SeaMap.Feature; 18 import seamap.SeaMap.*; 20 19 import symbols.Beacons; 21 20 import symbols.Buoys; 21 import symbols.Harbours; 22 import symbols.Landmarks; 23 import symbols.Symbols.Instr; 22 24 23 25 public class Rules { … … 114 116 private static void distances(ArrayList<Feature> features) {} 115 117 private static void ports(ArrayList<Feature> features) {} 116 private static void landmarks(ArrayList<Feature> features) {} 117 private static void moorings(ArrayList<Feature> features) {} 118 private static void landmarks(ArrayList<Feature> features) { 119 for (Feature feature : features) { 120 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) Renderer.getAttVal(feature, feature.type, 0, Att.CATLMK); 121 ArrayList<Instr> catSym = Landmarks.Shapes.get(cats.get(0)); 122 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Renderer.getAttVal(feature, feature.type, 0, Att.FUNCTN); 123 ArrayList<Instr> fncSym = Landmarks.Funcs.get(fncs.get(0)); 124 if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR)) catSym = Landmarks.ChurchTower; 125 Renderer.symbol(feature, catSym, feature.type); 126 Renderer.symbol(feature, fncSym, feature.type); 127 } 128 } 129 private static void moorings(ArrayList<Feature> features) { 130 for (Feature feature : features) { 131 CatMOR cat = (CatMOR) Renderer.getAttVal(feature, feature.type, 0, Att.CATMOR); 132 switch (cat) { 133 case MOR_DLPN: 134 Renderer.symbol(feature, Harbours.Dolphin, feature.type); 135 break; 136 case MOR_DDPN: 137 Renderer.symbol(feature, Harbours.DeviationDolphin, feature.type); 138 break; 139 case MOR_BLRD: 140 case MOR_POST: 141 Renderer.symbol(feature, Harbours.Bollard, feature.type); 142 break; 143 case MOR_BUOY: 144 BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP); 145 if (shape == BoySHP.BOY_UNKN) shape = BoySHP.BOY_SPHR; 146 Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type); 147 break; 148 } 149 } 150 } 118 151 private static void notices(ArrayList<Feature> features) {} 119 152 private static void marinas(ArrayList<Feature> features) {} 120 153 private static void bridges(ArrayList<Feature> features) {} 121 private static void lights(ArrayList<Feature> features) {}122 private static void floats(ArrayList<Feature> features) {}123 private static void signals(ArrayList<Feature> features) {}124 154 private static void wrecks(ArrayList<Feature> features) {} 125 155 private static void gauges(ArrayList<Feature> features) {} 126 private static void platforms(ArrayList<Feature> features) {} 156 private static void lights(ArrayList<Feature> features) { 157 for (Feature feature : features) { 158 switch (feature.type) { 159 case LITMAJ: 160 Renderer.symbol(feature, Beacons.LightMajor, feature.type); 161 break; 162 case LITMIN: 163 case LIGHTS: 164 Renderer.symbol(feature, Beacons.LightMinor, feature.type); 165 break; 166 } 167 } 168 } 169 private static void signals(ArrayList<Feature> features) { 170 for (Feature feature : features) { 171 switch (feature.type) { 172 case SISTAT: 173 case SISTAW: 174 Renderer.symbol(feature, Harbours.SignalStation, feature.type); 175 break; 176 case RDOSTA: 177 Renderer.symbol(feature, Harbours.SignalStation, feature.type); 178 break; 179 case RADSTA: 180 Renderer.symbol(feature, Harbours.SignalStation, feature.type); 181 break; 182 case PILBOP: 183 Renderer.symbol(feature, Harbours.SignalStation, feature.type); 184 break; 185 case CGUSTA: 186 // Renderer.symbol(feature, Harbours.CGuardStation, feature.type); 187 break; 188 case RSCSTA: 189 // Renderer.symbol(feature, Harbours.RescueStation, feature.type); 190 break; 191 } 192 } 193 } 194 private static void floats(ArrayList<Feature> features) { 195 for (Feature feature : features) { 196 switch (feature.type) { 197 case LITVES: 198 Renderer.symbol(feature, Buoys.Super, feature.type); 199 break; 200 case LITFLT: 201 Renderer.symbol(feature, Buoys.Float, feature.type); 202 break; 203 case BOYINB: 204 Renderer.symbol(feature, Buoys.Storage, feature.type); 205 break; 206 } 207 } 208 } 209 private static void platforms(ArrayList<Feature> features) { 210 for (Feature feature : features) { 211 Renderer.symbol(feature, Landmarks.Platform, feature.type); 212 } 213 } 127 214 private static void buoys(ArrayList<Feature> features) { 128 215 for (Feature feature : features) { -
applications/editors/josm/plugins/smed2/src/symbols/Beacons.java
r29174 r29176 63 63 public static final ArrayList<Instr> LightMajor = new ArrayList<Instr>(); 64 64 static { 65 LightMajor.add(new Instr(Prim.FILL, Color.black)); 65 66 Path2D.Double p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_NON_ZERO); 66 67 p.moveTo(0.0,-7.0); p.curveTo(-9.3,-6.5,-9.3,6.5,0.0,7.0); p.curveTo(9.3,6.5,9.3,-6.5,0.0,-7.0); p.closePath(); … … 71 72 public static final ArrayList<Instr> LightMinor = new ArrayList<Instr>(); 72 73 static { 74 LightMinor.add(new Instr(Prim.FILL, Color.black)); 73 75 Path2D.Double p = new Path2D.Double(); p.moveTo(0.0,-26.5); p.lineTo(6.0,-8.4); p.lineTo(25.1,-8.4); p.lineTo(9.6,3.0); 74 76 p.lineTo(15.4,21.4); p.lineTo(0.0,9.8); p.lineTo(-15.4,21.4); p.lineTo(-9.6,3.0); p.lineTo(-25.1,-8.4); p.lineTo(-6.0,-8.4); p.closePath(); -
applications/editors/josm/plugins/smed2/src/symbols/Landmarks.java
r29120 r29176 18 18 import java.awt.geom.Rectangle2D; 19 19 import java.util.ArrayList; 20 21 import symbols.Symbols.Instr; 22 import symbols.Symbols.Prim; 20 import java.util.EnumMap; 21 22 import s57.S57val.*; 23 import symbols.Symbols.*; 24 23 25 24 26 public class Landmarks { … … 210 212 Windsock.add(new Instr(Prim.PLIN, p)); 211 213 } 214 215 public static final EnumMap<CatLMK, ArrayList<Instr>> Shapes = new EnumMap<CatLMK, ArrayList<Instr>>(CatLMK.class); 216 static { 217 Shapes.put(CatLMK.LMK_CARN, Beacons.Cairn); Shapes.put(CatLMK.LMK_CHMY, Landmarks.Chimney); 218 Shapes.put(CatLMK.LMK_DISH, Landmarks.DishAerial); Shapes.put(CatLMK.LMK_FLAG, Landmarks.Flagstaff); Shapes.put(CatLMK.LMK_FLAR, Landmarks.FlareStack); 219 Shapes.put(CatLMK.LMK_MAST, Landmarks.Mast); Shapes.put(CatLMK.LMK_WNDS, Landmarks.Windsock); Shapes.put(CatLMK.LMK_MNMT, Landmarks.Monument); 220 Shapes.put(CatLMK.LMK_CLMN, Landmarks.Monument); Shapes.put(CatLMK.LMK_MEML, Landmarks.Monument); Shapes.put(CatLMK.LMK_OBLK, Landmarks.Monument); 221 Shapes.put(CatLMK.LMK_STAT, Landmarks.Monument); Shapes.put(CatLMK.LMK_CROS, Landmarks.Cross); Shapes.put(CatLMK.LMK_DOME, Landmarks.Dome); 222 Shapes.put(CatLMK.LMK_RADR, Landmarks.RadioMast); Shapes.put(CatLMK.LMK_TOWR, Landmarks.LandTower); Shapes.put(CatLMK.LMK_WNDM, Landmarks.Windmill); 223 Shapes.put(CatLMK.LMK_WNDG, Landmarks.WindMotor); Shapes.put(CatLMK.LMK_SPIR, Landmarks.Spire); Shapes.put(CatLMK.LMK_BLDR, Beacons.Cairn); 224 Shapes.put(CatLMK.LMK_MNRT, Landmarks.Minaret); Shapes.put(CatLMK.LMK_WTRT, Landmarks.WaterTower); 225 } 226 227 public static final EnumMap<FncFNC, ArrayList<Instr>> Funcs = new EnumMap<FncFNC, ArrayList<Instr>>(FncFNC.class); 228 static { 229 Funcs.put(FncFNC.FNC_CHCH, Landmarks.Church); Funcs.put(FncFNC.FNC_CHPL, Landmarks.Church); Funcs.put(FncFNC.FNC_TMPL, Landmarks.Temple); 230 Funcs.put(FncFNC.FNC_PGDA, Landmarks.Temple); Funcs.put(FncFNC.FNC_SHSH, Landmarks.Temple); Funcs.put(FncFNC.FNC_BTMP, Landmarks.Temple); 231 Funcs.put(FncFNC.FNC_MOSQ, Landmarks.Minaret); Funcs.put(FncFNC.FNC_MRBT, Landmarks.Spire); Funcs.put(FncFNC.FNC_COMM, Landmarks.RadioMast); 232 Funcs.put(FncFNC.FNC_TV, Landmarks.RadioMast); Funcs.put(FncFNC.FNC_RADO, Landmarks.RadioMast); Funcs.put(FncFNC.FNC_RADR, Landmarks.RadioMast); 233 Funcs.put(FncFNC.FNC_LGHT, Beacons.LightMajor); Funcs.put(FncFNC.FNC_MCWV, Landmarks.RadioMast); 234 } 212 235 } -
applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
r29134 r29176 125 125 g2.translate(x, y); 126 126 g2.scale(scale, scale); 127 for (Instr item : symbol) { 128 switch (item.type) { 129 case BBOX: 130 Rectangle bbox = (Rectangle) item.params; 131 double dx = 0.0; 132 double dy = 0.0; 133 if (dd != null) { 134 g2.transform(dd.t); 135 switch (dd.h) { 136 case CC: 137 dx = bbox.x + (bbox.width / 2.0); 138 dy = bbox.y + (bbox.height / 2.0); 139 break; 140 case TL: 141 dx = bbox.x; 142 dy = bbox.y; 143 break; 144 case TR: 145 dx = bbox.x + bbox.width; 146 dy = bbox.y; 147 break; 148 case TC: 149 dx = bbox.x + (bbox.width / 2.0); 150 dy = bbox.y; 151 break; 152 case LC: 153 dx = bbox.x; 154 dy = bbox.y + (bbox.height / 2.0); 155 break; 156 case RC: 157 dx = bbox.x + bbox.width; 158 dy = bbox.y + (bbox.height / 2.0); 159 break; 160 case BL: 161 dx = bbox.x; 162 dy = bbox.y + bbox.height; 163 break; 164 case BR: 165 dx = bbox.x + bbox.width; 166 dy = bbox.y + bbox.height; 167 break; 168 case BC: 169 dx = bbox.x + (bbox.width / 2.0); 170 dy = bbox.y + bbox.height; 171 break; 127 if (symbol != null) { 128 for (Instr item : symbol) { 129 switch (item.type) { 130 case BBOX: 131 Rectangle bbox = (Rectangle) item.params; 132 double dx = 0.0; 133 double dy = 0.0; 134 if (dd != null) { 135 g2.transform(dd.t); 136 switch (dd.h) { 137 case CC: 138 dx = bbox.x + (bbox.width / 2.0); 139 dy = bbox.y + (bbox.height / 2.0); 140 break; 141 case TL: 142 dx = bbox.x; 143 dy = bbox.y; 144 break; 145 case TR: 146 dx = bbox.x + bbox.width; 147 dy = bbox.y; 148 break; 149 case TC: 150 dx = bbox.x + (bbox.width / 2.0); 151 dy = bbox.y; 152 break; 153 case LC: 154 dx = bbox.x; 155 dy = bbox.y + (bbox.height / 2.0); 156 break; 157 case RC: 158 dx = bbox.x + bbox.width; 159 dy = bbox.y + (bbox.height / 2.0); 160 break; 161 case BL: 162 dx = bbox.x; 163 dy = bbox.y + bbox.height; 164 break; 165 case BR: 166 dx = bbox.x + bbox.width; 167 dy = bbox.y + bbox.height; 168 break; 169 case BC: 170 dx = bbox.x + (bbox.width / 2.0); 171 dy = bbox.y + bbox.height; 172 break; 173 } 174 g2.translate(-dx, -dy); 172 175 } 173 g2.translate(-dx, -dy); 174 } 175 break; 176 case COLR: 177 if ((cs != null) && (cs.col != null)) { 178 for (Instr patch : (ArrayList<Instr>) item.params) { 179 switch (patch.type) { 180 case P1: 181 if (cn > 0) { 182 g2.setPaint(bodyColours.get(cs.col.get(0))); 183 g2.fill((Path2D.Double) patch.params); 176 break; 177 case COLR: 178 if ((cs != null) && (cs.col != null)) { 179 for (Instr patch : (ArrayList<Instr>) item.params) { 180 switch (patch.type) { 181 case P1: 182 if (cn > 0) { 183 g2.setPaint(bodyColours.get(cs.col.get(0))); 184 g2.fill((Path2D.Double) patch.params); 185 } 186 break; 187 case P2: 188 if (cn > 0) { 189 if (cn > 1) { 190 g2.setPaint(bodyColours.get(cs.col.get(1))); 191 } else { 192 g2.setPaint(bodyColours.get(cs.col.get(0))); 193 } 194 g2.fill((Path2D.Double) patch.params); 195 } 196 break; 197 case H2: 198 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 199 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn))); 200 g2.fill((Path2D.Double) patch.params); 201 } 202 break; 203 case H3: 204 if ((cn == 3) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 205 g2.setPaint(bodyColours.get(cs.col.get(1))); 206 g2.fill((Path2D.Double) patch.params); 207 } 208 break; 209 case H4: 210 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 211 g2.setPaint(bodyColours.get(cs.col.get(1))); 212 g2.fill((Path2D.Double) patch.params); 213 } 214 break; 215 case H5: 216 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 217 g2.setPaint(bodyColours.get(cs.col.get(2))); 218 g2.fill((Path2D.Double) patch.params); 219 } 220 break; 221 case V2: 222 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_VERT)) { 223 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn))); 224 g2.fill((Path2D.Double) patch.params); 225 } 226 break; 184 227 } 185 break;186 case P2:187 if (cn > 0) {188 if (cn > 1) {189 g2.setPaint(bodyColours.get(cs.col.get(1)));190 } else {191 g2.setPaint(bodyColours.get(cs.col.get(0)));192 }193 g2.fill((Path2D.Double) patch.params);194 }195 break;196 case H2:197 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {198 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn)));199 g2.fill((Path2D.Double) patch.params);200 }201 break;202 case H3:203 if ((cn == 3) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {204 g2.setPaint(bodyColours.get(cs.col.get(1)));205 g2.fill((Path2D.Double) patch.params);206 }207 break;208 case H4:209 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {210 g2.setPaint(bodyColours.get(cs.col.get(1)));211 g2.fill((Path2D.Double) patch.params);212 }213 break;214 case H5:215 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {216 g2.setPaint(bodyColours.get(cs.col.get(2)));217 g2.fill((Path2D.Double) patch.params);218 }219 break;220 case V2:221 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_VERT)) {222 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn)));223 g2.fill((Path2D.Double) patch.params);224 }225 break;226 228 } 227 229 } 230 break; 231 case STRK: 232 g2.setStroke((BasicStroke) item.params); 233 break; 234 case FILL: 235 g2.setPaint((Color) item.params); 236 break; 237 case LINE: 238 g2.draw((Line2D.Double) item.params); 239 break; 240 case RECT: 241 g2.draw((Rectangle2D.Double) item.params); 242 break; 243 case RRCT: 244 g2.draw((RoundRectangle2D.Double) item.params); 245 break; 246 case ELPS: 247 g2.draw((Ellipse2D.Double) item.params); 248 break; 249 case EARC: 250 g2.draw((Arc2D.Double) item.params); 251 break; 252 case PLIN: 253 g2.draw((Path2D.Double) item.params); 254 break; 255 case PGON: 256 g2.fill((Path2D.Double) item.params); 257 break; 258 case RSHP: 259 g2.fill((RectangularShape) item.params); 260 break; 261 case SYMB: 262 Symbol s = (Symbol) item.params; 263 drawSymbol(g2, s.instr, s.scale, s.x, s.y, s.delta, s.scheme); 264 break; 265 case FONT: 266 g2.setFont((Font) item.params); 267 break; 268 case TEXT: 269 Caption c = (Caption) item.params; 270 g2.drawString(c.str, c.x, c.y); 271 break; 228 272 } 229 break;230 case STRK:231 g2.setStroke((BasicStroke) item.params);232 break;233 case FILL:234 g2.setPaint((Color) item.params);235 break;236 case LINE:237 g2.draw((Line2D.Double) item.params);238 break;239 case RECT:240 g2.draw((Rectangle2D.Double) item.params);241 break;242 case RRCT:243 g2.draw((RoundRectangle2D.Double) item.params);244 break;245 case ELPS:246 g2.draw((Ellipse2D.Double) item.params);247 break;248 case EARC:249 g2.draw((Arc2D.Double) item.params);250 break;251 case PLIN:252 g2.draw((Path2D.Double) item.params);253 break;254 case PGON:255 g2.fill((Path2D.Double) item.params);256 break;257 case RSHP:258 g2.fill((RectangularShape) item.params);259 break;260 case SYMB:261 Symbol s = (Symbol) item.params;262 drawSymbol(g2, s.instr, s.scale, s.x, s.y, s.delta, s.scheme);263 break;264 case FONT:265 g2.setFont((Font)item.params);266 break;267 case TEXT:268 Caption c = (Caption)item.params;269 g2.drawString(c.str, c.x, c.y);270 break;271 273 } 272 274 }
Note:
See TracChangeset
for help on using the changeset viewer.