コード例 #1
0
  public EntityImageUseCase(ILeaf entity, ISkinParam skinParam) {
    super(entity, skinParam);
    final Stereotype stereotype = entity.getStereotype();

    final TextBlock tmp =
        new BodyEnhanced(
            entity.getDisplay(),
            FontParam.USECASE,
            skinParam,
            HorizontalAlignment.CENTER,
            stereotype,
            true,
            false);

    if (stereotype == null || stereotype.getLabel() == null) {
      this.desc = tmp;
    } else {
      final TextBlock stereo =
          TextBlockUtils.create(
              Display.getWithNewlines(stereotype.getLabel()),
              new FontConfiguration(
                  SkinParamUtils.getFont(getSkinParam(), FontParam.ACTOR_STEREOTYPE, stereotype),
                  SkinParamUtils.getFontColor(getSkinParam(), FontParam.ACTOR_STEREOTYPE, null),
                  getSkinParam().getHyperlinkColor()),
              HorizontalAlignment.CENTER,
              skinParam);
      this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER);
    }
    this.url = entity.getUrl99();
  }
コード例 #2
0
ファイル: FtileDiamond.java プロジェクト: plantuml/plantuml
 public FtileDiamond(
     ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) {
   this(
       skinParam,
       backColor,
       borderColor,
       swimlane,
       TextBlockUtils.empty(0, 0),
       TextBlockUtils.empty(0, 0),
       TextBlockUtils.empty(0, 0),
       TextBlockUtils.empty(0, 0));
 }
コード例 #3
0
ファイル: ImageBuilder.java プロジェクト: jensnerche/plantuml
  private ImageData writeImageAnimatedGif(OutputStream os) throws IOException {

    final LimitFinder limitFinder = new LimitFinder(TextBlockUtils.getDummyStringBounder(), true);
    udrawable.drawU(limitFinder);
    final Dimension2D dim =
        new Dimension2DDouble(
            limitFinder.getMaxX() + 1 + margin1 + margin2,
            limitFinder.getMaxY() + 1 + margin1 + margin2);

    final MinMax minmax = affineTransformations.getMinMax(dim);

    final AnimatedGifEncoder e = new AnimatedGifEncoder();
    // e.setQuality(1);
    e.setRepeat(0);
    e.start(os);
    // e.setDelay(1000); // 1 frame per sec
    // e.setDelay(100); // 10 frame per sec
    e.setDelay(60); // 16 frame per sec
    // e.setDelay(50); // 20 frame per sec

    for (AffineTransformation at : affineTransformations.getAll()) {
      final ImageIcon ii = new ImageIcon(getAviImage(at));
      e.addFrame((BufferedImage) ii.getImage());
    }
    e.finish();
    return new ImageDataSimple(dim);
  }
コード例 #4
0
ファイル: ImageBuilder.java プロジェクト: jensnerche/plantuml
  private ImageData writeImageTOBEMOVED(
      FileFormatOption fileFormatOption, OutputStream os, Animation affineTransforms)
      throws IOException {
    final LimitFinder limitFinder = new LimitFinder(TextBlockUtils.getDummyStringBounder(), true);
    udrawable.drawU(limitFinder);
    Dimension2D dim =
        new Dimension2DDouble(
            limitFinder.getMaxX() + 1 + margin1 + margin2,
            limitFinder.getMaxY() + 1 + margin1 + margin2);
    double dx = 0;
    double dy = 0;
    if (affineTransforms != null) {
      final MinMax minmax = affineTransformations.getMinMax(dim);
      affineTransforms.setDimension(dim);
      dim = minmax.getDimension();
      dx = -minmax.getMinX();
      dy = -minmax.getMinY();
    }

    final UGraphic2 ug = createUGraphic(fileFormatOption, dim, affineTransforms, dx, dy);
    udrawable.drawU(handwritten(ug.apply(new UTranslate(margin1, margin1))));
    ug.flushUg();
    ug.writeImageTOBEMOVED(os, metadata, 96);
    os.flush();

    if (ug instanceof UGraphicG2d) {
      final Set<Url> urls = ((UGraphicG2d) ug).getAllUrlsEncountered();
      if (urls.size() > 0) {
        final CMapData cmap = CMapData.cmapString(urls, dpiFactor);
        return new ImageDataComplex(dim, cmap, warningOrError);
      }
    }

    return new ImageDataSimple(dim);
  }
