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