This commit is contained in:
Sampo Niskanen 2012-09-19 04:13:57 +00:00
parent e68fbafde9
commit 3ff98a01d2

View File

@ -4,7 +4,6 @@
package net.sf.openrocket.gui.print; package net.sf.openrocket.gui.print;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.io.IOException;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.List; import java.util.List;
@ -31,12 +30,13 @@ import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.Chars; import net.sf.openrocket.util.Chars;
import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Coordinate;
import org.uispec4j.utils.Utils;
import com.itextpdf.text.Document; import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException; import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element; import com.itextpdf.text.Element;
import com.itextpdf.text.Paragraph; import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle; import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.DefaultFontMapper; import com.itextpdf.text.pdf.DefaultFontMapper;
import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPCell;
@ -277,12 +277,12 @@ public class DesignReport {
final DefaultFontMapper mapper = new DefaultFontMapper(); final DefaultFontMapper mapper = new DefaultFontMapper();
Graphics2D g2d = theCanvas.createGraphics(thePageImageableWidth, thePageImageableHeight * 2, mapper); Graphics2D g2d = theCanvas.createGraphics(thePageImageableWidth, thePageImageableHeight * 2, mapper);
final double halfFigureHeight = SCALE_FUDGE_FACTOR * theFigure.getFigureHeightPx()/2; final double halfFigureHeight = SCALE_FUDGE_FACTOR * theFigure.getFigureHeightPx() / 2;
int y = PrintUnit.POINTS_PER_INCH; int y = PrintUnit.POINTS_PER_INCH;
//If the y dimension is negative, then it will potentially be drawn off the top of the page. Move the origin //If the y dimension is negative, then it will potentially be drawn off the top of the page. Move the origin
//to allow for this. //to allow for this.
if (theFigure.getDimensions().getY() < 0.0d) { if (theFigure.getDimensions().getY() < 0.0d) {
y += (int)halfFigureHeight; y += (int) halfFigureHeight;
} }
g2d.translate(20, y); g2d.translate(20, y);
@ -468,8 +468,8 @@ public class DesignReport {
labelTable.addCell(ITextHelper.createCell(MAX_VELOCITY, 2, 2)); labelTable.addCell(ITextHelper.createCell(MAX_VELOCITY, 2, 2));
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getMaxVelocity()), 2, 2)); labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getMaxVelocity()), 2, 2));
labelTable.addCell(ITextHelper.createCell(DEPLOYMENT_VELOCITY, 2,2)); labelTable.addCell(ITextHelper.createCell(DEPLOYMENT_VELOCITY, 2, 2));
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getDeploymentVelocity()),2,2)); labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getDeploymentVelocity()), 2, 2));
labelTable.addCell(ITextHelper.createCell(LANDING_VELOCITY, 2, 2)); labelTable.addCell(ITextHelper.createCell(LANDING_VELOCITY, 2, 2));
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getGroundHitVelocity()), 2, 2)); labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getGroundHitVelocity()), 2, 2));
@ -501,7 +501,7 @@ public class DesignReport {
try { try {
for (int i = 0; i < simulations.size(); i++) { for (int i = 0; i < simulations.size(); i++) {
Simulation simulation = simulations.get(i); Simulation simulation = simulations.get(i);
if (simulation.getOptions().getMotorConfigurationID().equals(motorId)) { if (Utils.equals(simulation.getOptions().getMotorConfigurationID(), motorId)) {
simulation = simulation.copy(); simulation = simulation.copy();
simulation.simulate(); simulation.simulate();
flight = simulation.getSimulatedData(); flight = simulation.getSimulatedData();