Package research

Examples of research.Figure


        Iterator iterator = selection.iterator();

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

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


        Iterator iterator = selection.iterator();

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

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

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

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

        if (figureCount < 3) 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 = new Rectangle(figure.center().x, figure.center().y, 0, 0);
                } else {
                    rect.add(figure.center());
                }
            }
        }

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

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

        Iterator iterator = selection.iterator();

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

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

        Iterator iterator = selection.iterator();

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

        drawingEditor.getCurrentView().repairDamage();
    }
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

              for (int i = 0; i < selection.size(); i++) {
                  String fID = (String) selection.get(i);
                  if (cv.isFeatureCustomizable(fID)) {
                Set set = (Set)idToFigureMap.get(fID);
                for (Iterator itFigure = set.iterator() ; itFigure.hasNext() ; ) {
                    Figure figure = (Figure)itFigure.next();
                    cv.setCustomization(fID, state);
                    figure.setAttribute(ConstantDefinition.CURRENT_CUSTOMIZATION_CUSTOMIZABLE , new Boolean(cv.isFeatureCustomizable(fID)));
              figure.setAttribute(ConstantDefinition.CURRENT_CUSTOMIZATION, state);
                   }
                  }
              }
             
              editorArea.getCurrentView().drawingRequestUpdate(null);
View Full Code Here

                     
                      AutoLayout_Feature layout = new AutoLayout_Feature();
                      for (Iterator<String> itFeature=figureMap.keySet().iterator() ; itFeature.hasNext() ; ) {
                        String featureID = itFeature.next();
                        Feature desFeature = featureModel.getFeature(featureID);
                        Figure desFigure = figureMap.get(featureID);
                       
                        layout.addFeature(desFeature, desFigure.size().width, desFigure.size().height);
                      }
                      layout.caculateLayout();
                     
                      Figure rootFigure = figureMap.get(feature.getID());
                      int off_x = rootFigure.getDisplayBox().x - layout.getFeatureLayout(feature).x;
                      int root_off_x;
                      if (off_x<0) {
                        root_off_x = -1 * off_x;
                        off_x = 0;
                      } else {
                        root_off_x = 0;
                      }
                      int off_y = rootFigure.getDisplayBox().y;
                     
                      for (Iterator<String> itFeature=figureMap.keySet().iterator() ; itFeature.hasNext() ; ) {
                        String featureID = itFeature.next();
                        if (featureID.equals(feature.getID())) {
                          rootFigure.moveBy(root_off_x, 0);
                        } else {
                          Feature desFeature = featureModel.getFeature(featureID);
                          Figure desFigure = figureMap.get(featureID);
                         
                          FeatureLayout flo = layout.getFeatureLayout(desFeature);
                          desFigure.moveBy(flo.x + off_x, flo.y + off_y);
                        }
                      }
                    }
                }
        }
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.