Search in sources :

Example 1 with CubicCurve2D

use of org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.CubicCurve2D in project gs-ui-javafx by graphstream.

the class LineShape method make.

@Override
public void make(Backend backend, DefaultCamera2D camera) {
    Point3 from = skel.from();
    Point3 to = skel.to();
    if (skel.isCurve()) {
        Point3 ctrl1 = skel.apply(1);
        Point3 ctrl2 = skel.apply(2);
        theShapeC = new CubicCurve2D(from.x, from.y, ctrl1.x, ctrl1.y, ctrl2.x, ctrl2.y, to.x, to.y);
        theShape = theShapeC;
    } else {
        theShapeL = new Line2D(from.x, from.y, to.x, to.y);
        theShape = theShapeL;
    }
}
Also used : Point3(org.graphstream.ui.geom.Point3) CubicCurve2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.CubicCurve2D) Line2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Line2D)

Example 2 with CubicCurve2D

use of org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.CubicCurve2D in project gs-ui-javafx by graphstream.

the class LineShape method makeShadow.

@Override
public void makeShadow(Backend backend, DefaultCamera2D camera) {
    double x0 = skel.from().x + shadowableLine.theShadowOff.x;
    double y0 = skel.from().y + shadowableLine.theShadowOff.y;
    double x1 = skel.to().x + shadowableLine.theShadowOff.x;
    double y1 = skel.to().y + shadowableLine.theShadowOff.y;
    if (skel.isCurve()) {
        double ctrlx0 = skel.apply(1).x + shadowableLine.theShadowOff.x;
        double ctrly0 = skel.apply(1).y + shadowableLine.theShadowOff.y;
        double ctrlx1 = skel.apply(2).x + shadowableLine.theShadowOff.x;
        double ctrly1 = skel.apply(2).y + shadowableLine.theShadowOff.y;
        theShapeC = new CubicCurve2D(x0, y0, ctrlx0, ctrly0, ctrlx1, ctrly1, x1, y1);
        theShape = theShapeC;
    } else {
        theShapeL = new Line2D(x0, y0, x1, y1);
        theShape = theShapeL;
    }
}
Also used : CubicCurve2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.CubicCurve2D) Line2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Line2D)

Aggregations

CubicCurve2D (org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.CubicCurve2D)2 Line2D (org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Line2D)2 Point3 (org.graphstream.ui.geom.Point3)1