trackeditor: add missing local info

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

Former-commit-id: 319c4cc1f27ab6e51ad1b046d2d39a9ce86461a6
Former-commit-id: 6f5093fa0a5065faee140f7378c2b626c03795fb
This commit is contained in:
iobyte 2023-03-13 20:39:15 +00:00
parent a5dd60a872
commit a54091c506
5 changed files with 86 additions and 1 deletions

View file

@ -49,6 +49,14 @@ public class LocalInfoProperties extends PropertyPanel
private JTextField sunAscensionTextField = new JTextField(); private JTextField sunAscensionTextField = new JTextField();
private JLabel altitudeLabel = new JLabel(); private JLabel altitudeLabel = new JLabel();
private JTextField altitudeTextField = new JTextField(); private JTextField altitudeTextField = new JTextField();
private JLabel latitudeLabel = new JLabel();
private JTextField latitudeTextField = new JTextField();
private JLabel longitudeLabel = new JLabel();
private JTextField longitudeTextField = new JTextField();
private JLabel climatLabel = new JLabel();
private JTextField climatTextField = new JTextField();
private JLabel precipitationLabel = new JLabel();
private JTextField precipitationTextField = new JTextField();
/** /**
* *
@ -77,6 +85,10 @@ public class LocalInfoProperties extends PropertyPanel
addLabel(this, 5, timeOfDayLabel, "Time Of Day", 150); addLabel(this, 5, timeOfDayLabel, "Time Of Day", 150);
addLabel(this, 6, sunAscensionLabel, "Sun Ascension", 150); addLabel(this, 6, sunAscensionLabel, "Sun Ascension", 150);
addLabel(this, 7, altitudeLabel, "Altitude", 150); addLabel(this, 7, altitudeLabel, "Altitude", 150);
addLabel(this, 8, latitudeLabel, "Latitude", 150);
addLabel(this, 9, longitudeLabel, "Longitude", 150);
addLabel(this, 10, climatLabel, "Climate", 150);
addLabel(this, 11, precipitationLabel, "Precipitation", 150);
addTextField(this, 0, stationTextField, getEditorFrame().getTrackData().getLocalInfo().getStation(), 170, 125); addTextField(this, 0, stationTextField, getEditorFrame().getTrackData().getLocalInfo().getStation(), 170, 125);
addTextField(this, 1, timezoneTextField, getEditorFrame().getTrackData().getLocalInfo().getTimezone(), 170, 125); addTextField(this, 1, timezoneTextField, getEditorFrame().getTrackData().getLocalInfo().getTimezone(), 170, 125);
@ -86,6 +98,10 @@ public class LocalInfoProperties extends PropertyPanel
addTextField(this, 5, timeOfDayTextField, getEditorFrame().getTrackData().getLocalInfo().getTimeOfDay(), 170, 125); addTextField(this, 5, timeOfDayTextField, getEditorFrame().getTrackData().getLocalInfo().getTimeOfDay(), 170, 125);
addTextField(this, 6, sunAscensionTextField, getEditorFrame().getTrackData().getLocalInfo().getSunAscension(), 170, 125); addTextField(this, 6, sunAscensionTextField, getEditorFrame().getTrackData().getLocalInfo().getSunAscension(), 170, 125);
addTextField(this, 7, altitudeTextField, getEditorFrame().getTrackData().getLocalInfo().getAltitude(), 170, 125); addTextField(this, 7, altitudeTextField, getEditorFrame().getTrackData().getLocalInfo().getAltitude(), 170, 125);
addTextField(this, 8, latitudeTextField, getEditorFrame().getTrackData().getLocalInfo().getLatitude(), 170, 125);
addTextField(this, 9, longitudeTextField, getEditorFrame().getTrackData().getLocalInfo().getLongitude(), 170, 125);
addTextField(this, 10, climatTextField, getEditorFrame().getTrackData().getLocalInfo().getClimat(), 170, 125);
addTextField(this, 11, precipitationTextField, getEditorFrame().getTrackData().getLocalInfo().getPrecipitation(), 170, 125);
} }
/** /**
@ -95,6 +111,7 @@ public class LocalInfoProperties extends PropertyPanel
{ {
MutableString stringResult = new MutableString(); MutableString stringResult = new MutableString();
MutableDouble doubleResult = new MutableDouble(); MutableDouble doubleResult = new MutableDouble();
MutableInteger integerResult = new MutableInteger();
if (isDifferent(stationTextField.getText(), if (isDifferent(stationTextField.getText(),
getEditorFrame().getTrackData().getLocalInfo().getStation(), stringResult)) getEditorFrame().getTrackData().getLocalInfo().getStation(), stringResult))
@ -151,5 +168,33 @@ public class LocalInfoProperties extends PropertyPanel
getEditorFrame().getTrackData().getLocalInfo().setAltitude(doubleResult.getValue()); getEditorFrame().getTrackData().getLocalInfo().setAltitude(doubleResult.getValue());
getEditorFrame().documentIsModified = true; getEditorFrame().documentIsModified = true;
} }
if (isDifferent(latitudeTextField.getText(),
getEditorFrame().getTrackData().getLocalInfo().getLatitude(), doubleResult))
{
getEditorFrame().getTrackData().getLocalInfo().setLatitude(doubleResult.getValue());
getEditorFrame().documentIsModified = true;
}
if (isDifferent(longitudeTextField.getText(),
getEditorFrame().getTrackData().getLocalInfo().getLongitude(), doubleResult))
{
getEditorFrame().getTrackData().getLocalInfo().setLongitude(doubleResult.getValue());
getEditorFrame().documentIsModified = true;
}
if (isDifferent(climatTextField.getText(),
getEditorFrame().getTrackData().getLocalInfo().getClimat(), integerResult))
{
getEditorFrame().getTrackData().getLocalInfo().setClimat(integerResult.getValue());
getEditorFrame().documentIsModified = true;
}
if (isDifferent(precipitationTextField.getText(),
getEditorFrame().getTrackData().getLocalInfo().getPrecipitation(), doubleResult))
{
getEditorFrame().getTrackData().getLocalInfo().setPrecipitation(doubleResult.getValue());
getEditorFrame().documentIsModified = true;
}
} }
} // @jve:decl-index=0:visual-constraint="10,10" } // @jve:decl-index=0:visual-constraint="10,10"

View file

@ -419,6 +419,10 @@ public class XmlReader
data.setTimeOfDay(getAttrNumValue(element, "time of day", "hour")); data.setTimeOfDay(getAttrNumValue(element, "time of day", "hour"));
data.setSunAscension(getAttrNumValue(element, "sun ascension", "deg")); data.setSunAscension(getAttrNumValue(element, "sun ascension", "deg"));
data.setAltitude(getAttrNumValue(element, "altitude", "m")); data.setAltitude(getAttrNumValue(element, "altitude", "m"));
data.setLatitude(getAttrNumValue(element, "latitude", "deg"));
data.setLongitude(getAttrNumValue(element, "longitude", "deg"));
data.setClimat(getAttrIntValue(element, "climat"));
data.setPrecipitation(getAttrNumValue(element, "precipitation"));
editorFrame.getTrackData().setLocalInfo(data); editorFrame.getTrackData().setLocalInfo(data);
} }

View file

@ -781,6 +781,10 @@ public class XmlWriter
addContent(element, "time of day", "hour", editorFrame.getTrackData().getLocalInfo().getTimeOfDay()); addContent(element, "time of day", "hour", editorFrame.getTrackData().getLocalInfo().getTimeOfDay());
addContent(element, "sun ascension", "deg", editorFrame.getTrackData().getLocalInfo().getSunAscension()); addContent(element, "sun ascension", "deg", editorFrame.getTrackData().getLocalInfo().getSunAscension());
addContent(element, "altitude", "m", editorFrame.getTrackData().getLocalInfo().getAltitude()); addContent(element, "altitude", "m", editorFrame.getTrackData().getLocalInfo().getAltitude());
addContent(element, "latitude", "deg", editorFrame.getTrackData().getLocalInfo().getLatitude());
addContent(element, "longitude", "deg", editorFrame.getTrackData().getLocalInfo().getLongitude());
addContent(element, "climat", null, editorFrame.getTrackData().getLocalInfo().getClimat());
addContent(element, "precipitation", null, editorFrame.getTrackData().getLocalInfo().getPrecipitation());
return element; return element;
} }

View file

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

View file

@ -10,6 +10,10 @@ public class LocalInfo {
private double timeOfDay = Double.NaN; private double timeOfDay = Double.NaN;
private double sunAscension = Double.NaN; private double sunAscension = Double.NaN;
private double altitude = Double.NaN; private double altitude = Double.NaN;
private double latitude = Double.NaN;
private double longitude = Double.NaN;
private int climat = Integer.MAX_VALUE;
private double precipitation = Double.NaN;
public String getStation() { public String getStation() {
return station; return station;
@ -59,6 +63,30 @@ public class LocalInfo {
public void setAltitude(double altitude) { public void setAltitude(double altitude) {
this.altitude = altitude; this.altitude = altitude;
} }
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public int getClimat() {
return climat;
}
public void setClimat(int climat) {
this.climat = climat;
}
public double getPrecipitation() {
return precipitation;
}
public void setPrecipitation(double precipitation) {
this.precipitation = precipitation;
}
public void dump(String indent) public void dump(String indent)
{ {
@ -71,5 +99,9 @@ public class LocalInfo {
System.out.println(indent + " timeOfDay : " + timeOfDay); System.out.println(indent + " timeOfDay : " + timeOfDay);
System.out.println(indent + " sunAscension : " + sunAscension); System.out.println(indent + " sunAscension : " + sunAscension);
System.out.println(indent + " altitude : " + altitude); System.out.println(indent + " altitude : " + altitude);
System.out.println(indent + " latitude : " + latitude);
System.out.println(indent + " longitude : " + longitude);
System.out.println(indent + " climat : " + climat);
System.out.println(indent + " precipitation : " + precipitation);
} }
} }