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


Java OurPDFWriter类代码示例

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


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

示例1: alloySaveAsPDF

import edu.mit.csail.sdg.alloy4.OurPDFWriter; //导入依赖的package包/类
/** Export the current drawing as a PDF file with the given image resolution. */
public void alloySaveAsPDF(String filename, int dpi) throws IOException {
   try {
      double xwidth = dpi*8L+(dpi/2L); // Width is up to 8.5 inch
      double xheight = dpi*11L;        // Height is up to 11 inch
      double scale1 = (xwidth-dpi)  / graph.getTotalWidth();  // We leave 0.5 inch on the left and right
      double scale2 = (xheight-dpi) / graph.getTotalHeight(); // We leave 0.5 inch on the left and right
      if (scale1<scale2) scale2=scale1; // Choose the scale such that the image does not exceed the page in either direction
      OurPDFWriter x = new OurPDFWriter(filename, dpi, scale2);
      graph.draw(new Artist(x), scale2, null, false);
      x.close();
   } catch(Throwable ex) {
      if (ex instanceof IOException) throw (IOException)ex;
      throw new IOException("Failure writing the PDF file to " + filename + " (" + ex + ")");
   }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:17,代码来源:GraphViewer.java

示例2: alloySaveAsPDF

import edu.mit.csail.sdg.alloy4.OurPDFWriter; //导入依赖的package包/类
/**
 * Export the current drawing as a PDF file with the given image resolution.
 */
public void alloySaveAsPDF(String filename, int dpi) throws IOException {
	try {
		double xwidth = dpi * 8L + (dpi / 2L); // Width is up to 8.5 inch
		double xheight = dpi * 11L; // Height is up to 11 inch
		double scale1 = (xwidth - dpi) / graph.getTotalWidth(); // We leave
																// 0.5 inch
																// on the
																// left and
																// right
		double scale2 = (xheight - dpi) / graph.getTotalHeight(); // We
																	// leave
																	// 0.5
																	// inch
																	// on
																	// the
																	// left
																	// and
																	// right
		if (scale1 < scale2)
			scale2 = scale1; // Choose the scale such that the image does
								// not exceed the page in either direction
		OurPDFWriter x = new OurPDFWriter(filename, dpi, scale2);
		graph.draw(new Artist(x), scale2, null, false);
		x.close();
	} catch (Throwable ex) {
		if (ex instanceof IOException)
			throw (IOException) ex;
		throw new IOException("Failure writing the PDF file to " + filename + " (" + ex + ")");
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:34,代码来源:GraphViewer.java

示例3: Artist

import edu.mit.csail.sdg.alloy4.OurPDFWriter; //导入依赖的package包/类
/**
 * Construct an artist that acts as a wrapper around the given OurPDFWriter
 * object.
 */
public Artist(OurPDFWriter pdfWriter) {
	this.gr = null;
	this.pdf = pdfWriter;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:9,代码来源:Artist.java

示例4: Artist

import edu.mit.csail.sdg.alloy4.OurPDFWriter; //导入依赖的package包/类
/** Construct an artist that acts as a wrapper around the given OurPDFWriter object. */
public Artist(OurPDFWriter pdfWriter)  { this.gr=null; this.pdf=pdfWriter; }
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:3,代码来源:Artist.java


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