Changeset 31063 in osm for applications/editors/josm
- Timestamp:
- 2015-03-27T09:22:05+01:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/seachart
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/js57toosm/src/js57toosm/Js57toosm.java
r31044 r31063 173 173 for (Map.Entry<Att, AttVal<?>> item : feature.atts.entrySet()) { 174 174 String attstr = S57att.stringAttribute(item.getKey()); 175 String valstr = S57val.stringValue(item.getValue() );175 String valstr = S57val.stringValue(item.getValue(), item.getKey()); 176 176 if (!attstr.isEmpty() && !valstr.isEmpty()) 177 177 out.format(" <tag k='seamark:%s:%s' v='%s'/>%n", type, attstr, valstr); … … 184 184 for (Map.Entry<Att, AttVal<?>> item : atts.entrySet()) { 185 185 String attstr = S57att.stringAttribute(item.getKey()); 186 String valstr = S57val.stringValue(item.getValue() );186 String valstr = S57val.stringValue(item.getValue(), item.getKey()); 187 187 if (!attstr.isEmpty() && !valstr.isEmpty()) { 188 188 if ((ix == 0) && (tab.size() == 1)) { -
applications/editors/josm/plugins/seachart/src/render/Signals.java
r31044 r31063 54 54 static final EnumMap<LitCHR, String> lightCharacters = new EnumMap<LitCHR, String>(LitCHR.class); 55 55 static { 56 lightCharacters.put(LitCHR.CHR_F, " W");56 lightCharacters.put(LitCHR.CHR_F, "F"); 57 57 lightCharacters.put(LitCHR.CHR_FL, "Fl"); 58 58 lightCharacters.put(LitCHR.CHR_LFL, "LFl"); … … 285 285 Enum<ColCOL> col = null; 286 286 Enum<ColCOL> tcol = null; 287 ObjTab objs = feature.objs.get(Obj.LIGHTS);288 for (AttMap atts : objs.values()) {287 ObjTab lights = feature.objs.get(Obj.LIGHTS); 288 for (AttMap atts : lights.values()) { 289 289 if (atts.containsKey(Att.COLOUR)) { 290 290 ArrayList<Enum<ColCOL>> cols = (ArrayList<Enum<ColCOL>>) atts.get(Att.COLOUR).val; … … 304 304 } 305 305 Renderer.symbol(feature, Beacons.LightFlare, new Scheme(lightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120)))); 306 if ( objs.get(1) != null) {307 for (AttMap atts : objs.values()) {306 if (lights.get(1) != null) { 307 for (AttMap atts : lights.values()) { 308 308 Enum<ColCOL> col1 = null; 309 309 Enum<ColCOL> col2 = null; … … 360 360 double n1 = 360; 361 361 double n2 = 360; 362 for (AttMap sect : objs.values()) {362 for (AttMap sect : lights.values()) { 363 363 if (sect != atts) { 364 364 … … 369 369 } 370 370 } 371 } 372 373 /* 374 void renderSector(Item_t *item, int s, char *text, char *style, double offset, int dy) { 375 Obj_t *sector; 376 double start, end; 377 Att_t *att; 378 XY_t p0, p1; 379 double r0, r1; 380 double b0, b1, span; 381 char *col; 382 XY_t pos = findCentroid(item); 383 if ((sector = getObj(item, LIGHTS, s)) != NULL) { 384 strcpy(string1, (att = getAtt(sector, LITRAD)) != NULL ? att->val.val.a : "0.2"); 385 if (((att = getAtt(sector, CATLIT)) != NULL) && (testAtt(att, LIT_DIR)) && ((att = getAtt(sector, ORIENT)) != NULL)) { 386 b0 = fmod(540.0 - att->val.val.f, 360.0); 387 if ((att = getAtt(sector, COLOUR)) != NULL) { 388 col = light_colours[att->val.val.l->val]; 389 r0 = atof(string1); 390 p0 = radial(pos, r0, b0); 391 printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n", 392 pos.x, pos.y, p0.x, p0.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom])); 393 start = fmod(b0 + 2.0, 360.0); 394 end = fmod(360.0 + b0 - 2.0, 360.0); 395 Obj_t *adj; 396 for (int i = s-1; i <= s+1; i++) { 397 if (i == s) continue; 398 if ((adj = getObj(item, LIGHTS, i)) == NULL) continue; 399 Att_t *att; 400 if (((att = getAtt(adj, CATLIT)) != NULL) && (testAtt(att, LIT_DIR)) && ((att = getAtt(adj, ORIENT)) != NULL)) { 401 b1 = fmod(540.0 - att->val.val.f, 360.0); 402 if (fabs(b0 - b1) > 180.0) { 403 if (b0 < b1) b0 += 360.0; 404 else b1 += 360.0; 405 } 406 if (fabs(b0 - b1) < 4.0) { 407 if (b1 > b0) start = fmod((720.0 + b0 + b1) / 2.0, 360.0); 408 else end = fmod((720.0 + b0 + b1) / 2.0, 360.0); 409 } 410 } 411 } 412 p0 = radial(pos, r0, start); 413 p1 = radial(pos, r0, end); 414 printf("<path id=\"%d\" d=\"M %g,%g A %g,%g,0,0,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n", 415 ++ref, p0.x, p0.y, r0*mile, r0*mile, p1.x, p1.y, col, (20 * symbolScale[zoom])); 416 if (att->val.val.l->next != NULL) { 417 char *col = light_colours[att->val.val.l->next->val]; 418 r1 = r0 - (20 * symbolScale[zoom]/mile); 419 p0 = radial(pos, r1, start); 420 p1 = radial(pos, r1, end); 421 printf("<path d=\"M %g,%g A %g,%g,0,0,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n", 422 p0.x, p0.y, r1*mile, r1*mile, p1.x, p1.y, col, (20 * symbolScale[zoom])); 423 } 424 } 425 } else if ((att = getAtt(sector, SECTR1)) != NULL) { 426 start = fmod(540.0 - att->val.val.f, 360.0); 427 if ((att = getAtt(sector, SECTR2)) != NULL) { 428 end = fmod(540.0 - att->val.val.f, 360.0); 429 start += start < end ? 360.0 : 0.0; 430 if ((att = getAtt(sector, COLOUR)) != NULL) { 431 char *ttok, *etok; 432 char *radstr = strdup(string1); 433 int arc = 0; 434 col = light_colours[att->val.val.l->val]; 435 r0 = 0.0; 436 b0 = b1 = start; 437 for (char *tpl = strtok_r(radstr, ";", &ttok); tpl != NULL; tpl = strtok_r(NULL, ";", &ttok)) { 438 p0 = radial(pos, r0, b0); 439 span = 0.0; 440 char *ele = strtok_r(tpl, ":", &etok); 441 if ((*tpl == ':') && (r0 == 0.0)) { 442 r1 = 0.2; 443 } else if (*tpl != ':') { 444 r1 = atof(tpl); 445 ele = strtok_r(NULL, ":", &etok); 446 } 447 while (ele != NULL) { 448 if (isalpha(*ele)) { 449 if (strcmp(ele, "suppress") == 0) arc = 2; 450 else if (strcmp(ele, "dashed") == 0) arc = 1; 451 else arc = 0; 452 } else { 453 span = atof(ele); 454 } 455 ele = strtok_r(NULL, ":", &etok); 456 } 457 if (span == 0.0) { 458 char *back = (ttok != NULL) ? strstr(ttok, "-") : NULL; 459 if (back != NULL) { 460 span = b0 - end + atof(back); 461 } else { 462 span = b0 - end; 463 } 464 } 465 if (r1 != r0) { 466 p1 = radial(pos, r1, b0); 467 if (!((start == 180.0) && (end == 180.0))) 468 printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n", 469 p0.x, p0.y, p1.x, p1.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom])); 470 r0 = r1; 471 p0 = p1; 472 } 473 if (span < 0.0) { 474 b1 = end - span; 475 b1 = b1 > b0 ? b0 : b1; 476 b0 = b1; 477 b1 = end; 478 p0 = radial(pos, r0, b0); 479 } else { 480 b1 = b0 - span; 481 b1 = b1 < end ? end : b1; 482 } 483 p1 = radial(pos, r1, b1); 484 if ((b0 == 180.0) && (b1 == 180.0)) { 485 span = 360.0; 486 p1 = radial(pos, r1, b1+0.01); 487 } 488 if (arc == 0) { 489 if (p0.x < p1.x) 490 printf("<path id=\"%d\" d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n", 491 ++ref, p0.x, p0.y, r1*mile, r1*mile, span>180.0, p1.x, p1.y, col, (20 * symbolScale[zoom])); 492 else 493 printf("<path id=\"%d\" d=\"M %g,%g A %g,%g,0,%d,0,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n", 494 ++ref, p1.x, p1.y, r1*mile, r1*mile, span>180.0, p0.x, p0.y, col, (20 * symbolScale[zoom])); 495 if (text != NULL) { 496 double chord = sqrt(pow((p0.x - p1.x), 2) + pow((p0.y - p1.y), 2)); 497 if ((chord > (strlen(text) * textScale[zoom] * 50)) || ((b0 == 180.0) && (b1 == 180.0))) 498 drawLineText(item, text, style, offset, dy, ref); 499 } 500 } else if (arc == 1) { 501 printf("<path d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g;stroke-opacity:0.5;stroke-dasharray:%g\"/>\n", 502 p0.x, p0.y, r1*mile, r1*mile, span>180.0, p1.x, p1.y, col, (10 * symbolScale[zoom]), (30 * symbolScale[zoom])); 503 } 504 if ((arc == 0) && (att->val.val.l->next != NULL)) { 505 char *col = light_colours[att->val.val.l->next->val]; 506 double r2 = r1 - (20 * symbolScale[zoom]/mile); 507 XY_t p2 = radial(pos, r2, b0); 508 XY_t p3 = radial(pos, r2, b1); 509 printf("<path d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n", 510 p2.x, p2.y, r1*mile, r1*mile, span>180.0, p3.x, p3.y, col, (20 * symbolScale[zoom])); 511 } 512 b0 = b1; 513 if (b0 == end) break; 514 } 515 if (!((start == 180.0) && (end == 180.0))) 516 printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n", 517 pos.x, pos.y, p1.x, p1.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom])); 518 free(radstr); 519 } 520 } 521 } 522 } 371 final Att matches[] = { Att.SIGPER, Att.SIGGRP, Att.MLTYLT, Att.LITCHR, Att.CATLIT, Att.HEIGHT }; 372 ArrayList<ArrayList<AttMap>> groups = new ArrayList<ArrayList<AttMap>>(); 373 for (AttMap sector : lights.values()) { 374 if (sector.containsKey(Att.COLOUR)) { 375 boolean equal = false; 376 for (ArrayList<AttMap> group : groups) { 377 AttMap member = group.get(0); 378 for (Att match : matches) { 379 if (!((sector.containsKey(match) && member.containsKey(match) && sector.get(match).val.equals(member.get(match).val)) || (!sector.containsKey(match) && !member.containsKey(match)))) { 380 equal = false; 381 break; 382 } else { 383 equal = true; 384 } 385 } 386 if (equal) { 387 group.add(sector); 388 break; 389 } 390 } 391 if (!equal) { 392 ArrayList<AttMap> group = new ArrayList<AttMap>(); 393 group.add(sector); 394 groups.add(group); 395 } 396 } 397 } 398 for (boolean sorted = false; !sorted;) { 399 sorted = true; 400 for (int i = 0; i < groups.size()-1; i ++) { 401 if (groups.get(i).size() < groups.get(i+1).size()) { 402 ArrayList<AttMap> tmp = groups.remove(i); 403 groups.add(i+1, tmp); 404 sorted = false; 405 } 406 } 407 } 408 for (ArrayList<AttMap> group : groups) { 409 for (boolean sorted = false; !sorted;) { 410 sorted = true; 411 for (int i = 0; i < group.size()-1; i ++) { 412 AttMap m0 = group.get(i); 413 AttMap m1 = group.get(i+1); 414 if (((m0.containsKey(Att.VALNMR) && m1.containsKey(Att.VALNMR) && ((int)m0.get(Att.VALNMR).val < (int)m1.get(Att.VALNMR).val))) 415 || (!m0.containsKey(Att.VALNMR) && m1.containsKey(Att.VALNMR))) { 416 AttMap tmp = group.remove(i); 417 group.add(i+1, tmp); 418 sorted = false; 419 } 420 } 421 } 422 } 423 } 424 523 425 } 524 char *charString(Item_t *item, char *type, int idx) {525 strcpy(string1, "");526 Att_t *att = NULL;527 Obj_t *obj = getObj(item, enumType(type), idx);528 switch (enumType(type)) {529 case LIGHTS:530 {531 int secmax = countObjects(item, "light");532 if ((idx == 0) && (secmax > 0)) {533 struct SECT {534 struct SECT *next;535 int dir;536 LitCHR_t chr;537 ColCOL_t col;538 ColCOL_t alt;539 char *grp;540 double per;541 double rng;542 } *lights = NULL;543 for (int i = secmax; i > 0; i--) {544 struct SECT *tmp = calloc(1, sizeof(struct SECT));545 tmp->next = lights;546 lights = tmp;547 obj = getObj(item, LIGHTS, i);548 if ((att = getAtt(obj, CATLIT)) != NULL) {549 lights->dir = testAtt(att, LIT_DIR);550 }551 if ((att = getAtt(obj, LITCHR)) != NULL) {552 lights->chr = att->val.val.e;553 switch (lights->chr) {554 case CHR_AL:555 lights->chr = CHR_F;556 break;557 case CHR_ALOC:558 lights->chr = CHR_OC;559 break;560 case CHR_ALLFL:561 lights->chr = CHR_LFL;562 break;563 case CHR_ALFL:564 lights->chr = CHR_FL;565 break;566 case CHR_ALFFL:567 lights->chr = CHR_FFL;568 break;569 default:570 break;571 }572 }573 if ((att = getAtt(obj, SIGGRP)) != NULL) {574 lights->grp = att->val.val.a;575 } else {576 lights->grp = "";577 }578 if ((att = getAtt(obj, SIGPER)) != NULL) {579 lights->per = att->val.val.f;580 }581 if ((att = getAtt(obj, VALNMR)) != NULL) {582 lights->rng = att->val.val.f;583 }584 if ((att = getAtt(obj, COLOUR)) != NULL) {585 lights->col = att->val.val.l->val;586 if (att->val.val.l->next != NULL)587 lights->alt = att->val.val.l->next->val;588 }589 }590 struct COLRNG {591 int col;592 double rng;593 } colrng[14];594 while (lights != NULL) {595 strcpy(string2, "");596 bzero(colrng, 14*sizeof(struct COLRNG));597 colrng[lights->col].col = 1;598 colrng[lights->col].rng = lights->rng;599 struct SECT *this = lights;600 struct SECT *next = lights->next;601 while (next != NULL) {602 if ((this->dir == next->dir) && (this->chr == next->chr) &&603 (strcmp(this->grp, next->grp) == 0) && (this->per == next->per)) {604 colrng[next->col].col = 1;605 if (next->rng > colrng[next->col].rng)606 colrng[next->col].rng = next->rng;607 struct SECT *tmp = lights;608 while (tmp->next != next) tmp = tmp->next;609 tmp->next = next->next;610 free(next);611 next = tmp->next;612 } else {613 next = next->next;614 }615 }616 if (this->chr != CHR_UNKN) {617 if (this->dir) strcpy(string2, "Dir.");618 strcat(string2, light_characters[this->chr]);619 if (strcmp(this->grp, "") != 0) {620 if (this->grp[0] == '(')621 sprintf(strchr(string2, 0), "%s", this->grp);622 else623 sprintf(strchr(string2, 0), "(%s)", this->grp);624 } else {625 if (strlen(string2) > 0) strcat(string2, ".");626 }627 int n = 0;628 for (int i = 0; i < 14; i++) if (colrng[i].col) n++;629 double max = 0.0;630 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng > max)) max = colrng[i].rng;631 double min = max;632 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng > 0.0) && (colrng[i].rng < min)) min = colrng[i].rng;633 if (min == max) {634 for (int i = 0; i < 14; i++) if (colrng[i].col) strcat(string2, light_letters[i]);635 } else {636 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng == max)) strcat(string2, light_letters[i]);637 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng < max) && (colrng[i].rng > min)) strcat(string2, light_letters[i]);638 for (int i = 0; i < 14; i++) if (colrng[i].col && colrng[i].rng == min) strcat(string2, light_letters[i]);639 }640 strcat(string2, ".");641 if (this->per > 0.0) sprintf(strchr(string2, 0), "%gs", this->per);642 if (max > 0.0) {643 sprintf(strchr(string2, 0), "%g", max);644 if (min != max) {645 if (n == 2) strcat(string2, "/");646 else if (n > 2) strcat(string2, "-");647 if (min < max) sprintf(strchr(string2, 0), "%g", min);648 }649 strcat(string2, "M");650 }651 if (strlen(string1) > 0) strcat(string1, "\n");652 strcat(string1, string2);653 }654 lights = this->next;655 free(this);656 this = lights;657 }658 } else {659 if ((att = getAtt(obj, CATLIT)) != NULL) {660 if (testAtt(att, LIT_DIR))661 strcat(string1, "Dir");662 }663 if ((att = getAtt(obj, MLTYLT)) != NULL)664 sprintf(strchr(string1, 0), "%s", stringValue(att->val));665 if ((att = getAtt(obj, LITCHR)) != NULL) {666 char *chrstr = strdup(stringValue(att->val));667 Att_t *grp = getAtt(obj, SIGGRP);668 if (grp != NULL) {669 char *strgrp = strdup(stringValue(grp->val));670 char *grpstr = strtok(strgrp, "()");671 switch (att->val.val.e) {672 case CHR_QLFL:673 sprintf(strchr(string1, 0), "Q(%s)+LFl", grpstr);674 break;675 case CHR_VQLFL:676 sprintf(strchr(string1, 0), "VQ(%s)+LFl", grpstr);677 break;678 case CHR_UQLFL:679 sprintf(strchr(string1, 0), "UQ(%s)+LFl", grpstr);680 break;681 default:682 sprintf(strchr(string1, 0), "%s(%s)", chrstr, grpstr);683 break;684 }685 free(strgrp);686 } else {687 sprintf(strchr(string1, 0), "%s", chrstr);688 }689 free(chrstr);690 }691 if ((att = getAtt(obj, COLOUR)) != NULL) {692 int n = countValues(att);693 if (!((n == 1) && (idx == 0) && (testAtt(att, COL_WHT)))) {694 if ((strlen(string1) > 0) && ((string1[strlen(string1)-1] != ')')))695 strcat(string1, ".");696 Lst_t *lst = att->val.val.l;697 while (lst != NULL) {698 strcat(string1, light_letters[lst->val]);699 lst = lst->next;700 }701 }702 }703 if ((idx == 0) && (att = getAtt(obj, CATLIT)) != NULL) {704 if (testAtt(att, LIT_VERT))705 strcat(string1, "(vert)");706 if (testAtt(att, LIT_HORI))707 strcat(string1, "(hor)");708 }709 if ((strlen(string1) > 0) &&710 ((getAtt(obj, SIGPER) != NULL) ||711 (getAtt(obj, HEIGHT) != NULL) ||712 (getAtt(obj, VALMXR) != NULL)) &&713 (string1[strlen(string1)-1] != ')'))714 strcat(string1, ".");715 if ((att = getAtt(obj, SIGPER)) != NULL)716 sprintf(strchr(string1, 0), "%ss", stringValue(att->val));717 if ((idx == 0) && (item->objs.obj != LITMIN)) {718 if ((att = getAtt(obj, HEIGHT)) != NULL)719 sprintf(strchr(string1, 0), "%sm", stringValue(att->val));720 if ((att = getAtt(obj, VALNMR)) != NULL)721 sprintf(strchr(string1, 0), "%sM", stringValue(att->val));722 }723 if ((idx == 0) && (att = getAtt(obj, CATLIT)) != NULL) {724 if (testAtt(att, LIT_FRNT))725 strcat(string1, "(Front)");726 if (testAtt(att, LIT_REAR))727 strcat(string1, "(Rear)");728 if (testAtt(att, LIT_UPPR))729 strcat(string1, "(Upper)");730 if (testAtt(att, LIT_LOWR))731 strcat(string1, "(Lower)");732 }733 }734 }735 break;736 default: break;737 }738 return string1;739 }740 */741 742 } -
applications/editors/josm/plugins/seachart/src/s57/S57dat.java
r30894 r31063 11 11 12 12 import java.io.UnsupportedEncodingException; 13 import java.util.ArrayList; 14 import java.util.Arrays; 15 import java.util.EnumMap; 13 import java.util.*; 16 14 17 15 public class S57dat { -
applications/editors/josm/plugins/seachart/src/s57/S57dec.java
r30894 r31063 22 22 byte[] leader = new byte[24]; 23 23 boolean ddr = false; 24 int length ;25 int fields ;24 int length = 0; 25 int fields = 0;; 26 26 int mapfl, mapfp, mapts, entry; 27 27 String tag; … … 39 39 40 40 while (in.read(leader) == 24) { 41 try { 41 42 length = Integer.parseInt(new String(leader, 0, 5)) - 24; 42 43 ddr = (leader[6] == 'L'); 43 44 fields = Integer.parseInt(new String(leader, 12, 5)) - 24; 45 } catch (Exception e) { 46 System.err.println("Invalid file format - Encrypted/compressed ENC file?"); 47 System.exit(-1); 48 } 44 49 mapfl = leader[20] - '0'; 45 50 mapfp = leader[21] - '0'; -
applications/editors/josm/plugins/seachart/src/s57/S57map.java
r31044 r31063 524 524 } 525 525 if (osm.att != Att.UNKATT) { 526 atts.put(osm.att, new AttVal<>(osm. att, osm.conv, osm.val));526 atts.put(osm.att, new AttVal<>(osm.conv, osm.val)); 527 527 } 528 528 } else { … … 536 536 objs.put(0, atts); 537 537 if (osm.att != Att.UNKATT) { 538 atts.put(osm.att, new AttVal<>(osm. att, osm.conv, osm.val));538 atts.put(osm.att, new AttVal<>(osm.conv, osm.val)); 539 539 } 540 540 index.put(++xref, base); -
applications/editors/josm/plugins/seachart/src/s57/S57val.java
r31027 r31063 35 35 36 36 public static class AttVal<V> { 37 public Att att;37 // public Att att; 38 38 public Conv conv; 39 39 public V val; 40 AttVal(Att a, Conv c, V v) { 41 att = a; conv = c; val = v; 40 // AttVal(Att a, Conv c, V v) { 41 // att = a; conv = c; val = v; 42 // } 43 AttVal(Conv c, V v) { 44 conv = c; val = v; 42 45 } 43 46 } … … 1129 1132 case A: 1130 1133 case S: 1131 return new AttVal<String>( att,conv, val);1134 return new AttVal<String>(conv, val); 1132 1135 case E: 1133 1136 ArrayList<Enum<?>> list = new ArrayList<Enum<?>>(); 1134 1137 list.add(s57Enum(val, att)); 1135 return new AttVal<ArrayList<?>>( att,Conv.E, list);1138 return new AttVal<ArrayList<?>>(Conv.E, list); 1136 1139 case L: 1137 1140 list = new ArrayList<Enum<?>>(); … … 1139 1142 list.add(s57Enum(item, att)); 1140 1143 } 1141 return new AttVal<ArrayList<?>>( att,Conv.L, list);1144 return new AttVal<ArrayList<?>>(Conv.L, list); 1142 1145 case I: 1143 1146 try { 1144 return new AttVal<Long>( att,Conv.I, Long.parseLong(val));1147 return new AttVal<Long>(Conv.I, Long.parseLong(val)); 1145 1148 } catch (Exception e) { 1146 1149 break; … … 1148 1151 case F: 1149 1152 try { 1150 return new AttVal<Double>( att,Conv.F, Double.parseDouble(val));1153 return new AttVal<Double>(Conv.F, Double.parseDouble(val)); 1151 1154 } catch (Exception e) { 1152 1155 break; … … 1165 1168 } 1166 1169 1167 1168 public static String stringValue(AttVal<?> attval) { // Convert SCM value object to OSM attribute value string 1170 public static String stringValue(AttVal<?> attval, Att att) { // Convert SCM value object to OSM attribute value string 1169 1171 if (attval != null) { 1170 1172 switch (attval.conv) { … … 1173 1175 return (String) attval.val; 1174 1176 case E: 1175 EnumMap<?, ?> map = keys.get(att val.att).map;1177 EnumMap<?, ?> map = keys.get(att).map; 1176 1178 return ((S57enum) map.get(((ArrayList<?>) attval.val).get(0))).val; 1177 1179 case L: 1178 1180 String str = ""; 1179 map = keys.get(att val.att).map;1181 map = keys.get(att).map; 1180 1182 for (Object item : (ArrayList<?>) attval.val) { 1181 1183 if (!str.isEmpty()) … … 1211 1213 case A: 1212 1214 case S: 1213 return new AttVal<String>( att,Conv.S, val);1215 return new AttVal<String>(Conv.S, val); 1214 1216 case E: 1215 1217 ArrayList<Enum<?>> list = new ArrayList<Enum<?>>(); 1216 1218 list.add(osmEnum(val, att)); 1217 return new AttVal<ArrayList<?>>( att,Conv.E, list);1219 return new AttVal<ArrayList<?>>(Conv.E, list); 1218 1220 case L: 1219 1221 list = new ArrayList<Enum<?>>(); … … 1221 1223 list.add(osmEnum(item, att)); 1222 1224 } 1223 return new AttVal<ArrayList<?>>( att,Conv.L, list);1225 return new AttVal<ArrayList<?>>(Conv.L, list); 1224 1226 case I: 1225 1227 try { 1226 return new AttVal<Long>( att,Conv.I, Long.parseLong(val));1228 return new AttVal<Long>(Conv.I, Long.parseLong(val)); 1227 1229 } catch (Exception e) { 1228 1230 break; … … 1230 1232 case F: 1231 1233 try { 1232 return new AttVal<Double>( att,Conv.F, Double.parseDouble(val));1234 return new AttVal<Double>(Conv.F, Double.parseDouble(val)); 1233 1235 } catch (Exception e) { 1234 1236 break; 1235 1237 } 1236 1238 } 1237 return new AttVal<Object>( att,keys.get(att).conv, null);1239 return new AttVal<Object>(keys.get(att).conv, null); 1238 1240 } 1239 1241 -
applications/editors/josm/plugins/seachart/src/symbols/Symbols.java
r31044 r31063 20 20 public class Symbols { 21 21 22 public static final Color Yland = new Color(0x f1c010);22 public static final Color Yland = new Color(0xedbc0c); 23 23 public static final Color Bwater = new Color(0x78acd2); 24 24 public static final Color Gdries = new Color(0x689868);
Note:
See TracChangeset
for help on using the changeset viewer.