Search in sources :

Example 31 with Path2D

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

the class PolylineEdgeShape method make.

@Override
public void make(Backend backend, DefaultCamera2D camera) {
    int n = skel.size();
    theShape = new Path2D(n + 2, false);
    theShape.moveTo(skel.apply(0).x, skel.apply(0).y);
    for (int i = 0; i < n; i++) {
        theShape.lineTo(skel.apply(i).x, skel.apply(i).y);
    }
}
Also used : Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 32 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 make.

@Override
public void make(Backend backend, DefaultCamera2D camera) {
    double x = area.theCenter.x;
    double y = area.theCenter.y;
    double w2 = area.theSize.x / 2;
    double h2 = area.theSize.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 33 with Path2D

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

the class PolygonShape method makeShadow.

@Override
public void makeShadow(Backend backend, DefaultCamera2D camera) {
    double n = theValues.length;
    double x = area.theCenter.x + shadowable.theShadowOff.x;
    double y = area.theCenter.y + shadowable.theShadowOff.y;
    theShape = new Path2D((int) n + 2, true);
    if (n > 0) {
        theShape().moveTo(x + theValues[0].x, y + theValues[0].y);
        for (int i = 0; i < n; i++) {
            theShape().lineTo(x + theValues[i].x, y + theValues[i].y);
        }
    }
    theShape.closePath();
}
Also used : Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 34 with Path2D

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

the class PolygonShape method make.

@Override
public void make(Backend backend, DefaultCamera2D camera) {
    double x = area.theCenter.x;
    double y = area.theCenter.y;
    double n = theValues.length;
    theShape = new Path2D((int) n + 2, true);
    if (n > 0) {
        theShape().moveTo(x + theValues[0].x, y + theValues[0].y);
        for (int i = 0; i < n; i++) {
            theShape().lineTo(x + theValues[i].x, y + theValues[i].y);
        }
    }
    theShape.closePath();
}
Also used : Path2D(org.graphstream.ui.javafx.renderer.shape.javafx.baseShapes.Form.Path2D)

Example 35 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 make.

@Override
public void make(Backend backend, DefaultCamera2D camera) {
    double x = area.theCenter.x;
    double y = area.theCenter.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);
    per.scalarMult(area.theSize.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)

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