Java 类org.eclipse.draw2d.geometry.PointList 实例源码

项目:Open_Source_ECOA_Toolset_AS5    文件:LinkEditPart.java   
@Override
protected IFigure createFigure() {
    Link lnk = (Link) getModel();
    String dis = "";
    if (lnk.getSource() instanceof TriggerInstanceTerminalNode || lnk.getTarget() instanceof TriggerInstanceTerminalNode)
        dis = "Period : " + lnk.getPeriod();
    LabeledConnection conn = new LabeledConnection(dis);
    PolygonDecoration decoration = new PolygonDecoration();
    PointList decorationPointList = new PointList();
    decorationPointList.addPoint(0, 0);
    decorationPointList.addPoint(-2, 2);
    decorationPointList.addPoint(-2, -2);
    decoration.setTemplate(decorationPointList);
    conn.setTargetDecoration(decoration);
    conn.setConnectionRouter(new BendpointConnectionRouter());
    return conn;
}
项目:gw4e.project    文件:EdgeFigure.java   
public PointList getPoints() {
    PointList list = super.getPoints();
    PointList pl = new PointList() {
        public Point getPoint(int index) {
            try {
                return super.getPoint(index);
            } catch (Exception e) {
                 if (index > 0)
                     return super.getPoint(index-1);
                 return super.getPoint(0);
            }
        }
    };
    int max  = list.size();
    for (int i = 0; i < max; i++) {
        Point p = new Point(list.getPoint(i).x,list.getPoint(i).y);
        pl.addPoint(p);
    }
    return pl;
}
项目:ermasterr    文件:IETargetDecoration.java   
public IETargetDecoration() {
    super();

    final PointList pointList = new PointList();

    pointList.addPoint(-13, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, 12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-13, 12);

    setTemplate(pointList);
    setScale(1, 1);
}
项目:ermasterr    文件:IDEF1XZeroOneSourceDecoration.java   
public IDEF1XZeroOneSourceDecoration() {
    super();

    final PointList pointList = new PointList();

    pointList.addPoint(-1, 0);
    pointList.addPoint(-8, -7);
    pointList.addPoint(-15, 0);
    pointList.addPoint(-8, 7);
    pointList.addPoint(-1, 0);

    setTemplate(pointList);
    setScale(1, 1);

    final Label label = new Label();
    label.setText("Z");

    this.add(label);
}
项目:ermasterr    文件:NoteFigure.java   
/**
 * {@inheritDoc}
 */
@Override
protected void fillShape(final Graphics graphics) {
    graphics.setAlpha(200);

    final Rectangle bounds = getBounds();

    final Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH);
    final Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0);

    final PointList pointList = new PointList();
    pointList.addPoint(bounds.getTopLeft());
    pointList.addPoint(bounds.getBottomLeft());
    pointList.addPoint(bounds.getBottomRight());
    pointList.addPoint(topRight1);
    pointList.addPoint(topRight2);
    pointList.addPoint(bounds.getTopLeft());

    graphics.fillPolygon(pointList);
}
项目:ermaster-k    文件:IETargetDecoration.java   
public IETargetDecoration() {
    super();

    PointList pointList = new PointList();

    pointList.addPoint(-13, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, 12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-13, 12);

    this.setTemplate(pointList);
    this.setScale(1, 1);
}
项目:ermaster-k    文件:IDEF1XZeroOneSourceDecoration.java   
public IDEF1XZeroOneSourceDecoration() {
    super();

    PointList pointList = new PointList();

    pointList.addPoint(-1, 0);
    pointList.addPoint(-8, -7);
    pointList.addPoint(-15, 0);
    pointList.addPoint(-8, 7);
    pointList.addPoint(-1, 0);

    this.setTemplate(pointList);
    this.setScale(1, 1);

    Label label = new Label();
    label.setText("Z");

    this.add(label);
}
项目:ermaster-k    文件:NoteFigure.java   
/**
 * {@inheritDoc}
 */
