当前位置: 首页>>代码示例>>Java>>正文


Java Dimension2D.getHeight方法代码示例

本文整理汇总了Java中javafx.geometry.Dimension2D.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Dimension2D.getHeight方法的具体用法?Java Dimension2D.getHeight怎么用?Java Dimension2D.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.geometry.Dimension2D的用法示例。


在下文中一共展示了Dimension2D.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setFillImageKeepingAspectRatio

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
public void setFillImageKeepingAspectRatio(Rectangle rectangle, Image image, Dimension2D gamingContextDimension2D) {
    double imageWidth = image.getWidth();
    double imageHeight = image.getHeight();
    double imageHeightToWidthRatio = imageHeight / imageWidth;

    double initialHeight = rectangle.getHeight();
    double initialWidth = initialHeight / imageHeightToWidthRatio;

    double positionX = (gamingContextDimension2D.getWidth() - initialWidth) / 2;
    double positionY = (gamingContextDimension2D.getHeight() - initialHeight) / 2;

    rectangle.setFill(new ImagePattern(image));

    rectangle.setX(positionX);
    rectangle.setY(positionY);
    rectangle.setWidth(initialWidth);
    rectangle.setHeight(initialHeight);

    rectangle.setTranslateX(0);
    rectangle.setScaleX(1);
    rectangle.setScaleY(1);
    rectangle.setScaleZ(1);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:24,代码来源:AspectRatioImageRectangleUtil.java

示例2: newRandomPosition

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
public Position newRandomPosition(double radius) {

        double minX = radius;
        double minY = radius;

        Dimension2D dimension2D = getDimension2D();

        double maxX = dimension2D.getWidth() - radius;
        double maxY = dimension2D.getHeight() - radius;
        if (maxX > 0 && maxY > 0) {
            double positionX = random.nextInt((int) (maxX - minX)) + minX;
            double positionY = random.nextInt((int) (maxY - minY)) + minY;
            return new Position((int) positionX, (int) positionY);
        } else {
            return new Position((int) radius, (int) radius);
        }
    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:18,代码来源:RandomPositionGenerator.java

示例3: latLongToPixel

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
public static Point2D latLongToPixel(final Dimension2D MAP_DIMENSION,
                                     final Point2D UPPER_LEFT,
                                     final Point2D LOWER_RIGHT,
                                     final Point2D LOCATION) {
    final double LATITUDE   = LOCATION.getX();
    final double LONGITUDE  = LOCATION.getY();
    final double MAP_WIDTH  = MAP_DIMENSION.getWidth();
    final double MAP_HEIGHT = MAP_DIMENSION.getHeight();

    final double WORLD_MAP_WIDTH = ((MAP_WIDTH / (LOWER_RIGHT.getY() - UPPER_LEFT.getY())) * 360) / (2 * Math.PI);
    final double MAP_OFFSET_Y    = (WORLD_MAP_WIDTH / 2 * Math.log10((1 + Math.sin(Math.toRadians(LOWER_RIGHT.getX()))) / (1 - Math.sin(Math.toRadians(LOWER_RIGHT.getX())))));

    final double X = (LONGITUDE - UPPER_LEFT.getY()) * (MAP_WIDTH / (LOWER_RIGHT.getY() - UPPER_LEFT.getY()));
    final double Y = MAP_HEIGHT - ((WORLD_MAP_WIDTH / 2 * Math.log10((1 + Math.sin(Math.toRadians(LATITUDE))) / (1 - Math.sin(Math.toRadians(LATITUDE))))) - MAP_OFFSET_Y);

    return new Point2D(X, Y);
}
 
开发者ID:HanSolo,项目名称:worldheatmap,代码行数:18,代码来源:Helper.java

示例4: moveTarget

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
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);
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:21,代码来源:BouncingTargets.java

示例5: setHiddenPicture

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
private void setHiddenPicture(GameContext gameContext) {
    final int randomPictureIndex = (int) Math.floor(Math.random() * images.length);
    final Image randomPicture = images[randomPictureIndex];

    Dimension2D dimension2D = gameContext.getGamePanelDimensionProvider().getDimension2D();

    Rectangle imageRectangle = new Rectangle(0, 0, dimension2D.getWidth(), dimension2D.getHeight());
    imageRectangle.setFill(new ImagePattern(randomPicture, 0, 0, 1, 1, true));

    AspectRatioImageRectangleUtil aspectRatioImageRectangleUtil = new AspectRatioImageRectangleUtil();
    aspectRatioImageRectangleUtil.setFillImageKeepingAspectRatio(imageRectangle, randomPicture, dimension2D);

    gameContext.getChildren().add(imageRectangle);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:15,代码来源:Blocs.java

示例6: build

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
public final HeatMap build() {
    double              width               = 400;
    double              height              = 400;
    ColorMapping        colorMapping        = ColorMapping.LIME_YELLOW_RED;
    double              eventRadius         = 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 ("eventRadius".equals(key)) {
            eventRadius = ((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, eventRadius, fadeColors, heatMapOpacity, opacityDistribution);
}
 
开发者ID:HanSolo,项目名称:worldheatmap,代码行数:34,代码来源:HeatMapBuilder.java

示例7: build

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
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);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:33,代码来源:HeatMapBuilder.java

示例8: getLabelSize

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
private double getLabelSize() {
    Dimension2D dim = measureTickMarkLabelSize("-888.88E-88", getTickLabelRotation());
    if (getSide().isHorizontal()) {
        return dim.getWidth();
    }
    else {
        return dim.getHeight();
    }
}
 
开发者ID:fthevenet,项目名称:binjr,代码行数:10,代码来源:StableTicksAxis.java

示例9: setProjectionSizeFromLetterPaperPixels

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:31,代码来源:PerspectiveManager.java

示例10: layoutChildren

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void layoutChildren()
{
	Dimension2D actualLayoutSize = doLayout(getWidth(), getHeight(), true);
	
	boolean secondPassRequired = false;
	
	if (orientation.get() == Orientation.HORIZONTAL)
	{
		if ((calculatedPrefWidth > 0 && actualLayoutSize.getWidth() > calculatedPrefWidth)
				|| (calculatedPrefHeight > 0 && actualLayoutSize.getHeight() != calculatedPrefHeight))
		{
			secondPassRequired = true;
		}
	}
	else
	{
		if ((calculatedPrefWidth > 0 && actualLayoutSize.getWidth() != calculatedPrefWidth)
				|| (calculatedPrefHeight > 0 && actualLayoutSize.getHeight() > calculatedPrefHeight))
		{
			secondPassRequired = true;
		}
	}
	
	if ((previousWidth > 0 && previousWidth != getWidth()) || (previousHeight > 0 && previousHeight != getHeight()))
	{
		secondPassRequired = true;
	}
	
	if (secondPassRequired)
	{
		Platform.runLater(this::requestLayout);
	}
	
	previousWidth = getWidth();
	previousHeight = getHeight();
	
	calculatedPrefSize = null;
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:43,代码来源:FXFluidFlowPane.java

示例11: doStretchOtherDirection

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
/**
 * Stretches the children in the other direction as the direction of the
 * container, if required.
 * 
 * @param pLayoutSize the size of the layout.
 * @param pRows the rows.
 */
private void doStretchOtherDirection(Dimension2D pLayoutSize, List<LayoutRow> pRows)
{
	Insets padding = getPaddingSafe();
	
	double widthFactor = 1;
	double heightFactor = 1;
	
	if (orientation.get() == Orientation.HORIZONTAL
			&& stretchVertical.get())
	{
		double height = getHeight() - padding.getTop() - padding.getBottom();
		heightFactor = height / pLayoutSize.getHeight();
	}
	
	if (orientation.get() == Orientation.VERTICAL
			&& stretchHorizontal.get())
	{
		double width = getWidth() - padding.getLeft() - padding.getRight();
		widthFactor = width / pLayoutSize.getWidth();
	}
	
	for (LayoutRow row : pRows)
	{
		for (Node node : row.getNodes())
		{
			node.resizeRelocate(
					node.getLayoutX() * widthFactor,
					node.getLayoutY() * heightFactor,
					node.getLayoutBounds().getWidth() * widthFactor,
					node.getLayoutBounds().getHeight() * heightFactor);
		}
	}
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:41,代码来源:FXFluidFlowPane.java

示例12: computeCardHeight

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
private static double computeCardHeight(Dimension2D gameDimension2D, int nbLines) {
    return gameDimension2D.getHeight() * 0.9 / nbLines;
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:4,代码来源:MagicCards.java

示例13: computeGameSizing

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
public GameSizing computeGameSizing(Dimension2D dimension2D) {
    Rectangle2D bounds = new Rectangle2D(0, 0, dimension2D.getWidth(), dimension2D.getHeight());

    return computeGameSizing(bounds);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:6,代码来源:GameSizingComputer.java

示例14: centreOf

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
private static Point2D centreOf(Dimension2D d) {
	return new Point2D(d.getWidth() / 2d, d.getHeight() / 2d);
}
 
开发者ID:tom91136,项目名称:GestureFX,代码行数:4,代码来源:AffineEvent.java

示例15: averageDimensions

import javafx.geometry.Dimension2D; //导入方法依赖的package包/类
private Dimension2D averageDimensions(Dimension2D d2d1, Dimension2D d2d2) {
	return new Dimension2D((d2d1.getWidth() + d2d2.getWidth()) / 2, (d2d1.getHeight() + d2d2.getHeight()) / 2);
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:4,代码来源:AutoCalibrationManager.java


注:本文中的javafx.geometry.Dimension2D.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。