类javafx.scene.shape.Box源码实例Demo

下面列出了怎么用javafx.scene.shape.Box的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: scenic-view   文件: ThreeDOM.java
private void buildAxes(Group world) {
    PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);

    Box xAxis = new Box(AXES_SIZE, 1, 1);
    xAxis.setMaterial(redMaterial);
    Box yAxis = new Box(1, AXES_SIZE, 1);
    yAxis.setMaterial(greenMaterial);
    Box zAxis = new Box(1, 1, AXES_SIZE);
    zAxis.setMaterial(blueMaterial);

    Group group = new Group();
    group.getChildren().addAll(xAxis, yAxis, zAxis);
    group.setVisible(true);
    world.getChildren().addAll(group);
    group.visibleProperty().bind(checkBoxAxes.selectedProperty());
}
 
源代码2 项目: mzmine3   文件: Fx3DFeatureDataset.java
public Fx3DFeatureDataset(Feature feature, int rtResolution, int mzResolution,
    Range<Double> rtRange, Range<Double> mzRange, double maxOfAllBinnedIntensity,
    Color featureColor) {
  super(null, feature.toString(), featureColor);
  this.feature = feature;
  this.featureRtRange = feature.getRawDataPointsRTRange();
  this.featureMzRange = feature.getRawDataPointsMZRange();
  this.plotRtRange = rtRange;
  this.plotMzRange = mzRange;
  this.maxIntensityValue = feature.getRawDataPointsIntensityRange().upperEndpoint();

  float factorX = (float) SIZE / rtResolution;
  float factorZ = (float) SIZE / mzResolution;

  double rtSlope = SIZE / (plotRtRange.upperEndpoint() - plotRtRange.lowerEndpoint());
  double mzSlope = SIZE / (plotMzRange.upperEndpoint() - plotMzRange.lowerEndpoint());
  logger.finest("RtSlope is:" + rtSlope);
  logger.finest("MzSlope is:" + mzSlope);
  double minFeatureRtPoint =
      (featureRtRange.lowerEndpoint() - plotRtRange.lowerEndpoint()) * rtSlope;
  double maxFeatureRtPoint =
      (featureRtRange.upperEndpoint() - plotRtRange.lowerEndpoint()) * rtSlope;
  double minFeatureMzPoint =
      (featureMzRange.lowerEndpoint() - plotMzRange.lowerEndpoint()) * mzSlope;
  double maxFeatureMzPoint =
      (featureMzRange.upperEndpoint() - plotMzRange.lowerEndpoint()) * mzSlope;
  logger.finest("minRTPoint:" + minFeatureRtPoint + "  maxRTPoint:" + maxFeatureRtPoint);
  logger.finest("minMzPoint:" + minFeatureMzPoint + "  maxMzPoint:" + maxFeatureMzPoint);
  logger.finest("maxIntensityValue is:" + maxIntensityValue * AMPLIFI);
  logger.finest("maxOfAllBinnedIntensity value is:" + maxOfAllBinnedIntensity * AMPLIFI);
  double width = maxFeatureRtPoint - minFeatureRtPoint;
  double depth = maxFeatureMzPoint - minFeatureMzPoint;
  logger.finest("width is: " + width);
  logger.finest("depth is:" + depth);
  featureBox = new Box(width * factorX, maxIntensityValue * AMPLIFI, depth * factorZ);
  featureBox.setTranslateX((minFeatureRtPoint + width / 2) * factorX);
  featureBox.setTranslateY(-maxIntensityValue * AMPLIFI / 2);
  featureBox.setTranslateZ((minFeatureMzPoint + depth / 2) * factorZ);
  setNodeColor(featureColor);
}
 
源代码3 项目: phoebus   文件: Viewer3d.java
private Xform buildAxes()
{
    Xform axes = new Xform();
    final PhongMaterial red = new PhongMaterial();
    red.setDiffuseColor(Color.RED);
    red.setSpecularColor(Color.DARKRED);

    final PhongMaterial green = new PhongMaterial();
    green.setDiffuseColor(Color.GREEN);
    green.setSpecularColor(Color.DARKGREEN);

    final PhongMaterial blue = new PhongMaterial();
    blue.setDiffuseColor(Color.BLUE);
    blue.setSpecularColor(Color.DARKBLUE);

    final Box xAxis = new Box(AXIS_LENGTH, 1, 1);
    final Box yAxis = new Box(1, AXIS_LENGTH, 1);
    final Box zAxis = new Box(1, 1, AXIS_LENGTH);

    xAxis.setTranslateX(AXIS_LENGTH/2 + 0.5);
    yAxis.setTranslateY(AXIS_LENGTH/2 + 0.5);
    zAxis.setTranslateZ(AXIS_LENGTH/2 + 0.5);

    xAxis.setMaterial(red);
    yAxis.setMaterial(green);
    zAxis.setMaterial(blue);

    axes.getChildren().addAll(xAxis, yAxis, zAxis);

    return axes;
}
 
源代码4 项目: gluon-samples   文件: ContentModel.java
private void buildAxes() {
    double length = 2d * dimModel;
    double width = dimModel / 100d;
    double radius = 2d * dimModel / 100d;
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}
 
源代码5 项目: FXyzLib   文件: Histogram.java
private Node createDefaultNode(double barWidth, double barHeight) {
    switch (defaultNodeType) {
        case CYLINDER:
            return new Cylinder(barWidth / 2, barHeight);
        case CUBE:
            return new Box(barWidth, barHeight, barWidth);
        default:
            return new Box(barWidth, barHeight, barWidth);
    }
}
 
