예제 #1
0
 public void drawU(UGraphic ug, double x, double y) {
   if (fill) {
     ug.getParam().setBackcolor(ug.getParam().getColor());
   }
   ug.draw(x, y, polygon);
   ug.getParam().setBackcolor(null);
 }
예제 #2
0
  public void drawU(UGraphic ug) {

    ug.getParam().setStroke(new UStroke(thickness));

    final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness;

    final UEllipse head = new UEllipse(headDiam, headDiam);
    final double centerX = startX + headDiam / 2;

    final ULine body = new ULine(0, bodyLenght);
    final ULine arms = new ULine(armsLenght * 2, 0);

    final double y = headDiam + thickness + bodyLenght;

    final ULine legs1 = new ULine(-legsX, legsY);
    final ULine legs2 = new ULine(legsX, legsY);
    if (deltaShadow != 0) {
      head.setDeltaShadow(deltaShadow);
      body.setDeltaShadow(deltaShadow);
      arms.setDeltaShadow(deltaShadow);
      legs1.setDeltaShadow(deltaShadow);
      legs2.setDeltaShadow(deltaShadow);
    }

    ug.getParam().setBackcolor(backgroundColor);
    ug.getParam().setColor(foregroundColor);
    ug.draw(startX, thickness, head);

    ug.draw(centerX, headDiam + thickness, body);
    ug.draw(centerX - armsLenght, headDiam + thickness + armsY, arms);
    ug.draw(centerX, y, legs1);
    ug.draw(centerX, y, legs2);

    ug.getParam().setStroke(new UStroke());
  }
예제 #3
0
파일: Frame.java 프로젝트: rakyll/plantuml
  public void drawU(UGraphic ug, Area area, Context2D context) {
    final Dimension2D dimensionToUse = area.getDimensionToUse();
    final HtmlColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder);
    ug.getParam().setColor(lineColor);
    ug.getParam().setBackcolor(null);
    ug.getParam().setStroke(new UStroke(1.4));
    ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
    ug.getParam().setStroke(new UStroke());

    final TextBlock textBlock = createTextBloc();
    textBlock.drawU(ug, 2, 2);

    final Dimension2D textDim = getTextDim(ug.getStringBounder());
    final double x = textDim.getWidth() + 6;
    final double y = textDim.getHeight() + 6;
    final UPolygon poly = new UPolygon();
    poly.addPoint(x, 0);
    poly.addPoint(x, y - 6);
    poly.addPoint(x - 6, y);
    poly.addPoint(0, y);
    poly.addPoint(0, 0);
    ug.getParam().setColor(lineColor);
    ug.getParam().setStroke(new UStroke(1.4));
    ug.draw(0, 0, poly);
    ug.getParam().setStroke(new UStroke());
  }
 @Override
 protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
   stroke(ug, 2, 2);
   ug.getParam().setColor(groupBorder);
   ug.draw(0, 1, new ULine(dimensionToUse.getWidth(), 0));
   ug.getParam().setStroke(new UStroke());
   getTextBlock().drawU(ug, getMarginX1(), getMarginY());
 }
예제 #5
0
 public void drawU(UGraphic ug, double x, double y, int zIndex, Dimension2D dimToUse) {
   if (background != null) {
     final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), x, y);
     ug.getParam().setBackcolor(background);
     ug.draw(x, y, new URectangle(dim.getWidth(), dim.getHeight()));
     ug.getParam().setBackcolor(null);
   }
   block.drawU(ug, x, y);
 }
예제 #6
0
파일: ElementLine.java 프로젝트: grze/euml
 public void drawU(UGraphic ug, double x, double y, int zIndex, Dimension2D dimToUse) {
   if (zIndex != 0) {
     return;
   }
   final HtmlColor old = ug.getParam().getColor();
   ug.getParam().setColor(HtmlColorUtils.getColorIfValid("#AAAAAA"));
   ug.draw(x, y, new ULine(dimToUse.getWidth(), 0));
   ug.getParam().setColor(old);
 }
예제 #7
0
  public void drawU(UGraphic ug, double x, double y) {

    if (circle != null) {
      ug.getParam().setColor(circle);
    }
    final HtmlColor back = ug.getParam().getBackcolor();
    ug.getParam().setBackcolor(innerCircle);
    ug.draw(x, y, new UEllipse(radius * 2, radius * 2));
    ug.getParam().setColor(fontColor);
    ug.centerChar(x + radius, y + radius, c.charAt(0), font);
    ug.getParam().setBackcolor(back);
  }
