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);
                }
            }

            editorArea.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));
                }
            }

            editorArea.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.y < fig.center().y) {
                                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().height / 2;
                } else {
                    filled += fig.getDisplayBox().height;
                }

            }

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

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

            editorArea.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;
            }

            editorArea.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

        Vector selection = currentView.getSelection();
        if ((selection == null) || (selection.size() <= 0)) return null;

        ArrayList selectionList = new ArrayList(selection.size());
        for (int i = 0; i < selection.size(); i++) {
            Figure fig = (Figure) selection.get(i);
            selectionList.add(fig.getAttribute("id"));
        }

        return selectionList;
    }
View Full Code Here

                DrawingView view = (DrawingView) e.getNewValue();
                //����id��figure��ӳ���
                if (idToFigureMap != null) {
                    FigureEnumeration fe = view.getDrawing().getFigures();
                    while (fe.hasMoreElements()) {
                        Figure figure = fe.nextFigure();

                        idToFigureMap.add(figure.getAttribute("id"), figure);
                    }
                }
            } else if (DrawingEditor.VIEW_REMOVED.equals(propertyName)) {
                DrawingView view = (DrawingView) e.getOldValue();
                //����id��figure��ӳ���
                if (idToFigureMap != null) {
                    FigureEnumeration fe = view.getDrawing().getFigures();
                    while (fe.hasMoreElements()) {
                        Figure figure = fe.nextFigure();

                        idToFigureMap.remove(figure.getAttribute("id"), figure);
                    }
                }
            }
        }
View Full Code Here

        g.setColor(oldColor);
  }

  public Point findStart(ConnectionFigure connection) {
    Figure startFigure = connection.getStartConnector().owner();
    Rectangle r2 = connection.getEndConnector().getDisplayBox();
    Point r2c = null;

    if (connection.pointCount() == 2) {
      r2c = new Point(r2.x + r2.width/2, r2.y + r2.height/2);
View Full Code Here

    return chop(startFigure, r2c);
  }

  public Point findEnd(ConnectionFigure connection) {
    Figure endFigure = connection.getEndConnector().owner();
    Rectangle r1 = connection.getStartConnector().getDisplayBox();
    Point r1c = null;

    if (connection.pointCount() == 2) {
      r1c = new Point(r1.x + r1.width/2, r1.y + r1.height/2);
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.