trackeditor: move segment nbSteps and stepLength into base class

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9297 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
iobyte 2024-02-01 22:58:12 +00:00
parent 2a2dd16822
commit e70913a990
4 changed files with 11 additions and 8 deletions

View File

@ -34,7 +34,7 @@ public class Properties
private static Properties instance = new Properties();
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
public final String title = "sd2-trackeditor";
public final String version = "1.4.24";
public final String version = "1.4.25";
private String path;
private double imageScale = 1;

View File

@ -41,7 +41,6 @@ public class Curve extends Segment
protected double radiusStart;
protected double radiusEnd;
int nbSteps;
public Point2D.Double center = new Point2D.Double();
protected String marks;
@ -73,8 +72,6 @@ public class Curve extends Segment
Curve shape = (Curve) _shape;
shape.nbSteps = nbSteps;
return shape;
}
@ -142,9 +139,9 @@ public class Curve extends Segment
}
trackStartDist += length;
stepLength = length / nbSteps;
double deltaRadiusStep;
double stepLength = length / nbSteps;
if (radiusEnd != radiusStart)
{

View File

@ -59,6 +59,8 @@ public class Segment implements Cloneable
public Point2D.Double startTrackCenter = new Point2D.Double();
public Point2D.Double endTrackCenter = new Point2D.Double();
public double distFromCircuitStart;
public int nbSteps = 0;
public double stepLength;
// All datas
protected double length = Double.NaN;
@ -140,6 +142,8 @@ public class Segment implements Cloneable
type = segment.type;
comment = segment.comment;
length = segment.length;
nbSteps = segment.nbSteps;
stepLength = segment.stepLength;
surface = segment.surface;
heightStart = segment.heightStart;
heightStartLeft = segment.heightStartLeft;
@ -859,6 +863,8 @@ public class Segment implements Cloneable
s.type = this.type;
s.comment = this.comment;
s.length = this.length;
s.nbSteps = this.nbSteps;
s.stepLength = this.stepLength;
s.surface = this.surface;
s.heightStart = this.heightStart;
s.heightStartLeft = this.heightStartLeft;
@ -2268,6 +2274,8 @@ public class Segment implements Cloneable
System.out.println(indent + " type : " + type);
System.out.println(indent + " count : " + count);
System.out.println(indent + " length : " + length);
System.out.println(indent + " nbSteps : " + nbSteps);
System.out.println(indent + " stepLength : " + stepLength);
System.out.println(indent + " surface : " + surface);
System.out.println(indent + " heightStart : " + heightStart);
System.out.println(indent + " heightStartLeft : " + heightStartLeft);

View File

@ -104,7 +104,6 @@ public class Straight extends Segment
double leftEndHeight = this.getCalculatedHeightEndLeft();
double rightEndHeight = this.getCalculatedHeightEndRight();
int nbSteps = 1;
if (hasProfilSteps())
{
nbSteps = getProfilSteps();
@ -113,7 +112,7 @@ public class Straight extends Segment
{
nbSteps = (int) (length / profilStepsLength + 0.5) + 1;
}
double stepLength = length / nbSteps;
stepLength = length / nbSteps;
if (points == null || points.length != 4 * (7 + (showArrows > 0.0 ? 1 : 0)) * nbSteps)
{
@ -319,7 +318,6 @@ public class Straight extends Segment
{
}
public Object clone()
{
Straight s;