trackeditor: fix segment split profil steps length
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9264 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: e2d8499508515594060ced3a1b02ab422f187643 Former-commit-id: f8ed8814c421bbedc512c2db472a562078ce7875
This commit is contained in:
parent
96b76d880d
commit
d67e3dc1ec
3 changed files with 11 additions and 14 deletions
|
@ -454,6 +454,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
SegmentVector data = editorFrame.getTrackData().getSegments();
|
||||
int pos = data.indexOf(handledShape);
|
||||
double splitPoint = 0.5;
|
||||
double profilStepsLength = handledShape.getValidProfilStepsLength(editorFrame);
|
||||
switch (handledShape.getType())
|
||||
{
|
||||
case "lft":
|
||||
|
@ -465,7 +466,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
double rStart = oldShape.getRadiusStart();
|
||||
double rEnd = oldShape.getRadiusEnd();
|
||||
double L = (rStart + rEnd) / 2.0 * oldShape.getArcDeg();
|
||||
double nbSteps = (int)(L / 4.0 + 0.5) + 1;
|
||||
double nbSteps = (int)(L / profilStepsLength + 0.5) + 1;
|
||||
double stepLength = L / nbSteps;
|
||||
double deltaRadiusStep = (rEnd - rStart) / (nbSteps - 1.0);
|
||||
double tmpAngle = 0.0;
|
||||
|
@ -495,7 +496,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
newShape2.setRadiusEnd(rEnd);
|
||||
newShape2.setRadiusStart(tmpRadius);
|
||||
splitSegment(oldShape, newShape2, splitPoint);
|
||||
newShape2.setProfilStepsLength(4.0);
|
||||
newShape2.setProfilStepsLength(oldShape.getProfilStepsLength());
|
||||
int count2 = Editor.getProperties().getCurveNameCount() + 1;
|
||||
Editor.getProperties().setCurveNameCount(count2);
|
||||
newShape2.setName("curve " + count2);
|
||||
|
@ -512,7 +513,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
double rStart = oldShape.getRadiusStart();
|
||||
double rEnd = oldShape.getRadiusEnd();
|
||||
double L = (rStart + rEnd) / 2.0 * oldShape.getArcDeg();
|
||||
double nbSteps = (int)(L / 4.0 + 0.5) + 1;
|
||||
double nbSteps = (int)(L / profilStepsLength + 0.5) + 1;
|
||||
double stepLength = L / nbSteps;
|
||||
final double deltaRadiusStep = (rEnd - rStart) / (nbSteps - 1.0);
|
||||
double tmpAngle = 0.0;
|
||||
|
@ -542,7 +543,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
newShape2.setRadiusEnd(rEnd);
|
||||
newShape2.setRadiusStart(tmpRadius);
|
||||
splitSegment(oldShape, newShape2, splitPoint);
|
||||
newShape2.setProfilStepsLength(4.0);
|
||||
newShape2.setProfilStepsLength(oldShape.getProfilStepsLength());
|
||||
int count2 = Editor.getProperties().getCurveNameCount() + 1;
|
||||
Editor.getProperties().setCurveNameCount(count2);
|
||||
newShape2.setName("curve " + count2);
|
||||
|
@ -568,6 +569,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
}
|
||||
}
|
||||
splitSegment(oldShape, newShape3, splitPoint);
|
||||
newShape3.setProfilStepsLength(oldShape.getProfilStepsLength());
|
||||
int count3 = Editor.getProperties().getStraightNameCount() + 1;
|
||||
Editor.getProperties().setStraightNameCount(count3);
|
||||
newShape3.setName("straight " + count3);
|
||||
|
|
|
@ -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.10";
|
||||
public final String version = "1.4.11";
|
||||
private String path;
|
||||
|
||||
private double imageScale = 1;
|
||||
|
|
|
@ -877,18 +877,13 @@ public class Segment implements Cloneable
|
|||
return surf;
|
||||
}
|
||||
|
||||
// this is not inherited
|
||||
public double getValidProfilStepsLength(EditorFrame editorFrame)
|
||||
{
|
||||
Segment previous = this;
|
||||
double length;
|
||||
while (previous != null)
|
||||
double length = profilStepsLength;
|
||||
if (hasProfilStepsLength())
|
||||
{
|
||||
length = profilStepsLength;
|
||||
if (!Double.isNaN(profilStepsLength))
|
||||
{
|
||||
return length;
|
||||
}
|
||||
previous = previous.previousShape;
|
||||
return length;
|
||||
}
|
||||
|
||||
length = editorFrame.getTrackData().getMainTrack().getProfilStepsLength();
|
||||
|
|
Loading…
Reference in a new issue