refined xml tags for InnerTube

This commit is contained in:
Daniel_M_Williams 2015-12-06 16:16:20 -05:00
parent 1988ee4266
commit 0308d8d0c6
7 changed files with 27 additions and 8 deletions

View File

@ -333,8 +333,6 @@ class DocumentConfig {
setters.put("InnerTube:clusterrotation", new DoubleSetter( setters.put("InnerTube:clusterrotation", new DoubleSetter(
Reflection.findMethod(InnerTube.class, "setClusterRotation", double.class), Reflection.findMethod(InnerTube.class, "setClusterRotation", double.class),
Math.PI / 180.0)); Math.PI / 180.0));
setters.put("InnerTube:instancecount", new IntSetter(
Reflection.findMethod(InnerTube.class, "setInstanceCount",int.class)));
// RadiusRingComponent // RadiusRingComponent

View File

@ -14,6 +14,7 @@ import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.motor.MotorInstance; import net.sf.openrocket.motor.MotorInstance;
import net.sf.openrocket.motor.ThrustCurveMotor; import net.sf.openrocket.motor.ThrustCurveMotor;
import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.rocketcomponent.Clusterable;
import net.sf.openrocket.rocketcomponent.ComponentAssembly; import net.sf.openrocket.rocketcomponent.ComponentAssembly;
import net.sf.openrocket.rocketcomponent.FlightConfigurationID; import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
import net.sf.openrocket.rocketcomponent.Instanceable; import net.sf.openrocket.rocketcomponent.Instanceable;
@ -85,14 +86,17 @@ public class RocketComponentSaver {
if ( c instanceof Instanceable) { if ( c instanceof Instanceable) {
int instanceCount = c.getInstanceCount(); int instanceCount = c.getInstanceCount();
if( 1 < instanceCount ){ if( 1 < instanceCount ){
emitString( elements, "instancecount", Integer.toString( c.getInstanceCount()) ); if( c instanceof Clusterable ){
; // no-op. Instance counts are set via named cluster configurations
}
if( c instanceof LineInstanceable ){ if( c instanceof LineInstanceable ){
LineInstanceable line = (LineInstanceable)c; LineInstanceable line = (LineInstanceable)c;
emitDouble( elements, "linseparation", line.getInstanceSeparation()); emitString( elements, "instancecount", Integer.toString( c.getInstanceCount()) );
emitDouble( elements, "linseparation", line.getInstanceSeparation());
} }
if( c instanceof RingInstanceable){ if( c instanceof RingInstanceable){
RingInstanceable ring = (RingInstanceable)c; RingInstanceable ring = (RingInstanceable)c;
if(( c instanceof ParallelStage )&&( ((ParallelStage)c).getAutoRadialOffset() )){ if( ring.getAutoRadialOffset() ){
emitString(elements, "radialoffset", "auto"); emitString(elements, "radialoffset", "auto");
}else{ }else{
emitDouble( elements, "radialoffset", ring.getRadialOffset() ); emitDouble( elements, "radialoffset", ring.getRadialOffset() );

View File

@ -464,11 +464,19 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
} }
public int getMotorCount() { public int getMotorCount() {
return getAllMotorCount();
}
public int getActiveMotorCount(){
return getActiveMotors().size();
}
public int getAllMotorCount(){
return motors.size(); return motors.size();
} }
public Set<MotorInstanceId> getMotorIDs() { public Set<MotorInstanceId> getMotorIDs() {
return this.motors.keySet(); return motors.keySet();
} }
public MotorInstance getMotorInstance(MotorInstanceId id) { public MotorInstance getMotorInstance(MotorInstanceId id) {

View File

@ -151,7 +151,9 @@ public class InnerTube extends ThicknessRingComponent implements Clusterable, Ra
@Override @Override
public void setInstanceCount( final int newCount ){ public void setInstanceCount( final int newCount ){
log.error("Programmer Error: cannot set the instance count of an "+this.getClass().getSimpleName()+" directly. Please set setClusterConfiguration(ClusterConfiguration) instead."); log.error("Programmer Error: cannot set the instance count of an InnerTube directly."+
" Please set setClusterConfiguration(ClusterConfiguration) instead.",
new UnsupportedOperationException("InnerTube.setInstanceCount(..) on an"+this.getClass().getSimpleName()));
} }
/** /**

View File

@ -191,6 +191,7 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo
return this.getAxialOffset(); return this.getAxialOffset();
} }
@Override
public boolean getAutoRadialOffset(){ public boolean getAutoRadialOffset(){
return this.autoRadialPosition; return this.autoRadialPosition;
} }

View File

@ -189,6 +189,10 @@ public class PodSet extends ComponentAssembly implements RingInstanceable {
return this.radialPosition_m; return this.radialPosition_m;
} }
@Override
public boolean getAutoRadialOffset(){
return false;
}
@Override @Override
public int getInstanceCount() { public int getInstanceCount() {

View File

@ -6,6 +6,8 @@ public interface RingInstanceable extends Instanceable {
public double getRadialOffset(); public double getRadialOffset();
public boolean getAutoRadialOffset();
public void setAngularOffset(final double angle); public void setAngularOffset(final double angle);
public void setRadialOffset(final double radius); public void setRadialOffset(final double radius);