Java Code Examples for javafx.geometry.Dimension2D#getHeight()

The following examples show how to use javafx.geometry.Dimension2D#getHeight() . 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: BouncingTargets.java    From ShootOFF with GNU General Public License v3.0 6 votes vote down vote up
public void moveTarget() {
	if (maxVelocity == 0) return;

	final Bounds b = target.getBoundsInParent();
	final Point2D p = target.getPosition();
	final Dimension2D d = target.getDimension();
	final CollisionType ct = checkCollision();

	if (b.getMinX() <= 1 || b.getMinX() + d.getWidth() > thisSuper.getArenaWidth()
			|| ct == CollisionType.COLLISION_X || ct == CollisionType.COLLISION_BOTH) {
		dx *= -1;
	}

	if (b.getMinY() <= 1 || b.getMinY() + d.getHeight() > thisSuper.getArenaHeight()
			|| ct == CollisionType.COLLISION_X || ct == CollisionType.COLLISION_BOTH) {
		dy *= -1;
	}

	target.setPosition(p.getX() + dx, p.getY() + dy);
}
 
Example 2
Source File: HeatMapBuilder.java    From charts with Apache License 2.0 5 votes vote down vote up
public final HeatMap build() {
    double              width               = 400;
    double              height              = 400;
    ColorMapping        colorMapping        = ColorMapping.LIME_YELLOW_RED;
    double              spotRadius          = 15.5;
    boolean             fadeColors          = false;
    double              heatMapOpacity      = 0.5;
    OpacityDistribution opacityDistribution = OpacityDistribution.CUSTOM;

    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            width  = dim.getWidth();
            height = dim.getHeight();
        } else if ("width".equals(key)) {
            width = ((DoubleProperty) properties.get(key)).get();
        } else if ("height".equals(key)) {
            height = ((DoubleProperty) properties.get(key)).get();
        } else if ("colorMapping".equals(key)) {
            colorMapping = ((ObjectProperty<ColorMapping>) properties.get(key)).get();
        } else if ("spotRadius".equals(key)) {
            spotRadius = ((DoubleProperty) properties.get(key)).get();
        } else if ("fadeColors".equals(key)) {
            fadeColors = ((BooleanProperty) properties.get(key)).get();
        } else if ("heatMapOpacity".equals(key)) {
            heatMapOpacity = ((DoubleProperty) properties.get(key)).get();
        } else if ("opacityDistribution".equals(key)) {
            opacityDistribution = ((ObjectProperty<OpacityDistribution>) properties.get(key)).get();
        }
    }
    return new HeatMap(width,  height, colorMapping, spotRadius, fadeColors, heatMapOpacity, opacityDistribution);
}
 
Example 3
Source File: PerspectiveManager.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
private void setProjectionSizeFromLetterPaperPixels(Dimension2D letterDims) {
	if (logger.isTraceEnabled())
		logger.trace("letter w {} h {}", letterDims.getWidth(), letterDims.getHeight());

	if (cameraWidth == -1 || patternWidth == -1) {
		logger.error("Missing cameraWidth or patternWidth for US Letter calculation");
		return;
	}

	// Calculate the size of the whole camera feed using the size of the
	// letter
	final double cameraFeedWidthMM = (cameraWidth / letterDims.getWidth()) * US_LETTER_WIDTH_MM;
	final double cameraFeedHeightMM = (cameraHeight / letterDims.getHeight()) * US_LETTER_HEIGHT_MM;

	if (logger.isTraceEnabled()) {
		logger.trace("{} = ({} / {}) * {}", cameraFeedWidthMM, cameraWidth, letterDims.getWidth(),
				US_LETTER_WIDTH_MM);
		logger.trace("{} = ({} / {}) * {}", cameraFeedHeightMM, cameraHeight, letterDims.getHeight(),
				US_LETTER_HEIGHT_MM);
	}

	// Set the projection width/height in mm
	projectionWidth = (int) (cameraFeedWidthMM * ((double) patternWidth / (double) cameraWidth));
	projectionHeight = (int) (cameraFeedHeightMM * ((double) patternHeight / (double) cameraHeight));

	if (logger.isTraceEnabled()) {
		logger.trace("{} = ({} / {}) * {}", projectionWidth, cameraFeedWidthMM, patternWidth, cameraWidth);
		logger.trace("{} = ({} / {}) * {}", projectionHeight, cameraFeedHeightMM, patternHeight, cameraHeight);
	}
}
 
Example 4
Source File: StableTicksAxis.java    From jfxutils with Apache License 2.0 5 votes vote down vote up
private double getLabelSize() {
	Dimension2D dim = measureTickMarkLabelSize( "-888.88E-88", getTickLabelRotation() );
	if ( getSide().isHorizontal() ) {
		return dim.getWidth();
	} else {
		return dim.getHeight();
	}
}
 
Example 5
Source File: AutoCalibrationManager.java    From ShootOFF with GNU General Public License v3.0 4 votes vote down vote up
private Dimension2D averageDimensions(Dimension2D d2d1, Dimension2D d2d2) {
	return new Dimension2D((d2d1.getWidth() + d2d2.getWidth()) / 2, (d2d1.getHeight() + d2d2.getHeight()) / 2);
}