Exemple #1
0
  @SuppressWarnings({"unused", "unchecked", "rawtypes"})
  @Override
  public void start(Stage stage) throws Exception {
    // TODO Auto-generated method stub

    //		dp.setView(50, 0, 15, 20);
    //		dp.setView(5, 0, 0, 20);
    dp.setView(50, 0, 0, 20);

    Path sfx = getFXShape(target.getShapeList(dp));

    rotationGroup = new Group(sfx);
    rotationGroup.setRotationAxis(Rotate.Y_AXIS);

    //		Pane root = new Pane(rotationGroup);

    //		//Create scene without a depth buffer
    //		Scene scene = new Scene(root, 600, 600);

    // Create scene with a depth buffer
    Scene scene = new Scene(rotationGroup, windowWidth, windowHeight, true);

    //		//Disable depth test from this node and its children
    //		rotationGroup.setDepthTest(DepthTest.DISABLE);

    scene.setCamera(new PerspectiveCamera());
    stage.setScene(scene);
    stage.show();

    rotationGroup
        .getScene()
        .setOnMouseClicked(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                // TODO Auto-generated method stub
                System.out.println("fx: Mouse Clicked " + e.getX() + ", " + e.getY());
                ((DrawWFPanel) dp.gettCanvas()).mouseClicked((int) e.getX(), (int) e.getY());
                updateView();
              }
            });

    rotationGroup
        .getScene()
        .setOnMousePressed(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                // TODO Auto-generated method stub
                System.out.println("fx: Mouse Pressed " + e.getX() + ", " + e.getY());
                ((DrawWFPanel) dp.gettCanvas()).mousePressed((int) e.getX(), (int) e.getY());
                updateView();
              }
            });

    rotationGroup
        .getScene()
        .setOnMouseMoved(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                // TODO Auto-generated method stub
                System.out.println("fx: Mouse Moved " + e.getX() + ", " + e.getY());
                ((DrawWFPanel) dp.gettCanvas()).mouseMoved((int) e.getX(), (int) e.getY());

                if (((DrawWFPanel) dp.gettCanvas()).mouseMode == DrawWFPanel.MODIFY_TARGET) {
                  rotationGroup.getScene().setCursor(Cursor.CROSSHAIR);
                } else {
                  rotationGroup.getScene().setCursor(Cursor.DEFAULT);
                }

                //				updateView();
              }
            });

    rotationGroup
        .getScene()
        .setOnMouseDragged(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent e) {
                // TODO Auto-generated method stub
                System.out.println("fx: Mouse Dragged " + e.getX() + ", " + e.getY());
                ((DrawWFPanel) dp.gettCanvas()).mouseDragged((int) e.getX(), (int) e.getY());
                updateView();
              }
            });
  }
Exemple #2
0
 public void updateView() {
   Path sfx = getFXShape(target.getShapeList(dp));
   rotationGroup.getChildren().clear();
   rotationGroup.getChildren().add(sfx);
 }