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