[rm] excised EXTRA_SCALE (==S) factor in ScaleFigure Code
This commit is contained in:
parent
885df6ce04
commit
87b1f99a9b
@ -34,9 +34,9 @@ public class FinSetShapes extends RocketComponentShape {
|
||||
Coordinate c = finSetFront.add(finPoints[i]);
|
||||
|
||||
if (i==0)
|
||||
p.moveTo(c.x*S, c.y*S);
|
||||
p.moveTo(c.x, c.y);
|
||||
else
|
||||
p.lineTo(c.x*S, c.y*S);
|
||||
p.lineTo(c.x, c.y);
|
||||
}
|
||||
|
||||
p.closePath();
|
||||
@ -87,13 +87,13 @@ public class FinSetShapes extends RocketComponentShape {
|
||||
Path2D.Double p = new Path2D.Double();
|
||||
|
||||
a = finFront.add( c[0] );
|
||||
p.moveTo(a.z*S, a.y*S);
|
||||
p.moveTo(a.z, a.y);
|
||||
a = finFront.add( c[1] );
|
||||
p.lineTo(a.z*S, a.y*S);
|
||||
p.lineTo(a.z, a.y);
|
||||
a = finFront.add( c[2] );
|
||||
p.lineTo(a.z*S, a.y*S);
|
||||
p.lineTo(a.z, a.y);
|
||||
a = finFront.add( c[3] );
|
||||
p.lineTo(a.z*S, a.y*S);
|
||||
p.lineTo(a.z, a.y);
|
||||
p.closePath();
|
||||
|
||||
return new Shape[]{p};
|
||||
@ -190,9 +190,9 @@ public class FinSetShapes extends RocketComponentShape {
|
||||
for (int i=0; i < array.length; i++) {
|
||||
Coordinate a = t.transform(compCenter.add( array[i]) );
|
||||
if (i==0)
|
||||
p.moveTo(a.z*S, a.y*S);
|
||||
p.moveTo(a.z, a.y);
|
||||
else
|
||||
p.lineTo(a.z*S, a.y*S);
|
||||
p.lineTo(a.z, a.y);
|
||||
}
|
||||
p.closePath();
|
||||
return p;
|
||||
|
@ -30,8 +30,7 @@ public class MassComponentShapes extends RocketComponentShape {
|
||||
|
||||
Coordinate start = transformation.transform( componentAbsoluteLocation);
|
||||
Shape[] s = new Shape[1];
|
||||
s[0] = new RoundRectangle2D.Double(start.x*S,(start.y-radius)*S,
|
||||
length*S,2*radius*S,arc*S,arc*S);
|
||||
s[0] = new RoundRectangle2D.Double(start.x, (start.y-radius), length, 2*radius, arc, arc);
|
||||
|
||||
switch (type) {
|
||||
case ALTIMETER:
|
||||
@ -75,7 +74,7 @@ public class MassComponentShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[start.length];
|
||||
for (int i=0; i < start.length; i++) {
|
||||
s[i] = new Ellipse2D.Double((start[i].z-or)*S,(start[i].y-or)*S,2*or*S,2*or*S);
|
||||
s[i] = new Ellipse2D.Double((start[i].z-or),(start[i].y-or),2*or,2*or);
|
||||
}
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ public class MassObjectShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[start.length];
|
||||
for (int i=0; i < start.length; i++) {
|
||||
s[i] = new RoundRectangle2D.Double(start[i].x*S,(start[i].y-radius)*S,
|
||||
length*S,2*radius*S,arc*S,arc*S);
|
||||
s[i] = new RoundRectangle2D.Double(start[i].x,(start[i].y-radius),
|
||||
length,2*radius,arc,arc);
|
||||
}
|
||||
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
@ -44,7 +44,7 @@ public class MassObjectShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[start.length];
|
||||
for (int i=0; i < start.length; i++) {
|
||||
s[i] = new Ellipse2D.Double((start[i].z-or)*S,(start[i].y-or)*S,2*or*S,2*or*S);
|
||||
s[i] = new Ellipse2D.Double((start[i].z-or),(start[i].y-or),2*or,2*or);
|
||||
}
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ public class ParachuteShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[start.length];
|
||||
for (int i=0; i < start.length; i++) {
|
||||
s[i] = new RoundRectangle2D.Double(start[i].x*S,(start[i].y-radius)*S,
|
||||
length*S,2*radius*S,arc*S,arc*S);
|
||||
s[i] = new RoundRectangle2D.Double(start[i].x, (start[i].y-radius), length, 2*radius, arc, arc);
|
||||
}
|
||||
return RocketComponentShape.toArray( addSymbol(s), component);
|
||||
}
|
||||
@ -46,7 +45,7 @@ public class ParachuteShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[start.length];
|
||||
for (int i=0; i < start.length; i++) {
|
||||
s[i] = new Ellipse2D.Double((start[i].z-or)*S,(start[i].y-or)*S,2*or*S,2*or*S);
|
||||
s[i] = new Ellipse2D.Double((start[i].z-or),(start[i].y-or),2*or,2*or);
|
||||
}
|
||||
return RocketComponentShape.toArray( s, component);
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ public class RailButtonShapes extends RocketComponentShape {
|
||||
final double drawHeight = outerDiameter*sinr;
|
||||
final Point2D.Double center = new Point2D.Double( instanceAbsoluteLocation.x, instanceAbsoluteLocation.y );
|
||||
Point2D.Double lowerLeft = new Point2D.Double( center.x - outerRadius, center.y-outerRadius*sinr);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x*S, lowerLeft.y*S, drawWidth*S, drawHeight*S), false);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x, lowerLeft.y, drawWidth, drawHeight), false);
|
||||
|
||||
path.append( new Line2D.Double( lowerLeft.x*S, center.y*S, lowerLeft.x*S, (center.y+baseHeightcos)*S ), false);
|
||||
path.append( new Line2D.Double( (center.x+outerRadius)*S, center.y*S, (center.x+outerRadius)*S, (center.y+baseHeightcos)*S ), false);
|
||||
path.append( new Line2D.Double( lowerLeft.x, center.y, lowerLeft.x, (center.y+baseHeightcos) ), false);
|
||||
path.append( new Line2D.Double( (center.x+outerRadius), center.y, (center.x+outerRadius), (center.y+baseHeightcos) ), false);
|
||||
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x*S, (lowerLeft.y+baseHeightcos)*S, drawWidth*S, drawHeight*S), false);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x, (lowerLeft.y+baseHeightcos), drawWidth, drawHeight), false);
|
||||
}
|
||||
|
||||
{// inner
|
||||
@ -56,24 +56,24 @@ public class RailButtonShapes extends RocketComponentShape {
|
||||
final double drawHeight = innerDiameter*sinr;
|
||||
final Point2D.Double center = new Point2D.Double( instanceAbsoluteLocation.x, instanceAbsoluteLocation.y + baseHeightcos);
|
||||
final Point2D.Double lowerLeft = new Point2D.Double( center.x - innerRadius, center.y-innerRadius*sinr);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x*S, lowerLeft.y*S, drawWidth*S, drawHeight*S), false);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x, lowerLeft.y, drawWidth, drawHeight), false);
|
||||
|
||||
path.append( new Line2D.Double( lowerLeft.x*S, center.y*S, lowerLeft.x*S, (center.y+innerHeightcos)*S ), false);
|
||||
path.append( new Line2D.Double( (center.x+innerRadius)*S, center.y*S, (center.x+innerRadius)*S, (center.y+innerHeightcos)*S ), false);
|
||||
path.append( new Line2D.Double( lowerLeft.x, center.y, lowerLeft.x, (center.y+innerHeightcos) ), false);
|
||||
path.append( new Line2D.Double( (center.x+innerRadius), center.y, (center.x+innerRadius), (center.y+innerHeightcos) ), false);
|
||||
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x*S, (lowerLeft.y+innerHeightcos)*S, drawWidth*S, drawHeight*S), false);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x, (lowerLeft.y+innerHeightcos), drawWidth, drawHeight), false);
|
||||
}
|
||||
{// outer flange
|
||||
final double drawWidth = outerDiameter;
|
||||
final double drawHeight = outerDiameter*sinr;
|
||||
final Point2D.Double center = new Point2D.Double( instanceAbsoluteLocation.x, instanceAbsoluteLocation.y+baseHeightcos+innerHeightcos);
|
||||
final Point2D.Double lowerLeft = new Point2D.Double( center.x - outerRadius, center.y-outerRadius*sinr);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x*S, lowerLeft.y*S, drawWidth*S, drawHeight*S), false);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x, lowerLeft.y, drawWidth, drawHeight), false);
|
||||
|
||||
path.append( new Line2D.Double( lowerLeft.x*S, center.y*S, lowerLeft.x*S, (center.y+flangeHeightcos)*S ), false);
|
||||
path.append( new Line2D.Double( (center.x+outerRadius)*S, center.y*S, (center.x+outerRadius)*S, (center.y+flangeHeightcos)*S ), false);
|
||||
path.append( new Line2D.Double( lowerLeft.x, center.y, lowerLeft.x, (center.y+flangeHeightcos) ), false);
|
||||
path.append( new Line2D.Double( (center.x+outerRadius), center.y, (center.x+outerRadius), (center.y+flangeHeightcos) ), false);
|
||||
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x*S, (lowerLeft.y+flangeHeightcos)*S, drawWidth*S, drawHeight*S), false);
|
||||
path.append( new Ellipse2D.Double( lowerLeft.x, (lowerLeft.y+flangeHeightcos), drawWidth, drawHeight), false);
|
||||
}
|
||||
|
||||
return RocketComponentShape.toArray( new Shape[]{ path }, component );
|
||||
@ -131,10 +131,10 @@ public class RailButtonShapes extends RocketComponentShape {
|
||||
final double sinr = Math.sin(angle_rad);
|
||||
final double cosr = Math.cos(angle_rad);
|
||||
|
||||
rect.moveTo( (x-radius*cosr)*S, (y+radius*sinr)*S);
|
||||
rect.lineTo( (x-radius*cosr+height*sinr)*S, (y+radius*sinr+height*cosr)*S);
|
||||
rect.lineTo( (x+radius*cosr+height*sinr)*S, (y-radius*sinr+height*cosr)*S);
|
||||
rect.lineTo( (x+radius*cosr)*S, (y-radius*sinr)*S);
|
||||
rect.moveTo( (x-radius*cosr), (y+radius*sinr));
|
||||
rect.lineTo( (x-radius*cosr+height*sinr), (y+radius*sinr+height*cosr));
|
||||
rect.lineTo( (x+radius*cosr+height*sinr), (y-radius*sinr+height*cosr));
|
||||
rect.lineTo( (x+radius*cosr), (y-radius*sinr));
|
||||
rect.closePath();
|
||||
// add points
|
||||
|
||||
|
@ -16,8 +16,6 @@ import net.sf.openrocket.util.Transformation;
|
||||
*/
|
||||
public class RocketComponentShape {
|
||||
|
||||
protected static final double S = RocketFigure.EXTRA_SCALE;
|
||||
|
||||
final public boolean hasShape;
|
||||
final public Shape shape;
|
||||
final public net.sf.openrocket.util.Color color;
|
||||
|
@ -25,8 +25,8 @@ public class ShockCordShapes extends RocketComponentShape {
|
||||
|
||||
Coordinate start = transformation.transform( componentAbsoluteLocation);
|
||||
Shape[] s = new Shape[1];
|
||||
s[0] = new RoundRectangle2D.Double(start.x*S,(start.y-radius)*S,
|
||||
length*S,2*radius*S,arc*S,arc*S);
|
||||
s[0] = new RoundRectangle2D.Double(start.x,(start.y-radius),
|
||||
length,2*radius,arc,arc);
|
||||
|
||||
return RocketComponentShape.toArray( addSymbol(s), component);
|
||||
}
|
||||
@ -43,13 +43,13 @@ public class ShockCordShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[1];
|
||||
Coordinate start = componentAbsoluteLocation;
|
||||
s[0] = new Ellipse2D.Double((start.z-or)*S,(start.y-or)*S,2*or*S,2*or*S);
|
||||
s[0] = new Ellipse2D.Double((start.z-or),(start.y-or),2*or,2*or);
|
||||
|
||||
// Coordinate[] start = transformation.transform(tube.toAbsolute(instanceOffset));
|
||||
//
|
||||
// Shape[] s = new Shape[start.length];
|
||||
// for (int i=0; i < start.length; i++) {
|
||||
// s[i] = new Ellipse2D.Double((start[i].z-or)*S,(start[i].y-or)*S,2*or*S,2*or*S);
|
||||
// s[i] = new Ellipse2D.Double((start[i].z-or),(start[i].y-or),2*or,2*or);
|
||||
// }
|
||||
return RocketComponentShape.toArray( s, component);
|
||||
}
|
||||
|
@ -24,14 +24,14 @@ public class StreamerShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[1];
|
||||
Coordinate frontCenter = componentAbsoluteLocation;
|
||||
s[0] = new RoundRectangle2D.Double((frontCenter.x)*S,(frontCenter.y-radius)*S,
|
||||
length*S,2*radius*S,arc*S,arc*S);
|
||||
s[0] = new RoundRectangle2D.Double((frontCenter.x),(frontCenter.y-radius),
|
||||
length,2*radius,arc,arc);
|
||||
|
||||
// Coordinate[] start = transformation.transform(tube.toAbsolute(instanceOffset));
|
||||
// Shape[] s = new Shape[start.length];
|
||||
// for (int i=0; i < start.length; i++) {
|
||||
// s[i] = new RoundRectangle2D.Double(start[i].x*S,(start[i].y-radius)*S,
|
||||
// length*S,2*radius*S,arc*S,arc*S);
|
||||
// s[i] = new RoundRectangle2D.Double(start[i].x,(start[i].y-radius),
|
||||
// length,2*radius,arc,arc);
|
||||
// }
|
||||
return RocketComponentShape.toArray(addSymbol(s), component);
|
||||
}
|
||||
@ -47,13 +47,13 @@ public class StreamerShapes extends RocketComponentShape {
|
||||
double or = tube.getRadius();
|
||||
Shape[] s = new Shape[1];
|
||||
Coordinate center = componentAbsoluteLocation;
|
||||
s[0] = new Ellipse2D.Double((center.z-or)*S,(center.y-or)*S,2*or*S,2*or*S);
|
||||
s[0] = new Ellipse2D.Double((center.z-or),(center.y-or),2*or,2*or);
|
||||
|
||||
// Coordinate[] start = transformation.transform(tube.toAbsolute(instanceOffset));
|
||||
//
|
||||
// Shape[] s = new Shape[start.length];
|
||||
// for (int i=0; i < start.length; i++) {
|
||||
// s[i] = new Ellipse2D.Double((start[i].z-or)*S,(start[i].y-or)*S,2*or*S,2*or*S);
|
||||
// s[i] = new Ellipse2D.Double((start[i].z-or),(start[i].y-or),2*or,2*or);
|
||||
// }
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.sf.openrocket.gui.rocketfigure;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
import net.sf.openrocket.util.MathUtil;
|
||||
import net.sf.openrocket.util.Transformation;
|
||||
@ -21,15 +22,8 @@ public class SymmetricComponentShapes extends RocketComponentShape {
|
||||
Transformation transformation,
|
||||
Coordinate componentAbsoluteLocation) {
|
||||
|
||||
return getShapesSide(component, transformation, componentAbsoluteLocation, S);
|
||||
}
|
||||
|
||||
public static RocketComponentShape[] getShapesSide(
|
||||
net.sf.openrocket.rocketcomponent.RocketComponent component,
|
||||
Transformation transformation,
|
||||
Coordinate componentAbsoluteLocation,
|
||||
final double scaleFactor) {
|
||||
net.sf.openrocket.rocketcomponent.SymmetricComponent c = (net.sf.openrocket.rocketcomponent.SymmetricComponent) component;
|
||||
SymmetricComponent c = (SymmetricComponent) component;
|
||||
|
||||
int i;
|
||||
|
||||
final double delta = 0.0000001;
|
||||
@ -89,14 +83,14 @@ public class SymmetricComponentShapes extends RocketComponentShape {
|
||||
|
||||
// TODO: LOW: curved path instead of linear
|
||||
Path2D.Double path = new Path2D.Double();
|
||||
path.moveTo((nose.x + points.get(len - 1).x) * scaleFactor, (nose.y+points.get(len - 1).y) * scaleFactor);
|
||||
path.moveTo((nose.x + points.get(len - 1).x) , (nose.y+points.get(len - 1).y) );
|
||||
for (i = len - 2; i >= 0; i--) {
|
||||
path.lineTo((nose.x+points.get(i).x)* scaleFactor, (nose.y+points.get(i).y) * scaleFactor);
|
||||
path.lineTo((nose.x+points.get(i).x), (nose.y+points.get(i).y) );
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
path.lineTo((nose.x+points.get(i).x) * scaleFactor, (nose.y-points.get(i).y) * scaleFactor);
|
||||
path.lineTo((nose.x+points.get(i).x) , (nose.y-points.get(i).y) );
|
||||
}
|
||||
path.lineTo((nose.x+points.get(len - 1).x) * scaleFactor, (nose.y+points.get(len - 1).y) * scaleFactor);
|
||||
path.lineTo((nose.x+points.get(len - 1).x) , (nose.y+points.get(len - 1).y) );
|
||||
path.closePath();
|
||||
|
||||
//s[len] = path;
|
||||
|
@ -8,7 +8,6 @@ import net.sf.openrocket.util.Transformation;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
|
||||
public class TransitionShapes extends RocketComponentShape {
|
||||
@ -16,10 +15,10 @@ public class TransitionShapes extends RocketComponentShape {
|
||||
// TODO: LOW: Uses only first component of cluster (not currently clusterable).
|
||||
|
||||
public static RocketComponentShape[] getShapesSide(
|
||||
net.sf.openrocket.rocketcomponent.RocketComponent component,
|
||||
Transformation transformation,
|
||||
Coordinate instanceLocation) {
|
||||
return getShapesSide(component, transformation, instanceLocation, S);
|
||||
RocketComponent component,
|
||||
Transformation transformation,
|
||||
Coordinate instanceLocation) {
|
||||
return getShapesSide(component, transformation, instanceLocation, 1.0);
|
||||
}
|
||||
|
||||
public static RocketComponentShape[] getShapesSide(
|
||||
@ -27,7 +26,8 @@ public class TransitionShapes extends RocketComponentShape {
|
||||
Transformation transformation,
|
||||
Coordinate instanceAbsoluteLocation,
|
||||
final double scaleFactor) {
|
||||
|
||||
|
||||
|
||||
Transition transition = (Transition)component;
|
||||
|
||||
RocketComponentShape[] mainShapes;
|
||||
@ -41,15 +41,15 @@ public class TransitionShapes extends RocketComponentShape {
|
||||
double r2 = transition.getAftRadius();
|
||||
|
||||
Path2D.Float path = new Path2D.Float();
|
||||
path.moveTo( (frontCenter.x)* scaleFactor, (frontCenter.y+ r1)* scaleFactor);
|
||||
path.lineTo( (frontCenter.x+length)* scaleFactor, (frontCenter.y+r2)* scaleFactor);
|
||||
path.lineTo( (frontCenter.x+length)* scaleFactor, (frontCenter.y-r2)* scaleFactor);
|
||||
path.lineTo( (frontCenter.x)* scaleFactor, (frontCenter.y-r1)* scaleFactor);
|
||||
path.moveTo( (frontCenter.x), (frontCenter.y+ r1));
|
||||
path.lineTo( (frontCenter.x+length), (frontCenter.y+r2));
|
||||
path.lineTo( (frontCenter.x+length), (frontCenter.y-r2));
|
||||
path.lineTo( (frontCenter.x), (frontCenter.y-r1));
|
||||
path.closePath();
|
||||
|
||||
mainShapes = new RocketComponentShape[] { new RocketComponentShape( path, component) };
|
||||
} else {
|
||||
mainShapes = SymmetricComponentShapes.getShapesSide(component, transformation, instanceAbsoluteLocation, scaleFactor);
|
||||
mainShapes = SymmetricComponentShapes.getShapesSide(component, transformation, instanceAbsoluteLocation);
|
||||
}
|
||||
|
||||
Shape foreShoulder=null, aftShoulder=null;
|
||||
@ -105,8 +105,8 @@ public class TransitionShapes extends RocketComponentShape {
|
||||
Coordinate center = componentAbsoluteLocation;
|
||||
|
||||
Shape[] s = new Shape[2];
|
||||
s[0] = new Ellipse2D.Double((center.z-r1)*S,(center.y-r1)*S,2*r1*S,2*r1*S);
|
||||
s[1] = new Ellipse2D.Double((center.z-r2)*S,(center.y-r2)*S,2*r2*S,2*r2*S);
|
||||
s[0] = new Ellipse2D.Double((center.z-r1),(center.y-r1),2*r1,2*r1);
|
||||
s[1] = new Ellipse2D.Double((center.z-r2),(center.y-r2),2*r2,2*r2);
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class TubeFinSetShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[fins];
|
||||
for (int i=0; i<fins; i++) {
|
||||
s[i] = new Rectangle2D.Double(start[0].x*S,(start[0].y-outerRadius)*S,length*S,2*outerRadius*S);
|
||||
s[i] = new Rectangle2D.Double(start[0].x,(start[0].y-outerRadius),length,2*outerRadius);
|
||||
start = finRotation.transform(start);
|
||||
}
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
@ -75,7 +75,7 @@ public class TubeFinSetShapes extends RocketComponentShape {
|
||||
|
||||
Shape[] s = new Shape[fins];
|
||||
for (int i=0; i < fins; i++) {
|
||||
s[i] = new Ellipse2D.Double((start[0].z-outerradius)*S,(start[0].y-outerradius)*S,2*outerradius*S,2*outerradius*S);
|
||||
s[i] = new Ellipse2D.Double((start[0].z-outerradius),(start[0].y-outerradius),2*outerradius,2*outerradius);
|
||||
start = finRotation.transform(start);
|
||||
}
|
||||
return RocketComponentShape.toArray(s, component);
|
||||
|
@ -15,10 +15,10 @@ public class TubeShapes extends RocketComponentShape {
|
||||
Coordinate instanceAbsoluteLocation,
|
||||
final double length, final double radius ){
|
||||
|
||||
return new Rectangle2D.Double((instanceAbsoluteLocation.x)*S, //x - the X coordinate of the upper-left corner of the newly constructed Rectangle2D
|
||||
(instanceAbsoluteLocation.y-radius)*S, // y - the Y coordinate of the upper-left corner of the newly constructed Rectangle2D
|
||||
length*S, // w - the width of the newly constructed Rectangle2D
|
||||
2*radius*S); // h - the height of the newly constructed Rectangle2D
|
||||
return new Rectangle2D.Double((instanceAbsoluteLocation.x), //x - the X coordinate of the upper-left corner of the newly constructed Rectangle2D
|
||||
(instanceAbsoluteLocation.y-radius), // y - the Y coordinate of the upper-left corner of the newly constructed Rectangle2D
|
||||
length, // w - the width of the newly constructed Rectangle2D
|
||||
2*radius); // h - the height of the newly constructed Rectangle2D
|
||||
}
|
||||
|
||||
public static Shape getShapesBack(
|
||||
@ -26,7 +26,7 @@ public class TubeShapes extends RocketComponentShape {
|
||||
Coordinate instanceAbsoluteLocation,
|
||||
final double radius ) {
|
||||
|
||||
return new Ellipse2D.Double((instanceAbsoluteLocation.z-radius)*S, (instanceAbsoluteLocation.y-radius)*S, 2*radius*S, 2*radius*S);
|
||||
return new Ellipse2D.Double((instanceAbsoluteLocation.z-radius), (instanceAbsoluteLocation.y-radius), 2*radius, 2*radius);
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,16 +22,6 @@ import net.sf.openrocket.util.StateChangeListener;
|
||||
public abstract class AbstractScaleFigure extends JPanel {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(AbstractScaleFigure.class);
|
||||
|
||||
/**
|
||||
* Extra scaling applied to the figure. The f***ing Java JRE doesn't know
|
||||
* how to draw shapes when using very large scaling factors, so this must
|
||||
* be manually applied to every single shape used.
|
||||
* <p>
|
||||
* The scaling factor used is divided by this value, and every coordinate used
|
||||
* in the figures must be multiplied by this factor.
|
||||
*/
|
||||
public static final double EXTRA_SCALE = 1.0;
|
||||
|
||||
public static final double INCHES_PER_METER = 39.3701;
|
||||
public static final double METERS_PER_INCH = 0.0254;
|
||||
|
@ -229,16 +229,16 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
|
||||
float[] dashes = style.getDashes();
|
||||
for (int j = 0; j < dashes.length; j++) {
|
||||
dashes[j] *= EXTRA_SCALE / scale;
|
||||
dashes[j] *= 1.0 / scale;
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
g2.setStroke(new BasicStroke((float) (SELECTED_WIDTH * EXTRA_SCALE / scale),
|
||||
g2.setStroke(new BasicStroke((float) (SELECTED_WIDTH / scale),
|
||||
BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, dashes, 0));
|
||||
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_PURE);
|
||||
} else {
|
||||
g2.setStroke(new BasicStroke((float) (NORMAL_WIDTH * EXTRA_SCALE / scale),
|
||||
g2.setStroke(new BasicStroke((float) (NORMAL_WIDTH / scale),
|
||||
BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, dashes, 0));
|
||||
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
@ -246,7 +246,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
g2.draw(rcs.shape);
|
||||
}
|
||||
|
||||
g2.setStroke(new BasicStroke((float) (NORMAL_WIDTH * EXTRA_SCALE / scale),
|
||||
g2.setStroke(new BasicStroke((float) (NORMAL_WIDTH / scale),
|
||||
BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
|
||||
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
@ -276,13 +276,15 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
{
|
||||
Shape s;
|
||||
if (currentViewType == RocketPanel.VIEW_TYPE.SideView) {
|
||||
s = new Rectangle2D.Double(EXTRA_SCALE * curMotorLocation.x,
|
||||
EXTRA_SCALE * (curMotorLocation.y - motorRadius), EXTRA_SCALE * motorLength,
|
||||
EXTRA_SCALE * 2 * motorRadius);
|
||||
s = new Rectangle2D.Double( curMotorLocation.x,
|
||||
(curMotorLocation.y - motorRadius),
|
||||
motorLength,
|
||||
2 * motorRadius);
|
||||
} else {
|
||||
s = new Ellipse2D.Double(EXTRA_SCALE * (curMotorLocation.z - motorRadius),
|
||||
EXTRA_SCALE * (curMotorLocation.y - motorRadius), EXTRA_SCALE * 2 * motorRadius,
|
||||
EXTRA_SCALE * 2 * motorRadius);
|
||||
s = new Ellipse2D.Double((curMotorLocation.z - motorRadius),
|
||||
(curMotorLocation.y - motorRadius),
|
||||
2 * motorRadius,
|
||||
2 * motorRadius);
|
||||
}
|
||||
g2.setColor(fillColor);
|
||||
g2.fill(s);
|
||||
@ -295,7 +297,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
|
||||
// Draw relative extras
|
||||
for (FigureElement e : relativeExtra) {
|
||||
e.paint(g2, scale / EXTRA_SCALE);
|
||||
e.paint(g2, scale);
|
||||
}
|
||||
|
||||
// Draw absolute extras
|
||||
|
@ -641,8 +641,8 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
if (figure.getType() == RocketPanel.VIEW_TYPE.SideView && length > 0) {
|
||||
|
||||
// TODO: LOW: Y-coordinate and rotation
|
||||
extraCP.setPosition(cpx * RocketFigure.EXTRA_SCALE, 0);
|
||||
extraCG.setPosition(cgx * RocketFigure.EXTRA_SCALE, 0);
|
||||
extraCP.setPosition(cpx, 0);
|
||||
extraCG.setPosition(cgx, 0);
|
||||
|
||||
} else {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user