public Controller(View root, Stage stage) { this.root = root; root.openFile.setOnAction( (value) -> { root.pdbObjects.getChildren().clear(); File file = root.fileChooser.showOpenDialog(stage); readPDB(file.getAbsolutePath()); root.fileLabel.setText(file.getName()); }); scene = new Scene(root, 700, 700, true); root.threeDView.widthProperty().bind(scene.widthProperty()); root.threeDView.heightProperty().bind(Bindings.add(-50.0, scene.heightProperty())); scene.setOnMousePressed( (event) -> { mouseStartX = event.getSceneX(); mouseStartY = event.getSceneY(); }); scene.setOnMouseDragged( (event) -> { double deltaX = event.getSceneX() - mouseStartX; double deltaY = event.getSceneY() - mouseStartY; if (event.isShiftDown()) { root.camera.setTranslateZ(root.getTranslateZ() + deltaY * 10); } else { worldRotateY.setAngle(deltaX); worldRotateZ.setAngle(deltaY); } }); }
private void rotateNeedle(final double VALUE) { double needleStartAngle = angleRange * 0.5; double targetAngle = (VALUE - minValue) * angleStep - needleStartAngle; targetAngle = Helper.clamp(-needleStartAngle, -needleStartAngle + angleRange, targetAngle); needleRotate.setAngle(targetAngle); bar.setLength(-(getSkinnable().getCurrentValue() - minValue) * angleStep); setBarColor(VALUE); }
public void animate() { Timeline timeline = new Timeline( new KeyFrame( Duration.seconds(0), new KeyValue(translateZ.zProperty(), -20), new KeyValue(rotateX.angleProperty(), 90), new KeyValue(rotateY.angleProperty(), 90), new KeyValue(rotateZ.angleProperty(), 90)), new KeyFrame( Duration.seconds(5), new KeyValue(translateZ.zProperty(), -80), new KeyValue(rotateX.angleProperty(), -90), new KeyValue(rotateY.angleProperty(), -90), new KeyValue(rotateZ.angleProperty(), -90))); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }
/** Generar la canvas con el grafoNoDirigido. */ private void generarGrafico() { grafico.removerDestacar(); Colores colores = new Colores(); GraphicsContext graphicsContext = contenidoGrafo.getGraphicsContext2D(); graphicsContext.clearRect(0, 0, contenidoGrafo.getWidth(), contenidoGrafo.getHeight()); if (grafoNodos[0] != null) { graphicsContext.setFill(colores.getFondo()); graphicsContext.setStroke(colores.getBorder()); graphicsContext.fillOval(10, 10, 40, 40); graphicsContext.strokeOval(10, 10, 40, 40); graphicsContext.setFill(colores.getTexto()); int x = textX(25, String.valueOf(grafoNodos[0].getValue())); graphicsContext.fillText(String.valueOf(grafoNodos[0].getValue()), x, 35); } colores.siguinteColor(); if (grafoNodos[1] != null) { graphicsContext.setFill(colores.getFondo()); graphicsContext.setStroke(colores.getBorder()); graphicsContext.fillOval(210, 10, 40, 40); graphicsContext.strokeOval(210, 10, 40, 40); graphicsContext.setStroke(colores.getTexto()); int x = textX(225, String.valueOf(grafoNodos[1].getValue())); graphicsContext.strokeText(String.valueOf(grafoNodos[1].getValue()), x, 35); } colores.siguinteColor(); if (grafoNodos[2] != null) { graphicsContext.setFill(colores.getFondo()); graphicsContext.setStroke(colores.getBorder()); graphicsContext.fillOval(10, 210, 40, 40); graphicsContext.strokeOval(10, 210, 40, 40); graphicsContext.setStroke(colores.getTexto()); int x = textX(25, String.valueOf(grafoNodos[2].getValue())); graphicsContext.strokeText(String.valueOf(grafoNodos[2].getValue()), x, 235); } colores.siguinteColor(); if (grafoNodos[3] != null) { graphicsContext.setFill(colores.getFondo()); graphicsContext.setStroke(colores.getBorder()); graphicsContext.fillOval(210, 210, 40, 40); graphicsContext.strokeOval(210, 210, 40, 40); graphicsContext.setStroke(colores.getTexto()); int x = textX(225, String.valueOf(grafoNodos[3].getValue())); graphicsContext.strokeText(String.valueOf(grafoNodos[3].getValue()), x, 235); } colores.siguinteColor(); if (grafoNodos[4] != null) { graphicsContext.setFill(colores.getFondo()); graphicsContext.setStroke(colores.getBorder()); graphicsContext.fillOval(105, 410, 40, 40); graphicsContext.strokeOval(105, 410, 40, 40); graphicsContext.setStroke(colores.getTexto()); int x = textX(120, String.valueOf(grafoNodos[4].getValue())); graphicsContext.strokeText(String.valueOf(grafoNodos[4].getValue()), x, 435); } graphicsContext.setStroke(colores.getBorder()); graphicsContext.setFill(colores.getBorder()); if (grafoTipos.getTipo() == Grafo.Tipos.NO_DIRIGIDO) { // Line between 0 and 0. if (grafoNodos[0] != null && noDirigido.edgeExists(grafoNodos[0], grafoNodos[0])) { graphicsContext.strokeArc(15, 40, 29, 30, 145, 250, ArcType.OPEN); } // Line between 1 and 1. if (grafoNodos[1] != null && noDirigido.edgeExists(grafoNodos[1], grafoNodos[1])) { graphicsContext.strokeArc(215, 40, 29, 30, 145, 250, ArcType.OPEN); } // Line between 2 and 2. if (grafoNodos[2] != null && noDirigido.edgeExists(grafoNodos[2], grafoNodos[2])) { graphicsContext.strokeArc(15, 240, 29, 30, 145, 250, ArcType.OPEN); } // Line between 3 and 3. if (grafoNodos[3] != null && noDirigido.edgeExists(grafoNodos[3], grafoNodos[3])) { graphicsContext.strokeArc(215, 240, 29, 30, 145, 250, ArcType.OPEN); } // Line between 4 and 4. if (grafoNodos[4] != null && noDirigido.edgeExists(grafoNodos[4], grafoNodos[4])) { graphicsContext.strokeArc(110, 440, 29, 30, 145, 250, ArcType.OPEN); } // Line between 0 and 1. if (grafoNodos[0] != null && grafoNodos[1] != null && noDirigido.edgeExists(grafoNodos[0], grafoNodos[1])) { graphicsContext.strokeLine(50, 30, 210, 30); } // Line between 0 and 2. if (grafoNodos[0] != null && grafoNodos[2] != null && noDirigido.edgeExists(grafoNodos[0], grafoNodos[2])) { graphicsContext.strokeLine(30, 50, 30, 210); } // Line between 0 and 3. if (grafoNodos[0] != null && grafoNodos[3] != null && noDirigido.edgeExists(grafoNodos[0], grafoNodos[3])) { graphicsContext.strokeLine(45, 45, 215, 215); } // Line between 0 and 4. if (grafoNodos[0] != null && grafoNodos[4] != null && noDirigido.edgeExists(grafoNodos[0], grafoNodos[4])) { graphicsContext.strokeLine(38, 50, 125, 410); } // Line between 1 and 2. if (grafoNodos[1] != null && grafoNodos[2] != null && noDirigido.edgeExists(grafoNodos[1], grafoNodos[2])) { graphicsContext.strokeLine(45, 215, 215, 45); } // Line between 1 and 3. if (grafoNodos[1] != null && grafoNodos[3] != null && noDirigido.edgeExists(grafoNodos[1], grafoNodos[3])) { graphicsContext.strokeLine(230, 50, 230, 210); } // Line between 1 and 4. if (grafoNodos[1] != null && grafoNodos[4] != null && noDirigido.edgeExists(grafoNodos[1], grafoNodos[4])) { graphicsContext.strokeLine(221, 50, 125, 410); } // Line between 2 and 3 if (grafoNodos[2] != null && grafoNodos[3] != null && noDirigido.edgeExists(grafoNodos[2], grafoNodos[3])) { graphicsContext.strokeLine(50, 230, 210, 230); } // Line between 2 and 4. if (grafoNodos[2] != null && grafoNodos[4] != null && noDirigido.edgeExists(grafoNodos[2], grafoNodos[4])) { graphicsContext.strokeLine(38, 250, 125, 410); } // Line between 3 and 4. if (grafoNodos[3] != null && grafoNodos[4] != null && noDirigido.edgeExists(grafoNodos[3], grafoNodos[4])) { graphicsContext.strokeLine(221, 250, 125, 410); } } else { List<Grafo.Edge<GrafoNodo>> edges = dirigido.getEdges(); for (Grafo.Edge<GrafoNodo> edge : edges) { Grafo.Vertex<GrafoNodo> vFrom = edge.getFrom(); Grafo.Vertex<GrafoNodo> vTo = edge.getTo(); GrafoNodo from = vFrom.getData(); GrafoNodo to = vTo.getData(); int peso = edge.getCost(); if (from == grafoNodos[0] && to == from) { graphicsContext.strokeArc(15, 40, 29, 30, 145, 250, ArcType.OPEN); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(15, String.valueOf(peso)), 80); } } if (from == grafoNodos[1] && to == from) { graphicsContext.strokeArc(215, 40, 29, 30, 145, 250, ArcType.OPEN); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(235, String.valueOf(peso)), 80); } } if (from == grafoNodos[2] && to == from) { graphicsContext.strokeArc(15, 240, 29, 30, 145, 250, ArcType.OPEN); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(15, String.valueOf(peso)), 280); } } if (from == grafoNodos[3] && to == from) { graphicsContext.strokeArc(215, 240, 29, 30, 145, 250, ArcType.OPEN); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(235, String.valueOf(peso)), 280); } } if (from == grafoNodos[4] && to == from) { graphicsContext.strokeArc(110, 440, 29, 30, 145, 250, ArcType.OPEN); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(120, String.valueOf(peso)), 485); } } // Line between 0 and 1. if (from == grafoNodos[0] && to == grafoNodos[1]) { graphicsContext.strokeLine(50, 30, 210, 30); graphicsContext.fillPolygon( new double[] {200.0, 210.0, 200.0}, new double[] {25.0, 30.0, 35.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), 120, 25); } } // Line between 1 and 0 if (from == grafoNodos[1] && to == grafoNodos[0]) { graphicsContext.strokeLine(50, 30, 210, 30); graphicsContext.fillPolygon( new double[] {60.0, 50.0, 60.0}, new double[] {25.0, 30.0, 35.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), 120, 45); } } // Line between 2 and 3 if (from == grafoNodos[2] && to == grafoNodos[3]) { graphicsContext.strokeLine(50, 230, 210, 230); graphicsContext.fillPolygon( new double[] {200.0, 210.0, 200.0}, new double[] {225.0, 230.0, 235.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), 120, 225); } } // Line between 3 and 2 if (from == grafoNodos[3] && to == grafoNodos[2]) { graphicsContext.strokeLine(50, 230, 210, 230); graphicsContext.fillPolygon( new double[] {60.0, 50.0, 60.0}, new double[] {225.0, 230.0, 235.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), 120, 245); } } // Line between 0 and 2 if (from == grafoNodos[0] && to == grafoNodos[2]) { graphicsContext.strokeLine(30, 50, 30, 210); graphicsContext.fillPolygon( new double[] {25.0, 35.0, 30.0}, new double[] {200.0, 200.0, 210.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(15, String.valueOf(peso)), 150); } } // Line between 2 and 0 if (from == grafoNodos[2] && to == grafoNodos[0]) { graphicsContext.strokeLine(30, 50, 30, 210); graphicsContext.fillPolygon( new double[] {30.0, 25.0, 35.0}, new double[] {50.0, 60.0, 60.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), 35, 150); } } // Line between 1 and 3 if (from == grafoNodos[1] && to == grafoNodos[3]) { graphicsContext.strokeLine(230, 50, 230, 210); graphicsContext.fillPolygon( new double[] {225.0, 235.0, 230.0}, new double[] {200.0, 200.0, 210.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(215, String.valueOf(peso)), 150); } } // Line between 3 and 1 if (from == grafoNodos[3] && to == grafoNodos[1]) { graphicsContext.strokeLine(230, 50, 230, 210); graphicsContext.fillPolygon( new double[] {230.0, 225.0, 235.0}, new double[] {50.0, 60.0, 60.0}, 3); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), 235, 150); } } // Line between 0 and 3 if (from == grafoNodos[0] && to == grafoNodos[3]) { graphicsContext.strokeLine(45, 45, 215, 215); // Rotation is a pain in the ass. graphicsContext.save(); Rotate rotate = new Rotate(315, 213.0, 213.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {208.0, 218.0, 213.0}, new double[] {208.0, 208.0, 218.0}, 3); graphicsContext.restore(); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(90, String.valueOf(peso)), 110); } } // Line between 3 and 0 if (from == grafoNodos[3] && to == grafoNodos[0]) { graphicsContext.strokeLine(45, 45, 215, 215); graphicsContext.save(); Rotate rotate = new Rotate(135, 44.0, 44.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {39.0, 49.0, 44.0}, new double[] {34.0, 34.0, 44.0}, 3); graphicsContext.restore(); if (grafoTipos.getTipo() == Grafo.Tipos.PESO) { graphicsContext.strokeText(String.valueOf(peso), textX(115, String.valueOf(peso)), 110); } } // Line between 1 and 2 if (from == grafoNodos[1] && to == grafoNodos[2]) { graphicsContext.strokeLine(45, 215, 215, 45); graphicsContext.save(); Rotate rotate = new Rotate(45, 47.0, 213.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {42.0, 52.0, 47.0}, new double[] {208.0, 208.0, 218.0}, 3); graphicsContext.restore(); } // Line between 2 and 1 if (from == grafoNodos[2] && to == grafoNodos[1]) { graphicsContext.strokeLine(45, 215, 215, 45); graphicsContext.save(); Rotate rotate = new Rotate(225, 217.0, 43.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {212.0, 222.0, 217.0}, new double[] {33.0, 33.0, 43.0}, 3); graphicsContext.restore(); } // Line between 0 and 4 if (from == grafoNodos[0] && to == grafoNodos[4]) { graphicsContext.strokeLine(38, 50, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(345, 125.0, 410.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {120.0, 130.0, 125.0}, new double[] {400.0, 400.0, 410.0}, 3); graphicsContext.restore(); } // Line between 4 and 0 if (from == grafoNodos[4] && to == grafoNodos[0]) { graphicsContext.strokeLine(38, 50, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(165, 38.0, 50.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {33.0, 43.0, 38.0}, new double[] {40.0, 40.0, 50.0}, 3); graphicsContext.restore(); } // Line between 1 and 4 if (from == grafoNodos[1] && to == grafoNodos[4]) { graphicsContext.strokeLine(221, 50, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(375, 125.0, 410.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {120.0, 130.0, 125.0}, new double[] {400.0, 400.0, 410.0}, 3); graphicsContext.restore(); } // Line between 4 and 1 if (from == grafoNodos[4] && to == grafoNodos[1]) { graphicsContext.strokeLine(221, 50, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(195, 222.0, 50.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {217.0, 227.0, 222.0}, new double[] {40.0, 40.0, 50.0}, 3); graphicsContext.restore(); } // Line between 2 and 4 if (from == grafoNodos[2] && to == grafoNodos[4]) { graphicsContext.strokeLine(38, 250, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(330, 125.0, 410.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {120.0, 130.0, 125.0}, new double[] {400.0, 400.0, 410.0}, 3); graphicsContext.restore(); } // Line between 4 and 2 if (from == grafoNodos[4] && to == grafoNodos[2]) { graphicsContext.strokeLine(38, 250, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(150, 37.0, 249.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {32.0, 42.0, 37.0}, new double[] {239.0, 239.0, 249.0}, 3); graphicsContext.restore(); } // Line between 3 and 4 if (from == grafoNodos[3] && to == grafoNodos[4]) { graphicsContext.strokeLine(221, 250, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(35, 125.0, 410.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {120.0, 130.0, 125.0}, new double[] {400.0, 400.0, 410.0}, 3); graphicsContext.restore(); } // Line between 4 and 3 if (from == grafoNodos[4] && to == grafoNodos[3]) { graphicsContext.strokeLine(221, 250, 125, 410); graphicsContext.save(); Rotate rotate = new Rotate(210, 221.0, 249.0); graphicsContext.setTransform( rotate.getMxx(), rotate.getMyx(), rotate.getMxy(), rotate.getMyy(), rotate.getTx(), rotate.getTy()); graphicsContext.fillPolygon( new double[] {216.0, 226.0, 221.0}, new double[] {239.0, 239.0, 249.0}, 3); graphicsContext.restore(); } // Todo: make this more effecient by removing the extra line draws that overlap } } }
public void editRotate(Rotate newRotate) { this.rotate.setAngle(newRotate.getAngle()); this.rotate.setAxis(newRotate.getAxis()); }
@Override public void start(Stage primaryStage) throws Exception { Group sceneRoot = new Group(); Scene scene = new Scene(sceneRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED); scene.setFill(Color.BLACK); camera = new PerspectiveCamera(true); camera.setNearClip(0.1); camera.setFarClip(10000.0); camera.setTranslateZ(-1000); scene.setCamera(camera); ArrayList<Point3D> points = new ArrayList<>(); for (int i = -250; i < 250; i++) { points.add( new Point3D((float) i, (float) Math.sin(i) * 50 + i, (float) Math.cos(i) * 50 + i)); } polyLine3D = new PolyLine3D(points, 3, Color.STEELBLUE); sceneRoot.getChildren().addAll(polyLine3D); scene.setOnKeyPressed( event -> { double change = 10.0; // Add shift modifier to simulate "Running Speed" if (event.isShiftDown()) { change = 50.0; } // What key did the user press? KeyCode keycode = event.getCode(); // Step 2c: Add Zoom controls if (keycode == KeyCode.W) { camera.setTranslateZ(camera.getTranslateZ() + change); } if (keycode == KeyCode.S) { camera.setTranslateZ(camera.getTranslateZ() - change); } // Step 2d: Add Strafe controls if (keycode == KeyCode.A) { camera.setTranslateX(camera.getTranslateX() - change); } if (keycode == KeyCode.D) { camera.setTranslateX(camera.getTranslateX() + change); } }); // Add a Mouse Handler for Rotations Rotate xRotate = new Rotate(0, Rotate.X_AXIS); Rotate yRotate = new Rotate(0, Rotate.Y_AXIS); Rotate zRotate = new Rotate(0, Rotate.Z_AXIS); polyLine3D.getTransforms().addAll(xRotate, yRotate); // Use Binding so your rotation doesn't have to be recreated xRotate.angleProperty().bind(angleX); yRotate.angleProperty().bind(angleY); zRotate.angleProperty().bind(angleZ); // Start Tracking mouse movements only when a button is pressed scene.setOnMousePressed( event -> { scenex = event.getSceneX(); sceney = event.getSceneY(); fixedXAngle = angleX.get(); fixedYAngle = angleY.get(); if (event.isMiddleButtonDown()) { scenez = event.getSceneX(); fixedZAngle = angleZ.get(); } }); // Angle calculation will only change when the button has been pressed scene.setOnMouseDragged( event -> { if (event.isMiddleButtonDown()) angleZ.set(fixedZAngle - (scenez - event.getSceneY())); else angleX.set(fixedXAngle - (scenex - event.getSceneY())); angleY.set(fixedYAngle + sceney - event.getSceneX()); }); primaryStage.setTitle("F(X)yz ScatterPlotTest"); primaryStage.setScene(scene); primaryStage.show(); }
private void resize() { width = getSkinnable().getWidth() - getSkinnable().getInsets().getLeft() - getSkinnable().getInsets().getRight(); height = getSkinnable().getHeight() - getSkinnable().getInsets().getTop() - getSkinnable().getInsets().getBottom(); if (ASPECT_RATIO * width > height) { width = 1 / (ASPECT_RATIO / height); } else if (1 / (ASPECT_RATIO / height) > width) { height = ASPECT_RATIO * width; } if (width > 0 && height > 0) { double centerX = width * 0.5; double centerY = height * 0.85; double barRadius = height * 0.54210526; double barWidth = width * 0.28472222; pane.setMaxSize(width, height); pane.relocate( (getSkinnable().getWidth() - width) * 0.5, (getSkinnable().getHeight() - height) * 0.5); barBackground.setCenterX(centerX); barBackground.setCenterY(centerY); barBackground.setRadiusX(barRadius); barBackground.setRadiusY(barRadius); barBackground.setStrokeWidth(barWidth); barBackground.setStartAngle(angleRange * 0.5 + 90); barBackground.setLength(-angleRange); if (sectionsVisible && sectionsAlwaysVisible) { sectionLayer.setPrefSize(width, height); drawSections(); } bar.setCenterX(centerX); bar.setCenterY(centerY); bar.setRadiusX(barRadius); bar.setRadiusY(barRadius); bar.setStrokeWidth(barWidth); bar.setStartAngle(angleRange * 0.5 + 90); bar.setLength(-(getSkinnable().getCurrentValue() - minValue) * angleStep); double needleWidth = height * 0.13157895; double needleHeight = height * 0.91315789; needle.setCache(true); needleMoveTo1.setX(0.0); needleMoveTo1.setY(0.927953890489914 * needleHeight); needleCubicCurveTo2.setControlX1(0); needleCubicCurveTo2.setControlY1(0.968299711815562 * needleHeight); needleCubicCurveTo2.setControlX2(0.22 * needleWidth); needleCubicCurveTo2.setControlY2(needleHeight); needleCubicCurveTo2.setX(0.5 * needleWidth); needleCubicCurveTo2.setY(needleHeight); needleCubicCurveTo3.setControlX1(0.78 * needleWidth); needleCubicCurveTo3.setControlY1(needleHeight); needleCubicCurveTo3.setControlX2(needleWidth); needleCubicCurveTo3.setControlY2(0.968299711815562 * needleHeight); needleCubicCurveTo3.setX(needleWidth); needleCubicCurveTo3.setY(0.927953890489914 * needleHeight); needleCubicCurveTo4.setControlX1(needleWidth); needleCubicCurveTo4.setControlY1(0.92507204610951 * needleHeight); needleCubicCurveTo4.setControlX2(0.6 * needleWidth); needleCubicCurveTo4.setControlY2(0.0144092219020173 * needleHeight); needleCubicCurveTo4.setX(0.6 * needleWidth); needleCubicCurveTo4.setY(0.0144092219020173 * needleHeight); needleCubicCurveTo5.setControlX1(0.6 * needleWidth); needleCubicCurveTo5.setControlY1(0.0144092219020173 * needleHeight); needleCubicCurveTo5.setControlX2(0.58 * needleWidth); needleCubicCurveTo5.setControlY2(0); needleCubicCurveTo5.setX(0.5 * needleWidth); needleCubicCurveTo5.setY(0); needleCubicCurveTo6.setControlX1(0.42 * needleWidth); needleCubicCurveTo6.setControlY1(0); needleCubicCurveTo6.setControlX2(0.4 * needleWidth); needleCubicCurveTo6.setControlY2(0.0144092219020173 * needleHeight); needleCubicCurveTo6.setX(0.4 * needleWidth); needleCubicCurveTo6.setY(0.0144092219020173 * needleHeight); needleCubicCurveTo7.setControlX1(0.4 * needleWidth); needleCubicCurveTo7.setControlY1(0.0144092219020173 * needleHeight); needleCubicCurveTo7.setControlX2(0); needleCubicCurveTo7.setControlY2(0.92507204610951 * needleHeight); needleCubicCurveTo7.setX(0); needleCubicCurveTo7.setY(0.927953890489914 * needleHeight); needle.setCache(true); needle.setCacheHint(CacheHint.ROTATE); needle.relocate( (width - needle.getLayoutBounds().getWidth()) * 0.5, centerY - needle.getLayoutBounds().getHeight() + needle.getLayoutBounds().getWidth() * 0.5); needleRotate.setPivotX(needle.getLayoutBounds().getWidth() * 0.5); needleRotate.setPivotY( needle.getLayoutBounds().getHeight() - needle.getLayoutBounds().getWidth() * 0.5); resizeStaticText(); } }
{ textZAxisRotate.setAxis(new Point3D(0, 0, 1)); }
{ textYAxisRotate.setAxis(new Point3D(0, 1, 0)); }
{ textXAxisRotate.setAxis(new Point3D(1, 0, 0)); }