コード例 #5
0
ファイル: Snake.java プロジェクト: pabranch/plantuml
 public Snake merge(Snake other, StringBounder stringBounder) {
   final MergeStrategy strategy = this.mergeable.max(other.mergeable);
   if (strategy == MergeStrategy.NONE) {
     return null;
   }
   if (TextBlockUtils.isEmpty(other.textBlock, stringBounder) == false) {
     return null;
     // System.err.println("merge other.textBlock="+other.textBlock+"
     // "+other.textBlock.calculateDimension(TextBlockUtils.getDummyStringBounder()));
   }
   // if (other.textBlock != null) {
   // return null;
   // }
   if (same(this.getLast(), other.getFirst())) {
     final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration;
     final Snake result = new Snake(color, oneOf);
     result.emphasizeDirection =
         emphasizeDirection == null ? other.emphasizeDirection : emphasizeDirection;
     result.worm.addAll(this.worm.merge(other.worm, strategy));
     result.mergeable = strategy;
     return result;
   }
   if (same(this.getFirst(), other.getLast())) {
     return other.merge(this, stringBounder);
   }
   return null;
 }
コード例 #6
0
ファイル: ImageBuilder.java プロジェクト: jensnerche/plantuml
  private ImageData writeImageMjpeg(OutputStream os) throws IOException {

    final LimitFinder limitFinder = new LimitFinder(TextBlockUtils.getDummyStringBounder(), true);
    udrawable.drawU(limitFinder);
    final Dimension2D dim =
        new Dimension2DDouble(
            limitFinder.getMaxX() + 1 + margin1 + margin2,
            limitFinder.getMaxY() + 1 + margin1 + margin2);

    final File f = new File("c:/tmp.avi");

    final int nbframe = 100;

    final MJPEGGenerator m =
        new MJPEGGenerator(
            f, getAviImage(null).getWidth(null), getAviImage(null).getHeight(null), 12.0, nbframe);
    for (int i = 0; i < nbframe; i++) {
      // AffineTransform at = AffineTransform.getRotateInstance(1.0);
      AffineTransform at =
          AffineTransform.getTranslateInstance(dim.getWidth() / 2, dim.getHeight() / 2);
      at.rotate(90.0 * Math.PI / 180.0 * i / 100);
      at.translate(-dim.getWidth() / 2, -dim.getHeight() / 2);
      // final AffineTransform at = AffineTransform.getTranslateInstance(i, 0);
      // final ImageIcon ii = new ImageIcon(getAviImage(at));
      // m.addImage(ii.getImage());
      throw new UnsupportedOperationException();
    }
    m.finishAVI();

    FileUtils.copyToStream(f, os);

    return new ImageDataSimple(dim);
  }
コード例 #7
0
 public ElementMenuEntry(String text, UFont font, SpriteContainer spriteContainer) {
   final FontConfiguration config = new FontConfiguration(font, HtmlColor.BLACK);
   this.block =
       TextBlockUtils.create(
           Arrays.asList(text), config, HorizontalAlignement.LEFT, spriteContainer);
   this.text = text;
 }
コード例 #8
0
 public FtileDiamondInside2(
     boolean shadowing,
     HtmlColor backColor,
     HtmlColor borderColor,
     Swimlane swimlane,
     TextBlock label) {
   this(
       shadowing,
       backColor,
       borderColor,
       swimlane,
       label,
       TextBlockUtils.empty(0, 0),
       TextBlockUtils.empty(0, 0),
       TextBlockUtils.empty(0, 0),
       TextBlockUtils.empty(0, 0));
 }
