Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.PointList


    protected void paintFigure(Graphics g) {
    super.paintFigure(g);

    Rectangle r = getClientArea();

    PointList points = new PointList();
    points.addPoint(r.x+20, r.y) ;
    points.addPoint(r.x+ r.width-1, r.y) ;
    points.addPoint(r.x+ r.width - 20, r.y + r.height-1) ;
    points.addPoint(r.x, r.y + r.height-1) ;

    drawAndFillFigureBorder(g, points);
    }
View Full Code Here


  protected void paintFigure(Graphics g) {
  super.paintFigure(g);

  Rectangle r = getClientArea();

  PointList points = new PointList();
    points.addPoint(r.x+10, r.y+10) ;
    points.addPoint(r.x+21, r.y) ;

    points.addPoint(r.x+ r.width-11, r.y) ;
    points.addPoint(r.x+ r.width-1, r.y+11) ;

    points.addPoint(r.x+ r.width-1, r.y+ r.height - 11) ;

    points.addPoint(r.x+ r.width-11, r.y+ r.height-1) ;
    points.addPoint(r.x+21, r.y+ r.height-1) ;
    points.addPoint(r.x+10, r.y+ r.height-11) ;

    drawAndFillFigureBorder(g, points);
  }
View Full Code Here

    }

    // The line run
    float run = (reference.x - center.x);

    PointList pointList = owner.getPoints();
    for (int i = 0; i < pointList.size() - 1; i++) {
      Point start = pointList.getPoint(i);
      Point end = pointList.getPoint(i + 1);

      // Translate from relative to absolute coordinates
      owner.translateToAbsolute(start);
      owner.translateToAbsolute(end);
View Full Code Here

    @Override
    protected void paintUMLFigure(Graphics g, Rectangle r) {
        g.translate(getLocation());
        int halfWidth = Math.round(getSize().width / 2);
        int halfHeight = Math.round(getSize().height / 2);
        PointList points = new PointList(4);
        points.addPoint(halfWidth, 0);
        points.addPoint(getSize().width - 1, halfHeight);
        points.addPoint(halfWidth, getSize().height - 1);
        points.addPoint(0, halfHeight);
        g.drawPolygon(points);
    }
View Full Code Here

class ReferencedBendpointConnectionRouter extends BendpointConnectionRouter {
    private static final PrecisionPoint A_POINT = new PrecisionPoint();

    @Override
    public void route(Connection conn) {
        PointList points = conn.getPoints();
        points.removeAllPoints();

        List<Bendpoint> bendpoints = (List<Bendpoint>) getConstraint(conn);
        if (bendpoints == null)
            bendpoints = new ArrayList<Bendpoint>();

        Point ref1, ref2;

        if (bendpoints.isEmpty()) {
            if (conn.getTargetAnchor() instanceof ReferencedConnectionAnchor) {
                Point reference = conn.getSourceAnchor().getReferencePoint();
                ref1 = ((ReferencedConnectionAnchor) conn.getTargetAnchor()).getReferencePoint(reference);
            } else {
                ref1 = conn.getTargetAnchor().getReferencePoint();
            }

            if (conn.getSourceAnchor() instanceof ReferencedConnectionAnchor) {
              Point reference = ref1.getCopy();
                ref2 = ((ReferencedConnectionAnchor) conn.getSourceAnchor()).getReferencePoint(reference);
            } else {
                ref2 = conn.getSourceAnchor().getReferencePoint();
            }
        } else {
            ref1 = new Point(bendpoints.get(0).getLocation());
            conn.translateToAbsolute(ref1);
            ref2 = new Point(bendpoints.get(bendpoints.size() - 1).getLocation());
            conn.translateToAbsolute(ref2);
        }

        A_POINT.setLocation(conn.getSourceAnchor().getLocation(ref1));
        conn.translateToRelative(A_POINT);
        points.addPoint(A_POINT);

        for (int i = 0; i < bendpoints.size(); i++) {
            Bendpoint bp = bendpoints.get(i);
            points.addPoint(bp.getLocation());
        }

        A_POINT.setLocation(conn.getTargetAnchor().getLocation(ref2));
        conn.translateToRelative(A_POINT);
        points.addPoint(A_POINT);
        conn.setPoints(points);
    }
View Full Code Here

        if (figure instanceof TransitionFigure) {
            int shift = actionIndex*(ACTION_SIZE+ACTION_DELIM) + addPixels;
            if (((TransitionFigure) figure).hasSourceDecoration()) {
              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);
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()) {
View Full Code Here

  protected void generatePointList() {
    if (points != null)
      if (rawPoints == getAttributeValue(SVGConstants.SVG_POINTS_ATTRIBUTE))
        return;

    points = new PointList();
    rawPoints = getAttributeValue(SVGConstants.SVG_POINTS_ATTRIBUTE);
    if (rawPoints == null)
      return;

    String[] rawList = rawPoints.split(" ");
View Full Code Here

  protected static PointList performScale(PointList points, double sx,
      double sy) {
    Point anchor = points.getBounds().getLocation();
    int[] rawPoints = points.toIntArray();
    PointList ps = new PointList(points.size());
    int x, y;

    for (int i = 0; i < rawPoints.length; i += 2) {
      x = scaleMaintainPosition(anchor.x, rawPoints[i], sx);
      y = scaleMaintainPosition(anchor.y, rawPoints[i + 1], sy);
      ps.addPoint(x, y);
    }
    return ps;
  }
View Full Code Here

   * @param bounds
   * @return
   */
  protected PointList getDefaultPoints(Rectangle bounds) {
    // let's add a vertical line if no points provided (i.e. drag and drop)
    PointList points = new PointList();
    points.addPoint(bounds.x, bounds.y);
    points.addPoint(bounds.x, bounds.y + bounds.height);
    return points;
  }
View Full Code Here

TOP

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

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.