当前位置: 首页>>代码示例>>Java>>正文


Java FileFormat类代码示例

本文整理汇总了Java中net.sourceforge.plantuml.FileFormat的典型用法代码示例。如果您正苦于以下问题:Java FileFormat类的具体用法?Java FileFormat怎么用?Java FileFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileFormat类属于net.sourceforge.plantuml包,在下文中一共展示了FileFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createUGraphic

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
private UGraphic2 createUGraphic(FileFormatOption fileFormatOption, final Dimension2D dim, Animation animationArg,
		double dx, double dy) {
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	switch (fileFormat) {
	case PNG:
		return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, animationArg, dx, dy);
	case SVG:
		return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor, fileFormatOption.getSvgLinkTarget());
	case EPS:
		return new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
	case EPS_TEXT:
		return new UGraphicEps(colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT);
	case HTML5:
		return new UGraphicHtml5(colorMapper);
	case VDX:
		return new UGraphicVdx(colorMapper);
	case LATEX:
		return new UGraphicTikz(colorMapper, true);
	case LATEX_NO_PREAMBLE:
		return new UGraphicTikz(colorMapper, false);
	case BRAILLE_PNG:
		return new UGraphicBraille(colorMapper, fileFormat);
	default:
		throw new UnsupportedOperationException(fileFormat.toString());
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:27,代码来源:ImageBuilder.java

