Example usage for javafx.scene.paint Color BLUEVIOLET

List of usage examples for javafx.scene.paint Color BLUEVIOLET

Introduction

In this page you can find the example usage for javafx.scene.paint Color BLUEVIOLET.

Prototype

Color BLUEVIOLET

To view the source code for javafx.scene.paint Color BLUEVIOLET.

Click Source Link

Document

The color blue violet with an RGB value of #8A2BE2

Usage

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setTitle("Xylophone");

    camOffset.getChildren().add(cam);/*from  w w w.  j av a  2s  .c  om*/
    resetCam();

    final Scene scene = new Scene(camOffset, 800, 600, true);
    scene.setFill(new RadialGradient(225, 0.85, 300, 300, 500, false, CycleMethod.NO_CYCLE,
            new Stop[] { new Stop(0f, Color.BLUE), new Stop(1f, Color.LIGHTBLUE) }));
    scene.setCamera(new PerspectiveCamera());

    final AudioClip bar1Note = new AudioClip(Main.class.getResource("audio/Note1.wav").toString());
    final AudioClip bar2Note = new AudioClip(Main.class.getResource("audio/Note2.wav").toString());
    final AudioClip bar3Note = new AudioClip(Main.class.getResource("audio/Note3.wav").toString());
    final AudioClip bar4Note = new AudioClip(Main.class.getResource("audio/Note4.wav").toString());
    final AudioClip bar5Note = new AudioClip(Main.class.getResource("audio/Note5.wav").toString());
    final AudioClip bar6Note = new AudioClip(Main.class.getResource("audio/Note6.wav").toString());
    final AudioClip bar7Note = new AudioClip(Main.class.getResource("audio/Note7.wav").toString());
    final AudioClip bar8Note = new AudioClip(Main.class.getResource("audio/Note8.wav").toString());

    Group rectangleGroup = new Group();
    rectangleGroup.getTransforms().add(shear);
    rectangleGroup.setDepthTest(DepthTest.ENABLE);

    double xStart = 260.0;
    double xOffset = 30.0;
    double yPos = 300.0;
    double zPos = 0.0;
    double barWidth = 22.0;
    double barDepth = 7.0;

    // Base1
    Cube base1Cube = new Cube(1.0, new Color(0.2, 0.12, 0.1, 1.0), 1.0);
    base1Cube.setTranslateX(xStart + 135);
    base1Cube.setTranslateZ(yPos + 20.0);
    base1Cube.setTranslateY(11.0);
    base1Cube.setScaleX(barWidth * 11.5);
    base1Cube.setScaleZ(10.0);
    base1Cube.setScaleY(barDepth * 2.0);

    // Base2
    Cube base2Cube = new Cube(1.0, new Color(0.2, 0.12, 0.1, 1.0), 1.0);
    base2Cube.setTranslateX(xStart + 135);
    base2Cube.setTranslateZ(yPos - 20.0);
    base2Cube.setTranslateY(11.0);
    base2Cube.setScaleX(barWidth * 11.5);
    base2Cube.setScaleZ(10.0);
    base2Cube.setScaleY(barDepth * 2.0);

    // Bar1
    Cube bar1Cube = new Cube(1.0, Color.PURPLE, 1.0);
    bar1Cube.setTranslateX(xStart + 1 * xOffset);
    bar1Cube.setTranslateZ(yPos);
    bar1Cube.setScaleX(barWidth);
    bar1Cube.setScaleZ(100.0);
    bar1Cube.setScaleY(barDepth);

    // Bar2
    Cube bar2Cube = new Cube(1.0, Color.BLUEVIOLET, 1.0);
    bar2Cube.setTranslateX(xStart + 2 * xOffset);
    bar2Cube.setTranslateZ(yPos);
    bar2Cube.setScaleX(barWidth);
    bar2Cube.setScaleZ(95.0);
    bar2Cube.setScaleY(barDepth);

    // Bar3
    Cube bar3Cube = new Cube(1.0, Color.BLUE, 1.0);
    bar3Cube.setTranslateX(xStart + 3 * xOffset);
    bar3Cube.setTranslateZ(yPos);
    bar3Cube.setScaleX(barWidth);
    bar3Cube.setScaleZ(90.0);
    bar3Cube.setScaleY(barDepth);

    // Bar4
    Cube bar4Cube = new Cube(1.0, Color.GREEN, 1.0);
    bar4Cube.setTranslateX(xStart + 4 * xOffset);
    bar4Cube.setTranslateZ(yPos);
    bar4Cube.setScaleX(barWidth);
    bar4Cube.setScaleZ(85.0);
    bar4Cube.setScaleY(barDepth);

    // Bar5
    Cube bar5Cube = new Cube(1.0, Color.GREENYELLOW, 1.0);
    bar5Cube.setTranslateX(xStart + 5 * xOffset);
    bar5Cube.setTranslateZ(yPos);
    bar5Cube.setScaleX(barWidth);
    bar5Cube.setScaleZ(80.0);
    bar5Cube.setScaleY(barDepth);

    // Bar6
    Cube bar6Cube = new Cube(1.0, Color.YELLOW, 1.0);
    bar6Cube.setTranslateX(xStart + 6 * xOffset);
    bar6Cube.setTranslateZ(yPos);
    bar6Cube.setScaleX(barWidth);
    bar6Cube.setScaleZ(75.0);
    bar6Cube.setScaleY(barDepth);

    // Bar7
    Cube bar7Cube = new Cube(1.0, Color.ORANGE, 1.0);
    bar7Cube.setTranslateX(xStart + 7 * xOffset);
    bar7Cube.setTranslateZ(yPos);
    bar7Cube.setScaleX(barWidth);
    bar7Cube.setScaleZ(70.0);
    bar7Cube.setScaleY(barDepth);

    // Bar8
    Cube bar8Cube = new Cube(1.0, Color.RED, 1.0);
    bar8Cube.setTranslateX(xStart + 8 * xOffset);
    bar8Cube.setTranslateZ(yPos);
    bar8Cube.setScaleX(barWidth);
    bar8Cube.setScaleZ(65.0);
    bar8Cube.setScaleY(barDepth);

    bar1Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar1Note.play();
        }
    });
    bar2Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar2Note.play();
        }
    });
    bar3Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar3Note.play();
        }
    });
    bar4Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar4Note.play();
        }
    });
    bar5Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar5Note.play();
        }
    });
    bar6Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar6Note.play();
        }
    });
    bar7Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar7Note.play();
        }
    });
    bar8Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            bar8Note.play();
        }
    });

    rectangleGroup.getChildren().addAll(base1Cube, base2Cube, bar1Cube, bar2Cube, bar3Cube, bar4Cube, bar5Cube,
            bar6Cube, bar7Cube, bar8Cube);
    rectangleGroup.setScaleX(2.5);
    rectangleGroup.setScaleY(2.5);
    rectangleGroup.setScaleZ(2.5);
    cam.getChildren().add(rectangleGroup);

    double halfSceneWidth = 375; // scene.getWidth()/2.0;
    double halfSceneHeight = 275; // scene.getHeight()/2.0;
    cam.p.setX(halfSceneWidth);
    cam.ip.setX(-halfSceneWidth);
    cam.p.setY(halfSceneHeight);
    cam.ip.setY(-halfSceneHeight);

    frameCam(stage, scene);

    scene.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            mousePosX = me.getX();
            mousePosY = me.getY();
            mouseOldX = me.getX();
            mouseOldY = me.getY();
            //System.out.println("scene.setOnMousePressed " + me);
        }
    });
    scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            mouseOldX = mousePosX;
            mouseOldY = mousePosY;
            mousePosX = me.getX();
            mousePosY = me.getY();
            mouseDeltaX = mousePosX - mouseOldX;
            mouseDeltaY = mousePosY - mouseOldY;
            if (me.isAltDown() && me.isShiftDown() && me.isPrimaryButtonDown()) {
                double rzAngle = cam.rz.getAngle();
                cam.rz.setAngle(rzAngle - mouseDeltaX);
            } else if (me.isAltDown() && me.isPrimaryButtonDown()) {
                double ryAngle = cam.ry.getAngle();
                cam.ry.setAngle(ryAngle - mouseDeltaX);
                double rxAngle = cam.rx.getAngle();
                cam.rx.setAngle(rxAngle + mouseDeltaY);
            } else if (me.isShiftDown() && me.isPrimaryButtonDown()) {
                double yShear = shear.getY();
                shear.setY(yShear + mouseDeltaY / 1000.0);
                double xShear = shear.getX();
                shear.setX(xShear + mouseDeltaX / 1000.0);
            } else if (me.isAltDown() && me.isSecondaryButtonDown()) {
                double scale = cam.s.getX();
                double newScale = scale + mouseDeltaX * 0.01;
                cam.s.setX(newScale);
                cam.s.setY(newScale);
                cam.s.setZ(newScale);
            } else if (me.isAltDown() && me.isMiddleButtonDown()) {
                double tx = cam.t.getX();
                double ty = cam.t.getY();
                cam.t.setX(tx + mouseDeltaX);
                cam.t.setY(ty + mouseDeltaY);
            }
        }
    });
    scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (KeyCode.A.equals(ke.getCode())) {
                resetCam();
                shear.setX(0.0);
                shear.setY(0.0);
            }
            if (KeyCode.F.equals(ke.getCode())) {
                frameCam(stage, scene);
                shear.setX(0.0);
                shear.setY(0.0);
            }
            if (KeyCode.SPACE.equals(ke.getCode())) {
                if (stage.isFullScreen()) {
                    stage.setFullScreen(false);
                    frameCam(stage, scene);
                } else {
                    stage.setFullScreen(true);
                    frameCam(stage, scene);
                }
            }
        }
    });

    stage.setScene(scene);
    stage.show();
}