@Override
protected void fillShape(Graphics graphics) {
    graphics.setAlpha(200);

    Rectangle bounds = this.getBounds();

    Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH);
    Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0);

    PointList pointList = new PointList();
    pointList.addPoint(bounds.getTopLeft());
    pointList.addPoint(bounds.getBottomLeft());
    pointList.addPoint(bounds.getBottomRight());
    pointList.addPoint(topRight1);
    pointList.addPoint(topRight2);
    pointList.addPoint(bounds.getTopLeft());

    graphics.fillPolygon(pointList);
}
项目:NEXCORE-UML-Modeler    文件:ConnectionLabelLocator.java   
/**
 * labelRelocate
 * 
 * @param label
 * @param pointList
 *            void
 */
private void labelRelocate(IFigure label, PointList pointList) {
    int pointSize = pointList.size();
    int centerPoint = (pointSize - 1) / 2;
    Point startP = pointList.getPoint(centerPoint);
    Point endP = pointList.getPoint(centerPoint + 1);

    if (Math.abs(endP.x - startP.x) >= Math.abs(endP.y - startP.y)) {
        figureBounds.x = startP.x + (endP.x - startP.x) / 2 - label.getPreferredSize().width / 2;
        figureBounds.y = startP.y + (endP.y - startP.y) / 2 - (label.getPreferredSize().height + 2);
    } else {
        figureBounds.x = startP.x + (endP.x - startP.x) / 2 - label.getPreferredSize().width / 2;
        figureBounds.y = startP.y + (endP.y - startP.y) / 2 - label.getPreferredSize().height;
    }
    figureBounds.width = label.getPreferredSize().width;
    figureBounds.height = label.getPreferredSize().height;
    label.setBounds(figureBounds);
}
项目:NEXCORE-UML-Modeler    文件:MessageLabelLocator.java   
/**
 * labelRelocate
 * 
 * @param label
 * @param pointList
 *            void
 */
private void labelRelocate(IFigure label, PointList pointList) {
    int pointSize = pointList.size();
    int centerPoint = (pointSize - 1) / 2;
    Point startP = pointList.getPoint(centerPoint);
    Point endP = pointList.getPoint(centerPoint + 1);

    if (Math.abs(endP.x - startP.x) >= Math.abs(endP.y - startP.y)) {
        figureBounds.x = startP.x + (endP.x - startP.x) / 2 - label.getPreferredSize().width / 2;
        figureBounds.y = startP.y + (endP.y - startP.y) / 2 - (label.getPreferredSize().height + 2);
    } else {
        figureBounds.x = startP.x + (endP.x - startP.x) / 2 - label.getPreferredSize().width / 2;
        figureBounds.y = startP.y + (endP.y - startP.y) / 2 - label.getPreferredSize().height;
    }
    if (startP.x == endP.x) {
        figureBounds.y -= 8;
    }
    figureBounds.width = label.getPreferredSize().width;
    figureBounds.height = label.getPreferredSize().height;
    label.setBounds(figureBounds);
}
项目:NEXCORE-UML-Modeler    文件:SequenceBendpointEditPolicy.java   
/**
 * setReferencePoints
 *  
 * @param request void
 */
