Class Environment

java.lang.Object
org.openstreetmap.josm.gui.mappaint.Environment

public class Environment extends Object
Environment is a data object to provide access to various "global" parameters. It is used during processing of MapCSS rules and for the generation of style elements.
  • Field Details

  • Constructor Details

    • Environment

      public Environment()
      Creates a new uninitialized environment.
    • Environment

      public Environment(IPrimitive osm)
      Creates a new environment.
      Parameters:
      osm - OSM primitive
      Since:
      8415, 13810 (signature)
    • Environment

      public Environment(IPrimitive osm, MultiCascade mc, String layer, StyleSource source)
      Creates a new environment.
      Parameters:
      osm - OSM primitive
      mc - multi cascade
      layer - layer
      source - style source
      Since:
      13810 (signature)
    • Environment

      public Environment(Environment other)
      Creates a clone of the environment other.
      Parameters:
      other - the other environment. Must not be null.
      Throws:
      IllegalArgumentException - if param is null
    • Environment

      private Environment(Environment other, Selector selector)
      Creates a clone of the environment other.
      Parameters:
      other - the other environment. Must not be null.
      selector - the selector for this environment. May be null.
      Throws:
      IllegalArgumentException - if param is null
  • Method Details

    • withPrimitive

      Creates a clone of this environment, with the specified primitive.
      Parameters:
      osm - OSM primitive
      Returns:
      A clone of this environment, with the specified primitive
      Since:
      13810 (signature)
      See Also:
    • withParent

      Creates a clone of this environment, with the specified parent.
      Parameters:
      parent - the matching parent object
      Returns:
      A clone of this environment, with the specified parent
      Since:
      13810 (signature)
      See Also:
    • withParentAndIndexAndLinkContext

      public Environment withParentAndIndexAndLinkContext(IPrimitive parent, int index, int count)
      Creates a clone of this environment, with the specified parent, index, and context set to Condition.Context.LINK.
      Parameters:
      parent - the matching parent object
      index - index of node in parent way or member in parent relation
      count - count of nodes in parent way or members in parent relation
      Returns:
      A clone of this environment, with the specified parent, index, and context set to Condition.Context.LINK
      Since:
      6175, 13810 (signature)
      See Also:
    • withChild

      Creates a clone of this environment, with the specified child.
      Parameters:
      child - the matching child object
      Returns:
      A clone of this environment, with the specified child
      Since:
      13810 (signature)
      See Also:
    • withChildAndIndexAndLinkContext

      public Environment withChildAndIndexAndLinkContext(IPrimitive child, int index, int count)
      Creates a clone of this environment, with the specified child, index, and context set to Condition.Context.LINK.
      Parameters:
      child - the matching child object
      index - index of node in parent way or member in parent relation
      count - count of nodes in parent way or members in parent relation
      Returns:
      A clone of this environment, with the specified child, index, and context set to Context#LINK
      Since:
      6175, 13810 (signature)
      See Also:
    • withIndex

      public Environment withIndex(int index, int count)
      Creates a clone of this environment, with the specified index.
      Parameters:
      index - index of node in parent way or member in parent relation
      count - count of nodes in parent way or members in parent relation
      Returns:
      A clone of this environment, with the specified index
      See Also:
    • withContext

      Creates a clone of this environment, with the specified Condition.Context.
      Parameters:
      context - context
      Returns:
      A clone of this environment, with the specified Context
    • withLinkContext

      Creates a clone of this environment, with context set to Condition.Context.LINK.
      Returns:
      A clone of this environment, with context set to Context#LINK
    • withSelector

      public Environment withSelector(Selector selector)
      Creates a clone of this environment, with the selector set
      Parameters:
      selector - The selector to use
      Returns:
      A clone of this environment, with the specified selector
      Since:
      18757
    • isLinkContext

      public boolean isLinkContext()
      Determines if the context of this environment is Condition.Context.LINK.
      Returns:
      true if the context of this environment is Context#LINK, false otherwise
    • hasParentRelation

      public boolean hasParentRelation()
      Determines if this environment has a relation as parent.
      Returns:
      true if this environment has a relation as parent, false otherwise
      See Also:
    • getContext

      Replies the current context.
      Returns:
      the current context
    • getRole

      public String getRole()
      Gets the role of the matching primitive in the relation
      Returns:
      The role
    • selector

      public Selector selector()
      Get the selector for this environment
      Returns:
      The selector. May be null.
      Since:
      18757
    • clearSelectorMatchingInformation

      Clears all matching context information
      Returns:
      this
    • getCascade

      public Cascade getCascade()
      Gets the current cascade for the current layer of this environment
      Returns:
      The cascade
    • getCascade

      public Cascade getCascade(String layer)
      Gets the current cascade for a given layer
      Parameters:
      layer - The layer to use, null to use the layer of the Environment
      Returns:
      The cascade