本文整理了Java中javafx.scene.Node.getTransforms()
方法的一些代码示例,展示了Node.getTransforms()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getTransforms()
方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getTransforms
暂无
代码示例来源:origin: stackoverflow.com
public static void addRotate(Node node, Point3D rotationAxis, double angle) {
ObservableList<Transform> transforms = node.getTransforms();
try {
for (Transform t : transforms) {
rotationAxis = t.inverseDeltaTransform(rotationAxis);
}
} catch (NonInvertibleTransformException ex) {
throw new IllegalStateException(ex);
}
transforms.add(new Rotate(angle, rotationAxis));
}
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
public MouseBehaviorImpl1(Node n, MouseButton btn) {
n.getTransforms().addAll(rotateX, rotateZ);
this.btn = btn;
if (btn == null) {
this.btn = MouseButton.MIDDLE;
}
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
public static void transformNode(Node nodeToTransform, RigidBodyTransform transform)
{
nodeToTransform.getTransforms().add(JavaFXTools.convertRigidBodyTransformToAffine(transform));
}
代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit
public SimpleCameraMouseEventHandler(Node cameraNode)
{
cameraNode.getTransforms().addAll(xRotate, yRotate);
}
代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit
public SimpleCameraMouseEventHandler(Node cameraNode)
{
cameraNode.getTransforms().addAll(xRotate, yRotate);
}
代码示例来源:origin: stackoverflow.com
public static void printNode(final Node node) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
Printer printer = Printer.getDefaultPrinter();
PageLayout pageLayout
= printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.HARDWARE_MINIMUM);
PrinterAttributes attr = printer.getPrinterAttributes();
PrinterJob job = PrinterJob.createPrinterJob();
double scaleX
= pageLayout.getPrintableWidth() / node.getBoundsInParent().getWidth();
double scaleY
= pageLayout.getPrintableHeight() / node.getBoundsInParent().getHeight();
Scale scale = new Scale(scaleX, scaleY);
node.getTransforms().add(scale);
if (job != null && job.showPrintDialog(node.getScene().getWindow())) {
boolean success = job.printPage(pageLayout, node);
if (success) {
job.endJob();
}
}
node.getTransforms().remove(scale);
}
代码示例来源:origin: com.github.wshackle/poseList3DPlot
private void updateTransformsText() {
final List<Transform> transforms = this.getContentGroup().getTransforms();
this.setTransformText(transformsToString(transforms));
}
代码示例来源:origin: stackoverflow.com
public void print(final Node node) {
Printer printer = Printer.getDefaultPrinter();
PageLayout pageLayout = printer.createPageLayout(Paper.NA_LETTER, PageOrientation.PORTRAIT, Printer.MarginType.DEFAULT);
double scaleX = pageLayout.getPrintableWidth() / node.getBoundsInParent().getWidth();
double scaleY = pageLayout.getPrintableHeight() / node.getBoundsInParent().getHeight();
node.getTransforms().add(new Scale(scaleX, scaleY));
PrinterJob job = PrinterJob.createPrinterJob();
if (job != null) {
boolean success = job.printPage(node);
if (success) {
job.endJob();
}
}
}
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
private void optimize(Node node) {
ObservableList<Transform> transforms = node.getTransforms();
Iterator<Transform> iterator = transforms.iterator();
boolean prevIsStatic = false;
代码示例来源:origin: com.github.wshackle/poseList3DPlot
private void resetTransforms() {
getContentGroup().getTransforms().clear();
getContentGroup().getTransforms().addAll(getTmain(), getRxmain(), getRymain(), getRzmain());
setupTransforms();
}
代码示例来源:origin: stackoverflow.com
node.getTransforms().add(new Scale(scale, scale));
代码示例来源:origin: com.github.wshackle/poseList3DPlot
this.getContentGroup().getTransforms().add(0, getRxy());
this.getContentGroup().getTransforms().add(getRxy());
this.setRz(new Rotate(0, Rotate.Z_AXIS));
if (leftMultiplySelected) {
this.getContentGroup().getTransforms().add(0, getRz());
} else {
this.getContentGroup().getTransforms().add(getRz());
this.setT(new Translate());
if (leftMultiplySelected) {
this.getContentGroup().getTransforms().add(0, getT());
} else {
this.getContentGroup().getTransforms().add(getT());
this.setT(new Translate());
if (leftMultiplySelected) {
this.getContentGroup().getTransforms().add(0, getT());
} else {
this.getContentGroup().getTransforms().add(getT());
this.setS(new Scale());
if (leftMultiplySelected) {
this.getContentGroup().getTransforms().add(0, getS());
} else {
this.getContentGroup().getTransforms().add(getS());
代码示例来源:origin: org.jfxtras/jfxtras-test-support
for (Transform t : node.getTransforms()) {
if (t instanceof Rotate) {
r = (Rotate)t;
for (Transform t : node.getTransforms()) {
if (t instanceof Scale) {
s = (Scale)t;
代码示例来源:origin: stackoverflow.com
node.getTransforms().add(new Translate(-x,-y));
node.setTranslateX(x); node.setTranslateY(y);
代码示例来源:origin: org.jfxtras/jfxtras-test-support
public AssertNode assertRotate(double x, double y, double angle, double accuracy) {
Rotate r = null;
for (Transform t : node.getTransforms()) {
if (t instanceof Rotate) {
r = (Rotate)t;
break;
}
}
Assert.assertEquals(description + ", PivotX", x, r.getPivotX(), accuracy);
Assert.assertEquals(description + ", PivotY", y, r.getPivotY(), accuracy);
Assert.assertEquals(description + ", Angle", angle, r.getAngle(), accuracy);
return this;
}
代码示例来源:origin: org.jfxtras/jfxtras-test-support
public AssertNode assertScale(double x, double y, double scaleX, double scaleY, double accuracy) {
Scale s = null;
for (Transform t : node.getTransforms()) {
if (t instanceof Scale) {
s = (Scale)t;
break;
}
}
Assert.assertEquals(description + ", PivotX", x, s.getPivotX(), accuracy);
Assert.assertEquals(description + ", PivotY", y, s.getPivotY(), accuracy);
Assert.assertEquals(description + ", X", scaleX, s.getX(), accuracy);
Assert.assertEquals(description + ", Y", scaleY, s.getY(), accuracy);
return this;
}
代码示例来源:origin: stackoverflow.com
rx.setAngle(Math.toDegrees( -angle1));
node.getTransforms().addAll(rx);
代码示例来源:origin: org.tentackle/tentackle-fx
/**
* Prints a node.<br>
* The user selects the printer and the node is scaled down if too large for the paper.
*
* @param node the node to print
*/
public void print(Node node) {
PrinterJob job = PrinterJob.createPrinterJob();
if (job != null && job.showPrintDialog(Fx.getStage(node))) {
PageLayout pageLayout = job.getJobSettings().getPageLayout();
double scaleX = 1.0;
if (pageLayout.getPrintableWidth() < node.getBoundsInParent().getWidth()) {
scaleX = pageLayout.getPrintableWidth() / node.getBoundsInParent().getWidth();
}
double scaleY = 1.0;
if (pageLayout.getPrintableHeight() < node.getBoundsInParent().getHeight()) {
scaleY = pageLayout.getPrintableHeight() / node.getBoundsInParent().getHeight();
}
double scaleXY = Double.min(scaleX, scaleY);
Scale scale = new Scale(scaleXY, scaleXY);
node.getTransforms().add(scale);
boolean success = job.printPage(node);
node.getTransforms().remove(scale);
if (success) {
job.endJob();
}
}
}
代码示例来源:origin: com.guigarage/ui-basics
@Override
public void run() {
node.getTransforms().addAll(xRotate, yRotate);
scene.setOnMousePressed(e -> {
mousePoint = new Point2D(e.getSceneX(), e.getSceneY());
});
scene.setOnZoom((e) -> {
System.out.println(node.getTranslateZ());
node.setTranslateZ(node.getTranslateZ() + (1.0 - e.getZoomFactor()) * 100);
});
scene.setOnMouseDragged(e -> {
double mouseDeltaX = (e.getSceneX() - mousePoint.getX());
double mouseDeltaY = (e.getSceneY() - mousePoint.getY());
mousePoint = new Point2D(e.getSceneX(), e.getSceneY());
xRotate.setAngle(xRotate.getAngle() - mouseDeltaY * 0.1 * 2.0);
yRotate.setAngle(yRotate.getAngle() + mouseDeltaX * 0.1 * 2.0);
});
}
}.run();
代码示例来源:origin: com.guigarage/ui-basics
@Override
public void run() {
node.getTransforms().addAll(xRotate, yRotate);
scene.setOnMousePressed(e -> {
mousePoint = new Point2D(e.getSceneX(), e.getSceneY());
});
scene.setOnZoom((e) -> {
System.out.println(node.getTranslateZ());
node.setTranslateZ(node.getTranslateZ() + (1.0 - e.getZoomFactor()) * 100);
});
scene.setOnMouseDragged(e -> {
double mouseDeltaX = (e.getSceneX() - mousePoint.getX());
double mouseDeltaY = (e.getSceneY() - mousePoint.getY());
mousePoint = new Point2D(e.getSceneX(), e.getSceneY());
xRotate.setAngle(xRotate.getAngle() - mouseDeltaY * 0.1 * 2.0);
yRotate.setAngle(yRotate.getAngle() + mouseDeltaX * 0.1 * 2.0);
});
}
}.run();
内容来源于网络,如有侵权,请联系作者删除!