private void setReferencePoints(BendpointRequest request) {
    PointList points = getConnection().getPoints();
    int bpIndex = -1;
    List bendPoints = (List)getConnection().getRoutingConstraint();
    Point bp = ((Bendpoint)bendPoints.get(request.getIndex())).getLocation();

    int smallestDistance = -1;

    for (int i = 0; i < points.size(); i++) {
        if (smallestDistance == -1
                || points.getPoint(i).getDistance2(bp) < smallestDistance) {
            bpIndex = i;
            smallestDistance = points.getPoint(i).getDistance2(bp);
            if (smallestDistance == 0)
                break;
        }
    }

    points.getPoint(ref1, bpIndex - 1);
    getConnection().translateToAbsolute(ref1);
    points.getPoint(ref2, bpIndex + 1);
    getConnection().translateToAbsolute(ref2);
}
项目:triquetrum    文件:ResizablePolygonDrawingStrategy.java   
@Override
public void doFillShape(ResizablePolygonAttribute polygonAttr, Graphics graphics, Rectangle bounds) throws IllegalActionException {
  PointList pList = getPolygonPoints(polygonAttr);

  Dimension dim = bounds.getSize();
  Point tlp = bounds.getTopLeft();
  Dimension rawDim = getRawBounds(pList).getSize();

  // Ptolemy scales x and y potentially differently, depending on the ratios
  // of dim width & height and rawDim width & height respectively.
  double scaleWidth = dim.preciseWidth() / rawDim.preciseWidth();
  double scaleHeight = dim.preciseHeight() / rawDim.preciseHeight();
  Transform transform = new Transform();
  transform.setScale(scaleWidth, scaleHeight);
  pList = getTransformedPolygon(transform, pList);
  pList.translate(tlp);
  graphics.fillPolygon(pList);
}
项目:triquetrum    文件:ResizablePolygonDrawingStrategy.java   
@Override
public void doDrawBorder(ResizablePolygonAttribute polygonAttr, Graphics graphics, Rectangle bounds) throws IllegalActionException {
  PointList pList = getPolygonPoints(polygonAttr);

  Dimension dim = bounds.getSize();
  Point tlp = bounds.getTopLeft();
  Dimension rawDim = getRawBounds(pList).getSize();

  // Ptolemy scales x and y potentially differently, depending on the ratios
  // of dim width & height and rawDim width & height respectively.
  double scaleWidth = dim.preciseWidth() / rawDim.preciseWidth();
  double scaleHeight = dim.preciseHeight() / rawDim.preciseHeight();
  Transform transform = new Transform();
  transform.setScale(scaleWidth, scaleHeight);
  pList = getTransformedPolygon(transform, pList);
  pList.translate(tlp);
  graphics.drawPolygon(pList);
}
项目:statecharts    文件:ChoiceEditPart.java   
@Override
protected NodeFigure createNodeFigure() {
    final NodeFigure figure = new NodeFigure() {
        @Override
        public PointList getPolygonPoints() {
            PointList points = new PointList(5);
            Rectangle handleBounds = getHandleBounds();
            points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y);
            points.addPoint(handleBounds.x + handleBounds.width, handleBounds.y + (handleBounds.height / 2));
            points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y + handleBounds.height);
            points.addPoint(handleBounds.x, handleBounds.y + handleBounds.height / 2);
            points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y);
            return points;
        }
    };
    figure.setLayoutManager(new StackLayout());
    figure.add(createPrimaryShape());
    figure.setBackgroundColor(org.eclipse.draw2d.ColorConstants.white);
    figure.setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
    figure.setMinimumSize(getDefaultSize());
    return figure;
}
项目:statecharts    文件:ChoiceFigure.java   
/**
 * @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics)
 */
@Override
protected void outlineShape(Graphics graphics) {
    graphics.pushState();
    graphics.setForegroundColor(getForegroundColor());
    graphics.setBackgroundColor(getBackgroundColor());
    Rectangle f = Rectangle.SINGLETON;
    Rectangle r = getBounds();
    f.x = r.x + getLineWidth() / 2;
    f.y = r.y + getLineWidth() / 2;
    f.width = r.width - getLineWidth() - 1;
    f.height = r.height - getLineWidth() - 1;

    PointList pl = new PointList();
    pl.addPoint(f.getTop());
    pl.addPoint(f.getRight());
    pl.addPoint(f.getBottom());
    pl.addPoint(f.getLeft());

    graphics.drawPolygon(pl);
    graphics.popState();
}
项目:scouter    文件:Trace.java   
/**
     * Draw polyline with the line style and line width of the trace.
     * 
 * @param graphics
 * @param pl
 */
