Search in sources :

Example 1 with Ellipse

use of javafx.scene.shape.Ellipse in project org.csstudio.display.builder by kasemir.

the class BaseLEDRepresentation method createLED.

private void createLED() {
    jfx_node.getChildren().clear();
    if (model_widget.propSquare().getValue())
        led = new Rectangle();
    else
        led = new Ellipse();
    led.getStyleClass().add("led");
    label = new Label();
    label.getStyleClass().add("led_label");
    label.setAlignment(Pos.CENTER);
    jfx_node.getChildren().addAll(led, label);
}
Also used : Ellipse(javafx.scene.shape.Ellipse) Rectangle(javafx.scene.shape.Rectangle) Label(javafx.scene.control.Label)

Example 2 with Ellipse

use of javafx.scene.shape.Ellipse in project org.csstudio.display.builder by kasemir.

the class ByteMonitorRepresentation method addLEDs.

private void addLEDs(final Pane pane, final int w, final int h, final boolean horizontal) {
    final int save_bits = numBits;
    final boolean save_sq = square_led;
    final Color[] save_colorVals = value_colors;
    final Shape[] leds = new Shape[save_bits];
    for (int i = 0; i < save_bits; i++) {
        final Shape led;
        if (save_sq) {
            final Rectangle rect = new Rectangle();
            rect.setX(horizontal ? i * w / save_bits : 0);
            rect.setY(horizontal ? 0 : i * h / save_bits);
            rect.setWidth(horizontal ? w / save_bits : w);
            rect.setHeight(horizontal ? h : h / save_bits);
            led = rect;
        } else {
            final Ellipse ell = new Ellipse();
            final int dh = horizontal ? w / save_bits : w;
            final int dv = horizontal ? h : h / save_bits;
            ell.setCenterX(horizontal ? dh / 2 + i * dh : dh / 2);
            ell.setCenterY(horizontal ? dv / 2 : dv / 2 + i * dv);
            ell.setRadiusX(dh / 2);
            ell.setRadiusY(dv / 2);
            led = ell;
        }
        led.getStyleClass().add("led");
        if (save_colorVals != null && i < save_colorVals.length)
            led.setFill(makeGradient(save_colorVals[i]));
        leds[i] = led;
    }
    this.leds = leds;
    pane.getChildren().clear();
    pane.getChildren().addAll(leds);
}
Also used : Ellipse(javafx.scene.shape.Ellipse) Shape(javafx.scene.shape.Shape) Color(javafx.scene.paint.Color) Rectangle(javafx.scene.shape.Rectangle)

Example 3 with Ellipse

use of javafx.scene.shape.Ellipse in project org.csstudio.display.builder by kasemir.

the class PaneEllipsesDemo method start.

@Override
public void start(final Stage stage) {
    // 10101010
    Color[] value_colors = getColors(170);
    String[] labels = { "1", "2", "4", "8", "16", "32", "64", "128" };
    // ===widget-relevant code===//
    Pane pane = new Pane();
    Ellipse[] ellipses = new Ellipse[number];
    Text[] textLabels = new Text[number];
    for (int i = 0; i < number; i++) {
        ellipses[i] = new Ellipse();
        textLabels[i] = createText(labels[i]);
        pane.getChildren().addAll(ellipses[i], textLabels[i]);
    }
    pane.setPrefSize(size * number, size);
    for (int i = 0; i < number; i++) {
        ellipses[i].setCenterX(size / 2 + i * size);
        ellipses[i].setCenterY(size / 2);
        ellipses[i].setRadiusX(size / 2);
        ellipses[i].setRadiusY(size / 2);
        textLabels[i].setX(i * size);
        textLabels[i].setY(size / 2);
        textLabels[i].setWrappingWidth(size);
    }
    for (int i = 0; i < number; i++) ellipses[i].setFill(new LinearGradient(0, 0, 0.5, 0.5, true, CycleMethod.NO_CYCLE, new Stop(0, value_colors[i].interpolate(Color.WHITESMOKE, 0.8)), new Stop(1, value_colors[i])));
    // =end widget-relevant code=//
    // VBox.setVgrow(pane, Priority.NEVER);
    VBox vbox = new VBox(pane);
    final Scene scene = new Scene(vbox, 800, 700);
    stage.setScene(scene);
    stage.setTitle("Pane with Ellipses");
    stage.show();
}
Also used : Ellipse(javafx.scene.shape.Ellipse) Stop(javafx.scene.paint.Stop) Color(javafx.scene.paint.Color) Text(javafx.scene.text.Text) Scene(javafx.scene.Scene) Pane(javafx.scene.layout.Pane) LinearGradient(javafx.scene.paint.LinearGradient) VBox(javafx.scene.layout.VBox)

