Always save using .zip container format. Removed the "use compression"
option from the StorageOptionChooser.
This commit is contained in:
parent
1bbef243ac
commit
7db51b9b65
@ -1063,8 +1063,6 @@ StorageOptChooser.lbl.longC1 = <html>Store only the values shown in the summary
|
||||
StorageOptChooser.lbl.longC2 = This results in the smallest files.
|
||||
StorageOptChooser.checkbox.IncludeDecals = Include decals
|
||||
StorageOptChooser.lbl.IncludeDecals = "Including decals will produce a compressed zip file"
|
||||
StorageOptChooser.checkbox.Compfile = Compress file
|
||||
StorageOptChooser.lbl.UsingComp = Using compression reduces the file size significantly.
|
||||
StorageOptChooser.lbl.longD1 = An estimate on how large the resulting file would be with the present options.
|
||||
StorageOptChooser.ttip.Saveopt = Save options
|
||||
StorageOptChooser.lbl.Estfilesize = Estimated file size:
|
||||
|
@ -16,8 +16,6 @@ public class StorageOptions implements Cloneable {
|
||||
|
||||
private boolean includeDecals = false;
|
||||
|
||||
private boolean compressionEnabled = true;
|
||||
|
||||
private double simulationTimeSkip = SIMULATION_DATA_NONE;
|
||||
|
||||
private boolean explicitlySet = false;
|
||||
@ -38,14 +36,6 @@ public class StorageOptions implements Cloneable {
|
||||
this.includeDecals = includeDecals;
|
||||
}
|
||||
|
||||
public boolean isCompressionEnabled() {
|
||||
return compressionEnabled;
|
||||
}
|
||||
|
||||
public void setCompressionEnabled(boolean compression) {
|
||||
this.compressionEnabled = compression;
|
||||
}
|
||||
|
||||
public double getSimulationTimeSkip() {
|
||||
return simulationTimeSkip;
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ public class GeneralRocketLoader {
|
||||
// Check for GZIP
|
||||
if (buffer[0] == GZIP_SIGNATURE[0] && buffer[1] == GZIP_SIGNATURE[1]) {
|
||||
OpenRocketDocument doc = loadFromStream(new GZIPInputStream(source), motorFinder);
|
||||
doc.getDefaultStorageOptions().setCompressionEnabled(true);
|
||||
doc.getDecalRegistry().setIsZipFile(false);
|
||||
return doc;
|
||||
}
|
||||
@ -122,7 +121,6 @@ public class GeneralRocketLoader {
|
||||
}
|
||||
if (entry.getName().matches(".*\\.[oO][rR][kK]$")) {
|
||||
OpenRocketDocument doc = loadFromStream(in, motorFinder);
|
||||
doc.getDefaultStorageOptions().setCompressionEnabled(true);
|
||||
doc.getDefaultStorageOptions().setIncludeDecals(true);
|
||||
doc.getDecalRegistry().setIsZipFile(true);
|
||||
return doc;
|
||||
|
@ -146,16 +146,6 @@ public class GeneralRocketSaver {
|
||||
|
||||
private void save(String fileName, OutputStream output, OpenRocketDocument document, StorageOptions options) throws IOException {
|
||||
|
||||
// If we don't include decals, just write the simple file.
|
||||
if (!options.isIncludeDecals()) {
|
||||
saveInternal(output,document,options);
|
||||
return;
|
||||
}
|
||||
|
||||
// We're saving decals, so the result will be a zip file. There's no
|
||||
// need to gzip the rocket model file in the archive.
|
||||
options.setCompressionEnabled(false);
|
||||
|
||||
/* if we want a directory ...
|
||||
String path = fileName;
|
||||
int dotlocation = fileName.lastIndexOf('.');
|
||||
|
@ -9,7 +9,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.Warning;
|
||||
import net.sf.openrocket.document.OpenRocketDocument;
|
||||
@ -57,11 +56,8 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
|
||||
// Estimated storage used by different portions
|
||||
// These have been hand-estimated from saved files
|
||||
private static final int BYTES_PER_COMPONENT_UNCOMPRESSED = 590;
|
||||
private static final int BYTES_PER_COMPONENT_COMPRESSED = 80;
|
||||
private static final int BYTES_PER_SIMULATION_UNCOMPRESSED = 1000;
|
||||
private static final int BYTES_PER_SIMULATION_COMPRESSED = 100;
|
||||
private static final int BYTES_PER_DATAPOINT_UNCOMPRESSED = 350;
|
||||
private static final int BYTES_PER_DATAPOINT_COMPRESSED = 100;
|
||||
|
||||
|
||||
@ -73,11 +69,6 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
|
||||
log.info("Saving .ork file");
|
||||
|
||||
if (options.isCompressionEnabled()) {
|
||||
log.debug("Enabling compression");
|
||||
output = new GZIPOutputStream(output);
|
||||
}
|
||||
|
||||
dest = new BufferedWriter(new OutputStreamWriter(output, OPENROCKET_CHARSET));
|
||||
|
||||
// Select file version number
|
||||
@ -121,9 +112,6 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
|
||||
log.debug("Writing complete, flushing buffers");
|
||||
dest.flush();
|
||||
if (options.isCompressionEnabled()) {
|
||||
((GZIPOutputStream) output).finish();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -178,17 +166,11 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
componentCount++;
|
||||
}
|
||||
|
||||
if (options.isCompressionEnabled())
|
||||
size += componentCount * BYTES_PER_COMPONENT_COMPRESSED;
|
||||
else
|
||||
size += componentCount * BYTES_PER_COMPONENT_UNCOMPRESSED;
|
||||
size += componentCount * BYTES_PER_COMPONENT_COMPRESSED;
|
||||
|
||||
|
||||
// Size per simulation
|
||||
if (options.isCompressionEnabled())
|
||||
size += doc.getSimulationCount() * BYTES_PER_SIMULATION_COMPRESSED;
|
||||
else
|
||||
size += doc.getSimulationCount() * BYTES_PER_SIMULATION_UNCOMPRESSED;
|
||||
size += doc.getSimulationCount() * BYTES_PER_SIMULATION_COMPRESSED;
|
||||
|
||||
|
||||
// Size per flight data point
|
||||
@ -205,10 +187,7 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
}
|
||||
}
|
||||
|
||||
if (options.isCompressionEnabled())
|
||||
size += pointCount * BYTES_PER_DATAPOINT_COMPRESSED;
|
||||
else
|
||||
size += pointCount * BYTES_PER_DATAPOINT_UNCOMPRESSED;
|
||||
size += pointCount * BYTES_PER_DATAPOINT_COMPRESSED;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ public class OpenRocketLoader extends AbstractRocketLoader {
|
||||
timeSkip = Math.rint(timeSkip * 100) / 100;
|
||||
|
||||
doc.getDefaultStorageOptions().setSimulationTimeSkip(timeSkip);
|
||||
doc.getDefaultStorageOptions().setCompressionEnabled(false); // Set by caller if compressed
|
||||
doc.getDefaultStorageOptions().setExplicitlySet(false);
|
||||
|
||||
doc.clearUndo();
|
||||
|
@ -39,7 +39,6 @@ public class StorageOptionChooser extends JPanel {
|
||||
|
||||
private JSpinner timeSpinner;
|
||||
|
||||
private JCheckBox compressButton;
|
||||
private JCheckBox decalButton;
|
||||
|
||||
private JLabel estimateLabel;
|
||||
@ -130,14 +129,6 @@ public class StorageOptionChooser extends JPanel {
|
||||
decalButton.addActionListener(actionUpdater);
|
||||
this.add(decalButton, "spanx, wrap para");
|
||||
|
||||
//// Compress file
|
||||
// FIXME - if the user selects save decals, should we automatically select compress file?
|
||||
compressButton = new JCheckBox(trans.get("StorageOptChooser.checkbox.Compfile"));
|
||||
//// Using compression reduces the file size significantly.
|
||||
compressButton.setToolTipText(trans.get("StorageOptChooser.lbl.UsingComp"));
|
||||
compressButton.addActionListener(actionUpdater);
|
||||
this.add(compressButton, "spanx, wrap para");
|
||||
|
||||
|
||||
// Estimate is updated in loadOptions(opts)
|
||||
estimateLabel = new JLabel("");
|
||||
@ -176,8 +167,6 @@ public class StorageOptionChooser extends JPanel {
|
||||
timeSpinner.setValue(t);
|
||||
artificialEvent = false;
|
||||
|
||||
// Compression checkbox
|
||||
compressButton.setSelected(opts.isCompressionEnabled());
|
||||
decalButton.setSelected(opts.isIncludeDecals());
|
||||
|
||||
updateEstimate();
|
||||
@ -198,7 +187,6 @@ public class StorageOptionChooser extends JPanel {
|
||||
opts.setSimulationTimeSkip(t);
|
||||
|
||||
opts.setIncludeDecals(decalButton.isSelected());
|
||||
opts.setCompressionEnabled(compressButton.isSelected());
|
||||
|
||||
opts.setExplicitlySet(true);
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ public class RocksimConverter {
|
||||
try {
|
||||
StorageOptions opts = new StorageOptions();
|
||||
opts.setFileType(StorageOptions.FileType.OPENROCKET);
|
||||
opts.setCompressionEnabled(true);
|
||||
opts.setSimulationTimeSkip(StorageOptions.SIMULATION_DATA_NONE);
|
||||
opts.setExplicitlySet(true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user