trackeditor: fix units for camera to start

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8776 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 8f7d38ea734e4f13549da9254818f37e48eb1847
Former-commit-id: 1eded1262d7ed47be52bc609dcfd45b9b77a3660
This commit is contained in:
iobyte 2023-03-09 21:44:49 +00:00
parent db7867f5e9
commit f298812ce0
5 changed files with 31 additions and 3 deletions

View file

@ -3016,4 +3016,9 @@ public class EditorFrame extends JFrame
return 0;
}
public Segment getSegment(String name)
{
return trackData.getSegments().getSegment(name);
}
}

View file

@ -288,7 +288,8 @@ public class XmlReader
cam.setComment(getAttrStrValue(camera, "comment"));
cam.setSegment(getAttrStrValue(camera, "segment"));
cam.setToRight(getAttrNumValue(camera, "to right"));
cam.setToStart(getAttrNumValue(camera, "to start", "deg"));
// units can be meters for straights or degrees for curves
cam.setToStart(getAttrNumValue(camera, "to start"));
cam.setHeight(getAttrNumValue(camera, "height"));
cam.setFovStart(getAttrStrValue(camera, "fov start"));
cam.setFovEnd(getAttrStrValue(camera, "fov end"));

View file

@ -548,7 +548,16 @@ public class XmlWriter
addContent(el, "comment", camera.getComment());
addContent(el, "segment", camera.getSegment());
addContent(el, "to right", null, camera.getToRight());
addContent(el, "to start", "deg", camera.getToStart());
// units can be meters for straights or degrees for curves
Segment segment = editorFrame.getSegment(camera.getSegment());
if (segment != null && !segment.getType().equals("str"))
{
addContent(el, "to start", "deg", camera.getToStart());
}
else
{
addContent(el, "to start", null, camera.getToStart());
}
addContent(el, "height", null, camera.getHeight());
addContent(el, "fov start", camera.getFovStart());
addContent(el, "fov end", camera.getFovEnd());

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.0.10";
public final String version = "1.0.11";
private String path;
private double imageScale = 1;

View file

@ -195,4 +195,17 @@ public class SegmentVector extends Vector<Segment>
return valid;
}
public Segment getSegment(String name)
{
for (Segment segment : this)
{
if (segment.getName().equals(name))
{
return segment;
}
}
return null;
}
}