Class LayoutLocation


  • public final class LayoutLocation
    extends Object
    Represents a "node location" on a UI layout.
    • Method Detail

      • isOrigin

        public boolean isOrigin()
        Returns true if the coordinates indicate the origin (0, 0) of the coordinate system; false otherwise.
        Returns:
        true if geo-coordinates are set; false otherwise
      • id

        public String id()
        Returns the identifier associated with this location.
        Returns:
        the identifier
      • locType

        public LayoutLocation.Type locType()
        Returns the location type (geo or grid), which indicates how the data is to be interpreted.
        Returns:
        location type
      • latOrY

        public double latOrY()
        Returns the latitude (geo) or y-coord (grid) data value.
        Returns:
        geo latitude or grid y-coord
      • longOrX

        public double longOrX()
        Returns the longitude (geo) or x-coord (grid) data value.
        Returns:
        geo longitude or grid x-coord
      • toCompactListString

        public String toCompactListString()
        Produces a compact string representation of this instance.
        Returns:
        compact string rep
      • fromCompactString

        public static LayoutLocation fromCompactString​(String s)
        Produces a layout location instance from a compact string representation.
        Parameters:
        s - the compact string
        Returns:
        a corresponding instance
      • toCompactListString

        public static String toCompactListString​(LayoutLocation... locs)
        Produces a compact encoding of a list of layout locations.
        Parameters:
        locs - array of layout location instances
        Returns:
        string encoding
      • toCompactListString

        public static String toCompactListString​(List<LayoutLocation> locs)
        Produces a compact encoding of a list of layout locations.
        Parameters:
        locs - list of layout location instances
        Returns:
        string encoding
      • fromCompactListString

        public static List<LayoutLocation> fromCompactListString​(String compactList)
        Returns a list of layout locations from a compact string representation.
        Parameters:
        compactList - string representation
        Returns:
        corresponding list of layout locations
      • layoutLocation

        public static LayoutLocation layoutLocation​(String id,
                                                    LayoutLocation.Type locType,
                                                    double latOrY,
                                                    double longOrX)
        Creates an instance of a layout location.
        Parameters:
        id - an identifier for the item at this location
        locType - the location type
        latOrY - geo latitude / grid y-coord
        longOrX - geo longitude / grid x-coord
        Returns:
        layout location instance
      • layoutLocation

        public static LayoutLocation layoutLocation​(String id,
                                                    String locType,
                                                    double latOrY,
                                                    double longOrX)
        Creates an instance of a layout location.
        Parameters:
        id - an identifier for the item at this location
        locType - the location type ("geo" or "grid")
        latOrY - geo latitude / grid y-coord
        longOrX - geo longitude / grid x-coord
        Returns:
        layout location instance
        Throws:
        IllegalArgumentException - if the type is not "geo" or "grid"