本文整理汇总了Java中javafx.scene.shape.MoveTo类的典型用法代码示例。如果您正苦于以下问题:Java MoveTo类的具体用法?Java MoveTo怎么用?Java MoveTo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MoveTo类属于javafx.scene.shape包,在下文中一共展示了MoveTo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearSmallPolygons
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private void clearSmallPolygons(Path... paths){
validPaths = new ArrayList<>();
Point2D p0 = Point2D.ZERO;
for (Path path : paths) {
for (PathElement elem : path.getElements()) {
if (elem instanceof MoveTo) {
elements = new ArrayList<>();
elements.add(elem);
listPoints = new ArrayList<>();
p0 = new Point2D(((MoveTo)elem).getX(), ((MoveTo)elem).getY());
listPoints.add(p0);
} else if (elem instanceof CubicCurveTo) {
elements.add(elem);
Point2D ini = listPoints.size() > 0 ? listPoints.get(listPoints.size() - 1) : p0;
listPoints.addAll(evalCubicCurve((CubicCurveTo) elem, ini, POINTS_CURVE));
} else if (elem instanceof ClosePath) {
elements.add(elem);
listPoints.add(p0);
if (Math.abs(calculateArea()) > MINIMUM_AREA) {
validPaths.add(new Path(elements));
}
}
}
}
}
示例2: Draw
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
double height = canvas.getHeight();
double width = canvas.getWidth();
canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
Path p = new Path(new PathElement[]
{
new MoveTo(width, 0),
new LineTo(width, height),
new LineTo(0, height),
new LineTo(width, 0)
});
p.fillProperty().set(Colors[1]);
p.strokeWidthProperty().set(0);
canvas.getChildren().add(p);
}
示例3: Draw
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
double height = canvas.getHeight();
double width = canvas.getWidth();
canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
Path p = new Path(new PathElement[]
{
new MoveTo(0, height),
new LineTo(width, 0),
new LineTo(width, height),
new LineTo(0, 0)
});
p.fillProperty().set(Colors[1]);
p.strokeWidthProperty().set(0);
canvas.getChildren().add(p);
}
示例4: Draw
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
double height = canvas.getHeight();
double width = canvas.getWidth();
canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
Path p = new Path(new PathElement[]
{
new MoveTo(width, height),
new LineTo(0, height),
new LineTo(0, 0),
new LineTo(width, height)
});
p.fillProperty().set(Colors[1]);
p.strokeWidthProperty().set(0);
canvas.getChildren().add(p);
}
示例5: DirectedPath
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
/**
* Constructs and binds the appropriate properties for the line and
* the arrow
*/
public DirectedPath(DoubleBinding startX, DoubleBinding startY,
DoubleBinding endX,DoubleBinding endY){
this.path = new Path();
MoveTo start = new MoveTo();
start.xProperty().bind(startX);
start.yProperty().bind(startY);
LineTo end = new LineTo();
end.xProperty().bind(endX);
end.yProperty().bind(endY);
path.getElements().add(start);
path.getElements().add(end);
this.arrow = getArrow();
this.getChildren().add(path);
this.getChildren().add(arrow);
this.path.getStyleClass().setAll("edge");
}
示例6: createIconContent
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
public static Node createIconContent() {
Path path = new Path();
path.getElements().addAll(
new MoveTo(25, 25),
new HLineTo(45),
new ArcTo(20, 20, 0, 80, 25, true, true)
);
path.setStroke(Color.web("#b9c0c5"));
path.setStrokeWidth(5);
path.getStrokeDashArray().addAll(15d,15d);
path.setFill(null);
javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
effect.setOffsetX(1);
effect.setOffsetY(1);
effect.setRadius(3);
effect.setColor(Color.rgb(0,0,0,0.6));
path.setEffect(effect);
return path;
}
示例7: drawingAreaMouseClicked
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
@FXML
private void drawingAreaMouseClicked(MouseEvent e)
{
polyline.getPoints().addAll(e.getX(), e.getY());
polygon.getPoints().addAll(e.getX(), e.getY());
// if path is empty, move to first click position and close path
if (path.getElements().isEmpty())
{
path.getElements().add(new MoveTo(e.getX(), e.getY()));
path.getElements().add(new ClosePath());
}
else // insert a new path segment before the ClosePath element
{
// create an arc segment and insert it in the path
ArcTo arcTo = new ArcTo();
arcTo.setX(e.getX());
arcTo.setY(e.getY());
arcTo.setRadiusX(100.0);
arcTo.setRadiusY(100.0);
arcTo.setSweepFlag(sweepFlag);
sweepFlag = !sweepFlag;
path.getElements().add(path.getElements().size() - 1, arcTo);
}
}
示例8: initializeTriangle
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private Path initializeTriangle() {
final Path triangle = new Path();
MoveTo start = new MoveTo();
LineTo l1 = new LineTo();
LineTo l2 = new LineTo();
LineTo l3 = new LineTo();
start.xProperty().bind(ax);
start.yProperty().bind(ay);
l1.xProperty().bind(bx);
l1.yProperty().bind(by);
l2.xProperty().bind(cx);
l2.yProperty().bind(cy);
l3.xProperty().bind(ax);
l3.yProperty().bind(ay);
triangle.setFill(Color.BLACK);
triangle.getElements().addAll(start, l1, l2, l3);
return triangle;
}
示例9: initializeHalfCircle
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private Path initializeHalfCircle() {
final Path halfCircle = new Path();
halfCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(CIRCLE_RADIUS);
p2.setRadiusY(CIRCLE_RADIUS);
halfCircle.getElements().add(p1);
halfCircle.getElements().add(p2);
return halfCircle;
}
示例10: initializeLargeCircle
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private Path initializeLargeCircle() {
final Path largeCircle = new Path();
largeCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(LARGE_CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(LARGE_CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(LARGE_CIRCLE_RADIUS);
p2.setRadiusY(LARGE_CIRCLE_RADIUS);
largeCircle.getElements().add(p1);
largeCircle.getElements().add(p2);
return largeCircle;
}
示例11: initializeMediumCircle
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private Path initializeMediumCircle() {
final Path mediumCircle = new Path();
mediumCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(MEDIUM_CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(MEDIUM_CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(MEDIUM_CIRCLE_RADIUS);
p2.setRadiusY(MEDIUM_CIRCLE_RADIUS);
mediumCircle.getElements().add(p1);
mediumCircle.getElements().add(p2);
return mediumCircle;
}
示例12: initializeSmallCircle
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private Path initializeSmallCircle() {
final Path smallCircle = new Path();
smallCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(SMALL_CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(SMALL_CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(SMALL_CIRCLE_RADIUS);
p2.setRadiusY(SMALL_CIRCLE_RADIUS);
smallCircle.getElements().add(p1);
smallCircle.getElements().add(p2);
return smallCircle;
}
示例13: drawChart
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
private void drawChart(final List<Point> POINTS) {
if (POINTS.isEmpty()) return;
Point[] points = smoothing ? Helper.subdividePoints(POINTS.toArray(new Point[0]), 8) : POINTS.toArray(new Point[0]);
fillPath.getElements().clear();
fillPath.getElements().add(new MoveTo(0, height));
strokePath.getElements().clear();
strokePath.getElements().add(new MoveTo(points[0].getX(), points[0].getY()));
for (Point p : points) {
fillPath.getElements().add(new LineTo(p.getX(), p.getY()));
strokePath.getElements().add(new LineTo(p.getX(), p.getY()));
}
fillPath.getElements().add(new LineTo(width, height));
fillPath.getElements().add(new LineTo(0, height));
fillPath.getElements().add(new ClosePath());
if (dataPointsVisible) { drawDataPoints(POINTS, tile.isFillWithGradient() ? tile.getGradientStops().get(0).getColor() : tile.getBarColor()); }
}
示例14: handleEvents
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
Helper.enableNode(valueText, tile.isValueVisible());
Helper.enableNode(timeSpanText, !tile.isTextVisible());
redraw();
} else if ("VALUE".equals(EVENT_TYPE)) {
if(tile.isAnimated()) { tile.setAnimated(false); }
if (!tile.isAveragingEnabled()) { tile.setAveragingEnabled(true); }
double value = clamp(minValue, maxValue, tile.getValue());
addData(value);
handleCurrentValue(value);
} else if ("AVERAGING".equals(EVENT_TYPE)) {
noOfDatapoints = tile.getAveragingPeriod();
// To get smooth lines in the chart we need at least 4 values
if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3.");
for (int i = 0; i < noOfDatapoints; i++) { dataList.add(minValue); }
pathElements.clear();
pathElements.add(0, new MoveTo());
for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); }
sparkLine.getElements().setAll(pathElements);
redraw();
}
}
示例15: getRange
import javafx.scene.shape.MoveTo; //导入依赖的package包/类
/** returns selection shape for a given range */
public PathElement[] getRange(int start, int end)
{
if(center instanceof CTextFlow)
{
CTextFlow t = (CTextFlow)center;
return t.getRange(start, end);
}
else
{
double w = center.getWidth();
double h = center.getHeight();
return new PathElement[]
{
new MoveTo(0, 0),
new LineTo(w, 0),
new LineTo(w, h),
new LineTo(0, h),
new LineTo(0, 0)
};
}
}