001/* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005package armyc2.c5isr.JavaTacticalRenderer; 006 007import java.util.ArrayList; 008import java.util.Collections; 009 010import armyc2.c5isr.JavaLineArray.LinePattern; 011import armyc2.c5isr.JavaLineArray.arraysupport; 012import armyc2.c5isr.JavaLineArray.ref; 013import armyc2.c5isr.JavaLineArray.POINT2; 014import armyc2.c5isr.JavaLineArray.TacticalLines; 015import armyc2.c5isr.JavaLineArray.CELineArray; 016import armyc2.c5isr.JavaLineArray.Shape2; 017import armyc2.c5isr.RenderMultipoints.clsRenderer2; 018import armyc2.c5isr.graphics2d.BasicStroke; 019import armyc2.c5isr.graphics2d.Rectangle2D; 020import armyc2.c5isr.renderer.utilities.Color; 021import armyc2.c5isr.renderer.utilities.EntityCode; 022import armyc2.c5isr.renderer.utilities.ErrorLogger; 023import armyc2.c5isr.renderer.utilities.IPointConversion; 024import armyc2.c5isr.renderer.utilities.RendererException; 025import armyc2.c5isr.JavaLineArray.Channels; 026import armyc2.c5isr.JavaLineArray.lineutility; 027import armyc2.c5isr.renderer.utilities.SymbolID; 028 029/** 030 * A class to process channel types. 031 * 032* 033 */ 034public final class clsChannelUtility { 035 036 private static final String _className = "clsChannelUtility"; 037 038 /** 039 * Gets partitions from the client points based on the segments generated by 040 * GetSegments. Partitions are used handle double-backed segments. Each 041 * partition is a continuous sequence of points for a channel. 042 * 043 * @param segments 044 * @param partitions OUT the partitions 045 * @return 046 */ 047 private static int GetPartitions(boolean[] segments, 048 ArrayList<P1> partitions) { 049 try { 050 int j = 0; 051 boolean nextSegment = false; 052 //worst case is every segment is a separate partition 053 //caller must deallocate partitions 054 P1 p1 = new P1(); 055 //first segment will always be true, 056 //there are no bad one-segment channels 057 if (segments[0] == false) { 058 return 0; 059 } 060 061 if (partitions != null) { 062 partitions.clear(); 063 } else { 064 return 0; 065 } 066 067 p1.start = 0; 068 //only add the partitions after p1.end has been set 069 int n = segments.length; 070 //for (j = 0; j < segments.length - 1; j++) 071 for (j = 0; j < n - 1; j++) { 072 nextSegment = segments[j + 1]; 073 if (nextSegment == false) { 074 //the end of the current partition is the last good segment 075 p1.end_Renamed = j; 076 partitions.add(p1); 077 //beginning of the next partition 078 p1 = new P1(); 079 p1.start = j + 1; 080 } 081 } 082 p1.end_Renamed = j; 083 partitions.add(p1); 084 } catch (Exception exc) { 085 //System.out.println(e.getMessage()); 086 //clsUtility.WriteFile("error in clsChanneUtility.GetPartitions"); 087 ErrorLogger.LogException(_className, "GetPartitions", 088 new RendererException("Failed inside GetPartitions", exc)); 089 } 090 return partitions.size(); 091 } 092 093 /** 094 * Draws a partition to the shapes array and stores the calculated channel 095 * points 096 * 097 * @param fromSegment 098 * @param toSegment 099 * @param pixels 100 * @param channelWidth 101 * @param bolLastSegment 102 * @param shapes 103 * @param channelPoints 104 * @param distanceToChannelPoint 105 * @return 106 */ 107 private static int DrawGoodChannel2(TGLight tg, 108 int fromSegment, 109 int toSegment, 110 double[] pixels, 111 int channelWidth, 112 boolean bolLastSegment, 113 ArrayList<Shape2> shapes, 114 ArrayList<POINT2> channelPoints, 115 double distanceToChannelPoint) { 116 int returnValue = 0; // Had to initialize to something 117 try { 118 int lineType = tg.get_LineType(); 119 int lineType2; 120 double[] channelPixels = null; 121 switch (lineType) { 122 case TacticalLines.LC: 123 case TacticalLines.UNSP: 124 case TacticalLines.DFENCE: 125 case TacticalLines.SFENCE: 126 case TacticalLines.DOUBLEA: 127 case TacticalLines.LWFENCE: 128 case TacticalLines.HWFENCE: 129 case TacticalLines.BBS_LINE: 130 case TacticalLines.SINGLEC: 131 case TacticalLines.DOUBLEC: 132 case TacticalLines.TRIPLE: 133 lineType2 = lineType; 134 break; 135 case TacticalLines.SPT: 136 case TacticalLines.FRONTAL_ATTACK: 137 case TacticalLines.TURNING_MOVEMENT: 138 case TacticalLines.MOVEMENT_TO_CONTACT: 139 if (fromSegment == 0) { 140 lineType2 = TacticalLines.CHANNEL_FLARED; 141 } else { 142 lineType2 = TacticalLines.CHANNEL; 143 } 144 break; 145 case TacticalLines.MAIN: 146 if (fromSegment == 0) { 147 lineType2 = TacticalLines.CHANNEL_FLARED; 148 } else { 149 lineType2 = TacticalLines.CHANNEL; 150 } 151 break; 152 case TacticalLines.CATK: 153 lineType2 = TacticalLines.CHANNEL_DASHED; 154 break; 155 case TacticalLines.CATKBYFIRE: 156 lineType2 = TacticalLines.CHANNEL_DASHED; 157 break; 158 default: 159 lineType2 = TacticalLines.CHANNEL; 160 break; 161 } 162 if (bolLastSegment == true) { 163 if (fromSegment != 0) { 164 switch (lineType) { 165 case TacticalLines.SPT: 166 case TacticalLines.FRONTAL_ATTACK: 167 case TacticalLines.TURNING_MOVEMENT: 168 case TacticalLines.MOVEMENT_TO_CONTACT: 169 lineType2 = TacticalLines.SPT_STRAIGHT; 170 break; 171 case TacticalLines.MAIN: 172 lineType2 = TacticalLines.MAIN_STRAIGHT; 173 break; 174 default: 175 lineType2 = (int) lineType; 176 break; 177 } 178 } else { 179 lineType2 = (int) lineType; 180 } 181 } 182 183 if (fromSegment < 0) { 184 return returnValue; 185 } 186 if (toSegment < 0) { 187 return returnValue; 188 } 189 if (toSegment < fromSegment) { 190 return returnValue; 191 } 192 int j; 193 int lineCount; 194 int numPoints; 195 int counter; 196 double[] goodUpperPixels; 197 double[] goodLowerPixels; 198 numPoints = toSegment - fromSegment + 2; 199 goodUpperPixels = new double[2 * numPoints]; 200 goodLowerPixels = new double[2 * numPoints]; 201 202 counter = 0; 203 for (j = fromSegment; j < toSegment + 2; j++) { 204 goodUpperPixels[counter] = pixels[2 * j]; 205 goodUpperPixels[counter + 1] = pixels[2 * j + 1]; 206 goodLowerPixels[counter] = pixels[2 * j]; 207 goodLowerPixels[counter + 1] = pixels[2 * j + 1]; 208 counter = counter + 2; 209 } 210 211 tg.set_LineType(lineType2); 212 lineCount = CELineArray.CGetLineCountDouble(tg, goodUpperPixels, numPoints, channelWidth); 213 channelPixels = new double[3 * lineCount]; 214 POINT2 pt = null; 215 lineCount = Channels.GetChannel1Double(tg, goodUpperPixels, goodLowerPixels, channelPixels, numPoints, numPoints, channelWidth / 2, (int) distanceToChannelPoint, shapes); 216 tg.set_LineType(lineType); 217 218 //if shapes is null then it is not a CPOF client 219 if (shapes == null && channelPixels != null) { 220 //do not clear channelPoints first because the function gets successive calls 221 int n = channelPixels.length; 222 //for (j = 0; j < channelPixels.length / 3; j++) 223 for (j = 0; j < n / 3; j++) { 224 pt = new POINT2(channelPixels[3 * j], channelPixels[3 * j + 1], (int) channelPixels[3 * j + 2]); 225 if (j == channelPixels.length / 3 - 1) { 226 pt.style = 5; 227 } 228 channelPoints.add(pt); 229 } 230 } 231 232 if (lineCount > 0) { 233 //DrawChannelPixels2(lineCount, channelPixels, (int)lineType); 234 returnValue = channelPixels.length; 235 } else { 236 returnValue = 0; 237 } 238 //channelPixels[channelPixels.length - 1] = 5; 239 if (lineCount > 0) { 240 channelPixels[lineCount - 1] = 5; 241 } 242 //clean up 243 goodUpperPixels = null; 244 goodLowerPixels = null; 245 } catch (Exception exc) { 246 //clsUtility.WriteFile("error in clsChanneUtility.DrawGoodChannel2"); 247 ErrorLogger.LogException(_className, "DrawGoodChannel2", 248 new RendererException("Failed inside DrawGoodChannel2", exc)); 249 } 250 return returnValue; 251 } 252 253 /** 254 * Draws the channel partitions to the shapes array 255 * 256 * @param pixels 257 * @param partitions 258 * @param channelWidth channel width in pixels 259 * @param shapes 260 * @param channelPoints 261 * @param distanceToChannelPoint distance in pixels from the tip to the back 262 * of the arrow 263 */ 264 private static void DrawSegments(TGLight tg, 265 double[] pixels, 266 ArrayList<P1> partitions, 267 int channelWidth, 268 ArrayList<Shape2> shapes, 269 ArrayList<POINT2> channelPoints, 270 double distanceToChannelPoint) { 271 try { 272 int j = 0; 273 int n = 0; 274 int t = partitions.size(); 275 //for (j = 0; j < partitions.size() - 1; j++) 276 for (j = 0; j < t - 1; j++) { 277 n = DrawGoodChannel2(tg, partitions.get(j).start, partitions.get(j).end_Renamed, pixels, channelWidth, false, shapes, channelPoints, distanceToChannelPoint); 278 279 } 280 //draw the last partition using linetype 281 n = DrawGoodChannel2(tg, partitions.get(j).start, partitions.get(j).end_Renamed, pixels, channelWidth, true, shapes, channelPoints, distanceToChannelPoint); 282 } catch (Exception exc) { 283 //clsUtility.WriteFile("error in clsChanneUtility.DrawSegments"); 284 ErrorLogger.LogException(_className, "DrawSegments", 285 new RendererException("Failed inside DrawSegments", exc)); 286 } 287 } 288 289 private static void DrawLCSingleLineSegments(TGLight tg, 290 double[] pixels2, 291 ArrayList<P1> singleLinePartitions, 292 ArrayList<Shape2> shapes, 293 Rectangle2D clipBounds, 294 IPointConversion converter) { 295 try { 296 for (P1 flotPartition : singleLinePartitions) { 297 int vblSaveCounter = flotPartition.end_Renamed - flotPartition.start + 1; 298 ArrayList<POINT2> flotPixels = new ArrayList<>(); 299 for (int i = 0; i < vblSaveCounter; i++) 300 flotPixels.add(new POINT2(pixels2[2 * (i + flotPartition.start)], pixels2[2 * (i + flotPartition.start) + 1])); 301 302 String flotID = tg.get_SymbolId(); 303 flotID = SymbolID.setAffiliation(flotID, SymbolID.StandardIdentity_Affiliation_Hostile_Faker); 304 flotID = SymbolID.setEntityCode(flotID, EntityCode.EntityCode_FLOT); 305 TGLight flotTG = new TGLight(); 306 flotTG.set_LineType(TacticalLines.FLOT); 307 flotTG.set_Pixels(flotPixels); 308 flotTG.set_SymbolId(flotID); 309 flotTG.set_LineThickness(tg.get_LineThickness()); 310 311 ArrayList<Shape2> flotShapes = clsRenderer2.GetLineArray(flotTG, converter, false, clipBounds); 312 313 if (flotShapes != null) { 314 for (Shape2 shape : flotShapes) 315 shape.setLineColor(Color.RED); 316 shapes.addAll(flotShapes); 317 } 318 } 319 } catch (Exception exc) { 320 ErrorLogger.LogException(_className, "DrawLCFlotSegments", 321 new RendererException("Failed inside DrawLCFlotSegments", exc)); 322 } 323 } 324 325 /** 326 * Handle symbol too small for line of contact 327 * @param tg 328 * @param pixels 329 * @return 330 */ 331 private static ArrayList<POINT2> getLCPixels(TGLight tg,ArrayList<POINT2>pixels) 332 { 333 ArrayList<POINT2>pixels2=null; 334 try 335 { 336 if(tg.get_LineType()!=TacticalLines.LC) 337 return pixels; 338 POINT2[] pts=tg.Pixels.toArray(new POINT2[pixels.size()]); 339 POINT2 ul=new POINT2(),lr=new POINT2(); 340 lineutility.CalcMBRPoints((POINT2[])pts, pts.length, ul, lr); 341 double flotDiameter = arraysupport.getScaledSize(21, tg.get_LineThickness(), tg.get_patternScale()); 342 if(lr.x-ul.x>=flotDiameter) 343 return pixels; 344 else if (lr.y-ul.y>=flotDiameter) 345 return pixels; 346 //at this point the mbr is too small for a meaningful LC symbol 347 double x0=pts[0].x,y0=pts[0].y,x1=pts[1].x,y1=pts[1].y; 348 if (x0<=x1) 349 x1=x0+flotDiameter; 350 else 351 x1=x0-flotDiameter; 352 y1=y0; 353 POINT2 pt0=new POINT2(x0,y0),pt1=new POINT2(x1,y1); 354 pixels2=new ArrayList(); 355 pixels2.add(pt0); 356 pixels2.add(pt1); 357 } 358 catch (Exception exc) { 359 //clsUtility.WriteFile("error in clsChanneUtility.DrawSegments"); 360 ErrorLogger.LogException(_className ,"getLCPixels", 361 new RendererException("Failed inside getLCPixels", exc)); 362 } 363 return pixels2; 364 } 365 366 public static void DrawChannelPatterns(ArrayList<POINT2> pixels, 367 TGLight tg, 368 ArrayList<Shape2> shapes) 369 { 370 371 pixels=getLCPixels(tg,pixels); 372 Shape2 shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE); 373 int i = 0; 374 375 //make sure points are always clockwise for use with Line Patterns 376 if(clsUtility.isClosedPolygon(tg.get_LineType())) { 377 if (!isClockwise(tg)) 378 Collections.reverse(tg.Pixels); 379 } 380 381 //undo point reversals for certain lines 382 int ec = SymbolID.getEntityCode(tg.get_SymbolId()); 383 switch (ec) 384 { 385 case 290100://Obstacle Line 386 case 290301://Unspecified 387 case 290305://Low Wire Fence 388 case 290306://High Wire Fence 389 //case 290307://Single Strand Concertina 390 case 290308://Double Strand Concertina 391 case 290309://Triple Strand Concertina 392 Collections.reverse(tg.Pixels); 393 break; 394 } 395 396 for(POINT2 p : pixels) 397 { 398 if(i > 0) { 399 shape.lineTo(new POINT2(p.x, p.y)); 400 } 401 else { 402 shape.moveTo(new POINT2(p.x, p.y)); 403 } 404 i++; 405 } 406 407 LinePattern lp = LinePattern.getLinePattern(tg.get_SymbolId(),tg.get_LineColor(),tg.get_FillColor(),tg.get_LineThickness()); 408 409 shape.setLineColor(tg.get_LineColor()); 410 shape.setFillColor(tg.get_FillColor()); 411 shape.setLinePattern(lp); 412 413 shapes.add(shape); 414 } 415 416 private static boolean isClockwise(TGLight tg) 417 { 418 ArrayList<POINT2> points = tg.get_Pixels(); 419 if (points == null || points.size() < 3) { 420 return false; // A polygon must have at least 3 points 421 } 422 423 double sum = 0.0; 424 int numPoints = points.size(); 425 426 // If the list is already closed (the last point is identical to the first), 427 // we ignore the last point to avoid calculating a redundant 0-length edge. 428 if (numPoints > 1 && points.get(0).equals(points.get(numPoints - 1))) { 429 numPoints--; 430 } 431 432 for (int i = 0; i < numPoints; i++) { 433 POINT2 current = points.get(i); 434 // Wrap around to the first point if we are at the last point 435 POINT2 next = points.get((i + 1) % numPoints); 436 437 // Shoelace calculation for the current edge 438 double dx = next.x - current.x; 439 double sumY = next.y + current.y; 440 441 sum += dx * sumY; 442 } 443 444 // In Y-down coordinates, a positive sum means Clockwise 445 // - A negative sum (< 0) means Clockwise (CW) 446 // - A positive sum (> 0) means Counter-Clockwise (CCW) 447 return sum < 0; 448 } 449 450 451 /** 452 * The main interface to clsChannelUtility calls DrawChannel2 after stuffing 453 * the points into an array of 2-tuples x,y 454 * 455 * @param pixels the client points 456 * @param linetype the line type 457 * @param tg the tactical graphic 458 * @param shapes 459 * @param channelPoints 460 */ 461 public static void DrawChannel(ArrayList<POINT2> pixels, 462 int linetype, 463 TGLight tg, 464 ArrayList<Shape2> shapes, 465 ArrayList<POINT2> channelPoints, 466 Rectangle2D clipBounds, 467 IPointConversion converter) { 468 try { 469 pixels=getLCPixels(tg,pixels); 470 //we must do this because the rotary arrow tip now has to match the 471 //anchor point, i.e. the rotary feature can no longer stick out past the anchor point 472 //45 pixels shift here matches the 45 pixels shift for catkbyfire found in Channels.GetAXADDouble 473 lineutility.adjustCATKBYFIREControlPoint(linetype, pixels, 45); 474 475 int j = 0; 476 double[] pixels2 = new double[pixels.size() * 2]; 477 int n = pixels.size(); 478 //for (j = 0; j < pixels.size(); j++) 479 for (j = 0; j < n; j++) { 480 pixels2[2 * j] = pixels.get(j).x; 481 pixels2[2 * j + 1] = pixels.get(j).y; 482 } 483 DrawChannel2(pixels2, linetype, tg, shapes, channelPoints, clipBounds, converter); 484 } catch (Exception exc) { 485 //clsUtility.WriteFile("error in clsChanneUtility.DrawSegments"); 486 ErrorLogger.LogException(_className, "DrawChannel", 487 new RendererException("Failed inside DrawChannel", exc)); 488 } 489 } 490 491 /** 492 * utility for clsMETOC to handle double-backed segments 493 * 494 * @param tg the tactical graphic object 495 */ 496 public static ArrayList<P1> GetPartitions2(TGLight tg) { 497 ArrayList partitions = null; 498 try { 499 double[] pixels = new double[tg.Pixels.size() * 2]; 500 int n = tg.Pixels.size(); 501 //for(int j=0;j<tg.Pixels.size();j++) 502 for (int j = 0; j < n; j++) { 503 pixels[2 * j] = tg.Pixels.get(j).x; 504 pixels[2 * j + 1] = tg.Pixels.get(j).y; 505 } 506 507 boolean[] segments = new boolean[pixels.length / 2 - 1]; 508 if (segments.length == 0) { 509 return null; 510 } 511 512 double factor = arraysupport.getScaledSize(3, tg.get_LineThickness(), tg.get_patternScale()); 513 514 clsUtility.GetSegments(pixels, segments, factor); 515 partitions = new ArrayList<P1>(); 516 GetPartitions(segments, partitions); 517 } catch (Exception exc) { 518 ErrorLogger.LogException(_className, "GetPartitions2", 519 new RendererException("Failed inside GetPartitions2", exc)); 520 } 521 return partitions; 522 } 523 524 /** 525 * The main function for processing channel types. Gets segments, then gets 526 * partitions from the segments and then draws the partitions. 527 * 528 * @param pixels the client points as an array of 2-tuples x,y 529 * @param linetype the line type 530 * @param tg the tactical graphic object 531 * @param shapes 532 * @param channelPoints 533 */ 534 private static void DrawChannel2(double[] pixels, 535 int linetype, 536 TGLight tg, 537 ArrayList<Shape2> shapes, 538 ArrayList<POINT2> channelPoints, 539 Rectangle2D clipBounds, 540 IPointConversion converter) { 541 try { 542 ref<double[]> distanceToChannelPoint = new ref(); 543 int j = 0; 544 double[] pixels2 = null; 545 int channelWidth = 0; 546 ArrayList<P1> partitions = null; 547 int n = pixels.length; 548 int numPoints = 0; 549 //LC and others do not call clsUtility.ChannelWidth, but the 550 //value array still needs to be allocated or there is a 551 //null pointer exception in DrawGoodChannel2 552 distanceToChannelPoint.value = new double[1]; 553 distanceToChannelPoint.value[0] = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale()); 554 555 switch (linetype) { 556 case TacticalLines.MAIN: 557 case TacticalLines.CATK: 558 case TacticalLines.CATKBYFIRE: 559 case TacticalLines.AIRAOA: 560 case TacticalLines.AAAAA: 561 case TacticalLines.SPT: 562 case TacticalLines.FRONTAL_ATTACK: 563 case TacticalLines.TURNING_MOVEMENT: 564 case TacticalLines.MOVEMENT_TO_CONTACT: 565 clsUtility.ReorderPixels(pixels); 566 numPoints = pixels.length / 2; 567 568 if (numPoints < 3) { 569 return; 570 } 571 //moved this to be prior to stuffing pixels2 572 channelWidth = clsUtility.ChannelWidth(pixels, distanceToChannelPoint) / 2; 573 //ValidateChannelPixels2(ref pixels, ref channelWidth, ref distanceToChannelPoint); 574 575 numPoints = pixels.length / 2; 576 pixels2 = new double[pixels.length - 2]; 577 578 for (j = 0; j < numPoints; j++) { 579 if (j < numPoints - 1) { 580 pixels2[2 * j] = pixels[2 * j]; 581 pixels2[2 * j + 1] = pixels[2 * j + 1]; 582 } 583 } 584 break; 585 case TacticalLines.LC: 586 channelWidth = (int) arraysupport.getScaledSize(40, tg.get_LineThickness(), tg.get_patternScale());// was 20; 587 pixels2 = new double[pixels.length]; 588 n = pixels.length; 589 //for (j = 0; j < pixels.length; j++) 590 for (j = 0; j < n; j++) { 591 pixels2[j] = pixels[j]; 592 } 593 break; 594 case TacticalLines.UNSP: 595 case TacticalLines.DFENCE: 596 case TacticalLines.SFENCE: 597 case TacticalLines.DOUBLEA: 598 case TacticalLines.LWFENCE: 599 case TacticalLines.HWFENCE: 600 case TacticalLines.SINGLEC: 601 case TacticalLines.DOUBLEC: 602 case TacticalLines.TRIPLE: 603 tg.set_lineCap(BasicStroke.CAP_BUTT); 604 channelWidth = (int) arraysupport.getScaledSize(30, tg.get_LineThickness(), tg.get_patternScale()); 605 if (Channels.getShiftLines()) { 606 channelWidth = (int) arraysupport.getScaledSize(60, tg.get_LineThickness(), tg.get_patternScale()); 607 } 608 pixels2 = new double[pixels.length]; 609 n = pixels.length; 610 //for (j = 0; j < pixels.length; j++) 611 for (j = 0; j < n; j++) { 612 pixels2[j] = pixels[j]; 613 } 614 break; 615 case TacticalLines.BBS_LINE: 616 channelWidth = 8 * tg.Pixels.get(0).style; //was 20 1-10-13 617 pixels2 = new double[pixels.length]; 618 n = pixels.length; 619 //for (j = 0; j < pixels.length; j++) 620 for (j = 0; j < n; j++) { 621 pixels2[j] = pixels[j]; 622 } 623 break; 624 default: 625 626 break; 627 } 628 629 //we require new partitions because pixels are dirty 630 boolean[] segments = new boolean[pixels2.length / 2 - 1]; 631 if (segments.length == 0) { 632 return; 633 } 634 635 // Line of contact looks bad with small channel corners extending out 636 if (linetype == TacticalLines.LC) { 637 partitions = new ArrayList<>(); 638 ArrayList<P1> singleLinePartitions = new ArrayList<>(); 639 clsUtility.GetLCPartitions(pixels2, arraysupport.getScaledSize(40, tg.get_LineThickness(), tg.get_patternScale()), partitions, singleLinePartitions); 640 DrawSegments(tg, pixels2, partitions, channelWidth, shapes, channelPoints, distanceToChannelPoint.value[0]); 641 642 if (singleLinePartitions.size() > 0) { 643 // Render any small angles that only have side (not channel) as FLOT 644 DrawLCSingleLineSegments(tg, pixels2, singleLinePartitions, shapes, clipBounds, converter); 645 } 646 } else { 647 double factor = 3; 648 649 clsUtility.GetSegments(pixels2, segments, factor); 650 partitions = new ArrayList<>(); 651 GetPartitions(segments, partitions); 652 653 DrawSegments(tg, pixels2, partitions, channelWidth, shapes, channelPoints, distanceToChannelPoint.value[0]); 654 } 655 } catch (Exception exc) { 656 ErrorLogger.LogException(_className, "DrawChannel2", 657 new RendererException("Failed inside DrawChannel2", exc)); 658 } 659 } 660}