Examples of Figure


Examples of diva.canvas.Figure

    /** Create a composite figure that does not have a background
     */
    public void createCompositeFigure() {
        CompositeFigure tc = new CompositeFigure();
        Figure bg = new BasicRectangle(100.0, 100.0, 100.0, 100.0, Color.green);
        tc.add(bg);
        layer.add(tc);
        tc.setInteractor(defaultInteractor);
        addPorts(tc);
    }
View Full Code Here

Examples of diva.canvas.Figure

    /** Create a composite figure that uses the background facility.
     * Generally, for figures of this nature, this is a better thing to do.
     */
    public void createBackgroundedCompositeFigure() {
        CompositeFigure tc = new CompositeFigure();
        Figure bg = new BasicRectangle(100.0, 100.0, 100.0, 100.0, Color.blue);
        tc.setBackgroundFigure(bg);
        layer.add(tc);
        tc.setInteractor(defaultInteractor);
        addPorts(tc);
        tc.translate(200.0, 0);
View Full Code Here

Examples of diva.canvas.Figure

    }

    /** Utility function to add the "ports" to the composite figure.
     */
    public void addPorts(CompositeFigure tc) {
        Figure p1 = new BasicEllipse(150.0, 100.0, 20.0, 20.0, Color.red);
        p1.translate(-10, -10);

        Figure p2 = new BasicEllipse(200.0, 150.0, 20.0, 20.0, Color.blue);
        p2.translate(-10, -10);

        Figure p3 = new BasicEllipse(150.0, 200.0, 20.0, 20.0, Color.yellow);
        p3.translate(-10, -10);

        Figure p4 = new BasicEllipse(100.0, 150.0, 20.0, 20.0, Color.magenta);
        p4.translate(-10, -10);

        tc.add(p1);
        tc.add(p2);
        tc.add(p3);
        tc.add(p4);

        p1.setInteractor(defaultInteractor);
        p2.setInteractor(defaultInteractor);
        p3.setInteractor(defaultInteractor);
        p4.setInteractor(defaultInteractor);
    }
View Full Code Here

Examples of diva.canvas.Figure

        // Create an interactor to do the work.
        Interactor dragger = new DragInteractor();

        // Create the figure
        Figure one = new CloudFigure(10.0, 10.0, 80.0, 80.0);
        layer.add(one);
        one.setInteractor(dragger);

        Figure two = new CloudFigure(150, 150, 200, 180);
        layer.add(two);
        two.setInteractor(dragger);
    }
View Full Code Here

Examples of diva.canvas.Figure

        super.setChild(f);
        clearGrabHandles();
        _geometry = null;

        // Process new child
        Figure child = getChild();

        if (child != null) {
            // Check that we can mess with this figure
            if (!(child instanceof ShapedFigure)) {
                throw new IllegalArgumentException(
View Full Code Here

Examples of diva.canvas.Figure

     * within the region.
     */
    public void setup(LayerEvent e) {
        // Get the size of the figure and calculate bounds
        // FIXME: how to parameterize for figure sets?
        Figure f = e.getFigureSource();
        double ex = e.getLayerX();
        double ey = e.getLayerY();
        Rectangle2D b = f.getBounds();

        double x = (_bounds.getX() + ex) - b.getX();
        double y = (_bounds.getY() + ey) - b.getY();

        double w = (_bounds.getX() + _bounds.getWidth() + ex)
View Full Code Here

Examples of diva.canvas.Figure

    public static class CompositeFigureFactory1 implements
            FigureTest.FigureFactory {
        // FindBugs suggests making this class static so as to decrease
        // the size of instances and avoid dangling references.
        public Figure createFigure() {
            Figure bg = new BasicRectangle(10, 10, 20, 20, Color.blue);
            Figure cf = new CompositeFigure(bg);
            return cf;
        }
View Full Code Here

Examples of diva.canvas.Figure

    public static class PaneWrapperFactory implements FigureTest.FigureFactory {
        // FindBugs suggests making this class static so as to decrease
        // the size of instances and avoid dangling references.

        public Figure createFigure() {
            Figure bg = new BasicRectangle(10, 10, 20, 20, Color.blue);
            CanvasPane pane = new GraphicsPane();
            pane.setSize(300.0, 300.0);

            PaneWrapper wrapper = new PaneWrapper(pane);
            wrapper.setBackground(bg);
View Full Code Here

Examples of diva.canvas.Figure

     * other useful predefined figure classes, is contained in the
     * package <b>diva.canvas.toolbox</b>.
     */
    public void createBasicRectangle() {
        FigureLayer layer = graphicsPane.getForegroundLayer();
        Figure rectangle = new BasicRectangle(50, 50, 80, 80, Color.blue);
        layer.add(rectangle);
    }
View Full Code Here

Examples of diva.canvas.Figure

        path.moveTo(120, 240);
        path.lineTo(240, 240);
        path.quadTo(180, 120, 120, 240);
        path.closePath();

        Figure semi = new BasicFigure(path, Color.green);
        layer.add(semi);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.