List of usage examples for javafx.scene.shape Path getElements
public final ObservableList<PathElement> getElements()
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("ComboBoxSample"); Scene scene = new Scene(new Group(), 450, 250); Path path = new Path(); MoveTo moveTo = new MoveTo(); moveTo.setX(0.0f);//from w w w .j av a 2s. c om moveTo.setY(0.0f); CubicCurveTo cubicTo = new CubicCurveTo(); cubicTo.setControlX1(0.0f); cubicTo.setControlY1(0.0f); cubicTo.setControlX2(100.0f); cubicTo.setControlY2(100.0f); cubicTo.setX(100.0f); cubicTo.setY(50.0f); path.getElements().add(moveTo); path.getElements().add(cubicTo); Group root = (Group) scene.getRoot(); root.getChildren().add(path); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Shapes"); Group root = new Group(); Scene scene = new Scene(root, 300, 300, Color.WHITE); Path path = new Path(); QuadCurveTo quadCurveTo = new QuadCurveTo(); quadCurveTo.setX(50);// w ww. ja va 2s. c o m quadCurveTo.setY(50); quadCurveTo.setControlX(10); quadCurveTo.setControlY(50); LineTo lineTo1 = new LineTo(); lineTo1.setX(150); lineTo1.setY(150); LineTo lineTo2 = new LineTo(); lineTo2.setX(100); lineTo2.setY(200); LineTo lineTo3 = new LineTo(); lineTo3.setX(350); lineTo3.setY(150); MoveTo moveTo = new MoveTo(); moveTo.setX(50); moveTo.setY(150); path.getElements().add(moveTo); path.getElements().add(quadCurveTo); path.getElements().add(lineTo1); path.getElements().add(lineTo2); path.getElements().add(lineTo3); path.setTranslateY(30); path.setStrokeWidth(3); path.setStroke(Color.BLACK); root.getChildren().add(path); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
private void playLayoutBoundsPathTransition() { Bounds b = mainRect.getLayoutBounds(); Path path = new Path(); path.getElements().add(new MoveTo(b.getMinX(), b.getMinY())); path.getElements().add(new LineTo(b.getMaxX(), b.getMinY())); path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY())); path.getElements().add(new LineTo(b.getMinX(), b.getMaxY())); path.getElements().add(new LineTo(b.getMinX(), b.getMinY())); LAYOUT_BOUNDS_PATH_TRANSITION.setPath(path); LAYOUT_BOUNDS_PATH_TRANSITION.play(); }
From source file:Main.java
private void playLocalBoundsPathTransition() { Bounds b = mainRect.getBoundsInLocal(); Path path = new Path(); path.getElements().add(new MoveTo(b.getMinX(), b.getMinY())); //path.getElements().add(new LineTo(b.getMinX(), b.getMinY())); path.getElements().add(new LineTo(b.getMaxX(), b.getMinY())); path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY())); path.getElements().add(new LineTo(b.getMinX(), b.getMaxY())); path.getElements().add(new LineTo(b.getMinX(), b.getMinY())); LOCAL_BOUNDS_PATH_TRANSITION.setPath(path); LOCAL_BOUNDS_PATH_TRANSITION.play(); }
From source file:Main.java
private void playParentBoundsPathTransition() { Bounds b = mainRect.getBoundsInParent(); Path path = new Path(); path.getElements().add(new MoveTo(b.getMinX(), b.getMinY())); path.getElements().add(new LineTo(b.getMaxX(), b.getMinY())); path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY())); path.getElements().add(new LineTo(b.getMinX(), b.getMaxY())); path.getElements().add(new LineTo(b.getMinX(), b.getMinY())); PARENT_BOUNDS_PATH_TRANSITION.setPath(path); PARENT_BOUNDS_PATH_TRANSITION.play(); }
From source file:nl.rivm.cib.episim.model.disease.infection.MSEIRSPlot.java
private double getY(final Path path, final int i) { final PathElement elem = path.getElements().get(i); return elem instanceof MoveTo ? ((MoveTo) elem).getY() : ((LineTo) elem).getY(); }
From source file:org.nmrfx.processor.gui.spectra.DrawSpectrum.java
private static int drawVectoreCore(Vec vec, int dataOffset, boolean drawReal, double ph0, double ph1, double[][] xyValues, Path bcPath, DoubleBinaryOperator xFunction, DoubleBinaryOperator yFunction, boolean offsetVec, int start, int end, int size, double dValue, double dDelta, double delta) { if ((start - dataOffset) < 0) { start = dataOffset;/* w w w . jav a 2 s . c o m*/ } if (end > ((size + dataOffset) - 1)) { end = (size + dataOffset) - 1; } int incr = (end - start) / 2048; if (incr < 1) { incr = 1; } if ((start - dataOffset) < 0) { start = dataOffset; } if (end > ((size + dataOffset) - 1)) { end = (size + dataOffset) - 1; } //System.out.println((start - dataOffset) + " " + (end - dataOffset) + " " + dValue + " " + (dValue + delta * (end - start))); if (((Math.abs(ph0) > 1.0e-6) || (Math.abs(ph1) > 1.0e-6)) && !vec.isComplex()) { vec.hft(); } double dValueHold = dValue; int nPoints = 0; if (incr != 1) { double[] ve = new double[end - start + 1]; for (int i = start; i <= end; i++) { double p = ph0 + i * dDelta; if (vec.isComplex()) { Complex cmpPhas = new Complex(Math.cos(p * degtorad), -Math.sin(p * degtorad)); Complex phasedValue = vec.getComplex(i - dataOffset).multiply(cmpPhas); if (drawReal) { ve[i - start] = phasedValue.getReal(); } else { ve[i - start] = phasedValue.getImaginary(); } } else { ve[i - start] = vec.getReal(i - dataOffset); } } nPoints = speedSpectrum(ve, start, start, end, dValue, delta, incr, xyValues, xFunction, yFunction); } else { nPoints = end - start + 1; if ((xyValues[0] == null) || (xyValues[0].length < nPoints)) { xyValues[0] = new double[nPoints]; xyValues[1] = new double[nPoints]; } int iLine = 0; for (int i = start; i <= end; i++) { double intensity; if (vec.isComplex()) { double p = ph0 + i * dDelta; Complex cmpPhas = new Complex(Math.cos(p * degtorad), -Math.sin(p * degtorad)); Complex phasedValue = vec.getComplex(i - dataOffset).multiply(cmpPhas); if (drawReal) { intensity = phasedValue.getReal(); } else { intensity = phasedValue.getImaginary(); } } else { intensity = vec.getReal(i - dataOffset); } xyValues[0][iLine] = xFunction.applyAsDouble(dValue, intensity); xyValues[1][iLine++] = yFunction.applyAsDouble(dValue, intensity); dValue += delta; } } if (bcPath != null) { boolean[] signalPoints = vec.getSignalRegion(); dValue = dValueHold; if (signalPoints != null) { boolean inBase = !signalPoints[start]; int last = 0; for (int i = start; i < end; i++) { double intensity; if (vec.isComplex()) { double p = ph0 + i * dDelta; Complex cmpPhas = new Complex(Math.cos(p * degtorad), -Math.sin(p * degtorad)); Complex phasedValue = vec.getComplex(i - dataOffset).multiply(cmpPhas); if (drawReal) { intensity = phasedValue.getReal(); } else { intensity = phasedValue.getImaginary(); } } else { intensity = vec.getReal(i - dataOffset); } double xValue = xFunction.applyAsDouble(dValue, intensity); double yValue = yFunction.applyAsDouble(dValue, intensity); if (i == start) { if (inBase) { bcPath.getElements().add(new MoveTo(xValue, yValue)); } } if (i == (end - 1)) { if (inBase) { bcPath.getElements().add(new LineTo(xValue, yValue)); } } if (!signalPoints[i] != inBase) { if (inBase) { bcPath.getElements().add(new LineTo(xValue, yValue)); last = i; } else { bcPath.getElements().add(new MoveTo(xValue, yValue)); } } if ((i - last) > 10) { if (inBase) { bcPath.getElements().add(new LineTo(xValue, yValue)); last = i; } } inBase = !signalPoints[i]; dValue += delta; } } } return nPoints; }