java.lang.Object
cz.fidentis.analyst.data.surfacemask.impl.LayerImpl
All Implemented Interfaces:
Layer

public class LayerImpl extends Object implements Layer
Represents a single layer within a SurfaceMaskLayers, containing a surface mask and a history of previous states for undo/redo functionality.
  • Constructor Details

    • LayerImpl

      public LayerImpl()
      Constructs a new Layer with the specified surface mask.
  • Method Details

    • getCurrentMask

      public SurfaceMask2D getCurrentMask()
      Description copied from interface: Layer
      Returns the current surface mask in this layer.
      Specified by:
      getCurrentMask in interface Layer
      Returns:
      The current SurfaceMask2D.
    • setCurrentMask

      public void setCurrentMask(int dir)
      Description copied from interface: Layer
      Sets a new current surface mask for this layer.
      Specified by:
      setCurrentMask in interface Layer
      Parameters:
      dir - 1 - forward; -1 - back in masks.
    • setCurrentMask

      public void setCurrentMask(SurfaceMask2D mask)
      Description copied from interface: Layer
      Sets a new current
      Specified by:
      setCurrentMask in interface Layer
      Parameters:
      mask - mask to be set as current
    • getAllMasks

      public List<SurfaceMask2D> getAllMasks()
      Description copied from interface: Layer
      Returns all surface masks in this layer.
      Specified by:
      getAllMasks in interface Layer
      Returns:
      A list of all SurfaceMask2D objects in this layer.
    • addMask

      public void addMask(SurfaceMask2D mask)
      Description copied from interface: Layer
      Adds a new surface mask to this layer and sets it as the current mask.
      Specified by:
      addMask in interface Layer
      Parameters:
      mask - The SurfaceMask2D to be added.
    • setVisibility

      public void setVisibility(boolean visible)
      Description copied from interface: Layer
      Sets the visibility of this layer.
      Specified by:
      setVisibility in interface Layer
      Parameters:
      visible - true to make the layer visible; false to hide it.
    • updateHistory

      public void updateHistory()
      Description copied from interface: Layer
      Update the history, if the max depth is exceeded, the history is halved, and sets the current index to the last entry added.
      Specified by:
      updateHistory in interface Layer
    • isVisible

      public boolean isVisible()
      Description copied from interface: Layer
      Checks if the layer is currently visible.
      Specified by:
      isVisible in interface Layer
      Returns:
      true if the layer is visible; false otherwise.
    • goBack

      public void goBack()
      Description copied from interface: Layer
      Moves back to the previous mask state in the history if possible.
      Specified by:
      goBack in interface Layer
    • goForward

      public void goForward()
      Description copied from interface: Layer
      Moves forward to the next mask state in the history if possible.
      Specified by:
      goForward in interface Layer
    • updateMask

      public void updateMask(SurfaceMask2D oldMask, SurfaceMask2D newMask)
      Description copied from interface: Layer
      Updates mask according to 3D
      Specified by:
      updateMask in interface Layer
      Parameters:
      oldMask - Original mask
      newMask - New mask