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; }
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()); } }
@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(); } }
/** 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) }; } }
/** returns selection shape for a given range */ public PathElement[] getCaretShape(int index, boolean leading) { if(center instanceof CTextFlow) { CTextFlow t = (CTextFlow)center; return t.getCaretShape(index, leading); } else { double x = leading ? 0 : center.getWidth(); double h = center.getHeight(); return new PathElement[] { new MoveTo(x, 0), new LineTo(x, h) }; } }
private void createNeedle() { double needleWidth = size * 0.04; double needleHeight = size * 0.4675; needle.getElements().clear(); needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight)); needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight, 0.4375 * needleWidth, 0.0, 0.5 * needleWidth, 0.0)); needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0, 0.6875 * needleWidth, 0.005319148936170213 * needleHeight, 0.6875 * needleWidth, 0.015957446808510637 * needleHeight)); needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight, needleWidth, 0.9946808510638298 * needleHeight, needleWidth, 0.9946808510638298 * needleHeight)); needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight)); needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight, 0.3125 * needleWidth, 0.015957446808510637 * needleHeight, 0.3125 * needleWidth, 0.015957446808510637 * needleHeight)); needle.getElements().add(new ClosePath()); needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0, needle.getLayoutBounds().getMaxX(), 0, false, CycleMethod.NO_CYCLE, new Stop(0.0, gauge.getNeedleColor().darker()), new Stop(0.5, gauge.getNeedleColor()), new Stop(1.0, gauge.getNeedleColor().darker()))); }
private void drawAverage() { double scaledWidth = width * 1.106; double centerX = width * 0.5; double centerY = height * 0.77; double minValue = gauge.getMinValue(); // Draw average average.getElements().clear(); double averageAngle = START_ANGLE - (gauge.getAverage() - minValue) * angleStep; double averageSize = Helper.clamp(2.0, 2.5, 0.01 * scaledWidth); double sinValue = Math.sin(Math.toRadians(averageAngle)); double cosValue = Math.cos(Math.toRadians(averageAngle)); average.getElements().add(new MoveTo(centerX + scaledWidth * 0.38 * sinValue, centerY + scaledWidth * 0.38 * cosValue)); sinValue = Math.sin(Math.toRadians(averageAngle - averageSize)); cosValue = Math.cos(Math.toRadians(averageAngle - averageSize)); average.getElements().add(new LineTo(centerX + scaledWidth * 0.35 * sinValue, centerY + scaledWidth * 0.35 * cosValue)); sinValue = Math.sin(Math.toRadians(averageAngle + averageSize)); cosValue = Math.cos(Math.toRadians(averageAngle + averageSize)); average.getElements().add(new LineTo(centerX + scaledWidth * 0.35 * sinValue, centerY + scaledWidth * 0.35 * cosValue)); average.getElements().add(new ClosePath()); average.setFill(gauge.getAverageColor()); average.setStroke(gauge.getTickMarkColor()); }
private void initGraphics() { moveTo = new MoveTo(); upperLeft = new LineTo(); upperRight = new LineTo(); lowerRight = new LineTo(); lowerLeft = new LineTo(); path = new Path(); path.getElements().add(moveTo); path.getElements().add(upperLeft); path.getElements().add(upperRight); path.getElements().add(lowerRight); path.getElements().add(lowerLeft); path.getElements().add(new ClosePath()); path.getStyleClass().add("segment"); pane = new Pane(path); pane.getStyleClass().add("segment"); getChildren().setAll(pane); }
/** * Draws the arrow-head for its current size and position values. */ public void draw() { getElements().clear(); getElements().add(new MoveTo(x, y + length / 2)); getElements().add(new LineTo(x + width / 2, y - length / 2)); if (radius > 0) { final ArcTo arcTo = new ArcTo(); arcTo.setX(x - width / 2); arcTo.setY(y - length / 2); arcTo.setRadiusX(radius); arcTo.setRadiusY(radius); arcTo.setSweepFlag(true); getElements().add(arcTo); } else { getElements().add(new LineTo(x - width / 2, y - length / 2)); } getElements().add(new ClosePath()); }
@Override public void start(Stage stage) throws Exception { Path shape = new Path(new MoveTo(450, 450), new LineTo(-SIZE, -SIZE), new LineTo(0, -2 * SIZE), new LineTo(SIZE, -SIZE), new LineTo(450, 450), new ClosePath()); shape.setFill(Color.BLUE); shape.setStroke(Color.RED); shape.setStrokeWidth(2.0); shape.getStrokeDashArray().addAll(10.0, 5.0); Pane root = new Pane(); root.getChildren().add(shape); stage.setScene(new Scene(root, 900, 900)); stage.show(); }
private static Path processPath(final List<String> PATH_LIST, final PathReader READER) { final Path PATH = new Path(); PATH.setFillRule(FillRule.EVEN_ODD); while (!PATH_LIST.isEmpty()) { if ("M".equals(READER.read())) { PATH.getElements().add(new MoveTo(READER.nextX(), READER.nextY())); } else if ("L".equals(READER.read())) { PATH.getElements().add(new LineTo(READER.nextX(), READER.nextY())); } else if ("C".equals(READER.read())) { PATH.getElements().add(new CubicCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY())); } else if ("Q".equals(READER.read())) { PATH.getElements().add(new QuadCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY())); } else if ("H".equals(READER.read())) { PATH.getElements().add(new HLineTo(READER.nextX())); } else if ("L".equals(READER.read())) { PATH.getElements().add(new VLineTo(READER.nextY())); } else if ("A".equals(READER.read())) { PATH.getElements().add(new ArcTo(READER.nextX(), READER.nextY(), 0, READER.nextX(), READER.nextY(), false, false)); } else if ("Z".equals(READER.read())) { PATH.getElements().add(new ClosePath()); } } return PATH; }
protected Rectangle2D getBounds(int start, int end) { PathElement[] shape = getShape(start, end); double minX = 0, minY = 0, maxX = 0, maxY = 0; for (PathElement pathElement : shape) { if (pathElement instanceof MoveTo) { MoveTo moveTo = (MoveTo) pathElement; minX = maxX = moveTo.getX(); minY = maxY = moveTo.getY(); } else if (pathElement instanceof LineTo) { LineTo lineTo = (LineTo) pathElement; double x = lineTo.getX(); double y = lineTo.getY(); minX = Math.min(minX, x); minY = Math.min(minY, y); maxX = Math.max(maxX, x); maxY = Math.max(maxY, y); } } return new Rectangle2D(minX, minY, maxX - minX, maxY - minY); }
@Override public void Draw(Pane canvas) { double width = canvas.getWidth() * (GetDoubleAttribute("Width") / (double) MaximumX); double height = GetDoubleAttribute("Height") == 0 ? width : canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY); double left = canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX) - width / 2; double top = canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY) - height / 2; Path path = new Path(new PathElement[] { new MoveTo(0, height / 2), new LineTo(width / 2, 0), new LineTo(width, height / 2), new LineTo(width / 2, height), new LineTo(0, height / 2) }); path.setFill(GetColorAttribute("Color")); path.setStrokeWidth(0); path.setLayoutX(left); path.setLayoutY(top); canvas.getChildren().add(path); }
@Override public void Draw(Pane canvas) { double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; Path path = new Path(new PathElement[] { new MoveTo(widthX, 0), new LineTo(0, 0), new LineTo(0, widthY), new LineTo(canvas.getWidth() - widthX, canvas.getHeight()), new LineTo(canvas.getWidth(), canvas.getHeight()), new LineTo(canvas.getWidth(), canvas.getHeight() - widthY), new LineTo(widthX, 0) }); path.setFill(GetColorAttribute("Color")); path.setStrokeWidth(0); canvas.getChildren().add(path); }
@Override protected Shape[] Thumbnail() { return new Shape[] { new Path(new PathElement[] { new MoveTo(0, 5), new LineTo(30, 5), new LineTo(30, 25), new LineTo(0, 25), new LineTo(0, 5), new MoveTo(5, 10), new LineTo(5, 20), new LineTo(25, 20), new LineTo(25, 10), new LineTo(5, 10) }) }; }
@Override public void Draw(Pane canvas) { double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; Path path = new Path(new PathElement[] { new MoveTo(canvas.getWidth() - widthX, 0), new LineTo(canvas.getWidth(), 0), new LineTo(canvas.getWidth(), widthY), new LineTo(widthX, canvas.getHeight()), new LineTo(0, canvas.getHeight()), new LineTo(0, canvas.getHeight() - widthY), new LineTo(canvas.getWidth() - widthX, 0) }); path.setFill(GetColorAttribute("Color")); path.setStrokeWidth(0); canvas.getChildren().add(path); }
@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); }
@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); }
@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); }
/** * 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"); }
private void createMinus() { Path minus = PathBuilder.create() .elements(new MoveTo(0, 0), new LineTo(0, 5), new LineTo(15, 5), new LineTo(15, 0), new LineTo(0, 0)) .stroke(Color.web("#000000")) .fill(Color.web("#FFFFFF")) .strokeWidth(1) .cursor(Cursor.HAND) .build(); Circle c = CircleBuilder.create().radius(13).style("-fx-fill:-fx-base;").build() ; StackPane sp = StackPaneBuilder.create().styleClass("close-btn") .maxHeight(26).maxWidth(26) .prefHeight(26).prefWidth(26) .children(c,minus).build(); root.getChildren().add(sp); }
/** * @param from The index of the first character. * @param to The index of the last character. * @return An array with the PathElement objects which define an * underline from the first to the last character. */ PathElement[] getUnderlineShape(int from, int to) { // get a Path for the text underline PathElement[] shape = textLayout().getRange(from, to, TextLayout.TYPE_UNDERLINE, 0, 0); // The shape is returned as a closed Path (a thin rectangle). // If we use the Path as it is, this causes rendering issues. // Hence we only use the MoveTo and the succeeding LineTo elements for the result // so that simple line segments instead of rectangles are returned. List<PathElement> result = new ArrayList<>(); boolean collect = false; for (PathElement elem : shape) { if (elem instanceof MoveTo) { // There seems to be no API to get the type of the PathElement result.add(elem); collect = true; } else if (elem instanceof LineTo) { if (collect) { result.add(elem); collect = false; } } } return result.toArray(new PathElement[0]); }
Desk(int numOfColumns, int numOfRows) { setStyle("-fx-background-color: #cccccc; " + "-fx-border-color: #464646; " + "-fx-effect: innershadow( two-pass-box , rgba(0,0,0,0.8) , 15, 0.0 , 0 , 4 );"); double DESK_WIDTH = Piece.SIZE * numOfColumns; double DESK_HEIGHT = Piece.SIZE * numOfRows; setPrefSize(DESK_WIDTH,DESK_HEIGHT); setMaxSize(DESK_WIDTH, DESK_HEIGHT); autosize(); // create path for lines Path grid = new Path(); grid.setStroke(Color.rgb(70, 70, 70)); getChildren().add(grid); // create vertical lines for (int col = 0; col < numOfColumns - 1; col++) { grid.getElements().addAll( new MoveTo(Piece.SIZE + Piece.SIZE * col, 5), new LineTo(Piece.SIZE + Piece.SIZE * col, Piece.SIZE * numOfRows - 5) ); } // create horizontal lines for (int row = 0; row < numOfRows - 1; row++) { grid.getElements().addAll( new MoveTo(5, Piece.SIZE + Piece.SIZE * row), new LineTo(Piece.SIZE * numOfColumns - 5, Piece.SIZE + Piece.SIZE * row) ); } }
private Path createSegment(final double START_ANGLE, final double END_ANGLE, final double INNER_RADIUS, final double OUTER_RADIUS, final Color FILL, final Color STROKE, final TreeNode NODE) { double startAngleRad = Math.toRadians(START_ANGLE + 90); double endAngleRad = Math.toRadians(END_ANGLE + 90); boolean largeAngle = Math.abs(END_ANGLE - START_ANGLE) > 180.0; double x1 = centerX + INNER_RADIUS * Math.sin(startAngleRad); double y1 = centerY - INNER_RADIUS * Math.cos(startAngleRad); double x2 = centerX + OUTER_RADIUS * Math.sin(startAngleRad); double y2 = centerY - OUTER_RADIUS * Math.cos(startAngleRad); double x3 = centerX + OUTER_RADIUS * Math.sin(endAngleRad); double y3 = centerY - OUTER_RADIUS * Math.cos(endAngleRad); double x4 = centerX + INNER_RADIUS * Math.sin(endAngleRad); double y4 = centerY - INNER_RADIUS * Math.cos(endAngleRad); MoveTo moveTo1 = new MoveTo(x1, y1); LineTo lineTo2 = new LineTo(x2, y2); ArcTo arcTo3 = new ArcTo(OUTER_RADIUS, OUTER_RADIUS, 0, x3, y3, largeAngle, true); LineTo lineTo4 = new LineTo(x4, y4); ArcTo arcTo1 = new ArcTo(INNER_RADIUS, INNER_RADIUS, 0, x1, y1, largeAngle, false); Path path = new Path(moveTo1, lineTo2, arcTo3, lineTo4, arcTo1); path.setFill(FILL); path.setStroke(STROKE); String tooltipText = new StringBuilder(NODE.getData().getName()).append("\n").append(String.format(Locale.US, formatString, NODE.getData().getValue())).toString(); Tooltip.install(path, new Tooltip(tooltipText)); path.setOnMousePressed(new WeakEventHandler<>(e -> NODE.getTreeRoot().fireTreeNodeEvent(new TreeNodeEvent(NODE, EventType.NODE_SELECTED)))); return path; }
public PathSample() { super(180,90); // Create path shape - square Path path1 = new Path(); path1.getElements().addAll( new MoveTo(25, 25), new HLineTo(65), new VLineTo(65), new LineTo(25, 65), new ClosePath() ); path1.setFill(null); path1.setStroke(Color.RED); path1.setStrokeWidth(2); // Create path shape - curves Path path2 = new Path(); path2.getElements().addAll( new MoveTo(100, 45), new CubicCurveTo(120, 20, 130, 80, 140, 45), new QuadCurveTo(150, 0, 160, 45), new ArcTo(20, 40, 0, 180, 45, true, true) ); path2.setFill(null); path2.setStroke(Color.DODGERBLUE); path2.setStrokeWidth(2); // show the path shapes; getChildren().add(new Group(path1, path2)); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Path 1 Stroke", path1.strokeProperty()), new SimplePropertySheet.PropDesc("Path 2 Stroke", path2.strokeProperty()) ); // END REMOVE ME }
/** * Ends the current path if one is being created * * @param container */ public void endPath (Pane container) { if (!myMakingPath) { return; } myMakingPath = false; container.setOnMouseMoved(null); int last = myPath.getElements().size() - 1; if (myPath.getElements().get(last) instanceof LineTo) { myPath.getElements().remove(last); } }
/** * Overloads previous class to add a coordinate to the current * path * * @param point * @param container */ public void addToPath (Coordinate point, Pane container) { if (!myMakingPath) { return; } container.requestFocus(); myPath.getElements().add(new MoveTo(point.getX(), point.getY())); LineTo line = new LineTo(point.getX(), point.getY()); myPath.getElements().add(line); container.setOnMouseMoved(e -> followMouse(e, line)); }
private Shape getHatching(int length, int offset) { final Path p = new Path(); for (int i = 0; i < (length / 2.5) + 1; i++) { final double x1 = (i - 1) * 2.5 + offset; final double y1 = 8; final double x2 = (i + 1) * 2.5 + offset; final double y2 = 0; final MoveTo move = new MoveTo(x1, y1); final LineTo line = new LineTo(x2, y2); p.getElements().addAll(move, line); p.setStrokeWidth(1); } return p; }
public void initMovingAnimation(Image image,CoordGene<Integer> coordStart, CoordGene<Integer> coordEnd){ CoordGene<Double> start = new CoordGene<>((double) coordStart.getX(), (double) coordStart.getY()); CoordGene<Double> end = new CoordGene<>((double) coordEnd.getX(), (double) coordEnd.getY()); start = traductor.axialToPixel(start); end = traductor.axialToPixel(end); panCanvas.getChildren().add(this.getPolygon()); this.setImagePolygon(image); this.setPath(new Path( new MoveTo(start.getX() + traductor.getMoveOrigin().getX(), start.getY() + traductor.getMoveOrigin().getY()), new LineTo(end.getX() + traductor.getMoveOrigin().getX(), end.getY() + traductor.getMoveOrigin().getY()))); }
public void initPlacingAnimation(Image image,CoordGene<Integer> coordEnd){ CoordGene<Double> start = new CoordGene<>((double) coordEnd.getX(), (double) 0); CoordGene<Double> end = new CoordGene<>((double) coordEnd.getX(), (double) coordEnd.getY()); start = traductor.axialToPixel(start); end = traductor.axialToPixel(end); panCanvas.getChildren().add(this.getPolygon()); this.setImagePolygon(image); this.setPath(new Path( new MoveTo(start.getX() + traductor.getMoveOrigin().getX(), 0), new LineTo(end.getX() + traductor.getMoveOrigin().getX(), end.getY() + traductor.getMoveOrigin().getY()))); }
private void smooth(ObservableList<PathElement> strokeElements, ObservableList<PathElement> fillElements, final double HEIGHT) { if (fillElements.isEmpty()) return; // as we do not have direct access to the data, first recreate the list of all the data points we have final Point2D[] dataPoints = new Point2D[strokeElements.size()]; for (int i = 0; i < strokeElements.size(); i++) { final PathElement element = strokeElements.get(i); if (element instanceof MoveTo) { final MoveTo move = (MoveTo) element; dataPoints[i] = new Point2D(move.getX(), move.getY()); } else if (element instanceof LineTo) { final LineTo line = (LineTo) element; final double x = line.getX(), y = line.getY(); dataPoints[i] = new Point2D(x, y); } } double firstX = dataPoints[0].getX(); double lastX = dataPoints[dataPoints.length - 1].getX(); Point2D[] points = Helper.subdividePoints(dataPoints, getSubDivisions()); fillElements.clear(); fillElements.add(new MoveTo(firstX, HEIGHT)); strokeElements.clear(); strokeElements.add(new MoveTo(points[0].getX(), points[0].getY())); for (Point2D p : points) { if (Double.compare(p.getX(), firstX) >= 0) { fillElements.add(new LineTo(p.getX(), p.getY())); strokeElements.add(new LineTo(p.getX(), p.getY())); } } fillElements.add(new LineTo(lastX, HEIGHT)); fillElements.add(new LineTo(0, HEIGHT)); fillElements.add(new ClosePath()); }
private double[] getXYFromPathElement(final PathElement ELEMENT) { if (ELEMENT instanceof MoveTo) { return new double[]{ ((MoveTo) ELEMENT).getX(), ((MoveTo) ELEMENT).getY() }; } else if (ELEMENT instanceof LineTo) { return new double[] { ((LineTo) ELEMENT).getX(), ((LineTo) ELEMENT).getY() }; } else { return new double[] { -1, -1 }; } }
private void initializeShape() { final MoveTo p0 = new MoveTo(CORNER_SIZE, 0); final LineTo l0 = new LineTo(JORK_WIDTH - CORNER_SIZE, 0); final LineTo l1 = new LineTo(JORK_WIDTH, JORK_HEIGHT); final LineTo l2 = new LineTo(0, JORK_HEIGHT); final LineTo l3 = new LineTo(CORNER_SIZE, 0); controller.shape.getElements().addAll(p0, l0, l1, l2, l3); }
private void drawRectBubbleToplineIndicator() { getElements().addAll(new MoveTo(1.0f, 1.2f), new HLineTo(2.5f), new LineTo(2.7f, 1.0f), new LineTo(2.9f, 1.2f), new HLineTo(4.4f), new VLineTo(4f), new HLineTo(1.0f), new VLineTo(1.2f) ); }
private void drawRectBubbleRightBaselineIndicator() { getElements().addAll(new MoveTo(3.0f, 1.0f), new HLineTo(0f), new VLineTo(4f), new HLineTo(3.0f), new LineTo(2.8f, 3.8f), new VLineTo(1f) ); }
private void drawRectBubbleLeftBaselineIndicator() { getElements().addAll(new MoveTo(1.2f, 1.0f), new HLineTo(3f), new VLineTo(4f), new HLineTo(1.0f), new LineTo(1.2f, 3.8f), new VLineTo(1f) ); }
private void drawRectBubbleRightCenterIndicator() { getElements().addAll(new MoveTo(3.0f, 2.5f), new LineTo(2.8f, 2.4f), new VLineTo(1f), new HLineTo(0f), new VLineTo(4f), new HLineTo(2.8f), new VLineTo(2.7f), new LineTo(3.0f, 2.5f) ); }