private void drawPolyline(Graphics graphics, PointList pl) {
    graphics.pushState();
    graphics.setLineWidth(lineWidth);
    switch(traceType) {
    case SOLID_LINE:
    case STEP_HORIZONTALLY:
    case STEP_VERTICALLY:
        graphics.setLineStyle(SWTConstants.LINE_SOLID);
        graphics.drawPolyline(pl);
        break;
    case DASH_LINE:
        graphics.setLineStyle(SWTConstants.LINE_DASH);
        graphics.drawPolyline(pl);
        break;
    default:
        break;
    }
    graphics.popState();
}
项目:erflute    文件:IETargetDecoration.java   
public IETargetDecoration() {
    super();

    final PointList pointList = new PointList();

    pointList.addPoint(-13, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, 12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-13, 12);

    setTemplate(pointList);
    setScale(0.66, 0.66);
}
项目:erflute    文件:IDEF1XZeroOneSourceDecoration.java   
public IDEF1XZeroOneSourceDecoration() {
    super();

    final PointList pointList = new PointList();

    pointList.addPoint(-1, 0);
    pointList.addPoint(-8, -7);
    pointList.addPoint(-15, 0);
    pointList.addPoint(-8, 7);
    pointList.addPoint(-1, 0);

    setTemplate(pointList);
    setScale(1, 1);

    final Label label = new Label();
    label.setText("Z");

    add(label);
}
项目:txtUML    文件:DiagramElementsModifier.java   
/**
 * Sets the points of a connection.
 * 
 * @param connection
 *            - The connection
 * @param bendpoints
 *            - Start, end and bending points
 */
public static void setConnectionPoints(ConnectionNodeEditPart connection, List<Point> bendpoints) {
    TransactionalEditingDomain editingDomain = connection.getEditingDomain();
    SetConnectionBendpointsCommand cmd = new SetConnectionBendpointsCommand(editingDomain);
    cmd.setEdgeAdapter(new EObjectAdapter(connection.getNotationView()));

    Point first = bendpoints.get(0);
    Point last = bendpoints.get(bendpoints.size() - 1);
    Point sourceRef = new Point(first.x(), first.y());
    Point targetRef = new Point(last.x(), last.y());
    PointList pointList = new PointList();

    for (Point bendpoint : bendpoints) {
        pointList.addPoint(new Point(bendpoint.x(), bendpoint.y()));
    }

    cmd.setNewPointList(pointList, sourceRef, targetRef);
    Command proxy = new ICommandProxy(cmd);
    proxy.execute();
}
项目:OpenSPIFe    文件:MarchingAntsSelectionEditPolicy.java   
/**
 * @param marchStep How far the march has gone, aka which animation frame, aka the offset in pixels.
 * @param bounds 
 * @return two point lists, defining the sides of the rectangle of ants
 */
private PointList[] getEdges(int marchStep) {

    PointList topAndRightEdges = new PointList();
    PointList bottomAndLeftEdges = new PointList();

    // Top ants head left to right, right-edge ants head down.  (Clockwise.)
    topAndRightEdges.addPoint(marchStep                , margin);
    topAndRightEdges.addPoint(bounds.width - margin + 1, margin);
    topAndRightEdges.addPoint(bounds.width - margin + 1, bounds.height - margin);
    topAndRightEdges.translate(bounds.x-1, bounds.y-1);

    // Left ants head up, bottom ants head right to left.  (Clockwise.)
    int reverse = (-marchStep)%maxMarchSteps;
    bottomAndLeftEdges.addPoint(margin                  , reverse);
    bottomAndLeftEdges.addPoint(margin                  , bounds.height - margin);
    bottomAndLeftEdges.addPoint(bounds.width - margin + 1, bounds.height - margin);
    bottomAndLeftEdges.translate(bounds.x-1, bounds.y-1);

    return new PointList[]{topAndRightEdges, bottomAndLeftEdges};
}
项目:OpenSPIFe    文件:LineFigure.java   
public void setNormalizedPointList(PrecisionPointList norms) {
    this.norms = norms;
    // dimensions
    Dimension parentSize = getParent().getSize();
    int parentY = (int) (parentSize.height * ChartFigure.DESIGN_BOUNDARY_PERCENTAGE);
    int parentHeight = (int) (parentSize.height - 2*parentSize.height*ChartFigure.DESIGN_BOUNDARY_PERCENTAGE);
    PointList pointList = new PointList();
    int length = norms.size();
    int previous_x = Integer.MIN_VALUE;
    int previous_y = Integer.MIN_VALUE;
    for (int i=0; i<length; i++) {
        PrecisionPoint pt = (PrecisionPoint) norms.getPoint(i);
        int x = Math.max(0, (int)pt.preciseX());
        int y = (int)((parentHeight * (1.0 - pt.preciseY())) + parentY);
        if ((x != previous_x) || (y != previous_y)) {
            pointList.addPoint(x, y);
            previous_x = x;
            previous_y = y;
        }
    }
    setPoints(pointList);
    intArray = pointList.toIntArray();
}
项目:ermaster-nhit    文件:IETargetDecoration.java   
public IETargetDecoration() {
    super();

    PointList pointList = new PointList();

    pointList.addPoint(-13, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, -12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-1, 12);
    pointList.addPoint(-13, 0);
    pointList.addPoint(-13, 12);

    this.setTemplate(pointList);
    this.setScale(1, 1);
}
项目:ermaster-nhit    文件:IDEF1XZeroOneSourceDecoration.java   
public IDEF1XZeroOneSourceDecoration() {
    super();

    PointList pointList = new PointList();

    pointList.addPoint(-1, 0);
    pointList.addPoint(-8, -7);
    pointList.addPoint(-15, 0);
    pointList.addPoint(-8, 7);
    pointList.addPoint(-1, 0);

    this.setTemplate(pointList);
    this.setScale(1, 1);

    Label label = new Label();
    label.setText("Z");

    this.add(label);
}
项目:ermaster-nhit    文件:NoteFigure.java   
/**
 * {@inheritDoc}
 */
