Class Layer

All Implemented Interfaces:
ICustomPropertyProvider, ILayer
Direct Known Subclasses:
GroupLayer, ImageLayer, MapObjectLayer, TileLayer

public abstract class Layer extends CustomPropertyProvider implements ILayer
Represents an abstract layer in a tile map. This class extends the CustomPropertyProvider class and implements the ILayer interface.
  • Constructor Details

    • Layer

      protected Layer()
      Default constructor for the Layer class. Initializes a new instance of the Layer class with default values.
    • Layer

      protected Layer(Layer layerToBeCopied)
      Copy constructor for the Layer class. Creates a new instance of the Layer class by copying the properties from the provided Layer object.
      Parameters:
      layerToBeCopied - The Layer object to copy from.
  • Method Details

    • getHeight

      public int getHeight()
      Gets the height.
      Specified by:
      getHeight in interface ILayer
      Returns:
      the height
    • getId

      public int getId()
      Description copied from interface: ILayer
      Gets the unique id of the layer.
      Specified by:
      getId in interface ILayer
      Returns:
      the layer id
    • getName

      public String getName()
      Description copied from interface: ILayer
      Gets the name.
      Specified by:
      getName in interface ILayer
      Returns:
      the name
    • getOpacity

      public float getOpacity()
      Description copied from interface: ILayer
      Gets the opacity.
      Specified by:
      getOpacity in interface ILayer
      Returns:
      the opacity
    • getOffset

      public Point2D getOffset()
      Description copied from interface: ILayer
      Gets both the X and the Y offset of the layer.
      Specified by:
      getOffset in interface ILayer
      Returns:
      a Point2D representing the offset
    • getOffsetX

      public double getOffsetX()
      Description copied from interface: ILayer
      Gets the horizontal offset of the layer.
      Specified by:
      getOffsetX in interface ILayer
      Returns:
      the x offset
    • getOffsetY

      public double getOffsetY()
      Description copied from interface: ILayer
      Gets the vertical offset of the layer.
      Specified by:
      getOffsetY in interface ILayer
      Returns:
      the y offset
    • getHorizontalParallaxFactor

      public double getHorizontalParallaxFactor()
      Description copied from interface: ILayer
      Gets the horizontal parallax scrolling factor of the layer. Defaults to 1.0.
      Specified by:
      getHorizontalParallaxFactor in interface ILayer
      Returns:
      The horizontal parallax scrolling factor.
    • getVerticalParallaxFactor

      public double getVerticalParallaxFactor()
      Description copied from interface: ILayer
      Gets the vertical parallax scrolling factor of the layer. Defaults to 1.0.
      Specified by:
      getVerticalParallaxFactor in interface ILayer
      Returns:
      The vertical parallax scrolling factor.
    • getTintColor

      public Color getTintColor()
      Description copied from interface: ILayer
      Gets a tint color that affects the way contents of this layer are rendered.
      Specified by:
      getTintColor in interface ILayer
      Returns:
      A color that is used to tint the visible contents of this layer.
    • setTintColor

      public void setTintColor(Color tintColor)
      Description copied from interface: ILayer
      Sets the tint color of this layer.
      Specified by:
      setTintColor in interface ILayer
      Parameters:
      tintColor - The tint color of this layer.
    • getRenderType

      public RenderType getRenderType()
      Description copied from interface: ILayer
      Gets the render type used when drawing this layer.
      Specified by:
      getRenderType in interface ILayer
      Returns:
      the render type
    • getSizeInTiles

      public Dimension getSizeInTiles()
      Description copied from interface: ILayer
      Gets the size in tiles.
      Specified by:
      getSizeInTiles in interface ILayer
      Returns:
      the size in tiles
    • getWidth

      public int getWidth()
      Gets the width.
      Specified by:
      getWidth in interface ILayer
      Returns:
      the width
    • getMap

      public IMap getMap()
      Description copied from interface: ILayer
      Gets the map that owns this layer.
      Specified by:
      getMap in interface ILayer
      Returns:
      the owning map
    • isVisible

      public boolean isVisible()
      Description copied from interface: ILayer
      Checks if is visible.
      Specified by:
      isVisible in interface ILayer
      Returns:
      true, if is visible
    • setName

      public void setName(String name)
      Description copied from interface: ILayer
      Sets the name of the layer.
      Specified by:
      setName in interface ILayer
      Parameters:
      name - the layer name
    • setWidth

      public void setWidth(int width)
      Description copied from interface: ILayer
      Sets the width of the layer, in tiles.
      Specified by:
      setWidth in interface ILayer
      Parameters:
      width - the new width in tiles
    • setHeight

      public void setHeight(int height)
      Description copied from interface: ILayer
      Sets the height of the layer, in tiles.
      Specified by:
      setHeight in interface ILayer
      Parameters:
      height - the new height in tiles
    • setOpacity

      public void setOpacity(float opacity)
      Description copied from interface: ILayer
      Sets the opacity of the layer in the range [0, 1].
      Specified by:
      setOpacity in interface ILayer
      Parameters:
      opacity - the opacity to set
    • setRenderType

      public void setRenderType(RenderType renderType)
      Description copied from interface: ILayer
      Sets the render type used when drawing this layer.
      Specified by:
      setRenderType in interface ILayer
      Parameters:
      renderType - the render type
    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: ILayer
      Sets whether the layer is visible.
      Specified by:
      setVisible in interface ILayer
      Parameters:
      visible - true to make the layer visible
    • setMap

      protected void setMap(TmxMap map)
    • afterUnmarshal

      protected void afterUnmarshal(jakarta.xml.bind.Unmarshaller u, Object parent)