Search in sources :

Example 11 with Path2D

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

the class HorizontalSquareEdgeShape method makeMulti.

private void makeMulti(DefaultCamera2D camera, double sox, double soy, double swx, double swy) {
    double fromx = skel.apply(0).x + sox;
    double fromy = skel.apply(0).y + soy;
    double tox = skel.apply(3).x + sox;
    double toy = skel.apply(3).y + soy;
    double c1x = skel.apply(1).x + sox;
    double c1y = skel.apply(1).y + soy;
    double c2x = skel.apply(2).x + sox;
    double c2y = skel.apply(2).y + soy;
    theShape = new Path2D(5, true);
    theShape.moveTo(fromx, fromy);
    theShape.curveTo(c1x, c1y, c2x, c2y, tox, toy);
}
Also used : Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 12 with Path2D

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

the class HorizontalSquareEdgeShape method makeSingle.

private void makeSingle(DefaultCamera2D camera, double sox, double soy, double swx, double swy) {
    Point3 from = new Point3(skel.from().x + sox, skel.from().y + soy, 0);
    Point3 to = new Point3(skel.to().x + sox, skel.to().y + soy, 0);
    double size = (theSourceSize.x + theTargetSize.x);
    Point3 inter1 = null;
    Point3 inter2 = null;
    Point3 inter3 = null;
    Point3 inter4 = null;
    if (to.x > from.x) {
        double len = to.x - from.x;
        if (len < size) {
            inter1 = new Point3(from.x + theSourceSize.x, from.y, 0);
            inter2 = new Point3(to.x - theTargetSize.x, to.y, 0);
            inter3 = new Point3(inter1.x, inter1.y + (to.y - from.y) / 2, 0);
            inter4 = new Point3(inter2.x, inter3.y, 0);
            if (sox == 0 && soy == 0) {
                Point3[] pts = { from, inter1, inter3, inter4, inter2, to };
                skel.setPoly(pts);
            }
        } else {
            double middle = (to.x - from.x) / 2;
            inter1 = new Point3(from.x + middle, from.y, 0);
            inter2 = new Point3(to.x - middle, to.y, 0);
            if (sox == 0 && soy == 0) {
                Point3[] pts = { from, inter1, inter2, to };
                skel.setPoly(pts);
            }
        }
    } else {
        double len = from.x - to.x;
        if (len < size) {
            inter1 = new Point3(from.x - theSourceSize.x, from.y, 0);
            inter2 = new Point3(to.x + theTargetSize.x, to.y, 0);
            inter3 = new Point3(inter1.x, inter1.y + (to.y - from.y) / 2, 0);
            inter4 = new Point3(inter2.x, inter3.y, 0);
            if (sox == 0 && soy == 0) {
                Point3[] pts = { from, inter1, inter3, inter4, inter2, to };
                skel.setPoly(pts);
            }
        } else {
            double middle = (to.x - from.x) / 2;
            inter1 = new Point3(from.x + middle, from.y, 0);
            inter2 = new Point3(to.x - middle, to.y, 0);
            if (sox == 0 && soy == 0) {
                Point3[] pts = { from, inter1, inter2, to };
                skel.setPoly(pts);
            }
        }
    }
    theShape = new Path2D(10, true);
    theShape.moveTo(from.x, from.y);
    theShape.lineTo(inter1.x, inter1.y);
    if ((inter3 != null) && (inter4 != null)) {
        theShape.lineTo(inter3.x, inter3.y);
        theShape.lineTo(inter4.x, inter4.y);
    }
    theShape.lineTo(inter2.x, inter2.y);
    theShape.lineTo(to.x, to.y);
}
Also used : Point3(org.graphstream.ui.geom.Point3) Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 13 with Path2D

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

the class DiamondShape method makeShadow.

@Override
public void makeShadow(Backend backend, DefaultCamera2D camera) {
    double x = area.theCenter.x + shadowable.theShadowOff.x;
    double y = area.theCenter.y + shadowable.theShadowOff.y;
    double w2 = (area.theSize.x + shadowable.theShadowWidth.x) / 2;
    double h2 = (area.theSize.y + shadowable.theShadowWidth.y) / 2;
    theShape = new Path2D(10, true);
    theShape().moveTo(x - w2, y);
    theShape().lineTo(x, y - h2);
    theShape().lineTo(x + w2, y);
    theShape().lineTo(x, y + h2);
    theShape.closePath();
}
Also used : Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 14 with Path2D

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

the class SpriteArrowShape method makeShadow.

@Override
public void makeShadow(Backend backend, DefaultCamera2D camera) {
    double x = area.theCenter.x + shadowable.theShadowOff.x;
    double y = area.theCenter.y + shadowable.theShadowOff.y;
    Vector2 dir = new Vector2(orientable.target.x - x, orientable.target.y - y);
    dir.normalize();
    Vector2 per = new Vector2(dir.y(), -dir.x());
    dir.scalarMult(area.theSize.x + shadowable.theShadowWidth.x);
    per.scalarMult((area.theSize.y + shadowable.theShadowWidth.y) / 2);
    theShape = new Path2D(5, true);
    theShape().moveTo(x + per.x(), y + per.y());
    theShape().lineTo(x + dir.x(), y + dir.y());
    theShape().lineTo(x - per.x(), y - per.y());
    theShape.closePath();
}
Also used : Vector2(org.graphstream.ui.geom.Vector2) Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 15 with Path2D

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

the class CrossShape method makeShadow.

@Override
public void makeShadow(Backend backend, DefaultCamera2D camera) {
    double x = area.theCenter.x + shadowable.theShadowOff.x;
    double y = area.theCenter.y + shadowable.theShadowOff.y;
    double h2 = (area.theSize.x + shadowable.theShadowWidth.x) / 2;
    double w2 = (area.theSize.y + shadowable.theShadowWidth.y) / 2;
    double w1 = (area.theSize.x + shadowable.theShadowWidth.x) * 0.2f;
    double h1 = (area.theSize.y + shadowable.theShadowWidth.y) * 0.2f;
    double w4 = (area.theSize.x + shadowable.theShadowWidth.x) * 0.3f;
    double h4 = (area.theSize.y + shadowable.theShadowWidth.y) * 0.3f;
    theShape = new Path2D(20, true);
    theShape().moveTo(x - w2, y + h4);
    theShape().lineTo(x - w4, y + h2);
    theShape().lineTo(x, y + h1);
    theShape().lineTo(x + w4, y + h2);
    theShape().lineTo(x + w2, y + h4);
    theShape().lineTo(x + w1, y);
    theShape().lineTo(x + w2, y - h4);
    theShape().lineTo(x + w4, y - h2);
    theShape().lineTo(x, y - h1);
    theShape().lineTo(x - w4, y - h2);
    theShape().lineTo(x - w2, y - h4);
    theShape().lineTo(x - w1, y);
    theShape().closePath();
}
Also used : Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Aggregations

Path2D (org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)35 Vector2 (org.graphstream.ui.geom.Vector2)15 Point3 (org.graphstream.ui.geom.Point3)4 Point2 (org.graphstream.ui.geom.Point2)2 Style (org.graphstream.ui.graphicGraph.stylesheet.Style)2 ConnectorSkeleton (org.graphstream.ui.javafx.renderer.ConnectorSkeleton)1 Triplet (org.graphstream.ui.javafx.renderer.Skeleton.Triplet)1