示例2: stor

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
private void stor(String fileName, Socket socket) throws UnknownHostException, IOException {
	final InputStream is = socket.getInputStream();
	final ByteArrayOutputStream baos = new ByteArrayOutputStream();
	FileUtils.copyToStream(is, baos);

	myOut("226 Transfer complete.");

	if ("png".equalsIgnoreCase(fileName)) {
		connexion.setFileFormat(FileFormat.PNG);
	} else if ("svg".equalsIgnoreCase(fileName)) {
		connexion.setFileFormat(FileFormat.SVG);
	} else if ("eps".equalsIgnoreCase(fileName)) {
		connexion.setFileFormat(FileFormat.EPS);
	}

	if (fileName.length() > 3) {
		final String data = new String(baos.toByteArray(), ftpServer.getCharset());
		final String pngFileName = connexion.getFutureFileName(fileName);
		connexion.futureOutgoing(pngFileName);
		connexion.addIncoming(fileName, data);

		ftpServer.processImage(connexion, fileName);
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:25,代码来源:FtpLoop.java

示例3: createImage

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
private UGraphic createImage(FileFormatOption fileFormatOption) {
	final Color backColor = getSkinParam().getColorMapper()
			.getMappedColor(this.getSkinParam().getBackgroundColor());
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	if (fileFormat == FileFormat.PNG) {
		final double height = getDefaultArea().heightWhenWidthIs(width, fileFormat.getDefaultStringBounder());
		final EmptyImageBuilder builder = new EmptyImageBuilder(width, height, backColor);

		final Graphics2D graphics2D = builder.getGraphics2D();
		final double dpiFactor = this.getDpiFactor(fileFormatOption);
		final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), graphics2D, dpiFactor);
		result.setBufferedImage(builder.getBufferedImage());
		return result;
	}
	throw new UnsupportedOperationException();
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:17,代码来源:PostItDiagram.java

示例4: drawU

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void drawU(UGraphic ug, Area area, Context2D context) {
	final Dimension2D dimensionToUse = area.getDimensionToUse();
	final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();
	final int width = (int) dimensionToUse.getWidth();
	final int textWidth = StringUtils.getWidth(stringsToDisplay);
	// final int height = (int) dimensionToUse.getHeight();

	final int textPos = (width - textWidth - 1) / 2;
	final String desc = " " + stringsToDisplay.get(0).toString();

	if (fileFormat == FileFormat.UTXT) {
		charArea.drawHLine('\u2550', 2, 0, width, '\u2502', '\u256a');
		charArea.drawStringLR(desc, textPos, 2);
		
		charArea.drawHLine('\u2550', 1, textPos - 1, textPos + desc.length() + 1, '\u2502', '\u2567');
		charArea.drawHLine('\u2550', 3, textPos - 1, textPos + desc.length() + 1, '\u2502', '\u2564');
		
		charArea.drawStringTB("\u2554\u2563\u255a", textPos - 1, 1);
		charArea.drawStringTB("\u2557\u2560\u255d", textPos + desc.length(), 1);
	} else {
		charArea.drawHLine('=', 2, 0, width);
		charArea.drawStringLR(desc, textPos, 2);
		charArea.drawHLine('=', 1, textPos - 1, textPos + desc.length() + 1);
		charArea.drawHLine('=', 3, textPos - 1, textPos + desc.length() + 1);
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:27,代码来源:ComponentTextDivider.java

示例5: drawU

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void drawU(UGraphic ug, Area area, Context2D context) {
	final Dimension2D dimensionToUse = area.getDimensionToUse();
	final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();
	final int width = (int) dimensionToUse.getWidth() - 1;
	final int height = (int) dimensionToUse.getHeight();
	charArea.fillRect(' ', 2, 1, width - 3, height - 2);
	if (type == ComponentType.NOTE) {
		if (fileFormat == FileFormat.UTXT) {
			charArea.drawNoteSimpleUnicode(2, 0, width - 2, height);
		} else {
			charArea.drawNoteSimple(2, 0, width - 2, height);
		}
	} else if (type == ComponentType.NOTE_BOX) {
		if (fileFormat == FileFormat.UTXT) {
			charArea.drawBoxSimpleUnicode(2, 0, width - 2, height);
		} else {
			charArea.drawBoxSimple(2, 0, width - 2, height);
		}
	}
	charArea.drawStringsLR(stringsToDisplay.as(), 3, 1);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:22,代码来源:ComponentTextNote.java

示例6: drawU

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void drawU(UGraphic ug, Area area, Context2D context) {
	final Dimension2D dimensionToUse = area.getDimensionToUse();
	final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();
	final int width = (int) dimensionToUse.getWidth();
	final int height = (int) dimensionToUse.getHeight();
	charArea.fillRect(' ', 0, 0, width, height);
	if (fileFormat == FileFormat.UTXT) {
		charArea.drawBoxSimpleUnicode(0, 0, width, height);
		if (type == ComponentType.PARTICIPANT_TAIL) {
			charArea.drawChar('\u2534', (width - 1) / 2, 0);
		}
		if (type == ComponentType.PARTICIPANT_HEAD) {
			charArea.drawChar('\u252c', (width - 1) / 2, height - 1);
		}
	} else {
		charArea.drawBoxSimple(0, 0, width, height);
		if (type == ComponentType.PARTICIPANT_TAIL) {
			charArea.drawChar('+', (width - 1) / 2, 0);
		}
		if (type == ComponentType.PARTICIPANT_HEAD) {
			charArea.drawChar('+', (width - 1) / 2, height - 1);
		}
	}
	charArea.drawStringsLR(stringsToDisplay.as(), 1, 1);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:26,代码来源:ComponentTextParticipant.java

示例7: drawU

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void drawU(UGraphic ug, Area area, Context2D context) {
	final Dimension2D dimensionToUse = area.getDimensionToUse();
	final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();
	final int width = (int) dimensionToUse.getWidth();

	if (stringsToDisplay.get(0) != null) {
		charArea.drawStringLR("[" + stringsToDisplay.get(0) + "]", 2, 0);
	}
	if (fileFormat == FileFormat.UTXT) {
		charArea.drawChar('\u2560', 0, -1);
		charArea.drawChar('\u2563', width - 1, -1);
		charArea.drawHLine('\u2550', -1, 1, width - 1, '\u2502', '\u256a');
	} else {
		charArea.drawHLine('~', -1, 1, width - 1);
	}

	// charArea.fillRect('E', 0, 0, width, height);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:19,代码来源:ComponentTextGroupingElse.java

示例8: drawU

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void drawU(UGraphic ug, Area area, Context2D context) {
	final Dimension2D dimensionToUse = area.getDimensionToUse();
	final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();
	final int width = (int) dimensionToUse.getWidth();
	final int height = (int) dimensionToUse.getHeight();

	if (fileFormat == FileFormat.UTXT) {
		charArea.drawVLine('\u2551', 0, 0, height);
		charArea.drawVLine('\u2551', width - 1, 0, height);
		charArea.drawHLine('\u2550', height - 1, 1, width - 1, '\u2502', '\u256a');
		charArea.drawChar('\u2560', 0, height - 1);
		charArea.drawChar('\u2563', width - 1, height - 1);
	} else {
		charArea.drawVLine('!', 0, 0, height);
		charArea.drawVLine('!', width - 1, 0, height);
		charArea.drawHLine('~', height - 1, 1, width - 1);
	}
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:19,代码来源:ComponentTextGroupingBody.java

示例9: createUGraphic

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
private UGraphic2 createUGraphic(FileFormat fileFormat, final Dimension2D dim,
		Animation affineTransforms, double dx, double dy) {
	switch (fileFormat) {
	case PNG:
		return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, affineTransforms, dx, dy);
	case SVG:
		return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor);
	case EPS:
		return new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
	case EPS_TEXT:
		return new UGraphicEps(colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT);
	case HTML5:
		return new UGraphicHtml5(colorMapper);
	case VDX:
		return new UGraphicVdx(colorMapper);
	case LATEX:
		return new UGraphicTikz(colorMapper);
	default:
		throw new UnsupportedOperationException(fileFormat.toString());
	}
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:22,代码来源:ImageBuilder.java

示例10: writeImage

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public static void writeImage(OutputStream os, String metadata, FileFormatOption fileFormatOption,
		ColorMapper colorMapper, HtmlColor background, TextBlock image) throws IOException {
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	if (fileFormat == FileFormat.PNG) {
		final BufferedImage im = createImage(colorMapper, background, image);
		PngIO.write(im, os, fileFormatOption.isWithMetadata() ? metadata : null, 96);
	} else if (fileFormat == FileFormat.SVG) {
		final UGraphicSvg svg = new UGraphicSvg(colorMapper, StringUtils.getAsHtml(colorMapper
				.getMappedColor(background)), false, 1.0);
		image.drawU(svg);
		svg.createXml(os);
	} else if (fileFormat == FileFormat.EPS) {
		final UGraphicEps ug = new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
		image.drawU(ug);
		os.write(ug.getEPSCode().getBytes());
	} else {
		throw new UnsupportedOperationException();
	}
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:20,代码来源:UGraphicUtils.java

示例11: getBufferedImage

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public BufferedImage getBufferedImage(final char c) throws IOException {
	final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1, null, null, null, 0, 0, null);
	final double dim = 20;
	imageBuilder.addUDrawable(new UDrawable() {
		public void drawU(UGraphic ug) {
			ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
			ug.draw(new URectangle(dim - 1, dim - 1));
			ug = (UGraphic2) ug.apply(new UTranslate(dim / 3, 2 * dim / 3));
			final UText text = new UText("" + c, new FontConfiguration(font, HtmlColorUtils.BLACK,
					HtmlColorUtils.BLUE));
			ug.draw(text);
		}
	});
	final ByteArrayOutputStream os = new ByteArrayOutputStream();
	imageBuilder.writeImageTOBEMOVED(FileFormat.PNG, os);
	os.close();
	return ImageIO.read(new ByteArrayInputStream(os.toByteArray()));
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:19,代码来源:FontChecker.java

示例12: processImage

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void processImage(String fileName) throws IOException {
	if (fileName.startsWith("/")) {
		throw new IllegalArgumentException();
	}
	final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName));
	final ByteArrayOutputStream baos = new ByteArrayOutputStream();
	final FileFormat format = FileFormat.PNG;
	final DiagramDescription desc = sourceStringReader.generateDiagramDescription(baos,
			new FileFormatOption(format));
	final String pngFileName = format.changeName(fileName, 0);
	final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err";
	synchronized (this) {
		outgoing.remove(pngFileName);
		outgoing.remove(errorFileName);
		if (desc != null && desc.getDescription() != null) {
			outgoing.put(pngFileName, baos.toByteArray());
			if (desc.getDescription().startsWith("(Error)")) {
				final ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
				sourceStringReader.generateImage(errBaos, new FileFormatOption(FileFormat.ATXT));
				errBaos.close();
				outgoing.put(errorFileName, errBaos.toByteArray());
			}
		}
	}
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:26,代码来源:FtpConnexion.java

示例13: createImage

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
private UGraphic createImage(FileFormatOption fileFormatOption) {
	final Color backColor = getSkinParam().getColorMapper()
			.getMappedColor(this.getSkinParam().getBackgroundColor());
	final FileFormat fileFormat = fileFormatOption.getFileFormat();
	if (fileFormat == FileFormat.PNG) {
		final double height = getDefaultArea().heightWhenWidthIs(width, TextBlockUtils.getDummyStringBounder());
		final EmptyImageBuilder builder = new EmptyImageBuilder(width, height, backColor);

		final Graphics2D graphics2D = builder.getGraphics2D();
		final double dpiFactor = this.getDpiFactor(fileFormatOption);
		final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), graphics2D, dpiFactor);
		result.setBufferedImage(builder.getBufferedImage());
		return result;
	}
	throw new UnsupportedOperationException();
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:17,代码来源:PostItDiagram.java

示例14: drawU

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public void drawU(UGraphic ug, Area area, Context2D context) {
	final Dimension2D dimensionToUse = area.getDimensionToUse();
	final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();
	final int width = (int) dimensionToUse.getWidth();
	final int height = (int) dimensionToUse.getHeight();
	final int textWidth = StringUtils.getWidth(stringsToDisplay);

	final int yarrow = height - 2;
	charArea.drawHLine(fileFormat == FileFormat.UTXT ? '\u2500' : '-', yarrow, 1, width);
	if (config.isDotted()) {
		for (int i = 1; i < width; i += 2) {
			charArea.drawChar(' ', i, yarrow);
		}
	}

	if (config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) {
		charArea.drawChar('>', width - 1, yarrow);
	} else if (config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE) {
		charArea.drawChar('<', 1, yarrow);
	} else {
		throw new UnsupportedOperationException();
	}
	charArea.drawStringsLR(stringsToDisplay.as(), (width - textWidth) / 2, 0);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:25,代码来源:ComponentTextArrow.java

示例15: createOne

import net.sourceforge.plantuml.FileFormat; //导入依赖的package包/类
public ImageData createOne(OutputStream os, int index, boolean isWithMetadata) throws IOException {
	final UGraphic2 ug = createImage((int) fullDimension.getWidth(), pages.get(index), index);

	ug.writeImageTOBEMOVED(os, isWithMetadata ? diagram.getMetadata() : null, diagram.getDpi(fileFormatOption));
	final Dimension2D info = new Dimension2DDouble(fullDimension.getWidth(), fullDimension.getHeight());

	if (fileFormatOption.getFileFormat() == FileFormat.PNG && ug instanceof UGraphicG2d) {
		final Set<Url> urls = ((UGraphicG2d) ug).getAllUrlsEncountered();
		if (urls.size() > 0) {
			if (scale == 0) {
				throw new IllegalStateException();
			}
			final CMapData cmap = CMapData.cmapString(urls, scale);
			return new ImageDataComplex(info, cmap, null);
		}
	}
	return new ImageDataSimple(info);
}
 
开发者ID:mar9000,项目名称:plantuml,代码行数:19,代码来源:SequenceDiagramFileMakerPuma.java


注:本文中的net.sourceforge.plantuml.FileFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。