parent
1a780d6955
commit
e7f84eaf83
@ -1,218 +0,0 @@
|
||||
package seng302.Data;
|
||||
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import seng302.Exceptions.InvalidBoatDataException;
|
||||
import seng302.Model.Boat;
|
||||
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.StringWriter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by esa46 on 25/04/17.
|
||||
*/
|
||||
public class BoatData {
|
||||
|
||||
Document doc;
|
||||
private List<Boat> boatData;
|
||||
|
||||
|
||||
public BoatData(List<Boat> boatData) {
|
||||
this.boatData = boatData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AC35 officially formatted xml description of boats competing in a race
|
||||
*
|
||||
* @return String containing xml-formatted boats description
|
||||
*/
|
||||
public String createXML() {
|
||||
|
||||
try {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
|
||||
//root element
|
||||
doc = docBuilder.newDocument();
|
||||
Element rootElement = doc.createElement("BoatConfig");
|
||||
doc.appendChild(rootElement);
|
||||
|
||||
//Boats element
|
||||
Element boats = doc.createElement("Boats");
|
||||
rootElement.appendChild(boats);
|
||||
|
||||
appendIndividualBoats(boats);
|
||||
|
||||
// write the content into xml file
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||
DOMSource source = new DOMSource(doc);
|
||||
|
||||
//Serialize document.
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
StreamResult result = new StreamResult(stringWriter);
|
||||
transformer.transform(source, result);
|
||||
|
||||
return stringWriter.toString();
|
||||
|
||||
|
||||
} catch (ParserConfigurationException pce) {
|
||||
throw new InvalidBoatDataException();
|
||||
} catch (TransformerException tfe) {
|
||||
throw new InvalidBoatDataException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs through competing boats, creating an element for each
|
||||
*
|
||||
* @param boatsElement boats element to be added to
|
||||
*/
|
||||
private void appendIndividualBoats(Element boatsElement) {
|
||||
|
||||
for (int i = 0; i < boatData.size(); i++) {
|
||||
Element boat = doc.createElement("Boat");
|
||||
appendType(boat);
|
||||
appendSourceID(boat, i);
|
||||
appendShapeID(boat);
|
||||
appendHullNum(boat);
|
||||
appendStoweName(boat, i);
|
||||
appendShortName(boat, i);
|
||||
appendBoatName(boat, i);
|
||||
appendGPSCoords(boat, i);
|
||||
//Write boat to boats
|
||||
boatsElement.appendChild(boat);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends type attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
*/
|
||||
private void appendType(Element boat) {
|
||||
//Type attribute
|
||||
Attr attrType = doc.createAttribute("Type");
|
||||
attrType.setValue("Yacht");
|
||||
boat.setAttributeNode(attrType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends sourceID attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendSourceID(Element boat, int i) {
|
||||
//SourceID attribute
|
||||
Attr attrSourceID = doc.createAttribute("SourceID");
|
||||
attrSourceID.setValue(Integer.toString(boatData.get(i).getSourceID()));
|
||||
boat.setAttributeNode(attrSourceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends shapeID attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
*/
|
||||
private void appendShapeID(Element boat) {
|
||||
//ShapeID attribute
|
||||
Attr attrShapeID = doc.createAttribute("ShapeID");
|
||||
attrShapeID.setValue("0");
|
||||
boat.setAttributeNode(attrShapeID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends hull name attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
*/
|
||||
private void appendHullNum(Element boat) {
|
||||
//HullNum attribute
|
||||
Attr attrHullNum = doc.createAttribute("HullNum");
|
||||
attrHullNum.setValue("RG01");
|
||||
boat.setAttributeNode(attrHullNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends stow name attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendStoweName(Element boat, int i) {
|
||||
//StoweName attribute
|
||||
Attr attrStoweName = doc.createAttribute("StoweName");
|
||||
attrStoweName.setValue(boatData.get(i).getCountry());
|
||||
boat.setAttributeNode(attrStoweName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends short name attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendShortName(Element boat, int i) {
|
||||
//ShortName attribute
|
||||
Attr attrShortName = doc.createAttribute("ShortName");
|
||||
attrShortName.setValue(boatData.get(i).getCountry());
|
||||
boat.setAttributeNode(attrShortName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends boat name attribute of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendBoatName(Element boat, int i) {
|
||||
//BoatName attribute
|
||||
Attr attrBoatName = doc.createAttribute("BoatName");
|
||||
attrBoatName.setValue(boatData.get(i).getName());
|
||||
boat.setAttributeNode(attrBoatName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends gps attributes of a boat
|
||||
*
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendGPSCoords(Element boat, int i) {
|
||||
//GPSCoord for element
|
||||
Element GPSCoord = doc.createElement("GPSposition");
|
||||
//Z axis attribute
|
||||
Attr attrZCoord = doc.createAttribute("Z");
|
||||
attrZCoord.setValue("0");
|
||||
GPSCoord.setAttributeNode(attrZCoord);
|
||||
|
||||
//Y axis attribute
|
||||
Attr attrYCoord = doc.createAttribute("Y");
|
||||
attrYCoord.setValue(Double.toString(boatData.get(i).getCurrentPosition().getLatitude()));
|
||||
GPSCoord.setAttributeNode(attrYCoord);
|
||||
|
||||
//X axis attribute
|
||||
Attr attrXCoord = doc.createAttribute("X");
|
||||
attrXCoord.setValue(Double.toString(boatData.get(i).getCurrentPosition().getLongitude()));
|
||||
GPSCoord.setAttributeNode(attrXCoord);
|
||||
|
||||
//Write GPSCoord to boat
|
||||
boat.appendChild(GPSCoord);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,250 +0,0 @@
|
||||
package seng302.Data;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import seng302.DataInput.RaceDataSource;
|
||||
import seng302.Exceptions.InvalidRaceDataException;
|
||||
import seng302.Model.Boat;
|
||||
import seng302.Model.CompoundMark;
|
||||
import seng302.Model.GPSCoordinate;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.StringWriter;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* Created by esa46 on 21/04/17.
|
||||
*/
|
||||
public class RaceData {
|
||||
|
||||
private RaceDataSource dataSource;
|
||||
private Document doc;
|
||||
private Element rootElement;
|
||||
private ZonedDateTime creationTimeDate;
|
||||
|
||||
public RaceData(RaceDataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
creationTimeDate = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AC35 officially formatted xml description of a race.
|
||||
*
|
||||
* @return String containing xml-formatted race description
|
||||
*/
|
||||
public String createXML() {
|
||||
|
||||
try {
|
||||
|
||||
//create base xml document
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
doc = docBuilder.newDocument();
|
||||
|
||||
//create root element (In this case, "Race")
|
||||
rootElement = doc.createElement("Race");
|
||||
doc.appendChild(rootElement);
|
||||
|
||||
appendChildElements();
|
||||
|
||||
// write the content into xml file
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||
DOMSource source = new DOMSource(doc);
|
||||
|
||||
//Serialize document.
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
StreamResult result = new StreamResult(stringWriter);
|
||||
transformer.transform(source, result);
|
||||
|
||||
return stringWriter.toString();
|
||||
|
||||
} catch (ParserConfigurationException pce) {
|
||||
throw new InvalidRaceDataException();
|
||||
} catch (TransformerException tfe) {
|
||||
throw new InvalidRaceDataException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates all necessary child elements and appends them to the xml doc
|
||||
*/
|
||||
private void appendChildElements() {
|
||||
appendRaceId();
|
||||
appendRaceType();
|
||||
appendCreationTimeDate();
|
||||
appendRaceStartTime();
|
||||
appendParticipants();
|
||||
appendCourse();
|
||||
appendCourseLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends race id element
|
||||
*/
|
||||
private void appendRaceId() {
|
||||
Element raceIdElement = doc.createElement("RaceID");
|
||||
raceIdElement.appendChild(doc.createTextNode(Integer.toString(dataSource.getRaceId())));
|
||||
rootElement.appendChild(raceIdElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends race type element
|
||||
*/
|
||||
private void appendRaceType() {
|
||||
Element raceTypeElement = doc.createElement("RaceType");
|
||||
raceTypeElement.appendChild(doc.createTextNode(dataSource.getRaceType()));
|
||||
rootElement.appendChild(raceTypeElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends creation time date element
|
||||
*/
|
||||
private void appendCreationTimeDate() {
|
||||
Element creationTimeElement = doc.createElement("CreationTimeDate");
|
||||
|
||||
|
||||
creationTimeElement.appendChild(doc.createTextNode(toTruncatedString(creationTimeDate)));
|
||||
rootElement.appendChild(creationTimeElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends race start time element, which is 3 minutes after the race was created by default
|
||||
*/
|
||||
private void appendRaceStartTime() {
|
||||
Element startTimeElement = doc.createElement("RaceStartTime");
|
||||
startTimeElement.setAttribute("Time", (toTruncatedString(creationTimeDate.plusMinutes(3))));
|
||||
startTimeElement.setAttribute("Postpone", "false");
|
||||
rootElement.appendChild(startTimeElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends participants element
|
||||
*/
|
||||
private void appendParticipants() {
|
||||
Element participantsElement = doc.createElement("Participants");
|
||||
|
||||
for (Boat boat : dataSource.getBoats()) {
|
||||
Element yachtElement = doc.createElement("Yacht");
|
||||
yachtElement.setAttribute("SourceID", boat.getSourceID() + "");
|
||||
participantsElement.appendChild(yachtElement);
|
||||
}
|
||||
rootElement.appendChild(participantsElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends course elements
|
||||
*/
|
||||
private void appendCourse() {
|
||||
Element courseElement = doc.createElement("Course");
|
||||
Element compoundMarkSeqElement = doc.createElement("CompoundMarkSequence");
|
||||
|
||||
int i = 1;
|
||||
for (CompoundMark compoundMark : dataSource.getCompoundMarks()) {
|
||||
|
||||
courseElement.appendChild(createCompoundMarker(compoundMark, i));
|
||||
compoundMarkSeqElement.appendChild(createCornerElement(i));
|
||||
i++;
|
||||
}
|
||||
|
||||
rootElement.appendChild(compoundMarkSeqElement);
|
||||
rootElement.appendChild(courseElement);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a mark element for insertion in a coumpound mark element
|
||||
*
|
||||
* @param marker GPS coordinates of the mark
|
||||
* @return Element mark element
|
||||
*/
|
||||
private Element createMark(GPSCoordinate marker) {
|
||||
Element mark = doc.createElement("Mark");
|
||||
mark.setAttribute("TargetLat", marker.getLatitude() + "");
|
||||
mark.setAttribute("TargetLng", marker.getLongitude() + "");
|
||||
return mark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a compound compoundMark holding one or two marks,and a sequence number
|
||||
*
|
||||
* @param compoundMark compoundMark
|
||||
* @param i sequence number
|
||||
* @return Element compound mark element
|
||||
*/
|
||||
private Element createCompoundMarker(CompoundMark compoundMark, int i) {
|
||||
Element compoundMarkElement = doc.createElement("CompoundMark");
|
||||
compoundMarkElement.setAttribute("CompoundMarkID", i + "");
|
||||
compoundMarkElement.setAttribute("Name", compoundMark.getName());
|
||||
|
||||
compoundMarkElement.appendChild(createMark(compoundMark.getMark1()));
|
||||
|
||||
if (!(compoundMark.getMark1().equals(compoundMark.getMark2()))) {
|
||||
compoundMarkElement.appendChild(createMark(compoundMark.getMark2()));
|
||||
}
|
||||
|
||||
return compoundMarkElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a corner element
|
||||
*
|
||||
* @param i sequence number
|
||||
* @return Element corner element
|
||||
*/
|
||||
private Element createCornerElement(int i) {
|
||||
Element cornerElement = doc.createElement("Corner");
|
||||
cornerElement.setAttribute("SeqID", i + "");
|
||||
cornerElement.setAttribute("CompoundMarkID", i + "");
|
||||
|
||||
return cornerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends course limits element (boundaries)
|
||||
*/
|
||||
private void appendCourseLimit() {
|
||||
int j = 1;
|
||||
|
||||
Element courseLimitElement = doc.createElement("CourseLimit");
|
||||
for (GPSCoordinate coordinate : dataSource.getBoundary()) {
|
||||
Element limitElement = doc.createElement("Limit");
|
||||
limitElement.setAttribute("SeqID", j + "");
|
||||
limitElement.setAttribute("Lat", coordinate.getLatitude() + "");
|
||||
limitElement.setAttribute("Lon", coordinate.getLongitude() + "");
|
||||
|
||||
courseLimitElement.appendChild(limitElement);
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
rootElement.appendChild(courseLimitElement);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format time data and return it.
|
||||
* @param time time data.
|
||||
* @return formatted time data.
|
||||
*/
|
||||
private String toTruncatedString(ZonedDateTime time) {
|
||||
DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
String text = dateFormat.format(time);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,169 +0,0 @@
|
||||
package seng302.Data;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import seng302.DataInput.RegattaDataSource;
|
||||
import seng302.Exceptions.InvalidRegattaDataException;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* Created by esa46 on 25/04/17.
|
||||
*/
|
||||
public class RegattaData {
|
||||
|
||||
|
||||
private RegattaDataSource regattaDataSource;
|
||||
private Document doc;
|
||||
private Element rootElement;
|
||||
|
||||
public RegattaData(RegattaDataSource regattaDataSource) {
|
||||
this.regattaDataSource = regattaDataSource;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an AC35 officially formatted xml description of a regatta
|
||||
*
|
||||
* @return String containing xml-formatted regatta description
|
||||
*/
|
||||
public String createXML() {
|
||||
|
||||
try {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
|
||||
//root element
|
||||
doc = docBuilder.newDocument();
|
||||
rootElement = doc.createElement("RegattaConfig");
|
||||
doc.appendChild(rootElement);
|
||||
|
||||
appendChildElements();
|
||||
|
||||
// write the content into xml file
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||
DOMSource source = new DOMSource(doc);
|
||||
|
||||
//Serialize document.
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
StreamResult result = new StreamResult(stringWriter);
|
||||
transformer.transform(source, result);
|
||||
|
||||
return stringWriter.toString();
|
||||
|
||||
|
||||
} catch (ParserConfigurationException pce) {
|
||||
throw new InvalidRegattaDataException();
|
||||
} catch (TransformerException tfe) {
|
||||
throw new InvalidRegattaDataException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates all necessary child elements and appends them to the xml doc
|
||||
*/
|
||||
private void appendChildElements() {
|
||||
appendRegattaID();
|
||||
appendRegattaName();
|
||||
appendCourseName();
|
||||
appendCentralLatitude();
|
||||
appendCentralLongitude();
|
||||
appendCentralAltitude();
|
||||
appedUtcOffset();
|
||||
appendMagneticVariation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends regatta id element
|
||||
*/
|
||||
private void appendRegattaID() {
|
||||
//regattaID element
|
||||
Element regattaID = doc.createElement("RegattaID");
|
||||
regattaID.appendChild(doc.createTextNode(Integer.toString(regattaDataSource.getRegatta().getRegattaID())));
|
||||
rootElement.appendChild(regattaID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends regatta name element
|
||||
*/
|
||||
private void appendRegattaName() {
|
||||
//regattaName element
|
||||
Element regattaName = doc.createElement("RegattaName");
|
||||
regattaName.appendChild(doc.createTextNode(regattaDataSource.getRegatta().getRegattaName()));
|
||||
rootElement.appendChild(regattaName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends course name element
|
||||
*/
|
||||
private void appendCourseName() {
|
||||
//courseName element
|
||||
Element courseName = doc.createElement("CourseName");
|
||||
courseName.appendChild(doc.createTextNode(regattaDataSource.getRegatta().getCourseName()));
|
||||
rootElement.appendChild(courseName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends central latitude element
|
||||
*/
|
||||
private void appendCentralLatitude() {
|
||||
//centralLatitude element
|
||||
Element centralLat = doc.createElement("CentralLatitude");
|
||||
centralLat.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralLatitude())));
|
||||
rootElement.appendChild(centralLat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends central longitude element
|
||||
*/
|
||||
private void appendCentralLongitude() {
|
||||
//centralLongitude element
|
||||
Element centralLong = doc.createElement("CentralLongitude");
|
||||
centralLong.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralLongitude())));
|
||||
rootElement.appendChild(centralLong);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends central altitude element
|
||||
*/
|
||||
private void appendCentralAltitude() {
|
||||
//centralAltitude element
|
||||
Element centralAlt = doc.createElement("CentralAltitude");
|
||||
centralAlt.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralAltitude())));
|
||||
rootElement.appendChild(centralAlt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends utc offset element
|
||||
*/
|
||||
private void appedUtcOffset() {
|
||||
//utcOffset element
|
||||
Element utcOffset = doc.createElement("UtcOffset");
|
||||
utcOffset.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getUtcOffset())));
|
||||
rootElement.appendChild(utcOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends magnetic variation element
|
||||
*/
|
||||
private void appendMagneticVariation() {
|
||||
//magneticVariation element
|
||||
Element magneticVariation = doc.createElement("MagneticVariation");
|
||||
magneticVariation.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getMagneticVariation())));
|
||||
rootElement.appendChild(magneticVariation);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue