merge fixing
This commit is contained in:
parent
e8abfbd306
commit
683c11072a
@ -3,8 +3,10 @@
|
||||
*/
|
||||
package net.sf.openrocket.gui.print.visitor;
|
||||
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.BodyComponent;
|
||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
||||
@ -24,8 +26,8 @@ import net.sf.openrocket.rocketcomponent.Stage;
|
||||
import net.sf.openrocket.rocketcomponent.Transition;
|
||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
|
||||
/**
|
||||
* This abstract class contains boilerplate functionality to support visiting the components of a rocket. It is a
|
||||
@ -123,7 +125,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
||||
* @param root the root component; all children will be visited recursively
|
||||
*/
|
||||
protected void goDeep(final RocketComponent root) {
|
||||
RocketComponent[] rc = root.getChildren();
|
||||
List<RocketComponent> rc = root.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -133,7 +135,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
||||
*
|
||||
* @param theRc an array of rocket components; all children will be visited recursively
|
||||
*/
|
||||
protected void goDeep (final RocketComponent[] theRc) {
|
||||
protected void goDeep(final List<RocketComponent> theRc) {
|
||||
level++;
|
||||
for (RocketComponent rocketComponent : theRc) {
|
||||
rocketComponent.accept(parent);
|
||||
|
||||
@ -3,18 +3,14 @@
|
||||
*/
|
||||
package net.sf.openrocket.gui.print.visitor;
|
||||
|
||||
import com.itextpdf.text.BadElementException;
|
||||
import com.itextpdf.text.Chunk;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Element;
|
||||
import com.itextpdf.text.Font;
|
||||
import com.itextpdf.text.Image;
|
||||
import com.itextpdf.text.Phrase;
|
||||
import com.itextpdf.text.Rectangle;
|
||||
import com.itextpdf.text.pdf.PdfPCell;
|
||||
import com.itextpdf.text.pdf.PdfPTable;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import net.sf.openrocket.gui.main.ComponentIcons;
|
||||
import net.sf.openrocket.gui.print.ITextHelper;
|
||||
import net.sf.openrocket.gui.print.PrintUtilities;
|
||||
@ -41,11 +37,18 @@ import net.sf.openrocket.unit.Unit;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import com.itextpdf.text.BadElementException;
|
||||
import com.itextpdf.text.Chunk;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Element;
|
||||
import com.itextpdf.text.Font;
|
||||
import com.itextpdf.text.Image;
|
||||
import com.itextpdf.text.Phrase;
|
||||
import com.itextpdf.text.Rectangle;
|
||||
import com.itextpdf.text.pdf.PdfPCell;
|
||||
import com.itextpdf.text.pdf.PdfPTable;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
|
||||
/**
|
||||
* A visitor strategy for creating documentation about parts details.
|
||||
@ -87,11 +90,10 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid = new PdfPTable(TABLE_COLUMNS);
|
||||
grid.setWidthPercentage(100);
|
||||
grid.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
}
|
||||
catch (DocumentException e) {
|
||||
} catch (DocumentException e) {
|
||||
}
|
||||
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -109,7 +111,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -120,7 +122,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
public void visit(final BodyComponent visitable) {
|
||||
grid.addCell(visitable.getName());
|
||||
grid.completeRow();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -136,7 +138,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -153,7 +155,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -191,7 +193,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -206,7 +208,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(createOuterDiaCell(visitable));
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -228,7 +230,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(cell);
|
||||
grid.addCell(cell);
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -243,7 +245,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(ITextHelper.createCell(visitable.getType().getName(), PdfPCell.BOTTOM));
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -258,7 +260,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(createOuterDiaCell(visitable));
|
||||
grid.addCell(createLengthCell(visitable.getLength()));
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -295,8 +297,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
if (grid != null) {
|
||||
document.add(grid);
|
||||
}
|
||||
}
|
||||
catch (DocumentException e) {
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -355,11 +356,9 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
|
||||
try {
|
||||
img = Image.getInstance(writer, awtImage, 0.25f);
|
||||
}
|
||||
catch (BadElementException e) {
|
||||
} catch (BadElementException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -374,7 +373,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
grid.addCell(ITextHelper.createCell());
|
||||
grid.addCell(createMassCell(visitable.getMass()));
|
||||
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -428,10 +427,8 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
||||
cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
|
||||
cell.setBorder(PdfPCell.NO_BORDER);
|
||||
return cell;
|
||||
}
|
||||
catch (BadElementException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (BadElementException e) {
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -3,8 +3,11 @@
|
||||
*/
|
||||
package net.sf.openrocket.gui.print.visitor;
|
||||
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||
import net.sf.openrocket.rocketcomponent.Coaxial;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
||||
@ -19,9 +22,8 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.Transition;
|
||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
|
||||
/**
|
||||
* A visitor strategy for creating documentation about a parts list.
|
||||
@ -56,7 +58,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
||||
crap.put(pa, pa);
|
||||
}
|
||||
pa.increment();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -72,7 +74,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
||||
crap.put(pa, pa);
|
||||
}
|
||||
pa.increment();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -102,7 +104,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
||||
crap.put(pa, pa);
|
||||
}
|
||||
pa.increment();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -118,7 +120,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
||||
crap.put(pa, pa);
|
||||
}
|
||||
pa.increment();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -134,7 +136,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
||||
crap.put(pa, pa);
|
||||
}
|
||||
pa.increment();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -150,7 +152,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
||||
crap.put(pa, pa);
|
||||
}
|
||||
pa.increment();
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -213,6 +215,7 @@ class PartsAccumulator {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o1) {
|
||||
if (this == o1) {
|
||||
return true;
|
||||
@ -221,11 +224,9 @@ class PartsAccumulator {
|
||||
RocketComponent that;
|
||||
if (o1 instanceof net.sf.openrocket.gui.print.visitor.PartsAccumulator) {
|
||||
that = ((net.sf.openrocket.gui.print.visitor.PartsAccumulator) o1).component;
|
||||
}
|
||||
else if (o1 instanceof RocketComponent) {
|
||||
} else if (o1 instanceof RocketComponent) {
|
||||
that = (RocketComponent) o1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -250,6 +251,7 @@ class PartsAccumulator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return component.getComponentName().hashCode();
|
||||
}
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
*/
|
||||
package net.sf.openrocket.gui.print.visitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.BodyComponent;
|
||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
||||
@ -22,9 +25,6 @@ import net.sf.openrocket.rocketcomponent.Stage;
|
||||
import net.sf.openrocket.rocketcomponent.Transition;
|
||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This visitor strategy accumulates Stage references in a Rocket hierarchy.
|
||||
*/
|
||||
@ -85,7 +85,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
||||
stageComponents.add(mass);
|
||||
}
|
||||
mass = 0d;
|
||||
RocketComponent[] rc = visitable.getChildren();
|
||||
List<RocketComponent> rc = visitable.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
||||
* @param root the root component; all children will be visited recursively
|
||||
*/
|
||||
protected void goDeep(final RocketComponent root) {
|
||||
RocketComponent[] rc = root.getChildren();
|
||||
List<RocketComponent> rc = root.getChildren();
|
||||
goDeep(rc);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
||||
*
|
||||
* @param theRc an array of rocket components; all children will be visited recursively
|
||||
*/
|
||||
protected void goDeep (final RocketComponent[] theRc) {
|
||||
protected void goDeep(final List<RocketComponent> theRc) {
|
||||
for (RocketComponent rocketComponent : theRc) {
|
||||
rocketComponent.accept(parent);
|
||||
}
|
||||
@ -250,6 +250,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
||||
/**
|
||||
* Close by setting the last stage.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
if (mass > 0d) {
|
||||
stageComponents.add(mass);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user