Merge pull request #2049 from SiboVG/issue-2047

[#2047] Fix pod set & booster markers
This commit is contained in:
Sibo Van Gool 2023-02-21 23:32:18 +01:00 committed by GitHub
commit 98dccd868a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 8 deletions

View File

@ -181,10 +181,8 @@ public abstract class ComponentAssembly extends RocketComponent implements Axial
public void updateBounds() { public void updateBounds() {
// currently only updates the length // currently only updates the length
this.length = 0; this.length = 0;
Iterator<RocketComponent> childIterator = this.getChildren().iterator(); for (RocketComponent curChild : this.getChildren()) {
while (childIterator.hasNext()) { if (curChild.isAfter()) {
RocketComponent curChild = childIterator.next();
if(curChild.isAfter()){
this.length += curChild.getLength(); this.length += curChild.getLength();
} }
} }

View File

@ -6,6 +6,7 @@ import net.sf.openrocket.rocketcomponent.ParallelStage;
import net.sf.openrocket.rocketcomponent.PodSet; import net.sf.openrocket.rocketcomponent.PodSet;
import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.position.AxialMethod; import net.sf.openrocket.rocketcomponent.position.AxialMethod;
import net.sf.openrocket.rocketcomponent.position.RadiusMethod;
import net.sf.openrocket.util.Color; import net.sf.openrocket.util.Color;
import net.sf.openrocket.util.Transformation; import net.sf.openrocket.util.Transformation;
@ -30,8 +31,10 @@ public class ComponentAssemblyShapes extends RocketComponentShape {
} }
// Correct the radius to be at the "reference point" dictated by the component's radius offset. // Correct the radius to be at the "reference point" dictated by the component's radius offset.
double boundingRadius = assembly.getBoundingRadius(); if (assembly.getRadiusMethod() == RadiusMethod.RELATIVE) {
correctedTransform = correctedTransform.applyTransformation(new Transformation(0, -boundingRadius, 0)); double boundingRadius = assembly.getBoundingRadius();
correctedTransform = correctedTransform.applyTransformation(new Transformation(0, -boundingRadius, 0));
}
double markerRadius = getDisplayRadius(component); double markerRadius = getDisplayRadius(component);
Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(correctedTransform, markerRadius); Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(correctedTransform, markerRadius);
@ -55,8 +58,11 @@ public class ComponentAssemblyShapes extends RocketComponentShape {
ComponentAssembly assembly = (ComponentAssembly) component; ComponentAssembly assembly = (ComponentAssembly) component;
// Correct the radius to be at the "reference point" dictated by the component's radius offset. // Correct the radius to be at the "reference point" dictated by the component's radius offset.
double boundingRadius = assembly.getBoundingRadius(); Transformation correctedTransform = transformation;
Transformation correctedTransform = transformation.applyTransformation(new Transformation(0, -boundingRadius, 0)); if (assembly.getRadiusMethod() == RadiusMethod.RELATIVE) {
double boundingRadius = assembly.getBoundingRadius();
correctedTransform = correctedTransform.applyTransformation(new Transformation(0, -boundingRadius, 0));
}
double markerRadius = getDisplayRadius(component); double markerRadius = getDisplayRadius(component);
Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(correctedTransform, markerRadius); Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(correctedTransform, markerRadius);

View File

@ -0,0 +1,5 @@
package net.sf.openrocket.gui.rocketfigure;
public class ParallelStageShapes extends ComponentAssemblyShapes {
// Everything is handled by the ComponentAssemblyShapes class.
}

View File

@ -0,0 +1,5 @@
package net.sf.openrocket.gui.rocketfigure;
public class PodSetShapes extends ComponentAssemblyShapes {
// Everything is handled by the ComponentAssemblyShapes class.
}