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