From source file:editeurpanovisu.EditeurPanovisu.java

private ScrollPane afficheLegende() {
    double positionX = 0;
    double positionY = 0;
    AnchorPane apLegende = new AnchorPane();
    ScrollPane spLegende = new ScrollPane(apLegende);
    spLegende.getStyleClass().add("legendePane");

    apLegende.setMinWidth(1000);//  ww  w .j  a v  a2s .  c o  m
    apLegende.setMinHeight(150);
    apLegende.setPrefWidth(1000);
    apLegende.setPrefHeight(150);
    apLegende.setMaxWidth(1000);
    apLegende.setMaxHeight(150);
    positionY = (pano.getLayoutY() + pano.getPrefHeight() + 10);

    Circle point = new Circle(30, 20, 5);
    point.setFill(Color.YELLOW);
    point.setStroke(Color.RED);
    point.setCursor(Cursor.DEFAULT);
    Circle point2 = new Circle(30, 60, 5);
    point2.setFill(Color.BLUE);
    point2.setStroke(Color.YELLOW);
    point2.setCursor(Cursor.DEFAULT);
    Circle point3 = new Circle(30, 100, 5);
    point3.setFill(Color.GREEN);
    point3.setStroke(Color.YELLOW);
    point3.setCursor(Cursor.DEFAULT);
    Polygon polygon = new Polygon();
    polygon.getPoints().addAll(new Double[] { 15.0, 2.0, 2.0, 2.0, 2.0, 15.0, -2.0, 15.0, -2.0, 2.0, -15.0, 2.0,
            -15.0, -2.0, -2.0, -2.0, -2.0, -15.0, 2.0, -15.0, 2.0, -2.0, 15.0, -2.0 });
    polygon.setStrokeLineJoin(StrokeLineJoin.MITER);
    polygon.setFill(Color.BLUEVIOLET);
    polygon.setStroke(Color.YELLOW);
    polygon.setId("PoV");
    polygon.setLayoutX(500);
    polygon.setLayoutY(20);
    Label lblHS = new Label(rb.getString("main.legendeHS"));
    Label lblHSImage = new Label(rb.getString("main.legendeHSImage"));
    //Label lblHSHTML = new Label(rb.getString("main.legendeHSHTML"));
    Label lblPoV = new Label(rb.getString("main.legendePoV"));
    Label lblNord = new Label(rb.getString("main.legendeNord"));
    Line ligneNord = new Line(500, 45, 500, 65);
    ligneNord.setStroke(Color.RED);
    ligneNord.setStrokeWidth(3);
    lblHS.setLayoutX(50);
    lblHS.setLayoutY(10);
    lblHSImage.setLayoutX(50);
    lblHSImage.setLayoutY(50);
    //lblHSHTML.setLayoutX(50);
    //lblHSHTML.setLayoutY(90);
    lblPoV.setLayoutX(520);
    lblPoV.setLayoutY(10);
    lblNord.setLayoutX(520);
    lblNord.setLayoutY(50);
    //        apLegende.getChildren().addAll(lblHS, point, lblHSImage, point2, lblHSHTML, point3, lblPoV, polygon, lblNord, ligneNord);
    apLegende.getChildren().addAll(lblHS, point, lblHSImage, point2, lblPoV, polygon, lblNord, ligneNord);
    apLegende.setId("legende");
    apLegende.setVisible(true);
    if (largeurMax - 50 < 1004) {
        spLegende.setPrefWidth(largeurMax - 50);
        spLegende.setMaxWidth(largeurMax - 50);
        positionX = 25;
    } else {
        spLegende.setPrefWidth(1004);
        spLegende.setMaxWidth(1004);
        positionX = (largeurMax - 1004) / 2.d;
    }
    spLegende.setLayoutX(positionX);
    spLegende.setLayoutY(positionY);
    spLegende.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spLegende.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);

    return spLegende;
}

