Пример #1
0
    @Override
    public void paintFigure(Graphics graphics) {

      int offsetX;
      int offsetY;

      if (ci.getShape() == ComponentShape.CIRCLE) {
        offsetX = OFFSET_SMALL_CIRCLE_COMPONENT_ICON;
        offsetY = OFFSET_SMALL_CIRCLE_COMPONENT_ICON;
        graphics.fillOval(this.getBounds());
        graphics.setAntialias(SWT.ON);
        Rectangle b = this.getBounds().getCopy();
        b.width--;
        b.height--;
        graphics.drawOval(b);

        graphics.setAntialias(SWT.OFF);
      } else {
        offsetX = OFFSET_SMALL_SQUARE_COMPONENT_ICON_X;
        offsetY = OFFSET_SMALL_SQUARE_COMPONENT_ICON_Y;
        graphics.fillRectangle(this.getBounds());
        Rectangle b = this.getBounds().getCopy();
        b.width--;
        b.height--;
        graphics.drawRectangle(b);
      }
      graphics.drawImage(
          icon, new Point(this.getLocation().x + offsetX, this.getLocation().y - 1 + offsetY));
    }
Пример #2
0
  @Override
  public void paintBorder(IFigure figure, Graphics graphics, Insets insets) {
    Rectangle rect = getPaintRectangle(figure, insets);
    int width = figure.getBounds().width;
    int height = figure.getBounds().height;

    int x = rect.x + (int) Math.floor(this.getWidth() / 2.0);
    int y = rect.y + (int) Math.floor(this.getWidth() / 2.0);
    graphics.drawOval(x, y, width - this.getWidth(), height - this.getWidth());
  }
  /**
   * @see
   *     nexcore.tool.uml.ui.core.diagram.figure.AbstractNotationNodeFigure#paintFigure(org.eclipse.draw2d.Graphics)
   */
  @Override
  protected void paintFigure(Graphics graphics) {
    super.paintFigure(graphics);

    graphics.setAntialias(SWT.ON);
    Rectangle bounds = getBounds();
    if (isDangling()) {
      graphics.setForegroundColor(ColorConstants.red);
      graphics.drawOval(bounds.x, bounds.y, 12, 12);
      graphics.drawLine(bounds.x + 2, bounds.y + 2, bounds.x + 10, bounds.y + 10);
      graphics.drawLine(bounds.x + 10, bounds.y + 2, bounds.x + 2, bounds.y + 10);
    }
  }
 @Override
 public void paintFigure(Graphics g) {
   Rectangle r = getBounds();
   r.shrink(1, 1);
   try {
     g.setBackgroundColor(getFillColor());
     g.fillOval(r);
     g.setForegroundColor(getLineColor());
     g.drawOval(r);
   } finally {
     // We don't really own rect 'r', so fix it.
     r.expand(1, 1);
   }
 }
Пример #5
0
  @Override
  protected void outlineShape(Graphics graphics) {
    Rectangle a = start(graphics);
    try {
      graphics.setLineWidth(2);
      graphics.setLineStyle(SWT.LINE_SOLID);

      if (shape instanceof Ellipse) {
        graphics.drawOval(1, 1, a.width - 2, a.height - 2);
      } else if (shape instanceof PointList) {
        graphics.drawPolygon((PointList) shape);
      }
    } finally {
      stop(graphics);
    }
  }