源代码6 项目: FXyzLib   文件: ScatterPlot.java
private Shape3D createDefaultNode(double radius) {
    switch(defaultNodeType) {
        case SPHERE: return new Sphere(radius);
        case CUBE: return new Box(radius, radius, radius);
        default: return new Box(radius, radius, radius);    
    }
}
 
源代码7 项目: FXyzLib   文件: Drag3DObject.java
@Override
public void start(Stage stage) {
    Box floor = new Box(1000, 10, 1000);
    floor.setTranslateY(150);
    root.getChildren().add(floor);

    Sphere s = new Sphere(150);
    s.setTranslateX(5);
    s.setPickOnBounds(true);
    root.getChildren().add(s);
    
    showStage(stage);
}
 
源代码8 项目: RubikFX   文件: ContentModel.java
private void buildAxes() {
    double length = 2d*dimModel;
    double width = dimModel/100d;
    double radius = 2d*dimModel/100d;
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}
 
源代码9 项目: JavaFX-Tutorial-Codes   文件: JavaFX3D.java
@Override
public void start(Stage primaryStage) {
    Box box = new Box(100, 20, 50);

    SmartGroup group = new SmartGroup();
    group.getChildren().add(box);

    Camera camera = new PerspectiveCamera();
    Scene scene = new Scene(group, WIDTH, HEIGHT);
    scene.setFill(Color.SILVER);
    scene.setCamera(camera);

    group.translateXProperty().set(WIDTH / 2);
    group.translateYProperty().set(HEIGHT / 2);
    group.translateZProperty().set(-1500);

    initMouseControl(group, scene);

    primaryStage.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
        switch (event.getCode()) {
            case W:
                group.translateZProperty().set(group.getTranslateZ() + 100);
                break;
            case S:
                group.translateZProperty().set(group.getTranslateZ() - 100);
                break;
            case Q:
                group.rotateByX(10);
                break;
            case E:
                group.rotateByX(-10);
                break;
            case NUMPAD6:
                group.rotateByY(10);
                break;
            case NUMPAD4:
                group.rotateByY(-10);
                break;
        }
    });

    primaryStage.setTitle("Genuine Coder");
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
源代码10 项目: mzmine2   文件: Fx3DFeatureDataset.java
public Fx3DFeatureDataset(FeatureSelection featureSel, int rtResolution,
        int mzResolution, Range<Double> rtRange, Range<Double> mzRange,
        double maxOfAllBinnedIntensity, Color featureColor) {
    super(featureSel.getRawDataFile(), featureSel.getFeature().toString(),
            featureColor);
    this.featureSelection = featureSel;
    this.featureRtRange = featureSel.getFeature().getRawDataPointsRTRange();
    this.featureMzRange = featureSel.getFeature().getRawDataPointsMZRange();
    this.plotRtRange = rtRange;
    this.plotMzRange = mzRange;
    this.maxIntensityValue = featureSel.getFeature()
            .getRawDataPointsIntensityRange().upperEndpoint();

    float factorX = (float) SIZE / rtResolution;
    float factorZ = (float) SIZE / mzResolution;

    double rtSlope = (double) ((double) SIZE
            / (plotRtRange.upperEndpoint() - plotRtRange.lowerEndpoint()));
    double mzSlope = (double) ((double) SIZE
            / (plotMzRange.upperEndpoint() - plotMzRange.lowerEndpoint()));
    LOG.finest("RtSlope is:" + rtSlope);
    LOG.finest("MzSlope is:" + mzSlope);
    double minFeatureRtPoint = (double) ((featureRtRange.lowerEndpoint()
            - plotRtRange.lowerEndpoint()) * rtSlope);
    double maxFeatureRtPoint = (double) ((featureRtRange.upperEndpoint()
            - plotRtRange.lowerEndpoint()) * rtSlope);
    double minFeatureMzPoint = (double) ((featureMzRange.lowerEndpoint()
            - plotMzRange.lowerEndpoint()) * mzSlope);
    double maxFeatureMzPoint = (double) ((featureMzRange.upperEndpoint()
            - plotMzRange.lowerEndpoint()) * mzSlope);
    LOG.finest("minRTPoint:" + minFeatureRtPoint + "  maxRTPoint:"
            + maxFeatureRtPoint);
    LOG.finest("minMzPoint:" + minFeatureMzPoint + "  maxMzPoint:"
            + maxFeatureMzPoint);
    LOG.finest("maxIntensityValue is:" + maxIntensityValue * AMPLIFI);
    LOG.finest("maxOfAllBinnedIntensity value is:"
            + maxOfAllBinnedIntensity * AMPLIFI);
    double width = maxFeatureRtPoint - minFeatureRtPoint;
    double depth = maxFeatureMzPoint - minFeatureMzPoint;
    LOG.finest("width is: " + width);
    LOG.finest("depth is:" + depth);
    featureBox = new Box(width * factorX, maxIntensityValue * AMPLIFI,
            depth * factorZ);
    featureBox.setTranslateX((minFeatureRtPoint + width / 2) * factorX);
    featureBox.setTranslateY(-maxIntensityValue * AMPLIFI / 2);
    featureBox.setTranslateZ((minFeatureMzPoint + depth / 2) * factorZ);
    setNodeColor(featureColor);
}
 
 类所在包
 同包方法