From source file:editeurpanovisu.EditeurPanovisu.java

private void afficheNord(double longitude) {
    double largeur = imagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX();
    Node ancPoV = (Node) pano.lookup("#Nord");
    if (ancPoV != null) {
        pano.getChildren().remove(ancPoV);
    }/*from   w w w .j  a v a2s . c  o  m*/
    Line ligne = new Line(0, 0, 0, imagePanoramique.getFitHeight());
    ligne.setCursor(Cursor.DEFAULT);

    ligne.setLayoutX(X);
    ligne.setStroke(Color.RED);
    ligne.setStrokeWidth(4);
    ligne.setId("Nord");
    ligne.setOnDragDetected((MouseEvent me1) -> {
        ligne.setStroke(Color.BLUEVIOLET);
        dragDrop = true;
        me1.consume();
    });
    ligne.setOnMouseDragged((MouseEvent me1) -> {

        double XX = me1.getSceneX() - imagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > imagePanoramique.getFitWidth()) {
            XX = imagePanoramique.getFitWidth();
        }
        ligne.setLayoutX(XX + imagePanoramique.getLayoutX());
        me1.consume();

    });
    ligne.setOnMouseReleased((MouseEvent me1) -> {
        double X1 = me1.getSceneX();
        double mouseX1 = X1 - imagePanoramique.getLayoutX();
        if (mouseX1 < 0) {
            mouseX1 = 0;
        }
        if (mouseX1 > imagePanoramique.getFitWidth()) {
            mouseX1 = imagePanoramique.getFitWidth();
        }
        double regardX = 360.0f * mouseX1 / largeur - 180;
        panoramiquesProjet[panoActuel].setZeroNord(regardX);
        ligne.setStroke(Color.RED);
        me1.consume();

    });

    pano.getChildren().add(ligne);
}

