List of usage examples for javafx.scene.canvas GraphicsContext stroke
public void stroke()
From source file:org.nmrfx.processor.gui.spectra.DrawSpectrum.java
private void genContourPath(DatasetAttributes dataGenerator, AXMODE[] axModes, Contour contours, final int coordIndex, GraphicsContext g2) { int lineCount = contours.getLineCount(coordIndex); float scale = Contour.getScaleFac() / Short.MAX_VALUE; double cxOffset = contours.xOffset; double cyOffset = contours.yOffset; g2.beginPath();//from w ww . ja v a2 s .co m Dataset dataset = dataGenerator.getDataset(); for (int iLine = 0; iLine < lineCount; iLine += 4) { if (cancelled) { System.out.println("can response1"); break; } double xPoint1 = scale * contours.coords[coordIndex][iLine] + cxOffset; double xPoint2 = scale * contours.coords[coordIndex][iLine + 2] + cxOffset; double yPoint1 = scale * contours.coords[coordIndex][iLine + 1] + cyOffset; double yPoint2 = scale * contours.coords[coordIndex][iLine + 3] + cyOffset; xPoint1 = dataset.pointToPPM(dataGenerator.dim[0], xPoint1); xPoint2 = dataset.pointToPPM(dataGenerator.dim[0], xPoint2); yPoint1 = dataset.pointToPPM(dataGenerator.dim[1], yPoint1); yPoint2 = dataset.pointToPPM(dataGenerator.dim[1], yPoint2); double x1 = axes[0].getDisplayPosition(xPoint1); double x2 = axes[0].getDisplayPosition(xPoint2); double y1 = axes[1].getDisplayPosition(yPoint1); double y2 = axes[1].getDisplayPosition(yPoint2); g2.moveTo(x1, y1); g2.lineTo(x2, y2); } g2.stroke(); }