コード例 #9
0
ファイル: Frame.java プロジェクト: rakyll/plantuml
 private TextBlock createTextBloc() {
   final UFont font = skinParam.getFont(FontParam.PACKAGE, null);
   final HtmlColor textColor = skinParam.getFontHtmlColor(FontParam.PACKAGE, null);
   final TextBlock bloc =
       TextBlockUtils.create(
           name, new FontConfiguration(font, textColor), HorizontalAlignement.LEFT);
   return bloc;
 }
コード例 #10
0
 public EntityImageUsecase(Entity entity) {
   super(entity);
   this.name =
       TextBlockUtils.create(
           StringUtils.getWithNewlines(entity.getDisplay()),
           new FontConfiguration(getFont14(), Color.BLACK),
           HorizontalAlignement.CENTER);
 }
コード例 #11
0
 private UGraphicSvg(
     ColorMapper colorMapper, SvgGraphics svg, boolean textAsPath, String linkTarget) {
   super(colorMapper, svg);
   this.stringBounder = TextBlockUtils.getDummyStringBounder();
   this.textAsPath2 = textAsPath;
   this.target = linkTarget;
   register();
 }
コード例 #12
0
 public EntityImageDefault(Entity entity) {
   super(entity);
   this.textBlock =
       TextBlockUtils.create(
           entity.getDisplay2(),
           new FontConfiguration(getFont14(), HtmlColor.BLACK),
           HorizontalAlignement.CENTER,
           new SpriteContainerEmpty());
 }
コード例 #13
0
ファイル: TimeHeaderMonth.java プロジェクト: grze/euml
 private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) {
   final double width = n * dayWidth - pendingX;
   ug.draw(x + pendingX, y, new URectangle(width, getHeight()));
   final TextBlock b =
       TextBlockUtils.create(
           Arrays.asList(last), fontConfig, HorizontalAlignement.LEFT, new SpriteContainerEmpty());
   final Dimension2D dimText = b.calculateDimension(ug.getStringBounder());
   final double diffX = width - dimText.getWidth();
   final double diffY = getHeight() - dimText.getHeight();
   b.drawU(ug, x + pendingX + diffX / 2, y + diffY / 2);
 }
コード例 #14
0
ファイル: Display.java プロジェクト: 51ttw/plantuml
 private TextBlock createMessageNumber(
     FontConfiguration fontConfiguration,
     HorizontalAlignment horizontalAlignment,
     ISkinSimple spriteContainer,
     double maxMessageSize) {
   TextBlock tb1 =
       subList(0, 1)
           .getCreole(
               fontConfiguration,
               horizontalAlignment,
               spriteContainer,
               maxMessageSize,
               CreoleMode.FULL);
   tb1 = TextBlockUtils.withMargin(tb1, 0, 4, 0, 0);
   final TextBlock tb2 =
       subList(1, size())
           .getCreole(
               fontConfiguration,
               horizontalAlignment,
               spriteContainer,
               maxMessageSize,
               CreoleMode.FULL);
   return TextBlockUtils.mergeLR(tb1, tb2, VerticalAlignment.CENTER);
 }
コード例 #15
0
 private void register() {
   registerDriver(URectangle.class, new DriverRectangleSvg(this));
   if (textAsPath2) {
     registerDriver(
         UText.class, new DriverTextAsPathSvg(TextBlockUtils.getFontRenderContext(), this));
   } else {
     registerDriver(UText.class, new DriverTextSvg(getStringBounder(), this));
   }
   registerDriver(ULine.class, new DriverLineSvg(this));
   registerDriver(UPolygon.class, new DriverPolygonSvg(this));
   registerDriver(UEllipse.class, new DriverEllipseSvg(this));
   registerDriver(UImage.class, new DriverImagePng(this));
   registerDriver(UImageSvg.class, new DriverImageSvgSvg());
   registerDriver(UPath.class, new DriverPathSvg(this));
   registerDriver(DotPath.class, new DriverDotPathSvg());
   registerDriver(UCenteredCharacter.class, new DriverCenteredCharacterSvg());
 }