From source file:editeurpanovisu.EditeurPanovisu.java

private void affichePoV(double longitude, double latitude) {
    double largeur = imagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX();
    double Y = (90.0d - latitude) * largeur / 360.0d;
    Node ancPoV = (Node) pano.lookup("#PoV");
    if (ancPoV != null) {
        pano.getChildren().remove(ancPoV);
    }// ww w  . j a v  a  2  s .  c o m
    Polygon polygon = new Polygon();
    polygon.getPoints().addAll(new Double[] { 20.0, 2.0, 2.0, 2.0, 2.0, 20.0, -2.0, 20.0, -2.0, 2.0, -20.0, 2.0,
            -20.0, -2.0, -2.0, -2.0, -2.0, -20.0, 2.0, -20.0, 2.0, -2.0, 20.0, -2.0 });
    polygon.setStrokeLineJoin(StrokeLineJoin.MITER);
    polygon.setFill(Color.BLUEVIOLET);
    polygon.setStroke(Color.YELLOW);
    polygon.setId("PoV");
    polygon.setLayoutX(X);
    polygon.setLayoutY(Y);
    polygon.setCursor(Cursor.DEFAULT);
    polygon.setOnDragDetected((MouseEvent me1) -> {
        polygon.setFill(Color.YELLOW);
        polygon.setStroke(Color.BLUEVIOLET);
        dragDrop = true;
        me1.consume();

    });
    polygon.setOnMouseDragged((MouseEvent me1) -> {

        double XX = me1.getSceneX() - imagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > imagePanoramique.getFitWidth()) {
            XX = imagePanoramique.getFitWidth();
        }
        polygon.setLayoutX(XX + imagePanoramique.getLayoutX());
        double YY = me1.getSceneY() - pano.getLayoutY() - 109;
        if (YY < 0) {
            YY = 0;
        }
        if (YY > imagePanoramique.getFitHeight()) {
            YY = imagePanoramique.getFitHeight();
        }
        polygon.setLayoutY(YY);

        me1.consume();

    });
    polygon.setOnMouseReleased((MouseEvent me1) -> {
        double X1 = me1.getSceneX();
        double Y1 = me1.getSceneY();
        double mouseX1 = X1 - imagePanoramique.getLayoutX();
        if (mouseX1 < 0) {
            mouseX1 = 0;
        }
        if (mouseX1 > imagePanoramique.getFitWidth()) {
            mouseX1 = imagePanoramique.getFitWidth();
        }
        double mouseY1 = Y1 - pano.getLayoutY() - 109;
        if (mouseY1 < 0) {
            mouseY1 = 0;
        }
        if (mouseY1 > imagePanoramique.getFitHeight()) {
            mouseY1 = imagePanoramique.getFitHeight();
        }
        double regardX = 360.0f * mouseX1 / largeur - 180;
        double regardY = 90.0d - 2.0f * mouseY1 / largeur * 180.0f;
        panoramiquesProjet[panoActuel].setLookAtX(regardX);
        panoramiquesProjet[panoActuel].setLookAtY(regardY);
        polygon.setFill(Color.BLUEVIOLET);
        polygon.setStroke(Color.YELLOW);
        me1.consume();

    });

    pano.getChildren().add(polygon);
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @return/*w  w  w.  ja v  a2  s.  co  m*/
 */
