001/* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005package armyc2.c2sd.JavaTacticalRenderer; 006 007import java.util.ArrayList; 008import armyc2.c2sd.JavaLineArray.POINT2; 009import armyc2.c2sd.renderer.utilities.ErrorLogger; 010import armyc2.c2sd.renderer.utilities.RendererException; 011import armyc2.c2sd.JavaLineArray.TacticalLines; 012import armyc2.c2sd.renderer.utilities.Color; 013import armyc2.c2sd.graphics2d.*; 014 015/** 016 * A class to encapsulate the tactical graphic object. Many of the properties 017 * correspond to a client MilStdSymbol object. 018 * 019 * @author Michael Deutch 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 public ArrayList<POINT2> Pixels; 034 035 public ArrayList<POINT2> get_Pixels() { 036 return Pixels; 037 } 038 039 public void set_Pixels(ArrayList<POINT2> value) { 040 Pixels = value; 041 } 042 public ArrayList<Modifier2> modifiers; 043 044 public ArrayList<Modifier2> get_Modifiers() { 045 return modifiers; 046 } 047 048 public void set_Modifiers(ArrayList<Modifier2> value) { 049 modifiers = value; 050 } 051 TexturePaint tp = null; 052 053 public void set_TexturePaint(TexturePaint value) { 054 tp = value; 055 } 056 057 public TexturePaint get_TexturePaint() { 058 return tp; 059 } 060 061 boolean maskOff; 062 063 public TGLight() { 064 } 065 private Font font; 066 067 public void set_Font(Font value) { 068 font = value; 069 } 070 071 public Font get_Font() { 072 return font; 073 } 074 private int lineType; 075 076 public void set_LineType(int value) { 077 lineType = value; 078 } 079 080 public int get_LineType() { 081 return lineType; 082 } 083 private int lineStyle; 084 085 public void set_LineStyle(int value) { 086 lineStyle = value; 087 } 088 089 public int get_LineStyle() { 090 return lineStyle; 091 } 092 private Color lineColor; 093 094 public Color get_LineColor() { 095 return lineColor; 096 } 097 098 public void set_LineColor(Color value) { 099 lineColor = value; 100 } 101 private int fillStyle; 102 103 public int get_FillStyle() { 104 return fillStyle; 105 } 106 107 public void set_Fillstyle(int value) { 108 fillStyle = value; 109 } 110 private Color fillColor; 111 112 public Color get_FillColor() { 113 return fillColor; 114 } 115 116 public void set_FillColor(Color value) { 117 fillColor = value; 118 } 119 private Color fontBackColor = Color.WHITE; 120 121 //private Color fontBackColor=RendererSettings.getInstance().getLabelBackgroundColor(); 122 public Color get_FontBackColor() { 123 return fontBackColor; 124 } 125 126 public void set_FontBackColor(Color value) { 127 fontBackColor = value; 128 } 129 private Color textColor; 130 131 public Color get_TextColor() { 132 return textColor; 133 } 134 135 public void set_TextColor(Color value) { 136 textColor = value; 137 } 138 private int lineThickness; 139 140 public int get_LineThickness() { 141 return lineThickness; 142 } 143 144 public void set_LineThickness(int value) { 145 lineThickness = value; 146 } 147 private String t = ""; 148 149 public String get_Name() { 150 if (visibleModifiers) { 151 return t; 152 } else { 153 return ""; 154 } 155 } 156 private String client = ""; 157 158 public String get_Client() { 159 return client; 160 } 161 162 public void set_client(String value) { 163 client = value; 164 } 165 166 public void set_Name(String value) { 167 t = value; 168 } 169 private String t1 = ""; 170 171 public String get_T1() { 172 if (visibleModifiers) { 173 return t1; 174 } else { 175 return ""; 176 } 177 } 178 179 public void set_T1(String value) { 180 t1 = value; 181 } 182 private String h = ""; 183 184 public String get_H() { 185 if (visibleModifiers || lineType == TacticalLines.RECTANGULAR) { 186 return h; 187 } else { 188 return ""; 189 } 190 } 191 192 public void set_H(String value) { 193 h = value; 194 } 195 196 public String get_Location() { 197 if (visibleModifiers) { 198 return y; 199 } else { 200 return ""; 201 } 202 } 203 204 public void set_Location(String value) { 205 y = value; 206 } 207 private String h1 = ""; 208 209 public String get_H1() { 210 if (visibleModifiers) { 211 return h1; 212 } else { 213 return ""; 214 } 215 } 216 217 public void set_H1(String value) { 218 h1 = value; 219 } 220 //location 221 private String y = ""; 222 223 private String n = "ENY"; 224 225 public String get_N() { 226 return n; 227 } 228 229 public void set_N(String value) { 230 n = value; 231 } 232 233 private String h2 = ""; 234 235 public String get_H2() { 236 if (visibleModifiers || lineType == TacticalLines.RECTANGULAR) { 237 return h2; 238 } else { 239 return ""; 240 } 241 } 242 243 public void set_H2(String value) { 244 h2 = value; 245 } 246 private String w = ""; 247 248 public String get_DTG() { 249 if (visibleModifiers) { 250 return w; 251 } else { 252 return ""; 253 } 254 } 255 256 public void set_DTG(String value) { 257 w = value; 258 } 259 private String w1 = ""; 260 261 public String get_DTG1() { 262 if (visibleModifiers) { 263 return w1; 264 } else { 265 return ""; 266 } 267 } 268 269 public void set_DTG1(String value) { 270 w1 = value; 271 } 272 273 private String affiliation; 274 275 public String get_Affiliation() { 276 return affiliation; 277 } 278 279 public void set_Affiliation(String value) { 280 affiliation = value; 281 } 282 private String echelon; 283 284 protected String get_Echelon() { 285 return echelon; 286 } 287 288 public void set_Echelon(String value) { 289 echelon = value; 290 } 291 private String echelonSymbol = ""; 292 293 protected String get_EchelonSymbol() { 294 return echelonSymbol; 295 } 296 297 public void set_EcheclonSymbol(String value) { 298 echelonSymbol = value; 299 } 300 private String symbolId; 301 302 public String get_SymbolId() { 303 return symbolId; 304 } 305 private String status; 306 307 public String get_Status() { 308 if (symbolId.equalsIgnoreCase("BS_AREA--------")) { 309 return "P"; 310 } 311 return status; 312 } 313 314 public void set_Status(String value) { 315 status = value; 316 } 317 318 /** 319 * Sets tactical graphic properties based on a string value, either a 320 * generic name or the 15 character Mil-Std-2525 symbol code. 321 * 322 * @param value 323 */ 324 public void set_SymbolId(String value) { 325 try { 326 symbolId = value; 327 char letter; 328 String s; 329 if (symbolId.length() == 15) //MilStd2525 15 character symbol code 330 { 331 status = symbolId.substring(3, 4); 332 if (status.equals("A") && !value.equalsIgnoreCase("BS_AREA--------")) { 333 lineStyle = 1; //dashed 334 } 335 //set the affiliation from the symbol id 336 affiliation = symbolId.substring(1, 2); 337 338 //set the echelon from the symbol id 339 echelon = symbolId.substring(11, 12); 340 } 341 else if (symbolId.length() >= 20) 342 { 343 String setA = symbolId.substring(0, 10); 344 String symbolSet = setA.substring(4, 6); 345 if (symbolSet.equalsIgnoreCase("25")) 346 { 347 affiliation = setA.substring(2, 4); 348 if (affiliation.equalsIgnoreCase("03")) { 349 affiliation = "F"; 350 } else if (affiliation.equalsIgnoreCase("06")) { 351 affiliation = "H"; 352 } 353 status = setA.substring(6, 7); 354 if (status.equalsIgnoreCase("0")) { 355 status = "P"; 356 } else if (status.equalsIgnoreCase("1")) { 357 status = "A"; 358 } 359 if (status.equalsIgnoreCase("A")) { 360 lineStyle = 1; //dashed 361 } 362 echelon = setA.substring(8); 363 if (echelon.equalsIgnoreCase("11")) { 364 echelon = "A"; 365 } else if (echelon.equalsIgnoreCase("12")) { 366 echelon = "B"; 367 } else if (echelon.equalsIgnoreCase("13")) { 368 echelon = "C"; 369 } else if (echelon.equalsIgnoreCase("14")) { 370 echelon = "D"; 371 } else if (echelon.equalsIgnoreCase("15")) { 372 echelon = "E"; 373 } else if (echelon.equalsIgnoreCase("16")) { 374 echelon = "F"; 375 } else if (echelon.equalsIgnoreCase("17")) { 376 echelon = "G"; 377 } else if (echelon.equalsIgnoreCase("18")) { 378 echelon = "H"; 379 } else if (echelon.equalsIgnoreCase("21")) { 380 echelon = "I"; 381 } else if (echelon.equalsIgnoreCase("22")) { 382 echelon = "J"; 383 } else if (echelon.equalsIgnoreCase("23")) { 384 echelon = "K"; 385 } else if (echelon.equalsIgnoreCase("24")) { 386 echelon = "L"; 387 } else if (echelon.equalsIgnoreCase("M")) { 388 echelon = "M"; 389 } 390 } 391 } 392 if (echelon.equals("M")) //REGION 393 { 394 echelonSymbol = "XXXXXX"; 395 } else if (echelon.equals("L")) //FRONT 396 { 397 echelonSymbol = "XXXXX"; 398 } else if (echelon.equals("K")) //ARMY 399 { 400 echelonSymbol = "XXXX"; 401 } else if (echelon.equals("J")) //CORPS 402 { 403 echelonSymbol = "XXX"; 404 } else if (echelon.equals("I")) //DIVISION 405 { 406 echelonSymbol = "XX"; 407 } else if (echelon.equals("H")) //BRIGADE 408 { 409 echelonSymbol = "X"; 410 } else if (echelon.equals("G")) //REGIMENT 411 { 412 echelonSymbol = "III"; 413 } else if (echelon.equals("F")) //BATTALION 414 { 415 echelonSymbol = "II"; 416 } else if (echelon.equals("E")) //COMPANY 417 { 418 echelonSymbol = "I"; 419 } else if (echelon.equals("D")) //PLATOON 420 { 421 letter = (char) 9679; 422 s = Character.toString(letter); 423 echelonSymbol = s + s + s; 424 } else if (echelon.equals("C")) //SECTION 425 { 426 letter = (char) 9679; 427 s = Character.toString(letter); 428 echelonSymbol = s + s; 429 } else if (echelon.equals("B")) //SQUAD 430 { 431 letter = (char) 9679; 432 s = Character.toString(letter); 433 echelonSymbol = s; 434 } else if (echelon.equals("A")) //GROUP 435 { 436 letter = (char) 216; 437 echelonSymbol = Character.toString(letter); 438 } 439 } catch (Exception exc) { 440 //clsUtility.WriteFile("Error in TGLight.set_SymbolId"); 441 ErrorLogger.LogException(_className, "set_SymbolId", 442 new RendererException("Failed inside set_SymbolId", exc)); 443 } 444 } 445 private boolean visibleModifiers; 446 447 public void set_VisibleModifiers(boolean value) { 448 visibleModifiers = value; 449 } 450 451 protected boolean get_VisibleModifiers() { 452 return visibleModifiers; 453 } 454 private boolean visibleLabels; 455 456 public void set_VisibleLabels(boolean value) { 457 visibleLabels = value; 458 } 459 460 protected boolean get_VisibleLabels() { 461 return visibleLabels; 462 } 463 int _SymbologyStandard = 0; 464 465 public void setSymbologyStandard(int standard) { 466 _SymbologyStandard = standard; 467 } 468 469 /** 470 * Current symbology standard 471 * 472 * @return symbologyStandard Like 473 * RendererSettings.Symbology_2525Bch2_USAS_13_14 474 */ 475 public int getSymbologyStandard() { 476 return _SymbologyStandard; 477 } 478 boolean _useLineInterpolation = false; 479 480 public boolean get_UseLineInterpolation() { 481 return _useLineInterpolation; 482 } 483 484 public void set_UseLineInterpolation(boolean value) { 485 _useLineInterpolation = value; 486 } 487 boolean _useDashArray = false; 488 489 public boolean get_UseDashArray() { 490 return _useDashArray; 491 } 492 493 public void set_UseDashArray(boolean value) { 494 _useDashArray = value; 495 } 496 497 boolean _useHatchFill = false; 498 499 public boolean get_UseHatchFill() { 500 return _useHatchFill; 501 } 502 503 public void set_UseHatchFill(boolean value) { 504 _useHatchFill = value; 505 } 506 507// boolean _usePatternFill = false; 508// public boolean get_UsePatternFill() { 509// return _usePatternFill; 510// } 511// 512// public void set_UsePatternFill(boolean value) { 513// _usePatternFill = value; 514// } 515 516 private boolean _wasClipped=false; 517 public void set_WasClipped(boolean value) 518 { 519 _wasClipped=value; 520 } 521 public boolean get_WasClipped() 522 { 523 return _wasClipped; 524 } 525 526 //boolean determines whether to add the range and azimuth modifiers for range fans 527 private boolean _HideOptionalLabels=false; 528 public boolean get_HideOptionalLabels() 529 { 530 return _HideOptionalLabels; 531 } 532 public void set_HideOptionalLabels(boolean value) 533 { 534 _HideOptionalLabels=value; 535 } 536}