Example usage for java.awt.geom Arc2D CHORD

List of usage examples for java.awt.geom Arc2D CHORD

Introduction

In this page you can find the example usage for java.awt.geom Arc2D CHORD.

Prototype

int CHORD

To view the source code for java.awt.geom Arc2D CHORD.

Click Source Link

Document

The closure type for an arc closed by drawing a straight line segment from the start of the arc segment to the end of the arc segment.

Usage

From source file:de.fuberlin.agcsw.heraclitus.graph.GraphAnalyse.java

private static void initJungViewer() {

    //      Create Layout for Visualization
    Graph<JungVertex, JungEdge> g = new DirectedSparseMultigraph<JungVertex, JungEdge>();
    KKLayout<JungVertex, JungEdge> l = new KKLayout<JungVertex, JungEdge>(g);
    l.setMaxIterations(100);/*w w  w.j a  v a  2 s. co  m*/

    vv = new VisualizationViewer<JungVertex, JungEdge>(l);
    vv.addComponentListener(new FrameComponentListener());
    JungClickOnPickMouseListener lis = new JungClickOnPickMouseListener();
    vv.addMouseListener(lis);
    vv.addMouseMotionListener(lis);
    vv.setDoubleBuffered(true);

    //init Mouse Picking
    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    gm.setMode(ModalGraphMouse.Mode.PICKING);
    vv.setGraphMouse(gm);

    Transformer<JungVertex, Paint> vertexPaint = new Transformer<JungVertex, Paint>() {
        public Paint transform(JungVertex v) {

            if (v.getUri() == null) {
                //this is a literal
                return Color.GRAY;
            }
            if (v.getLabel().startsWith("node")) {
                //this is a blank node
                return Color.orange;
            }
            return Color.RED;
        }
    };

    Transformer<JungVertex, Shape> vertexShape = new Transformer<JungVertex, Shape>() {

        @Override
        public Shape transform(JungVertex v) {
            if (v.getLabel().startsWith("node")) {
                //this is a blank node
                Arc2D.Double arc = new Arc2D.Double(-15, -15, 30, 30, 0, 360, Arc2D.CHORD);
                return arc;
            }
            RoundRectangle2D.Double rec = new RoundRectangle2D.Double(-65, -12.5, 130, 25, 30, 30);
            return rec;
        }

    };

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<JungVertex>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<JungEdge>());
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderContext().setVertexShapeTransformer(vertexShape);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

}

From source file:org.eclipse.birt.chart.device.g2d.G2dRendererBase.java

/**
 * /*from   w w w .j a  v a2s .  c  o m*/
 * @param iArcStyle
 * @return
 */
protected static final int toG2dArcType(int iArcStyle) {
    switch (iArcStyle) {
    case ArcRenderEvent.OPEN:
        return Arc2D.OPEN;
    case ArcRenderEvent.CLOSED:
        return Arc2D.CHORD;
    case ArcRenderEvent.SECTOR:
        return Arc2D.PIE;
    }
    return -1;
}