bugfix commits - fixed rearview display bug, implemented component.getPositionVector()
This commit is contained in:
parent
56dec21824
commit
0945961fc4
@ -967,6 +967,22 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public Coordinate getRelativePositionVector() {
|
||||
// ghetto version of this....
|
||||
return new Coordinate(this.getPositionValue(), 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public void setRelativePositionVector(final Coordinate _newPos) {
|
||||
// ghetto version of this....
|
||||
this.position = _newPos.x;
|
||||
}
|
||||
|
||||
/////////// Coordinate changes ///////////
|
||||
|
||||
|
@ -89,14 +89,17 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
|
||||
this.count = 1;
|
||||
}
|
||||
|
||||
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (this.isInline()) {
|
||||
return 1;
|
||||
} else {
|
||||
return this.count;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCount(final int _count) {
|
||||
@ -194,19 +197,25 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
|
||||
|
||||
@Override
|
||||
public Coordinate[] getInstanceOffsets() {
|
||||
if (this.isInline()) {
|
||||
return new Coordinate[] { new Coordinate(0, 0, 0) };
|
||||
}
|
||||
|
||||
Coordinate[] toReturn = new Coordinate[this.count];
|
||||
|
||||
double radius = this.radialPosition_m;
|
||||
double angle0 = this.angularPosition_rad;
|
||||
double angleIncr = this.angularSeparation;
|
||||
|
||||
System.err.println("Producing offsets list: ");
|
||||
double thisAngle = angle0;
|
||||
for (int instanceNumber = 0; instanceNumber < this.count; instanceNumber++) {
|
||||
|
||||
toReturn[instanceNumber] = new Coordinate(0, radius * Math.cos(thisAngle), radius * Math.sin(thisAngle));
|
||||
System.err.println(" instance#: " + instanceNumber + " = " + toReturn[instanceNumber]);
|
||||
thisAngle += angleIncr;
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,8 +47,10 @@ public class RingComponentShapes extends RocketComponentShape {
|
||||
}
|
||||
|
||||
|
||||
public static RocketComponentShape[] getShapesBack(net.sf.openrocket.rocketcomponent.RocketComponent component,
|
||||
Transformation transformation) {
|
||||
public static RocketComponentShape[] getShapesBack(
|
||||
net.sf.openrocket.rocketcomponent.RocketComponent component,
|
||||
Transformation transformation,
|
||||
Coordinate instanceOffset) {
|
||||
net.sf.openrocket.rocketcomponent.RingComponent tube = (net.sf.openrocket.rocketcomponent.RingComponent)component;
|
||||
Shape[] s;
|
||||
|
||||
@ -56,7 +58,7 @@ public class RingComponentShapes extends RocketComponentShape {
|
||||
double ir = tube.getInnerRadius();
|
||||
|
||||
|
||||
Coordinate[] start = transformation.transform(tube.toAbsolute(new Coordinate(0,0,0)));
|
||||
Coordinate[] start = transformation.transform(tube.toAbsolute(instanceOffset));
|
||||
|
||||
if ((ir < or) && (ir > 0)) {
|
||||
// Draw inner and outer
|
||||
|
@ -30,7 +30,6 @@ public class RocketComponentShape {
|
||||
this.color = null;
|
||||
this.lineStyle = null;
|
||||
this.component=null;
|
||||
|
||||
}
|
||||
|
||||
public RocketComponentShape( final Shape _shape, final RocketComponent _comp){
|
||||
|
@ -433,20 +433,15 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
RocketPanel.VIEW_TYPE viewType = this.currentViewType;
|
||||
Transformation viewTransform = this.transformation;
|
||||
|
||||
|
||||
// TODO: Implement actual locations in the components
|
||||
Coordinate componentLocation = new Coordinate(comp.getPositionValue(),0,0);
|
||||
Coordinate componentLocation = comp.getRelativePositionVector();
|
||||
|
||||
if( comp instanceof MultipleComponent ){
|
||||
MultipleComponent multi = (MultipleComponent)comp;
|
||||
int instanceCount;
|
||||
instanceCount = multi.getInstanceCount();
|
||||
|
||||
|
||||
// get m instance locations
|
||||
// get the offsets for m instances
|
||||
Coordinate[] instanceOffsets = multi.getInstanceOffsets();
|
||||
assert(false);
|
||||
assert( instanceOffsets.length == instanceCount );
|
||||
|
||||
// replicate n children m times each
|
||||
int childCount = comp.getChildCount();
|
||||
@ -466,7 +461,6 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
if( comp instanceof Rocket){
|
||||
// the Rocket doesn't have any graphics to get.
|
||||
|
Loading…
x
Reference in New Issue
Block a user