Remove a bunch of commented out code.
This commit is contained in:
parent
cec784d77e
commit
d9c0f68e64
@ -1,6 +1,5 @@
|
|||||||
package net.sf.openrocket.gui.plot;
|
package net.sf.openrocket.gui.plot;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -128,8 +127,8 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
DEFAULT_CONFIGURATIONS = configs.toArray(new PlotConfiguration[0]);
|
DEFAULT_CONFIGURATIONS = configs.toArray(new PlotConfiguration[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Bonus given for the first type being on the first axis */
|
/** Bonus given for the first type being on the first axis */
|
||||||
private static final double BONUS_FIRST_TYPE_ON_FIRST_AXIS = 1.0;
|
private static final double BONUS_FIRST_TYPE_ON_FIRST_AXIS = 1.0;
|
||||||
|
|
||||||
@ -145,11 +144,11 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
/** Bonus given for only using a single axis. */
|
/** Bonus given for only using a single axis. */
|
||||||
private static final double BONUS_ONLY_ONE_AXIS = 50.0;
|
private static final double BONUS_ONLY_ONE_AXIS = 50.0;
|
||||||
|
|
||||||
|
|
||||||
private static final double INCLUDE_ZERO_DISTANCE = 0.3; // 30% of total range
|
private static final double INCLUDE_ZERO_DISTANCE = 0.3; // 30% of total range
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The data types to be plotted. */
|
/** The data types to be plotted. */
|
||||||
private ArrayList<FlightDataType> plotDataTypes = new ArrayList<FlightDataType>();
|
private ArrayList<FlightDataType> plotDataTypes = new ArrayList<FlightDataType>();
|
||||||
|
|
||||||
@ -164,14 +163,14 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
private FlightDataType domainAxisType = null;
|
private FlightDataType domainAxisType = null;
|
||||||
private Unit domainAxisUnit = null;
|
private Unit domainAxisUnit = null;
|
||||||
|
|
||||||
|
|
||||||
/** All available axes. */
|
/** All available axes. */
|
||||||
private final int axesCount;
|
private final int axesCount;
|
||||||
private ArrayList<Axis> allAxes = new ArrayList<Axis>();
|
private ArrayList<Axis> allAxes = new ArrayList<Axis>();
|
||||||
|
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
|
|
||||||
public PlotConfiguration() {
|
public PlotConfiguration() {
|
||||||
this(null, FlightDataType.TYPE_TIME);
|
this(null, FlightDataType.TYPE_TIME);
|
||||||
}
|
}
|
||||||
@ -191,7 +190,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//// Axis
|
//// Axis
|
||||||
|
|
||||||
public FlightDataType getDomainAxisType() {
|
public FlightDataType getDomainAxisType() {
|
||||||
return domainAxisType;
|
return domainAxisType;
|
||||||
}
|
}
|
||||||
@ -221,7 +220,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//// FlightDataTypes
|
//// FlightDataTypes
|
||||||
|
|
||||||
public void addPlotDataType(FlightDataType type) {
|
public void addPlotDataType(FlightDataType type) {
|
||||||
plotDataTypes.add(type);
|
plotDataTypes.add(type);
|
||||||
plotDataUnits.add(type.getUnitGroup().getDefaultUnit());
|
plotDataUnits.add(type.getUnitGroup().getDefaultUnit());
|
||||||
@ -278,7 +277,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FlightDataType getType(int index) {
|
public FlightDataType getType(int index) {
|
||||||
return plotDataTypes.get(index);
|
return plotDataTypes.get(index);
|
||||||
}
|
}
|
||||||
@ -315,9 +314,9 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<Axis> getAllAxes() {
|
public List<Axis> getAllAxes() {
|
||||||
List<Axis> list = new ArrayList<Axis>();
|
List<Axis> list = new ArrayList<Axis>();
|
||||||
list.addAll(allAxes);
|
list.addAll(allAxes);
|
||||||
@ -342,7 +341,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the best combination of the auto-selectable axes.
|
* Find the best combination of the auto-selectable axes.
|
||||||
*
|
*
|
||||||
@ -357,8 +356,8 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively search for the best combination of the auto-selectable axes.
|
* Recursively search for the best combination of the auto-selectable axes.
|
||||||
* This is a brute-force search method.
|
* This is a brute-force search method.
|
||||||
@ -377,13 +376,13 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (autoindex >= plotDataAxes.size()) {
|
if (autoindex >= plotDataAxes.size()) {
|
||||||
// All axes have been assigned, just return since we are already the best
|
// All axes have been assigned, just return since we are already the best
|
||||||
return new Pair<PlotConfiguration, Double>(copy, copy.getGoodnessValue(data));
|
return new Pair<PlotConfiguration, Double>(copy, copy.getGoodnessValue(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the auto-selected index one at a time and choose the best one
|
// Set the auto-selected index one at a time and choose the best one
|
||||||
PlotConfiguration best = null;
|
PlotConfiguration best = null;
|
||||||
double bestValue = Double.NEGATIVE_INFINITY;
|
double bestValue = Double.NEGATIVE_INFINITY;
|
||||||
@ -400,9 +399,9 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fit the axes to hold the provided data. All of the plotDataAxis elements must
|
* Fit the axes to hold the provided data. All of the plotDataAxis elements must
|
||||||
* be non-negative.
|
* be non-negative.
|
||||||
@ -452,7 +451,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check whether to use a common zero
|
// Check whether to use a common zero
|
||||||
Axis left = allAxes.get(0);
|
Axis left = allAxes.get(0);
|
||||||
Axis right = allAxes.get(1);
|
Axis right = allAxes.get(1);
|
||||||
@ -462,8 +461,8 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
Double.isNaN(left.getMinValue()) || Double.isNaN(right.getMinValue()))
|
Double.isNaN(left.getMinValue()) || Double.isNaN(right.getMinValue()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// Compute common zero
|
//// Compute common zero
|
||||||
// TODO: MEDIUM: This algorithm may require tweaking
|
// TODO: MEDIUM: This algorithm may require tweaking
|
||||||
|
|
||||||
@ -474,7 +473,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
|
|
||||||
// Calculate and round scaling factor
|
// Calculate and round scaling factor
|
||||||
double scale = Math.max(left.getRangeLength(), right.getRangeLength()) /
|
double scale = Math.max(left.getRangeLength(), right.getRangeLength()) /
|
||||||
Math.min(left.getRangeLength(), right.getRangeLength());
|
Math.min(left.getRangeLength(), right.getRangeLength());
|
||||||
|
|
||||||
//System.out.println("Scale: " + scale);
|
//System.out.println("Scale: " + scale);
|
||||||
|
|
||||||
@ -494,54 +493,6 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
min2 /= scale;
|
min2 /= scale;
|
||||||
max2 /= scale;
|
max2 /= scale;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Scale to unit length
|
|
||||||
// double scale1 = left.getRangeLength();
|
|
||||||
// double scale2 = right.getRangeLength();
|
|
||||||
//
|
|
||||||
// double min1 = left.getMinValue() / scale1;
|
|
||||||
// double max1 = left.getMaxValue() / scale1;
|
|
||||||
// double min2 = right.getMinValue() / scale2;
|
|
||||||
// double max2 = right.getMaxValue() / scale2;
|
|
||||||
//
|
|
||||||
// // Combine unit ranges
|
|
||||||
// min1 = MathUtil.min(min1, min2);
|
|
||||||
// min2 = min1;
|
|
||||||
// max1 = MathUtil.max(max1, max2);
|
|
||||||
// max2 = max1;
|
|
||||||
//
|
|
||||||
// // Scale up
|
|
||||||
// min1 *= scale1;
|
|
||||||
// max1 *= scale1;
|
|
||||||
// min2 *= scale2;
|
|
||||||
// max2 *= scale2;
|
|
||||||
//
|
|
||||||
// // Compute common scale
|
|
||||||
// double range1 = max1-min1;
|
|
||||||
// double range2 = max2-min2;
|
|
||||||
//
|
|
||||||
// double scale = MathUtil.max(range1, range2) / MathUtil.min(range1, range2);
|
|
||||||
// double roundScale = roundScale(scale);
|
|
||||||
//
|
|
||||||
// if (range2 < range1) {
|
|
||||||
// if (roundScale < scale) {
|
|
||||||
// min2 = min1 / roundScale;
|
|
||||||
// max2 = max1 / roundScale;
|
|
||||||
// } else {
|
|
||||||
// min1 = min2 * roundScale;
|
|
||||||
// max1 = max2 * roundScale;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (roundScale > scale) {
|
|
||||||
// min2 = min1 * roundScale;
|
|
||||||
// max2 = max1 * roundScale;
|
|
||||||
// } else {
|
|
||||||
// min1 = min2 / roundScale;
|
|
||||||
// max1 = max2 / roundScale;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Apply scale
|
// Apply scale
|
||||||
left.addBound(min1);
|
left.addBound(min1);
|
||||||
left.addBound(max1);
|
left.addBound(max1);
|
||||||
@ -551,7 +502,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private double roundScale(double scale) {
|
private double roundScale(double scale) {
|
||||||
double mul = 1;
|
double mul = 1;
|
||||||
while (scale >= 10) {
|
while (scale >= 10) {
|
||||||
@ -580,7 +531,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private double roundScaleUp(double scale) {
|
private double roundScaleUp(double scale) {
|
||||||
double mul = 1;
|
double mul = 1;
|
||||||
@ -633,7 +584,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fits the axis ranges to the data and returns the "goodness value" of this
|
* Fits the axis ranges to the data and returns the "goodness value" of this
|
||||||
* selection of axes. All plotDataAxis elements must be non-null.
|
* selection of axes. All plotDataAxis elements must be non-null.
|
||||||
@ -675,11 +626,11 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
goodness += d * 100.0;
|
goodness += d * 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add extra points for specific things.
|
* Add extra points for specific things.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// A little for the first type being on the first axis
|
// A little for the first type being on the first axis
|
||||||
if (plotDataAxes.get(0) == 0)
|
if (plotDataAxes.get(0) == 0)
|
||||||
goodness += BONUS_FIRST_TYPE_ON_FIRST_AXIS;
|
goodness += BONUS_FIRST_TYPE_ON_FIRST_AXIS;
|
||||||
@ -703,7 +654,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the units of this configuration to the default units. Returns this
|
* Reset the units of this configuration to the default units. Returns this
|
||||||
* PlotConfiguration.
|
* PlotConfiguration.
|
||||||
@ -718,8 +669,8 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotConfiguration clone() {
|
public PlotConfiguration clone() {
|
||||||
try {
|
try {
|
||||||
@ -740,7 +691,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
|
|
||||||
|
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
throw new BugException("BUG! Could not clone().");
|
throw new BugException("BUG! Could not clone().");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user