Changeset 30027 in osm for applications
- Timestamp:
- 2013-10-18T17:29:48+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r30025 r30027 63 63 // public static final double textScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.5556, 0.3086, 0.1714, 0.0953, 0.0529, 0.0294, 0.0163, 0.0091, 0.0050, 0.0028, 0.0163 }; 64 64 65 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC }65 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, HCLR } 66 66 67 67 static MapContext context; … … 342 342 double width = bounds.getWidth(); 343 343 double height = bounds.getHeight(); 344 double dx = 0.25 * width; 345 double dy = 0.25 * height; 344 if (width < height) width = height; 345 double dx = 0; 346 double dy = 0; 346 347 switch (delta.h) { 347 348 case CC: … … 349 350 dy += height / 2.0; 350 351 break; 351 case TL:352 dx += 0;353 dy += 0;354 break;355 352 case TR: 356 353 dx += width; 357 dy += 0;358 354 break; 359 355 case TC: 360 356 dx += width / 2.0; 361 dy += 0;362 357 break; 363 358 case LC: 364 dx += 0;365 359 dy += height / 2.0; 366 360 break; … … 370 364 break; 371 365 case BL: 372 dx += 0;373 366 dy += height; 374 367 break; … … 382 375 break; 383 376 } 377 width += (height * 0.8); 378 dx += (height * 0.4); 379 height *= 1.5; 380 dy += (height * 0.15); 384 381 Symbol label = new Symbol(); 385 382 switch (style) { 386 383 case RRCT: 387 if (width < height) width = height;388 width *= 1.5;389 height *= 1.5;390 384 label.add(new Instr(Prim.FILL, bg)); 391 385 label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height))); … … 393 387 label.add(new Instr(Prim.STRK, new BasicStroke(1 + (int)(height/10), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 394 388 label.add(new Instr(Prim.RRCT, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height))); 389 break; 390 case VCLR: 391 height += 20; 392 dy += 10; 393 label.add(new Instr(Prim.FILL, bg)); 394 label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height))); 395 label.add(new Instr(Prim.FILL, fg)); 396 int sw = 1 + (int)(height/10); 397 double po = dy - (sw / 2); 398 label.add(new Instr(Prim.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 399 Path2D.Double p = new Path2D.Double(); p.moveTo(-(height*0.2),po); p.lineTo((height*0.2),po); p.moveTo(0,po); p.lineTo(0,po-10); 400 p.moveTo(-(height*0.2),-po); p.lineTo((height*0.2),-po); p.moveTo(0,-po); p.lineTo(0,-po+10); 401 label.add(new Instr(Prim.PLIN, p)); 395 402 break; 396 403 } -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r30026 r30027 19 19 import s57.S57obj.*; 20 20 21 import seamap.SeaMap.AttItem; 22 import seamap.SeaMap.AttMap; 23 import seamap.SeaMap.ObjTab; 21 24 import seamap.Renderer.*; 22 25 import seamap.SeaMap.*; … … 69 72 if ((objects = map.features.get(Obj.CRANES)) != null) for (Feature feature : objects) ports(feature); 70 73 if ((objects = map.features.get(Obj.LNDMRK)) != null) for (Feature feature : objects) landmarks(feature); 74 if ((objects = map.features.get(Obj.BUISGL)) != null) for (Feature feature : objects) harbours(feature); 71 75 if ((objects = map.features.get(Obj.MORFAC)) != null) for (Feature feature : objects) moorings(feature); 72 76 if ((objects = map.features.get(Obj.NOTMRK)) != null) for (Feature feature : objects) notices(feature); … … 247 251 private static void bridges(Feature feature) { 248 252 if (zoom >= 16) { 249 250 } 251 /* case BRIDGE: { 252 Att_t *attv = getAtt(getObj(item, BRIDGE, 0), VERCLR); 253 if (attv == NULL) attv = getAtt(getObj(item, BRIDGE, 0), VERCSA); 254 Att_t *attc = getAtt(getObj(item, BRIDGE, 0), VERCCL); 255 Att_t *atto = getAtt(getObj(item, BRIDGE, 0), VERCOP); 256 if (attv != NULL) { 257 renderSymbol(item, obja, "clear_v", "", "", CC, 0, 0, 0); 258 drawText(item, stringValue(attv->val), "font-family:Arial; font-weight:normal; font-size:70; text-anchor:middle", 0, 12); 259 } 260 else if ((attc != NULL) && (atto == NULL)) { 261 char *string=strdup(stringValue(attc->val)); 262 string = realloc(string, strlen(string) + 3); strcat(string, "/-"); 263 renderSymbol(item, obja, "clear_v", "", "", CC, 0, 0, 0); 264 drawText(item, string, "font-family:Arial; font-weight:normal; font-size:70; text-anchor:middle", 0, 12); 265 free(string); 266 } 267 else if ((attc != NULL) && (atto != NULL)) { 268 char *string=strdup(stringValue(attc->val)); 269 string = realloc(string, strlen(string) + 2); strcat(string, "/"); 270 string = realloc(string, strlen(string) + strlen(stringValue(atto->val)) + 1); strcat(string, stringValue(atto->val)); 271 renderSymbol(item, obja, "clear_v", "", "", CC, 0, 0, 0); 272 drawText(item, string, "font-family:Arial; font-weight:normal; font-size:60; text-anchor:middle", 0, 10); 273 free(string); 274 } 275 } 276 */ 277 } 253 double verclr, verccl, vercop; 254 AttMap atts = feature.objs.get(Obj.BRIDGE).get(0); 255 String str = ""; 256 if (atts.containsKey(Att.VERCLR)) { 257 verclr = (Double)atts.get(Att.VERCLR).val; 258 } else { 259 verclr = atts.containsKey(Att.VERCSA) ? (Double)atts.get(Att.VERCSA).val : 0; 260 } 261 verccl = atts.containsKey(Att.VERCCL) ? (Double)atts.get(Att.VERCCL).val : 0; 262 vercop = atts.containsKey(Att.VERCOP) ? (Double)atts.get(Att.VERCOP).val : 0; 263 if (verclr > 0) { 264 str += String.valueOf(verclr); 265 } else if (verccl > 0) { 266 if (vercop == 0) { 267 str += String.valueOf(verccl) + "/-"; 268 } else { 269 str += String.valueOf(verccl) + "/" + String.valueOf(vercop); 270 } 271 } 272 if (!str.isEmpty()) 273 Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 0))); 274 } 275 } 276 278 277 private static void cables(Feature feature) { 279 278 if (zoom >= 14) { … … 389 388 } 390 389 break; 390 case BUISGL: 391 if (zoom >= 16) { 392 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Renderer.getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN); 393 Renderer.symbol(feature, Landmarks.Funcs.get(fncs.get(0)), null, null, null); 394 } 395 break; 391 396 } 392 397 } … … 430 435 */ 431 436 Signals.addSignals(feature); 437 } 438 439 private static void buildings(Feature feature) { 432 440 } 433 441 -
applications/editors/josm/plugins/smed2/src/symbols/Landmarks.java
r30022 r30027 210 210 Funcs.put(FncFNC.FNC_MOSQ, Landmarks.Minaret); Funcs.put(FncFNC.FNC_MRBT, Landmarks.Spire); Funcs.put(FncFNC.FNC_COMM, Landmarks.RadioTV); 211 211 Funcs.put(FncFNC.FNC_TV, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_RADO, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_RADR, Landmarks.RadioTV); 212 Funcs.put(FncFNC.FNC_LGHT, Beacons.LightMajor); Funcs.put(FncFNC.FNC_MCWV, Landmarks.RadioTV); 212 Funcs.put(FncFNC.FNC_LGHT, Beacons.LightMajor); Funcs.put(FncFNC.FNC_MCWV, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_HBRM, Harbours.HarbourMaster); 213 Funcs.put(FncFNC.FNC_CSTM, Harbours.Customs); Funcs.put(FncFNC.FNC_HLTH, Harbours.Hospital); Funcs.put(FncFNC.FNC_HOSP, Harbours.Hospital); 213 214 } 214 215 }
Note:
See TracChangeset
for help on using the changeset viewer.