Package research

Examples of research.Figure


        Iterator iterator = selection.iterator();

        Rectangle r = new Rectangle();
        int limit = rect.y + rect.height / 2;
        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figure.moveBy(0, limit - figure.center().y);
            }
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here


        Iterator iterator = selection.iterator();

        Rectangle r = new Rectangle();
        int limit = rect.y + rect.height;
        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figure.moveBy(0, limit - (figure.getDisplayBox(r).y + r.height));
            }
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here

        int figureCount = 0;

        arrayList.clear();

        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figureCount++;

                Point center = figure.center();
                if (arrayList.isEmpty()) {
                    arrayList.add(figure);
                } else {
                    int i;
                    for (i = 0; i < arrayList.size(); i++) {
                        Figure fig = (Figure) arrayList.get(i);
                        if (center.x < fig.center().x) {
                            arrayList.add(i, figure);
                            break;
                        }
                    }

                    if (i == arrayList.size())
                        arrayList.add(figure);
                }

            }
        }

        int filled = 0;
        for (int i = 0; i < arrayList.size(); i++) {
            Figure fig = (Figure) arrayList.get(i);

            if ((i == 0) || (i == arrayList.size() - 1)) {
                filled += fig.getDisplayBox().width / 2;
            } else {
                filled += fig.getDisplayBox().width;
            }

        }

        double unit = (rect.width * 1.0 - filled) / (figureCount - 1);

        Rectangle r = ((Figure) arrayList.get(0)).getDisplayBox();
        int base = r.x + r.width;
        for (int i = 1; i < arrayList.size() - 1; i++) {
            Figure fig = (Figure) arrayList.get(i);
            fig.moveBy((int) (base + unit * i - fig.getDisplayBox(r).x), 0);
            base += r.width;
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here

        //AlignAction����connectionFigure��Ч�����Ҫ�жϵ�ǰѡ���ͼԪ�з�connectionFigure����Ŀ�Ƿ����2
        Iterator iterator = selection.iterator();
        int figureCount = 0;

        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure))
                figureCount++;
        }

        if (figureCount < 2) return false;
View Full Code Here

        Iterator iterator = selection.iterator();

        rect = null;

        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                if (rect == null) {
                    rect = figure.getDisplayBox();
                } else {
                    rect.add(figure.getDisplayBox());
                }
            }
        }

    }
View Full Code Here

        double scale = drawingView.getScale();
        int realX = (int) (e.getX() / scale + 0.5);
        int realY = (int) (e.getY() / scale + 0.5);

        Figure pressedFigure = drawingView.getDrawing().findFigureInside(realX, realY);

        if (pressedFigure instanceof TextAreaHolder) {
            textHolder = (TextAreaHolder) pressedFigure;
            if (!textHolder.acceptsTyping())
                textHolder = null;
View Full Code Here

            Vector fs = drawingView.getSelection();

            Iterator iterator = fs.iterator();
            while (iterator.hasNext()) {
                Figure f = (Figure) iterator.next();

                if (f instanceof TextHolder) {
                    TextHolder th = (TextHolder) f;

                    if (th.isConnected()) {
                        Figure cf = th.getConnectedFigure();

                        if (fs.contains(cf)) {
                            drawingView.toggleSelection(f);
                        }
                    }
View Full Code Here

        double scale = drawingView.getScale();
        int realX = (int) (e.getX() / scale + 0.5);
        int realY = (int) (e.getY() / scale + 0.5);

        Figure pressedFigure = drawingView.getDrawing().findFigureInside(realX, realY);

        if (pressedFigure instanceof TextHolder) {
            textHolder = (TextHolder) pressedFigure;
            if (!textHolder.acceptsTyping())
                textHolder = null;
View Full Code Here

            int realX = (int) (e.getX() / scale + 0.5);
            int realY = (int) (e.getY() / scale + 0.5);

            FigureEnumeration fe = drawingView.getDrawing().getFiguresReverse();

            Figure figure = null;

            while (fe.hasMoreElements()) {
                figure = fe.nextFigure();
                if (!figure.containsPoint(realX, realY)) {
                    figure = null;
                    continue;
                }

                Boolean selectivity = (Boolean) figure.getAttribute("selectivity");

                if (selectivity.booleanValue() == false) {
                    figure = null;
                    continue;
                }
View Full Code Here

    private void selectGroup(boolean toggle) {
        FigureEnumeration k = drawingView.getDrawing().getFiguresReverse();

        while (k.hasMoreElements()) {
            Figure figure = k.nextFigure();

            Boolean selectivity = (Boolean) figure.getAttribute("selectivity");

            if (selectivity.booleanValue() == false)
                continue;

            Rectangle r2 = figure.getDisplayBox();
            double scale = drawingView.getScale();
            Rectangle realR2 = new Rectangle((int) (r2.x * scale), (int) (r2.y * scale), (int) (r2.width * scale) + 2, (int) (r2.height * scale) + 2);

            if (selectRect.contains(realR2.x, realR2.y) && selectRect.contains(realR2.x + realR2.width, realR2.y + realR2.height)) {
                if (toggle) {
                    drawingView.toggleSelection(figure);
                } else {
                    drawingView.addToSelection(figure);
                }
            }
        }

        Vector fs = drawingView.getSelection();

        Iterator iterator = fs.iterator();
        while (iterator.hasNext()) {
            Figure f = (Figure) iterator.next();

            if (f instanceof TextHolder) {
                TextHolder th = (TextHolder) f;

                if(th.isConnected()){
                   Figure cf = th.getConnectedFigure();

                    if(fs.contains(cf)){
                        drawingView.toggleSelection(f);
                    }
                }
View Full Code Here

TOP

Related Classes of research.Figure

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.