예제 #8
0
  public void drawU(
      UGraphic ug,
      double xTheoricalPosition,
      double yTheoricalPosition,
      double marginWidth,
      double marginHeight) {
    final Dimension2D dim = getDimension(ug.getStringBounder());

    final double widthTotal = dim.getWidth() + 2 * marginWidth;
    final double heightTotal = dim.getHeight() + 2 * marginHeight;
    final URectangle rect = new URectangle(widthTotal, heightTotal);

    // if (entity.getParent() == null) {
    if (entity.getType() != EntityType.GROUP) {
      ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.classBackground));
      ug.getParam().setColor(rose.getHtmlColor(param, ColorParam.classBorder));
      ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight, rect);
      // name.drawU(ug, xTheoricalPosition + margin, yTheoricalPosition + margin);
      name.drawU(ug, xTheoricalPosition + 0, yTheoricalPosition + 0);
    } else {
      // final Frame frame = new Frame(StringUtils.getWithNewlines(entity.getDisplay()),
      // Color.BLACK, param
      // .getFont(FontParam.CLASS), rose.getHtmlColor(param, ColorParam.classBorder).getColor());
      final Frame frame = new Frame(entity.getDisplay2(), param);

      ug.getParam().setBackcolor(rose.getHtmlColor(param, ColorParam.background));
      ug.getParam().setColor(null);
      ug.draw(xTheoricalPosition - marginWidth, yTheoricalPosition - marginWidth, rect);

      final double oldX = ug.getTranslateX();
      final double oldY = ug.getTranslateY();
      ug.translate(xTheoricalPosition - marginWidth, yTheoricalPosition - marginHeight);
      frame.drawU(ug, new Area(new Dimension2DDouble(widthTotal, heightTotal)), null);
      // ug.translate(-xTheoricalPosition + marginWidth,
      // -yTheoricalPosition + marginHeight);
      ug.setTranslate(oldX, oldY);

      // playField.drawInternal(UGraphicUtils.translate(ug, xTheoricalPosition + margin,
      // yTheoricalPosition +
      // margin
      // + frame.getPreferredHeight(ug.getStringBounder())));
      playField.drawInternal(
          UGraphicUtils.translate(
              ug,
              xTheoricalPosition + 0,
              yTheoricalPosition + 0 + frame.getPreferredHeight(ug.getStringBounder())));
    }
  }
 public void drawU(UGraphic ug) {
   ug.apply(new UChangeBackColor(ug.getParam().getColor())).draw(polygon);
   ug.apply(new UStroke(1.5))
       .apply(new UChangeBackColor(HtmlColorUtils.WHITE))
       .apply(new UTranslate(dest.getX() - radius, dest.getY() - radius))
       .draw(new UEllipse(radius * 2, radius * 2));
 }
예제 #10
0
  public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
    final UEllipse circle = new UEllipse(SIZE, SIZE);
    if (getSkinParam().shadowing()) {
      circle.setDeltaShadow(3);
    }
    ug.getParam().setStroke(new UStroke());
    ug.getParam().setBackcolor(null);
    ug.getParam().setColor(getColor(ColorParam.activityEnd, getStereo()));
    ug.draw(xTheoricalPosition, yTheoricalPosition, circle);
    ug.getParam().setStroke(new UStroke());

    final double delta = 4;
    final UShape circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2);
    ug.getParam().setColor(null);
    ug.getParam().setBackcolor(getColor(ColorParam.activityEnd, getStereo()));
    ug.draw(xTheoricalPosition + delta + 0.5, yTheoricalPosition + delta + 0.5, circleSmall);
  }
 @Override
 protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
   ug.getParam().setColor(color);
   // stroke(ug, 0.4, 2.5);
   stroke(ug, 1, 4);
   final int x = (int) (dimensionToUse.getWidth() / 2);
   ug.setAntiAliasing(false);
   ug.draw(x, 0, new ULine(0, dimensionToUse.getHeight()));
   ug.setAntiAliasing(true);
   final double dx = 5;
   final double dy = 1.5;
   final double space = 1.5;
   final double middle = dimensionToUse.getHeight() / 2;
   ug.getParam().setStroke(new UStroke(1));
   //		ug.draw(x - dx, middle + dy - space, new ULine(2 * dx, -2 * dy));
   //		ug.draw(x - dx, middle + dy + space, new ULine(2 * dx, -2 * dy));
   ug.getParam().setStroke(new UStroke());
 }
