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


Java Box.setTranslateZ方法代码示例

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


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

示例1: buildCubes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private void buildCubes(ActionEvent event) {
    world = new XForm();
    moleculeGroup = new XForm();
    for (Cube cube : cubes) {

        Box boxShape = new Box(cube.getSideLength(), cube.getSideLength(), cube.getSideLength());
        boxShape.setMaterial(MaterialProvider.crateMaterialFromColor(Color.LIGHTSALMON));
        boxShape.setTranslateX(cube.getCenter().getX());
        boxShape.setTranslateY(cube.getCenter().getY());
        boxShape.setTranslateZ(cube.getCenter().getZ());

        // add tooltip
        Tooltip tooltip = new Tooltip(cube.toString());
        Tooltip.install(boxShape, tooltip);

        moleculeGroup.getChildren().add(boxShape);
    }
    world.getChildren().add(moleculeGroup);
    displayGroup.getChildren().retainAll();
    displayGroup.getChildren().add(world);
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:22,代码来源:StructureViewer.java

示例2: createPlane

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private void createPlane(double length) {
    Box xzPlane = new Box(length, PLANE_THICKNESS, length);
    xzPlane.setDrawMode(DrawMode.LINE);
    xzPlane.setTranslateX(length / 2.0);
    xzPlane.setTranslateZ(length / 2.0);
    
    Box xyPlane = new Box(length, length, PLANE_THICKNESS);
    xyPlane.setDrawMode(DrawMode.LINE);
    xyPlane.setTranslateX(length / 2.0);
    xyPlane.setTranslateY(length / 2.0);
    
    Box yzPlane = new Box(PLANE_THICKNESS, length, length);
    yzPlane.setDrawMode(DrawMode.LINE);
    yzPlane.setTranslateY(length / 2.0);
    yzPlane.setTranslateZ(length / 2.0);
    
    this.group.getChildren().addAll(xzPlane, xyPlane, yzPlane);
}
 
开发者ID:opengl-8080,项目名称:classical-physics,代码行数:19,代码来源:Axis.java

示例3: createAxis

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private void createAxis(double length) {
    Box x = new Box(length, AXIS_THICKNESS, AXIS_THICKNESS);
    x.setMaterial(new PhongMaterial(Color.BLUE));
    x.setTranslateX(length / 2.0);
    
    Box y = new Box(AXIS_THICKNESS, length, AXIS_THICKNESS);
    y.setMaterial(new PhongMaterial(Color.RED));
    y.setTranslateY(length / 2.0);
    
    Box z = new Box(AXIS_THICKNESS, AXIS_THICKNESS, length);
    z.setMaterial(new PhongMaterial(Color.GREEN));
    z.setTranslateZ(length / 2.0);
    
    this.group.getChildren().addAll(x, y, z);
}
 
开发者ID:opengl-8080,项目名称:classical-physics,代码行数:16,代码来源:Axis.java

示例4: AxesGrid

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 * Construct a new axes and grid in 3D.
 *
 * @param length length of the axis and grid
 */
public AxesGrid(double length) {
  redMaterial.setDiffuseColor(Color.RED);
  redMaterial.setSpecularColor(Color.PINK);

  greenMaterial.setDiffuseColor(Color.GREEN);
  greenMaterial.setSpecularColor(Color.LIGHTGREEN);

  blueMaterial.setDiffuseColor(Color.BLUE);
  blueMaterial.setSpecularColor(Color.LIGHTBLUE);

  blackMaterial.setDiffuseColor(Color.BLACK);
  blackMaterial.setSpecularColor(Color.BLACK);

  final Box xAxis = new Box(length, AXES_THICKNESS, AXES_THICKNESS);
  xAxis.setTranslateX(length / 2.0);
  xAxis.setMaterial(redMaterial);

  final Box yAxis = new Box(AXES_THICKNESS, length, AXES_THICKNESS);
  yAxis.setTranslateY(length / 2.0);
  yAxis.setMaterial(greenMaterial);

  final Box zAxis = new Box(AXES_THICKNESS, AXES_THICKNESS, length);
  zAxis.setTranslateZ(length / 2.0);
  zAxis.setMaterial(blueMaterial);

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

  for (int i = (int) -length; i <= length; i++) {
    addXLine(length * 2, i);
  }
  for (int i = (int) -length; i <= length; i++) {
    addYLine(length * 2, i);
  }
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:40,代码来源:AxesGrid.java

示例5: TransformGizmo

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 *
 * @param axisSize
 */
public TransformGizmo(double axisSize) {
	super();

	if (axisSize > 0) {
		
		this.axisSize = axisSize;
		
		axisXMaterial = new PhongMaterial();
		axisXMaterial.setDiffuseColor(Color.RED);

		axisYMaterial = new PhongMaterial();
		axisYMaterial.setDiffuseColor(Color.GREEN);

		axisZMaterial = new PhongMaterial();
		axisZMaterial.setDiffuseColor(Color.BLUE);

		PhongMaterial handleMaterial = new PhongMaterial();
		handleMaterial.setDiffuseColor(Color.BLUE);

		setDepthTest(DepthTest.DISABLE);
		
		createAxes(axisSize, axisWidth);

		handleX = new Box(15, 15, 15);
		handleX.setDepthTest(DepthTest.DISABLE);
		handleX.setMaterial(handleMaterial);
		handleX.setTranslateX(axisSize);
		handleX.setTranslateY(0);
		handleX.setTranslateZ(0);
		
		handleY = new Box(15, 15, 15);
		handleY.setDepthTest(DepthTest.DISABLE);
		handleY.setMaterial(handleMaterial);
		handleY.setTranslateX(0);
		handleY.setTranslateY(-axisSize);
		handleY.setTranslateZ(0);

		handleZ = new Box(15, 15, 15);
		handleZ.setDepthTest(DepthTest.DISABLE);
		handleZ.setMaterial(handleMaterial);
		handleZ.setTranslateX(0);
		handleZ.setTranslateY(0);
		handleZ.setTranslateZ(axisSize);

		ObservableList<Node> children = getChildren();

		children.add(handleX);
		children.add(handleY);
		children.add(handleZ);
		
		//The gizmo will initially be drawn on a 1 to 1 scale
		currentSize = 1;
	}
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:59,代码来源:TransformGizmo.java


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