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.Document
doc
(package private) org.jdom2.Element
root
-
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.String
defaultFilename()
static java.lang.String
defaultLocation()
java.lang.String
getAlgorithm()
javax.vecmath.Point3d
getCalibrationPosition(int n)
Get the nth calibration position in the file.Reading
getCalibrationReading(int n)
Get the nth calibration reading in the file.int
getOffset()
boolean
getReceiverActive(int n)
Get the nth receiver active state in the file.int
getReceiverMax(int n)
Get the nth receiver max time.int
getReceiverMin(int n)
Get the nth receiver min time.javax.vecmath.Point3d
getReceiverPosition(int n)
Get the nth receiver position in the file.double
getVSound()
void
loadFile(java.io.File f)
Read in the file, and make available for examination.int
maxReceiver()
FInd the highest numbered receiver in the file(package private) org.jdom2.Element
positionElement(javax.vecmath.Point3d p)
javax.vecmath.Point3d
positionFromElement(org.jdom2.Element position)
void
prepare()
Initialize for writing information.(package private) org.jdom2.Element
readingElement(Reading r)
Reading
readingFromElement(org.jdom2.Element reading)
void
setCalibrationPoint(javax.vecmath.Point3d p, Reading r)
void
setConstants(double vSound, int offset, java.lang.String algorithm)
void
setReceiver(int n, javax.vecmath.Point3d p, boolean active)
void
setReceiver(int n, Receiver r)
void
store(java.io.File file)
(package private) org.jdom2.Element
timeElement(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()
-
-