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