Package org.gephi.preview.api

Examples of org.gephi.preview.api.Point


    public void renderGraphLabelBorders(Graph graph) {
    }

    public void renderNode(Node node) {
        Point center = node.getPosition();
        Color c = node.getColor();
        Color bc = node.getBorderColor();

        cb.setRGBColorStroke(bc.getRed(), bc.getGreen(), bc.getBlue());
        cb.setLineWidth(node.getBorderWidth());
        cb.setRGBColorFill(c.getRed(), c.getGreen(), c.getBlue());
        cb.circle(center.getX(), -center.getY(), node.getRadius());
        cb.fillStroke();
    }
View Full Code Here


        cb.circle(center.getX(), -center.getY(), node.getRadius());
        cb.fillStroke();
    }

    public void renderNodeLabel(NodeLabel label) {
        Point p = label.getPosition();
        Font font = label.getFont();

        setFillColor(label.getColor());

        try {
            BaseFont bf = genBaseFont(font);
            float ascent = bf.getAscentPoint(label.getValue(), font.getSize());
            float descent = bf.getDescentPoint(label.getValue(), font.getSize());
            float textHeight = (ascent - descent) / 2f;

            cb.beginText();
            cb.setFontAndSize(bf, font.getSize());
            cb.showTextAligned(PdfContentByte.ALIGN_CENTER, label.getValue(), p.getX(), -p.getY() - textHeight, 0);
            cb.endText();
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
View Full Code Here

            renderEdgeMiniLabel(ml);
        }
    }

    public void renderEdgeArrow(EdgeArrow arrow) {
        Point pt1 = arrow.getPt1();
        Point pt2 = arrow.getPt2();
        Point pt3 = arrow.getPt3();

        cb.moveTo(pt1.getX(), -pt1.getY());
        cb.lineTo(pt2.getX(), -pt2.getY());
        cb.lineTo(pt3.getX(), -pt3.getY());
        cb.closePath();

        setFillColor(arrow.getColor());
        cb.fill();
    }
View Full Code Here

        setFillColor(arrow.getColor());
        cb.fill();
    }

    public void renderEdgeLabel(EdgeLabel label) {
        Point p = label.getPosition();
        Font font = label.getFont();

        setFillColor(label.getColor());

        try {
            BaseFont bf = genBaseFont(font);

            cb.beginText();
            cb.setFontAndSize(bf, font.getSize());
            cb.showTextAligned(PdfContentByte.ALIGN_CENTER, label.getValue(), p.getX(), -p.getY(), (float) (Math.toDegrees(-label.getAngle())));
            cb.endText();
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
View Full Code Here

            Exceptions.printStackTrace(ex);
        }
    }

    public void renderEdgeMiniLabel(EdgeMiniLabel miniLabel) {
        Point p = miniLabel.getPosition();
        Font font = miniLabel.getFont();

        setFillColor(miniLabel.getColor());

        try {
            BaseFont bf = genBaseFont(font);

            cb.beginText();
            cb.setFontAndSize(bf, font.getSize());
            cb.showTextAligned(miniLabel.getHAlign().toIText(), miniLabel.getValue(), p.getX(), -p.getY(), (float) (Math.toDegrees(-miniLabel.getAngle())));
            cb.endText();
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
View Full Code Here

     * Draws a cubic bezier curve.
     *
     * @param curve  the curve to draw
     */
    private void cubicBezierCurve(CubicBezierCurve curve) {
        Point pt1 = curve.getPt1();
        Point pt2 = curve.getPt2();
        Point pt3 = curve.getPt3();
        Point pt4 = curve.getPt4();

        cb.moveTo(pt1.getX(), -pt1.getY());
        cb.curveTo(pt2.getX(), -pt2.getY(), pt3.getX(), -pt3.getY(), pt4.getX(), -pt4.getY());
    }
View Full Code Here

        Progress.progress(progress);
    }

    public void renderStraightEdge(Edge edge) {
        Point boundary1 = edge.getNode1().getPosition();
        Point boundary2 = edge.getNode2().getPosition();

        Element edgeElem = createElement("path");
        edgeElem.setAttribute("d", String.format(Locale.ENGLISH, "M %f,%f L %f,%f",
                boundary1.getX(), boundary1.getY(),
                boundary2.getX(), boundary2.getY()));
        edgeElem.setAttribute("stroke", edge.getColor().toHexString());
        edgeElem.setAttribute("stroke-width", Float.toString(edge.getThickness() * edge.getScale() * scaleRatio));
        edgeGroupElem.appendChild(edgeElem);
    }
View Full Code Here

     * Returns the edge's angle.
     *
     * @return the edge's angle
     */
    public Float getAngle() {
        Point p1 = node1.getPosition();
        Point p2 = node2.getPosition();

        return (float) Math.atan2(p2.getY() - p1.getY(), p2.getX() - p1.getX());
    }
View Full Code Here

TOP

Related Classes of org.gephi.preview.api.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.