trackeditor: fix import export differences from degree to radian to degree conversions
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8483 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 52624b6a4606ce6a6196b3c9a23de42c7af42d1b Former-commit-id: 22bb8d638d8dc60764516707c030ae7b77f352de
This commit is contained in:
parent
b65df99736
commit
8eb900d612
7 changed files with 31 additions and 18 deletions
|
@ -471,7 +471,7 @@ public class DeltaPanel extends JDialog implements Runnable
|
|||
if(!obj.getType().equals("str"))
|
||||
{
|
||||
Curve curve = (Curve) obj;
|
||||
curve.setArc(curve.getArc()*co);
|
||||
curve.setArcRad(curve.getArcRad()*co);
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -583,7 +583,7 @@ public class EditorFrame extends JFrame
|
|||
shape = new Curve();
|
||||
((Curve)shape).setRadiusStart(100);
|
||||
((Curve)shape).setRadiusEnd(100);
|
||||
((Curve)shape).setArc(Math.PI);
|
||||
((Curve)shape).setArcDeg(180);
|
||||
shape.setHeightStartLeft(0);
|
||||
shape.setHeightStartRight(0);
|
||||
shape.setHeightEndLeft(0);
|
||||
|
@ -611,7 +611,7 @@ public class EditorFrame extends JFrame
|
|||
shape = new Curve();
|
||||
((Curve)shape).setRadiusStart(100);
|
||||
((Curve)shape).setRadiusEnd(100);
|
||||
((Curve)shape).setArc(Math.PI);
|
||||
((Curve)shape).setArcDeg(180);
|
||||
shape.setHeightStartLeft(0);
|
||||
shape.setHeightStartRight(0);
|
||||
shape.setHeightEndLeft(0);
|
||||
|
|
|
@ -355,10 +355,10 @@ public class SegmentEditorDlg extends JDialog implements SliderListener
|
|||
arcSlider.setMax(360);
|
||||
arcSlider.setExtent(10);
|
||||
arcSlider.setTickSpacing(1);
|
||||
arcSlider.setRealToTextCoeff(180/Math.PI);
|
||||
arcSlider.setRealToTextCoeff(1);
|
||||
if (!shape.getType().equals("str"))
|
||||
{
|
||||
arcSlider.setMethod("Arc");
|
||||
arcSlider.setMethod("ArcDeg");
|
||||
}
|
||||
arcSlider.addSliderListener(this);
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ public class SegmentEditorDlg extends JDialog implements SliderListener
|
|||
getGroupButton().setEnabled(true);
|
||||
getGroupButton().setSelected(curve.getType());
|
||||
|
||||
this.getArcSlider().setValue(curve.getArc());
|
||||
this.getArcSlider().setValue(curve.getArcDeg());
|
||||
this.getRadiusStartSlider().setValue(curve.getRadiusStart());
|
||||
this.getRadiusEndSlider().setValue(curve.getRadiusEnd());
|
||||
this.getMarksTextField().setEnabled(true);
|
||||
|
|
|
@ -260,7 +260,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
Vector<Segment> data = editorFrame.getTrackData().getSegments();
|
||||
int pos = data.indexOf(handledShape);
|
||||
Curve newShape = new Curve("lft",handledShape);
|
||||
newShape.setArc(Math.PI/2);
|
||||
newShape.setArcDeg(90);
|
||||
newShape.setRadiusStart(50);
|
||||
newShape.setRadiusEnd(50);
|
||||
newShape.inheritProperties(handledShape);
|
||||
|
@ -289,7 +289,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
Vector<Segment> data = editorFrame.getTrackData().getSegments();
|
||||
int pos = data.indexOf(handledShape);
|
||||
Curve newShape = new Curve("rgt",handledShape);
|
||||
newShape.setArc(Math.PI/2);
|
||||
newShape.setArcDeg(90);
|
||||
newShape.setRadiusStart(50);
|
||||
newShape.setRadiusEnd(50);
|
||||
newShape.inheritProperties(handledShape);
|
||||
|
|
|
@ -687,8 +687,7 @@ public class XmlReader
|
|||
} else
|
||||
{
|
||||
double arc = getAttrNumValue(seg, "arc", "deg");
|
||||
arc = (arc * Math.PI) / 180;
|
||||
((Curve) shape).setArc(arc);
|
||||
((Curve) shape).setArcDeg(arc);
|
||||
double startRad = getAttrNumValue(seg, "radius", "m");
|
||||
((Curve) shape).setRadiusStart(startRad);
|
||||
double endRad = getAttrNumValue(seg, "end radius", "m");
|
||||
|
|
|
@ -284,8 +284,7 @@ public class XmlWriter
|
|||
addContent(segment, "lg", "m", ((Straight) shape).getLength());
|
||||
} else
|
||||
{
|
||||
double arc = ((Curve) shape).getArc();
|
||||
arc = (arc * 180) / Math.PI;
|
||||
double arc = ((Curve) shape).getArcDeg();
|
||||
addContent(segment, "arc", "deg", arc);
|
||||
|
||||
double radStart = ((Curve) shape).getRadiusStart();
|
||||
|
|
|
@ -36,7 +36,7 @@ import miscel.EPMath;
|
|||
|
||||
public class Curve extends Segment implements Cloneable
|
||||
{
|
||||
protected double arc;
|
||||
protected double arcDeg;
|
||||
protected double radiusStart;
|
||||
protected double radiusEnd;
|
||||
|
||||
|
@ -91,6 +91,7 @@ public class Curve extends Segment implements Cloneable
|
|||
*/
|
||||
|
||||
// calc turn length
|
||||
double arc = arcDeg * Math.PI / 180;
|
||||
length = arc * (radiusStart + radiusEnd) / 2;
|
||||
nbSteps = (int) (length / profilStepsLength + 0.5) + 1;
|
||||
|
||||
|
@ -346,16 +347,30 @@ public class Curve extends Segment implements Cloneable
|
|||
/**
|
||||
* @return Returns the arc.
|
||||
*/
|
||||
public double getArc()
|
||||
public double getArcRad()
|
||||
{
|
||||
return arc;
|
||||
return arcDeg * Math.PI / 180;
|
||||
}
|
||||
/**
|
||||
* @param arc The arc to set.
|
||||
*/
|
||||
public void setArc(double arc)
|
||||
public void setArcRad(double arcRad)
|
||||
{
|
||||
this.arc = arc;
|
||||
this.arcDeg = arcRad * 180 / Math.PI;
|
||||
}
|
||||
/**
|
||||
* @return Returns the arc.
|
||||
*/
|
||||
public double getArcDeg()
|
||||
{
|
||||
return arcDeg;
|
||||
}
|
||||
/**
|
||||
* @param arc The arc to set.
|
||||
*/
|
||||
public void setArcDeg(double arcDeg)
|
||||
{
|
||||
this.arcDeg = arcDeg;
|
||||
}
|
||||
/**
|
||||
* @return Returns the radiusEnd.
|
||||
|
@ -401,7 +416,7 @@ public class Curve extends Segment implements Cloneable
|
|||
{
|
||||
Curve s;
|
||||
s = (Curve) super.clone();
|
||||
s.arc = this.arc;
|
||||
s.arcDeg = this.arcDeg;
|
||||
s.radiusStart = this.radiusStart;
|
||||
s.radiusEnd = this.radiusEnd;
|
||||
|
||||
|
|
Loading…
Reference in a new issue