javafx.scene.shape.VLineTo Java Examples

The following examples show how to use javafx.scene.shape.VLineTo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShapeConverter.java    From Enzo with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: PathSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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
}
 
Example #3
Source File: PathSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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
}
 
Example #4
Source File: Bubble.java    From ChatRoom-JavaFX with Apache License 2.0 5 votes vote down vote up
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)
			);
}
 
Example #5
Source File: Bubble.java    From ChatRoom-JavaFX with Apache License 2.0 5 votes vote down vote up
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)
			);
}
 
Example #6
Source File: Bubble.java    From ChatRoom-JavaFX with Apache License 2.0 5 votes vote down vote up
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)
			);
}
 
Example #7
Source File: Bubble.java    From ChatRoom-JavaFX with Apache License 2.0 5 votes vote down vote up
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)
			);
}
 
Example #8
Source File: Bubble.java    From ChatRoom-JavaFX with Apache License 2.0 5 votes vote down vote up
private void drawRectBubbleLeftCenterIndicator() {
	getElements().addAll(new MoveTo(1.0f, 2.5f),
			new LineTo(1.2f, 2.4f),
			new VLineTo(1f),
			new HLineTo(2.9f),
			new VLineTo(4f),
			new HLineTo(1.2f),
			new VLineTo(2.7f),
			new LineTo(1.0f, 2.5f)
			);
}
 
Example #9
Source File: Bubble.java    From JavaFX-Chat with GNU General Public License v3.0 5 votes vote down vote up
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)
			);
}
 
Example #10
Source File: Bubble.java    From JavaFX-Chat with GNU General Public License v3.0 5 votes vote down vote up
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)
			);
}
 
Example #11
Source File: Bubble.java    From JavaFX-Chat with GNU General Public License v3.0 5 votes vote down vote up
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)
			);
}
 
Example #12
Source File: Bubble.java    From JavaFX-Chat with GNU General Public License v3.0 5 votes vote down vote up
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)
			);
}
 
Example #13
Source File: Bubble.java    From JavaFX-Chat with GNU General Public License v3.0 5 votes vote down vote up
private void drawRectBubbleLeftCenterIndicator() {
	getElements().addAll(new MoveTo(1.0f, 2.5f),
			new LineTo(1.2f, 2.4f),
			new VLineTo(1f),
			new HLineTo(2.9f),
			new VLineTo(4f),
			new HLineTo(1.2f),
			new VLineTo(2.7f),
			new LineTo(1.0f, 2.5f)
			);
}
 
Example #14
Source File: ShapeConverter.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public static String convertPath(final Path PATH) {
    final StringBuilder fxPath = new StringBuilder();
    for (PathElement element : PATH.getElements()) {
        if (MoveTo.class.equals(element.getClass())) {
            fxPath.append("M ")
                  .append(((MoveTo) element).getX()).append(" ")
                  .append(((MoveTo) element).getY()).append(" ");
        } else if (LineTo.class.equals(element.getClass())) {
            fxPath.append("L ")
                  .append(((LineTo) element).getX()).append(" ")
                  .append(((LineTo) element).getY()).append(" ");
        } else if (CubicCurveTo.class.equals(element.getClass())) {
            fxPath.append("C ")
                  .append(((CubicCurveTo) element).getControlX1()).append(" ")
                  .append(((CubicCurveTo) element).getControlY1()).append(" ")
                  .append(((CubicCurveTo) element).getControlX2()).append(" ")
                  .append(((CubicCurveTo) element).getControlY2()).append(" ")
                  .append(((CubicCurveTo) element).getX()).append(" ")
                  .append(((CubicCurveTo) element).getY()).append(" ");
        } else if (QuadCurveTo.class.equals(element.getClass())) {
            fxPath.append("Q ")
                  .append(((QuadCurveTo) element).getControlX()).append(" ")
                  .append(((QuadCurveTo) element).getControlY()).append(" ")
                  .append(((QuadCurveTo) element).getX()).append(" ")
                  .append(((QuadCurveTo) element).getY()).append(" ");
        } else if (ArcTo.class.equals(element.getClass())) {
            fxPath.append("A ")
                  .append(((ArcTo) element).getX()).append(" ")
                  .append(((ArcTo) element).getY()).append(" ")
                  .append(((ArcTo) element).getRadiusX()).append(" ")
                  .append(((ArcTo) element).getRadiusY()).append(" ");
        } else if (HLineTo.class.equals(element.getClass())) {
            fxPath.append("H ")
                  .append(((HLineTo) element).getX()).append(" ");
        } else if (VLineTo.class.equals(element.getClass())) {
            fxPath.append("V ")
                  .append(((VLineTo) element).getY()).append(" ");
        } else if (ClosePath.class.equals(element.getClass())) {
            fxPath.append("Z");
        }
    }
    return fxPath.toString();
}
 
Example #15
Source File: ConnectionSegment.java    From graph-editor with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Adds a vertical line to the path, to the given position.
 *
 * @param y the final y position of the line
 */
protected void addVLineTo(final double y) {
    pathElements.add(new VLineTo(GeometryUtils.moveOffPixel(y)));
}