Java Code Examples for javafx.scene.shape.Box#setTranslateY()

The following examples show how to use javafx.scene.shape.Box#setTranslateY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Fx3DFeatureDataset.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: Viewer3d.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: Drag3DObject.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: Fx3DFeatureDataset.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
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);
}