Class FocusView
java.lang.Object
gaiasky.scene.view.AbstractView
gaiasky.scene.view.BaseView
gaiasky.scene.view.FocusView
- All Implemented Interfaces:
IFocus, IVisibilitySwitch
-
Field Summary
FieldsFields inherited from class AbstractView
entity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntityHitCoordinate(int screenX, int screenY, int w, int h, int pixelDist, NaturalCamera camera, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> hits) voidaddEntityHitRay(Vector3D p0, Vector3D p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> hits) voidaddHitCoordinate(int screenX, int screenY, int w, int h, int pixelDist, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits) Add this focus to the hits list if it is hit by the [screenX, screenY] position.voidaddHitRay(Vector3D p0, Vector3D p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits) Add this focus to the hits list if it is hit by the given ray.protected voidContains actions to take after a new entity has been set.protected voidentityCheck(com.badlogic.ashley.core.Entity entity) Checks whether the given entity is suitable for this view.protected voidThis method is called when the entity of this view is cleared.booleanfloatGet the absolute magnitude.Return the absolute position of this entity in the native coordinates (equatorial system).getAbsolutePosition(String name, Vector3Q out) Return the absolute position of the entity identified by name within this entity in the native reference system.doublegetAlpha()Return the right ascension angle of this focus object.floatGet the apparent magnitude.longReturn the id of the focus candidate of this object.Return the name of the focus candidate of this object.doubleReturn the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radians.com.badlogic.ashley.core.EntitygetChildByNameAndArchetype(String name, Archetype archetype) Same asIFocus.getAbsolutePosition(Vector3Q).doubleSame asIFocus.getDistToCamera().Gets the name of the closest object, localized.Same asIFocus.getName().float[]getColor()Gets the color of this object.getCt()Return the component types of this focus.doublegetDelta()Return the declination angle of this focus object.doubleReturn the current distance to the camera in internal units.doublegetElevationAt(Vector3Q camPos) 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).doublegetElevationAt(Vector3Q camPos, boolean useFuturePosition) Same asIFocus.getElevationAt(Vector3Q)but with the option to use the future position of the body instead of the current one.doublegetElevationAt(Vector3Q camPos, Vector3Q nextPos) Same asIFocus.getElevationAt(Vector3Q)but with the option to use the given future position of the body instead of the current one.getExtra()com.badlogic.ashley.core.EntityGets the first ancestor of this node that is a star.Prepare the candidate with the given name.getGraph()doubleReturn the height scale of this focus, or 0 if it has no height info.intgetHip()longgetId()Return the unique id of this focus.Return the localized name of this focus.getMag()doubledoublegetName()Return the first name of this focus.String[]getNames()Return all names of this focus.intGet the octant this focus belongs to, if any.com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> getOctreeObjects(com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> list) Return the orientation matrix of this focus.Return the orientation quaternion of this focus.getPos()Return the position.voidgetPositionAboveSurface(double longitude, double latitude, double distance, Vector3Q out) Returns the cartesian position in the internal reference system above the surface at the given longitude and latitude and distance.Gets the position in equatorial spherical coordinates.getPredictedPosition(Vector3Q out, double deltaTime) Gets the position of this entity at the given delta time in the future in the internal reference system.getPredictedPosition(Vector3Q out, ITimeFrameProvider time, ICamera unused, boolean force) 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.getPredictedPosition(Vector3Q out, String name, ITimeFrameProvider time, boolean force) doubledoubleReturn the radius of this focus object in internal units.Return the rotation component of this focus.intGet the depth of this focus object in the scene graph.getSet()doublegetSize()Return the size (diameter) of this entity in internal units.doubleReturn the current view angle of this entity, in radians.doubleReturn the current apparent view angle (view angle corrected with the field of view) of this entity, in radians.doublegetTEff()Return the effective temperature.booleanhasId()Return whether the curent focus has a valid identifier number.booleanChecks whether the focus has the given name.booleanChecks whether the focus has the given name.booleanvoidhighlight(boolean state, float[] color, boolean allVisible) Highlight using a plain color.voidhighlight(boolean state, int cmi, float cmAlpha, IAttribute cma, double cmMin, double cmMax, boolean allVisible) Highlight using a colormap.booleanbooleanCheck whether this focus has camera collisions enabled.booleanbooleanbooleanCheck whether this focus is within its valid time range, so that it can be used as a focus.booleanisCopy()Check whether this is a copy or not.booleanCheck whether this focus is actually focusable.booleanReturn whether this focus object is active or not.booleanIs the label of the entity forced to display?booleanisForceLabel(String name) booleanbooleanisModel()booleanisOctree()booleanbooleanbooleanisPlanet()booleanIs the label of the entity rendered?booleanisRenderLabel(String name) booleanisSet()Checks whether the entity is a particle or star set.booleanReturns true if this focus is a single star.booleanisStar()Returns whether this focus is a star of any kind (set or single).booleanbooleanbooleanbooleanisVisibleGroup(boolean attributeValue) voidHook that runs when the candidate is actually made focus.voidMarks the element for update in VRAM.protected booleanWhether position must be recomputed for this entity.voidsetDescription(String description) voidsetForceLabel(Boolean forceLabel, String name) voidsetLabelColor(float[] color) Sets the label color, as an RGBA float array.voidsetLabelColor(float[] color, String name) voidvoidsetRenderLabel(Boolean renderLabel, String name) voidvoidsetVisible(boolean visible, String name) voidsetVisibleGroup(boolean visibility) Methods inherited from class BaseView
componentsCheck, getBase, getBody, getComponent, getComponentType, getOpacity, hasCt, isVisible, isVisible, setColor, setVisibleMethods inherited from class AbstractView
check, clearEntity, getEntity, isEmpty, isValid, setEntityMethods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IVisibilitySwitch
hasCt, isVisible, isVisible, setVisible
-
Field Details
-
extra
Particle component, maybe.
-
-
Constructor Details
-
FocusView
Creates a focus view with the given scene. -
FocusView
public FocusView()Creates an empty focus view. -
FocusView
public FocusView(com.badlogic.ashley.core.Entity entity) Creates an abstract view with the given entity.- Parameters:
entity- The entity.
-
-
Method Details
-
entityCheck
protected void entityCheck(com.badlogic.ashley.core.Entity entity) Description copied from class:AbstractViewChecks whether the given entity is suitable for this view. This method should throw aRuntimeExceptionif the entity is not suitable.- Overrides:
entityCheckin classBaseView- Parameters:
entity- The entity.
-
entityChanged
protected void entityChanged()Description copied from class:AbstractViewContains actions to take after a new entity has been set. This method is typically used to initialize the view components.- Overrides:
entityChangedin classBaseView
-
entityCleared
protected void entityCleared()Description copied from class:AbstractViewThis method is called when the entity of this view is cleared. It should set all component references to null.- Overrides:
entityClearedin classBaseView
-
setScene
-
isParticle
public boolean isParticle() -
getId
-
getCandidateId
public long getCandidateId()Description copied from interface:IFocusReturn the id of the focus candidate of this object. Defaults toIFocus.getId().- Specified by:
getCandidateIdin interfaceIFocus- Returns:
- The id of the candidate.
-
hasId
-
getLocalizedName
Description copied from interface:IFocusReturn the localized name of this focus. If it has no localized name, it returns the default name.- Specified by:
getLocalizedNamein interfaceIFocus- Returns:
- The localized name.
-
getName
-
setName
- Specified by:
setNamein interfaceIVisibilitySwitch
-
getNames
-
hasName
-
hasName
Description copied from interface:IFocusChecks whether the focus has the given name. -
getDescription
- Specified by:
getDescriptionin interfaceIVisibilitySwitch
-
setDescription
- Specified by:
setDescriptionin interfaceIVisibilitySwitch
-
getNumParticles
public int getNumParticles() -
getDataFile
-
isVisible
- Specified by:
isVisiblein interfaceIVisibilitySwitch
-
isVisibleGroup
public boolean isVisibleGroup() -
setVisibleGroup
public void setVisibleGroup(boolean visibility) -
isVisibleGroup
public boolean isVisibleGroup(boolean attributeValue) -
setVisible
- Specified by:
setVisiblein interfaceIVisibilitySwitch- Overrides:
setVisiblein classBaseView
-
getClosestName
Description copied from interface:IFocusSame asIFocus.getName().- Specified by:
getClosestNamein interfaceIFocus- Returns:
- The name.
-
getClosestLocalizedName
Description copied from interface:IFocusGets the name of the closest object, localized.- Specified by:
getClosestLocalizedNamein interfaceIFocus- Returns:
- The localized name.
-
getCandidateName
Description copied from interface:IFocusReturn the name of the focus candidate of this object. Defaults toIFocus.getName().- Specified by:
getCandidateNamein interfaceIFocus- Returns:
- The name of the candidate.
-
getCt
Description copied from interface:IFocusReturn the component types of this focus. -
isFocusActive
public boolean isFocusActive()Description copied from interface:IFocusReturn whether this focus object is active or not. The active status determines whether the object can be focussed or not.- Specified by:
isFocusActivein interfaceIFocus- Returns:
- The active status.
-
getPos
-
getFirstStarAncestor
- Specified by:
getFirstStarAncestorin interfaceIFocus
-
getFirstStarAncestor
-
getFirstStarAncestorEntity
public com.badlogic.ashley.core.Entity getFirstStarAncestorEntity()Description copied from interface:IFocusGets the first ancestor of this node that is a star.- Specified by:
getFirstStarAncestorEntityin interfaceIFocus- Returns:
- The first star ancestor.
-
getAbsolutePosition
Description copied from interface:IFocusReturn the absolute position of this entity in the native coordinates (equatorial system).- Specified by:
getAbsolutePositionin interfaceIFocus- Parameters:
out- The out vector.- Returns:
- The absolute position, same as aux.
-
getAbsolutePosition
Description copied from interface:IFocusReturn the absolute position of the entity identified by name within this entity in the native reference system.- Specified by:
getAbsolutePositionin interfaceIFocus- 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
public void getPositionAboveSurface(double longitude, double latitude, double distance, Vector3Q 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 deglatitude- The latitude in degdistance- The distance in kmout- The vector to store the result
-
getClosestAbsolutePos
Description copied from interface:IFocusSame asIFocus.getAbsolutePosition(Vector3Q).- Specified by:
getClosestAbsolutePosin interfaceIFocus- Parameters:
out- Vector3D where to put the return value.- Returns:
- The absolute position, same as aux.
-
getPosSph
-
mustUpdatePosition
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
public Vector3Q getPredictedPosition(Vector3Q out, ITimeFrameProvider time, ICamera unused, boolean force) Description copied from interface:IFocusGets 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:
getPredictedPositionin interfaceIFocus- 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
public Vector3Q getPredictedPosition(Vector3Q out, String name, ITimeFrameProvider time, boolean force) -
getPredictedPosition
Description copied from interface:IFocusGets the position of this entity at the given delta time in the future in the internal reference system.- Specified by:
getPredictedPositionin interfaceIFocus- Parameters:
out- The out vector where the result will be stored.deltaTime- Delta time in seconds.- Returns:
- The aux vector for chaining.
-
getDistToCamera
public double getDistToCamera()Description copied from interface:IFocusReturn the current distance to the camera in internal units.- Specified by:
getDistToCamerain interfaceIFocus- Returns:
- The current distance to the camera, in internal units.
-
getClosestDistToCamera
public double getClosestDistToCamera()Description copied from interface:IFocusSame asIFocus.getDistToCamera().- Specified by:
getClosestDistToCamerain interfaceIFocus- Returns:
- The distance to the camera in internal units.
-
getSolidAngle
public double getSolidAngle()Description copied from interface:IFocusReturn the current view angle of this entity, in radians.- Specified by:
getSolidAnglein interfaceIFocus- Returns:
- The view angle in radians.
-
getSolidAngleApparent
public double getSolidAngleApparent()Description copied from interface:IFocusReturn the current apparent view angle (view angle corrected with the field of view) of this entity, in radians.- Specified by:
getSolidAngleApparentin interfaceIFocus- Returns:
- The apparent view angle in radians.
-
getCandidateSolidAngleApparent
public double getCandidateSolidAngleApparent()Description copied from interface:IFocusReturn the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radians.- Specified by:
getCandidateSolidAngleApparentin interfaceIFocus- Returns:
- The apparent view angle in radians.
-
getAlpha
-
getDelta
-
getSize
-
getRadius
-
getTEff
-
getElevationAt
Description copied from interface:IFocusReturn 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:
getElevationAtin interfaceIFocus- Parameters:
camPos- The camera position.- Returns:
- The height of the projected position of the current camera.
-
getElevationAt
Description copied from interface:IFocusSame asIFocus.getElevationAt(Vector3Q)but with the option to use the future position of the body instead of the current one.- Specified by:
getElevationAtin interfaceIFocus- 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
Description copied from interface:IFocusSame asIFocus.getElevationAt(Vector3Q)but with the option to use the given future position of the body instead of the current one.- Specified by:
getElevationAtin interfaceIFocus- 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
public double getHeightScale()Description copied from interface:IFocusReturn the height scale of this focus, or 0 if it has no height info.- Specified by:
getHeightScalein interfaceIFocus- Returns:
- The height scale in internal units.
-
getAppmag
-
getAbsmag
-
getOrientation
Description copied from interface:IFocusReturn the orientation matrix of this focus.- Specified by:
getOrientationin interfaceIFocus- Returns:
- The orientation matrix. Can be null.
-
getRotationComponent
Description copied from interface:IFocusReturn the rotation component of this focus.- Specified by:
getRotationComponentin interfaceIFocus- Returns:
- The rotation component. Can be null.
-
getOrientationQuaternion
Description copied from interface:IFocusReturn the orientation quaternion of this focus.- Specified by:
getOrientationQuaternionin interfaceIFocus- Returns:
- The orientation quaternion. Can be null.
-
addHitCoordinate
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:IFocusAdd this focus to the hits list if it is hit by the [screenX, screenY] position.- Specified by:
addHitCoordinatein interfaceIFocus- 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
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:
addEntityHitCoordinatein interfaceIFocus
-
addHitRay
public void addHitRay(Vector3D p0, Vector3D p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits) Description copied from interface:IFocusAdd this focus to the hits list if it is hit by the given ray. -
addEntityHitRay
public void addEntityHitRay(Vector3D p0, Vector3D p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> hits) - Specified by:
addEntityHitRayin interfaceIFocus
-
makeFocus
-
getFocus
-
isCoordinatesTimeOverflow
public boolean isCoordinatesTimeOverflow()Description copied from interface:IFocusCheck whether this focus is within its valid time range, so that it can be used as a focus.- Specified by:
isCoordinatesTimeOverflowin interfaceIFocus- Returns:
- Whether the focus object is within its valid time range.
-
getSceneGraphDepth
public int getSceneGraphDepth()Description copied from interface:IFocusGet the depth of this focus object in the scene graph.- Specified by:
getSceneGraphDepthin interfaceIFocus- Returns:
- The depth of the scene graph.
-
getOctant
Description copied from interface:IFocusGet the octant this focus belongs to, if any. This will return null if this focus is not part of an octree. -
getHip
public int getHip() -
setForceLabel
-
isForceLabel
- Specified by:
isForceLabelin interfaceIFocus
-
isForceLabel
public boolean isForceLabel()Description copied from interface:IFocusIs the label of the entity forced to display?- Specified by:
isForceLabelin interfaceIFocus- Returns:
- The force label property.
-
setRenderLabel
-
isRenderLabel
- Specified by:
isRenderLabelin interfaceIFocus
-
isRenderLabel
public boolean isRenderLabel()Description copied from interface:IFocusIs the label of the entity rendered?- Specified by:
isRenderLabelin interfaceIFocus- Returns:
- The render label property.
-
equals
-
setLabelColor
public void setLabelColor(float[] color) Sets the label color, as an RGBA float array.- Parameters:
color- The label color.
-
setLabelColor
-
isCopy
-
isFocusable
public boolean isFocusable()Description copied from interface:IFocusCheck whether this focus is actually focusable. This checks the attribute 'focusable' of the Focus component.- Specified by:
isFocusablein interfaceIFocus- Returns:
- Whether the focus is focusable.
-
isCameraCollision
public boolean isCameraCollision()Description copied from interface:IFocusCheck whether this focus has camera collisions enabled.- Specified by:
isCameraCollisionin interfaceIFocus- Returns:
- Whether the focus has camera collisions enabled.
-
getColor
-
getGraph
-
getMag
-
getExtra
-
getParticleSet
-
getStarSet
-
isSet
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
public boolean isParticleSet() -
isStarSet
public boolean isStarSet() -
getSet
-
isModel
public boolean isModel() -
isBillboard
public boolean isBillboard() -
isCluster
public boolean isCluster() -
isCelestial
public boolean isCelestial() -
hasProperMotion
public boolean hasProperMotion() -
getMuAlpha
public double getMuAlpha() -
getMuDelta
public double getMuDelta() -
getRadialVelocity
public double getRadialVelocity() -
getChildByNameAndArchetype
-
markForUpdate
public void markForUpdate()Marks the element for update in VRAM. -
highlight
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
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
public boolean isHighlighted() -
isOctree
public boolean isOctree() -
getOctreeObjects
public com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> getOctreeObjects(com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> list) -
isPlanet
public boolean isPlanet() -
isSingleStar
public boolean isSingleStar()Returns true if this focus is a single star.- Returns:
- True if this is a single star.
-
isStar
public boolean isStar()Returns whether this focus is a star of any kind (set or single).- Returns:
- True if the focus is a star.
-