Package jmri

Class ScaleManager


  • public class ScaleManager
    extends java.lang.Object
    Create a list of layout scale objects and provide retrieval methods.

    See Scale for details of each scale object.

    Since:
    4.13.6
    • Constructor Summary

      Constructors 
      Constructor Description
      ScaleManager()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addScale​(java.lang.String scaleName, java.lang.String userName, double scaleRatio)
      Create a scale instance and add it to the map.
      static Scale getScale​(java.lang.String name)
      Get the scale that corresponds to the supplied scale name, otherwise null.
      static Scale getScaleByName​(java.lang.String name)
      Get the scale that matches the user name, the scale name, or null.
      static java.util.ArrayList<Scale> getScales()
      Get a list of all scale entries sorted by user name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addScale

        public static void addScale​(java.lang.String scaleName,
                                    java.lang.String userName,
                                    double scaleRatio)
        Create a scale instance and add it to the map.
        Parameters:
        scaleName - The scale name, such as HO.
        userName - The user name. By default the same as the scale name.
        scaleRatio - The ratio for the scale, such as 87.1.
      • getScale

        public static Scale getScale​(@Nonnull
                                     java.lang.String name)
        Get the scale that corresponds to the supplied scale name, otherwise null.
        Parameters:
        name - The scale name.
        Returns:
        The selected scale or null.
      • getScales

        public static java.util.ArrayList<ScalegetScales()
        Get a list of all scale entries sorted by user name.
        Returns:
        The sorted scale list.
      • getScaleByName

        public static Scale getScaleByName​(@Nonnull
                                           java.lang.String name)
        Get the scale that matches the user name, the scale name, or null. The user names are searched first. If not found then the scale name is used.
        Parameters:
        name - The user name or scale name.
        Returns:
        The selected scale or null.