예제 #12
0
  public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
    // final StringBounder stringBounder = ug.getStringBounder();
    // final Dimension2D dimTotal = getDimension(stringBounder);
    //
    // final double widthTotal = dimTotal.getWidth();
    // final double heightTotal = dimTotal.getHeight();

    final UPolygon diams = new UPolygon();
    if (getSkinParam().shadowing()) {
      diams.setDeltaShadow(5);
    }
    diams.addPoint(SIZE, 0);
    diams.addPoint(SIZE * 2, SIZE);
    diams.addPoint(SIZE, SIZE * 2);
    diams.addPoint(0, SIZE);
    diams.addPoint(SIZE, 0);

    ug.getParam().setStroke(new UStroke(1.5));
    ug.getParam().setColor(getColor(ColorParam.activityBorder, getStereo()));
    ug.getParam().setBackcolor(getColor(ColorParam.activityBackground, getStereo()));
    ug.draw(xTheoricalPosition, yTheoricalPosition, diams);
    ug.getParam().setStroke(new UStroke());
  }
예제 #13
0
  public void drawU(UGraphic ug, double x, double y) {
    x += margin;
    y += margin;
    ug.getParam().setStroke(new UStroke(thickness));
    ug.getParam().setBackcolor(backgroundColor);
    ug.getParam().setColor(foregroundColor);
    final UEllipse circle = new UEllipse(radius * 2, radius * 2);
    circle.setDeltaShadow(deltaShadow);
    ug.draw(x, y, circle);
    ug.getParam().setStroke(new UStroke());

    ug.getParam().setBackcolor(foregroundColor);
    final UPolygon polygon = new UPolygon();
    polygon.addPoint(0, 0);
    final int xAile = 6;
    final int yOuverture = 5;
    final int xContact = 4;
    polygon.addPoint(xAile, -yOuverture);
    polygon.addPoint(xContact, 0);
    polygon.addPoint(xAile, yOuverture);
    polygon.addPoint(0, 0);

    ug.draw(x + radius - xContact, y, polygon);
  }
 public void drawU(UGraphic ug) {
   ug.apply(new UChangeBackColor(ug.getParam().getColor()))
       .apply(new UTranslate(-radius * Math.cos(angle), -radius * Math.sin(angle)))
       .draw(polygon);
   ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE));
   ug.apply(new UStroke(1.5))
       .apply(new UTranslate(dest.getX() - radius, dest.getY() - radius))
       .draw(new UEllipse(radius * 2, radius * 2));
   drawLine(
       ug,
       getPointOnCircle(dest.getX(), dest.getY(), Math.PI / 4),
       getPointOnCircle(dest.getX(), dest.getY(), Math.PI + Math.PI / 4));
   drawLine(
       ug,
       getPointOnCircle(dest.getX(), dest.getY(), -Math.PI / 4),
       getPointOnCircle(dest.getX(), dest.getY(), Math.PI - Math.PI / 4));
 }
예제 #15
0
  public void drawU(UGraphic ug, double x, double y) {
    int n = 0;
    String last = null;

    double pendingX = -1;
    for (Day d = start; d.compareTo(end) <= 0; d = (Day) timeline.next(d)) {
      final String text = "" + d.getMonth().name();
      if (pendingX == -1) {
        pendingX = n * dayWidth;
        last = text;
      }
      ug.getParam().setColor(HtmlColorUtils.BLACK);
      ug.getParam().setBackcolor(HtmlColorUtils.WHITE);
      if (text.equals(last) == false) {
        manage(ug, x, y, n, last, pendingX);
        pendingX = n * dayWidth;
      }
      last = text;
      n++;
    }
    manage(ug, x, y, n, last, pendingX);
  }
예제 #16
0
  public void drawU(UGraphic ug, double x, double y) {
    ug.getParam().setColor(fontConfiguration.getColor());

    final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true);

    if (tokenizer.hasMoreTokens()) {
      final double tabSize = getTabSize(ug.getStringBounder());
      while (tokenizer.hasMoreTokens()) {
        final String s = tokenizer.nextToken();
        if (s.equals("\t")) {
          final double remainder = x % tabSize;
          x += tabSize - remainder;
        } else {
          final UText utext = new UText(s, fontConfiguration);
          ug.draw(x, y, utext);
          final Dimension2D dim =
              ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), s);
          x += dim.getWidth();
        }
      }
    }
  }