private static ScrollPane spAfficheLegende() {
    double positionX;
    double positionY;
    AnchorPane apLegende = new AnchorPane();
    ScrollPane spLegende = new ScrollPane(apLegende);
    spLegende.getStyleClass().add("legendePane");

    apLegende.setMinWidth(1000);
    apLegende.setMinHeight(150);
    apLegende.setPrefWidth(1000);
    apLegende.setPrefHeight(150);
    apLegende.setMaxWidth(1000);
    apLegende.setMaxHeight(150);
    positionY = (spVuePanoramique.getPrefHeight() - apLegende.getPrefHeight() - 15);

    Circle circPoint = new Circle(30, 20, 5);
    circPoint.setFill(Color.YELLOW);
    circPoint.setStroke(Color.RED);
    circPoint.setCursor(Cursor.DEFAULT);
    Circle circPoint2 = new Circle(30, 40, 5);
    circPoint2.setFill(Color.BLUE);
    circPoint2.setStroke(Color.YELLOW);
    circPoint2.setCursor(Cursor.DEFAULT);
    Circle circPoint3 = new Circle(30, 60, 5);
    circPoint3.setFill(Color.GREEN);
    circPoint3.setStroke(Color.YELLOW);
    circPoint3.setCursor(Cursor.DEFAULT);
    Polygon polygonCroix = new Polygon();
    polygonCroix.getPoints().addAll(new Double[] { 15.0, 2.0, 2.0, 2.0, 2.0, 15.0, -2.0, 15.0, -2.0, 2.0, -15.0,
            2.0, -15.0, -2.0, -2.0, -2.0, -2.0, -15.0, 2.0, -15.0, 2.0, -2.0, 15.0, -2.0 });
    polygonCroix.setStrokeLineJoin(StrokeLineJoin.MITER);
    polygonCroix.setFill(Color.BLUEVIOLET);
    polygonCroix.setStroke(Color.YELLOW);
    polygonCroix.setId("PoV");
    polygonCroix.setLayoutX(500);
    polygonCroix.setLayoutY(20);
    Label lblHS = new Label(rbLocalisation.getString("main.legendeHS"));
    Label lblHSImage = new Label(rbLocalisation.getString("main.legendeHSImage"));
    Label lblHSHTML = new Label(rbLocalisation.getString("main.legendeHSHTML"));
    Label lblPoV = new Label(rbLocalisation.getString("main.legendePoV"));
    Label lblNord = new Label(rbLocalisation.getString("main.legendeNord"));
    Line lineNord = new Line(500, 45, 500, 65);
    lineNord.setStroke(Color.RED);
    lineNord.setStrokeWidth(3);
    lblHS.setLayoutX(50);
    lblHS.setLayoutY(15);
    lblHSImage.setLayoutX(50);
    lblHSImage.setLayoutY(35);
    lblHSHTML.setLayoutX(50);
    lblHSHTML.setLayoutY(55);
    lblPoV.setLayoutX(520);
    lblPoV.setLayoutY(15);
    lblNord.setLayoutX(520);
    lblNord.setLayoutY(55);
    apLegende.getChildren().addAll(lblHS, circPoint, lblHSImage, circPoint2, lblHSHTML, circPoint3, lblPoV,
            polygonCroix, lblNord, lineNord);
    apLegende.setId("legende");
    apLegende.setVisible(true);
    if (largeurMax - 50 < 1004) {
        spLegende.setPrefWidth(largeurMax - 50);
        spLegende.setMaxWidth(largeurMax - 50);
        positionX = 25;
    } else {
        spLegende.setPrefWidth(1004);
        spLegende.setMaxWidth(1004);
        positionX = (largeurMax - 1004) / 2.d;
    }
    spLegende.setLayoutX(positionX);
    spLegende.setLayoutY(positionY);
    spLegende.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spLegende.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);

    return spLegende;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param longitude//from  w  w  w  .  jav a 2 s.c  o  m
 */