Example 4 with Ellipse

use of javafx.scene.shape.Ellipse in project latexdraw by arnobl.

the class TestViewDot method setUp.

@Override
@Before
public void setUp() {
    super.setUp();
    pathBefore = duplicatePath(getPathView().getElements());
    final Ellipse dotView = getDotView();
    dotBefore = new Ellipse(dotView.getCenterX(), dotView.getCenterY(), dotView.getRadiusX(), dotView.getRadiusY());
}
Also used : Ellipse(javafx.scene.shape.Ellipse) Before(org.junit.Before)

Example 5 with Ellipse

use of javafx.scene.shape.Ellipse in project latexdraw by arnobl.

the class ViewBezierCurve method bindShowPoints.

/**
 * Sub routine that creates and binds show points.
 */
private void bindShowPoints() {
    showPoint.getChildren().addAll(Stream.concat(Stream.concat(model.getPoints().stream(), model.getFirstCtrlPts().stream()), model.getSecondCtrlPts().stream()).map(pt -> {
        final Ellipse dot = new Ellipse();
        dot.fillProperty().bind(Bindings.createObjectBinding(() -> model.getLineColour().toJFX(), model.lineColourProperty()));
        dot.centerXProperty().bind(pt.xProperty());
        dot.centerYProperty().bind(pt.yProperty());
        dot.radiusXProperty().bind(Bindings.createDoubleBinding(() -> (model.getArrowAt(0).getDotSizeDim() + model.getArrowAt(0).getDotSizeNum() * model.getFullThickness()) / 2d, model.thicknessProperty(), model.dbleBordProperty(), model.dbleBordSepProperty(), model.getArrowAt(0).dotSizeDimProperty(), model.getArrowAt(0).dotSizeNumProperty()));
        dot.radiusYProperty().bind(dot.radiusXProperty());
        return dot;
    }).collect(Collectors.toList()));
    showPoint.getChildren().addAll(IntStream.range(0, model.getFirstCtrlPts().size()).mapToObj(i -> createLine(model.getFirstCtrlPtAt(i), model.getSecondCtrlPtAt(i))).collect(Collectors.toList()));
    showPoint.getChildren().addAll(IntStream.range(1, model.getFirstCtrlPts().size() - 1).mapToObj(i -> createLine(model.getSecondCtrlPtAt(i), model.getFirstCtrlPtAt(i + 1))).collect(Collectors.toList()));
    showPoint.getChildren().addAll(createLine(model.getFirstCtrlPtAt(0), model.getFirstCtrlPtAt(1)));
    // Hiding points on arrows
    showPoint.getChildren().stream().filter(node -> node instanceof Ellipse && ((Ellipse) node).getCenterX() == model.getPtAt(0).getX() && ((Ellipse) node).getCenterY() == model.getPtAt(0).getY()).findAny().ifPresent(ell -> ell.visibleProperty().bind(model.getArrowAt(0).styleProperty().isEqualTo(ArrowStyle.NONE)));
    showPoint.getChildren().stream().filter(node -> node instanceof Ellipse && ((Ellipse) node).getCenterX() == model.getPtAt(-1).getX() && ((Ellipse) node).getCenterY() == model.getPtAt(-1).getY()).findAny().ifPresent(ell -> ell.visibleProperty().bind(model.getArrowAt(-1).styleProperty().isEqualTo(ArrowStyle.NONE)));
}
Also used : Ellipse(javafx.scene.shape.Ellipse)

Aggregations

Ellipse (javafx.scene.shape.Ellipse)10 Color (javafx.scene.paint.Color)4 Rectangle (javafx.scene.shape.Rectangle)4 Stop (javafx.scene.paint.Stop)2 Shape (javafx.scene.shape.Shape)2 Text (javafx.scene.text.Text)2 KeyFrame (javafx.animation.KeyFrame)1 KeyValue (javafx.animation.KeyValue)1 ParallelTransition (javafx.animation.ParallelTransition)1 PauseTransition (javafx.animation.PauseTransition)1 SequentialTransition (javafx.animation.SequentialTransition)1 Timeline (javafx.animation.Timeline)1 Scene (javafx.scene.Scene)1 Canvas (javafx.scene.canvas.Canvas)1 GraphicsContext (javafx.scene.canvas.GraphicsContext)1 Button (javafx.scene.control.Button)1 Label (javafx.scene.control.Label)1 DropShadow (javafx.scene.effect.DropShadow)1 Glow (javafx.scene.effect.Glow)1 Pane (javafx.scene.layout.Pane)1