[resolves #374] centering rings, bulkheads now display correctly
This commit is contained in:
parent
9c93ada83f
commit
9176e9fa61
@ -7,7 +7,7 @@ import net.sf.openrocket.startup.Application;
|
|||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
|
|
||||||
|
|
||||||
public class CenteringRing extends RadiusRingComponent implements LineInstanceable {
|
public class CenteringRing extends RadiusRingComponent {
|
||||||
|
|
||||||
public CenteringRing() {
|
public CenteringRing() {
|
||||||
setOuterRadiusAutomatic(true);
|
setOuterRadiusAutomatic(true);
|
||||||
@ -17,10 +17,6 @@ public class CenteringRing extends RadiusRingComponent implements LineInstanceab
|
|||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
protected int instanceCount = 1;
|
|
||||||
// front-front along the positive rocket axis. i.e. [1,0,0];
|
|
||||||
protected double instanceSeparation = 0;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getInnerRadius() {
|
public double getInnerRadius() {
|
||||||
@ -82,42 +78,5 @@ public class CenteringRing extends RadiusRingComponent implements LineInstanceab
|
|||||||
return ComponentPreset.Type.CENTERING_RING;
|
return ComponentPreset.Type.CENTERING_RING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getInstanceSeparation(){
|
|
||||||
return this.instanceSeparation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInstanceSeparation(final double _separation){
|
|
||||||
this.instanceSeparation = _separation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInstanceCount( final int newCount ){
|
|
||||||
if( 0 < newCount ){
|
|
||||||
this.instanceCount = newCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Coordinate[] getInstanceOffsets(){
|
|
||||||
Coordinate[] toReturn = new Coordinate[this.getInstanceCount()];
|
|
||||||
for ( int index=0 ; index < this.getInstanceCount(); index++){
|
|
||||||
toReturn[index] = this.position.setX( this.position.x + index*this.instanceSeparation );
|
|
||||||
}
|
|
||||||
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInstanceCount(){
|
|
||||||
return this.instanceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPatternName(){
|
|
||||||
return (this.getInstanceCount() + "-Line");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,15 @@ import net.sf.openrocket.util.MathUtil;
|
|||||||
*
|
*
|
||||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||||
*/
|
*/
|
||||||
public abstract class RadiusRingComponent extends RingComponent implements Coaxial {
|
public abstract class RadiusRingComponent extends RingComponent implements Coaxial, LineInstanceable {
|
||||||
|
|
||||||
protected double outerRadius = 0;
|
protected double outerRadius = 0;
|
||||||
protected double innerRadius = 0;
|
protected double innerRadius = 0;
|
||||||
|
|
||||||
|
protected int instanceCount = 1;
|
||||||
|
// front-front along the positive rocket axis. i.e. [1,0,0];
|
||||||
|
protected double instanceSeparation = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFromPreset(ComponentPreset preset) {
|
protected void loadFromPreset(ComponentPreset preset) {
|
||||||
super.loadFromPreset(preset);
|
super.loadFromPreset(preset);
|
||||||
@ -96,4 +100,42 @@ public abstract class RadiusRingComponent extends RingComponent implements Coaxi
|
|||||||
setInnerRadius(outer - thickness);
|
setInnerRadius(outer - thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getInstanceSeparation(){
|
||||||
|
return this.instanceSeparation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInstanceSeparation(final double _separation){
|
||||||
|
this.instanceSeparation = _separation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInstanceCount( final int newCount ){
|
||||||
|
if( 0 < newCount ){
|
||||||
|
this.instanceCount = newCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Coordinate[] getInstanceOffsets(){
|
||||||
|
Coordinate[] toReturn = new Coordinate[this.getInstanceCount()];
|
||||||
|
for ( int index=0 ; index < this.getInstanceCount(); index++){
|
||||||
|
toReturn[index] = new Coordinate( index*this.instanceSeparation, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInstanceCount(){
|
||||||
|
return this.instanceCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPatternName(){
|
||||||
|
return (this.getInstanceCount() + "-Line");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user