private static void afficheNord(double longitude) {
    double largeur = ivImagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + ivImagePanoramique.getLayoutX();
    Node nodeAncienNord = (Node) panePanoramique.lookup("#Nord");
    if (nodeAncienNord != null) {
        panePanoramique.getChildren().remove(nodeAncienNord);
    }
    Line lineNord = new Line(0, 0, 0, ivImagePanoramique.getFitHeight());
    lineNord.setCursor(Cursor.DEFAULT);

    lineNord.setLayoutX(X);
    lineNord.setStroke(Color.RED);
    lineNord.setStrokeWidth(4);
    lineNord.setId("Nord");
    lineNord.setOnDragDetected((mouseEvent1) -> {
        lineNord.setStroke(Color.BLUEVIOLET);
        bDragDrop = true;
        mouseEvent1.consume();
    });
    lineNord.setOnMouseDragged((me1) -> {

        double XX = me1.getSceneX() - ivImagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > ivImagePanoramique.getFitWidth()) {
            XX = ivImagePanoramique.getFitWidth();
        }
        lineNord.setLayoutX(XX + ivImagePanoramique.getLayoutX());
        me1.consume();
        double YY = me1.getY();
        afficheLoupe(XX, YY);
    });
    lineNord.setOnMouseReleased((me1) -> {
        double X1 = me1.getSceneX();
        double mouseX1 = X1 - ivImagePanoramique.getLayoutX();
        if (mouseX1 < 0) {
            mouseX1 = 0;
        }
        if (mouseX1 > ivImagePanoramique.getFitWidth()) {
            mouseX1 = ivImagePanoramique.getFitWidth();
        }
        double regardX = 360.0f * mouseX1 / largeur - 180;
        navigateurPanoramique.setPositNord(regardX - 180);
        navigateurPanoramique.affiche();
        getPanoramiquesProjet()[getiPanoActuel()].setZeroNord(regardX);
        lineNord.setStroke(Color.RED);
        me1.consume();

    });

    panePanoramique.getChildren().add(lineNord);
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 * Affiche la croix reprsentant le point de vue
 *
 * @param longitude longitude/*from  w w  w . ja v a  2s . c  om*/
 * @param latitude latitude
 * @param fov Champ de vision
 */