Пример #6
0
  /** @see org.eclipse.draw2d.Figure#paintFigure(Graphics) */
  protected void paintFigure(Graphics g) {
    Rectangle r = getBounds().getCopy();

    IMapMode mm = MapModeUtil.getMapMode(this);
    r.translate(mm.DPtoLP(2), mm.DPtoLP(2));
    r.setSize(mm.DPtoLP(11), mm.DPtoLP(9));

    // Draw the bottom arc of the gate
    r.y += mm.DPtoLP(4);
    r.width = r.width - mm.DPtoLP(1);
    g.fillOval(r);
    r.height--;
    g.drawOval(r);

    // draw gate
    g.translate(getLocation());
    PointList outline = points.getCopy();
    mm.DPtoLP(outline);
    g.fillPolygon(outline);
    g.drawPolyline(outline);
    g.translate(getLocation().getNegated());
  }
  /** @see org.eclipse.draw2d.Figure#paintFigure(Graphics) */
  protected void paintFigure(Graphics g) {
    g.setXORMode(true);
    g.setForegroundColor(ColorConstants.white);

    g.setBackgroundColor(LogicColorConstants.ghostFillColor);

    Rectangle r = getBounds().getCopy();

    g.fillOval(r);
    r.height--;
    r.width--;
    g.drawOval(r);
    g.translate(r.getLocation());

    // Draw the "V"
    g.drawLine(3, 4, 5, 9);
    g.drawLine(5, 9, 7, 4);
    g.drawLine(5, 8, 5, 9);

    // Draw the "+"
    g.drawLine(9, 7, 9, 11);
    g.drawLine(7, 9, 11, 9);
    g.drawPoint(9, 9);
  }
Пример #8
0
  @Override
  protected void drawSymbol(Graphics g) {
    PointList points = null;

    super.drawSymbol(g);

    int centerPointX = (int) Math.ceil((H_EXTENT / 2.0f)); // Center point of odd #.

    switch (this.featureCategory) {
      case BUS_ACCESS:
      case DATA_ACCESS:
        // Configure GC.
        g.setForegroundColor(this.getForegroundColor());
        g.setBackgroundColor(ColorConstants.white);
        g.setLineWidth(2);

        // Create point list that defines the symbol.
        points = new PointList();

        /* Populate point list. */
        points.addPoint(centerPointX, 0);
        points.addPoint(0, V_EXTENT - 8);
        points.addPoint(0, V_EXTENT);
        points.addPoint(centerPointX, V_EXTENT - 2);
        points.addPoint(H_EXTENT, V_EXTENT);
        points.addPoint(H_EXTENT, V_EXTENT - 8);

        // Fill symbol.
        g.fillPolygon(points);
        // Draw symbol.
        g.drawPolygon(points);

        break;
      case SUBPROGRAM_ACCESS:
      case SUBPROGRAM_GROUP_ACCESS:
        // Configure GC
        if (this.featureCategory == FeatureAdapterCategory.SUBPROGRAM_ACCESS) {
          g.setBackgroundColor(ColorConstants.white);
          g.setForegroundColor(ColorConstants.black);
        } else {
          g.setBackgroundColor(ColorConstants.black);
          g.setForegroundColor(ColorConstants.white);
        }

        g.setLineCap(SWT.CAP_ROUND);
        g.setLineWidth(2);

        int ovalWidth = H_EXTENT;
        int ovalHeight = V_EXTENT;
        // Draw oval.
        Rectangle ovalRect =
            new Rectangle(
                (int) (0.5f * (H_EXTENT - ovalWidth)),
                (int) (0.5f * (V_EXTENT - ovalHeight)),
                ovalWidth,
                ovalHeight);
        g.fillOval(ovalRect);

        if (this.featureCategory == FeatureAdapterCategory.SUBPROGRAM_ACCESS) g.drawOval(ovalRect);

        int triangleWidth = 7;
        int triangleHeight = 5;
        int triangleStartX = (int) Math.ceil((0.5f * (H_EXTENT - triangleWidth)));
        int triangleStartY = (int) Math.ceil((0.5f * (V_EXTENT - triangleHeight)));

        // Draw triangle.
        g.drawLine(triangleStartX, triangleStartY, centerPointX, triangleStartY + triangleHeight);
        g.drawLine(
            triangleStartX + triangleWidth,
            triangleStartY,
            centerPointX,
            triangleStartY + triangleHeight);

        break;
    }
  }