本文整理汇总了Java中javafx.scene.shape.DrawMode类的典型用法代码示例。如果您正苦于以下问题:Java DrawMode类的具体用法?Java DrawMode怎么用?Java DrawMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DrawMode类属于javafx.scene.shape包,在下文中一共展示了DrawMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initListeners
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
private void initListeners() {
ValueChangedListener listener = (lastValue, newValue, source) -> {
if (newValue != lastValue) {
control.showOrientationCross(showOrientationcross.isYesSelected());
control.setDrawMode(interpolateValues.isYesSelected() ? DrawMode.FILL : DrawMode.LINE);
control.setLeftWallVisible(showLeftWall.isYesSelected());
control.setRightWallVisible(showRightWall.isYesSelected());
control.setTopWallVisible(showTopWall.isYesSelected());
control.setBottomWallVisible(showBottomWall.isYesSelected());
control.setFrontWallVisible(showFrontWall.isYesSelected());
control.setBackWallVisible(showBackWall.isYesSelected());
control.activateDynamicWalls(dynamicWalls.isYesSelected());
updateControls();
}
};
dynamicWalls.addValueChangedListener(listener);
showOrientationcross.addValueChangedListener(listener);
interpolateValues.addValueChangedListener(listener);
showLeftWall.addValueChangedListener(listener);
showRightWall.addValueChangedListener(listener);
showTopWall.addValueChangedListener(listener);
showBottomWall.addValueChangedListener(listener);
showFrontWall.addValueChangedListener(listener);
showBackWall.addValueChangedListener(listener);
}
示例2: buildGroup
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
@Override
protected Group buildGroup() {
mb = new MeshBuilder();
triangleMesh = mb.getTriangleMesh();
meshView = new MeshView(triangleMesh);
material = new PhongMaterial();
material.setDiffuseColor(Color.LIGHTGRAY);
material.setSpecularColor(Color.rgb(30, 30, 30));
meshView.setMaterial(material);
//Set Wireframe mode
meshView.setDrawMode(DrawMode.FILL);
meshView.setCullFace(CullFace.BACK);
meshView.setScaleX(SCALE);
meshView.setScaleY(SCALE);
meshView.setScaleZ(SCALE);
grp = new Group(meshView);
return grp;
}
示例3: setMode
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
/**
* Set all the MeshViews in the group to the given draw mode, as well as the
* children of any child groups.
*
* @param group
* The group whose children will have their draw modes set.
* @param mode
* The mode to be set to the group's children.
*/
private void setMode(Group group, DrawMode mode) {
// Handle each of the group's children
for (Node node : group.getChildren()) {
// If the node is a mesh view, set its material
if (node.getClass() == MeshView.class) {
((MeshView) node).setDrawMode(mode);
}
// Otherwise, recursively handle the child group
else if (node.getClass() == Group.class) {
setMode((Group) node, mode);
}
}
}
示例4: KnotMesh
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
public KnotMesh(double majorRadius, double minorRadius, double wireRadius, double p, double q,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setP(p);
setQ(q);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
示例5: IcosahedronMesh
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
public IcosahedronMesh(int level, float diameter){
setLevel(level);
setDiameter(diameter);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
diameterProperty().addListener((obs,f0,f1)->{
if(mesh!=null && f0!=null && f1!=null && f0.floatValue()>0 && f1.floatValue()>0){
updateVertices(f1.floatValue()/f0.floatValue());
}
});
levelProperty().addListener((obs,i0,i1)->{
if(mesh!=null && i1!=null && i1.intValue()>=0){
updateMesh();
}
});
}
示例6: CurvedSpringMesh
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
public CurvedSpringMesh(double majorRadius, double minorRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
示例7: SpringMesh
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
public SpringMesh(double meanRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMeanRadius(meanRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
factor=length/pitch;
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
示例8: testObject3D
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
@Override
public Group testObject3D() {
Group group = new Group();
TetrahedraMesh tetra = new TetrahedraMesh(10, 7, null);
// cylinder = new PrismMesh(0.2,2,3); //,new Point3D(-5,5,0),new
// Point3D(0,0,5));
tetra.setDrawMode(DrawMode.LINE);
tetra.setCullFace(CullFace.NONE);
// NONE
// cylinder.setTextureModeNone(Color.ROYALBLUE);
// IMAGE
// tetra.setTextureModeImage(getClass().getResource("res/steel-mesh.jpg").toExternalForm());
// tetra.setTextureModeVertices1D(6, t->t);
// cylinder.setColorPalette(ColorPalette.GREEN);
// DENSITY
tetra.setTextureModeVertices3D(1530, p -> p.magnitude());
// cylinder.setTextureModeVertices3D(1530,p->(double)cylinder.unTransform(p).magnitude());
// FACES
// tetra.setTextureModeFaces(1530);
group.getChildren().add(tetra);
return group;
}
示例9: createPlane
import javafx.scene.shape.DrawMode; //导入依赖的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);
}
示例10: MultiLine3D
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
/**
* Construct a new MultiLine3D object.
*
* @param lines list of lines
*/
public MultiLine3D(List<Line3D> lines) {
lineMaterial.setDiffuseColor(color);
lineMaterial.setSpecularColor(color);
//The MeshView allows you to control how the TriangleMesh is rendered
meshView.setDrawMode(DrawMode.FILL); //Fill so that the line shows width
// meshView.setDrawMode(DrawMode.LINE); // only show lines
meshView.setCullFace(CullFace.NONE); // no culling (backs are black)
meshView.setMaterial(lineMaterial);
this.getChildren().add(meshView);
// add dummy Texture Coordinate
mesh.getTexCoords().addAll(0, 0);
setDepthTest(DepthTest.INHERIT);
if (!lines.isEmpty()) {
refresh(lines);
}
}
示例11: IcosahedronMesh
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
public IcosahedronMesh(int level, float diameter){
setLevel(level);
setDiameter(diameter);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
diameterProperty().addListener((obs,f0,f1)->{
if(mesh!=null && f0!=null && f1!=null && f0.floatValue()>0 && f1.floatValue()>0){
updateVertices(f1.floatValue()/f0.floatValue());
}
});
levelProperty().addListener((obs,i0,i1)->{
if(mesh!=null && i1!=null && i1.intValue()>=0){
updateMesh();
}
});
}
示例12: updateControlPanel
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
private void updateControlPanel() {
if (controlPanel != null) {
SwingUtilities.invokeLater(() -> {
controlPanel.setDynamicWalls(dynamicWallsEnabled);
controlPanel.setLeftWallVisible(cube.isLeftWallVisible());
controlPanel.setRightWallVisible(cube.isRightWallVisible());
controlPanel.setTopWallVisible(cube.isTopWallVisible());
controlPanel.setBottomWallVisible(cube.isBottomWallVisible());
controlPanel.setFrontWallVisible(cube.isFrontWallVisible());
controlPanel.setBackWallVisible(cube.isBackWallVisible());
controlPanel.setInterpolateValues(drawMode == DrawMode.FILL);
controlPanel.setShowOrientationCross(axisOrientation.isVisible());
});
}
}
示例13: setDrawMode
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
@Override
public void setDrawMode(final DrawMode mode) {
new GetAction() {
@Override
public void run(Object... os) throws Exception {
getShapesApp().setDrawMode(mode);
}
}.dispatch(Root.ROOT.getEnvironment());
}
示例14: checkWireframe
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
/**
* Test that the vertex can be drawn in wireframe mode
*/
@Test @Ignore
public void checkWireframe() {
// Create a view for a vertex
FXVertexView view = new FXVertexView(new Vertex(0, 0, 0));
// The view should start off opaque
assertFalse(view.isWireframe());
// Make the view transparent
view.setWireframeMode(true);
// Check that the transparency flag is set
assertTrue(view.isWireframe());
// Whether a sphere shape has been found while searching the JavaFX
// node's children.
boolean sphereFound = false;
// Get the group containing the node
Representation<Group> representation = view.getRepresentation();
// Search all of the node's children
for (Node node : (representation.getData()).getChildren()) {
// If the child is a 3D shape, it should be transparent
if (node instanceof Shape3D) {
assertTrue(((Shape3D) node).getDrawMode() == DrawMode.LINE);
sphereFound = true;
break;
}
}
// A child sphere corresponding to the vertex should have been found
assertTrue(sphereFound);
}
示例15: setupSceneInternals
import javafx.scene.shape.DrawMode; //导入依赖的package包/类
/**
* <p>
* Creates scene elements that aren't meant to be manipulated by the user
* (markers, camera, etc.)
* </p>
*/
protected void setupSceneInternals(Group parent) {
// Create scene plane for frame of reference.
Box box = new Box(1000, 0, 1000);
box.setMouseTransparent(true);
box.setDrawMode(DrawMode.LINE);
box.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));
AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));
PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
light1.setMouseTransparent(true);
light1.setTranslateY(-350);
PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
light2.setMouseTransparent(true);
light2.setTranslateZ(350);
PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
light3.setMouseTransparent(true);
light3.setTranslateZ(-350);
PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
light4.setMouseTransparent(true);
light4.setTranslateZ(350);
TransformGizmo gizmo = new TransformGizmo(1000);
gizmo.showHandles(false);
parent.getChildren().addAll(gizmo, box, light1, light2, light3, light4,
ambientLight);
}