private static void affichePoV(double longitude, double latitude, double fov) {
    double largeur = ivImagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + ivImagePanoramique.getLayoutX();
    double Y = (90.0d - latitude) * largeur / 360.0d;
    Node nodeAncienPoV = (Node) panePanoramique.lookup("#PoV");
    if (nodeAncienPoV != null) {
        panePanoramique.getChildren().remove(nodeAncienPoV);
    }
    Polygon plgPoV = new Polygon();
    plgPoV.getPoints().addAll(new Double[] { 20.0, 2.0, 2.0, 2.0, 2.0, 20.0, -2.0, 20.0, -2.0, 2.0, -20.0, 2.0,
            -20.0, -2.0, -2.0, -2.0, -2.0, -20.0, 2.0, -20.0, 2.0, -2.0, 20.0, -2.0 });
    plgPoV.setStrokeLineJoin(StrokeLineJoin.MITER);
    plgPoV.setFill(Color.BLUEVIOLET);
    plgPoV.setStroke(Color.YELLOW);
    plgPoV.setId("PoV");
    plgPoV.setLayoutX(X);
    plgPoV.setLayoutY(Y);
    plgPoV.setCursor(Cursor.DEFAULT);
    plgPoV.setOnDragDetected((mouseEvent1) -> {
        plgPoV.setFill(Color.YELLOW);
        plgPoV.setStroke(Color.BLUEVIOLET);
        bDragDrop = true;
        mouseEvent1.consume();

    });
    plgPoV.setOnMouseDragged((mouseEvent1) -> {

        double XX = mouseEvent1.getSceneX() - ivImagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > ivImagePanoramique.getFitWidth()) {
            XX = ivImagePanoramique.getFitWidth();
        }
        plgPoV.setLayoutX(XX + ivImagePanoramique.getLayoutX());
        double YY = mouseEvent1.getSceneY() - panePanoramique.getLayoutY() - 130 - getiDecalageMac();
        if (YY < 0) {
            YY = 0;
        }
        if (YY > ivImagePanoramique.getFitHeight()) {
            YY = ivImagePanoramique.getFitHeight();
        }
        plgPoV.setLayoutY(YY);
        afficheLoupe(XX, YY);
        mouseEvent1.consume();

    });
    plgPoV.setOnMouseReleased((mouseEvent1) -> {
        double X1 = mouseEvent1.getSceneX();
        double Y1 = mouseEvent1.getSceneY();
        double mouseX1 = X1 - ivImagePanoramique.getLayoutX();
        if (mouseX1 < 0) {
            mouseX1 = 0;
        }
        if (mouseX1 > ivImagePanoramique.getFitWidth()) {
            mouseX1 = ivImagePanoramique.getFitWidth();
        }
        double mouseY1 = Y1 - panePanoramique.getLayoutY() - 130 - getiDecalageMac();
        if (mouseY1 < 0) {
            mouseY1 = 0;
        }
        if (mouseY1 > ivImagePanoramique.getFitHeight()) {
            mouseY1 = ivImagePanoramique.getFitHeight();
        }
        double regardX = 360.0f * mouseX1 / largeur - 180;
        double regardY = 90.0d - 2.0f * mouseY1 / largeur * 180.0f;
        navigateurPanoramique.setLongitude(regardX - 180);
        navigateurPanoramique.setLatitude(regardY);
        navigateurPanoramique.setFov(fov);
        navigateurPanoramique.affiche();
        getPanoramiquesProjet()[getiPanoActuel()].setRegardX(regardX);
        getPanoramiquesProjet()[getiPanoActuel()].setRegardY(regardY);
        plgPoV.setFill(Color.BLUEVIOLET);
        plgPoV.setStroke(Color.YELLOW);
        mouseEvent1.consume();

    });

    panePanoramique.getChildren().add(plgPoV);
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param iNumZone numro de la zone//from   w w w.j  a va  2s  . c om
 * @param cercle cercle concern
 * @return ancres cercles
 */
