本文整理汇总了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 + ")");
}
}
示例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 + ")");
}
}
示例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;
}
示例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; }