Package jmri.jmrit.timetable
Class Layout
java.lang.Object
jmri.jmrit.timetable.Layout
- All Implemented Interfaces:
VetoableChangeListener,EventListener
Define the content of a Layout record.
The fast clock, scale and metric values affect the scale mile / scale km. When these are changed, the stop times for all of the trains have to be re-calculated. Depending on the schedule limits, this can result in calculation errors. When this occurs, exceptions occur which trigger rolling back the changes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCopy()Make a copy of the layout.intintbooleandoublegetRatio()getScale()doubleintvoidsetFastClock(int newClock) Set a new fast clock speed, update smile/skm.voidsetLayoutName(String newName) voidsetMetric(boolean newMetric) Set metric flag, update smile/skm.voidvoidCalculate the length of a scale mile or scale kilometer.voidsetThrottles(int newThrottles) Set the new value for throttles.toString()voidListen for ratio changes to my current scale.
-
Field Details
-
SCALE_RATIO
- See Also:
-
_dm
-
-
Constructor Details
-
Layout
public Layout()Create a new layout with default values. -
Layout
-
-
Method Details
-
getCopy
Make a copy of the layout.- Returns:
- a new layout instance.
-
setScaleMK
Calculate the length of a scale mile or scale kilometer. The values are adjusted for scale and fast clock ratio. The resulting value is the real feet or meters. The final step is to re-calculate the train times.- Throws:
IllegalArgumentException- The calculate can throw an exception which will get re-thrown.
-
getScaleMK
-
getLayoutId
-
getLayoutName
-
setLayoutName
-
getRatio
-
getScale
-
setScale
-
getFastClock
-
setFastClock
Set a new fast clock speed, update smile/skm.- Parameters:
newClock- The value to be used.- Throws:
IllegalArgumentException- (CLOCK_LT_1) if the value is less than 1. will also re-throw a recalc error.
-
getThrottles
-
setThrottles
Set the new value for throttles.- Parameters:
newThrottles- The new throttle count.- Throws:
IllegalArgumentException- (THROTTLES_USED, THROTTLES_LT_0) when the new count is less than train references or a negative number was passed.
-
getMetric
-
setMetric
Set metric flag, update smile/skm.- Parameters:
newMetric- True for metric units.- Throws:
IllegalArgumentException- if there was a recalc error.
-
toString
-
vetoableChange
Listen for ratio changes to my current scale. Verify that the new ratio is neither too small nor too large. Too large can cause train times to move outside of the schedule window. If the new ratio is invalid, the change will be vetoed.- Specified by:
vetoableChangein interfaceVetoableChangeListener- Parameters:
evt- The scale ratio property change event.- Throws:
PropertyVetoException- The message will depend on the actual error.
-