コード例 #16
0
ファイル: Link.java プロジェクト: svn2github/plantuml
 private double getQualifierMargin(
     StringBounder stringBounder,
     UFont fontQualif,
     String qualif,
     SpriteContainer spriteContainer) {
   if (qualif != null) {
     final TextBlock b =
         TextBlockUtils.create(
             Arrays.asList(qualif),
             new FontConfiguration(fontQualif, HtmlColorUtils.BLACK),
             HorizontalAlignement.LEFT,
             spriteContainer);
     final Dimension2D dim = b.calculateDimension(stringBounder);
     return Math.max(dim.getWidth(), dim.getHeight());
   }
   return 0;
 }
コード例 #17
0
  public EntityImageBlock(
      IEntity entity, Rose rose, ISkinParam param, Collection<Link> links, FontParam titleParam) {
    this.entity = entity;
    this.param = param;
    this.rose = rose;
    this.links = links;

    if (StringUtils.isNotEmpty(entity.getDisplay2())) {
      this.name =
          TextBlockUtils.create(
              entity.getDisplay2(),
              new FontConfiguration(param.getFont(titleParam, null), HtmlColor.BLACK),
              HorizontalAlignement.CENTER,
              param);
    } else {
      this.name = null;
    }
  }
コード例 #18
0
ファイル: GrayComponent.java プロジェクト: mar9000/plantuml
  @Override
  protected void drawInternalU(UGraphic ug, Area area) {
    final StringBounder stringBounder = ug.getStringBounder();
    ug =
        ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY))
            .apply(new UChangeColor(HtmlColorUtils.BLACK));
    ug.draw(new URectangle(getPreferredWidth(stringBounder), getPreferredHeight(stringBounder)));

    final String n = type.name();
    final int split = 9;
    final List<String> strings = new ArrayList<String>();
    for (int i = 0; i < n.length(); i += split) {
      strings.add(n.substring(i, Math.min(i + split, n.length())));
    }

    final TextBlock textBlock =
        TextBlockUtils.create(
            Display.create(strings),
            new FontConfiguration(NORMAL, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE),
            HorizontalAlignment.LEFT,
            new SpriteContainerEmpty());
    textBlock.drawU(ug);
  }
コード例 #19
0
ファイル: GanttDiagram2.java プロジェクト: 51ttw/plantuml
	private Row getMainRow() {
		final List<Task> tasks = project.getTasks();
		final List<Row> rows = new ArrayList<Row>();
		for (Task t : tasks) {
			final String text = t.getCode();
			final TextBlock label = Display.create(text).create(fontConfig, HorizontalAlignment.LEFT,
					new SpriteContainerEmpty());
			rows.add(new RowSimple((Day) t.getStart(), (Day) t.getEnd(), HtmlColorUtils.BLACK, TextBlockUtils
					.withMargin(label, 3, 3)));
		}
		final Row row = RowUtils.merge(rows);
		return row;
	}
コード例 #20
0
ファイル: UText.java プロジェクト: 51ttw/plantuml
 public double getDescent() {
   final LineMetrics fm = TextBlockUtils.getLineMetrics(font.getFont(), text);
   final double descent = fm.getDescent();
   return descent;
 }
コード例 #21
0
ファイル: Project2.java プロジェクト: svn2github/plantuml
 public TextBlock getTimeHeader(double dayWith) {
   final TimeHeaderDay day = new TimeHeaderDay(getStart(), getEnd(), timeline, dayWith);
   final TimeHeaderMonth month = new TimeHeaderMonth(getStart(), getEnd(), timeline, dayWith);
   return TextBlockUtils.mergeTB(month, day, HorizontalAlignement.CENTER);
 }