Class PositionView

java.lang.Object
gaiasky.scene.view.AbstractView
gaiasky.scene.view.PositionView
All Implemented Interfaces:
IPosition
Direct Known Subclasses:
OctreeObjectView

public non-sealed class PositionView extends AbstractView implements IPosition
  • Field Summary

    Fields inherited from class AbstractView

    entity
    Modifier and Type
    Field
    Description
    protected com.badlogic.ashley.core.Entity
    A reference to the entity.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PositionView(com.badlogic.ashley.core.Entity entity)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    componentsCheck(com.badlogic.ashley.core.Entity entity)
    Check whether the current components are the same as the components of the given entity.
    protected void
    Contains actions to take after a new entity has been set.
    protected void
    entityCheck(com.badlogic.ashley.core.Entity entity)
    Checks whether the given entity is suitable for this view.
    protected void
    This method is called when the entity of this view is cleared.
     
     

    Methods inherited from class AbstractView

    check, clearEntity, getEntity, isEmpty, isValid, setEntity
    Modifier and Type
    Method
    Description
    protected void
    check(com.badlogic.ashley.core.Entity entity, com.badlogic.ashley.core.ComponentMapper mapper, Class<? extends com.badlogic.ashley.core.Component> componentClass)
    Checks whether an entity has a component, and throws a RuntimeException if it does not.
    void
    Removes the entity (if any) of this view and sets all component references to null.
    com.badlogic.ashley.core.Entity
    Returns the current entity under this view.
    boolean
    Checks whether an entity is set in this view.
    boolean
    Checks whether the entity is valid, i.e., it is not null and has at least one component.
    void
    setEntity(com.badlogic.ashley.core.Entity entity)
    Sets the entity behind this view.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PositionView

      public PositionView(com.badlogic.ashley.core.Entity entity)
  • Method Details

    • componentsCheck

      protected boolean componentsCheck(com.badlogic.ashley.core.Entity entity)
      Description copied from class: AbstractView
      Check whether the current components are the same as the components of the given entity.
      Specified by:
      componentsCheck in class AbstractView
      Parameters:
      entity - The entity to check.
      Returns:
      True if the components are the same, false otherwise.
    • entityCheck

      protected void entityCheck(com.badlogic.ashley.core.Entity entity)
      Description copied from class: AbstractView
      Checks whether the given entity is suitable for this view. This method should throw a RuntimeException if the entity is not suitable.
      Specified by:
      entityCheck in class AbstractView
      Parameters:
      entity - The entity.
    • entityChanged

      protected void entityChanged()
      Description copied from class: AbstractView
      Contains actions to take after a new entity has been set. This method is typically used to initialize the view components.
      Specified by:
      entityChanged in class AbstractView
    • entityCleared

      protected void entityCleared()
      Description copied from class: AbstractView
      This method is called when the entity of this view is cleared. It should set all component references to null.
      Specified by:
      entityCleared in class AbstractView
    • getPosition

      public Vector3Q getPosition()
      Specified by:
      getPosition in interface IPosition
    • getVelocity

      public Vector3D getVelocity()
      Specified by:
      getVelocity in interface IPosition