Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Dimension


     *
     * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
     */
    @Override
    public Dimension getPreferredSize(int wHint, int hHint) {
        return new Dimension();
    }
View Full Code Here


        }
    }

    public void setSpacing(Dimension spacing) {
        if (spacing == null)
            spacing = new Dimension(GRID_SIZE, GRID_SIZE);
        if (!spacing.equals(gridX, gridY)) {
            gridX = spacing.width != 0 ? spacing.width : gridX;
            gridY = spacing.height != 0 ? spacing.height : gridY;
            repaint();
        }
View Full Code Here

        this.dimension = dimension;
    }

    public Dimension getDimension() {
        if (dimension == null) {
            dimension = new Dimension(0, 0);
        }
        return dimension;
    }
View Full Code Here

              shift += 10;
            }
            PointList pointList = ((TransitionFigure) figure).getPoints();
            Point point0 = pointList.getPoint(0);
            Point point1 = pointList.getPoint(1);
            Dimension diff = point1.getDifference(point0);
            Point dist = new Point(diff.width, diff.height);
            double distance = new Point(0, 0).getDistance(dist);
            double scaleFactor = shift / distance;
            Point translation = dist.getScaled(scaleFactor);
            Point location = point0.getTranslated(translation);
View Full Code Here

    public static boolean areActionsFitInLine(TransitionFigure connection, int actionsSize) {
        PointList pointList = connection.getPoints();
        Point point0 = pointList.getPoint(0);
        Point point1 = pointList.getPoint(1);
        int shift = actionsSize*(ACTION_SIZE+ACTION_DELIM);
        Dimension diff = point1.getDifference(point0);
        Point dist = new Point(diff.width, diff.height);
        double distance = new Point(0, 0).getDistance(dist);
        if (connection.hasSourceDecoration()) {
          shift += 10;
        }
View Full Code Here

            targetElementConstraint = parentElement.getConstraint();
            parentElement = parentElement.getParent();
        }
        if (targetElementConstraint != null) {
            Viewport viewport = (Viewport) ((FreeformGraphicalRootEditPart) getGraphicalViewer().getRootEditPart()).getFigure();
            Dimension dim = viewport.getSize();
            Point startLocation = viewport.getViewLocation().getCopy();
            Point preferredEndLocation = new Point(targetElementConstraint.x - dim.width / 2 + targetElementConstraint.width / 2,
                targetElementConstraint.y - dim.height / 2 + targetElementConstraint.height / 2);
            moveViewport(viewport, startLocation, preferredEndLocation);
        }
View Full Code Here

    private void moveViewportTo(Viewport viewport, Point p, int debug) {
        viewport.setViewLocation(p);
    }

    private void moveViewport(final Viewport viewport, Point start, Point end) {
        Dimension viewportSize = viewport.getSize();
        int len = (int) Math.sqrt((start.x - end.x) * (start.x - end.x) + (start.y - end.y) * (start.y - end.y));
        if ((viewportSize.height + viewportSize.width) / 4 > len) {
            // simple moving
            viewport.setViewLocation(end);
        } else {
View Full Code Here

        LayerManager lm = (LayerManager) getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);

        try {
            Rectangle r = figure.getBounds();
            editor.getDefinition().setDimension(new Dimension(r.width, r.height));
            image = new Image(Display.getDefault(), r.width, r.height);
            gc = new GC(image);
            g = new SWTGraphics(gc);
            g.translate(r.x * -1, r.y * -1);
            figure.paint(g);
View Full Code Here

  @Override
  public Dimension getSize() {
    int width = 2 * getAttributeInt(SVGConstants.SVG_RX_ATTRIBUTE);
    int height = 2 * getAttributeInt(SVGConstants.SVG_RY_ATTRIBUTE);
    return new Dimension(width, height);
  }
View Full Code Here

  public abstract List<IRecord> createLayoutRecords(Rectangle layout,
      boolean onlyCreateNewRecords);

  public Rectangle getLayout() {
    Point loc = getLocation();
    Dimension dim = getSize();
    if (loc == null | dim == null)
      return null;
    else
      return new Rectangle(loc, dim);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.geometry.Dimension

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.