Package jmri.jmrix.rps
Class PositionFile
- java.lang.Object
-
- jmri.jmrit.XmlFile
-
- jmri.jmrix.rps.PositionFile
-
public class PositionFile extends XmlFile
Persist RPS configuration information.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrit.XmlFile
XmlFile.Validate
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.jdom2.Documentdoc(package private) org.jdom2.Elementroot-
Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation
-
-
Constructor Summary
Constructors Constructor Description PositionFile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringdefaultFilename()static java.lang.StringdefaultLocation()java.lang.StringgetAlgorithm()javax.vecmath.Point3dgetCalibrationPosition(int n)Get the nth calibration position in the file.ReadinggetCalibrationReading(int n)Get the nth calibration reading in the file.intgetOffset()booleangetReceiverActive(int n)Get the nth receiver active state in the file.intgetReceiverMax(int n)Get the nth receiver max time.intgetReceiverMin(int n)Get the nth receiver min time.javax.vecmath.Point3dgetReceiverPosition(int n)Get the nth receiver position in the file.doublegetVSound()voidloadFile(java.io.File f)Read in the file, and make available for examination.intmaxReceiver()FInd the highest numbered receiver in the file(package private) org.jdom2.ElementpositionElement(javax.vecmath.Point3d p)javax.vecmath.Point3dpositionFromElement(org.jdom2.Element position)voidprepare()Initialize for writing information.(package private) org.jdom2.ElementreadingElement(Reading r)ReadingreadingFromElement(org.jdom2.Element reading)voidsetCalibrationPoint(javax.vecmath.Point3d p, Reading r)voidsetConstants(double vSound, int offset, java.lang.String algorithm)voidsetReceiver(int n, javax.vecmath.Point3d p, boolean active)voidsetReceiver(int n, Receiver r)voidstore(java.io.File file)(package private) org.jdom2.ElementtimeElement(double time)-
Methods inherited from class jmri.jmrit.XmlFile
addDefaultInfo, backupFileName, checkFile, createFileNameWithDate, dumpElement, findFile, getBuilder, getDefaultDtdLocation, getDefaultValidate, getDtdLocation, getProcessingInstructionHRef, getProcessingInstructionType, getRoot, getValidate, makeBackupFile, makeBackupFile, newDocument, newDocument, revertBackupFile, rootFromFile, rootFromInputStream, rootFromName, rootFromURL, setDefaultDtdLocation, setDefaultValidate, setDtdLocation, setValidate, userFileChooser, userFileChooser, writeXML, xmlDir
-
-
-
-
Constructor Detail
-
PositionFile
public PositionFile()
-
-
Method Detail
-
prepare
public void prepare()
Initialize for writing information.This is followed by multiple "set" calls, then a "store".
-
setConstants
public void setConstants(double vSound, int offset, java.lang.String algorithm)
-
setReceiver
public void setReceiver(int n, Receiver r)
-
setReceiver
public void setReceiver(int n, javax.vecmath.Point3d p, boolean active)
-
setCalibrationPoint
public void setCalibrationPoint(javax.vecmath.Point3d p, Reading r)
-
positionElement
org.jdom2.Element positionElement(javax.vecmath.Point3d p)
-
positionFromElement
public javax.vecmath.Point3d positionFromElement(org.jdom2.Element position)
-
readingElement
org.jdom2.Element readingElement(Reading r)
-
readingFromElement
public Reading readingFromElement(org.jdom2.Element reading)
-
timeElement
org.jdom2.Element timeElement(double time)
-
store
public void store(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
loadFile
public void loadFile(java.io.File f) throws org.jdom2.JDOMException, java.io.IOException
Read in the file, and make available for examination.- Parameters:
f- file to load.- Throws:
org.jdom2.JDOMException- other errorsjava.io.IOException- error accessing file
-
getVSound
public double getVSound()
-
getOffset
public int getOffset()
-
getAlgorithm
public java.lang.String getAlgorithm()
-
maxReceiver
public int maxReceiver()
FInd the highest numbered receiver in the file- Returns:
- highest numbered receiver.
-
getReceiverPosition
public javax.vecmath.Point3d getReceiverPosition(int n)
Get the nth receiver position in the file.- Parameters:
n- receiver index.- Returns:
- null if not present
-
getReceiverActive
public boolean getReceiverActive(int n)
Get the nth receiver active state in the file.- Parameters:
n- receiver index.- Returns:
- true if not present
-
getReceiverMin
public int getReceiverMin(int n)
Get the nth receiver min time.- Parameters:
n- receiver index.- Returns:
- 0 if not present
-
getReceiverMax
public int getReceiverMax(int n)
Get the nth receiver max time.- Parameters:
n- receiver index.- Returns:
- 0 if not present
-
getCalibrationPosition
public javax.vecmath.Point3d getCalibrationPosition(int n)
Get the nth calibration position in the file.- Parameters:
n- calibration index.- Returns:
- null if not present
-
getCalibrationReading
public Reading getCalibrationReading(int n)
Get the nth calibration reading in the file.- Parameters:
n- reading index.- Returns:
- null if not present
-
defaultLocation
public static java.lang.String defaultLocation()
-
defaultFilename
public static java.lang.String defaultFilename()
-
-