@Override
protected void fillShape(Graphics graphics) {
    graphics.setAlpha(200);

    Rectangle bounds = this.getBounds();

    Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH);
    Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0);

    PointList pointList = new PointList();
    pointList.addPoint(bounds.getTopLeft());
    pointList.addPoint(bounds.getBottomLeft());
    pointList.addPoint(bounds.getBottomRight());
    pointList.addPoint(topRight1);
    pointList.addPoint(topRight2);
    pointList.addPoint(bounds.getTopLeft());

    graphics.fillPolygon(pointList);
}
项目:gef-gwt    文件:BendpointEditPolicy.java   
private void setReferencePoints(BendpointRequest request) {
    PointList points = getConnection().getPoints();
    int bpIndex = -1;
    List bendPoints = (List) getConnection().getRoutingConstraint();
    Point bp = ((Bendpoint) bendPoints.get(request.getIndex()))
            .getLocation();

    int smallestDistance = -1;

    for (int i = 0; i < points.size(); i++) {
        if (smallestDistance == -1
                || points.getPoint(i).getDistance2(bp) < smallestDistance) {
            bpIndex = i;
            smallestDistance = points.getPoint(i).getDistance2(bp);
            if (smallestDistance == 0)
                break;
        }
    }

    points.getPoint(ref1, bpIndex - 1);
    getConnection().translateToAbsolute(ref1);
    points.getPoint(ref2, bpIndex + 1);
    getConnection().translateToAbsolute(ref2);
}
项目:gef-gwt    文件:ScalablePolygonShape.java   
public PointList getScaledPoints() {
    if (scaledPoints != null) {
        return scaledPoints;
    }
    Rectangle pointsBounds = getTemplateBounds();
    Rectangle actualBounds = getBounds();
    double xScale = actualBounds.width > lineWidth ? ((double) actualBounds.width - lineWidth)
            / pointsBounds.width
            : 0;
    double yScale = actualBounds.height > lineWidth ? ((double) actualBounds.height - lineWidth)
            / pointsBounds.height
            : 0;
    double halfLineWidth = ((double) lineWidth) / 2;

    int[] pointsArray = points.getCopy().toIntArray();
    for (int i = 0; i < pointsArray.length; i = i + 2) {
        pointsArray[i] = (int) (Math.floor(pointsArray[i] * xScale) + halfLineWidth);
        pointsArray[i + 1] = (int) (Math.floor(pointsArray[i + 1] * yScale) + halfLineWidth);
    }
    return scaledPoints = new PointList(pointsArray);
}
项目:gef-gwt    文件:ShortestPathRouter.java   
/**
 * @since 3.0
 * @param path
 * @param children
 */
private void refreshChildrenEndpoints(Path path, List children) {
    Point previous = path.getStartPoint();
    Point next;
    PointList bendpoints = path.getBendPoints();
    Path child;

    for (int i = 0; i < children.size(); i++) {
        if (i < bendpoints.size())
            next = bendpoints.getPoint(i);
        else
            next = path.getEndPoint();
        child = (Path) children.get(i);
        child.setStartPoint(previous);
        child.setEndPoint(next);
        previous = next;
    }
}
项目:gef-gwt    文件:RouteEdges.java   
/**
 * @see GraphVisitor#visit(DirectedGraph)
 */
