Changeset 26450 in osm for applications/editors/josm
- Timestamp:
- 2011-08-05T08:34:59+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r26307 r26450 237 237 public void setSectored(boolean sectored) { 238 238 Sectored = sectored; 239 if (sectored) { 240 LightColour[0] = ""; 241 } else { 239 if (!sectored) { 242 240 setSectorIndex(0); 243 241 setLightChar(""); … … 272 270 273 271 public void setLightChar(String lightChar) { 274 if (SectorIndex == 0) { 275 LightChar = new String[10]; 276 LightChar[0] = lightChar; 277 } else if (LightChar[0].isEmpty()) 278 LightChar[SectorIndex] = lightChar; 272 LightChar[SectorIndex] = lightChar; 279 273 } 280 274 … … 300 294 301 295 public void setLightGroup(String lightGroup) { 302 if (SectorIndex == 0)303 LightGroup = new String[10];304 296 LightGroup[SectorIndex] = lightGroup; 305 297 } … … 322 314 323 315 public void setHeight(String height) { 324 if (SectorIndex == 0)325 Height = new String[10];326 316 Height[SectorIndex] = height; 327 317 } … … 336 326 337 327 public void setRange(String range) { 338 if (SectorIndex == 0)339 Range = new String[10];340 328 Range[SectorIndex] = range; 341 329 } … … 350 338 351 339 public void setSeq(String seq) { 352 if (SectorIndex == 0)353 Sequence = new String[10];354 340 Sequence[SectorIndex] = seq; 355 341 } … … 364 350 365 351 public void setBearing1(String bearing) { 366 if (SectorIndex == 0)367 Bearing1 = new String[10];368 352 Bearing1[SectorIndex] = bearing; 369 353 } … … 378 362 379 363 public void setBearing2(String bearing) { 380 if (SectorIndex == 0)381 Bearing2 = new String[10];382 364 Bearing2[SectorIndex] = bearing; 383 365 } … … 392 374 393 375 public void setRadius(String radius) { 394 if (SectorIndex == 0)395 Radius = new String[10];396 376 Radius[SectorIndex] = radius; 397 377 } … … 421 401 } 422 402 } 423 if (SectorIndex == 0)424 LightPeriod = new String[10];425 403 LightPeriod[SectorIndex] = lightPeriod; 426 404 } … … 502 480 else if (values[0].equals("white")) 503 481 LightColour[index] = "W"; 482 else if (values[0].equals("yellow")) 483 LightColour[index] = "Y"; 504 484 if (values.length > 1) 505 485 Bearing1[index] = values[1]; … … 507 487 Bearing2[index] = values[2]; 508 488 if (values.length > 3) 509 Radius[index] = values[3];489 Radius[index] = String.valueOf((((Integer.parseInt(values[3])*100)+50)/278)/100.0); 510 490 } else { 511 491 index = 0; … … 528 508 else if (value.equals("white")) 529 509 LightColour[index] = "W"; 510 else if (value.equals("yellow")) 511 LightColour[index] = "Y"; 530 512 } else if (key.equals("character")) { 531 513 LightChar[index] = value; … … 544 526 } else if (key.equals("sector_end")) { 545 527 Bearing2[index] = value; 528 } else if (key.equals("radius")) { 529 Radius[index] = value; 546 530 } 547 531 } … … 925 909 String colour; 926 910 if (dlg.cM01Fired.isSelected()) { 927 if (!(colour = LightColour[0]).isEmpty() && !Sectored)911 if (!(colour = LightColour[0]).isEmpty()) { 928 912 if (colour.equals("R")) { 929 913 Main.main.undoRedo.add(new ChangePropertyCommand(Node, … … 935 919 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 936 920 "seamark:light:colour", "white")); 921 } else if (colour.equals("Y")) { 922 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 923 "seamark:light:colour", "yellow")); 937 924 } 925 } 938 926 939 927 if (!LitRef.isEmpty()) … … 977 965 "seamark:light:sequence", Sequence[0])); 978 966 967 if (!Radius[0].isEmpty()) 968 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 969 "seamark:light:radius", Radius[0])); 970 979 971 for (int i = 1; i < 10; i++) { 980 if ((colour = LightColour[i]) != null) 981 if (colour.equals("R")) { 972 973 if (LightColour[i] != null) { 974 if (LightColour[i].equals("R")) { 982 975 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 983 976 "seamark:light:" + i + ":colour", "red")); 984 if ((Bearing1[i] != null) && (Bearing2[i] != null) 985 && (Radius[i] != null)) 986 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 987 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 988 + Bearing2[i] + ":" + Radius[i])); 989 } else if (colour.equals("G")) { 977 } 978 else if (LightColour[i].equals("G")) { 990 979 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 991 980 "seamark:light:" + i + ":colour", "green")); 992 if ((Bearing1[i] != null) && (Bearing2[i] != null) 993 && (Radius[i] != null)) 994 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 995 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 996 + Bearing2[i] + ":" + Radius[i])); 997 } else if (colour.equals("W")) { 981 } 982 else if (LightColour[i].equals("W")) { 998 983 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 999 984 "seamark:light:" + i + ":colour", "white")); 1000 if ((Bearing1[i] != null) && (Bearing2[i] != null)1001 && (Radius[i] != null))1002 1003 "seamark:light:" + i, "white:" + Bearing1[i] + ":"1004 + Bearing2[i] + ":" + Radius[i]));1005 985 } 986 else if (LightColour[i].equals("Y")) { 987 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 988 "seamark:light:" + i + ":colour", "yellow")); 989 } 990 } 1006 991 1007 992 if (LightPeriod[i] != null) … … 1036 1021 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 1037 1022 "seamark:light:" + i + ":sector_end", Bearing2[i])); 1023 1024 if (Radius[i] != null) 1025 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 1026 "seamark:light:" + i + ":radius", Radius[i])); 1038 1027 } 1039 1028 }
Note:
See TracChangeset
for help on using the changeset viewer.