Package jmri

Class Scale

All Implemented Interfaces:
BeanInterface, PropertyChangeFirer, PropertyChangeProvider, VetoableChangeProvider

public class Scale
extends ConstrainedBean
Define the characteristics of a layout scale. A scale has four properties.
  • Name - A fixed string, such N or HO.
  • User name - An alternate name that can be changed. It defaults to the scale name.
  • Ratio - The ratio for the scale, such as 160 for N scale.
  • Factor - A derived value created by dividing 1 by the scale ratio.
In addition to the standard scales, there is custom entry. Custom settings are retained in a local copy of ScaleData.xml.

Methods are provided to set/get the user name and the scale ratio. The scale factor is generated from the scale ratio and is read only, as is the scale name.

While changing the ratio and user names of the standard scales is not prohibited, doing so is not recommended due to potential conflicts with other applications.

Changes to user names and ratios send a vetoableChange event. Interested applications can add a vetoableChange listener in order to be notified when an event occurs. If the listener determines that the change cannot occur, it can throw a PropertyVetoException.

See Scale Manager for manager details.