Okay that didn't work...
This commit is contained in:
parent
1123a5d4ea
commit
ac663eb1c3
@ -282,40 +282,38 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
Color borderColor = ((SwingPreferences)Application.getPreferences()).getMotorBorderColor();
|
Color borderColor = ((SwingPreferences)Application.getPreferences()).getMotorBorderColor();
|
||||||
|
|
||||||
FlightConfiguration config = rocket.getSelectedConfiguration();
|
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
Iterator<MotorConfiguration> itr = config.getActiveMotors().iterator();
|
for (MotorConfiguration curInstance : config.getActiveMotors()) {
|
||||||
while (itr.hasNext()) {
|
|
||||||
MotorConfiguration curInstance = itr.next();
|
|
||||||
MotorMount mount = curInstance.getMount();
|
MotorMount mount = curInstance.getMount();
|
||||||
Motor motor = curInstance.getMotor();
|
Motor motor = curInstance.getMotor();
|
||||||
double motorLength = motor.getLength();
|
double motorLength = motor.getLength();
|
||||||
double motorRadius = motor.getDiameter() / 2;
|
double motorRadius = motor.getDiameter() / 2;
|
||||||
RocketComponent mountComponent = ((RocketComponent) mount);
|
RocketComponent mountComponent = ((RocketComponent) mount);
|
||||||
|
|
||||||
// <component>.getLocation() will return all the parent instances of this owning component, AND all of it's own instances as well.
|
// <component>.getLocation() will return all the parent instances of this owning component, AND all of it's own instances as well.
|
||||||
// so, just draw a motor once for each Coordinate returned...
|
// so, just draw a motor once for each Coordinate returned...
|
||||||
Coordinate[] mountLocations = mount.getLocations();
|
Coordinate[] mountLocations = mount.getLocations();
|
||||||
|
|
||||||
double mountLength = mountComponent.getLength();
|
double mountLength = mountComponent.getLength();
|
||||||
// System.err.println("Drawing Motor: "+motor.getDesignation()+" (x"+mountLocations.length+")");
|
// System.err.println("Drawing Motor: "+motor.getDesignation()+" (x"+mountLocations.length+")");
|
||||||
for ( Coordinate curMountLocation : mountLocations ){
|
for (Coordinate curMountLocation : mountLocations) {
|
||||||
Coordinate curMotorLocation = curMountLocation.add( mountLength - motorLength + mount.getMotorOverhang(), 0, 0);
|
Coordinate curMotorLocation = curMountLocation.add(mountLength - motorLength + mount.getMotorOverhang(), 0, 0);
|
||||||
// System.err.println(String.format(" mount instance: %s => %s", curMountLocation.toString(), curMotorLocation.toString() ));
|
// System.err.println(String.format(" mount instance: %s => %s", curMountLocation.toString(), curMotorLocation.toString() ));
|
||||||
|
|
||||||
// rotate by figure's axial rotation:
|
// rotate by figure's axial rotation:
|
||||||
curMotorLocation = this.axialRotation.transform(curMotorLocation);
|
curMotorLocation = this.axialRotation.transform(curMotorLocation);
|
||||||
|
|
||||||
{
|
{
|
||||||
Shape s;
|
Shape s;
|
||||||
if (currentViewType == RocketPanel.VIEW_TYPE.SideView) {
|
if (currentViewType == RocketPanel.VIEW_TYPE.SideView) {
|
||||||
s = new Rectangle2D.Double( curMotorLocation.x,
|
s = new Rectangle2D.Double(curMotorLocation.x,
|
||||||
(curMotorLocation.y - motorRadius),
|
(curMotorLocation.y - motorRadius),
|
||||||
motorLength,
|
motorLength,
|
||||||
2 * motorRadius);
|
2 * motorRadius);
|
||||||
} else {
|
} else {
|
||||||
s = new Ellipse2D.Double((curMotorLocation.z - motorRadius),
|
s = new Ellipse2D.Double((curMotorLocation.z - motorRadius),
|
||||||
(curMotorLocation.y - motorRadius),
|
(curMotorLocation.y - motorRadius),
|
||||||
2 * motorRadius,
|
2 * motorRadius,
|
||||||
2 * motorRadius);
|
2 * motorRadius);
|
||||||
}
|
}
|
||||||
g2.setColor(fillColor);
|
g2.setColor(fillColor);
|
||||||
g2.fill(s);
|
g2.fill(s);
|
||||||
@ -381,9 +379,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
// allShapes is an output buffer -- it stores all the generated shapes
|
// allShapes is an output buffer -- it stores all the generated shapes
|
||||||
allShapes.clear();
|
allShapes.clear();
|
||||||
|
|
||||||
Iterator<Entry<RocketComponent, ArrayList<InstanceContext>>> itr = config.getActiveInstances().entrySet().iterator();
|
for (Entry<RocketComponent, ArrayList<InstanceContext>> entry : config.getActiveInstances().entrySet()) {
|
||||||
while (itr.hasNext()) {
|
|
||||||
Entry<RocketComponent, ArrayList<InstanceContext>> entry = itr.next();
|
|
||||||
final RocketComponent comp = entry.getKey();
|
final RocketComponent comp = entry.getKey();
|
||||||
|
|
||||||
// Only draw podsets when they are selected
|
// Only draw podsets when they are selected
|
||||||
@ -399,14 +395,14 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
}
|
}
|
||||||
if (!selected) continue;
|
if (!selected) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<InstanceContext> contextList = entry.getValue();
|
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||||
|
|
||||||
for(InstanceContext context: contextList ) {
|
for (InstanceContext context : contextList) {
|
||||||
final Transformation currentTransform = this.axialRotation.applyTransformation(context.transform);
|
final Transformation currentTransform = this.axialRotation.applyTransformation(context.transform);
|
||||||
allShapes = addThisShape( allShapes, this.currentViewType, comp, currentTransform);
|
allShapes = addThisShape(allShapes, this.currentViewType, comp, currentTransform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user