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(
Reflection.findMethod(InnerTube.class, "setClusterRotation", double.class),
Math.PI / 180.0));
setters.put("InnerTube:instancecount", new IntSetter(
Reflection.findMethod(InnerTube.class, "setInstanceCount",int.class)));
// RadiusRingComponent

View File

@ -14,6 +14,7 @@ import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.motor.MotorInstance;
import net.sf.openrocket.motor.ThrustCurveMotor;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.rocketcomponent.Clusterable;
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
import net.sf.openrocket.rocketcomponent.Instanceable;
@ -85,14 +86,17 @@ public class RocketComponentSaver {
if ( c instanceof Instanceable) {
int instanceCount = c.getInstanceCount();
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 ){
LineInstanceable line = (LineInstanceable)c;
emitDouble( elements, "linseparation", line.getInstanceSeparation());
LineInstanceable line = (LineInstanceable)c;
emitString( elements, "instancecount", Integer.toString( c.getInstanceCount()) );
emitDouble( elements, "linseparation", line.getInstanceSeparation());
}
if( c instanceof RingInstanceable){
RingInstanceable ring = (RingInstanceable)c;
if(( c instanceof ParallelStage )&&( ((ParallelStage)c).getAutoRadialOffset() )){
if( ring.getAutoRadialOffset() ){
emitString(elements, "radialoffset", "auto");
}else{
emitDouble( elements, "radialoffset", ring.getRadialOffset() );

View File

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

View File

@ -151,7 +151,9 @@ public class InnerTube extends ThicknessRingComponent implements Clusterable, Ra
@Override
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();
}
@Override
public boolean getAutoRadialOffset(){
return this.autoRadialPosition;
}

View File

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

View File

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