001package armyc2.c5isr.JavaTacticalRenderer; 002 003import java.util.ArrayList; 004 005import armyc2.c5isr.JavaLineArray.POINT2; 006import armyc2.c5isr.JavaLineArray.TacticalLines; 007import armyc2.c5isr.graphics2d.BasicStroke; 008import armyc2.c5isr.graphics2d.Font; 009import armyc2.c5isr.graphics2d.TexturePaint; 010import armyc2.c5isr.renderer.utilities.Color; 011import armyc2.c5isr.renderer.utilities.ErrorLogger; 012import armyc2.c5isr.renderer.utilities.RendererException; 013import armyc2.c5isr.renderer.utilities.SymbolID; 014import armyc2.c5isr.renderer.utilities.SymbolUtilities; 015 016/** 017 * A class to encapsulate the tactical graphic object. Many of the properties 018 * correspond to a client MilStdSymbol object. 019 * 020 */ 021public class TGLight { 022 023 public ArrayList<POINT2> LatLongs; 024 private static final String _className = "TGLight"; 025 026 public ArrayList<POINT2> get_LatLongs() { 027 return LatLongs; 028 } 029 030 public void set_LatLongs(ArrayList<POINT2> value) { 031 LatLongs = value; 032 } 033 034 public ArrayList<POINT2> Pixels; 035 036 public ArrayList<POINT2> get_Pixels() { 037 return Pixels; 038 } 039 040 public void set_Pixels(ArrayList<POINT2> value) { 041 Pixels = value; 042 } 043 044 public ArrayList<Modifier2> modifiers; 045 046 public ArrayList<Modifier2> get_Modifiers() { 047 return modifiers; 048 } 049 050 public void set_Modifiers(ArrayList<Modifier2> value) { 051 modifiers = value; 052 } 053 054 TexturePaint tp = null; 055 056 public void set_TexturePaint(TexturePaint value) { 057 tp = value; 058 } 059 060 public TexturePaint get_TexturePaint() { 061 return tp; 062 } 063 064 boolean maskOff; 065 066 public TGLight() { 067 } 068 069 private Font font; 070 071 public void set_Font(Font value) { 072 font = value; 073 } 074 075 public Font get_Font() { 076 return font; 077 } 078 079 private int iconSize = 50; 080 081 /** 082 * Set the icon size for areas that have a symbol like LAA or Biological Contaminated Area 083 * @param pixelSize 084 */ 085 public void set_IconSize(int pixelSize){iconSize = pixelSize;} 086 087 public int get_IconSize(){return iconSize;} 088 089 private boolean keepUnitRatio = true; 090 091 public void set_KeepUnitRatio(boolean value) { 092 keepUnitRatio = value; 093 } 094 095 public boolean get_KeepUnitRation() { 096 return keepUnitRatio; 097 } 098 099 private int lineType; 100 101 public void set_LineType(int value) { 102 lineType = value; 103 } 104 105 public int get_LineType() { 106 return lineType; 107 } 108 109 private int lineStyle; 110 111 public void set_LineStyle(int value) { 112 lineStyle = value; 113 } 114 115 public int get_LineStyle() { 116 return lineStyle; 117 } 118 119 private Color lineColor; 120 121 public Color get_LineColor() { 122 return lineColor; 123 } 124 125 public void set_LineColor(Color value) { 126 lineColor = value; 127 } 128 129 private int fillStyle; 130 131 public int get_FillStyle() { 132 return fillStyle; 133 } 134 135 public void set_Fillstyle(int value) { 136 fillStyle = value; 137 } 138 139 private Color fillColor; 140 141 public Color get_FillColor() { 142 return fillColor; 143 } 144 145 public void set_FillColor(Color value) { 146 fillColor = value; 147 } 148 149 private Color fontBackColor = Color.WHITE; 150 151 //private Color fontBackColor=RendererSettings.getInstance().getLabelBackgroundColor(); 152 public Color get_FontBackColor() { 153 return fontBackColor; 154 } 155 156 public void set_FontBackColor(Color value) { 157 fontBackColor = value; 158 } 159 160 private Color textColor; 161 162 public Color get_TextColor() { 163 return textColor; 164 } 165 166 public void set_TextColor(Color value) { 167 textColor = value; 168 } 169 170 private int lineThickness; 171 172 public int get_LineThickness() { 173 return lineThickness; 174 } 175 176 public void set_LineThickness(int value) { 177 lineThickness = value; 178 } 179 180 private String t = ""; 181 182 public String get_Name() { 183 if (visibleModifiers) { 184 return t; 185 } else { 186 return ""; 187 } 188 } 189 190 private String client = ""; 191 192 public String get_Client() { 193 return client; 194 } 195 196 public void set_client(String value) { 197 client = value; 198 } 199 200 public void set_Name(String value) { 201 t = value; 202 } 203 204 private String t1 = ""; 205 206 public String get_T1() { 207 if (visibleModifiers) { 208 return t1; 209 } else { 210 return ""; 211 } 212 } 213 214 public void set_T1(String value) { 215 t1 = value; 216 } 217 218 private String am = ""; 219 220 public String get_AM() { 221 if (visibleModifiers) { 222 return am; 223 } else { 224 return ""; 225 } 226 } 227 228 public void set_AM(String value) { 229 am = value; 230 } 231 232 private String am1 = ""; 233 234 public String get_AM1() { 235 if (visibleModifiers) { 236 return am1; 237 } else { 238 return ""; 239 } 240 } 241 242 public void set_AM1(String value) { 243 am1 = value; 244 } 245 246 private String an = ""; 247 248 public String get_AN() { 249 if (visibleModifiers) { 250 return an; 251 } else { 252 return ""; 253 } 254 } 255 256 public void set_AN(String value) { 257 an = value; 258 } 259 260 private String v = ""; 261 262 public String get_V() { 263 if (visibleModifiers) { 264 return v; 265 } else { 266 return ""; 267 } 268 } 269 270 public void set_V(String value) { 271 v = value; 272 } 273 274 275 private String ap = ""; 276 277 public String get_AP() { 278 if (visibleModifiers) { 279 return ap; 280 } else { 281 return ""; 282 } 283 } 284 285 public void set_AP(String value) { 286 ap = value; 287 } 288 289 private String as = ""; 290 291 public String get_AS() { 292 if (visibleModifiers) { 293 return as; 294 } else { 295 return ""; 296 } 297 } 298 299 public void set_AS(String value) { 300 as = value; 301 } 302 303 private String x = ""; 304 305 public String get_X() { 306 return x; 307 } 308 309 public void set_X(String value) { 310 x = value; 311 } 312 313 private String x1 = ""; 314 315 public String get_X1() { 316 return x1; 317 } 318 319 public void set_X1(String value) { 320 x1 = value; 321 } 322 323 private String h = ""; 324 325 public String get_H() { 326 if (visibleModifiers || lineType == TacticalLines.RECTANGULAR) { 327 return h; 328 } else { 329 return ""; 330 } 331 } 332 333 public void set_H(String value) { 334 h = value; 335 } 336 337 public String get_Location() { 338 if (visibleModifiers) { 339 if (!y.isEmpty()) { 340 return y; 341 } else { 342 return h; 343 } 344 } else { 345 return ""; 346 } 347 } 348 349 public void set_Location(String value) { 350 y = value; 351 } 352 353 @Deprecated 354 private String h1 = ""; 355 356 /** 357 * @deprecated 358 */ 359 public String get_H1() { 360 if (visibleModifiers) { 361 return h1; 362 } else { 363 return ""; 364 } 365 } 366 367 /** 368 * @deprecated 369 */ 370 public void set_H1(String value) { 371 h1 = value; 372 } 373 374 //location 375 private String y = ""; 376 377 private String n = "ENY"; 378 379 public String get_N() { 380 return n; 381 } 382 383 public void set_N(String value) { 384 n = value; 385 } 386 387 @Deprecated 388 private String h2 = ""; 389 390 /** 391 * @deprecated 392 */ 393 public String get_H2() { 394 if (visibleModifiers || lineType == TacticalLines.RECTANGULAR) { 395 return h2; 396 } else { 397 return ""; 398 } 399 } 400 401 /** 402 * @deprecated 403 */ 404 public void set_H2(String value) { 405 h2 = value; 406 } 407 408 /** 409 * Only used for range fan 410 * left azimuth,right azimuth,min radius,max radius 411 */ 412 private String leftRightMinMax = ""; 413 414 public String get_LRMM() { 415 return leftRightMinMax; 416 } 417 418 public void set_LRMM(String value) { 419 leftRightMinMax = value; 420 } 421 422 private String w = ""; 423 424 public String get_DTG() { 425 if (visibleModifiers) { 426 return w; 427 } else { 428 return ""; 429 } 430 } 431 432 public void set_DTG(String value) { 433 w = value; 434 } 435 436 private String w1 = ""; 437 438 public String get_DTG1() { 439 if (visibleModifiers) { 440 return w1; 441 } else { 442 return ""; 443 } 444 } 445 446 public void set_DTG1(String value) { 447 w1 = value; 448 } 449 450 private String standardIdentity = "00"; 451 452 public String get_StandardIdentity(){ 453 return standardIdentity; 454 } 455 456 /** 457 * @return true if standard identity is suspect/joker or hostile/faker 458 */ 459 public boolean isHostile() { 460 if (standardIdentity != null) { 461 return standardIdentity.charAt(1) == '5' || standardIdentity.charAt(1) == '6'; 462 } else { 463 return false; 464 } 465 } 466 467 private String echelonSymbol = ""; 468 469 protected String get_EchelonSymbol() { 470 return echelonSymbol; 471 } 472 473 public void set_EchelonSymbol(String value) { 474 echelonSymbol = value; 475 } 476 477 private String symbolId = "00000000"; 478 479 public String get_SymbolId() { 480 return symbolId; 481 } 482 483 // "P" for present or "A" for anticipated 484 private String status = "P"; 485 486 public String get_Status() { 487 return status; 488 } 489 490 public void set_Status(String value) { 491 status = value; 492 } 493 494 /** 495 * Sets tactical graphic properties based on the 20-30 digit Mil-Std-2525 symbol code 496 * 497 * @param value 498 */ 499 public void set_SymbolId(String value) { 500 try { 501 symbolId = value; 502 int symbolSet = SymbolID.getSymbolSet(symbolId); 503 if (symbolSet == 25) { 504 standardIdentity = SymbolID.getStandardIdentity(symbolId) + ""; 505 if(standardIdentity.length()==1) 506 standardIdentity = "0" + standardIdentity; 507 508 status = "P"; // default to present 509 if (SymbolID.getStatus(symbolId) == 1) { 510 // Planned/Anticipated/Suspect 511 status = "A"; 512 lineStyle = 1; // dashed 513 } 514 515 int amplifier = SymbolID.getAmplifierDescriptor(symbolId); 516 echelonSymbol = SymbolUtilities.getEchelonText(amplifier); 517 if (echelonSymbol == null) { 518 echelonSymbol = ""; 519 } 520 } 521 } catch (Exception exc) { 522 //clsUtility.WriteFile("Error in TGLight.set_SymbolId"); 523 ErrorLogger.LogException(_className, "set_SymbolId", 524 new RendererException("Failed inside set_SymbolId", exc)); 525 } 526 } 527 528 @Deprecated // value is always true 529 private boolean visibleModifiers = true; 530 531 /** 532 * @deprecated 533 */ 534 public void set_VisibleModifiers(boolean value) { 535 visibleModifiers = value; 536 } 537 538 /** 539 * @deprecated 540 */ 541 protected boolean get_VisibleModifiers() { 542 return visibleModifiers; 543 } 544 545 @Deprecated // value is never used 546 private boolean visibleLabels; 547 548 /** 549 * @deprecated 550 */ 551 public void set_VisibleLabels(boolean value) { 552 visibleLabels = value; 553 } 554 555 /** 556 * @deprecated 557 */ 558 protected boolean get_VisibleLabels() { 559 return visibleLabels; 560 } 561 562 boolean _useLineInterpolation = false; 563 564 public boolean get_UseLineInterpolation() { 565 return _useLineInterpolation; 566 } 567 568 public void set_UseLineInterpolation(boolean value) { 569 _useLineInterpolation = value; 570 } 571 572 boolean _useDashArray = false; 573 574 public boolean get_UseDashArray() { 575 return _useDashArray; 576 } 577 578 public void set_UseDashArray(boolean value) { 579 _useDashArray = value; 580 } 581 582 boolean _useHatchFill = false; 583 584 public boolean get_UseHatchFill() { 585 return _useHatchFill; 586 } 587 588 public void set_UseHatchFill(boolean value) { 589 _useHatchFill = value; 590 } 591 592// boolean _usePatternFill = false; 593// public boolean get_UsePatternFill() { 594// return _usePatternFill; 595// } 596// 597// public void set_UsePatternFill(boolean value) { 598// _usePatternFill = value; 599// } 600 601 private boolean _wasClipped = false; 602 603 public void set_WasClipped(boolean value) { 604 _wasClipped = value; 605 } 606 607 public boolean get_WasClipped() { 608 return _wasClipped; 609 } 610 611 //boolean determines whether to add the range and azimuth modifiers for range fans 612 private boolean _HideOptionalLabels = false; 613 614 public boolean get_HideOptionalLabels() { 615 return _HideOptionalLabels; 616 } 617 618 public void set_HideOptionalLabels(boolean value) { 619 _HideOptionalLabels = value; 620 } 621 622 private int lineCap = BasicStroke.CAP_SQUARE; 623 624 public void set_lineCap(int cap) { 625 lineCap = cap; 626 } 627 628 public int get_lineCap() { 629 return lineCap; 630 } 631}