public void revisit(DirectedGraph g) {
    for (int i = 0; i < g.edges.size(); i++) {
        Edge edge = (Edge) g.edges.get(i);
        edge.start = new Point(edge.getSourceOffset() + edge.source.x,
                edge.source.y + edge.source.height);
        if (edge.source instanceof SubgraphBoundary) {
            SubgraphBoundary boundary = (SubgraphBoundary) edge.source;
            if (boundary.getParent().head == boundary)
                edge.start.y = boundary.getParent().y
                        + boundary.getParent().insets.top;
        }
        edge.end = new Point(edge.getTargetOffset() + edge.target.x,
                edge.target.y);

        if (edge.vNodes != null)
            routeLongEdge(edge, g);
        else {
            PointList list = new PointList();
            list.addPoint(edge.start);
            list.addPoint(edge.end);
            edge.setPoints(list);
        }
    }
}
项目:billie    文件:Draw2dFactory.java   
protected void outlineShape(Graphics g) {
    PointList pointList = getPoints();

    Point prevCtrl = pointList.getPoint(0);
    Point currCtrl = pointList.getPoint(1);
    Point pt1 = new Point((prevCtrl.x+currCtrl.x)/2, (prevCtrl.y+currCtrl.y)/2);
    g.pushState();
    g.translate(getLocation());
    g.drawLine(prevCtrl, pt1);
    if (pointList.size()>2) for (int i = 2; i < pointList.size(); i++) {
        Point nextCtrl = pointList.getPoint(i);
        Point pt2 = new Point((currCtrl.x+nextCtrl.x)/2, (currCtrl.y+nextCtrl.y)/2);
        drawBezier(g, pt1, currCtrl, pt2, currCtrl, 0.1);
        currCtrl = nextCtrl;
        pt1 = pt2;
    }
    g.drawLine(pt1, currCtrl);
    g.popState();
}
项目:FRaMED    文件:ORMConnectionMultiplePolyline.java   
@Override
protected void outlineShape(Graphics g){
    final PointList points = getPoints();

    Display display = Display.getCurrent();

    g.setAntialias(SWT.ON);
    g.setLineStyle(SWT.LINE_CUSTOM);
    if (hasConstraint){
        g.setLineStyle(SWT.LINE_DASH);
        g.setLineDash(new float[] {5.0f, 5.0f});
        g.setLineWidth(5);
        g.drawPolyline(points);

        g.setLineStyle(SWT.LINE_SOLID);
        g.setForegroundColor(display.getSystemColor(SWT.COLOR_WHITE));
        g.setLineWidth(3);
        g.drawPolyline(points);
    }

    g.setLineStyle(SWT.LINE_SOLID);
    g.setForegroundColor(display.getSystemColor(SWT.COLOR_BLACK));
    g.setLineWidth(1);
    g.drawPolyline(points);
}
项目:FRaMED    文件:ShadowOctagon.java   
private PointList getPoints(Rectangle rec){
  PointList octogon = new PointList(8);

  int hoffset =(rec.width/8);
  int voffset =(rec.height/8);


  octogon.removeAllPoints();
  octogon.addPoint(new Point(rec.x+hoffset,rec.y));
  octogon.addPoint(new Point(rec.x-hoffset+rec.width,rec.y));
  octogon.addPoint(new Point(rec.x+rec.width,rec.y+voffset));
  octogon.addPoint(new Point(rec.x+rec.width,rec.y-voffset+rec.height));  
  octogon.addPoint(new Point(rec.x-hoffset+rec.width,rec.y+rec.height));
  octogon.addPoint(new Point(rec.x+hoffset,rec.y+rec.height));
  octogon.addPoint(new Point(rec.x,rec.y-voffset+rec.height));
  octogon.addPoint(new Point(rec.x,rec.y+voffset));

  return octogon;
}
项目:Archie-Smart-IDE    文件:MappingFigure.java   
public MappingFigure() {
    super();

    // '>' arrow
    PolylineDecoration decoration = new PolylineDecoration();
    decoration.setAntialias(SWT.ON);
    decoration.setLineWidthFloat(1.3f);
    PointList points = new PointList();
    points.addPoint(-2, 2);
    points.addPoint(0, 0);
    points.addPoint(-2, -2);
    decoration.setTemplate(points);

    setTargetDecoration(decoration);
    setLineStyle(SWT.LINE_CUSTOM);
    setAntialias(SWT.ON);
    setLineWidthFloat(1.3f);
    setLineDash(new float[] { 8f, 6f });
}
项目:Archie-Smart-IDE    文件:AggregationFigure.java   
public AggregationFigure() {
    super();

    PolygonDecoration decoration = new PolygonDecoration();
    decoration.setAntialias(SWT.ON);
    decoration.setLineWidthFloat(1.3f);
    PointList points = new PointList();
    points.addPoint(-2, 2);
    points.addPoint(0, 0);
    points.addPoint(-2, -2);
    points.addPoint(-4, 0);
    points.addPoint(-2, 2);
    decoration.setTemplate(points);
    decoration.setBackgroundColor(ColorConstants.white);
    decoration.setFill(true);

    setTargetDecoration(decoration);
    setLineStyle(SWT.LINE_SOLID);
    setAntialias(SWT.ON);
    setLineWidthFloat(1.3f);
}
项目:Archie-Smart-IDE    文件:DependencyFigure.java   
public DependencyFigure() {
    super();

    PolylineDecoration decoration = new PolylineDecoration();
    decoration.setAntialias(SWT.ON);
    decoration.setLineWidthFloat(1.3f);
    PointList points = new PointList();
    points.addPoint(-2, 2);
    points.addPoint(0, 0);
    points.addPoint(-2, -2);
    decoration.setTemplate(points);

    setTargetDecoration(decoration);
    setLineStyle(SWT.LINE_SOLID);
    setAntialias(SWT.ON);
    setLineWidthFloat(1.3f);
}
项目:wt-studio    文件:NoteModelFigure.java   
/**
 * {@inheritDoc}
 */
