Class ImageObject

All Implemented Interfaces:
Serializable, Cloneable, Map<String,String>
Direct Known Subclasses:
Composite

public class ImageObject extends HashMap<String,String>
Describes an image-and-properties-based object. For details, see Image-and-property-based description of objects
See Also:
  • Field Details

    • key

      public String key
      A relative path (under the main shapes dir) or absolute path (for images elsewhere), case-sensitive and complete with the extension.
    • file

      public final File file
      For static objects, this is the SVG file for the image. For dynamically generated ones, null.
  • Constructor Details

    • ImageObject

      protected ImageObject()
      Used by Composite
  • Method Details

    • getKey

      public String getKey()
    • getSvg

      public String getSvg()
      The SVG code for the image, if available. It is mandatory for dynamically generated ImageObjects (/composite). For static ones, it may or may not be null.
    • clearTable

      public static void clearTable()
    • enlist

      public void enlist()
      Enters this ImageObject into the master table
    • obtainImageObjectPlain

      public static ImageObject obtainImageObjectPlain(File dir, String plainPath, boolean allowMissing)
      Retrieves the ImageObject for a specified path (no wildcards!) from the master table. If necessary, tries to add that object (and all other objects listed in the properties file in that directory) to the master table.
      Parameters:
      dir - If provided, plainPath is understood as being relative to it.
      plainPath - The image path (relative to dir, or absolute if dir==null). Must not contain wildcards. May contain an extension (e.g. ".png" or ".svg"); if it does not, ".svg" will be added.
    • obtainImageObjectPlain

      public static ImageObject obtainImageObjectPlain(File f)
    • obtainImageObjectPlain

      public static ImageObject obtainImageObjectPlain(File f, boolean allowMissing)
      Parameters:
      allowMissing - If true, simply return null, rather than throw exception, when the file is not listed in the prop file
    • obtainImageObjects

      public static Vector<ImageObject> obtainImageObjects(String wildCardPath)
      Loads an image object (or a group of them, if a wildcard is given).
      Parameters:
      path - One of the values from the "images" column of ParaSet. It is either a path (maybe with wildcards) relative to game-data/shapes, or a /composite/... string refering to a dynamically generated Composite ImageObject (or a group of them).
      Returns:
      a Vector of "regular" ImageObjects (associated with the file(s) given by the wildCardPath), or a Composite ImageObject (maybe a "family" one) is the path is of that kind.
    • listProperties

      public String listProperties()
    • listProperties

      public String listProperties(String sep)
      Produces a "key1:val1, key2:val2, ..." list, with a desired separator.
    • symbol

      public String symbol()
      For use in ASCII graphics