[#1655] Use minimum mount bounds for origin updating
This fixes issues when fins on a nose cone/transition are used.
This commit is contained in:
parent
8edfc5d591
commit
f529d3ee8b
@ -55,7 +55,8 @@ public class FinPointFigure extends AbstractScaleFigure {
|
|||||||
|
|
||||||
protected BoundingBox finBounds_m = null;
|
protected BoundingBox finBounds_m = null;
|
||||||
// Fin parent bounds
|
// Fin parent bounds
|
||||||
protected BoundingBox mountBounds_m = null;
|
protected BoundingBox mountBoundsMax_m = null; // Bounds using the maximum parent radius
|
||||||
|
protected BoundingBox mountBoundsMin_m = null; // Bound using the minimum parent radius
|
||||||
|
|
||||||
protected final List<StateChangeListener> listeners = new LinkedList<>();
|
protected final List<StateChangeListener> listeners = new LinkedList<>();
|
||||||
|
|
||||||
@ -205,11 +206,11 @@ public class FinPointFigure extends AbstractScaleFigure {
|
|||||||
|
|
||||||
private void paintBodyTube( Graphics2D g2){
|
private void paintBodyTube( Graphics2D g2){
|
||||||
// in-figure left extent
|
// in-figure left extent
|
||||||
final double xFore = mountBounds_m.min.x;
|
final double xFore = mountBoundsMax_m.min.x;
|
||||||
// in-figure right extent
|
// in-figure right extent
|
||||||
final double xAft = mountBounds_m.max.x;
|
final double xAft = mountBoundsMax_m.max.x;
|
||||||
// in-figure right extent
|
// in-figure right extent
|
||||||
final double yCenter = mountBounds_m.min.y;
|
final double yCenter = mountBoundsMax_m.min.y;
|
||||||
|
|
||||||
Path2D.Double shape = new Path2D.Double();
|
Path2D.Double shape = new Path2D.Double();
|
||||||
shape.moveTo( xFore, yCenter );
|
shape.moveTo( xFore, yCenter );
|
||||||
@ -374,13 +375,17 @@ public class FinPointFigure extends AbstractScaleFigure {
|
|||||||
final double xFinFront = finset.getAxialOffset(AxialMethod.TOP);
|
final double xFinFront = finset.getAxialOffset(AxialMethod.TOP);
|
||||||
final double xParent = -xFinFront;
|
final double xParent = -xFinFront;
|
||||||
final double yParent = -parent.getRadius(xParent); // from fin-front to parent centerline
|
final double yParent = -parent.getRadius(xParent); // from fin-front to parent centerline
|
||||||
final double rParent = Math.max(parent.getForeRadius(), parent.getAftRadius());
|
final double rParentMax = Math.max(parent.getForeRadius(), parent.getAftRadius());
|
||||||
|
final double rParentMin = Math.min(parent.getForeRadius(), parent.getAftRadius());
|
||||||
|
|
||||||
mountBounds_m = new BoundingBox()
|
mountBoundsMax_m = new BoundingBox()
|
||||||
.update(new Coordinate(xParent, yParent, 0))
|
.update(new Coordinate(xParent, yParent, 0))
|
||||||
.update(new Coordinate(xParent + parent.getLength(), yParent + rParent));
|
.update(new Coordinate(xParent + parent.getLength(), yParent + rParentMax));
|
||||||
|
mountBoundsMin_m = new BoundingBox()
|
||||||
|
.update(new Coordinate(xParent, yParent, 0))
|
||||||
|
.update(new Coordinate(xParent + parent.getLength(), yParent + rParentMin));
|
||||||
|
|
||||||
final BoundingBox combinedBounds = new BoundingBox().update(finBounds_m).update(mountBounds_m);
|
final BoundingBox combinedBounds = new BoundingBox().update(finBounds_m).update(mountBoundsMax_m);
|
||||||
|
|
||||||
contentBounds_m = combinedBounds.toRectangle();
|
contentBounds_m = combinedBounds.toRectangle();
|
||||||
}
|
}
|
||||||
@ -388,7 +393,7 @@ public class FinPointFigure extends AbstractScaleFigure {
|
|||||||
@Override
|
@Override
|
||||||
protected void updateCanvasOrigin() {
|
protected void updateCanvasOrigin() {
|
||||||
final int finBottomPy = (int)(finBounds_m.max.y*scale);
|
final int finBottomPy = (int)(finBounds_m.max.y*scale);
|
||||||
final int mountHeight = (int)(mountBounds_m.span().y*scale);
|
final int mountHeight = (int)(mountBoundsMin_m.span().y*scale);
|
||||||
// this is non-intuitive: it's an offset _from_ the origin(0,0) _to_ the lower-left of the content --
|
// this is non-intuitive: it's an offset _from_ the origin(0,0) _to_ the lower-left of the content --
|
||||||
// because the canvas is drawn from that lower-left corner of the content, and the fin-front
|
// because the canvas is drawn from that lower-left corner of the content, and the fin-front
|
||||||
// is fixed-- by definition-- to the origin.
|
// is fixed-- by definition-- to the origin.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user