private static ObservableList<AncreForme> olCreeAncresPourCercle(int iNumZone, Circle cercle) {
    ObservableList<AncreForme> olAnchors = FXCollections.observableArrayList();

    DoubleProperty xProperty1 = new SimpleDoubleProperty(cercle.getCenterX());
    DoubleProperty yProperty1 = new SimpleDoubleProperty(cercle.getCenterY());
    olAnchors.add(new AncreForme(Color.GOLD, xProperty1, yProperty1));
    DoubleProperty xProperty2 = new SimpleDoubleProperty(cercle.getCenterX() + cercle.getRadius());
    DoubleProperty yProperty2 = new SimpleDoubleProperty(cercle.getCenterY());
    final AncreForme ancRayon = new AncreForme(Color.BLUEVIOLET, xProperty2, yProperty2);
    olAnchors.add(ancRayon);
    xProperty1.addListener((ObservableValue<? extends Number> ov, Number oldX, Number x) -> {
        double dX = (double) x - cercle.getCenterX();
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - xProperty2.get(), 2.d)
                + Math.pow(cercle.getCenterY() - yProperty2.get(), 2.d));
        cercle.setCenterX((double) x);
        ancRayon.setCenterX(ancRayon.getCenterX() + dX);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);

    });

    yProperty1.addListener((ObservableValue<? extends Number> ov, Number oldY, Number y) -> {
        double dY = -cercle.getCenterY() + (double) y;
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - xProperty2.get(), 2.d)
                + Math.pow(cercle.getCenterY() - yProperty2.get(), 2.d));
        cercle.setCenterY((double) y);
        ancRayon.setCenterY(ancRayon.getCenterY() + dY);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });
    xProperty2.addListener((ObservableValue<? extends Number> ov, Number oldX, Number x) -> {
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - (double) x, 2.d)
                + Math.pow(cercle.getCenterY() - yProperty2.get(), 2.d));
        cercle.setRadius(rayon);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    yProperty2.addListener((ObservableValue<? extends Number> ov, Number oldY, Number y) -> {
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - xProperty2.get(), 2.d)
                + Math.pow(cercle.getCenterY() - (double) y, 2.d));
        cercle.setRadius(rayon);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    return olAnchors;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param iNumZone numero de la zone/*from w ww  .j  a va 2 s . c  o m*/
 * @param rect rectangle concern
 * @return ancres rectangle
 */
private static ObservableList<AncreForme> olCreeAncresPourRectangle(int iNumZone, Rectangle rect) {
    ObservableList<AncreForme> olAnchors = FXCollections.observableArrayList();

    DoubleProperty xProperty1 = new SimpleDoubleProperty(rect.getX());
    DoubleProperty yProperty1 = new SimpleDoubleProperty(rect.getY());
    DoubleProperty xProperty2 = new SimpleDoubleProperty(rect.getWidth() + rect.getX());
    DoubleProperty yProperty2 = new SimpleDoubleProperty(rect.getHeight() + rect.getY());
    olAnchors.add(new AncreForme(Color.GOLD, xProperty1, yProperty1));
    AncreForme ancrePoint2 = new AncreForme(Color.BLUEVIOLET, xProperty2, yProperty2);
    olAnchors.add(ancrePoint2);
    xProperty1.addListener((ObservableValue<? extends Number> ov, Number oldX, Number x) -> {
        double dX = -rect.getX() + (double) x;
        rect.setX((double) x);
        ancrePoint2.setCenterX(ancrePoint2.getCenterX() + dX);
        String chaine = Math.round(rect.getX() * 10) / 10 + "," + Math.round(rect.getY() * 10) / 10 + ","
                + Math.round((rect.getX() + rect.getWidth()) * 10) / 10 + ","
                + Math.round((rect.getY() + rect.getHeight()) * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    yProperty1.addListener((ObservableValue<? extends Number> ov, Number oldY, Number y) -> {
        double dY = -rect.getY() + (double) y;
        rect.setY((double) y);
        ancrePoint2.setCenterY(ancrePoint2.getCenterY() + dY);
        String chaine = Math.round(rect.getX() * 10) / 10 + "," + Math.round(rect.getY() * 10) / 10 + ","
                + Math.round((rect.getX() + rect.getWidth()) * 10) / 10 + ","
                + Math.round((rect.getY() + rect.getHeight()) * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });
    xProperty2.addListener((ObservableValue<? extends Number> ov, Number oldX, Number x) -> {
        rect.setWidth((double) x - rect.getX());
        String chaine = Math.round(rect.getX() * 10) / 10 + "," + Math.round(rect.getY() * 10) / 10 + ","
                + Math.round((rect.getX() + rect.getWidth()) * 10) / 10 + ","
                + Math.round((rect.getY() + rect.getHeight()) * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    yProperty2.addListener((ObservableValue<? extends Number> ov, Number oldY, Number y) -> {
        rect.setHeight((double) y - rect.getY());
        String chaine = Math.round(rect.getX() * 10) / 10 + "," + Math.round(rect.getY() * 10) / 10 + ","
                + Math.round((rect.getX() + rect.getWidth()) * 10) / 10 + ","
                + Math.round((rect.getY() + rect.getHeight()) * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    return olAnchors;
}