Class FocusView

All Implemented Interfaces:
IFocus, IVisibilitySwitch

public class FocusView extends BaseView implements IFocus, IVisibilitySwitch
  • Field Details Link icon

    • extra Link icon

      protected ParticleExtra extra
      Particle component, maybe.
  • Constructor Details Link icon

    • FocusView Link icon

      public FocusView(Scene scene)
      Creates a focus view with the given scene.
    • FocusView Link icon

      public FocusView()
      Creates an empty focus view.
    • FocusView Link icon

      public FocusView(com.badlogic.ashley.core.Entity entity)
      Creates an abstract view with the given entity.
      Parameters:
      entity - The entity.
  • Method Details Link icon

    • entityCheck Link icon

      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.
      Overrides:
      entityCheck in class BaseView
      Parameters:
      entity - The entity.
    • entityChanged Link icon

      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.
      Overrides:
      entityChanged in class BaseView
    • entityCleared Link icon

      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.
      Overrides:
      entityCleared in class BaseView
    • setScene Link icon

      public void setScene(Scene scene)
    • isParticle Link icon

      public boolean isParticle()
    • getId Link icon

      public long getId()
      Description copied from interface: IFocus
      Return the unique id of this focus.
      Specified by:
      getId in interface IFocus
      Returns:
      The id.
    • getCandidateId Link icon

      public long getCandidateId()
      Description copied from interface: IFocus
      Return the id of the focus candidate of this object. Defaults to IFocus.getId().
      Specified by:
      getCandidateId in interface IFocus
      Returns:
      The id of the candidate.
    • getLocalizedName Link icon

      public String getLocalizedName()
      Description copied from interface: IFocus
      Return the localized name of this focus. If it has no localized name, it returns the default name.
      Specified by:
      getLocalizedName in interface IFocus
      Returns:
      The localized name.
    • getName Link icon

      public String getName()
      Description copied from interface: IFocus
      Return the first name of this focus.
      Specified by:
      getName in interface IFocus
      Specified by:
      getName in interface IVisibilitySwitch
      Returns:
      The first name.
    • setName Link icon

      public void setName(String name)
      Specified by:
      setName in interface IVisibilitySwitch
    • getNames Link icon

      public String[] getNames()
      Description copied from interface: IFocus
      Return all names of this focus.
      Specified by:
      getNames in interface IFocus
      Returns:
      All names of this focus.
    • hasName Link icon

      public boolean hasName(String name)
      Description copied from interface: IFocus
      Checks whether the focus has the given name.
      Specified by:
      hasName in interface IFocus
      Parameters:
      name - The name.
      Returns:
      True if there is a match.
    • hasName Link icon

      public boolean hasName(String name, boolean matchCase)
      Description copied from interface: IFocus
      Checks whether the focus has the given name.
      Specified by:
      hasName in interface IFocus
      Parameters:
      name - The name.
      matchCase - Whether to match the case when comparing.
      Returns:
      True if there is a match.
    • getDescription Link icon

      public String getDescription()
      Specified by:
      getDescription in interface IVisibilitySwitch
    • setDescription Link icon

      public void setDescription(String description)
      Specified by:
      setDescription in interface IVisibilitySwitch
    • getNumParticles Link icon

      public int getNumParticles()
    • getDataFile Link icon

      public String getDataFile()
    • isVisible Link icon

      public boolean isVisible(String name)
      Specified by:
      isVisible in interface IVisibilitySwitch
    • isVisibleGroup Link icon

      public boolean isVisibleGroup()
    • setVisibleGroup Link icon

      public void setVisibleGroup(boolean visibility)
    • isVisibleGroup Link icon

      public boolean isVisibleGroup(boolean attributeValue)
    • setVisible Link icon

      public void setVisible(boolean visible, String name)
      Specified by:
      setVisible in interface IVisibilitySwitch
      Overrides:
      setVisible in class BaseView
    • getClosestName Link icon

      public String getClosestName()
      Description copied from interface: IFocus
      Specified by:
      getClosestName in interface IFocus
      Returns:
      The name.
    • getCandidateName Link icon

      public String getCandidateName()
      Description copied from interface: IFocus
      Return the name of the focus candidate of this object. Defaults to IFocus.getName().
      Specified by:
      getCandidateName in interface IFocus
      Returns:
      The name of the candidate.
    • getCt Link icon

      public ComponentTypes getCt()
      Description copied from interface: IFocus
      Return the component types of this focus.
      Specified by:
      getCt in interface IFocus
      Returns:
      The component types.
    • isFocusActive Link icon

      public boolean isFocusActive()
      Description copied from interface: IFocus
      Return whether this focus object is active or not. The active status determines whether the object can be focussed or not.
      Specified by:
      isFocusActive in interface IFocus
      Returns:
      The active status.
    • getPos Link icon

      public Vector3b getPos()
      Description copied from interface: IFocus
      Return the position.
      Specified by:
      getPos in interface IFocus
      Returns:
      The position.
    • getFirstStarAncestor Link icon

      public IFocus getFirstStarAncestor()
      Specified by:
      getFirstStarAncestor in interface IFocus
    • getFirstStarAncestor Link icon

      public IFocus getFirstStarAncestor(FocusView view)
    • getFirstStarAncestorEntity Link icon

      public com.badlogic.ashley.core.Entity getFirstStarAncestorEntity()
      Description copied from interface: IFocus
      Gets the first ancestor of this node that is a star.
      Specified by:
      getFirstStarAncestorEntity in interface IFocus
      Returns:
      The first star ancestor.
    • getAbsolutePosition Link icon

      public Vector3b getAbsolutePosition(Vector3b out)
      Description copied from interface: IFocus
      Return the absolute position of this entity in the native coordinates (equatorial system).
      Specified by:
      getAbsolutePosition in interface IFocus
      Parameters:
      out - The out vector.
      Returns:
      The absolute position, same as aux.
    • getAbsolutePosition Link icon

      public Vector3b getAbsolutePosition(String name, Vector3b out)
      Description copied from interface: IFocus
      Return the absolute position of the entity identified by name within this entity in the native reference system.
      Specified by:
      getAbsolutePosition in interface IFocus
      Parameters:
      name - The name (lowercase) of the entity to get the position from (useful in case of star groups).
      out - Vector3d to put the return value.
      Returns:
      The absolute position of the entity if it exists, null otherwise.
    • getPositionAboveSurface Link icon

      public void getPositionAboveSurface(double longitude, double latitude, double distance, Vector3b out)
      Returns the cartesian position in the internal reference system above the surface at the given longitude and latitude and distance.
      Parameters:
      longitude - The longitude in deg
      latitude - The latitude in deg
      distance - The distance in km
      out - The vector to store the result
    • getClosestAbsolutePos Link icon

      public Vector3b getClosestAbsolutePos(Vector3b out)
      Description copied from interface: IFocus
      Specified by:
      getClosestAbsolutePos in interface IFocus
      Parameters:
      out - Vector3d where to put the return value.
      Returns:
      The absolute position, same as aux.
    • getPosSph Link icon

      public Vector2d getPosSph()
      Description copied from interface: IFocus
      Gets the position in equatorial spherical coordinates.
      Specified by:
      getPosSph in interface IFocus
      Returns:
      The position in alpha, delta.
    • mustUpdatePosition Link icon

      protected boolean mustUpdatePosition(ITimeFrameProvider time)
      Whether position must be recomputed for this entity. By default, only when time is on
      Parameters:
      time - The current time
      Returns:
      True if position should be recomputed for this entity
    • getPredictedPosition Link icon

      public Vector3b getPredictedPosition(Vector3b out, ITimeFrameProvider time, ICamera unused, boolean force)
      Description copied from interface: IFocus
      Gets the position of this entity in the next time step in the internal reference system using the given time provider and the given camera.
      Specified by:
      getPredictedPosition in interface IFocus
      Parameters:
      out - The out vector where the result will be stored.
      time - The time frame provider.
      unused - The camera.
      force - Whether to force the computation if time is off.
      Returns:
      The aux vector for chaining.
    • getPredictedPosition Link icon

      public Vector3b getPredictedPosition(Vector3b out, String name, ITimeFrameProvider time, boolean force)
    • getPredictedPosition Link icon

      public Vector3b getPredictedPosition(Vector3b out, double deltaTime)
      Description copied from interface: IFocus
      Gets the position of this entity at the given delta time in the future in the internal reference system.
      Specified by:
      getPredictedPosition in interface IFocus
      Parameters:
      out - The out vector where the result will be stored.
      deltaTime - Delta time in seconds.
      Returns:
      The aux vector for chaining.
    • getDistToCamera Link icon

      public double getDistToCamera()
      Description copied from interface: IFocus
      Return the current distance to the camera in internal units.
      Specified by:
      getDistToCamera in interface IFocus
      Returns:
      The current distance to the camera, in internal units.
    • getClosestDistToCamera Link icon

      public double getClosestDistToCamera()
      Description copied from interface: IFocus
      Specified by:
      getClosestDistToCamera in interface IFocus
      Returns:
      The distance to the camera in internal units.
    • getSolidAngle Link icon

      public double getSolidAngle()
      Description copied from interface: IFocus
      Return the current view angle of this entity, in radians.
      Specified by:
      getSolidAngle in interface IFocus
      Returns:
      The view angle in radians.
    • getSolidAngleApparent Link icon

      public double getSolidAngleApparent()
      Description copied from interface: IFocus
      Return the current apparent view angle (view angle corrected with the field of view) of this entity, in radians.
      Specified by:
      getSolidAngleApparent in interface IFocus
      Returns:
      The apparent view angle in radians.
    • getCandidateSolidAngleApparent Link icon

      public double getCandidateSolidAngleApparent()
      Description copied from interface: IFocus
      Return the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radians.
      Specified by:
      getCandidateSolidAngleApparent in interface IFocus
      Returns:
      The apparent view angle in radians.
    • getAlpha Link icon

      public double getAlpha()
      Description copied from interface: IFocus
      Return the right ascension angle of this focus object.
      Specified by:
      getAlpha in interface IFocus
      Returns:
      The right ascension angle in degrees.
    • getDelta Link icon

      public double getDelta()
      Description copied from interface: IFocus
      Return the declination angle of this focus object.
      Specified by:
      getDelta in interface IFocus
      Returns:
      The declination angle in degrees.
    • getSize Link icon

      public double getSize()
      Description copied from interface: IFocus
      Return the size (diameter) of this entity in internal units.
      Specified by:
      getSize in interface IFocus
      Returns:
      The size in internal units.
    • getRadius Link icon

      public double getRadius()
      Description copied from interface: IFocus
      Return the radius of this focus object in internal units.
      Specified by:
      getRadius in interface IFocus
      Returns:
      The radius of the focus, in internal units.
    • getTEff Link icon

      public double getTEff()
      Description copied from interface: IFocus
      Return the effective temperature.
      Specified by:
      getTEff in interface IFocus
      Returns:
      The effective temperature of the object, in Kelvins.
    • getElevationAt Link icon

      public double getElevationAt(Vector3b camPos)
      Description copied from interface: IFocus
      Return the surface elevation of the projected position of the current camera on this focus object, which is usually the radius plus a value lookup in the height texture (if exists).
      Specified by:
      getElevationAt in interface IFocus
      Parameters:
      camPos - The camera position.
      Returns:
      The height of the projected position of the current camera.
    • getElevationAt Link icon

      public double getElevationAt(Vector3b camPos, boolean useFuturePosition)
      Description copied from interface: IFocus
      Same as IFocus.getElevationAt(Vector3b) but with the option to use the future position of the body instead of the current one.
      Specified by:
      getElevationAt in interface IFocus
      Parameters:
      camPos - The camera position.
      useFuturePosition - Whether to use the future position or the current one.
      Returns:
      The height of the projected position of the current camera on the surface.
    • getElevationAt Link icon

      public double getElevationAt(Vector3b camPos, Vector3b nextPos)
      Description copied from interface: IFocus
      Same as IFocus.getElevationAt(Vector3b) but with the option to use the given future position of the body instead of the current one.
      Specified by:
      getElevationAt in interface IFocus
      Parameters:
      camPos - The camera position.
      nextPos - The future position of this body to use.
      Returns:
      The height of the projected position of the current camera on the surface.
    • getHeightScale Link icon

      public double getHeightScale()
      Description copied from interface: IFocus
      Return the height scale of this focus, or 0 if it has no height info.
      Specified by:
      getHeightScale in interface IFocus
      Returns:
      The height scale in internal units.
    • getAppmag Link icon

      public float getAppmag()
      Description copied from interface: IFocus
      Get the apparent magnitude.
      Specified by:
      getAppmag in interface IFocus
      Returns:
      The apparent magnitude.
    • getAbsmag Link icon

      public float getAbsmag()
      Description copied from interface: IFocus
      Get the absolute magnitude.
      Specified by:
      getAbsmag in interface IFocus
      Returns:
      The absolute magnitude.
    • getOrientation Link icon

      public Matrix4d getOrientation()
      Description copied from interface: IFocus
      Return the orientation matrix of this focus.
      Specified by:
      getOrientation in interface IFocus
      Returns:
      The orientation matrix. Can be null.
    • getRotationComponent Link icon

      public RotationComponent getRotationComponent()
      Description copied from interface: IFocus
      Return the rotation component of this focus.
      Specified by:
      getRotationComponent in interface IFocus
      Returns:
      The rotation component. Can be null.
    • getOrientationQuaternion Link icon

      public QuaternionDouble getOrientationQuaternion()
      Description copied from interface: IFocus
      Return the orientation quaternion of this focus.
      Specified by:
      getOrientationQuaternion in interface IFocus
      Returns:
      The orientation quaternion. Can be null.
    • addHitCoordinate Link icon

      public void addHitCoordinate(int screenX, int screenY, int w, int h, int pixelDist, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits)
      Description copied from interface: IFocus
      Add this focus to the hits list if it is hit by the [screenX, screenY] position.
      Specified by:
      addHitCoordinate in interface IFocus
      Parameters:
      screenX - The x position of the hit.
      screenY - The y position of the hit.
      w - The viewport width.
      h - The viewport height.
      pixelDist - The minimum pixel distance to consider as hit.
      camera - The camera.
      hits - The list where to add the element.
    • addEntityHitCoordinate Link icon

      public void addEntityHitCoordinate(int screenX, int screenY, int w, int h, int pixelDist, NaturalCamera camera, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> hits)
      Specified by:
      addEntityHitCoordinate in interface IFocus
    • addHitRay Link icon

      public void addHitRay(Vector3d p0, Vector3d p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits)
      Description copied from interface: IFocus
      Add this focus to the hits list if it is hit by the given ray.
      Specified by:
      addHitRay in interface IFocus
      Parameters:
      p0 - Start point of the ray.
      p1 - End point of the ray.
      camera - The camera.
      hits - The list where the focus is to be added.
    • addEntityHitRay Link icon

      public void addEntityHitRay(Vector3d p0, Vector3d p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> hits)
      Specified by:
      addEntityHitRay in interface IFocus
    • makeFocus Link icon

      public void makeFocus()
      Description copied from interface: IFocus
      Hook that runs when the candidate is actually made focus.
      Specified by:
      makeFocus in interface IFocus
    • getFocus Link icon

      public IFocus getFocus(String name)
      Description copied from interface: IFocus
      Prepare the candidate with the given name.
      Specified by:
      getFocus in interface IFocus
      Parameters:
      name - The name in lower case.
    • isCoordinatesTimeOverflow Link icon

      public boolean isCoordinatesTimeOverflow()
      Description copied from interface: IFocus
      Check whether this focus is within its valid time range, so that it can be used as a focus.
      Specified by:
      isCoordinatesTimeOverflow in interface IFocus
      Returns:
      Whether the focus object is within its valid time range.
    • getSceneGraphDepth Link icon

      public int getSceneGraphDepth()
      Description copied from interface: IFocus
      Get the depth of this focus object in the scene graph.
      Specified by:
      getSceneGraphDepth in interface IFocus
      Returns:
      The depth of the scene graph.
    • getOctant Link icon

      public OctreeNode getOctant()
      Description copied from interface: IFocus
      Get the octant this focus belongs to, if any. This will return null if this focus is not part of an octree.
      Specified by:
      getOctant in interface IFocus
      Returns:
      The octant this focus belongs to. Null if it is not part of an octree.
    • getHip Link icon

      public int getHip()
    • setForceLabel Link icon

      public void setForceLabel(Boolean forceLabel, String name)
    • isForceLabel Link icon

      public boolean isForceLabel(String name)
      Specified by:
      isForceLabel in interface IFocus
    • equals Link icon

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • isForceLabel Link icon

      public boolean isForceLabel()
      Specified by:
      isForceLabel in interface IFocus
    • setLabelColor Link icon

      public void setLabelColor(float[] color)
      Sets the label color, as an RGBA float array.
      Parameters:
      color - The label color.
    • setLabelColor Link icon

      public void setLabelColor(float[] color, String name)
    • isCopy Link icon

      public boolean isCopy()
      Description copied from interface: IFocus
      Check whether this is a copy or not.
      Specified by:
      isCopy in interface IFocus
      Returns:
      Whether the object is a copy or not.
    • isFocusable Link icon

      public boolean isFocusable()
      Description copied from interface: IFocus
      Check whether this focus is actually focusable. This checks the attribute 'focusable' of the Focus component.
      Specified by:
      isFocusable in interface IFocus
      Returns:
      Whether the focus is focusable.
    • isCameraCollision Link icon

      public boolean isCameraCollision()
      Description copied from interface: IFocus
      Check whether this focus has camera collisions enabled.
      Specified by:
      isCameraCollision in interface IFocus
      Returns:
      Whether the focus has camera collisions enabled.
    • getColor Link icon

      public float[] getColor()
      Description copied from interface: IFocus
      Gets the color of this object.
      Specified by:
      getColor in interface IFocus
      Returns:
      The color as an RGBA float array.
    • getGraph Link icon

      public GraphNode getGraph()
    • getMag Link icon

      public Magnitude getMag()
    • getExtra Link icon

      public ParticleExtra getExtra()
    • getParticleSet Link icon

      public ParticleSet getParticleSet()
    • getStarSet Link icon

      public StarSet getStarSet()
    • isSet Link icon

      public boolean isSet()
      Checks whether the entity is a particle or star set.
      Returns:
      True if the entity is a particle or star set.
    • isParticleSet Link icon

      public boolean isParticleSet()
    • isStarSet Link icon

      public boolean isStarSet()
    • getSet Link icon

      public ParticleSet getSet()
    • isModel Link icon

      public boolean isModel()
    • isBillboard Link icon

      public boolean isBillboard()
    • isCluster Link icon

      public boolean isCluster()
    • isCelestial Link icon

      public boolean isCelestial()
    • hasProperMotion Link icon

      public boolean hasProperMotion()
    • getMuAlpha Link icon

      public double getMuAlpha()
    • getMuDelta Link icon

      public double getMuDelta()
    • getRadialVelocity Link icon

      public double getRadialVelocity()
    • getChildByNameAndArchetype Link icon

      public com.badlogic.ashley.core.Entity getChildByNameAndArchetype(String name, Archetype archetype)
    • markForUpdate Link icon

      public void markForUpdate()
      Marks the element for update in VRAM.
    • highlight Link icon

      public void highlight(boolean state, float[] color, boolean allVisible)
      Highlight using a plain color.
      Parameters:
      state - Whether to highlight.
      color - The plain color.
      allVisible - All visible.
    • highlight Link icon

      public void highlight(boolean state, int cmi, float cmAlpha, IAttribute cma, double cmMin, double cmMax, boolean allVisible)
      Highlight using a colormap.
      Parameters:
      state - Whether to highlight.
      cmi - Color map index.
      cmAlpha - Color map alpha value.
      cma - Color map attribute.
      cmMin - Min mapping value.
      cmMax - Max mapping value.
    • isHighlighted Link icon

      public boolean isHighlighted()
    • isOctree Link icon

      public boolean isOctree()
    • getOctreeObjects Link icon

      public com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> getOctreeObjects(com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> list)
    • isPlanet Link icon

      public boolean isPlanet()
    • isSingleStar Link icon

      public boolean isSingleStar()
      Returns true if this focus is a single star.
      Returns:
      True if this is a single star.
    • isStar Link icon

      public boolean isStar()
      Returns whether this focus is a star of any kind (set or single).
      Returns:
      True if the focus is a star.