001/* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005package armyc2.c5isr.JavaLineArray; 006 007import java.util.ArrayList; 008 009import armyc2.c5isr.JavaTacticalRenderer.TGLight; 010import armyc2.c5isr.renderer.utilities.ErrorLogger; 011import armyc2.c5isr.renderer.utilities.RendererException; 012import armyc2.c5isr.renderer.utilities.RendererSettings; 013import armyc2.c5isr.renderer.utilities.Color; 014import armyc2.c5isr.renderer.utilities.IPointConversion; 015import armyc2.c5isr.graphics2d.Area; 016import armyc2.c5isr.graphics2d.BasicStroke; 017import armyc2.c5isr.graphics2d.Polygon; 018import armyc2.c5isr.graphics2d.Rectangle2D; 019import armyc2.c5isr.graphics2d.Shape; 020 021/** 022 * Class to process the pixel arrays 023 */ 024public final class arraysupport { 025 026 private static final double maxLength = 100; 027 private static final double minLength = 2.5; //was 5 028 private static double dACP = 0; 029 private static final String _className = "arraysupport"; 030 031// protected static void setMinLength(double value) 032// { 033// minLength=value; 034// } 035 private static void FillPoints(POINT2[] pLinePoints, 036 int counter, 037 ArrayList<POINT2> points) { 038 points.clear(); 039 for (int j = 0; j < counter; j++) { 040 points.add(pLinePoints[j]); 041 } 042 } 043 044 /** 045 * This is the interface function to CELineArray from clsRenderer2 for 046 * non-channel types 047 * 048 * @param pts the client points 049 * @param shapes the symbol ShapeInfo objects 050 * @param clipBounds the rectangular clipping bounds 051 */ 052 public static ArrayList<POINT2> GetLineArray2(TGLight tg, 053 ArrayList<POINT2> pts, 054 ArrayList<Shape2> shapes, 055 Rectangle2D clipBounds, 056 IPointConversion converter) { 057 058 ArrayList<POINT2> points = null; 059 try { 060 POINT2 pt = null; 061 POINT2[] pLinePoints2 = null; 062 POINT2[] pLinePoints = null; 063 int vblSaveCounter = pts.size(); 064 //get the count from countsupport 065 int j = 0; 066 if (pLinePoints2 == null || pLinePoints2.length == 0)//did not get set above 067 { 068 pLinePoints = new POINT2[vblSaveCounter]; 069 for (j = 0; j < vblSaveCounter; j++) { 070 pt = (POINT2) pts.get(j); 071 pLinePoints[j] = new POINT2(pt.x, pt.y, pt.style); 072 } 073 } 074 //get the number of points the array will require 075 int vblCounter = countsupport.GetCountersDouble(tg, vblSaveCounter, pLinePoints, clipBounds); 076 077 //resize pLinePoints and fill the first vblSaveCounter elements with the original points 078 if (vblCounter > 0) { 079 pLinePoints = new POINT2[vblCounter]; 080 } else { 081 shapes = null; 082 return null; 083 } 084 085 lineutility.InitializePOINT2Array(pLinePoints); 086 087 //safeguards added 2-17-11 after CPOF client was allowed to add points to autoshapes 088 if (vblSaveCounter > pts.size()) { 089 vblSaveCounter = pts.size(); 090 } 091 if (vblSaveCounter > pLinePoints.length) { 092 vblSaveCounter = pLinePoints.length; 093 } 094 095 for (j = 0; j < vblSaveCounter; j++) { 096 pt = (POINT2) pts.get(j); 097 pLinePoints[j] = new POINT2(pt.x, pt.y, pt.style); 098 } 099 //we have to adjust the autoshapes because they are instantiating with fewer points 100 points = GetLineArray2Double(tg, pLinePoints, vblCounter, vblSaveCounter, shapes, clipBounds, converter); 101 102 } catch (Exception exc) { 103 ErrorLogger.LogException(_className, "GetLineArray2", 104 new RendererException("GetLineArray2 " + Integer.toString(tg.get_LineType()), exc)); 105 106 } 107 return points; 108 //the caller can get points 109 } 110 111 /** 112 * A function to calculate the points for FORTL 113 * 114 * @param pLinePoints OUT - the points arry also used for the return points 115 * @param vblSaveCounter the number of client points 116 * @return 117 */ 118 private static int GetFORTLPointsDouble(TGLight tg, POINT2[] pLinePoints, int vblSaveCounter) { 119 int nCounter = 0; 120 try { 121 int j = 0, k = 0, bolVertical = 0; 122 int lCount = 0; 123 final double dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness()); 124 ref<double[]> m = new ref(); 125 POINT2[] pSpikePoints = null; 126 POINT2 pt0 = new POINT2(), pt1 = new POINT2(); 127 128 lCount = countsupport.GetFORTLCountDouble(tg, pLinePoints, vblSaveCounter); 129 int numGlyphs = 0; 130 final double dGlyphSize = dIncrement / 2; 131 132 pSpikePoints = new POINT2[lCount]; 133 lineutility.InitializePOINT2Array(pSpikePoints); 134 135 for (j = 0; j < vblSaveCounter - 1; j++) { 136 bolVertical = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m); 137 double dLengthSegment = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 138 if (dLengthSegment / dIncrement < 1) { 139 pSpikePoints[nCounter] = new POINT2(pLinePoints[j]); 140 nCounter++; 141 pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 142 nCounter++; 143 continue; 144 } 145 numGlyphs = (int) (dLengthSegment / dIncrement); 146 final double dSegIncrement = (dLengthSegment / numGlyphs); 147 148 //for (k = 0; k < dLengthSegment / 20 - 1; k++) 149 for (k = 0; k < numGlyphs; k++) { 150 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dSegIncrement, 0); 151 nCounter++; 152 //pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dSegIncrement - 10, 0); 153 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dSegIncrement - dSegIncrement / 2, 0); 154 nCounter++; 155 pt0 = new POINT2(pSpikePoints[nCounter - 1]); 156 //pt1 = lineutility.ExtendLineDouble(pLinePoints[j], pSpikePoints[nCounter - 1], 10); 157 pt1 = lineutility.ExtendLineDouble(pLinePoints[j], pSpikePoints[nCounter - 1], dSegIncrement / 2); 158 //the spikes 159 if (pLinePoints[j].x > pLinePoints[j + 1].x) { 160 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 3, dGlyphSize); 161 nCounter++; 162 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt1, 3, dGlyphSize); 163 nCounter++; 164 } 165 if (pLinePoints[j].x < pLinePoints[j + 1].x) { 166 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 2, dGlyphSize); 167 nCounter++; 168 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt1, 2, dGlyphSize); 169 nCounter++; 170 } 171 if (pLinePoints[j].x == pLinePoints[j + 1].x) { 172 if (pLinePoints[j].y < pLinePoints[j + 1].y) { 173 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 1, dGlyphSize); 174 nCounter++; 175 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt1, 1, dGlyphSize); 176 nCounter++; 177 } 178 if (pLinePoints[j].y > pLinePoints[j + 1].y) { 179 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 0, dGlyphSize); 180 nCounter++; 181 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt1, 0, dGlyphSize); 182 nCounter++; 183 } 184 } 185 //pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 3], 10, 0); 186 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 3], dSegIncrement / 2, 0); 187 nCounter++; 188 }//end for k 189 pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 190 nCounter++; 191 }//end for j 192 for (j = 0; j < nCounter; j++) { 193 pLinePoints[j] = new POINT2(pSpikePoints[j]); 194 } 195 196 return nCounter; 197 } catch (Exception exc) { 198 ErrorLogger.LogException(_className, "GetFORTLPointsDouble", 199 new RendererException("GetFORTLPointsDouble " + Integer.toString(tg.get_LineType()), exc)); 200 } 201 return nCounter; 202 } 203 204 private static int GetATWallPointsDouble2(TGLight tg, POINT2[] pLinePoints, int vblSaveCounter) { 205 int nCounter = 0; 206 try { 207 int j = 0, k = 0; 208 int lCount = 0; 209 double dLengthSegment = 0, dIncrement = 0; 210 POINT2[] pSpikePoints = null; 211 POINT2 pt0; 212 double dSpikeSize = 0; 213 int limit = 0, numSpikes = 0;; 214 215 lCount = countsupport.GetFORTLCountDouble(tg, pLinePoints, vblSaveCounter); 216 pSpikePoints = new POINT2[lCount]; 217 lineutility.InitializePOINT2Array(pSpikePoints); 218 pSpikePoints[nCounter++] = new POINT2(pLinePoints[0]); 219 for (j = 0; j < vblSaveCounter - 1; j++) { 220 dLengthSegment = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 221 dSpikeSize = arraysupport.getScaledSize(10, tg.get_LineThickness()); 222 dIncrement = 2 * dSpikeSize; 223// diagnostic 224 numSpikes = (int) Math.round((dLengthSegment - dSpikeSize) / dIncrement); 225 dIncrement = dLengthSegment / numSpikes; 226 227 //limit = (int) (dLengthSegment / dIncrement) - 1; 228 limit = numSpikes - 1; 229// if (limit < 1) { 230// pSpikePoints[nCounter] = new POINT2(pLinePoints[j]); 231// nCounter++; 232// pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 233// nCounter++; 234// continue; 235// } 236// end diagnostic 237 for (k = -1; k < limit; k++)//was k=0 to limit 238 { 239 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - (dSpikeSize * 3), 0); 240 nCounter++; 241 242 pt0 = lineutility.ExtendLineDouble(pLinePoints[j], pSpikePoints[nCounter - 1], dSpikeSize / 2); 243 244 //the spikes 245 if (pLinePoints[j].x > pLinePoints[j + 1].x) //extend above the line 246 { 247 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pSpikePoints[nCounter - 1], pt0, 2, dSpikeSize); 248 } 249 if (pLinePoints[j].x < pLinePoints[j + 1].x) //extend below the line 250 { 251 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pSpikePoints[nCounter - 1], pt0, 3, dSpikeSize); 252 } 253 if (pLinePoints[j].x == pLinePoints[j + 1].x) { 254 pSpikePoints[nCounter] = new POINT2(pt0); 255 if (pLinePoints[j].y < pLinePoints[j + 1].y) //extend left of line 256 { 257 pSpikePoints[nCounter].x = pt0.x - dSpikeSize; 258 } else //extend right of line 259 { 260 pSpikePoints[nCounter].x = pt0.x + dSpikeSize; 261 } 262 } 263 nCounter++; 264 265 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 2], dSpikeSize, 0); 266 nCounter++; 267 } 268 //use the original line point for the segment end point 269 pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 270 pSpikePoints[nCounter].style = 0; 271 nCounter++; 272 } 273 274 for (j = 0; j < nCounter; j++) { 275 pLinePoints[j] = new POINT2(pSpikePoints[j]); 276 } 277 278 } catch (Exception exc) { 279 ErrorLogger.LogException(_className, "GetATWallPointsDouble", 280 new RendererException("GetATWallPointsDouble", exc)); 281 } 282 return nCounter; 283 } 284 285 public static int GetInsideOutsideDouble2(POINT2 pt0, 286 POINT2 pt1, 287 POINT2[] pLinePoints, 288 int vblCounter, 289 int index, 290 int lineType) { 291 int nDirection = 0; 292 try { 293 ref<double[]> m = new ref(); 294 ref<double[]> m0 = new ref(); 295 296 double b0 = 0; 297 double b2 = 0; 298 299 double b = 0; 300 double X0 = 0; //segment midpoint X value 301 double Y0 = 0; //segment midpoint Y value 302 double X = 0; //X value of horiz line from left intercept with current segment 303 double Y = 0; //Y value of vertical line from top intercept with current segment 304 int nInOutCounter = 0; 305 int j = 0, bolVertical = 0; 306 int bolVertical2 = 0; 307 int nOrientation = 0; //will use 0 for horiz line from left, 1 for vertical line from top 308 int extendLeft = 0; 309 int extendRight = 1; 310 int extendAbove = 2; 311 int extendBelow = 3; 312 313 POINT2 pt2 = new POINT2(); 314 //end declarations. will use this to determine the direction 315 316 //slope of the segment 317 bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m0); 318 if (m0.value == null) { 319 return 0; 320 } 321 //get the midpoint of the segment 322 X0 = (pt0.x + pt1.x) / 2; 323 Y0 = (pt0.y + pt1.y) / 2; 324 325 //slope is not too small or is vertical, use left to right 326 if (Math.abs(m0.value[0]) >= 1 || bolVertical == 0) { 327 nOrientation = 0; //left to right orientation 328 for (j = 0; j < vblCounter - 1; j++) { 329 if (index != j) { 330 //if ((pLinePoints[j].y <= Y0 && pLinePoints[j + 1].y >= Y0) || 331 // (pLinePoints[j].y >= Y0 && pLinePoints[j + 1].y <= Y0)) 332 if ((pLinePoints[j].y < Y0 && pLinePoints[j + 1].y > Y0) 333 || (pLinePoints[j].y > Y0 && pLinePoints[j + 1].y < Y0) 334 || (pLinePoints[j].y < Y0 && pLinePoints[j + 1].y == Y0) 335 || (pLinePoints[j].y == Y0 && pLinePoints[j + 1].y < Y0)) { 336 bolVertical2 = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m); 337 if (bolVertical2 == 1 && m.value[0] == 0) //current segment is horizontal, this should not happen 338 { //counter unaffected 339 nInOutCounter++; 340 nInOutCounter--; 341 } 342 //current segment is vertical, it's x value must be to the left 343 //of the current segment X0 for the horiz line from the left to cross 344 if (bolVertical2 == 0) { 345 if (pLinePoints[j].x < X0) { 346 nInOutCounter++; 347 } 348 } 349 350 //current segment is not horizontal and not vertical 351 if (m.value[0] != 0 && bolVertical2 == 1) { 352 //get the X value of the intersection between the horiz line 353 //from the left and the current segment 354 //b=Y0; 355 b = pLinePoints[j].y - m.value[0] * pLinePoints[j].x; 356 X = (Y0 - b) / m.value[0]; 357 if (X < X0) //the horizontal line crosses the segment 358 { 359 nInOutCounter++; 360 } 361 } 362 363 } //end if 364 } 365 366 } //end for 367 } //end if 368 else //use top to bottom to get orientation 369 { 370 nOrientation = 1; //top down orientation 371 for (j = 0; j < vblCounter - 1; j++) { 372 if (index != j) { 373 //if ((pLinePoints[j].x <= X0 && pLinePoints[j + 1].x >= X0) || 374 // (pLinePoints[j].x >= X0 && pLinePoints[j + 1].x <= X0)) 375 if ((pLinePoints[j].x < X0 && pLinePoints[j + 1].x > X0) 376 || (pLinePoints[j].x > X0 && pLinePoints[j + 1].x < X0) 377 || (pLinePoints[j].x < X0 && pLinePoints[j + 1].x == X0) 378 || (pLinePoints[j].x == X0 && pLinePoints[j + 1].x < X0)) { 379 bolVertical2 = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m); 380 if (bolVertical2 == 0) //current segment is vertical, this should not happen 381 { //counter unaffected 382 nInOutCounter++; 383 nInOutCounter--; 384 } 385 //current segment is horizontal, it's y value must be above 386 //the current segment Y0 for the horiz line from the left to cross 387 if (bolVertical2 == 1 && m.value[0] == 0) { 388 if (pLinePoints[j].y < Y0) { 389 nInOutCounter++; 390 } 391 } 392 393 //current segment is not horizontal and not vertical 394 if (m.value[0] != 0 && bolVertical2 == 1) { 395 //get the Y value of the intersection between the vertical line 396 //from the top and the current segment 397 b = pLinePoints[j].y - m.value[0] * pLinePoints[j].x; 398 Y = m.value[0] * X0 + b; 399 if (Y < Y0) //the vertical line crosses the segment 400 { 401 nInOutCounter++; 402 } 403 } 404 } //end if 405 } 406 } //end for 407 } 408 409 switch (nInOutCounter % 2) { 410 case 0: 411 if (nOrientation == 0) { 412 nDirection = extendLeft; 413 } else { 414 nDirection = extendAbove; 415 } 416 break; 417 case 1: 418 if (nOrientation == 0) { 419 nDirection = extendRight; 420 } else { 421 nDirection = extendBelow; 422 } 423 break; 424 default: 425 break; 426 } 427 //reverse direction for ICING 428 switch (lineType) { 429 case TacticalLines.ICING: 430 if (nDirection == extendLeft) { 431 nDirection = extendRight; 432 } else if (nDirection == extendRight) { 433 nDirection = extendLeft; 434 } else if (nDirection == extendAbove) { 435 nDirection = extendBelow; 436 } else if (nDirection == extendBelow) { 437 nDirection = extendAbove; 438 } 439 break; 440 default: 441 break; 442 } 443 } catch (Exception exc) { 444 ErrorLogger.LogException(_className, "GetInsideOutsideDouble2", 445 new RendererException("GetInsideOutsideDouble2", exc)); 446 } 447 return nDirection; 448 } 449 450 /** 451 * BELT and others 452 * 453 * @param pLinePoints 454 * @param vblSaveCounter 455 * @return 456 */ 457 protected static int GetZONEPointsDouble2(TGLight tg, POINT2[] pLinePoints, int vblSaveCounter) { 458 int nCounter = 0; 459 try { 460 int lineType = tg.get_LineType(); 461 int j = 0, k = 0, n = 0; 462 int lCount = 0; 463 double dLengthSegment = 0; 464 POINT2 pt0 = new POINT2(pLinePoints[0]), pt1 = null, pt2 = null, pt3 = null; 465 POINT2[] pSpikePoints = null; 466 int nDirection = 0; 467 double dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness()); 468 469 lCount = countsupport.GetFORTLCountDouble(tg, pLinePoints, vblSaveCounter); 470 pSpikePoints = new POINT2[lCount]; 471 lineutility.InitializePOINT2Array(pSpikePoints); 472 double remainder = 0; 473 for (j = 0; j < vblSaveCounter - 1; j++) { 474 pt1 = new POINT2(pLinePoints[j]); 475 pt2 = new POINT2(pLinePoints[j + 1]); 476 //get the direction for the spikes 477 nDirection = GetInsideOutsideDouble2(pt1, pt2, pLinePoints, vblSaveCounter, (int) j, lineType); 478 dLengthSegment = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 479 //reverse the direction for those lines with inward spikes 480 if (dLengthSegment < dIncrement) { 481 pSpikePoints[nCounter] = new POINT2(pLinePoints[j]); 482 nCounter++; 483 pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 484 nCounter++; 485 continue; 486 } 487 switch (lineType) { 488 case TacticalLines.OBSAREA: 489 case TacticalLines.OBSFAREA: 490 switch (nDirection) { 491 case 0: //extend left 492 nDirection = 1; //extend right 493 break; 494 case 1: //extend right 495 nDirection = 0; //extend left 496 break; 497 case 2: //extend above 498 nDirection = 3; //extend below 499 break; 500 case 3: //extgend below 501 nDirection = 2; //extend above 502 break; 503 default: 504 break; 505 } 506 break; 507 default: 508 break; 509 } 510 n = (int) (dLengthSegment / dIncrement); 511 remainder = dLengthSegment - n * dIncrement; 512 for (k = 0; k < n; k++) { 513 if (k > 0) { 514 pSpikePoints[nCounter++] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - remainder / 2, 0);//was +0 515 pSpikePoints[nCounter++] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - dIncrement / 2 - remainder / 2, 0);//was -10 516 } else { 517 pSpikePoints[nCounter++] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement, 0);//was +0 518 pSpikePoints[nCounter++] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - dIncrement / 2, 0);//was -10 519 } 520 521 switch (lineType) { 522 case TacticalLines.OBSAREA: 523 case TacticalLines.OBSFAREA: 524 case TacticalLines.ZONE: 525 case TacticalLines.ENCIRCLE: 526 pt0 = lineutility.ExtendLineDouble(pLinePoints[j], pSpikePoints[nCounter - 1], dIncrement / 4); 527 break; 528 case TacticalLines.STRONG: 529 case TacticalLines.FORT_REVD: 530 case TacticalLines.FORT: 531 pt0 = new POINT2(pSpikePoints[nCounter - 1]); 532 break; 533 default: 534 break; 535 } 536 537 pSpikePoints[nCounter++] = lineutility.ExtendDirectedLine(pt1, pt2, pt0, nDirection, dIncrement / 2); 538 //nCounter++; 539 switch (lineType) { 540 case TacticalLines.OBSAREA: 541 case TacticalLines.OBSFAREA: 542 case TacticalLines.ZONE: 543 case TacticalLines.ENCIRCLE: 544 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 2], dIncrement / 2, 0); 545 break; 546 case TacticalLines.STRONG: 547 pSpikePoints[nCounter] = new POINT2(pSpikePoints[nCounter - 2]); 548 break; 549 case TacticalLines.FORT_REVD: 550 case TacticalLines.FORT: 551 pt3 = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 2], dIncrement / 2, 0); 552 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pt1, pt2, pt3, nDirection, dIncrement / 2); 553 nCounter++; 554 pSpikePoints[nCounter] = new POINT2(pt3); 555 break; 556 default: 557 break; 558 } 559 //} 560 nCounter++; 561 //diagnostic 562 if (lineType == TacticalLines.ENCIRCLE) { 563 pSpikePoints[nCounter++] = new POINT2(pSpikePoints[nCounter - 4]); 564 } 565 }//end for k 566 pSpikePoints[nCounter++] = new POINT2(pLinePoints[j + 1]); 567 //nCounter++; 568 }//end for j 569 for (j = 0; j < nCounter; j++) { 570 if (lineType == (long) TacticalLines.OBSAREA) { 571 pSpikePoints[j].style = 11; 572 } 573 } 574 if (lineType == (long) TacticalLines.OBSAREA) { 575 pSpikePoints[nCounter - 1].style = 12; 576 } else { 577 if (nCounter > 0) { 578 pSpikePoints[nCounter - 1].style = 5; 579 } 580 } 581 582 for (j = 0; j < nCounter; j++) { 583 pLinePoints[j] = new POINT2(pSpikePoints[j]); 584 if (j == nCounter - 1) { 585 if (lineType != (long) TacticalLines.OBSAREA) { 586 pLinePoints[j].style = 5; 587 } 588 } 589 } 590 591 } catch (Exception exc) { 592 ErrorLogger.LogException(_className, "GetZONEPointsDouble2", 593 new RendererException("GetZONEPointsDouble2", exc)); 594 } 595 return nCounter; 596 } 597 598 private static boolean IsTurnArcReversed(POINT2[] pPoints) { 599 try { 600 if (pPoints.length < 3) { 601 return false; 602 } 603 604 POINT2[] ptsSeize = new POINT2[2]; 605 ptsSeize[0] = new POINT2(pPoints[0]); 606 ptsSeize[1] = new POINT2(pPoints[1]); 607 lineutility.CalcClockwiseCenterDouble(ptsSeize); 608 double d = lineutility.CalcDistanceDouble(ptsSeize[0], pPoints[2]); 609 610 ptsSeize[0] = new POINT2(pPoints[1]); 611 ptsSeize[1] = new POINT2(pPoints[0]); 612 lineutility.CalcClockwiseCenterDouble(ptsSeize); 613 double dArcReversed = lineutility.CalcDistanceDouble(ptsSeize[0], pPoints[2]); 614 615 ptsSeize = null; 616 if (dArcReversed > d) { 617 return true; 618 } else { 619 return false; 620 } 621 } catch (Exception exc) { 622 ErrorLogger.LogException(_className, "IsTurnArcReversed", 623 new RendererException("IsTurnArcReversed", exc)); 624 } 625 return false; 626 } 627 628 private static void GetIsolatePointsDouble(POINT2[] pLinePoints, 629 int lineType, 630 IPointConversion converter) { 631 try { 632 POINT2 pt0 = new POINT2(pLinePoints[0]), pt1 = new POINT2(pLinePoints[1]), pt2 = new POINT2(pLinePoints[0]); 633 if (pt0.x == pt1.x && pt0.y == pt1.y) { 634 pt1.x += 1; 635 } 636 637 POINT2 C = new POINT2(), E = new POINT2(); 638 int j = 0, k = 0, l = 0; 639 POINT2[] ptsArc = new POINT2[26]; 640 POINT2[] midPts = new POINT2[7]; 641 POINT2[] trianglePts = new POINT2[21]; 642 POINT2[] pArrowPoints = new POINT2[3]; 643 double dRadius = lineutility.CalcDistanceDouble(pt0, pt1); 644 double dLength = Math.abs(dRadius - 20); 645 if (dRadius < 40) { 646 dLength = dRadius / 1.5; 647 } 648 649 double d = lineutility.MBRDistance(pLinePoints, 2); 650 POINT2[] ptsSeize = new POINT2[2]; 651 POINT2[] savepoints = new POINT2[3]; 652 for (j = 0; j < 2; j++) { 653 savepoints[j] = new POINT2(pLinePoints[j]); 654 } 655 656 if (pLinePoints.length >= 3) { 657 savepoints[2] = new POINT2(pLinePoints[2]); 658 } 659 660 lineutility.InitializePOINT2Array(ptsArc); 661 lineutility.InitializePOINT2Array(midPts); 662 lineutility.InitializePOINT2Array(trianglePts); 663 lineutility.InitializePOINT2Array(pArrowPoints); 664 lineutility.InitializePOINT2Array(ptsSeize); 665 666 double DPIScaleFactor = RendererSettings.getInstance().getDeviceDPI() / 96.0; 667 if (d / 7 > maxLength * DPIScaleFactor) { 668 d = 7 * maxLength * DPIScaleFactor; 669 } 670 if (d / 7 < minLength * DPIScaleFactor) { //was minLength 671 d = 7 * minLength * DPIScaleFactor; //was minLength 672 } 673 //change due to outsized arrow in 6.0, 11-3-10 674 if (d > 140 * DPIScaleFactor) { 675 d = 140 * DPIScaleFactor; 676 } 677 //calculation points for the SEIZE arrowhead 678 //for SEIZE calculations 679 POINT2[] ptsArc2 = new POINT2[26]; 680 lineutility.InitializePOINT2Array(ptsArc2); 681 682 E.x = 2 * pt1.x - pt0.x; 683 E.y = 2 * pt1.y - pt0.y; 684 ptsArc[0] = new POINT2(pLinePoints[1]); 685 ptsArc[1] = new POINT2(E); 686 if(converter != null) 687 { 688 ptsArc[0] = new POINT2(pLinePoints[0]); 689 ptsArc[1] = new POINT2(pLinePoints[1]); 690 } 691 692 lineutility.ArcArrayDouble(ptsArc, 0, dRadius, lineType, converter); 693 for (j = 0; j < 26; j++) { 694 ptsArc[j].style = 0; 695 pLinePoints[j] = new POINT2(ptsArc[j]); 696 pLinePoints[j].style = 0; 697 } 698 if (lineType != TacticalLines.OCCUPY) { 699 lineutility.GetArrowHead4Double(ptsArc[24], ptsArc[25], (int) d / 7, (int) d / 7, pArrowPoints, 0); 700 } else { 701 lineutility.GetArrowHead4Double(ptsArc[24], ptsArc[25], (int) d / 7, (int) (1.75 * d) / 7, pArrowPoints, 0); 702 } 703 704 pLinePoints[25].style = 5; 705 706 switch (lineType) { 707 case TacticalLines.CORDONKNOCK: 708 case TacticalLines.CORDONSEARCH: 709 case TacticalLines.ISOLATE: 710 if (dRadius > 100) { 711 dLength = 0.8 * dRadius; 712 } 713 for (j = 1; j <= 23; j++) { 714 if (j % 3 == 0) { 715 midPts[k].x = pt0.x - (long) ((dLength / dRadius) * (pt0.x - ptsArc[j].x)); 716 midPts[k].y = pt0.y - (long) ((dLength / dRadius) * (pt0.y - ptsArc[j].y)); 717 midPts[k].style = 0; 718 trianglePts[l] = new POINT2(ptsArc[j - 1]); 719 l++; 720 trianglePts[l] = new POINT2(midPts[k]); 721 l++; 722 trianglePts[l] = new POINT2(ptsArc[j + 1]); 723 trianglePts[l].style = 5; 724 l++; 725 k++; 726 } 727 } 728 for (j = 26; j < 47; j++) { 729 pLinePoints[j] = new POINT2(trianglePts[j - 26]); 730 } 731 pLinePoints[46].style = 5; 732 for (j = 47; j < 50; j++) { 733 pLinePoints[j] = new POINT2(pArrowPoints[j - 47]); 734 pLinePoints[j].style = 0; 735 } 736 break; 737 case TacticalLines.OCCUPY: 738 for (j = 26; j < 29; j++) { 739 pLinePoints[j] = new POINT2(pArrowPoints[j - 26]); 740 } 741 742 pLinePoints[29] = lineutility.ExtendAlongLineDouble(pArrowPoints[0], pArrowPoints[1], lineutility.CalcDistanceDouble(pArrowPoints[0], pArrowPoints[1]) * 2); 743 pLinePoints[30] = new POINT2(pArrowPoints[1]); 744 pLinePoints[31] = lineutility.ExtendAlongLineDouble(pArrowPoints[2], pArrowPoints[1], lineutility.CalcDistanceDouble(pArrowPoints[2], pArrowPoints[1]) * 2); 745 break; 746 case TacticalLines.SECURE: 747 for (j = 26; j < 29; j++) { 748 pLinePoints[j] = new POINT2(pArrowPoints[j - 26]); 749 pLinePoints[j].style = 0; 750 } 751 pLinePoints[28].style = 5; 752 break; 753 754 case TacticalLines.TURN: 755 boolean changeArc = IsTurnArcReversed(savepoints); 756 if (changeArc) //swap the points 757 { 758 pt0.x = pt1.x; 759 pt0.y = pt1.y; 760 pt1.x = pt2.x; 761 pt1.y = pt2.y; 762 } 763 764 ptsSeize[0] = new POINT2(pt0); 765 ptsSeize[1] = new POINT2(pt1); 766 767 dRadius = lineutility.CalcClockwiseCenterDouble(ptsSeize); 768 769 C = new POINT2(ptsSeize[0]); 770 E = new POINT2(ptsSeize[1]); 771 ptsArc[0] = new POINT2(pt0); 772 ptsArc[1] = new POINT2(E); 773 lineutility.ArcArrayDouble(ptsArc, 0, dRadius, lineType, null); 774 for (j = 0; j < 26; j++) { 775 ptsArc[j].style = 0; 776 pLinePoints[j] = new POINT2(ptsArc[j]); 777 pLinePoints[j].style = 0; 778 } 779 780 if (changeArc) { 781 lineutility.GetArrowHead4Double(ptsArc[1], pt0, (int) d / 7, (int) d / 7, pArrowPoints, 5); 782 } else { 783 lineutility.GetArrowHead4Double(ptsArc[24], pt1, (int) d / 7, (int) d / 7, pArrowPoints, 5); 784 } 785 786 pLinePoints[25].style = 5; 787 788 for (j = 26; j < 29; j++) { 789 pLinePoints[j] = new POINT2(pArrowPoints[j - 26]); 790 pLinePoints[j].style = 9; 791 } 792 pLinePoints[28].style = 10; 793 794 break; 795 case TacticalLines.RETAIN: 796 for (j = 26; j < 29; j++) { 797 pLinePoints[j] = new POINT2(pArrowPoints[j - 26]); 798 pLinePoints[j].style = 0; 799 } 800 pLinePoints[28].style = 5; 801 //get the extended points for retain 802 k = 29; 803 for (j = 1; j < 24; j++) { 804 pLinePoints[k] = new POINT2(ptsArc[j]); 805 pLinePoints[k].style = 0; 806 k++; 807 pLinePoints[k] = lineutility.ExtendLineDouble(pt0, ptsArc[j], (long) d / 7); 808 pLinePoints[k].style = 5; 809 k++; 810 } 811 812 break; 813 default: 814 break; 815 } 816 } catch (Exception exc) { 817 ErrorLogger.LogException(_className, "GetIsolatePointsDouble", 818 new RendererException("GetIsolatePointsDouble " + Integer.toString(lineType), exc)); 819 } 820 } 821 822 private static void AirfieldCenterFeature(POINT2[] pLinePoints, int vblCounter) { 823 try { 824 double d = lineutility.MBRDistance(pLinePoints, vblCounter - 5); 825 double DPIScaleFactor = RendererSettings.getInstance().getDeviceDPI() / 96.0; 826 if (d > 350 * DPIScaleFactor) { 827 d = 350 * DPIScaleFactor; 828 } else if (d < 100 * DPIScaleFactor) { 829 d = 100 * DPIScaleFactor; 830 } 831 832 for (int k = 0; k < vblCounter; k++) { 833 pLinePoints[k].style = 0; 834 } 835 836 pLinePoints[vblCounter - 5] = new POINT2(pLinePoints[0]); 837 pLinePoints[vblCounter - 5].style = 5; 838 pLinePoints[vblCounter - 4] = lineutility.CalcCenterPointDouble(pLinePoints, vblCounter - 6); 839 pLinePoints[vblCounter - 4].x -= d / 10; //was 20 840 pLinePoints[vblCounter - 4].style = 0; 841 pLinePoints[vblCounter - 3] = new POINT2(pLinePoints[vblCounter - 4]); 842 pLinePoints[vblCounter - 3].x = pLinePoints[vblCounter - 4].x + d / 5;//was 10 843 pLinePoints[vblCounter - 3].style = 5; 844 pLinePoints[vblCounter - 2] = new POINT2(pLinePoints[vblCounter - 4]); 845 pLinePoints[vblCounter - 2].y += d / 20;//was 40 846 pLinePoints[vblCounter - 2].style = 0; 847 pLinePoints[vblCounter - 1] = new POINT2(pLinePoints[vblCounter - 3]); 848 pLinePoints[vblCounter - 1].y -= d / 20;//was 40 849 pLinePoints[vblCounter - 1].style = 0; 850 } catch (Exception exc) { 851 ErrorLogger.LogException(_className, "AirfieldCenterFeature", 852 new RendererException("AirfieldCenterFeature", exc)); 853 } 854 } 855 856 private static int GetATWallPointsDouble(TGLight tg, POINT2[] pLinePoints, int vblSaveCounter) { 857 int nCounter = 0; 858 try { 859 int lineType = tg.get_LineType(); 860 int j = 0, k = 0; 861 int lCount = 0; 862 double dLengthSegment = 0, dIncrement = 0; 863 POINT2[] pSpikePoints = null; 864 POINT2 pt0; 865 double dRemainder = 0, dSpikeSize = 0; 866 int limit = 0; 867 POINT2 crossPt1, crossPt2; 868 869 lCount = countsupport.GetFORTLCountDouble(tg, pLinePoints, vblSaveCounter); 870 pSpikePoints = new POINT2[lCount]; 871 switch (lineType) { 872 case TacticalLines.CFG: 873 case TacticalLines.CFY: 874 pSpikePoints[nCounter] = pLinePoints[0]; 875 pSpikePoints[nCounter].style = 0; 876 nCounter++; 877 break; 878 default: 879 break; 880 } 881 for (j = 0; j < vblSaveCounter - 1; j++) { 882 dLengthSegment = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 883 switch (lineType) { 884 case TacticalLines.UCF: 885 case TacticalLines.CF: 886 case TacticalLines.CFG: 887 case TacticalLines.CFY: 888 dIncrement = arraysupport.getScaledSize(60, tg.get_LineThickness()); 889 dSpikeSize = arraysupport.getScaledSize(20, tg.get_LineThickness()); 890 dRemainder = dLengthSegment / dIncrement - (double) ((int) (dLengthSegment / dIncrement)); 891 if (dRemainder < 0.75) { 892 limit = (int) (dLengthSegment / dIncrement); 893 } else { 894 limit = (int) (dLengthSegment / dIncrement) + 1; 895 } 896 break; 897 default: 898 dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness()); 899 dSpikeSize = arraysupport.getScaledSize(10, tg.get_LineThickness()); 900 limit = (int) (dLengthSegment / dIncrement) - 1; 901 break; 902 } 903 if (limit < 1) { 904 pSpikePoints[nCounter] = pLinePoints[j]; 905 nCounter++; 906 pSpikePoints[nCounter] = pLinePoints[j + 1]; 907 nCounter++; 908 continue; 909 } 910 911 for (k = 0; k < limit; k++) { 912 switch (lineType) { 913 case TacticalLines.CFG: //linebreak for dot 914 if (k > 0) { 915 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement + arraysupport.getScaledSize(45, tg.get_LineThickness()), 0); 916 nCounter++; 917 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement + arraysupport.getScaledSize(4, tg.get_LineThickness()), 5); //+2 918 nCounter++; 919 //dot 920 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - arraysupport.getScaledSize(1, tg.get_LineThickness()), 20); 921 nCounter++; 922 //remainder of line 923 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - arraysupport.getScaledSize(10, tg.get_LineThickness()), 0); //-4 924 } else { 925 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - arraysupport.getScaledSize(45, tg.get_LineThickness()), 0); 926 } 927 break; 928 case TacticalLines.CFY: //linebreak for crossed line 929 if (k > 0) { 930 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement + arraysupport.getScaledSize(45, tg.get_LineThickness()), 0); 931 nCounter++; 932 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement + arraysupport.getScaledSize(10, tg.get_LineThickness()), 5); //+2 933 nCounter++; 934 //dot 935 //replace the dot with crossed line segment 936 pSpikePoints[nCounter] = lineutility.ExtendAlongLineDouble(pSpikePoints[nCounter - 1], pLinePoints[j + 1], arraysupport.getScaledSize(5, tg.get_LineThickness()), 0); 937 nCounter++; 938 pSpikePoints[nCounter] = lineutility.ExtendAlongLineDouble(pSpikePoints[nCounter - 1], pLinePoints[j + 1], arraysupport.getScaledSize(10, tg.get_LineThickness()), 5); 939 nCounter++; 940 crossPt1 = lineutility.ExtendDirectedLine(pSpikePoints[nCounter - 2], pSpikePoints[nCounter - 1], pSpikePoints[nCounter - 1], 3, arraysupport.getScaledSize(5, tg.get_LineThickness()), 0); 941 crossPt2 = lineutility.ExtendDirectedLine(pSpikePoints[nCounter - 1], pSpikePoints[nCounter - 2], pSpikePoints[nCounter - 2], 2, arraysupport.getScaledSize(5, tg.get_LineThickness()), 5); 942 pSpikePoints[nCounter] = crossPt1; 943 nCounter++; 944 pSpikePoints[nCounter] = crossPt2; 945 nCounter++; 946 //remainder of line 947 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - arraysupport.getScaledSize(10, tg.get_LineThickness()), 0); //-4 948 } else { 949 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - arraysupport.getScaledSize(45, tg.get_LineThickness()), 0); 950 } 951 break; 952 default: 953 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - arraysupport.getScaledSize(30, tg.get_LineThickness()), 0); 954 break; 955 } 956 if (lineType == TacticalLines.CF) { 957 pSpikePoints[nCounter].style = 0; 958 } 959 nCounter++; 960 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement - dSpikeSize, 0); 961 962 if (lineType == TacticalLines.CF 963 || lineType == TacticalLines.CFG 964 || lineType == TacticalLines.CFY) { 965 pSpikePoints[nCounter].style = 9; 966 } 967 968 nCounter++; 969 pt0 = lineutility.ExtendLineDouble(pLinePoints[j], pSpikePoints[nCounter - 1], dSpikeSize / 2); 970 971 //the spikes 972 if (pLinePoints[j].x > pLinePoints[j + 1].x) //extend above the line 973 { 974 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pSpikePoints[nCounter - 1], pt0, 2, dSpikeSize); 975 } 976 if (pLinePoints[j].x < pLinePoints[j + 1].x) //extend below the line 977 { 978 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pSpikePoints[nCounter - 1], pt0, 3, dSpikeSize); 979 } 980 if (pLinePoints[j].x == pLinePoints[j + 1].x) { 981 pSpikePoints[nCounter] = pt0; 982 if (pLinePoints[j].y < pLinePoints[j + 1].y) //extend left of line 983 { 984 pSpikePoints[nCounter].x = pt0.x - dSpikeSize; 985 } else //extend right of line 986 { 987 pSpikePoints[nCounter].x = pt0.x + dSpikeSize; 988 } 989 } 990 nCounter++; 991 992 if (lineType == TacticalLines.CF 993 || lineType == TacticalLines.CFG 994 || lineType == TacticalLines.CFY) { 995 pSpikePoints[nCounter - 1].style = 9; 996 } 997 998 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 2], dSpikeSize, 0); 999 //need an extra point for these 1000 switch (lineType) { 1001 case TacticalLines.CF: 1002 pSpikePoints[nCounter].style = 10; 1003 break; 1004 case TacticalLines.CFG: 1005 case TacticalLines.CFY: 1006 pSpikePoints[nCounter].style = 10; 1007 nCounter++; 1008 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nCounter - 3], dSpikeSize, 0); 1009 break; 1010 default: 1011 break; 1012 } 1013 nCounter++; 1014 } 1015 1016 //use the original line point for the segment end point 1017 pSpikePoints[nCounter] = pLinePoints[j + 1]; 1018 pSpikePoints[nCounter].style = 0; 1019 nCounter++; 1020 } 1021 1022 for (j = 0; j < nCounter; j++) { 1023 pLinePoints[j] = pSpikePoints[j]; 1024 } 1025 pLinePoints[nCounter - 1].style = 5; 1026 1027 } catch (Exception exc) { 1028 ErrorLogger.LogException(_className, "GetATWallPointsDouble", 1029 new RendererException("GetATWallPointsDouble " + Integer.toString(tg.get_LineType()), exc)); 1030 } 1031 return nCounter; 1032 } 1033 1034 private static int GetRidgePointsDouble(TGLight tg, POINT2[] pLinePoints, int vblSaveCounter) { 1035 int nCounter = 0; 1036 try { 1037 int j = 0, k = 0; 1038 int lCount = 0; 1039 double dLengthSegment = 0, dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness()); 1040 ref<double[]> m = new ref(); 1041 POINT2[] pSpikePoints = null; 1042 POINT2 pt0; 1043 double dSpikeSize = arraysupport.getScaledSize(20, tg.get_LineThickness()); 1044 int limit = 0; 1045 double d = 0; 1046 int bolVertical = 0; 1047 1048 m.value = new double[1]; 1049 lCount = countsupport.GetFORTLCountDouble(tg, pLinePoints, vblSaveCounter); 1050 1051 pSpikePoints = new POINT2[lCount]; 1052 lineutility.InitializePOINT2Array(pSpikePoints); 1053 //for(j=0;j<numPts2-1;j++) 1054 for (j = 0; j < vblSaveCounter - 1; j++) { 1055 bolVertical = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m); 1056 dLengthSegment = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 1057 limit = (int) (dLengthSegment / dIncrement); 1058 if (limit < 1) { 1059 pSpikePoints[nCounter] = new POINT2(pLinePoints[j]); 1060 nCounter++; 1061 pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 1062 nCounter++; 1063 continue; 1064 } 1065 for (k = 0; k < limit; k++) { 1066 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -k * dIncrement, 0); 1067 nCounter++; 1068 d = lineutility.CalcDistanceDouble(pLinePoints[j], pSpikePoints[nCounter - 1]); 1069 pt0 = lineutility.ExtendLineDouble(pLinePoints[j + 1], pLinePoints[j], -d - dSpikeSize / 2); 1070 1071 //the spikes 1072 if (bolVertical != 0) //segment is not vertical 1073 { 1074 if (pLinePoints[j].x < pLinePoints[j + 1].x) //extend above the line 1075 { 1076 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 2, dSpikeSize); 1077 } else //extend below the line 1078 { 1079 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 3, dSpikeSize); 1080 } 1081 } else //segment is vertical 1082 { 1083 if (pLinePoints[j + 1].y < pLinePoints[j].y) //extend left of the line 1084 { 1085 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 0, dSpikeSize); 1086 } else //extend right of the line 1087 { 1088 pSpikePoints[nCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 1, dSpikeSize); 1089 } 1090 } 1091 nCounter++; 1092 pSpikePoints[nCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -d - dSpikeSize, 0); 1093 nCounter++; 1094 } 1095 pSpikePoints[nCounter] = new POINT2(pLinePoints[j + 1]); 1096 nCounter++; 1097 } 1098 1099 for (j = 0; j < nCounter; j++) { 1100 pLinePoints[j] = new POINT2(pSpikePoints[j]); 1101 } 1102 for (j = nCounter; j < lCount; j++) { 1103 pLinePoints[j] = new POINT2(pSpikePoints[nCounter - 1]); 1104 } 1105 1106 } catch (Exception exc) { 1107 ErrorLogger.LogException(_className, "GetRidgePointsDouble", 1108 new RendererException("GetRidgePointsDouble " + Integer.toString(tg.get_LineType()), exc)); 1109 } 1110 return nCounter; 1111 } 1112 1113 protected static int GetSquallDouble(POINT2[] pLinePoints, 1114 double amplitude, 1115 int quantity, 1116 double length, 1117 int numPoints) { 1118 int counter = 0; 1119 try { 1120 int j = 0, k = 0; 1121 POINT2 StartSegPt, EndSegPt; 1122 POINT2 savePoint1 = new POINT2(pLinePoints[0]); 1123 POINT2 savePoint2 = new POINT2(pLinePoints[numPoints - 1]); 1124 ref<int[]> sign = new ref(); 1125 int segQty = 0; 1126 int totalQty = countsupport.GetSquallQty(pLinePoints, quantity, length, numPoints); 1127 POINT2[] pSquallPts = new POINT2[totalQty]; 1128 POINT2[] pSquallSegPts = null; 1129 1130 lineutility.InitializePOINT2Array(pSquallPts); 1131 sign.value = new int[1]; 1132 sign.value[0] = -1; 1133 if (totalQty == 0) { 1134 return 0; 1135 } 1136 1137 for (j = 0; j < numPoints - 1; j++) { 1138 StartSegPt = new POINT2(pLinePoints[j]); 1139 EndSegPt = new POINT2(pLinePoints[j + 1]); 1140 segQty = countsupport.GetSquallSegQty(StartSegPt, EndSegPt, quantity, length); 1141 if (segQty > 0) { 1142 pSquallSegPts = new POINT2[segQty]; 1143 lineutility.InitializePOINT2Array(pSquallSegPts); 1144 } else { 1145 pSquallPts[counter].x = StartSegPt.x; 1146 pSquallPts[counter++].y = StartSegPt.y; 1147 pSquallPts[counter].x = EndSegPt.x; 1148 pSquallPts[counter++].y = EndSegPt.y; 1149 continue; 1150 } 1151 sign.value[0] = -1; 1152 lineutility.GetSquallSegment(StartSegPt, EndSegPt, pSquallSegPts, sign, amplitude, quantity, length); 1153 for (k = 0; k < segQty; k++) { 1154 pSquallPts[counter].x = pSquallSegPts[k].x; 1155 pSquallPts[counter].y = pSquallSegPts[k].y; 1156 if (k == 0) { 1157 pSquallPts[counter] = new POINT2(pLinePoints[j]); 1158 } 1159 if (k == segQty - 1) { 1160 pSquallPts[counter] = new POINT2(pLinePoints[j + 1]); 1161 } 1162 pSquallPts[counter].style = 0; 1163 counter++; 1164 } 1165 } 1166 //load the squall points into the linepoints array 1167 for (j = 0; j < counter; j++) { 1168 if (j < totalQty) { 1169 pLinePoints[j].x = pSquallPts[j].x; 1170 pLinePoints[j].y = pSquallPts[j].y; 1171 if (j == 0) { 1172 pLinePoints[j] = new POINT2(savePoint1); 1173 } 1174 if (j == counter - 1) { 1175 pLinePoints[j] = new POINT2(savePoint2); 1176 } 1177 pLinePoints[j].style = pSquallPts[j].style; 1178 } 1179 } 1180 if (counter == 0) { 1181 for (j = 0; j < pLinePoints.length; j++) { 1182 if (j == 0) { 1183 pLinePoints[j] = new POINT2(savePoint1); 1184 } else { 1185 pLinePoints[j] = new POINT2(savePoint2); 1186 } 1187 } 1188 counter = pLinePoints.length; 1189 } 1190 } catch (Exception exc) { 1191 ErrorLogger.LogException(_className, "GetSquallDouble", 1192 new RendererException("GetSquallDouble", exc)); 1193 } 1194 return counter; 1195 } 1196 1197 protected static int GetSevereSquall(POINT2[] pLinePoints, 1198 double length, 1199 int numPoints) { 1200 int l = 0; 1201 try { 1202 int quantity = 5, j = 0, k = 0; 1203 int totalQty = countsupport.GetSquallQty(pLinePoints, quantity, length, numPoints) + 2 * numPoints; 1204 POINT2[] squallPts = new POINT2[totalQty]; 1205 POINT2 pt0 = new POINT2(), pt1 = new POINT2(), pt2 = new POINT2(), 1206 pt3 = new POINT2(), pt4 = new POINT2(), pt5 = new POINT2(), pt6 = new POINT2(), 1207 pt7 = new POINT2(), pt8 = new POINT2(); 1208 int segQty = 0; 1209 double dist = 0; 1210 1211 lineutility.InitializePOINT2Array(squallPts); 1212 //each segment looks like this: --- V 1213 for (j = 0; j < numPoints - 1; j++) { 1214 dist = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 1215 segQty = (int) (dist / length); 1216 for (k = 0; k < segQty; k++) { 1217 pt0 = lineutility.ExtendAlongLineDouble2(pLinePoints[j], pLinePoints[j + 1], k * length); 1218 pt1 = lineutility.ExtendAlongLineDouble(pLinePoints[j], pLinePoints[j + 1], k * length + length / 6 * 4); 1219 pt1.style = 5; 1220 squallPts[l++] = new POINT2(pt0); 1221 squallPts[l++] = new POINT2(pt1); 1222 pt5 = lineutility.ExtendAlongLineDouble(pLinePoints[j], pLinePoints[j + 1], k * length + length / 6 * 5); 1223 pt6 = lineutility.ExtendAlongLineDouble(pLinePoints[j], pLinePoints[j + 1], k * length + length); 1224 pt2 = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 2, length / 6, 0); //extend above line 1225 pt3 = lineutility.ExtendDirectedLine(pt0, pt5, pt5, 3, length / 6, 0); //extend below line 1226 pt4 = lineutility.ExtendDirectedLine(pt0, pt6, pt6, 2, length / 6, 5); //extend above line 1227 pt4.style = 5; 1228 squallPts[l++] = new POINT2(pt2); 1229 squallPts[l++] = new POINT2(pt3); 1230 squallPts[l++] = new POINT2(pt4); 1231 } 1232 //segment remainder 1233 squallPts[l++] = new POINT2(pLinePoints[j + 1]); 1234 pt0 = lineutility.ExtendAlongLineDouble(pLinePoints[j + 1], pLinePoints[j], dist - segQty * length); 1235 pt0.style = 5; 1236 squallPts[l++] = new POINT2(pt0); 1237 } 1238 if (l > pLinePoints.length) { 1239 l = pLinePoints.length; 1240 } 1241 1242 for (j = 0; j < l; j++) { 1243 if (j < totalQty) { 1244 pLinePoints[j] = new POINT2(squallPts[j]); 1245 } else { 1246 break; 1247 } 1248 } 1249 1250 } catch (Exception exc) { 1251 ErrorLogger.LogException(_className, "GetSevereSquall", 1252 new RendererException("GetSevereSquall", exc)); 1253 } 1254 return l; 1255 } 1256 1257 private static int GetConvergencePointsDouble(POINT2[] pLinePoints, double length, int vblCounter) { 1258 int counter = vblCounter; 1259 try { 1260 int j = 0, k = 0; 1261 double d = 0; 1262 POINT2 pt0 = new POINT2(), pt1 = new POINT2(); 1263 POINT2[] tempPts = new POINT2[vblCounter]; 1264 POINT2 tempPt = new POINT2(); 1265 int numJags = 0; 1266 //save the original points 1267 for (j = 0; j < vblCounter; j++) { 1268 tempPts[j] = new POINT2(pLinePoints[j]); 1269 } 1270 1271 //result points begin with the original points, 1272 //set the last one's linestyle to 5; 1273 pLinePoints[vblCounter - 1].style = 5; 1274 for (j = 0; j < vblCounter - 1; j++) { 1275 1276 pt0 = new POINT2(tempPts[j]); 1277 pt1 = new POINT2(tempPts[j + 1]); 1278 d = lineutility.CalcDistanceDouble(pt0, pt1); 1279 numJags = (int) (d / length); 1280 //we don't want too small a remainder 1281 if (d - numJags * length < 5) { 1282 numJags -= 1; 1283 } 1284 1285 //each section has two spikes: one points above the line 1286 //the other spike points below the line 1287 for (k = 0; k < numJags; k++) { 1288 //the first spike 1289 tempPt = lineutility.ExtendAlongLineDouble(pt0, pt1, k * length + length / 2, 0); 1290 pLinePoints[counter++] = new POINT2(tempPt); 1291 tempPt = lineutility.ExtendAlongLineDouble(tempPt, pt1, length / 2); 1292 tempPt = lineutility.ExtendDirectedLine(pt0, tempPt, tempPt, 2, length / 2, 5); 1293 pLinePoints[counter++] = new POINT2(tempPt); 1294 //the 2nd spike 1295 tempPt = lineutility.ExtendAlongLineDouble(pt0, pt1, (k + 1) * length, 0); 1296 pLinePoints[counter++] = new POINT2(tempPt); 1297 tempPt = lineutility.ExtendAlongLineDouble(tempPt, pt1, length / 2); 1298 tempPt = lineutility.ExtendDirectedLine(pt0, tempPt, tempPt, 3, length / 2, 5); 1299 pLinePoints[counter++] = new POINT2(tempPt); 1300 } 1301 } 1302 } catch (Exception exc) { 1303 ErrorLogger.LogException(_className, "GetConvergencePointsDouble", 1304 new RendererException("GetConvergencePointsDouble", exc)); 1305 } 1306 return counter; 1307 } 1308 1309 // Dashes are 2/3*length and spaces are 1/3*length. 1310 private static int GetITDPointsDouble(POINT2[] pLinePoints, double length, int vblCounter) { 1311 int counter = 0; 1312 try { 1313 int j = 0, k = 0; 1314 double d = 0; 1315 POINT2 pt0 = new POINT2(), pt1 = new POINT2(); 1316 POINT2[] tempPts = new POINT2[vblCounter]; 1317 POINT2 tempPt = new POINT2(); 1318 int numJags = 0, lineStyle = 19; 1319 //save the original points 1320 for (j = 0; j < vblCounter; j++) { 1321 tempPts[j] = new POINT2(pLinePoints[j]); 1322 } 1323 1324 //result points begin with the original points, 1325 //set the last one's linestyle to 5; 1326 //pLinePoints[vblCounter-1].style=5; 1327 for (j = 0; j < vblCounter - 1; j++) { 1328 pt0 = new POINT2(tempPts[j]); 1329 pt1 = new POINT2(tempPts[j + 1]); 1330 d = lineutility.CalcDistanceDouble(pt0, pt1); 1331 numJags = (int) (d / length); 1332 //we don't want too small a remainder 1333 if (d - numJags * length / 3 * 2 < length / 3) { 1334 numJags -= 1; 1335 } 1336 if (numJags == 0) { 1337 pt0.style = 19; 1338 pLinePoints[counter++] = new POINT2(pt0); 1339 pt1.style = 5; 1340 pLinePoints[counter++] = new POINT2(pt1); 1341 } 1342 1343 for (k = 0; k < numJags; k++) { 1344 tempPt = lineutility.ExtendAlongLineDouble(pt0, pt1, k * length + length / 3, lineStyle); 1345 pLinePoints[counter++] = new POINT2(tempPt); 1346 1347 if (k < numJags - 1) { 1348 tempPt = lineutility.ExtendAlongLineDouble(tempPt, pt1, length * 2 / 3, 5); 1349 } else { 1350 tempPt = new POINT2(tempPts[j + 1]); 1351 tempPt.style = 5; 1352 } 1353 pLinePoints[counter++] = new POINT2(tempPt); 1354 if (lineStyle == 19) { 1355 lineStyle = 25; 1356 } else { 1357 lineStyle = 19; 1358 } 1359 } 1360 } 1361 } catch (Exception exc) { 1362 ErrorLogger.LogException(_className, "GetITDPointsDouble", 1363 new RendererException("GetITDPointsDouble", exc)); 1364 } 1365 return counter; 1366 } 1367 1368 private static int GetXPoints(POINT2[] pOriginalLinePoints, POINT2[] XPoints, double segmentLength, int vblCounter) { 1369 int xCounter = 0; 1370 try { 1371 int j = 0, k = 0; 1372 double d = 0; 1373 POINT2 pt0, pt1, pt2, pt3 = new POINT2(), pt4 = new POINT2(), pt5 = new POINT2(), pt6 = new POINT2(); 1374 int numThisSegment = 0; 1375 double distInterval = 0; 1376 double xSize = segmentLength / 6; 1377 for (j = 0; j < vblCounter - 1; j++) { 1378 d = lineutility.CalcDistanceDouble(pOriginalLinePoints[j], pOriginalLinePoints[j + 1]); 1379 numThisSegment = (int) ((d - segmentLength) / segmentLength); 1380 1381 //added 4-19-12 1382 distInterval = d / numThisSegment; 1383 for (k = 0; k < numThisSegment; k++) { 1384 //pt0=lineutility.ExtendAlongLineDouble(pOriginalLinePoints[j],pOriginalLinePoints[j+1], 10+20*k); 1385 pt0 = lineutility.ExtendAlongLineDouble2(pOriginalLinePoints[j], pOriginalLinePoints[j + 1], distInterval / 2 + distInterval * k); 1386 pt1 = lineutility.ExtendAlongLineDouble2(pt0, pOriginalLinePoints[j + 1], xSize); 1387 pt2 = lineutility.ExtendAlongLineDouble2(pt0, pOriginalLinePoints[j + 1], -xSize); 1388 1389 pt3 = lineutility.ExtendDirectedLine(pOriginalLinePoints[j], pt1, pt1, 2, xSize); 1390 pt4 = lineutility.ExtendDirectedLine(pOriginalLinePoints[j], pt1, pt1, 3, xSize); 1391 pt4.style = 5; 1392 pt5 = lineutility.ExtendDirectedLine(pOriginalLinePoints[j], pt2, pt2, 2, xSize); 1393 pt6 = lineutility.ExtendDirectedLine(pOriginalLinePoints[j], pt2, pt2, 3, xSize); 1394 pt6.style = 5; 1395 XPoints[xCounter++] = new POINT2(pt3); 1396 XPoints[xCounter++] = new POINT2(pt6); 1397 XPoints[xCounter++] = new POINT2(pt5); 1398 XPoints[xCounter++] = new POINT2(pt4); 1399 } 1400 } 1401 } catch (Exception exc) { 1402 ErrorLogger.LogException(_className, "GetXPointsDouble", 1403 new RendererException("GetXPointsDouble", exc)); 1404 } 1405 return xCounter; 1406 } 1407 1408 /** 1409 * returns a 37 point ellipse 1410 * 1411 * @param ptCenter 1412 * @param ptWidth 1413 * @param ptHeight 1414 * @return 1415 */ 1416 private static POINT2[] getEllipsePoints(POINT2 ptCenter, POINT2 ptWidth, POINT2 ptHeight) { 1417 POINT2[] pEllipsePoints = null; 1418 try { 1419 pEllipsePoints = new POINT2[37]; 1420 int l = 0; 1421 double dFactor = 0; 1422 double a = lineutility.CalcDistanceDouble(ptCenter, ptWidth); 1423 double b = lineutility.CalcDistanceDouble(ptCenter, ptHeight); 1424 lineutility.InitializePOINT2Array(pEllipsePoints); 1425 for (l = 1; l < 37; l++) { 1426 dFactor = (10.0 * l) * Math.PI / 180.0; 1427 pEllipsePoints[l - 1].x = ptCenter.x + (int) (a * Math.cos(dFactor)); 1428 pEllipsePoints[l - 1].y = ptCenter.y + (int) (b * Math.sin(dFactor)); 1429 pEllipsePoints[l - 1].style = 0; 1430 } 1431 pEllipsePoints[36] = new POINT2(pEllipsePoints[0]); 1432 } catch (Exception exc) { 1433 ErrorLogger.LogException(_className, "GetEllipsePoints", 1434 new RendererException("GetEllipsePoints", exc)); 1435 } 1436 return pEllipsePoints; 1437 } 1438 1439 /** 1440 * Calculate an ellipse and rotate about it's center by azimuth in degrees 1441 * 1442 * @param ptCenter 1443 * @param ptWidth 1444 * @param ptHeight 1445 * @param azimuth 1446 * @return 1447 */ 1448 private static POINT2[] getRotatedEllipsePoints(POINT2 ptCenter, POINT2 ptWidth, POINT2 ptHeight, double azimuth, int lineType) { 1449 POINT2[] pResultPoints = null; 1450 try { 1451 POINT2[] pEllipsePoints = new POINT2[36]; 1452 int l = 0, j = 0; 1453 double dFactor = 0; 1454 double a = lineutility.CalcDistanceDouble(ptCenter, ptWidth); 1455 double b = lineutility.CalcDistanceDouble(ptCenter, ptHeight); 1456 lineutility.InitializePOINT2Array(pEllipsePoints); 1457 for (l = 1; l < 37; l++) { 1458 dFactor = (10.0 * l) * Math.PI / 180.0; 1459 //pEllipsePoints[l - 1].x = ptCenter.x + (int) (a * Math.cos(dFactor)); 1460 //pEllipsePoints[l - 1].y = ptCenter.y + (int) (b * Math.sin(dFactor)); 1461 pEllipsePoints[l - 1].x = ptCenter.x + a * Math.cos(dFactor); 1462 pEllipsePoints[l - 1].y = ptCenter.y + b * Math.sin(dFactor); 1463 pEllipsePoints[l - 1].style = 0; 1464 } 1465 lineutility.RotateGeometryDouble(pEllipsePoints, 36, azimuth - 90); 1466 pResultPoints = new POINT2[37]; 1467 for (j = 0; j < 36; j++) { 1468 pResultPoints[j] = pEllipsePoints[j]; 1469 } 1470 pResultPoints[36] = pEllipsePoints[0]; 1471 } catch (Exception exc) { 1472 ErrorLogger.LogException(_className, "GetRotatedEllipsePoints", 1473 new RendererException("GetRotatedEllipsePoints", exc)); 1474 } 1475 return pResultPoints; 1476 } 1477 1478 private static int GetLVOPoints(POINT2[] pOriginalLinePoints, POINT2[] pLinePoints, double ovalWidth, double segmentLength, int vblCounter) { 1479 int lEllipseCounter = 0; 1480 try { 1481 double dAngle = 0, d = 0, ovalLength = ovalWidth * 2, dFactor = 0; 1482 int lHowManyThisSegment = 0, j = 0, k = 0, l = 0, t = 0; 1483 POINT2 ptCenter = new POINT2(); 1484 POINT2[] pEllipsePoints2 = new POINT2[37]; 1485 1486 double distInterval = 0; 1487 //end declarations 1488 for (j = 0; j < vblCounter - 1; j++) { 1489 lineutility.InitializePOINT2Array(pEllipsePoints2); 1490 d = lineutility.CalcDistanceDouble(pOriginalLinePoints[j], pOriginalLinePoints[j + 1]); 1491 lHowManyThisSegment = (int) ((d - segmentLength) / segmentLength); 1492 1493 distInterval = d / lHowManyThisSegment; 1494 1495 dAngle = lineutility.CalcSegmentAngleDouble(pOriginalLinePoints[j], pOriginalLinePoints[j + 1]); 1496 dAngle = dAngle + Math.PI / 2; 1497 for (k = 0; k < lHowManyThisSegment; k++) { 1498 ptCenter = lineutility.ExtendAlongLineDouble2(pOriginalLinePoints[j], pOriginalLinePoints[j + 1], k * distInterval); 1499 for (l = 1; l < 37; l++) { 1500 //dFactor = (10.0 * l) * Math.PI / 180.0; 1501 dFactor = (20.0 * l) * Math.PI / 180.0; 1502 pEllipsePoints2[l - 1].x = ptCenter.x + (int) (ovalWidth * Math.cos(dFactor)); 1503 pEllipsePoints2[l - 1].y = ptCenter.y + (int) (ovalLength * Math.sin(dFactor)); 1504 pEllipsePoints2[l - 1].style = 0; 1505 } 1506 lineutility.RotateGeometryDouble(pEllipsePoints2, 36, (int) (dAngle * 180 / Math.PI)); 1507 pEllipsePoints2[36] = new POINT2(pEllipsePoints2[35]); 1508 pEllipsePoints2[36].style = 5; 1509 for (l = 0; l < 37; l++) { 1510 pLinePoints[lEllipseCounter] = new POINT2(pEllipsePoints2[l]); 1511 lEllipseCounter++; 1512 } 1513 }//end k loop 1514 //extra ellipse on the final segment at the end of the line 1515 if (j == vblCounter - 2) { 1516 ptCenter = pOriginalLinePoints[j + 1]; 1517 1518 for (l = 1; l < 37; l++) { 1519 dFactor = (20.0 * l) * Math.PI / 180.0; 1520 pEllipsePoints2[l - 1].x = ptCenter.x + (int) (ovalWidth * Math.cos(dFactor)); 1521 pEllipsePoints2[l - 1].y = ptCenter.y + (int) (ovalLength * Math.sin(dFactor)); 1522 pEllipsePoints2[l - 1].style = 0; 1523 } 1524 lineutility.RotateGeometryDouble(pEllipsePoints2, 36, (int) (dAngle * 180 / Math.PI)); 1525 pEllipsePoints2[36] = new POINT2(pEllipsePoints2[35]); 1526 pEllipsePoints2[36].style = 5; 1527 for (l = 0; l < 37; l++) { 1528 pLinePoints[lEllipseCounter] = new POINT2(pEllipsePoints2[l]); 1529 lEllipseCounter++; 1530 } 1531 } 1532 } 1533 } catch (Exception exc) { 1534 ErrorLogger.LogException(_className, "GetLVOPointsDouble", 1535 new RendererException("GetLVOPointsDouble", exc)); 1536 } 1537 return lEllipseCounter; 1538 } 1539 1540 private static int GetIcingPointsDouble(POINT2[] pLinePoints, double length, int vblCounter) { 1541 int counter = 0; 1542 try { 1543 int j = 0; 1544 POINT2[] origPoints = new POINT2[vblCounter]; 1545 int nDirection = -1; 1546 int k = 0, numSegments = 0; 1547 POINT2 pt0 = new POINT2(), pt1 = new POINT2(), midPt = new POINT2(), pt2 = new POINT2(); 1548 //save the original points 1549 for (j = 0; j < vblCounter; j++) { 1550 origPoints[j] = new POINT2(pLinePoints[j]); 1551 } 1552 double distInterval = 0; 1553 for (j = 0; j < vblCounter - 1; j++) { 1554 //how many segments for this line segment? 1555 numSegments = (int) lineutility.CalcDistanceDouble(origPoints[j], origPoints[j + 1]); 1556 numSegments /= length; 1557 //4-19-12 1558 distInterval = lineutility.CalcDistanceDouble(origPoints[j], origPoints[j + 1]) / numSegments; 1559 //get the direction and the quadrant 1560 nDirection = GetInsideOutsideDouble2(origPoints[j], origPoints[j + 1], origPoints, vblCounter, j, TacticalLines.ICING); 1561 for (k = 0; k < numSegments; k++) { 1562 //get the parallel segment 1563 if (k == 0) { 1564 pt0 = new POINT2(origPoints[j]); 1565 } else { 1566 pt0 = lineutility.ExtendAlongLineDouble(origPoints[j], origPoints[j + 1], k * distInterval, 0); 1567 } 1568 1569 pt1 = lineutility.ExtendAlongLineDouble(origPoints[j], origPoints[j + 1], k * distInterval + length * 2 / 3, 5); 1570 midPt = lineutility.ExtendAlongLineDouble(origPoints[j], origPoints[j + 1], k * distInterval + length / 3, 0); 1571 //get the perpendicular segment 1572 pt2 = lineutility.ExtendDirectedLine(origPoints[j], origPoints[j + 1], midPt, nDirection, length / 3, 5); 1573 pLinePoints[counter] = new POINT2(pt0); 1574 pLinePoints[counter + 1] = new POINT2(pt1); 1575 pLinePoints[counter + 2] = new POINT2(midPt); 1576 pLinePoints[counter + 3] = new POINT2(pt2); 1577 counter += 4; 1578 } 1579 } 1580 } catch (Exception exc) { 1581 ErrorLogger.LogException(_className, "GetIcingPointsDouble", 1582 new RendererException("GetIcingPointsDouble", exc)); 1583 } 1584 return counter; 1585 } 1586 1587 protected static int GetAnchorageDouble(POINT2[] vbPoints2, double floatDiameter, int numPts) { 1588 int lFlotCounter = 0; 1589 try { 1590 int j = 0, k = 0, l = 0; 1591 int x1 = 0, y1 = 0; 1592 int numSegPts = -1; 1593 int lFlotCount = 0; 1594 int lNumSegs = 0; 1595 double dDistance = 0; 1596 int[] vbPoints = null; 1597 int[] points = null; 1598 int[] points2 = null; 1599 POINT2 pt = new POINT2(); 1600 POINT2 pt1 = new POINT2(), pt2 = new POINT2(); 1601 1602 lFlotCount = flot.GetAnchorageCountDouble(vbPoints2, floatDiameter, numPts); 1603 vbPoints = new int[2 * numPts]; 1604 1605 for (j = 0; j < numPts; j++) { 1606 vbPoints[k] = (int) vbPoints2[j].x; 1607 k++; 1608 vbPoints[k] = (int) vbPoints2[j].y; 1609 k++; 1610 } 1611 k = 0; 1612 1613 ref<int[]> bFlip = new ref(); 1614 bFlip.value = new int[1]; 1615 ref<int[]> lDirection = new ref(); 1616 lDirection.value = new int[1]; 1617 ref<int[]> lLastDirection = new ref(); 1618 lLastDirection.value = new int[1]; 1619 for (l = 0; l < numPts - 1; l++) { 1620 pt1.x = vbPoints[2 * l]; 1621 pt1.y = vbPoints[2 * l + 1]; 1622 pt2.x = vbPoints[2 * l + 2]; 1623 pt2.y = vbPoints[2 * l + 3]; 1624 //for all segments after the first segment we shorten 1625 //the line by floatDiameter so the flots will not abut 1626 if (l > 0) { 1627 pt1 = lineutility.ExtendAlongLineDouble(pt1, pt2, floatDiameter); 1628 } 1629 1630 dDistance = lineutility.CalcDistanceDouble(pt1, pt2); 1631 1632 lNumSegs = (int) (dDistance / floatDiameter); 1633 1634 if (lNumSegs > 0) { 1635 points2 = new int[lNumSegs * 32]; 1636 numSegPts = flot.GetAnchorageFlotSegment(vbPoints, (int) pt1.x, (int) pt1.y, (int) pt2.x, (int) pt2.y, l, floatDiameter, points2, bFlip, lDirection, lLastDirection); 1637 points = new int[numSegPts]; 1638 1639 for (j = 0; j < numSegPts; j++) { 1640 points[j] = points2[j]; 1641 } 1642 1643 for (j = 0; j < numSegPts / 3; j++) //only using half the flots 1644 { 1645 x1 = points[k]; 1646 y1 = points[k + 1]; 1647 k += 3; 1648 if (j % 10 == 0) { 1649 pt.x = x1; 1650 pt.y = y1; 1651 pt.style = 5; 1652 } else if ((j + 1) % 10 == 0) { 1653 if (lFlotCounter < lFlotCount) { 1654 vbPoints2[lFlotCounter].x = x1; 1655 vbPoints2[lFlotCounter++].y = y1; 1656 vbPoints2[lFlotCounter++] = new POINT2(pt); 1657 continue; 1658 } else { 1659 break; 1660 } 1661 } 1662 if (lFlotCounter < lFlotCount) { 1663 vbPoints2[lFlotCounter].x = x1; 1664 vbPoints2[lFlotCounter].y = y1; 1665 lFlotCounter++; 1666 } else { 1667 break; 1668 } 1669 } 1670 k = 0; 1671 points = null; 1672 } else { 1673 if (lFlotCounter < lFlotCount) { 1674 vbPoints2[lFlotCounter].x = vbPoints[2 * l]; 1675 vbPoints2[lFlotCounter].y = vbPoints[2 * l + 1]; 1676 lFlotCounter++; 1677 } 1678 } 1679 } 1680 for (j = lFlotCounter - 1; j < lFlotCount; j++) { 1681 vbPoints2[j].style = 5; 1682 } 1683 1684 } catch (Exception exc) { 1685 ErrorLogger.LogException(_className, "GetAnchorageDouble", 1686 new RendererException("GetAnchorageDouble", exc)); 1687 } 1688 return lFlotCounter; 1689 } 1690 1691 private static int GetPipePoints(POINT2[] pLinePoints, 1692 double length, 1693 int vblCounter) { 1694 int counter = 0; 1695 try { 1696 POINT2[] pOriginalPoints = new POINT2[vblCounter]; 1697 POINT2 pt0 = new POINT2(); 1698 POINT2 pt1 = new POINT2(); 1699 POINT2 pt2 = new POINT2(); 1700 POINT2[] xPoints = new POINT2[pLinePoints.length]; 1701 int xCounter = 0; 1702 int j = 0, k = 0; 1703 for (j = 0; j < vblCounter; j++) { 1704 pOriginalPoints[j] = new POINT2(pLinePoints[j]); 1705 } 1706 int numSegs = 0; 1707 double d = 0; 1708 1709 lineutility.InitializePOINT2Array(xPoints); 1710 for (j = 0; j < vblCounter - 1; j++) { 1711 d = lineutility.CalcDistanceDouble(pOriginalPoints[j], pOriginalPoints[j + 1]); 1712 numSegs = (int) (d / length); 1713 for (k = 0; k < numSegs; k++) { 1714 pt0 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * k); 1715 pt0.style = 0; 1716 pt1 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * k + length / 2); 1717 pt1.style = 5; 1718 pt2 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * k + length / 2); 1719 pt2.style = 20; //for filled circle 1720 pLinePoints[counter++] = new POINT2(pt0); 1721 pLinePoints[counter++] = new POINT2(pt1); 1722 xPoints[xCounter++] = new POINT2(pt2); 1723 } 1724 if (numSegs == 0) { 1725 pLinePoints[counter] = new POINT2(pOriginalPoints[j]); 1726 pLinePoints[counter++].style = 0; 1727 pLinePoints[counter] = new POINT2(pOriginalPoints[j + 1]); 1728 pLinePoints[counter++].style = 5; 1729 } else { 1730 pLinePoints[counter] = new POINT2(pLinePoints[counter - 1]); 1731 pLinePoints[counter++].style = 0; 1732 pLinePoints[counter] = new POINT2(pOriginalPoints[j + 1]); 1733 pLinePoints[counter++].style = 5; 1734 } 1735 } 1736 //load the circle points 1737 for (k = 0; k < xCounter; k++) { 1738 pLinePoints[counter++] = new POINT2(xPoints[k]); 1739 } 1740 //add one more circle 1741 pLinePoints[counter++] = new POINT2(pLinePoints[counter]); 1742 1743 pOriginalPoints = null; 1744 xPoints = null; 1745 } catch (Exception exc) { 1746 ErrorLogger.LogException(_className, "GetPipePoints", 1747 new RendererException("GetPipePoints", exc)); 1748 } 1749 return counter; 1750 } 1751 1752 private static int GetReefPoints(POINT2[] pLinePoints, 1753 double length, 1754 int vblCounter) { 1755 int counter = 0; 1756 try { 1757 POINT2[] pOriginalPoints = new POINT2[vblCounter]; 1758 POINT2 pt0 = new POINT2(); 1759 POINT2 pt1 = new POINT2(); 1760 POINT2 pt2 = new POINT2(); 1761 POINT2 pt3 = new POINT2(); 1762 POINT2 pt4 = new POINT2(); 1763 //POINT2 pt5=new POINT2(); 1764 for (int j = 0; j < vblCounter; j++) { 1765 pOriginalPoints[j] = new POINT2(pLinePoints[j]); 1766 } 1767 1768 int numSegs = 0, direction = 0; 1769 double d = 0; 1770 for (int j = 0; j < vblCounter - 1; j++) { 1771 if (pOriginalPoints[j].x < pOriginalPoints[j + 1].x) { 1772 direction = 2; 1773 } else { 1774 direction = 3; 1775 } 1776 1777 d = lineutility.CalcDistanceDouble(pOriginalPoints[j], pOriginalPoints[j + 1]); 1778 numSegs = (int) (d / length); 1779 for (int k = 0; k < numSegs; k++) { 1780 pt0 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * k); 1781 1782 pt1 = lineutility.ExtendAlongLineDouble2(pt0, pOriginalPoints[j + 1], length * .35); 1783 pt1 = lineutility.ExtendDirectedLine(pOriginalPoints[j], pOriginalPoints[j + 1], pt1, direction, length);//was 2 1784 1785 pt2 = lineutility.ExtendAlongLineDouble2(pt0, pOriginalPoints[j + 1], length * .4); 1786 pt2 = lineutility.ExtendDirectedLine(pOriginalPoints[j], pOriginalPoints[j + 1], pt2, direction, length * .6);//was 2 1787 1788 pt3 = lineutility.ExtendAlongLineDouble2(pt0, pOriginalPoints[j + 1], length * .75); 1789 pt3 = lineutility.ExtendDirectedLine(pOriginalPoints[j], pOriginalPoints[j + 1], pt3, direction, length * 1.35);//was 2 1790 1791 pt4 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * (k + 1)); 1792 pLinePoints[counter++] = new POINT2(pt0); 1793 pLinePoints[counter++] = new POINT2(pt1); 1794 pLinePoints[counter++] = new POINT2(pt2); 1795 pLinePoints[counter++] = new POINT2(pt3); 1796 pLinePoints[counter++] = new POINT2(pt4); 1797 } 1798 if (numSegs == 0) { 1799 pLinePoints[counter++] = new POINT2(pOriginalPoints[j]); 1800 pLinePoints[counter++] = new POINT2(pOriginalPoints[j + 1]); 1801 } 1802 } 1803 pLinePoints[counter++] = new POINT2(pOriginalPoints[vblCounter - 1]); 1804 pOriginalPoints = null; 1805 } catch (Exception exc) { 1806 ErrorLogger.LogException(_className, "GetReefPoints", 1807 new RendererException("GetReefPoints", exc)); 1808 } 1809 return counter; 1810 } 1811 1812 private static int GetRestrictedAreaPoints(POINT2[] pLinePoints, 1813 double length, 1814 int vblCounter) { 1815 int counter = 0; 1816 try { 1817 POINT2[] pOriginalPoints = new POINT2[vblCounter]; 1818 POINT2 pt0 = new POINT2(); 1819 POINT2 pt1 = new POINT2(); 1820 POINT2 pt2 = new POINT2(); 1821 POINT2 pt3 = new POINT2(); 1822 for (int j = 0; j < vblCounter; j++) { 1823 pOriginalPoints[j] = new POINT2(pLinePoints[j]); 1824 } 1825 int direction = 0; 1826 int numSegs = 0; 1827 double d = 0; 1828 for (int j = 0; j < vblCounter - 1; j++) { 1829 d = lineutility.CalcDistanceDouble(pOriginalPoints[j], pOriginalPoints[j + 1]); 1830 numSegs = (int) (d / length); 1831 if (pOriginalPoints[j].x < pOriginalPoints[j + 1].x) { 1832 direction = 3; 1833 } else { 1834 direction = 2; 1835 } 1836 for (int k = 0; k < numSegs; k++) { 1837 pt0 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * k); 1838 pt0.style = 0; 1839 pt1 = lineutility.ExtendAlongLineDouble2(pOriginalPoints[j], pOriginalPoints[j + 1], length * k + length * 2 / 3); 1840 pt1.style = 5; 1841 pt2 = lineutility.MidPointDouble(pt0, pt1, 0); 1842 //pt3 = lineutility.ExtendDirectedLine(pOriginalPoints[j], pOriginalPoints[j + 1], pt2, 3, 10); 1843 pt3 = lineutility.ExtendDirectedLine(pOriginalPoints[j], pOriginalPoints[j + 1], pt2, direction, length * 2 / 3); 1844 pt3.style = 5; 1845 pLinePoints[counter++] = new POINT2(pt2); 1846 pLinePoints[counter++] = new POINT2(pt3); 1847 pLinePoints[counter++] = new POINT2(pt0); 1848 pLinePoints[counter++] = new POINT2(pt1); 1849 } 1850 if (numSegs == 0) { 1851 pLinePoints[counter++] = new POINT2(pOriginalPoints[j]); 1852 pLinePoints[counter++] = new POINT2(pOriginalPoints[j + 1]); 1853 } 1854 } 1855 pLinePoints[counter - 1].style = 0; 1856 pLinePoints[counter++] = new POINT2(pOriginalPoints[vblCounter - 1]); 1857 } catch (Exception exc) { 1858 ErrorLogger.LogException(_className, "GetRestrictedAreaPoints", 1859 new RendererException("GetRestrictedAreaPoints", exc)); 1860 } 1861 return counter; 1862 } 1863 1864 //there should be two linetypes depending on scale 1865 private static int getOverheadWire(TGLight tg, POINT2[] pLinePoints, int vblCounter) { 1866 int counter = 0; 1867 try { 1868 int j = 0; 1869 POINT2 pt = null, pt2 = null; 1870 ArrayList<POINT2> pts = new ArrayList(); 1871 for (j = 0; j < vblCounter; j++) { 1872 pt = new POINT2(pLinePoints[j]); 1873 //tower 1874 pt2 = new POINT2(pt); 1875 pt2.y -= arraysupport.getScaledSize(5, tg.get_LineThickness()); 1876 pts.add(pt2); 1877 pt2 = new POINT2(pt); 1878 pt2.x -= arraysupport.getScaledSize(5, tg.get_LineThickness()); 1879 pts.add(pt2); 1880 pt2 = new POINT2(pt); 1881 pt2.y -= arraysupport.getScaledSize(20, tg.get_LineThickness()); 1882 pts.add(pt2); 1883 pt2 = new POINT2(pt); 1884 pt2.x += arraysupport.getScaledSize(5, tg.get_LineThickness()); 1885 pts.add(pt2); 1886 pt2 = new POINT2(pt); 1887 pt2.y -= arraysupport.getScaledSize(5, tg.get_LineThickness()); 1888 pt2.style = 5; 1889 pts.add(pt2); 1890 //low cross piece 1891 pt2 = new POINT2(pt); 1892 pt2.x -= arraysupport.getScaledSize(2, tg.get_LineThickness()); 1893 pt2.y -= arraysupport.getScaledSize(10, tg.get_LineThickness()); 1894 pts.add(pt2); 1895 pt2 = new POINT2(pt); 1896 pt2.x += arraysupport.getScaledSize(2, tg.get_LineThickness()); 1897 pt2.y -= arraysupport.getScaledSize(10, tg.get_LineThickness()); 1898 pt2.style = 5; 1899 pts.add(pt2); 1900 //high cross piece 1901 pt2 = new POINT2(pt); 1902 pt2.x -= arraysupport.getScaledSize(7, tg.get_LineThickness()); 1903 pt2.y -= arraysupport.getScaledSize(17, tg.get_LineThickness()); 1904 pts.add(pt2); 1905 pt2 = new POINT2(pt); 1906 pt2.x -= arraysupport.getScaledSize(5, tg.get_LineThickness()); 1907 pt2.y -= arraysupport.getScaledSize(20, tg.get_LineThickness()); 1908 pts.add(pt2); 1909 pt2 = new POINT2(pt); 1910 pt2.x += arraysupport.getScaledSize(5, tg.get_LineThickness()); 1911 pt2.y -= arraysupport.getScaledSize(20, tg.get_LineThickness()); 1912 pts.add(pt2); 1913 pt2 = new POINT2(pt); 1914 pt2.x += arraysupport.getScaledSize(7, tg.get_LineThickness()); 1915 pt2.y -= arraysupport.getScaledSize(17, tg.get_LineThickness()); 1916 pt2.style = 5; 1917 pts.add(pt2); 1918 //angle piece 1919 pt2 = new POINT2(pt); 1920 pt2.y -= arraysupport.getScaledSize(20, tg.get_LineThickness()); 1921 pts.add(pt2); 1922 pt2 = new POINT2(pt); 1923 pt2.x += arraysupport.getScaledSize(8, tg.get_LineThickness()); 1924 pt2.y -= arraysupport.getScaledSize(12, tg.get_LineThickness()); 1925 pt2.style = 5; 1926 pts.add(pt2); 1927 } 1928 //connect the towers 1929 for (j = 0; j < vblCounter - 1; j++) { 1930 pt = new POINT2(pLinePoints[j]); 1931 pt2 = new POINT2(pLinePoints[j + 1]); 1932 if (pt.x < pt2.x) { 1933 pt.x += arraysupport.getScaledSize(5, tg.get_LineThickness()); 1934 pt.y -= arraysupport.getScaledSize(10, tg.get_LineThickness()); 1935 pt2.x -= arraysupport.getScaledSize(5, tg.get_LineThickness()); 1936 pt2.y -= arraysupport.getScaledSize(10, tg.get_LineThickness()); 1937 pt2.style = 5; 1938 } else { 1939 pt.x -= arraysupport.getScaledSize(5, tg.get_LineThickness()); 1940 pt.y -= arraysupport.getScaledSize(10, tg.get_LineThickness()); 1941 pt2.x += arraysupport.getScaledSize(5, tg.get_LineThickness()); 1942 pt2.y -= arraysupport.getScaledSize(10, tg.get_LineThickness()); 1943 pt2.style = 5; 1944 } 1945 pts.add(pt); 1946 pts.add(pt2); 1947 } 1948 for (j = 0; j < pts.size(); j++) { 1949 pLinePoints[j] = pts.get(j); 1950 counter++; 1951 } 1952 for (j = counter; j < pLinePoints.length; j++) { 1953 pLinePoints[j] = new POINT2(pLinePoints[counter - 1]); 1954 } 1955 } catch (Exception exc) { 1956 ErrorLogger.LogException(_className, "GetOverheadWire", 1957 new RendererException("GetOverheadWire", exc)); 1958 } 1959 return counter; 1960 } 1961 1962 //private static int linetype=-1; //use for BLOCK, CONTIAN 1963 /** 1964 * Calculates the points for the non-channel symbols. The points will be 1965 * stored in the original POINT2 array in pixels, pLinePoints. The client 1966 * points occupy the first vblSaveCounter positions in pLinePoints and will 1967 * be overwritten by the symbol points. 1968 * 1969 * @param pLinePoints - OUT - an array of POINT2 1970 * @param vblCounter the number of points allocated 1971 * @param vblSaveCounter the number of client points 1972 * 1973 * @return the symbol point count 1974 */ 1975 private static ArrayList<POINT2> GetLineArray2Double(TGLight tg, 1976 POINT2[] pLinePoints, 1977 int vblCounter, 1978 int vblSaveCounter, 1979 ArrayList<Shape2> shapes, 1980 Rectangle2D clipBounds, 1981 IPointConversion converter) { 1982 ArrayList<POINT2> points = new ArrayList(); 1983 try { 1984 int lineType = tg.get_LineType(); 1985 String client = CELineArray.getClient(); 1986 if (pLinePoints == null || pLinePoints.length < 2) { 1987 return null; 1988 } 1989 int[] segments = null; 1990 double dMRR = 0; 1991 int n = 0, bolVertical = 0; 1992 double dExtendLength = 0; 1993 double dWidth = 0; 1994 int nQuadrant = 0; 1995 int lLinestyle = 0, pointCounter = 0; 1996 ref<double[]> offsetX = new ref(), offsetY = new ref(); 1997 double b = 0, b1 = 0, dRadius = 0, d1 = 0, d = 0; 1998 ref<double[]> m = new ref(); 1999 int direction = 0; 2000 int nCounter = 0; 2001 int j = 0, k = 0, middleSegment = -1; 2002 double dMBR = lineutility.MBRDistance(pLinePoints, vblSaveCounter); 2003 POINT2 pt0 = new POINT2(pLinePoints[0]), //calculation points for autoshapes 2004 pt1 = new POINT2(pLinePoints[1]), 2005 pt2 = new POINT2(pLinePoints[1]), 2006 pt3 = new POINT2(pLinePoints[0]), 2007 pt4 = new POINT2(pLinePoints[0]), 2008 pt5 = new POINT2(pLinePoints[0]), 2009 pt6 = new POINT2(pLinePoints[0]), 2010 pt7 = new POINT2(pLinePoints[0]), 2011 pt8 = new POINT2(pLinePoints[0]), 2012 ptYIntercept = new POINT2(pLinePoints[0]), 2013 ptYIntercept1 = new POINT2(pLinePoints[0]), 2014 ptCenter = new POINT2(pLinePoints[0]); 2015 POINT2[] pArrowPoints = new POINT2[3], 2016 arcPts = new POINT2[26], 2017 circlePoints = new POINT2[100], 2018 pts = null, pts2 = null; 2019 POINT2 midpt = new POINT2(pLinePoints[0]), midpt1 = new POINT2(pLinePoints[0]); 2020 2021 POINT2[] pOriginalLinePoints = null; 2022 POINT2[] pUpperLinePoints = null; 2023 POINT2[] pLowerLinePoints = null; 2024 POINT2[] pUpperLowerLinePoints = null; 2025 2026 POINT2 calcPoint0 = new POINT2(), 2027 calcPoint1 = new POINT2(), 2028 calcPoint2 = new POINT2(), 2029 calcPoint3 = new POINT2(), 2030 calcPoint4 = new POINT2(); 2031 POINT2 ptTemp = new POINT2(pLinePoints[0]); 2032 int acCounter = 0; 2033 POINT2[] acPoints = new POINT2[6]; 2034 int lFlotCount = 0; 2035 //end declarations 2036 2037 //Bearing line and others only have 2 points 2038 if (vblCounter > 2) { 2039 pt2 = new POINT2(pLinePoints[2]); 2040 } 2041 pt0.style = 0; 2042 pt1.style = 0; 2043 pt2.style = 0; 2044 2045 //set jaggylength in clsDISMSupport before the points get bounded 2046 ArrayList xPoints = null; 2047 pOriginalLinePoints = new POINT2[vblSaveCounter]; 2048 for (j = 0; j < vblSaveCounter; j++) { 2049 pOriginalLinePoints[j] = new POINT2(pLinePoints[j]); 2050 } 2051 2052 double DPIScaleFactor = RendererSettings.getInstance().getDeviceDPI() / 96.0; 2053 2054 //resize the array and get the line array 2055 //for the specified non-channel line type 2056 switch (lineType) { 2057 case TacticalLines.OVERHEAD_WIRE: 2058 acCounter = getOverheadWire(tg, pLinePoints, vblSaveCounter); 2059 break; 2060 case TacticalLines.BOUNDARY: 2061 acCounter = pLinePoints.length; 2062 break; 2063 case TacticalLines.REEF: 2064 vblCounter = GetReefPoints(pLinePoints, arraysupport.getScaledSize(40, tg.get_LineThickness()), vblSaveCounter); 2065 acCounter = vblCounter; 2066 break; 2067 case TacticalLines.RESTRICTED_AREA: 2068 vblCounter = GetRestrictedAreaPoints(pLinePoints, arraysupport.getScaledSize(15, tg.get_LineThickness()), vblSaveCounter); 2069 acCounter = vblCounter; 2070 break; 2071 case TacticalLines.TRAINING_AREA: 2072 dMBR = lineutility.MBRDistance(pLinePoints, vblSaveCounter); 2073 d = 20 * DPIScaleFactor; 2074 if (dMBR < 60 * DPIScaleFactor) { 2075 d = dMBR / 4; 2076 } 2077 if (d < 5 * DPIScaleFactor) { 2078 d = 5 * DPIScaleFactor; 2079 } 2080 for (j = 0; j < vblSaveCounter; j++) { 2081 pLinePoints[j].style = 1; 2082 } 2083 pLinePoints[vblSaveCounter - 1].style = 5; 2084 pt0 = lineutility.CalcCenterPointDouble(pLinePoints, vblSaveCounter - 1); 2085 //lineutility.CalcCircleDouble(pt0, 20, 26, arcPts, 0); 2086 lineutility.CalcCircleDouble(pt0, d, 26, arcPts, 0); 2087 2088 for (j = vblSaveCounter; j < vblSaveCounter + 26; j++) { 2089 pLinePoints[j] = new POINT2(arcPts[j - vblSaveCounter]); 2090 } 2091 pLinePoints[j - 1].style = 5; 2092 2093 //! inside the circle 2094 if (dMBR < 50 * DPIScaleFactor) { 2095 //d was used as the circle radius 2096 d *= 0.6; 2097 } else { 2098 d = 12 * DPIScaleFactor; 2099 } 2100 2101 pt1 = new POINT2(pt0); 2102 pt1.y -= d; 2103 pt1.style = 0; 2104 pt2 = new POINT2(pt1); 2105 pt2.y += d; 2106 pt2.style = 5; 2107 pt3 = new POINT2(pt2); 2108 pt3.y += d / 4 + tg.get_LineThickness(); 2109 pt3.style = 0; 2110 pt4 = new POINT2(pt3); 2111 pt4.y += d / 4; 2112 pLinePoints[j++] = new POINT2(pt1); 2113 pLinePoints[j++] = new POINT2(pt2); 2114 pLinePoints[j++] = new POINT2(pt3); 2115 pt4.style = 5; 2116 pLinePoints[j++] = new POINT2(pt4); 2117 vblCounter = j; 2118 acCounter = vblCounter; 2119 break; 2120 case TacticalLines.PIPE: 2121 vblCounter = GetPipePoints(pLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2122 acCounter = vblCounter; 2123 break; 2124 case TacticalLines.ANCHORAGE_AREA: 2125 //get the direction and quadrant of the first segment 2126 n = GetInsideOutsideDouble2(pLinePoints[0], pLinePoints[1], pLinePoints, vblSaveCounter, 0, lineType); 2127 nQuadrant = lineutility.GetQuadrantDouble(pLinePoints[0], pLinePoints[1]); 2128 //if the direction and quadrant are not compatible with GetFlotDouble then 2129 //reverse the points 2130 switch (nQuadrant) { 2131 case 4: 2132 switch (n) { 2133 case 1: //extend left 2134 case 2: //extend below 2135 break; 2136 case 0: //extend right 2137 case 3: //extend above 2138 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2139 break; 2140 default: 2141 break; 2142 } 2143 break; 2144 case 1: 2145 switch (n) { 2146 case 1: //extend left 2147 case 3: //extend above 2148 break; 2149 case 0: //extend right 2150 case 2: //extend below 2151 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2152 break; 2153 default: 2154 break; 2155 } 2156 break; 2157 case 2: 2158 switch (n) { 2159 case 1: //extend left 2160 case 2: //extend below 2161 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2162 break; 2163 case 0: //extend right 2164 case 3: //extend above 2165 break; 2166 default: 2167 break; 2168 } 2169 break; 2170 case 3: 2171 switch (n) { 2172 case 1: //extend left 2173 case 3: //extend above 2174 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2175 break; 2176 case 0: //extend right 2177 case 2: //extend above 2178 break; 2179 default: 2180 break; 2181 } 2182 break; 2183 default: 2184 break; 2185 } 2186 lFlotCount = GetAnchorageDouble(pLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2187 acCounter = lFlotCount; 2188 break; 2189 case TacticalLines.ANCHORAGE_LINE: 2190 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2191 acCounter = GetAnchorageDouble(pLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2192 break; 2193 case TacticalLines.LRO: 2194 int xCount = countsupport.GetXPointsCount(pOriginalLinePoints, arraysupport.getScaledSize(30, tg.get_LineThickness()), vblSaveCounter); 2195 POINT2[] xPoints2 = new POINT2[xCount]; 2196 int lvoCount = countsupport.GetLVOCount(pOriginalLinePoints, arraysupport.getScaledSize(30, tg.get_LineThickness()), vblSaveCounter); 2197 POINT2[] lvoPoints = new POINT2[lvoCount]; 2198 xCount = GetXPoints(pOriginalLinePoints, xPoints2, arraysupport.getScaledSize(30, tg.get_LineThickness()), vblSaveCounter); 2199 lvoCount = GetLVOPoints(pOriginalLinePoints, lvoPoints, arraysupport.getScaledSize(4, tg.get_LineThickness()), arraysupport.getScaledSize(30, tg.get_LineThickness()), vblSaveCounter); 2200 for (k = 0; k < xCount; k++) { 2201 pLinePoints[k] = new POINT2(xPoints2[k]); 2202 } 2203 if (xCount > 0) { 2204 pLinePoints[xCount - 1].style = 5; 2205 } 2206 for (k = 0; k < lvoCount; k++) { 2207 pLinePoints[xCount + k] = new POINT2(lvoPoints[k]); 2208 } 2209 acCounter = xCount + lvoCount; 2210 break; 2211 case TacticalLines.UNDERCAST: 2212 if (pLinePoints[0].x < pLinePoints[1].x) { 2213 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2214 } 2215 2216 lFlotCount = flot.GetFlotDouble(pLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2217 acCounter = lFlotCount; 2218 break; 2219 case TacticalLines.LVO: 2220 acCounter = GetLVOPoints(pOriginalLinePoints, pLinePoints, arraysupport.getScaledSize(4, tg.get_LineThickness()), arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2221 break; 2222 case TacticalLines.ICING: 2223 vblCounter = GetIcingPointsDouble(pLinePoints, arraysupport.getScaledSize(15, tg.get_LineThickness()), vblSaveCounter); 2224 acCounter = vblCounter; 2225 break; 2226 case TacticalLines.MVFR: 2227 //get the direction and quadrant of the first segment 2228 n = GetInsideOutsideDouble2(pLinePoints[0], pLinePoints[1], pLinePoints, vblSaveCounter, 0, lineType); 2229 nQuadrant = lineutility.GetQuadrantDouble(pLinePoints[0], pLinePoints[1]); 2230 //if the direction and quadrant are not compatible with GetFlotDouble then 2231 //reverse the points 2232 switch (nQuadrant) { 2233 case 4: 2234 switch (n) { 2235 case 0: //extend left 2236 case 3: //extend below 2237 break; 2238 case 1: //extend right 2239 case 2: //extend above 2240 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2241 break; 2242 default: 2243 break; 2244 } 2245 break; 2246 case 1: 2247 switch (n) { 2248 case 0: //extend left 2249 case 2: //extend above 2250 break; 2251 case 1: //extend right 2252 case 3: //extend below 2253 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2254 break; 2255 default: 2256 break; 2257 } 2258 break; 2259 case 2: 2260 switch (n) { 2261 case 0: //extend left 2262 case 3: //extend below 2263 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2264 break; 2265 case 1: //extend right 2266 case 2: //extend above 2267 break; 2268 default: 2269 break; 2270 } 2271 break; 2272 case 3: 2273 switch (n) { 2274 case 0: //extend left 2275 case 2: //extend above 2276 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2277 break; 2278 case 1: //extend right 2279 case 3: //extend above 2280 break; 2281 default: 2282 break; 2283 } 2284 break; 2285 default: 2286 break; 2287 } 2288 lFlotCount = flot.GetFlotDouble(pLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2289 acCounter = lFlotCount; 2290 break; 2291 case TacticalLines.ITD: 2292 acCounter = GetITDPointsDouble(pLinePoints, arraysupport.getScaledSize(15, tg.get_LineThickness()), vblSaveCounter); 2293 break; 2294 case TacticalLines.CONVERGENCE: 2295 acCounter = GetConvergencePointsDouble(pLinePoints, arraysupport.getScaledSize(10, tg.get_LineThickness()), vblSaveCounter); 2296 break; 2297 case TacticalLines.RIDGE: 2298 vblCounter = GetRidgePointsDouble(tg, pLinePoints, vblSaveCounter); 2299 acCounter = vblCounter; 2300 break; 2301 case TacticalLines.TROUGH: 2302 case TacticalLines.UPPER_TROUGH: 2303 case TacticalLines.INSTABILITY: 2304 case TacticalLines.SHEAR: 2305 vblCounter = GetSquallDouble(pLinePoints, arraysupport.getScaledSize(10, tg.get_LineThickness()), 6, arraysupport.getScaledSize(30, tg.get_LineThickness()), vblSaveCounter); 2306 acCounter = vblCounter; 2307 break; 2308 case TacticalLines.CABLE: 2309 vblCounter = GetSquallDouble(pLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness()), 6, arraysupport.getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 2310 acCounter = vblCounter; 2311 break; 2312 case TacticalLines.SQUALL: 2313 vblCounter = GetSevereSquall(pLinePoints, arraysupport.getScaledSize(30, tg.get_LineThickness()), vblSaveCounter); 2314 acCounter = vblCounter; 2315 break; 2316 case TacticalLines.SF: 2317 case TacticalLines.USF: 2318 case TacticalLines.SFG: 2319 case TacticalLines.SFY: 2320 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2321 vblCounter = flot.GetSFPointsDouble(tg, pLinePoints, vblSaveCounter); 2322 acCounter = vblCounter; 2323 break; 2324 case TacticalLines.OFY: 2325 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2326 vblCounter = flot.GetOFYPointsDouble(tg, pLinePoints, vblSaveCounter); 2327 acCounter = vblCounter; 2328 break; 2329 case TacticalLines.OCCLUDED: 2330 case TacticalLines.UOF: 2331 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2332 vblCounter = flot.GetOccludedPointsDouble(tg, pLinePoints, vblSaveCounter); 2333 for (j = 0; j < vblSaveCounter; j++) { 2334 pLinePoints[vblCounter + j] = pOriginalLinePoints[j]; 2335 } 2336 vblCounter += vblSaveCounter; 2337 acCounter = vblCounter; 2338 break; 2339 case TacticalLines.WF: 2340 case TacticalLines.UWF: 2341 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2342 lFlotCount = flot.GetFlot2Double(tg, pLinePoints, vblSaveCounter); 2343 for (j = 0; j < vblSaveCounter; j++) { 2344 pLinePoints[vblCounter - vblSaveCounter + j] = pOriginalLinePoints[j]; 2345 } 2346 acCounter = lFlotCount + vblSaveCounter; 2347 break; 2348 case TacticalLines.WFG: 2349 case TacticalLines.WFY: 2350 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 2351 lFlotCount = flot.GetFlot2Double(tg, pLinePoints, vblSaveCounter); 2352 acCounter = lFlotCount; 2353 break; 2354 case TacticalLines.CFG: 2355 case TacticalLines.CFY: 2356 vblCounter = GetATWallPointsDouble(tg, pLinePoints, vblSaveCounter); 2357 acCounter = vblCounter; 2358 break; 2359 case TacticalLines.CF: 2360 case TacticalLines.UCF: 2361 vblCounter = GetATWallPointsDouble(tg, pLinePoints, vblSaveCounter); 2362 pLinePoints[vblCounter - 1].style = 5; 2363 for (j = 0; j < vblSaveCounter; j++) { 2364 pLinePoints[vblCounter + j] = pOriginalLinePoints[j]; 2365 } 2366 vblCounter += vblSaveCounter; 2367 pLinePoints[vblCounter - 1].style = 5; 2368 acCounter = vblCounter; 2369 break; 2370 case TacticalLines.IL: 2371 case TacticalLines.PLANNED: 2372 case TacticalLines.ESR1: 2373 case TacticalLines.ESR2: 2374 lineutility.LineRelativeToLine(pLinePoints[0], pLinePoints[1], pLinePoints[2], pt0, pt1); 2375 d = lineutility.CalcDistanceDouble(pLinePoints[0], pt0); 2376 pt4 = lineutility.ExtendLineDouble(pt0, pLinePoints[0], d); 2377 lineutility.LineRelativeToLine(pLinePoints[0], pLinePoints[1], pt4, pt2, pt3); 2378 pLinePoints[0] = new POINT2(pt0); 2379 pLinePoints[1] = new POINT2(pt1); 2380 pLinePoints[2] = new POINT2(pt3); 2381 pLinePoints[3] = new POINT2(pt2); 2382 switch (lineType) { 2383 case TacticalLines.IL: 2384 case TacticalLines.ESR2: 2385 pLinePoints[0].style = 0; 2386 pLinePoints[1].style = 5; 2387 pLinePoints[2].style = 0; 2388 break; 2389 case TacticalLines.PLANNED: 2390 pLinePoints[0].style = 1; 2391 pLinePoints[1].style = 5; 2392 pLinePoints[2].style = 1; 2393 break; 2394 case TacticalLines.ESR1: 2395 pLinePoints[1].style = 5; 2396 if (pt0.x <= pt1.x) { 2397 if (pLinePoints[1].y <= pLinePoints[2].y) { 2398 pLinePoints[0].style = 0; 2399 pLinePoints[2].style = 1; 2400 } else { 2401 pLinePoints[0].style = 1; 2402 pLinePoints[2].style = 0; 2403 } 2404 } else { 2405 if (pLinePoints[1].y >= pLinePoints[2].y) { 2406 pLinePoints[0].style = 0; 2407 pLinePoints[2].style = 1; 2408 } else { 2409 pLinePoints[0].style = 1; 2410 pLinePoints[2].style = 0; 2411 } 2412 } 2413 break; 2414 default: 2415 break; 2416 } 2417 acCounter = 4; 2418 break; 2419 case TacticalLines.FORDSITE: 2420 lineutility.LineRelativeToLine(pLinePoints[0], pLinePoints[1], pLinePoints[2], pt0, pt1); 2421 pLinePoints[0].style = 1; 2422 pLinePoints[1].style = 5; 2423 pLinePoints[2] = new POINT2(pt0); 2424 pLinePoints[2].style = 1; 2425 pLinePoints[3] = new POINT2(pt1); 2426 pLinePoints[3].style = 5; 2427 acCounter = 4; 2428 break; 2429 case TacticalLines.ROADBLK: 2430 pts = new POINT2[4]; 2431 for (j = 0; j < 4; j++) { 2432 pts[j] = new POINT2(pLinePoints[j]); 2433 } 2434 dRadius = lineutility.CalcDistanceDouble(pLinePoints[0], pLinePoints[1]); 2435 d = lineutility.CalcDistanceToLineDouble(pLinePoints[0], pLinePoints[1], pLinePoints[2]); 2436 2437 //first two lines 2438 pLinePoints[0] = lineutility.ExtendTrueLinePerpDouble(pts[0], pts[1], pts[1], d, 0); 2439 pLinePoints[1] = lineutility.ExtendTrueLinePerpDouble(pts[0], pts[1], pts[0], d, 5); 2440 pLinePoints[2] = lineutility.ExtendTrueLinePerpDouble(pts[0], pts[1], pts[1], -d, 0); 2441 pLinePoints[3] = lineutility.ExtendTrueLinePerpDouble(pts[0], pts[1], pts[0], -d, 5); 2442 2443 midpt = lineutility.MidPointDouble(pts[0], pts[1], 0); 2444 //move the midpoint 2445 midpt = lineutility.ExtendLineDouble(pts[0], midpt, d); 2446 2447 //the next line 2448 pLinePoints[4] = lineutility.ExtendAngledLine(pts[0], pts[1], midpt, 105, dRadius / 2); 2449 pLinePoints[5] = lineutility.ExtendAngledLine(pts[0], pts[1], midpt, -75, dRadius / 2); 2450 pLinePoints[5].style = 5; 2451 2452 //recompute the original midpt because it was moved 2453 midpt = lineutility.MidPointDouble(pts[0], pts[1], 0); 2454 //move the midpoint 2455 midpt = lineutility.ExtendLineDouble(pts[1], midpt, d); 2456 2457 //the last line 2458 pLinePoints[6] = lineutility.ExtendAngledLine(pts[0], pts[1], midpt, 105, dRadius / 2); 2459 pLinePoints[7] = lineutility.ExtendAngledLine(pts[0], pts[1], midpt, -75, dRadius / 2); 2460 pLinePoints[7].style = 5; 2461 2462 acCounter = 8; 2463 break; 2464 case TacticalLines.AIRFIELD: 2465 AirfieldCenterFeature(pLinePoints, vblCounter); 2466 acCounter = vblCounter; 2467 //FillPoints(pLinePoints,acCounter,points); 2468 break; 2469 case TacticalLines.PNO: 2470 case TacticalLines.PLD: 2471 case TacticalLines.CFL: 2472 for (j = 0; j < vblCounter; j++) { 2473 pLinePoints[j].style = 1; 2474 } 2475 2476 acCounter = vblCounter; 2477 break; 2478 case TacticalLines.FENCED: 2479 FillPoints(pLinePoints, vblCounter, points); 2480 xPoints = lineutility.LineOfXPoints(tg, pOriginalLinePoints); 2481 for (j = 0; j < xPoints.size(); j++) { 2482 points.add((POINT2) xPoints.get(j)); 2483 } 2484 2485 acCounter = points.size(); 2486 break; 2487 case TacticalLines.FOXHOLE: 2488 bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m); 2489 2490 if (bolVertical == 0) //line is vertical 2491 { 2492 if (pt0.y > pt1.y) { 2493 direction = 0; 2494 } else { 2495 direction = 1; 2496 } 2497 } 2498 if (bolVertical != 0 && m.value[0] <= 1) { 2499 if (pt0.x < pt1.x) { 2500 direction = 3; 2501 } else { 2502 direction = 2; 2503 } 2504 } 2505 if (bolVertical != 0 && m.value[0] > 1) { 2506 if (pt0.x < pt1.x && pt0.y > pt1.y) { 2507 direction = 1; 2508 } 2509 if (pt0.x < pt1.x && pt0.y < pt1.y) { 2510 direction = 0; 2511 } 2512 2513 if (pt0.x > pt1.x && pt0.y > pt1.y) { 2514 direction = 1; 2515 } 2516 if (pt0.x > pt1.x && pt0.y < pt1.y) { 2517 direction = 0; 2518 } 2519 } 2520 2521 if (dMBR / 20 > maxLength * DPIScaleFactor) { 2522 dMBR = 20 * maxLength * DPIScaleFactor; 2523 } 2524 if (dMBR / 20 < minLength * DPIScaleFactor) { 2525 dMBR = 20 * minLength * DPIScaleFactor; 2526 } 2527 if (dMBR < 250 * DPIScaleFactor) { 2528 dMBR = 250 * DPIScaleFactor; 2529 } 2530 if (dMBR > 500 * DPIScaleFactor) { 2531 dMBR = 500 * DPIScaleFactor; 2532 } 2533 2534 pLinePoints[0] = lineutility.ExtendDirectedLine(pt0, pt1, pt0, direction, dMBR / 20); 2535 pLinePoints[1] = new POINT2(pt0); 2536 pLinePoints[2] = new POINT2(pt1); 2537 pLinePoints[3] = lineutility.ExtendDirectedLine(pt0, pt1, pt1, direction, dMBR / 20); 2538 acCounter = 4; 2539 break; 2540 case TacticalLines.ISOLATE: 2541 case TacticalLines.CORDONKNOCK: 2542 case TacticalLines.CORDONSEARCH: 2543 GetIsolatePointsDouble(pLinePoints, lineType, converter); 2544 acCounter = 50; 2545 break; 2546 case TacticalLines.OCCUPY: 2547 GetIsolatePointsDouble(pLinePoints, lineType, converter); 2548 acCounter = 32; 2549 break; 2550 case TacticalLines.RETAIN: 2551 GetIsolatePointsDouble(pLinePoints, lineType, converter); 2552 acCounter = 75; 2553 break; 2554 case TacticalLines.SECURE: 2555 GetIsolatePointsDouble(pLinePoints, lineType, converter); 2556 acCounter = 29; 2557 break; 2558 case TacticalLines.TURN: 2559 // Switch first and last point. Order changed in 2525C 2560 POINT2 swapPt = pLinePoints[0]; 2561 pLinePoints[0] = pLinePoints[1]; 2562 pLinePoints[1] = swapPt; 2563 GetIsolatePointsDouble(pLinePoints, lineType, null); 2564 acCounter = 29; 2565 break; 2566 case TacticalLines.ENCIRCLE: 2567 case TacticalLines.ZONE: 2568 case TacticalLines.OBSAREA: 2569 case TacticalLines.OBSFAREA: 2570 case TacticalLines.STRONG: 2571 case TacticalLines.FORT_REVD: 2572 case TacticalLines.FORT: 2573 acCounter = GetZONEPointsDouble2(tg, pLinePoints, vblSaveCounter); 2574 break; 2575 case TacticalLines.ATWALL: 2576 case TacticalLines.LINE: //7-9-07 2577 acCounter = GetATWallPointsDouble2(tg, pLinePoints, vblSaveCounter); 2578 break; 2579 case TacticalLines.SC: 2580 case TacticalLines.MRR: 2581 case TacticalLines.SL: 2582 case TacticalLines.TC: 2583 case TacticalLines.LLTR: //added 5-4-07 2584 case TacticalLines.SAAFR: //these have multiple segments 2585 case TacticalLines.AC: 2586 boolean bolSegmentAC = false; 2587 //uncomment the next line if the air corridor is segmented 2588 bolSegmentAC = true; 2589 dMRR = dACP; 2590 lineutility.InitializePOINT2Array(acPoints); 2591 lineutility.InitializePOINT2Array(arcPts); 2592 acCounter = 0; 2593 if (!bolSegmentAC) { 2594 for (j = 0; j < vblSaveCounter; j++) { 2595 if (pOriginalLinePoints[j].style <= 0) { 2596 pOriginalLinePoints[j].style = 1; //was 14 2597 } 2598 } 2599 } 2600 //get the SAAFR segments 2601 for (j = 0; j < vblSaveCounter - 1; j++) { 2602 //diagnostic: use style member for dMBR 2603 dMBR = pOriginalLinePoints[j].style; 2604 acPoints[0] = new POINT2(pOriginalLinePoints[j]); 2605 acPoints[1] = new POINT2(pOriginalLinePoints[j + 1]); 2606 lineutility.GetSAAFRSegment(acPoints, lineType, dMBR);//was dMRR 2607 for (k = 0; k < 6; k++) { 2608 pLinePoints[acCounter] = new POINT2(acPoints[k]); 2609 acCounter++; 2610 } 2611 } 2612 //get the circles 2613 int currentCircleSize = 0; 2614 if (!bolSegmentAC) 2615 { 2616 for (j = 0; j < vblSaveCounter - 1; j++) { 2617 currentCircleSize = pOriginalLinePoints[j].style; 2618 //nextCircleSize=pOriginalLinePoints[j+1].style; 2619 2620 //draw the circle at the segment front end 2621 arcPts[0] = new POINT2(pOriginalLinePoints[j]); 2622 //diagnostic: use style member for dMBR 2623 dMBR = currentCircleSize; 2624 lineutility.CalcCircleDouble(arcPts[0], dMBR, 26, arcPts, 0);//was dMRR 2625 arcPts[25].style = 5; 2626 for (k = 0; k < 26; k++) { 2627 pLinePoints[acCounter] = new POINT2(arcPts[k]); 2628 acCounter++; 2629 } 2630 2631 //draw the circle at the segment back end 2632 arcPts[0] = new POINT2(pOriginalLinePoints[j + 1]); 2633 dMBR = currentCircleSize; 2634 lineutility.CalcCircleDouble(arcPts[0], dMBR, 26, arcPts, 0);//was dMRR 2635 arcPts[25].style = 5; 2636 for (k = 0; k < 26; k++) { 2637 pLinePoints[acCounter] = new POINT2(arcPts[k]); 2638 acCounter++; 2639 } 2640 } 2641 } 2642 else //segmented air corridors 2643 { 2644 int lastCircleSize = 0; 2645 POINT2 lastCirclePoint = null; 2646 for (j = 0; j < vblSaveCounter; j++) { 2647 currentCircleSize = pOriginalLinePoints[j].style; 2648 if (j == 0) { 2649 lastCircleSize = currentCircleSize; 2650 lastCirclePoint = pOriginalLinePoints[j]; 2651 continue; 2652 } 2653 if (currentCircleSize < 0) { 2654 continue; 2655 } 2656 //the current circle point 2657 arcPts[0] = new POINT2(pOriginalLinePoints[j]); 2658 dMBR = lastCircleSize; 2659 lineutility.CalcCircleDouble(arcPts[0], dMBR, 26, arcPts, 0); 2660 arcPts[25].style = 5; 2661 for (k = 0; k < 26; k++) { 2662 pLinePoints[acCounter] = new POINT2(arcPts[k]); 2663 acCounter++; 2664 } 2665 //the previous circle point 2666 arcPts[0] = new POINT2(lastCirclePoint); 2667 lineutility.CalcCircleDouble(arcPts[0], dMBR, 26, arcPts, 0); 2668 arcPts[25].style = 5; 2669 for (k = 0; k < 26; k++) { 2670 pLinePoints[acCounter] = new POINT2(arcPts[k]); 2671 acCounter++; 2672 } 2673 //set the last values 2674 lastCircleSize = currentCircleSize; 2675 lastCirclePoint = pOriginalLinePoints[j]; 2676 } 2677 } 2678 break; 2679 case TacticalLines.MINED: 2680 case TacticalLines.UXO: 2681 case TacticalLines.ACOUSTIC: 2682 case TacticalLines.ACOUSTIC_AMB: 2683 case TacticalLines.BEARING: 2684 case TacticalLines.BEARING_J: 2685 case TacticalLines.BEARING_RDF: 2686 case TacticalLines.ELECTRO: 2687 case TacticalLines.BEARING_EW: 2688 case TacticalLines.TORPEDO: 2689 case TacticalLines.OPTICAL: 2690 acCounter = vblCounter; 2691 break; 2692 case TacticalLines.MSDZ: 2693 lineutility.InitializePOINT2Array(circlePoints); 2694 pt3 = new POINT2(pLinePoints[3]); 2695 //dRadius = lineutility.CalcDistanceDouble(pt0, pt1); 2696 if(converter==null) 2697 { 2698 dRadius = lineutility.CalcDistanceDouble(pt0, pt1); 2699 lineutility.CalcCircleDouble(pt0, dRadius, 100, 2700 circlePoints, 0); 2701 } 2702 else //use the converter 2703 lineutility.CalcCircleDouble2(pt0, pt1, 100, 2704 circlePoints, converter); 2705 for (j = 0; j < 100; j++) { 2706 pLinePoints[j] = new POINT2(circlePoints[j]); 2707 } 2708 pLinePoints[99].style = 5; 2709 //dRadius = lineutility.CalcDistanceDouble(pt0, pt2); 2710 if(converter==null) 2711 { 2712 dRadius = lineutility.CalcDistanceDouble(pt0, pt2); 2713 lineutility.CalcCircleDouble(pt0, dRadius, 100, 2714 circlePoints, 0); 2715 } 2716 else 2717 lineutility.CalcCircleDouble2(pt0, pt2, 100, 2718 circlePoints, converter); 2719 for (j = 0; j < 100; j++) { 2720 pLinePoints[100 + j] = new POINT2(circlePoints[j]); 2721 } 2722 pLinePoints[199].style = 5; 2723 //dRadius = lineutility.CalcDistanceDouble(pt0, pt3); 2724 if (vblSaveCounter == 4) { 2725 if (converter == null) { 2726 dRadius = lineutility.CalcDistanceDouble(pt0, pt3); 2727 lineutility.CalcCircleDouble(pt0, dRadius, 100, 2728 circlePoints, 0); 2729 } else 2730 lineutility.CalcCircleDouble2(pt0, pt3, 100, 2731 circlePoints, converter); 2732 for (j = 0; j < 100; j++) { 2733 pLinePoints[200 + j] = new POINT2(circlePoints[j]); 2734 } 2735 } 2736 acCounter = vblCounter; 2737 //FillPoints(pLinePoints,acCounter,points); 2738 break; 2739 case TacticalLines.CONVOY: 2740 if (dMBR < 150 * DPIScaleFactor) { 2741 dMBR = 150 * DPIScaleFactor; 2742 } 2743 if (dMBR > 500 * DPIScaleFactor) { 2744 dMBR = 500 * DPIScaleFactor; 2745 } 2746 dWidth = dMBR / 25; 2747 2748 pt0 = new POINT2(pLinePoints[0]); 2749 pt1 = new POINT2(pLinePoints[1]); 2750 2751 bolVertical = lineutility.CalcTrueSlopeDouble(pt1, pt0, m); 2752 pt0 = lineutility.ExtendLine2Double(pt1, pt0, -dWidth*3, 0); 2753 if (m.value[0] < 1) { 2754 pLinePoints[0] = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 2, dWidth); 2755 pLinePoints[1] = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 2, dWidth); 2756 pLinePoints[2] = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 3, dWidth); 2757 pLinePoints[3] = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 3, dWidth); 2758 } else { 2759 pLinePoints[0] = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 0, dWidth); 2760 pLinePoints[1] = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 0, dWidth); 2761 pLinePoints[2] = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 1, dWidth); 2762 pLinePoints[3] = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 1, dWidth); 2763 } 2764 pt2 = lineutility.ExtendLineDouble(pt1, pt0, dWidth * 3); 2765 lineutility.GetArrowHead4Double(pt0, pt2, (int) (dWidth * 3), (int) (dWidth * 3), pArrowPoints, 0); 2766 2767 d = lineutility.CalcDistanceDouble(pLinePoints[0], pArrowPoints[0]); 2768 d1 = lineutility.CalcDistanceDouble(pLinePoints[3], pArrowPoints[0]); 2769 pLinePoints[3].style = 5; 2770 if (d < d1) { 2771 pLinePoints[4] = new POINT2(pLinePoints[0]); 2772 pLinePoints[4].style = 0; 2773 pLinePoints[5] = new POINT2(pArrowPoints[0]); 2774 pLinePoints[5].style = 0; 2775 pLinePoints[6] = new POINT2(pArrowPoints[1]); 2776 pLinePoints[6].style = 0; 2777 pLinePoints[7] = new POINT2(pArrowPoints[2]); 2778 pLinePoints[7].style = 0; 2779 pLinePoints[8] = new POINT2(pLinePoints[3]); 2780 } else { 2781 pLinePoints[4] = pLinePoints[3]; 2782 pLinePoints[4].style = 0; 2783 pLinePoints[5] = pArrowPoints[0]; 2784 pLinePoints[5].style = 0; 2785 pLinePoints[6] = pArrowPoints[1]; 2786 pLinePoints[6].style = 0; 2787 pLinePoints[7] = pArrowPoints[2]; 2788 pLinePoints[7].style = 0; 2789 pLinePoints[8] = pLinePoints[0]; 2790 } 2791 2792 acCounter = 9; 2793 //FillPoints(pLinePoints,acCounter,points); 2794 break; 2795 case TacticalLines.HCONVOY: 2796 if (dMBR < 150 * DPIScaleFactor) { 2797 dMBR = 150 * DPIScaleFactor; 2798 } 2799 if (dMBR > 500 * DPIScaleFactor) { 2800 dMBR = 500 * DPIScaleFactor; 2801 } 2802 dWidth = dMBR / 25; 2803 2804 pt0 = new POINT2(pLinePoints[0]); 2805 pt1 = new POINT2(pLinePoints[1]); 2806 2807 pt2 = lineutility.ExtendAlongLineDouble(pt0, pt1, dWidth * 2); // Arrow point 2808 lineutility.GetArrowHead4Double(pt0, pt2, (int) dWidth * 2, (int) dWidth * 2, pArrowPoints, 0); 2809 2810 bolVertical = lineutility.CalcTrueSlopeDouble(pt1, pt2, m); 2811 if (m.value[0] < 1) { 2812 pLinePoints[0] = lineutility.ExtendDirectedLine(pt2, pt1, pt2, lineutility.extend_above, dWidth); 2813 pLinePoints[1] = lineutility.ExtendDirectedLine(pt2, pt1, pt1, lineutility.extend_above, dWidth); 2814 pLinePoints[2] = lineutility.ExtendDirectedLine(pt2, pt1, pt1, lineutility.extend_below, dWidth); 2815 pLinePoints[3] = lineutility.ExtendDirectedLine(pt2, pt1, pt2, lineutility.extend_below, dWidth); 2816 } else { 2817 pLinePoints[0] = lineutility.ExtendDirectedLine(pt2, pt1, pt2, lineutility.extend_left, dWidth); 2818 pLinePoints[1] = lineutility.ExtendDirectedLine(pt2, pt1, pt1, lineutility.extend_left, dWidth); 2819 pLinePoints[2] = lineutility.ExtendDirectedLine(pt2, pt1, pt1, lineutility.extend_right, dWidth); 2820 pLinePoints[3] = lineutility.ExtendDirectedLine(pt2, pt1, pt2, lineutility.extend_right, dWidth); 2821 } 2822 2823 pLinePoints[4] = new POINT2(pLinePoints[0]); 2824 pLinePoints[5] = new POINT2(pt2); 2825 pLinePoints[5].style = 0; 2826 2827 pLinePoints[6] = new POINT2(pArrowPoints[1]); 2828 pLinePoints[7] = new POINT2(pArrowPoints[0]); 2829 pLinePoints[8] = new POINT2(pArrowPoints[2]); 2830 pLinePoints[8].style = 0; 2831 pLinePoints[9] = new POINT2(pArrowPoints[1]); 2832 2833 acCounter = 10; 2834 //FillPoints(pLinePoints,acCounter,points); 2835 break; 2836 case TacticalLines.MSR_ONEWAY: 2837 case TacticalLines.MSR_TWOWAY: 2838 case TacticalLines.MSR_ALT: 2839 case TacticalLines.ASR_ONEWAY: 2840 case TacticalLines.ASR_TWOWAY: 2841 case TacticalLines.ASR_ALT: 2842 case TacticalLines.ROUTE_ONEWAY: 2843 case TacticalLines.ROUTE_ALT: 2844 nCounter = (int) vblSaveCounter; 2845 pLinePoints[vblSaveCounter - 1].style = 5; 2846 for (j = 0; j < vblSaveCounter - 1; j++) { 2847 d = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]); 2848 if (d < 20) //too short 2849 { 2850 continue; 2851 } 2852 pt0 = new POINT2(pLinePoints[j]); 2853 pt1 = new POINT2(pLinePoints[j + 1]); 2854 pt2 = lineutility.ExtendLine2Double(pLinePoints[j], pLinePoints[j + 1], -3 * d / 4, 0); 2855 pt3 = lineutility.ExtendLine2Double(pLinePoints[j], pLinePoints[j + 1], -1 * d / 4, 5); 2856 double distFromLine = 10 * DPIScaleFactor; 2857 direction = SupplyRouteArrowSide(pLinePoints[j], pLinePoints[j + 1]); 2858 pt2 = lineutility.ExtendDirectedLine(pt0, pt1, pt2, direction, distFromLine); 2859 pt3 = lineutility.ExtendDirectedLine(pt0, pt1, pt3, direction, distFromLine); 2860 pLinePoints[nCounter] = new POINT2(pt2); 2861 nCounter++; 2862 pLinePoints[nCounter] = new POINT2(pt3); 2863 nCounter++; 2864 2865 d = distFromLine; 2866 if (dMBR / 20 < minLength * DPIScaleFactor) { 2867 d = 5 * DPIScaleFactor; 2868 } 2869 2870 lineutility.GetArrowHead4Double(pt2, pt3, (int) d, (int) d, 2871 pArrowPoints, 0); 2872 2873 for (k = 0; k < 3; k++) { 2874 pLinePoints[nCounter] = new POINT2(pArrowPoints[k]); 2875 nCounter++; 2876 } 2877 2878 if (lineType == TacticalLines.MSR_ALT || lineType == TacticalLines.ASR_ALT || lineType == TacticalLines.ROUTE_ALT) { 2879 lineutility.GetArrowHead4Double(pt3, pt2, (int) d, (int) d, 2880 pArrowPoints, 0); 2881 2882 for (k = 0; k < 3; k++) { 2883 pLinePoints[nCounter] = new POINT2(pArrowPoints[k]); 2884 nCounter++; 2885 } 2886 } 2887 if (lineType == TacticalLines.MSR_TWOWAY || lineType == TacticalLines.ASR_TWOWAY) { 2888 distFromLine = 15 * DPIScaleFactor; 2889 pt2 = lineutility.ExtendDirectedLine(pt0, pt1, pt2, direction, distFromLine); 2890 pt3 = lineutility.ExtendDirectedLine(pt0, pt1, pt3, direction, distFromLine); 2891 2892 pLinePoints[nCounter] = new POINT2(pt2); 2893 nCounter++; 2894 pLinePoints[nCounter] = new POINT2(pt3); 2895 nCounter++; 2896 lineutility.GetArrowHead4Double(pt3, pt2, (int) d, (int) d, 2897 pArrowPoints, 0); 2898 2899 for (k = 0; k < 3; k++) { 2900 pLinePoints[nCounter] = new POINT2(pArrowPoints[k]); 2901 nCounter++; 2902 } 2903 } 2904 } 2905 acCounter = nCounter; 2906 break; 2907 case TacticalLines.FORDIF: 2908 lineutility.LineRelativeToLine(pLinePoints[0], pLinePoints[1], pLinePoints[2], pt4, pt5); //as pt2,pt3 2909 pLinePoints[2] = new POINT2(pt5);//was pt3 2910 pLinePoints[3] = new POINT2(pt4);//was pt2 2911 2912 for (j = 0; j < vblCounter; j++) { 2913 pLinePoints[j].style = 1; 2914 } 2915 2916 pt0 = lineutility.MidPointDouble(pLinePoints[0], pLinePoints[1], 0); 2917 pt1 = lineutility.MidPointDouble(pLinePoints[2], pLinePoints[3], 0); 2918 POINT2[] savepoints = null; 2919 Boolean drawJaggies = true; 2920 if (clipBounds != null) { 2921 POINT2 ul = new POINT2(clipBounds.getMinX(), clipBounds.getMinY()); 2922 POINT2 lr = new POINT2(clipBounds.getMaxX(), clipBounds.getMaxY()); 2923 savepoints = lineutility.BoundOneSegment(pt0, pt1, ul, lr); 2924 if (savepoints != null && savepoints.length > 1) { 2925 pt0 = savepoints[0]; 2926 pt1 = savepoints[1]; 2927 } else { 2928 savepoints = new POINT2[2]; 2929 savepoints[0] = new POINT2(pt0); 2930 savepoints[1] = new POINT2(pt1); 2931 drawJaggies = false; 2932 } 2933 } 2934 2935 midpt = lineutility.MidPointDouble(pt0, pt1, 0); 2936 double dist0 = lineutility.CalcDistanceDouble(midpt, pt0); 2937 double dist1 = lineutility.CalcDistanceDouble(midpt, pt1); 2938 2939 if (dist0 > dist1) { 2940 lineutility.LineRelativeToLine(pLinePoints[2], pLinePoints[3], pt0, pt4, pt5); 2941 pLinePoints[0] = new POINT2(pt5.x, pt5.y, 1); 2942 pLinePoints[1] = new POINT2(pt4.x, pt4.y, 1); 2943 } else { 2944 lineutility.LineRelativeToLine(pLinePoints[0], pLinePoints[1], pt1, pt4, pt5); 2945 pLinePoints[2] = new POINT2(pt5.x, pt5.y, 1); 2946 pLinePoints[3] = new POINT2(pt4.x, pt4.y, 1); 2947 } 2948 2949 //end section 2950 //calculate start, end points for upper and lower lines 2951 //across the middle 2952 double spikeLength = getScaledSize(10, tg.get_LineThickness()); 2953 pt2 = lineutility.ExtendLine2Double(pLinePoints[0], pt0, -spikeLength, 0); 2954 pt3 = lineutility.ExtendLine2Double(pLinePoints[3], pt1, -spikeLength, 0); 2955 pt4 = lineutility.ExtendLine2Double(pLinePoints[0], pt0, spikeLength, 0); 2956 pt5 = lineutility.ExtendLine2Double(pLinePoints[3], pt1, spikeLength, 0); 2957 2958 dWidth = lineutility.CalcDistanceDouble(pt0, pt1); 2959 2960 pointCounter = 4; 2961 n = 1; 2962 pLinePoints[pointCounter] = new POINT2(pt0); 2963 pLinePoints[pointCounter].style = 0; 2964 pointCounter++; 2965 if (drawJaggies) { 2966 while (dExtendLength < dWidth - spikeLength) { 2967 dExtendLength = (double) n * spikeLength / 2; 2968 pLinePoints[pointCounter] = lineutility.ExtendLine2Double(pt2, pt3, dExtendLength - dWidth, 0); 2969 pointCounter++; 2970 n++; 2971 //dExtendLength = (double) n * 10; 2972 dExtendLength = (double) n * spikeLength / 2; 2973 pLinePoints[pointCounter] = lineutility.ExtendLine2Double(pt4, pt5, dExtendLength - dWidth, 0); 2974 pointCounter++; 2975 if (pointCounter >= pLinePoints.length - 1) { 2976 break; 2977 } 2978 n++; 2979 } 2980 } 2981 pLinePoints[pointCounter] = new POINT2(pt1); 2982 pLinePoints[pointCounter].style = 5; 2983 pointCounter++; 2984 acCounter = pointCounter; 2985 break; 2986 case TacticalLines.ATDITCH: 2987 acCounter = lineutility.GetDitchSpikeDouble(tg, pLinePoints, vblSaveCounter, 0); 2988 break; 2989 case (int) TacticalLines.ATDITCHC: //extra Points were calculated by a function 2990 pLinePoints[0].style = 9; 2991 acCounter = lineutility.GetDitchSpikeDouble(tg, pLinePoints, vblSaveCounter, 0); 2992 //pLinePoints[vblCounter-1].style=10; 2993 break; 2994 case TacticalLines.ATDITCHM: 2995 lineutility.ReversePointsDouble2( 2996 pLinePoints, 2997 vblSaveCounter); 2998 pLinePoints[0].style = 9; 2999 acCounter = lineutility.GetDitchSpikeDouble(tg, pLinePoints, vblSaveCounter, 0); 3000 break; 3001 case TacticalLines.DIRATKGND: 3002 //was 20 3003 if (dMBR / 30 > maxLength * DPIScaleFactor) { 3004 dMBR = 30 * maxLength * DPIScaleFactor; 3005 } 3006 if (dMBR / 30 < minLength * DPIScaleFactor) { 3007 dMBR = 30 * minLength * DPIScaleFactor; 3008 } 3009 if (dMBR < 150 * DPIScaleFactor) { 3010 dMBR = 150 * DPIScaleFactor; 3011 } 3012 if (dMBR > 500 * DPIScaleFactor) { 3013 dMBR = 500 * DPIScaleFactor; 3014 } 3015 3016 d = lineutility.CalcDistanceDouble(pLinePoints[0], pLinePoints[1]); 3017 if (d < dMBR / 40) { 3018 pLinePoints[1] = lineutility.ExtendLineDouble(pLinePoints[0], pLinePoints[1], dMBR / 40 + 1); 3019 } 3020 3021 pLinePoints[0] = lineutility.ExtendAlongLineDouble(pLinePoints[0], pLinePoints[1], dMBR / 40); 3022 3023 //reverse the points 3024 lineutility.ReversePointsDouble2( 3025 pLinePoints, 3026 vblSaveCounter); 3027 3028 pt0 = new POINT2(pLinePoints[vblCounter - 12]); 3029 pt1 = new POINT2(pLinePoints[vblCounter - 11]); 3030 pt2 = lineutility.ExtendLineDouble(pt0, pt1, dMBR / 40); 3031 lineutility.GetArrowHead4Double(pt0, pt1, (int) dMBR / 20, (int) dMBR / 20, 3032 pArrowPoints, 0); 3033 3034 for (j = 0; j < 3; j++) { 3035 pLinePoints[vblCounter - 10 + j] = new POINT2(pArrowPoints[j]); 3036 } 3037 lineutility.GetArrowHead4Double(pt0, pt2, (int) (dMBR / 13.33), (int) (dMBR / 13.33), 3038 pArrowPoints, 0); 3039 3040 for (j = 0; j < 3; j++) { 3041 pLinePoints[vblCounter - 7 + j] = new POINT2(pArrowPoints[j]); 3042 } 3043 3044 pLinePoints[vblCounter - 4] = new POINT2(pLinePoints[vblCounter - 10]); 3045 pLinePoints[vblCounter - 4].style = 0; 3046 pLinePoints[vblCounter - 3] = new POINT2(pLinePoints[vblCounter - 7]); 3047 pLinePoints[vblCounter - 3].style = 5; 3048 3049 pLinePoints[vblCounter - 2] = new POINT2(pLinePoints[vblCounter - 8]); 3050 pLinePoints[vblCounter - 2].style = 0; 3051 pLinePoints[vblCounter - 1] = new POINT2(pLinePoints[vblCounter - 5]); 3052 pLinePoints[vblCounter - 1].style = 5; 3053 acCounter = vblCounter; 3054 break; 3055 case TacticalLines.MFLANE: 3056 case TacticalLines.RAFT: 3057 pt2 = lineutility.ExtendLineDouble(pLinePoints[vblCounter - 8], pLinePoints[vblCounter - 7], dMBR / 2); 3058 pt3 = new POINT2(pLinePoints[vblCounter - 7]); 3059 pt1 = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], dMBR / 2); 3060 3061 if (dMBR / 10 > maxLength * DPIScaleFactor) { 3062 dMBR = 10 * maxLength * DPIScaleFactor; 3063 } 3064 if (dMBR / 10 < minLength * DPIScaleFactor) { 3065 dMBR = 10 * minLength * DPIScaleFactor; 3066 } 3067 if (dMBR > 250 * DPIScaleFactor) { 3068 dMBR = 250 * DPIScaleFactor; 3069 } 3070 3071 lineutility.GetArrowHead4Double(pt2, pt3, (int) dMBR / 10, (int) dMBR / 5, 3072 pArrowPoints, 0); 3073 3074 for (k = 0; k < 3; k++) { 3075 pLinePoints[vblCounter - 6 + k] = new POINT2(pArrowPoints[k]); 3076 } 3077 3078 lineutility.GetArrowHead4Double(pt1, pt0, (int) dMBR / 10, (int) dMBR / 5, 3079 pArrowPoints, 0); 3080 3081 for (k = 0; k < 3; k++) { 3082 pLinePoints[vblCounter - 3 + k] = new POINT2(pArrowPoints[k]); 3083 } 3084 pLinePoints[vblSaveCounter - 1].style = 5; 3085 acCounter = vblCounter; 3086 break; 3087 case TacticalLines.DIRATKAIR: 3088 lineutility.ReversePointsDouble2( 3089 pLinePoints, 3090 vblSaveCounter); 3091 3092 for (k = vblSaveCounter - 1; k > 0; k--) { 3093 d += lineutility.CalcDistanceDouble(pLinePoints[k], pLinePoints[k - 1]); 3094 if (d > 60) { 3095 break; 3096 } 3097 } 3098 if (d > 60) { 3099 middleSegment = k; 3100 pt2 = pLinePoints[middleSegment]; 3101 if (middleSegment >= 1) { 3102 pt3 = pLinePoints[middleSegment - 1]; 3103 } 3104 } else { 3105 if (vblSaveCounter <= 3) { 3106 middleSegment = 1; 3107 } else { 3108 middleSegment = 2; 3109 } 3110 3111 pt2 = pLinePoints[middleSegment]; 3112 if (middleSegment >= 1) { 3113 pt3 = pLinePoints[middleSegment - 1]; 3114 } 3115 } 3116 3117 pt0 = new POINT2(pLinePoints[0]); 3118 3119 if (dMBR / 20 > maxLength * DPIScaleFactor) { 3120 dMBR = 20 * maxLength * DPIScaleFactor; 3121 } 3122 if (dMBR / 20 < minLength * DPIScaleFactor) { 3123 dMBR = 20 * minLength * DPIScaleFactor; 3124 } 3125 if (dMBR < 150 * DPIScaleFactor) { 3126 dMBR = 150 * DPIScaleFactor; 3127 } 3128 3129 if (dMBR > 250 * DPIScaleFactor) { 3130 dMBR = 250 * DPIScaleFactor; 3131 } 3132 3133 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 11], pLinePoints[vblCounter - 10], (int) dMBR / 20, (int) dMBR / 20, 3134 pArrowPoints, 0); 3135 3136 for (j = 0; j < 3; j++) { 3137 pLinePoints[vblCounter - 9 + j] = new POINT2(pArrowPoints[j]); 3138 } 3139 3140 pLinePoints[vblCounter - 6].x = (pLinePoints[vblCounter - 11].x + pLinePoints[vblCounter - 10].x) / 2; 3141 pLinePoints[vblCounter - 6].y = (pLinePoints[vblCounter - 11].y + pLinePoints[vblCounter - 10].y) / 2; 3142 pt0 = new POINT2(pLinePoints[vblCounter - 6]); 3143 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 11], pt0, (int) dMBR / 20, (int) dMBR / 20, 3144 pArrowPoints, 9); 3145 3146 if (middleSegment >= 1) { 3147 pt0 = lineutility.MidPointDouble(pt2, pt3, 0); 3148 lineutility.GetArrowHead4Double(pt3, pt0, (int) dMBR / 20, (int) dMBR / 20, 3149 pArrowPoints, 9); 3150 } 3151 3152 for (j = 0; j < 3; j++) { 3153 pLinePoints[vblCounter - 6 + j] = new POINT2(pArrowPoints[j]); 3154 } 3155 3156 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 10], pt0, (int) dMBR / 20, (int) dMBR / 20, 3157 pArrowPoints, 9); 3158 if (middleSegment >= 1) { 3159 pt0 = lineutility.MidPointDouble(pt2, pt3, 0); 3160 lineutility.GetArrowHead4Double(pt2, pt0, (int) dMBR / 20, (int) dMBR / 20, 3161 pArrowPoints, 9); 3162 } 3163 for (j = 0; j < 3; j++) { 3164 pLinePoints[vblCounter - 3 + j] = new POINT2(pArrowPoints[j]); 3165 } 3166 3167 //this section was added to remove fill from the bow tie feature 3168 ArrayList<POINT2> airPts = new ArrayList(); 3169 pLinePoints[middleSegment - 1].style = 5; 3170 //pLinePoints[middleSegment].style=14; 3171 if (vblSaveCounter == 2) { 3172 pLinePoints[1].style = 5; 3173 } 3174 3175 for (j = 0; j < vblCounter; j++) { 3176 airPts.add(new POINT2(pLinePoints[j])); 3177 } 3178 3179 midpt = lineutility.MidPointDouble(pLinePoints[middleSegment - 1], pLinePoints[middleSegment], 0); 3180 pt0 = lineutility.ExtendAlongLineDouble(midpt, pLinePoints[middleSegment], dMBR / 20, 0); 3181 airPts.add(pt0); 3182 pt1 = new POINT2(pLinePoints[middleSegment]); 3183 pt1.style = 5; 3184 airPts.add(pt1); 3185 3186 pt0 = lineutility.ExtendAlongLineDouble(midpt, pLinePoints[middleSegment - 1], dMBR / 20, 0); 3187 airPts.add(pt0); 3188 pt1 = new POINT2(pLinePoints[middleSegment - 1]); 3189 pt1.style = 5; 3190 airPts.add(pt1); 3191 3192 //re-dimension pLinePoints so that it can hold the 3193 //the additional points required by the shortened middle segment 3194 //which has the bow tie feature 3195 vblCounter = airPts.size(); 3196 pLinePoints = new POINT2[airPts.size()]; 3197 for (j = 0; j < airPts.size(); j++) { 3198 pLinePoints[j] = new POINT2(airPts.get(j)); 3199 } 3200 //end section 3201 3202 acCounter = vblCounter; 3203 //FillPoints(pLinePoints,vblCounter,points); 3204 break; 3205 case TacticalLines.PDF: 3206 pt0 = new POINT2(pLinePoints[1]); 3207 pt1 = new POINT2(pLinePoints[0]); 3208 pLinePoints[0] = new POINT2(pt0); 3209 pLinePoints[1] = new POINT2(pt1); 3210 pts2 = new POINT2[3]; 3211 pts2[0] = new POINT2(pt0); 3212 pts2[1] = new POINT2(pt1); 3213 pts2[2] = new POINT2(pt2); 3214 lineutility.GetPixelsMin(pts2, 3, 3215 offsetX, 3216 offsetY); 3217 if (offsetX.value[0] < 0) { 3218 offsetX.value[0] = offsetX.value[0] - 100; 3219 } else { 3220 offsetX.value[0] = 0; 3221 } 3222 3223 pLinePoints[2].style = 5; 3224 3225 if (dMBR / 20 > maxLength * DPIScaleFactor) { 3226 dMBR = 20 * maxLength * DPIScaleFactor; 3227 } 3228 if (dMBR / 20 < minLength * DPIScaleFactor) { 3229 dMBR = 20 * minLength * DPIScaleFactor; 3230 } 3231 if (dMBR > 500 * DPIScaleFactor) { 3232 dMBR = 500 * DPIScaleFactor; 3233 } 3234 3235 double rectWidth = getScaledSize(2, tg.get_LineThickness() / 2.0); 3236 3237 pt2 = lineutility.ExtendLineDouble(pt0, pt1, -dMBR / 10); 3238 bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m); 3239 if (bolVertical != 0 && m.value[0] != 0) { 3240 b = pt2.y + (1 / m.value[0]) * pt2.x; 3241 b1 = (-1 / m.value[0]) * offsetX.value[0] + b; 3242 ptYIntercept.x = offsetX.value[0]; 3243 ptYIntercept.y = b1; 3244 pLinePoints[3] = lineutility.ExtendLineDouble(ptYIntercept, pt2, -rectWidth); 3245 pLinePoints[3].style = 0; 3246 pLinePoints[4] = lineutility.ExtendLineDouble(ptYIntercept, pt2, rectWidth); 3247 pLinePoints[4].style = 0; 3248 } 3249 if (bolVertical != 0 && m.value[0] == 0) { 3250 pLinePoints[3] = new POINT2(pt2); 3251 pLinePoints[3].y = pt2.y - rectWidth; 3252 pLinePoints[3].style = 0; 3253 pLinePoints[4] = new POINT2(pt2); 3254 pLinePoints[4].y = pt2.y + rectWidth; 3255 pLinePoints[4].style = 0; 3256 } 3257 if (bolVertical == 0) { 3258 pLinePoints[3] = new POINT2(pt2); 3259 pLinePoints[3].x = pt2.x - rectWidth; 3260 pLinePoints[3].style = 0; 3261 pLinePoints[4] = new POINT2(pt2); 3262 pLinePoints[4].x = pt2.x + rectWidth; 3263 pLinePoints[4].style = 0; 3264 } 3265 3266 pt2 = lineutility.ExtendLineDouble(pt1, pt0, -dMBR / 10); 3267 if (bolVertical != 0 && m.value[0] != 0) { 3268 b = pt2.y + (1 / m.value[0]) * pt2.x; 3269 //get the Y intercept at x=offsetX 3270 b1 = (-1 / m.value[0]) * offsetX.value[0] + b; 3271 ptYIntercept.x = offsetX.value[0]; 3272 ptYIntercept.y = b1; 3273 pLinePoints[5] = lineutility.ExtendLineDouble(ptYIntercept, pt2, rectWidth); 3274 pLinePoints[5].style = 0; 3275 pLinePoints[6] = lineutility.ExtendLineDouble(ptYIntercept, pt2, -rectWidth); 3276 } 3277 if (bolVertical != 0 && m.value[0] == 0) { 3278 pLinePoints[5] = new POINT2(pt2); 3279 pLinePoints[5].y = pt2.y + rectWidth; 3280 pLinePoints[5].style = 0; 3281 pLinePoints[6] = new POINT2(pt2); 3282 pLinePoints[6].y = pt2.y - rectWidth; 3283 } 3284 if (bolVertical == 0) { 3285 pLinePoints[5] = new POINT2(pt2); 3286 pLinePoints[5].x = pt2.x + rectWidth; 3287 pLinePoints[5].style = 0; 3288 pLinePoints[6] = new POINT2(pt2); 3289 pLinePoints[6].x = pt2.x - rectWidth; 3290 } 3291 3292 pLinePoints[6].style = 0; 3293 pLinePoints[7] = new POINT2(pLinePoints[3]); 3294 pLinePoints[7].style = 5; 3295 lineutility.GetArrowHead4Double(pLinePoints[1], pLinePoints[0], (int) dMBR / 20, (int) dMBR / 20, pArrowPoints, 0); 3296 for (j = 0; j < 3; j++) { 3297 pLinePoints[8 + j] = new POINT2(pArrowPoints[j]); 3298 } 3299 lineutility.GetArrowHead4Double(pLinePoints[1], pLinePoints[2], (int) dMBR / 20, (int) dMBR / 20, pArrowPoints, 0); 3300 for (j = 0; j < 3; j++) { 3301 pLinePoints[11 + j] = new POINT2(pArrowPoints[j]); 3302 pLinePoints[11 + j].style = 0; 3303 } 3304 acCounter = 14; 3305 break; 3306 case TacticalLines.DIRATKSPT: 3307 //reverse the points 3308 lineutility.ReversePointsDouble2( 3309 pLinePoints, 3310 vblSaveCounter); 3311 if (dMBR / 20 > maxLength * DPIScaleFactor) { 3312 dMBR = 20 * maxLength * DPIScaleFactor; 3313 } 3314 if (dMBR / 20 < minLength * DPIScaleFactor) { 3315 dMBR = 20 * minLength * DPIScaleFactor; 3316 } 3317 if (dMBR < 150 * DPIScaleFactor) { 3318 dMBR = 150 * DPIScaleFactor; 3319 } 3320 if (dMBR > 500 * DPIScaleFactor) { 3321 dMBR = 500 * DPIScaleFactor; 3322 } 3323 3324 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 5], pLinePoints[vblCounter - 4], (int) dMBR / 20, (int) dMBR / 20, pArrowPoints, 0); 3325 for (k = 0; k < 3; k++) { 3326 pLinePoints[vblCounter - k - 1] = new POINT2(pArrowPoints[k]); 3327 } 3328 acCounter = vblCounter; 3329 break; 3330 case TacticalLines.ABATIS: 3331 //must use an x offset for ptYintercept because of extending from it 3332 pts2 = new POINT2[2]; 3333 pts2[0] = new POINT2(pt0); 3334 pts2[1] = new POINT2(pt1); 3335 lineutility.GetPixelsMin(pts2, 2, 3336 offsetX, 3337 offsetY); 3338 if (offsetX.value[0] <= 0) { 3339 offsetX.value[0] = offsetX.value[0] - 100; 3340 } else { 3341 offsetX.value[0] = 0; 3342 } 3343 if (dMBR > 300 * DPIScaleFactor) { 3344 dMBR = 300 * DPIScaleFactor; 3345 } 3346 3347 pLinePoints[0] = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], -dMBR / 10); 3348 bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m); 3349 midpt.x = (pt0.x + pLinePoints[0].x) / 2; 3350 midpt.y = (pt0.y + pLinePoints[0].y) / 2; 3351 pLinePoints[vblCounter - 3] = new POINT2(pt0); 3352 pLinePoints[vblCounter - 4].style = 5; 3353 pLinePoints[vblCounter - 3].style = 0; 3354 if (bolVertical != 0 && m.value[0] != 0) { 3355 b = midpt.y + (1 / m.value[0]) * midpt.x; //the line equation 3356 //get Y intercept at x=offsetX 3357 b1 = (-1 / m.value[0]) * offsetX.value[0] + b; 3358 ptYIntercept.x = offsetX.value[0]; 3359 ptYIntercept.y = b1; 3360 pLinePoints[vblCounter - 2] = lineutility.ExtendLineDouble(ptYIntercept, midpt, dMBR / 20); 3361 if (pLinePoints[vblCounter - 2].y >= midpt.y) { 3362 pLinePoints[vblCounter - 2] = lineutility.ExtendLineDouble(ptYIntercept, midpt, -dMBR / 20); 3363 } 3364 } 3365 if (bolVertical != 0 && m.value[0] == 0) //horizontal line 3366 { 3367 pLinePoints[vblCounter - 2] = new POINT2(midpt); 3368 pLinePoints[vblCounter - 2].y = midpt.y - dMBR / 20; 3369 } 3370 if (bolVertical == 0) { 3371 pLinePoints[vblCounter - 2] = new POINT2(midpt); 3372 pLinePoints[vblCounter - 2].x = midpt.x - dMBR / 20; 3373 } 3374 pLinePoints[vblCounter - 2].style = 0; 3375 pLinePoints[vblCounter - 1] = new POINT2(pLinePoints[0]); 3376 3377 //FillPoints(pLinePoints,vblCounter,points); 3378 acCounter = vblCounter; 3379 //FillPoints(pLinePoints,acCounter,points); 3380 break; 3381 case TacticalLines.CLUSTER: 3382 //must use an x offset for ptYintercept because of extending from it 3383 pts2 = new POINT2[2]; 3384 3385 //for some reason occulus puts the points on top of one another 3386 if (Math.abs(pt0.y - pt1.y) < 1) { 3387 pt1.y = pt0.y + 1; 3388 } 3389 3390 pts2[0] = new POINT2(pt0); 3391 pts2[1] = new POINT2(pt1); 3392 3393 pts = new POINT2[26]; 3394 dRadius = lineutility.CalcDistanceDouble(pt0, pt1) / 2; 3395 midpt.x = (pt1.x + pt0.x) / 2; 3396 midpt.y = (pt1.y + pt0.y) / 2; 3397 bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m); 3398 if (bolVertical != 0 && m.value[0] != 0) //not vertical or horizontal 3399 { 3400 b = midpt.y + (1 / m.value[0]) * midpt.x; //normal y intercept at x=0 3401 ptYIntercept.x = 0; 3402 ptYIntercept.y = b; 3403 pt2 = lineutility.ExtendLineDouble(ptYIntercept, midpt, dRadius); 3404 if (pLinePoints[0].x <= pLinePoints[1].x) { 3405 if (pt2.y >= midpt.y) { 3406 pt2 = lineutility.ExtendLineDouble(ptYIntercept, midpt, -dRadius); 3407 } 3408 } else { 3409 if (pt2.y <= midpt.y) { 3410 pt2 = lineutility.ExtendLineDouble(ptYIntercept, midpt, -dRadius); 3411 } 3412 } 3413 3414 } 3415 if (bolVertical != 0 && m.value[0] == 0) //horizontal line 3416 { 3417 pt2 = midpt; 3418 if (pLinePoints[0].x <= pLinePoints[1].x) { 3419 pt2.y = midpt.y - dRadius; 3420 } else { 3421 pt2.y = midpt.y + dRadius; 3422 } 3423 } 3424 if (bolVertical == 0) //vertical line 3425 { 3426 pt2 = midpt; 3427 if (pLinePoints[0].y <= pLinePoints[1].y) { 3428 pt2.x = midpt.x + dRadius; 3429 } else { 3430 pt2.x = midpt.x - dRadius; 3431 } 3432 } 3433 3434 pt1 = lineutility.ExtendLineDouble(midpt, pt2, 100); 3435 3436 pts[0] = new POINT2(pt2); 3437 pts[1] = new POINT2(pt1); 3438 3439 lineutility.ArcArrayDouble( 3440 pts, 3441 0, dRadius, 3442 lineType, 3443 null); 3444 pLinePoints[0].style = 1; 3445 pLinePoints[1].style = 5; 3446 for (j = 0; j < 26; j++) { 3447 pLinePoints[2 + j] = new POINT2(pts[j]); 3448 pLinePoints[2 + j].style = 1; 3449 } 3450 acCounter = 28; 3451 break; 3452 case TacticalLines.TRIP: 3453 dRadius = lineutility.CalcDistanceToLineDouble(pt0, pt1, pt2); 3454 bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m); 3455 if (bolVertical != 0 && m.value[0] != 0) { 3456 b = pt1.y + 1 / m.value[0] * pt1.x; 3457 b1 = pt2.y - m.value[0] * pt2.x; 3458 calcPoint0 = lineutility.CalcTrueIntersectDouble2(-1 / m.value[0], b, m.value[0], b1, 1, 1, pt0.x, pt0.y); 3459 calcPoint1 = lineutility.ExtendLineDouble(pt0, pt1, dRadius / 2); 3460 calcPoint2 = lineutility.ExtendLineDouble(pt0, pt1, dRadius); 3461 3462 b = calcPoint1.y + 1 / m.value[0] * calcPoint1.x; 3463 calcPoint3 = lineutility.CalcTrueIntersectDouble2(-1 / m.value[0], b, m.value[0], b1, 1, 1, pt0.x, pt0.y); 3464 b = calcPoint2.y + 1 / m.value[0] * calcPoint2.x; 3465 calcPoint4 = lineutility.CalcTrueIntersectDouble2(-1 / m.value[0], b, m.value[0], b1, 1, 1, pt0.x, pt0.y); 3466 midpt = lineutility.MidPointDouble(calcPoint1, calcPoint3, 0); 3467 midpt1 = lineutility.MidPointDouble(calcPoint2, calcPoint4, 0); 3468 3469 b = pt1.y + 1 / m.value[0] * pt1.x; 3470 calcPoint0 = lineutility.CalcTrueIntersectDouble2(-1 / m.value[0], b, m.value[0], b1, 1, 1, pt0.x, pt0.y); 3471 calcPoint3 = lineutility.ExtendLineDouble(pt0, pt1, dRadius); 3472 d = lineutility.CalcDistanceDouble(calcPoint0, calcPoint3); 3473 calcPoint1 = lineutility.ExtendLineDouble(calcPoint0, calcPoint3, -(d - dRadius)); 3474 } 3475 if (bolVertical != 0 && m.value[0] == 0) { 3476 calcPoint0.x = pt1.x; 3477 calcPoint0.y = pt2.y; 3478 calcPoint1 = lineutility.ExtendLineDouble(pt0, pt1, dRadius / 2); 3479 //calcPoint2 = lineutility.ExtendLineDouble(pt0, pt1, dRadius); 3480 calcPoint2 = pt2; 3481 3482 calcPoint3.x = calcPoint0.x + dRadius / 2; 3483 calcPoint3.y = calcPoint0.y; 3484 calcPoint4.x = pt1.x + dRadius; 3485 calcPoint4.y = pt2.y; 3486 midpt = lineutility.MidPointDouble(calcPoint1, calcPoint3, 0); 3487 midpt1 = lineutility.MidPointDouble(calcPoint2, calcPoint4, 0); 3488 3489 calcPoint3 = lineutility.ExtendLineDouble(pt0, pt1, dRadius); 3490 3491 d = lineutility.CalcDistanceDouble(calcPoint0, calcPoint3); 3492 calcPoint1 = lineutility.ExtendLineDouble(calcPoint0, calcPoint3, -(d - dRadius)); 3493 } 3494 if (bolVertical == 0) { 3495 3496 calcPoint0.x = pt2.x; 3497 calcPoint0.y = pt1.y; 3498 calcPoint1 = lineutility.ExtendLineDouble(pt0, pt1, dRadius / 2); 3499 //calcPoint2 = lineutility.ExtendLineDouble(pt0, pt1, dRadius); 3500 calcPoint2 = pt2; 3501 3502 calcPoint3.y = calcPoint0.y + dRadius / 2; 3503 calcPoint3.x = calcPoint0.x; 3504 calcPoint4.y = pt1.y + dRadius; 3505 calcPoint4.x = pt2.x; 3506 midpt = lineutility.MidPointDouble(calcPoint1, calcPoint3, 0); 3507 midpt1 = lineutility.MidPointDouble(calcPoint2, calcPoint4, 0); 3508 3509 calcPoint3 = lineutility.ExtendLineDouble(pt0, pt1, dRadius); 3510 3511 d = lineutility.CalcDistanceDouble(calcPoint0, calcPoint3); 3512 calcPoint1 = lineutility.ExtendLineDouble(calcPoint0, calcPoint3, -(d - dRadius)); 3513 } 3514 3515 arcPts[0] = new POINT2(calcPoint1); 3516 arcPts[1] = new POINT2(calcPoint3); 3517 lineutility.ArcArrayDouble( 3518 arcPts, 3519 0, dRadius, 3520 lineType, 3521 null); 3522 3523 pLinePoints[0].style = 5; 3524 pLinePoints[1].style = 5; 3525 for (k = 0; k < 26; k++) { 3526 pLinePoints[k] = new POINT2(arcPts[k]); 3527 } 3528 for (k = 25; k < vblCounter; k++) { 3529 pLinePoints[k].style = 5; 3530 } 3531 pLinePoints[26] = new POINT2(pt1); 3532 dRadius = lineutility.CalcDistanceDouble(pt1, pt0); 3533 3534 midpt = lineutility.ExtendLine2Double(pt1, pt0, -dRadius / 2 - 7, 0); 3535 3536 pLinePoints[27] = new POINT2(midpt); 3537 pLinePoints[27].style = 0; 3538 midpt = lineutility.ExtendLine2Double(pt1, pt0, -dRadius / 2 + 7, 0); 3539 pLinePoints[28] = new POINT2(midpt); 3540 pLinePoints[29] = new POINT2(pt0); 3541 pLinePoints[29].style = 5; 3542 lineutility.GetArrowHead4Double(pt1, pt0, 15, 15, pArrowPoints, 0); 3543 3544 for (k = 0; k < 3; k++) { 3545 pLinePoints[30 + k] = new POINT2(pArrowPoints[k]); 3546 } 3547 for (k = 0; k < 3; k++) { 3548 pLinePoints[30 + k].style = 5; 3549 } 3550 3551 midpt = lineutility.MidPointDouble(pt0, pt1, 0); 3552 d = lineutility.CalcDistanceDouble(pt1, calcPoint0); 3553 3554 pLinePoints[33] = pt2; 3555 pt3 = lineutility.PointRelativeToLine(pt0, pt1, pt0, pt2); 3556 d = lineutility.CalcDistanceDouble(pt3, pt2); 3557 pt4 = lineutility.ExtendAlongLineDouble(pt0, pt1, d); 3558 d = lineutility.CalcDistanceDouble(pt2, pt4); 3559 pLinePoints[34] = lineutility.ExtendLineDouble(pt2, pt4, d); 3560 3561 acCounter = 35; 3562 break; 3563 case TacticalLines.FOLLA: 3564 //reverse the points 3565 lineutility.ReversePointsDouble2(pLinePoints, vblSaveCounter); 3566 3567 if (dMBR / 10 > maxLength * DPIScaleFactor) { 3568 dMBR = 10 * maxLength * DPIScaleFactor; 3569 } 3570 if (dMBR / 10 < minLength * DPIScaleFactor) { 3571 dMBR = 10 * minLength * DPIScaleFactor; 3572 } 3573 if (dMBR > 150 * DPIScaleFactor) { 3574 dMBR = 150 * DPIScaleFactor; 3575 } 3576 3577 pLinePoints[0] = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], -2 * dMBR / 10); 3578 3579 for (k = 0; k < vblCounter - 14; k++) { 3580 pLinePoints[k].style = 18; 3581 } 3582 pLinePoints[vblCounter - 15].style = 5; 3583 3584 pt0 = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], 5 * dMBR / 10); 3585 3586 lineutility.GetArrowHead4Double(pt0, pLinePoints[0], (int) dMBR / 10, (int) dMBR / 10, pArrowPoints, 0); 3587 for (k = 0; k < 3; k++) { 3588 pLinePoints[vblCounter - 14 + k] = new POINT2(pArrowPoints[k]); 3589 } 3590 3591 pt3 = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], dMBR / 10); 3592 3593 lineutility.GetArrowHead4Double(pt0, pt3, (int) dMBR / 10, (int) dMBR / 10, pArrowPoints, 0); 3594 pLinePoints[vblCounter - 12].style = 0; 3595 pLinePoints[vblCounter - 11] = new POINT2(pArrowPoints[2]); 3596 pLinePoints[vblCounter - 11].style = 0; 3597 pLinePoints[vblCounter - 10] = new POINT2(pArrowPoints[0]); 3598 pLinePoints[vblCounter - 10].style = 0; 3599 pLinePoints[vblCounter - 9] = new POINT2(pLinePoints[vblCounter - 14]); 3600 pLinePoints[vblCounter - 9].style = 5; 3601 3602 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 16], pLinePoints[vblCounter - 15], (int) dMBR / 10, (int) dMBR / 10, pArrowPoints, 0); 3603 3604 for (k = 0; k < 3; k++) { 3605 pLinePoints[vblCounter - 8 + k] = new POINT2(pArrowPoints[k]); 3606 } 3607 pLinePoints[vblCounter - 6].style = 0; 3608 3609 //diagnostic to make first point tip of arrowhead 6-14-12 3610 //pt3 = lineutility.ExtendLineDouble(pLinePoints[vblCounter - 16], pLinePoints[vblCounter - 15], 0.75 * dMBR / 10); 3611 pt3 = lineutility.ExtendLineDouble(pLinePoints[vblCounter - 16], pLinePoints[vblCounter - 15], -0.75 * dMBR / 10); 3612 pLinePoints[1] = pt3; 3613 pLinePoints[1].style = 5; 3614 //lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 16], pt3, (int) (1.25 * dMBR / 10), (int) (1.25 * dMBR / 10), pArrowPoints, 0); 3615 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 16], pt3, (int) (dMBR / 10), (int) (dMBR / 10), pArrowPoints, 0); 3616 //end section 3617 3618 for (k = 0; k < 3; k++) { 3619 pLinePoints[vblCounter - 5 + k] = new POINT2(pArrowPoints[2 - k]); 3620 } 3621 pLinePoints[vblCounter - 5].style = 0; 3622 3623 pLinePoints[vblCounter - 2] = new POINT2(pLinePoints[vblCounter - 8]); 3624 pLinePoints[vblCounter - 2].style = 5; 3625 pLinePoints[vblCounter - 1] = new POINT2(pLinePoints[vblCounter - 7]); 3626 acCounter = 16; 3627 break; 3628 case TacticalLines.FOLSP: 3629 lineutility.ReversePointsDouble2( 3630 pLinePoints, 3631 vblSaveCounter); 3632 3633 if (dMBR / 15 > maxLength * DPIScaleFactor) { 3634 dMBR = 15 * maxLength * DPIScaleFactor; 3635 } 3636 if (dMBR / 15 < minLength * DPIScaleFactor) { 3637 dMBR = 15 * minLength * DPIScaleFactor; 3638 } 3639 if (dMBR < 100 * DPIScaleFactor) { 3640 dMBR = 100 * DPIScaleFactor; 3641 } 3642 if (dMBR > 500 * DPIScaleFactor) { 3643 dMBR = 500 * DPIScaleFactor; 3644 } 3645 3646 //make tail larger 6-10-11 m. Deutch 3647 pLinePoints[0] = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], -dMBR / 8.75); 3648 3649 pLinePoints[vblCounter - 15].style = 5; 3650 pt0 = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], dMBR / 4); 3651 3652 lineutility.GetArrowHead4Double(pt0, pLinePoints[0], (int) dMBR / 20, (int) dMBR / 20, 3653 pArrowPoints, 0); 3654 3655 for (k = 0; k < 3; k++) { 3656 pLinePoints[vblCounter - 14 + k] = new POINT2(pArrowPoints[k]); 3657 } 3658 3659 pLinePoints[vblCounter - 12].style = 0; 3660 3661 //make tail larger 6-10-11 m. Deutch 3662 pt3 = lineutility.ExtendLineDouble(pLinePoints[1], pLinePoints[0], dMBR / 15); 3663 3664 lineutility.GetArrowHead4Double(pt0, pt3, (int) dMBR / 20, (int) dMBR / 20, pArrowPoints, 0); 3665 3666 for (k = 0; k < 3; k++) { 3667 pLinePoints[vblCounter - 11 + k] = new POINT2(pArrowPoints[2 - k]); 3668 pLinePoints[vblCounter - 11 + k].style = 0; 3669 } 3670 pLinePoints[vblCounter - 8] = new POINT2(pLinePoints[vblCounter - 14]); 3671 pLinePoints[vblCounter - 8].style = 5; 3672 3673 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 16], pLinePoints[vblCounter - 15], (int) dMBR / 20, (int) dMBR / 20, pArrowPoints, 9); 3674 3675 for (k = 0; k < 3; k++) { 3676 pLinePoints[vblCounter - 7 + k] = new POINT2(pArrowPoints[k]); 3677 } 3678 for (k = 4; k > 0; k--) { 3679 pLinePoints[vblCounter - k].style = 5; 3680 } 3681 acCounter = 12; 3682 break; 3683 case TacticalLines.FERRY: 3684 lLinestyle = 9; 3685 if (dMBR / 10 > maxLength * DPIScaleFactor) { 3686 dMBR = 10 * maxLength * DPIScaleFactor; 3687 } 3688 if (dMBR / 10 < minLength * DPIScaleFactor) { 3689 dMBR = 10 * minLength * DPIScaleFactor; 3690 } 3691 if (dMBR > 250 * DPIScaleFactor) { 3692 dMBR = 250 * DPIScaleFactor; 3693 } 3694 3695 lineutility.GetArrowHead4Double(pLinePoints[vblCounter - 8], pLinePoints[vblCounter - 7], (int) dMBR / 10, (int) dMBR / 10, pArrowPoints, lLinestyle); 3696 for (k = 0; k < 3; k++) { 3697 pLinePoints[vblCounter - 6 + k] = new POINT2(pArrowPoints[k]); 3698 } 3699 lineutility.GetArrowHead4Double(pLinePoints[1], pLinePoints[0], (int) dMBR / 10, (int) dMBR / 10, pArrowPoints, lLinestyle); 3700 for (k = 0; k < 3; k++) { 3701 pLinePoints[vblCounter - 3 + k] = new POINT2(pArrowPoints[k]); 3702 } 3703 3704 acCounter = 8; 3705 break; 3706 case TacticalLines.NAVIGATION: 3707 double extensionLength = getScaledSize(10, tg.get_LineThickness()); 3708 pt3 = lineutility.ExtendLine2Double(pt1, pt0, -extensionLength, 0); 3709 pt4 = lineutility.ExtendLine2Double(pt0, pt1, -extensionLength, 0); 3710 3711 pt5 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, pt3, extensionLength, 0); 3712 pt6 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, pt3, -extensionLength, 0); 3713 pt7 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, pt4, extensionLength, 0); 3714 pt8 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, pt4, -extensionLength, 0); 3715 if (pt5.y < pt6.y) { 3716 pLinePoints[0] = new POINT2(pt5); 3717 } else { 3718 pLinePoints[0] = new POINT2(pt6); 3719 } 3720 if (pt7.y > pt8.y) { 3721 pLinePoints[3] = new POINT2(pt7); 3722 } else { 3723 pLinePoints[3] = new POINT2(pt8); 3724 } 3725 pLinePoints[1] = new POINT2(pt0); 3726 pLinePoints[2] = new POINT2(pt1); 3727 acCounter = 4; 3728 break; 3729 case TacticalLines.FORTL: 3730 acCounter = GetFORTLPointsDouble(tg, pLinePoints, vblSaveCounter); 3731 break; 3732 case TacticalLines.CANALIZE: 3733 acCounter = DISMSupport.GetDISMCanalizeDouble(pLinePoints, lineType); 3734 break; 3735 case TacticalLines.BREACH: 3736 acCounter = DISMSupport.GetDISMBreachDouble(pLinePoints, lineType); 3737 break; 3738 case TacticalLines.SCREEN: 3739 case TacticalLines.GUARD: 3740 case TacticalLines.COVER: 3741 if (vblSaveCounter == 4) { 3742 acCounter = DISMSupport.GetDISMCoverDoubleRevC(pLinePoints, lineType, vblSaveCounter); 3743 } else { 3744 acCounter = DISMSupport.GetDISMCoverDouble(pLinePoints, lineType); 3745 } 3746 break; 3747 case TacticalLines.SARA: 3748 acCounter = DISMSupport.GetDISMCoverDouble(pLinePoints, lineType); 3749 //reorder pLinePoints 3750 POINT2[] saraPts = new POINT2[16]; 3751 for (j = 0; j < 4; j++) { 3752 saraPts[j] = pLinePoints[j]; //0-3 3753 } 3754 for (j = 4; j < 8; j++) { 3755 saraPts[j] = pLinePoints[j + 4]; //8-11 3756 } 3757 for (j = 8; j < 12; j++) { 3758 saraPts[j] = pLinePoints[j - 4]; //4-7 3759 } 3760 for (j = 12; j < 16; j++) { 3761 saraPts[j] = pLinePoints[j]; //12-15 3762 } 3763 pLinePoints = saraPts; 3764 //acCounter=14; 3765 break; 3766 case TacticalLines.DISRUPT: 3767 acCounter = DISMSupport.GetDISMDisruptDouble(pLinePoints, lineType); 3768 break; 3769 case TacticalLines.CONTAIN: 3770 acCounter = DISMSupport.GetDISMContainDouble(pLinePoints, lineType); 3771 break; 3772 case TacticalLines.PENETRATE: 3773 DISMSupport.GetDISMPenetrateDouble(pLinePoints, lineType); 3774 acCounter = 7; 3775 break; 3776 case TacticalLines.MNFLDBLK: 3777 case TacticalLines.BLOCK: 3778 DISMSupport.GetDISMBlockDouble2( 3779 pLinePoints, 3780 lineType); 3781 acCounter = 4; 3782 break; 3783 case TacticalLines.LINTGT: 3784 case TacticalLines.LINTGTS: 3785 case TacticalLines.FPF: 3786 acCounter = DISMSupport.GetDISMLinearTargetDouble(pLinePoints, lineType, vblCounter); 3787 break; 3788 case TacticalLines.GAP: 3789 case TacticalLines.ASLTXING: 3790 DISMSupport.GetDISMGapDouble( 3791 pLinePoints, 3792 lineType); 3793 acCounter = 12; 3794 break; 3795 case TacticalLines.MNFLDDIS: 3796 acCounter = DISMSupport.GetDISMMinefieldDisruptDouble(pLinePoints, lineType); 3797 break; 3798 case TacticalLines.SPTBYFIRE: 3799 acCounter = DISMSupport.GetDISMSupportByFireDouble(pLinePoints, lineType); 3800 break; 3801 case TacticalLines.ATKBYFIRE: 3802 acCounter = DISMSupport.GetDISMATKBYFIREDouble(pLinePoints, lineType); 3803 break; 3804 case TacticalLines.BYIMP: 3805 acCounter = DISMSupport.GetDISMByImpDouble(pLinePoints, lineType); 3806 break; 3807 case TacticalLines.CLEAR: 3808 acCounter = DISMSupport.GetDISMClearDouble(pLinePoints, lineType); 3809 break; 3810 case TacticalLines.BYDIF: 3811 acCounter = DISMSupport.GetDISMByDifDouble(pLinePoints, lineType, clipBounds); 3812 break; 3813 case TacticalLines.SEIZE: 3814 double radius = 0; 3815 if (vblSaveCounter == 4) { 3816 radius = lineutility.CalcDistanceDouble(pLinePoints[0], pLinePoints[1]); 3817 pLinePoints[1] = new POINT2(pLinePoints[3]); 3818 pLinePoints[2] = new POINT2(pLinePoints[2]); 3819 } 3820 acCounter = DISMSupport.GetDISMSeizeDouble(pLinePoints, lineType, radius); 3821 break; 3822 case TacticalLines.FIX: 3823 case TacticalLines.MNFLDFIX: 3824 acCounter = DISMSupport.GetDISMFixDouble(pLinePoints, lineType, clipBounds); 3825 break; 3826 case TacticalLines.RIP: 3827 acCounter = DISMSupport.GetDISMRIPDouble(pLinePoints, lineType); 3828 break; 3829 case TacticalLines.DELAY: 3830 case TacticalLines.WITHDRAW: 3831 case TacticalLines.WDRAWUP: 3832 case TacticalLines.RETIRE: 3833 case TacticalLines.FPOL: 3834 case TacticalLines.RPOL: 3835 acCounter = DISMSupport.GetDelayGraphicEtcDouble(pLinePoints); 3836 break; 3837 case TacticalLines.EASY: 3838 acCounter = DISMSupport.GetDISMEasyDouble(pLinePoints, lineType); 3839 break; 3840 case TacticalLines.BYPASS: 3841 acCounter = DISMSupport.GetDISMBypassDouble(pLinePoints, lineType); 3842 break; 3843 case TacticalLines.AMBUSH: 3844 acCounter = DISMSupport.AmbushPointsDouble(pLinePoints); 3845 break; 3846 case TacticalLines.FLOT: 3847 acCounter = flot.GetFlotDouble(pLinePoints, getScaledSize(20, tg.get_LineThickness()), vblSaveCounter); 3848 break; 3849 default: 3850 acCounter = vblSaveCounter; 3851 break; 3852 } 3853 switch (lineType) { 3854 case TacticalLines.BOUNDARY: 3855 FillPoints(pLinePoints, acCounter, points); 3856 return points; 3857 case TacticalLines.CONTAIN: 3858 case TacticalLines.BLOCK: 3859 case TacticalLines.COVER: 3860 case TacticalLines.SCREEN: //note: screen, cover, guard are getting their modifiers before the call to getlinearray 3861 case TacticalLines.GUARD: 3862 case TacticalLines.PAA_RECTANGULAR: 3863 case TacticalLines.RECTANGULAR_TARGET: 3864 case TacticalLines.FOLSP: 3865 case TacticalLines.FOLLA: 3866 //add these for rev c 3-12-12 3867 case TacticalLines.BREACH: 3868 case TacticalLines.BYPASS: 3869 case TacticalLines.CANALIZE: 3870 case TacticalLines.CLEAR: 3871 case TacticalLines.DISRUPT: 3872 case TacticalLines.FIX: 3873 case TacticalLines.ISOLATE: 3874 case TacticalLines.OCCUPY: 3875 case TacticalLines.PENETRATE: 3876 case TacticalLines.RETAIN: 3877 case TacticalLines.SECURE: 3878 case TacticalLines.SEIZE: 3879 //add these 3880 case TacticalLines.AIRFIELD: 3881 case TacticalLines.CORDONKNOCK: 3882 case TacticalLines.CORDONSEARCH: 3883 case TacticalLines.MSDZ: 3884 case TacticalLines.CONVOY: 3885 case TacticalLines.HCONVOY: 3886 case TacticalLines.MFLANE: 3887 case TacticalLines.DIRATKAIR: 3888 case TacticalLines.ABATIS: 3889 FillPoints(pLinePoints, acCounter, points); 3890 break; 3891 default: 3892 //if shapes is null then it is a non-CPOF client, dependent upon pixels 3893 //instead of shapes 3894 if (shapes == null) { 3895 FillPoints(pLinePoints, acCounter, points); 3896 return points; 3897 } 3898 break; 3899 } 3900 3901 //the shapes require pLinePoints 3902 //if the shapes are null then it is a non-CPOF client, 3903 if (shapes == null) { 3904 return points; 3905 } 3906 3907 Shape2 shape = null; 3908 Shape gp = null; 3909 Shape2 redShape = null, blueShape = null, paleBlueShape = null, whiteShape = null; 3910 Shape2 redFillShape = null, blueFillShape = null, blackShape = null; 3911 BasicStroke blueStroke, paleBlueStroke; 3912 Area blueArea = null; 3913 Area paleBlueArea = null; 3914 Area whiteArea = null; 3915 boolean beginLine = true; 3916 Polygon poly = null; 3917 POINT2[] secondPoly; 3918 3919 //a loop for the outline shapes 3920 switch (lineType) { 3921 case TacticalLines.PDF: 3922 // Lines 3923 addPolyline(pLinePoints, 3, shapes); 3924 3925 // Rectangle 3926 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 3927 shape.moveTo(pLinePoints[3]); 3928 for (k = 4; k < 8; k++) { 3929 shape.lineTo(pLinePoints[k]); 3930 } 3931 shapes.add(shape); 3932 3933 // Arrows 3934 secondPoly = new POINT2[6]; 3935 for (int i = 0; i < 6; i++) { 3936 secondPoly[i] = pLinePoints[i + 8]; 3937 } 3938 addPolyline(secondPoly, 6, shapes); 3939 break; 3940 case TacticalLines.DIRATKGND: 3941 //create two shapes. the first shape is for the line 3942 //the second shape is for the arrow 3943 //renderer will know to use a skinny stroke for the arrow shape 3944 3945 //the line shape 3946 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 3947 shape.moveTo(pLinePoints[0]); 3948 for (j = 0; j < acCounter - 10; j++) { 3949 shape.lineTo(pLinePoints[j]); 3950 } 3951 3952 shapes.add(shape); 3953 3954 //the arrow shape 3955 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 3956 shape.moveTo(pLinePoints[acCounter - 10]); 3957 3958 for (j = 9; j > 0; j--) { 3959 if (pLinePoints[acCounter - j - 1].style == 5) { 3960 shape.moveTo(pLinePoints[acCounter - j]); 3961 } else { 3962 shape.lineTo(pLinePoints[acCounter - j]); 3963 } 3964 } 3965 3966 shapes.add(shape); 3967 break; 3968 case TacticalLines.DEPTH_AREA: 3969 whiteShape = new Shape2(Shape2.SHAPE_TYPE_FILL);//use for symbol 3970 whiteShape.setFillColor(Color.WHITE); 3971 BasicStroke whiteStroke = new BasicStroke((float) arraysupport.getScaledSize(28, tg.get_LineThickness())); 3972 3973 blueShape = new Shape2(Shape2.SHAPE_TYPE_FILL);//use for symbol 3974 blueShape.setFillColor(new Color(30, 144, 255)); 3975 3976 paleBlueStroke = new BasicStroke(whiteStroke.getLineWidth() / 2); 3977 paleBlueShape = new Shape2(Shape2.SHAPE_TYPE_FILL);//use for symbol 3978 paleBlueShape.setFillColor(new Color(153, 204, 255)); 3979 3980 poly = new Polygon(); 3981 3982 for (k = 0; k < vblSaveCounter; k++) { 3983 poly.addPoint((int) pLinePoints[k].x, (int) pLinePoints[k].y); 3984 if (k == 0) { 3985 whiteShape.moveTo(pLinePoints[k]); 3986 } else { 3987 whiteShape.lineTo(pLinePoints[k]); 3988 } 3989 } 3990 3991 blueArea = new Area(poly); 3992 blueShape.setShape(blueArea); 3993 3994 whiteArea = new Area((Shape) whiteStroke.createStrokedShape(poly)); 3995 whiteShape.setShape(lineutility.createStrokedShape(whiteArea)); 3996 3997 paleBlueArea = new Area((Shape) paleBlueStroke.createStrokedShape(poly)); 3998 paleBlueShape.setShape(lineutility.createStrokedShape(paleBlueArea)); 3999 4000 shapes.add(blueShape); 4001 shapes.add(paleBlueShape); 4002 shapes.add(whiteShape); 4003 break; 4004 case TacticalLines.TRAINING_AREA: 4005 redShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);//use for outline 4006 redShape.set_Style(1); 4007 blueShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);//use for symbol 4008 blueShape.set_Style(0); 4009 4010 redShape.moveTo(pLinePoints[0]); 4011 for (k = 1; k < vblSaveCounter; k++) { 4012 redShape.lineTo(pLinePoints[k]); 4013 } 4014 4015 beginLine = true; 4016 for (k = vblSaveCounter; k < acCounter; k++) { 4017 if (pLinePoints[k].style == 0) { 4018 if (beginLine) { 4019 blueShape.moveTo(pLinePoints[k]); 4020 beginLine = false; 4021 } else { 4022 blueShape.lineTo(pLinePoints[k]); 4023 } 4024 } 4025 if (pLinePoints[k].style == 5) { 4026 blueShape.lineTo(pLinePoints[k]); 4027 beginLine = true; 4028 } 4029 } 4030 shapes.add(redShape); 4031 shapes.add(blueShape); 4032 break; 4033 case TacticalLines.ITD: 4034 redShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4035 redShape.setLineColor(Color.RED); 4036 blueShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4037 blueShape.setLineColor(Color.GREEN); 4038 for (k = 0; k < acCounter - 1; k++) { 4039 if (pLinePoints[k].style == 19 && pLinePoints[k + 1].style == 5) { 4040 redShape.moveTo(pLinePoints[k]); 4041 redShape.lineTo(pLinePoints[k + 1]); 4042 } else if (pLinePoints[k].style == 25 && pLinePoints[k + 1].style == 5) { 4043 blueShape.moveTo(pLinePoints[k]); 4044 blueShape.lineTo(pLinePoints[k + 1]); 4045 } 4046 } 4047 shapes.add(redShape); 4048 shapes.add(blueShape); 4049 tg.set_lineCap(BasicStroke.CAP_BUTT); 4050 break; 4051 case TacticalLines.SFY: 4052 redShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4053 redShape.setLineColor(Color.RED); 4054 blueShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4055 blueShape.setLineColor(Color.BLUE); 4056 //flots and spikes (triangles) 4057 for (k = 0; k < acCounter - 1; k++) { 4058 if (pLinePoints[k].style == 23) //red flots 4059 { 4060 redFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); //1-3-12 4061 redFillShape.setFillColor(Color.RED); 4062 redFillShape.moveTo(pLinePoints[k - 9]); 4063 for (int l = k - 8; l <= k; l++) { 4064 redFillShape.lineTo(pLinePoints[l]); 4065 } 4066 shapes.add(redFillShape); //1-3-12 4067 } 4068 if (pLinePoints[k].style == 24)//blue spikes 4069 { 4070 blueFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); //1-3-12 4071 blueFillShape.setFillColor(Color.BLUE); 4072 blueFillShape.moveTo(pLinePoints[k - 2]); 4073 blueFillShape.lineTo(pLinePoints[k - 1]); 4074 blueFillShape.lineTo(pLinePoints[k]); 4075 shapes.add(blueFillShape); //1-3-12 4076 } 4077 } 4078 //the corners 4079 for (k = 0; k < vblSaveCounter; k++) { 4080 if (k == 0) { 4081 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4082 redShape.moveTo(pOriginalLinePoints[0]); 4083 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[0], pOriginalLinePoints[1]); 4084 if (d1 < d) { 4085 d = d1; 4086 } 4087 4088 pt0 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[0], pOriginalLinePoints[1], d); 4089 redShape.lineTo(pt0); 4090 } else if (k > 0 && k < vblSaveCounter - 1) { 4091 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4092 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[k], pOriginalLinePoints[k - 1]); 4093 if (d1 < d) { 4094 d = d1; 4095 } 4096 4097 pt0 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[k], pOriginalLinePoints[k - 1], d); 4098 pt1 = pOriginalLinePoints[k]; 4099 4100 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4101 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[k], pOriginalLinePoints[k + 1]); 4102 if (d1 < d) { 4103 d = d1; 4104 } 4105 4106 pt2 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[k], pOriginalLinePoints[k + 1], d); 4107 redShape.moveTo(pt0); 4108 redShape.lineTo(pt1); 4109 redShape.lineTo(pt2); 4110 } else //last point 4111 { 4112 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4113 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[vblSaveCounter - 1], pOriginalLinePoints[vblSaveCounter - 2]); 4114 if (d1 < d) { 4115 d = d1; 4116 } 4117 4118 redShape.moveTo(pOriginalLinePoints[vblSaveCounter - 1]); 4119 pt0 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[vblSaveCounter - 1], pOriginalLinePoints[vblSaveCounter - 2], d); 4120 redShape.lineTo(pt0); 4121 } 4122 } 4123 //red and blue short segments (between the flots) 4124 for (k = 0; k < vblCounter - 1; k++) { 4125 if (pLinePoints[k].style == 19 && pLinePoints[k + 1].style == 5) { 4126 redShape.moveTo(pLinePoints[k]); 4127 redShape.lineTo(pLinePoints[k + 1]); 4128 } else if (pLinePoints[k].style == 25 && pLinePoints[k + 1].style == 5) { 4129 blueShape.moveTo(pLinePoints[k]); 4130 blueShape.lineTo(pLinePoints[k + 1]); 4131 } 4132 } 4133 shapes.add(redShape); 4134 shapes.add(blueShape); 4135 break; 4136 case TacticalLines.SFG: 4137 redShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4138 redShape.setLineColor(Color.RED); 4139 blueShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4140 blueShape.setLineColor(Color.BLUE); 4141 for (k = 0; k < acCounter - 1; k++) { 4142 if (pLinePoints[k].style == 23) //red flots 4143 { 4144 redFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); //1-3-12 4145 redFillShape.setFillColor(Color.RED); 4146 redFillShape.moveTo(pLinePoints[k - 9]); 4147 for (int l = k - 8; l <= k; l++) { 4148 redFillShape.lineTo(pLinePoints[l]); 4149 } 4150 shapes.add(redFillShape); //1-3-12 4151 } 4152 if (pLinePoints[k].style == 24)//blue spikes red outline 4153 { 4154 blueFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); //1-3-12 4155 blueFillShape.setFillColor(Color.BLUE); 4156 blueFillShape.moveTo(pLinePoints[k - 2]); 4157 blueFillShape.lineTo(pLinePoints[k - 1]); 4158 blueFillShape.lineTo(pLinePoints[k]); 4159 shapes.add(blueFillShape); //1-3-12 4160 } 4161 } 4162 //the corners 4163 for (k = 0; k < vblSaveCounter; k++) { 4164 if (k == 0) { 4165 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4166 redShape.moveTo(pOriginalLinePoints[0]); 4167 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[0], pOriginalLinePoints[1]); 4168 if (d1 < d) { 4169 d = d1; 4170 } 4171 4172 pt0 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[0], pOriginalLinePoints[1], d); 4173 redShape.lineTo(pt0); 4174 } else if (k > 0 && k < vblSaveCounter - 1) { 4175 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4176 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[k], pOriginalLinePoints[k - 1]); 4177 if (d1 < d) { 4178 d = d1; 4179 } 4180 4181 pt0 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[k], pOriginalLinePoints[k - 1], d); 4182 pt1 = pOriginalLinePoints[k]; 4183 4184 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4185 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[k], pOriginalLinePoints[k + 1]); 4186 if (d1 < d) { 4187 d = d1; 4188 } 4189 4190 pt2 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[k], pOriginalLinePoints[k + 1], d); 4191 redShape.moveTo(pt0); 4192 redShape.lineTo(pt1); 4193 redShape.lineTo(pt2); 4194 } else //last point 4195 { 4196 d = arraysupport.getScaledSize(50, tg.get_LineThickness()); 4197 d1 = lineutility.CalcDistanceDouble(pOriginalLinePoints[vblSaveCounter - 1], pOriginalLinePoints[vblSaveCounter - 2]); 4198 if (d1 < d) { 4199 d = d1; 4200 } 4201 4202 redShape.moveTo(pOriginalLinePoints[vblSaveCounter - 1]); 4203 pt0 = lineutility.ExtendAlongLineDouble(pOriginalLinePoints[vblSaveCounter - 1], pOriginalLinePoints[vblSaveCounter - 2], d); 4204 redShape.lineTo(pt0); 4205 } 4206 } 4207 shapes.add(redShape); 4208 //the dots 4209 for (k = 0; k < acCounter; k++) { 4210 if (pLinePoints[k].style == 22) { 4211 POINT2[] CirclePoints = new POINT2[8]; 4212 redShape = lineutility.CalcCircleShape(pLinePoints[k], arraysupport.getScaledSize(3, tg.get_LineThickness()), 8, CirclePoints, 9); 4213 redShape.setFillColor(Color.RED); 4214 if (redShape != null && redShape.getShape() != null) { 4215 shapes.add(redShape); 4216 } 4217 } 4218 if (pLinePoints[k].style == 20) { 4219 POINT2[] CirclePoints = new POINT2[8]; 4220 blueShape = lineutility.CalcCircleShape(pLinePoints[k], arraysupport.getScaledSize(3, tg.get_LineThickness()), 8, CirclePoints, 9); 4221 blueShape.setFillColor(Color.BLUE); 4222 if (blueShape != null && blueShape.getShape() != null) { 4223 shapes.add(blueShape); 4224 } 4225 } 4226 } 4227 break; 4228 case TacticalLines.USF: 4229 redShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4230 redShape.setLineColor(Color.RED); 4231 blueShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4232 blueShape.setLineColor(Color.BLUE); 4233 beginLine = true; 4234 //int color=0;//red 4235 for (k = 0; k < acCounter - 1; k++) { 4236 if (pLinePoints[k].style == 19 && pLinePoints[k + 1].style == 5) { 4237 redShape.moveTo(pLinePoints[k]); 4238 redShape.lineTo(pLinePoints[k + 1]); 4239 //color=0; 4240 } 4241 if (pLinePoints[k].style == 19 && pLinePoints[k + 1].style == 19) { 4242 redShape.moveTo(pLinePoints[k]); 4243 redShape.lineTo(pLinePoints[k + 1]); 4244 //color=0; 4245 } 4246 if (pLinePoints[k].style == 25 && pLinePoints[k + 1].style == 5) { 4247 blueShape.moveTo(pLinePoints[k]); 4248 blueShape.lineTo(pLinePoints[k + 1]); 4249 //color=1; 4250 } 4251 if (pLinePoints[k].style == 25 && pLinePoints[k + 1].style == 25) { 4252 blueShape.moveTo(pLinePoints[k]); 4253 blueShape.lineTo(pLinePoints[k + 1]); 4254 //color=1; 4255 } 4256 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 5) { 4257 redShape.moveTo(pLinePoints[k]); 4258 redShape.lineTo(pLinePoints[k + 1]); 4259 } 4260 4261 } 4262 shapes.add(redShape); 4263 shapes.add(blueShape); 4264 break; 4265 case TacticalLines.SF: 4266 redShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4267 redShape.setLineColor(Color.RED); 4268 blueShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4269 blueShape.setLineColor(Color.BLUE); 4270 redFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4271 redFillShape.setLineColor(Color.RED); 4272 redFillShape.setFillColor(Color.RED); 4273 blueFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4274 blueFillShape.setLineColor(Color.BLUE); 4275 blueFillShape.setFillColor(Color.BLUE); 4276 for (k = 0; k < acCounter - 1; k++) { 4277 if (pLinePoints[k].style == 19 && pLinePoints[k + 1].style == 5) { 4278 redShape.moveTo(pLinePoints[k]); 4279 redShape.lineTo(pLinePoints[k + 1]); 4280 } 4281 if (pLinePoints[k].style == 19 && pLinePoints[k + 1].style == 19) { 4282 if (redFillShape.getPoints().isEmpty()) { 4283 redFillShape.moveTo(pLinePoints[k + 9]); 4284 for (int l = k + 9; l >= k; l--) { 4285 redFillShape.lineTo(pLinePoints[l]); 4286 } 4287 } else { 4288 redFillShape.moveTo(pLinePoints[k]); 4289 for (int l = k; l < k + 10; l++) { 4290 redFillShape.lineTo(pLinePoints[l]); 4291 } 4292 } 4293 k+=9; 4294 shapes.add(redFillShape); 4295 redFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4296 redFillShape.setLineColor(Color.RED); 4297 redFillShape.setFillColor(Color.RED); 4298 } 4299 if (pLinePoints[k].style == 25 && pLinePoints[k + 1].style == 5) { 4300 blueShape.moveTo(pLinePoints[k]); 4301 blueShape.lineTo(pLinePoints[k + 1]); 4302 } 4303 if (pLinePoints[k].style == 25 && pLinePoints[k + 1].style == 25) { 4304 if (blueFillShape.getPoints().isEmpty()) { 4305 blueFillShape.moveTo(pLinePoints[k + 2]); 4306 blueFillShape.lineTo(pLinePoints[k + 1]); 4307 blueFillShape.lineTo(pLinePoints[k]); 4308 } else { 4309 blueFillShape.moveTo(pLinePoints[k]); 4310 blueFillShape.lineTo(pLinePoints[k + 1]); 4311 blueFillShape.lineTo(pLinePoints[k + 2]); 4312 } 4313 shapes.add(blueFillShape); 4314 blueFillShape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4315 blueFillShape.setLineColor(Color.BLUE); 4316 blueFillShape.setFillColor(Color.BLUE); 4317 } 4318 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 5) { 4319 redShape.moveTo(pLinePoints[k]); 4320 redShape.lineTo(pLinePoints[k + 1]); 4321 } 4322 } 4323 shapes.add(redShape); 4324 shapes.add(blueShape); 4325 break; 4326 case TacticalLines.WFG: 4327 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4328 for (k = 0; k < acCounter - 1; k++) { 4329 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 5) { 4330 shape.moveTo(pLinePoints[k]); 4331 shape.lineTo(pLinePoints[k + 1]); 4332 } 4333 } 4334 shapes.add(shape); 4335 4336 //the dots 4337 for (k = 0; k < acCounter; k++) { 4338 if (pLinePoints[k].style == 20) { 4339 POINT2[] CirclePoints = new POINT2[8]; 4340 shape = lineutility.CalcCircleShape(pLinePoints[k], arraysupport.getScaledSize(3, tg.get_LineThickness()), 8, CirclePoints, 9); 4341 if (shape != null && shape.getShape() != null) { 4342 shapes.add(shape); 4343 } 4344 } 4345 } 4346 break; 4347 case TacticalLines.FOLLA: 4348 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4349 shape.set_Style(1); //dashed line 4350 shape.moveTo(pLinePoints[0]); 4351 shape.lineTo(pLinePoints[1]); 4352 shapes.add(shape); 4353 4354 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4355 shape.set_Style(0); //dashed line 4356 for (j = 2; j < vblCounter; j++) { 4357 if (pLinePoints[j - 1].style != 5) { 4358 shape.lineTo(pLinePoints[j]); 4359 } else { 4360 shape.moveTo(pLinePoints[j]); 4361 } 4362 } 4363 shapes.add(shape); 4364 break; 4365 case TacticalLines.CFG: 4366 for (k = 0; k < acCounter; k++) { 4367 if (pLinePoints[k].style == 20) { 4368 POINT2[] CirclePoints = new POINT2[8]; 4369 shape = lineutility.CalcCircleShape(pLinePoints[k], arraysupport.getScaledSize(3, tg.get_LineThickness()), 8, CirclePoints, 9); 4370 if (shape != null && shape.getShape() != null) { 4371 shapes.add(shape); 4372 } 4373 continue; 4374 } 4375 } 4376 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4377 for (k = 0; k < acCounter - 1; k++) { 4378 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 0) { 4379 shape.moveTo(pLinePoints[k]); 4380 shape.lineTo(pLinePoints[k + 1]); 4381 } 4382 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 9) { 4383 shape.moveTo(pLinePoints[k]); 4384 shape.lineTo(pLinePoints[k + 1]); 4385 } 4386 4387 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 5) { 4388 d = lineutility.CalcDistanceDouble(pLinePoints[k], pLinePoints[k + 1]); 4389 pt0 = lineutility.ExtendAlongLineDouble(pLinePoints[k], pLinePoints[k + 1], d - arraysupport.getScaledSize(5, tg.get_LineThickness())); 4390 shape.moveTo(pLinePoints[k]); 4391 shape.lineTo(pt0); 4392 } 4393 4394 if (pLinePoints[k].style == 0 && k == acCounter - 2) { 4395 shape.moveTo(pLinePoints[k]); 4396 shape.lineTo(pLinePoints[k + 1]); 4397 } 4398 } 4399 shapes.add(shape); 4400 break; 4401 case TacticalLines.PIPE: 4402 for (k = 0; k < acCounter; k++) { 4403 if (pLinePoints[k].style == 20) { 4404 POINT2[] CirclePoints = new POINT2[8]; 4405 shape = lineutility.CalcCircleShape(pLinePoints[k], arraysupport.getScaledSize(5, tg.get_LineThickness()), 8, CirclePoints, 9); 4406 if (shape != null && shape.getShape() != null) { 4407 shapes.add(shape); 4408 } 4409 } 4410 } 4411 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4412 for (k = 0; k < acCounter - 1; k++) { 4413 if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 5) { 4414 shape.moveTo(pLinePoints[k]); 4415 shape.lineTo(pLinePoints[k + 1]); 4416 } 4417 } 4418 shapes.add(shape); 4419 break; 4420 case TacticalLines.ATDITCHM: 4421 for (k = 0; k < acCounter; k++) { 4422 if (pLinePoints[k].style == 20) { 4423 POINT2[] CirclePoints = new POINT2[8]; 4424 shape = lineutility.CalcCircleShape(pLinePoints[k], getScaledSize(4, tg.get_LineThickness()), 8, CirclePoints, 9);//was 3 4425 if (shape != null && shape.getShape() != null) { 4426 shapes.add(shape); 4427 } 4428 continue; 4429 } 4430 if (k < acCounter - 2) { 4431 if (pLinePoints[k].style != 0 && pLinePoints[k + 1].style == 0) { 4432 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4433 shape.set_Style(pLinePoints[k].style); 4434 shape.moveTo(pLinePoints[k]); 4435 shape.lineTo(pLinePoints[k]); 4436 } else if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 0) { 4437 shape.moveTo(pLinePoints[k]); 4438 shape.lineTo(pLinePoints[k + 1]); 4439 } else if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 10) { 4440 shape.moveTo(pLinePoints[k]); 4441 shape.lineTo(pLinePoints[k + 1]); 4442 shapes.add(shape); 4443 } 4444 } 4445 if (k < acCounter - 2) { 4446 if (pLinePoints[k].style == 5 && pLinePoints[k + 1].style == 0) { 4447 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4448 shape.set_Style(pLinePoints[k].style); 4449 shape.moveTo(pLinePoints[k]); 4450 //shape.lineTo(pLinePoints[k]); 4451 } else if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 0) { 4452 shape.lineTo(pLinePoints[k + 1]); 4453 } else if (pLinePoints[k].style == 0 && pLinePoints[k + 1].style == 5) { 4454 shape.lineTo(pLinePoints[k + 1]); 4455 shapes.add(shape); 4456 } 4457 } 4458 }//end for 4459 break; 4460 case TacticalLines.ESR1: 4461 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4462 shape.set_Style(pLinePoints[0].style); 4463 shape.moveTo(pLinePoints[0]); 4464 shape.lineTo(pLinePoints[1]); 4465 //if(shape !=null && shape.get_Shape() != null) 4466 shapes.add(shape); 4467 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4468 shape.set_Style(pLinePoints[2].style); 4469 shape.moveTo(pLinePoints[2]); 4470 shape.lineTo(pLinePoints[3]); 4471 //if(shape !=null && shape.get_Shape() != null) 4472 shapes.add(shape); 4473 break; 4474 case TacticalLines.FORDIF: 4475 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4476 shape.set_Style(pLinePoints[0].style); 4477 shape.moveTo(pLinePoints[0]); 4478 shape.lineTo(pLinePoints[1]); 4479 shape.moveTo(pLinePoints[2]); 4480 shape.lineTo(pLinePoints[3]); 4481 shapes.add(shape); 4482 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4483 shape.set_Style(pLinePoints[4].style); 4484 shape.moveTo(pLinePoints[4]); 4485 for (k = 5; k < acCounter; k++) { 4486 if (pLinePoints[k - 1].style != 5) { 4487 shape.lineTo(pLinePoints[k]); 4488 } 4489 } 4490 4491 if (shape != null && shape.getShape() != null) { 4492 shapes.add(shape); 4493 } 4494 break; 4495 case TacticalLines.FENCED: 4496 //first shape is the original points 4497 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4498 shape.set_Style(points.get(0).style); 4499 shape.moveTo(points.get(0)); 4500 for (k = 1; k < vblCounter; k++) { 4501 shape.lineTo(points.get(k)); 4502 } 4503 if (shape != null && shape.getShape() != null) { 4504 shapes.add(shape); 4505 } 4506 4507 //second shape are the xpoints 4508 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4509 beginLine = true; 4510 for (k = vblCounter; k < points.size(); k++) { 4511 if (beginLine) { 4512 if (k == 0) { 4513 shape.set_Style(points.get(k).style); 4514 } 4515 4516 if (k > 0) //doubled points with linestyle=5 4517 { 4518 if (points.get(k).style == 5 && points.get(k - 1).style == 5) { 4519 shape.lineTo(points.get(k)); 4520 } 4521 } 4522 4523 shape.moveTo(points.get(k)); 4524 beginLine = false; 4525 } else { 4526 shape.lineTo(points.get(k)); 4527 if (points.get(k).style == 5 || points.get(k).style == 10) { 4528 beginLine = true; 4529 //unless there are doubled points with style=5 4530 } 4531 } 4532 if (k == points.size() - 1) //non-LC should only have one shape 4533 { 4534 if (shape != null && shape.getShape() != null) { 4535 shapes.add(shape); 4536 } 4537 } 4538 } 4539 break; 4540 case TacticalLines.AIRFIELD: 4541 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4542 shape.moveTo(pLinePoints[0]); 4543 for (k = 1; k < acCounter - 5; k++) { 4544 shape.lineTo(pLinePoints[k]); 4545 } 4546 4547 shapes.add(shape); 4548 4549 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4550 shape.moveTo(pLinePoints[acCounter - 4]); 4551 shape.lineTo(pLinePoints[acCounter - 3]); 4552 shape.moveTo(pLinePoints[acCounter - 2]); 4553 shape.lineTo(pLinePoints[acCounter - 1]); 4554 shapes.add(shape); 4555 break; 4556 case TacticalLines.STRIKWARN: 4557 addPolyline(pLinePoints, acCounter / 2, shapes); 4558 secondPoly = new POINT2[acCounter / 2]; 4559 for (int i = 0; i < acCounter / 2; i++) { 4560 secondPoly[i] = pLinePoints[i + acCounter / 2]; 4561 } 4562 addPolyline(secondPoly, acCounter / 2, shapes); 4563 break; 4564 case TacticalLines.DIRATKAIR: 4565 secondPoly = new POINT2[9]; 4566 for (int i = 0; i < 4 ; i++) { 4567 secondPoly[i] = pLinePoints[pLinePoints.length - 4 + i]; 4568 } 4569 addPolyline(secondPoly, 4, shapes); // Main line 4570 addPolyline(pLinePoints, acCounter - 13, shapes); // Main line extension 4571 for (int i = 0; i < 9 ; i++) { 4572 secondPoly[i] = pLinePoints[pLinePoints.length - 13 + i]; 4573 } 4574 addPolyline(secondPoly, 9, shapes); // Arrow and bowtie 4575 break; 4576 case TacticalLines.DIRATKSPT: 4577 addPolyline(pLinePoints, acCounter - 3, shapes); // Main line 4578 secondPoly = new POINT2[3]; 4579 for (int i = 0; i < 3; i++) { 4580 secondPoly[i] = pLinePoints[pLinePoints.length - 3 + i]; 4581 } 4582 addPolyline(secondPoly, 3, shapes); // Arrow 4583 break; 4584 default: 4585 addPolyline(pLinePoints, acCounter, shapes); 4586 break; 4587 }//end switch 4588 //a loop for arrowheads with fill 4589 //these require a separate shape for fill 4590 switch (lineType) { 4591 case TacticalLines.AC: 4592 case TacticalLines.SAAFR: 4593 case TacticalLines.MRR: 4594 case TacticalLines.SL: 4595 case TacticalLines.TC: 4596 case TacticalLines.SC: 4597 case TacticalLines.LLTR: 4598 for (j = 0; j < vblSaveCounter - 1; j++) { 4599 dMBR = pOriginalLinePoints[j].style; 4600 acPoints[0] = new POINT2(pOriginalLinePoints[j]); 4601 acPoints[1] = new POINT2(pOriginalLinePoints[j + 1]); 4602 lineutility.GetSAAFRFillSegment(acPoints, dMBR);//was dMRR 4603 shape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4604 shape.moveTo(acPoints[0]); 4605 shape.lineTo(acPoints[1]); 4606 shape.lineTo(acPoints[2]); 4607 shape.lineTo(acPoints[3]); 4608 shapes.add(0, shape); 4609 } 4610 break; 4611 case TacticalLines.DIRATKAIR: 4612 //added this section to not fill the bow tie and instead 4613 //add a shape to close what had been the bow tie fill areas with 4614 //a line segment for each one 4615 int outLineCounter = 0; 4616 POINT2[] ptOutline = new POINT2[4]; 4617 for (k = 0; k < acCounter; k++) { 4618 if (pLinePoints[k].style == 10) { 4619 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4620 shape.moveTo(pLinePoints[k - 2]); 4621 shape.lineTo(pLinePoints[k]); 4622 if (shape != null && shape.getShape() != null) { 4623 shapes.add(shape); 4624 } 4625 4626 //collect these four points 4627 ptOutline[outLineCounter++] = pLinePoints[k - 2]; 4628 ptOutline[outLineCounter++] = pLinePoints[k]; 4629 } 4630 }//end for 4631 break; 4632 case TacticalLines.OFY: 4633 case TacticalLines.OCCLUDED: 4634 case TacticalLines.WF: 4635 case TacticalLines.WFG: 4636 case TacticalLines.WFY: 4637 case TacticalLines.CF: 4638 case TacticalLines.CFY: 4639 case TacticalLines.CFG: 4640 case TacticalLines.SARA: 4641 case TacticalLines.FERRY: 4642 case TacticalLines.EASY: 4643 case TacticalLines.BYDIF: 4644 case TacticalLines.BYIMP: 4645 case TacticalLines.FOLSP: 4646 case TacticalLines.ATDITCHC: 4647 case TacticalLines.ATDITCHM: 4648 case TacticalLines.MNFLDFIX: 4649 case TacticalLines.TURN: 4650 case TacticalLines.MNFLDDIS: 4651 //POINT2 initialFillPt=null; 4652 for (k = 0; k < acCounter; k++) { 4653 if (k == 0) { 4654 if (pLinePoints[k].style == 9) { 4655 shape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4656 shape.set_Style(pLinePoints[k].style); 4657 shape.moveTo(pLinePoints[k]); 4658 } 4659 } else //k>0 4660 { 4661 if (pLinePoints[k].style == 9 && pLinePoints[k - 1].style != 9) { 4662 shape = new Shape2(Shape2.SHAPE_TYPE_FILL); 4663 shape.set_Style(pLinePoints[k].style); 4664 shape.moveTo(pLinePoints[k]); 4665 } 4666 if (pLinePoints[k].style == 9 && pLinePoints[k - 1].style == 9) //9,9,...,9,10 4667 { 4668 shape.lineTo(pLinePoints[k]); 4669 } 4670 } 4671 if (pLinePoints[k].style == 10) { 4672 shape.lineTo(pLinePoints[k]); 4673 if (shape != null && shape.getShape() != null) { 4674 shapes.add(0, shape); 4675 } 4676 } 4677 }//end for 4678 break; 4679 default: 4680 break; 4681 } 4682 } catch (Exception exc) { 4683 ErrorLogger.LogException(_className, "GetLineArray2Double", 4684 new RendererException("GetLineArray2Dboule " + Integer.toString(tg.get_LineType()), exc)); 4685 } 4686 return points; 4687 } 4688 4689 private static void addPolyline(POINT2[] pLinePoints, int acCounter, ArrayList<Shape2> shapes) { 4690 Shape2 shape = null; 4691 boolean beginLine = true; 4692 for (int k = 0; k < acCounter; k++) { 4693 //use shapes instead of pixels 4694 if (shape == null) { 4695 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 4696 } 4697 4698 if (beginLine) { 4699 4700 if (k == 0) { 4701 shape.set_Style(pLinePoints[k].style); 4702 } 4703 4704 if (k > 0) //doubled points with linestyle=5 4705 { 4706 if (pLinePoints[k].style == 5 && pLinePoints[k - 1].style == 5 && k < acCounter - 1) { 4707 continue; 4708 } else if (pLinePoints[k].style == 5 && pLinePoints[k - 1].style == 10) //CF 4709 { 4710 continue; 4711 } 4712 } 4713 4714 if (k == 0 && pLinePoints.length > 1) { 4715 if (pLinePoints[k].style == 5 && pLinePoints[k + 1].style == 5) { 4716 continue; 4717 } 4718 } 4719 4720 shape.moveTo(pLinePoints[k]); 4721 beginLine = false; 4722 } else { 4723 shape.lineTo(pLinePoints[k]); 4724 if (pLinePoints[k].style == 5 || pLinePoints[k].style == 10) { 4725 beginLine = true; 4726 //unless there are doubled points with style=5 4727 } 4728 } 4729 if (k == acCounter - 1) //non-LC should only have one shape 4730 { 4731 if (shape != null && shape.getShape() != null) { 4732 shapes.add(shape); 4733 } 4734 } 4735 }//end for 4736 } 4737 4738 /** 4739 * Returns which side of the line segment the arrow(s) go on for supply routes 4740 */ 4741 public static int SupplyRouteArrowSide(POINT2 pt0, POINT2 pt1) { 4742 ref<double[]> m = new ref(); 4743 int bolVertical = lineutility.CalcTrueSlopeDouble(pt0, pt1, m); 4744 if (pt0.x < pt1.x) { 4745 if (m.value[0] < 1) { 4746 return 2; 4747 } 4748 if (m.value[0] >= 1) { 4749 return 1; 4750 } 4751 } else if (pt0.x > pt1.x) { 4752 if (m.value[0] < 1) { 4753 return 3; 4754 } 4755 if (m.value[0] >= 1) { 4756 return 0; 4757 } 4758 } else if (bolVertical == 0) { 4759 if (pt0.y > pt1.y) { 4760 return 0; 4761 } else { 4762 return 1; 4763 } 4764 } 4765 return 0; 4766 } 4767 4768 public static double getScaledSize(double originalSize, double lineWidth) { 4769 if (lineWidth <= 3) { // Default line width 4770 return originalSize; 4771 } else if (lineWidth > 100) { 4772 lineWidth = 100; // Max scale size 4773 } 4774 return originalSize * (1 + (lineWidth - 3) / 2); 4775 } 4776}