@Override
protected void fillShape(Graphics graphics) {
    graphics.setAlpha(200);

    Rectangle bounds = this.getBounds();

    Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH);
    Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0);

    PointList pointList = new PointList();
    pointList.addPoint(bounds.getTopLeft());
    pointList.addPoint(bounds.getBottomLeft());
    pointList.addPoint(bounds.getBottomRight());
    pointList.addPoint(topRight1);
    pointList.addPoint(topRight2);
    pointList.addPoint(bounds.getTopLeft());

    graphics.fillPolygon(pointList);
}
项目:seg.jUCMNav    文件:CommentFigure.java   
private PointList buildPointList(Rectangle r, PointList second) {
    int x = r.x + getLineWidth() / 2;
    int y = r.y + getLineWidth() / 2;
    int w = r.width - getLineWidth();
    int h = r.height - getLineWidth();
    int kink = 15;
    if (w < 2 * kink)
        w = 2 * kink;
    if (h < 2 * kink)
        h = 2 * kink;

    PointList points = new PointList();
    points.addPoint(x, y);
    points.addPoint(x + w - kink, y);
    points.addPoint(x + w, y + kink);
    points.addPoint(x + w, y + h);
    points.addPoint(x, y + h);
    points.addPoint(x, y);

    second.addPoint(x + w - kink, y);
    second.addPoint(x + w - kink, y + kink);
    second.addPoint(x + w, y + kink);
    return points;
}
项目:seg.jUCMNav    文件:AndForkJoinFigure.java   
/**
 * Creates a non-rotated vertical line, in middle of bounds, with two branches.
 * 
 * The edges PointList will never be rotated. To obtain rotated points, look athe mainFigure.getPoints()
 * 
 * @see seg.jUCMNav.figures.PathNodeFigure#createFigure()
 */
protected void createFigure() {
    mainFigure = new Polygon();

    edges = new PointList();

    edges.addPoint(DEFAULT_WIDTH / 2, 0);
    edges.addPoint(DEFAULT_WIDTH / 2, DEFAULT_HEIGHT / 2);
    edges.addPoint(DEFAULT_WIDTH / 2, 3 * DEFAULT_HEIGHT / 2);
    edges.addPoint(DEFAULT_WIDTH / 2, 2 * DEFAULT_HEIGHT);

    mainFigure.setLineWidth(6);
    mainFigure.setPoints(edges);
    mainFigure.setAntialias(GeneralPreferencePage.getAntialiasingPref());

    add(mainFigure);
}
项目:seg.jUCMNav    文件:DirectionArrowFigure.java   
/**
 * Create arrow taking half the horizontal and vertical space.
 * 
 * @see seg.jUCMNav.figures.PathNodeFigure#createFigure()
 */
protected void createFigure() {
    edge1 = new Polygon();
    enpoints1 = new PointList();

    edge2 = new Polygon();
    enpoints2 = new PointList();

    enpoints1.addPoint(DEFAULT_WIDTH / 4, DEFAULT_HEIGHT / 4);
    enpoints1.addPoint(DEFAULT_WIDTH / 2, DEFAULT_HEIGHT / 2);

    enpoints2.addPoint(DEFAULT_WIDTH / 4, DEFAULT_HEIGHT - DEFAULT_HEIGHT / 4);
    enpoints2.addPoint(DEFAULT_WIDTH / 2, DEFAULT_HEIGHT / 2);

    edge1.setLineWidth(3);
    edge1.setPoints(enpoints1);
    edge1.setAntialias(GeneralPreferencePage.getAntialiasingPref());

    edge2.setLineWidth(3);
    edge2.setPoints(enpoints2);
    edge2.setAntialias(GeneralPreferencePage.getAntialiasingPref());

    add(edge1);
    add(edge2);
}
项目:seg.jUCMNav    文件:ResponsibilityFigure.java   
/**
 * Simply an X that can be rotated.
 * 
 * @see seg.jUCMNav.figures.PathNodeFigure#createFigure()
 */
protected void createFigure() {
    edge1 = new Polygon();
    enpoints1 = new PointList();

    edge2 = new Polygon();
    enpoints2 = new PointList();

    enpoints1.addPoint(DEFAULT_WIDTH / 4, DEFAULT_HEIGHT / 4);
    enpoints1.addPoint(DEFAULT_WIDTH - DEFAULT_WIDTH / 4, DEFAULT_HEIGHT - DEFAULT_HEIGHT / 4);

    enpoints2.addPoint(DEFAULT_WIDTH / 4, DEFAULT_HEIGHT - DEFAULT_HEIGHT / 4);
    enpoints2.addPoint(DEFAULT_WIDTH - DEFAULT_WIDTH / 4, DEFAULT_HEIGHT / 4);

    edge1.setLineWidth(3);
    edge1.setPoints(enpoints1);
    edge1.setAntialias(GeneralPreferencePage.getAntialiasingPref());

    edge2.setLineWidth(3);
    edge2.setPoints(enpoints2);
    edge2.setAntialias(GeneralPreferencePage.getAntialiasingPref());

    add(edge1);
    add(edge2);
}
项目:seg.jUCMNav    文件:BSpline.java   
/**
 * Return the point list between the index start and end.
 * 
 * @param start
 *            The first index
 * @param end
 *            The last index
 * @return The point list representing the curve between those two index.
 */
public PointList getPointBetween(int start, int end) {
    int X, Y;
    int Xo = (int) Math.round(Px[0]);
    int Yo = (int) Math.round(Py[0]);
    int Xold = Xo;
    int Yold = Yo;

    PointList points = new PointList();

    for (int i = start; i < end; i++) {
        for (int k = 0; k < precision; k++) {
            X = (int) Math.round((Px[i] * B0[k] + (Px[i] + dx[i]) * B1[k] + (Px[i + 1] - dx[i + 1]) * B2[k] + Px[i + 1] * B3[k]));
            Y = (int) Math.round((Py[i] * B0[k] + (Py[i] + dy[i]) * B1[k] + (Py[i + 1] - dy[i + 1]) * B2[k] + Py[i + 1] * B3[k]));

            points.addPoint(X, Y);

            Xold = X;
            Yold = Y;
        }
    }
    return points;
}