public class JplSpkFile extends DefinitionalObject
If STK is installed with the Planetary Data Supplement, several relatively small (less than 200 MB each) *.bsp files are
available in the STKData/Spice folder of the STK installation. These files are described in the Readme.txt file
in the ReadMe folder inside the STKData/Spice folder. They provide enough data to enable all of the available
CentralBodies
and PlanetarySystemBarycenters
to have their CenterOfMassPoint
(get
/ set
) be defined in terms of the
SolarSystemBarycenter
within the CentralBodiesFacet
with far greater accuracy and precision
than the default analytic ephemeris can provide.
If STK or the Planetary Data Supplement are unavailable, the next best option is to go to the website of the Navigation and Ancillary Information Facility (NAIF) of JPL to download *.bsp ephemerides for planets and planetary moons. Some of these can be massive (greater than 1 GB) because they often contain data that extends hundreds of years into the past and future for astronomical purposes. There is typically a small text *.cmt file with the same name as the *.bsp ephemeris that contains information about what data is contained within each *.bsp file.
For asteroids and comets, the best strategy is to go to the website of the Solar System Dynamics (SSD) group of JPL to generate custom *.bsp files using the Horizons Web Application.
Modifier | Constructor and Description |
---|---|
protected |
JplSpkFile(JplSpkFile existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
|
JplSpkFile(StreamFactory streamFactory)
Initializes a new instance with the specified stream factory.
|
|
JplSpkFile(String filename)
Initializes an instance using the specified JPL SPK filename.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkForSameDefinition(DefinitionalObject other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(JplSpkFile other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
Map<Integer,Integer> |
getNaifIdsOfAvailableTargetPointsAndCenterPoints()
Interrogates a .bsp file to ascertain which target points are available
and what center points they are modeled to orbit around.
|
Point |
getTargetPoint(int naifIdOfTargetPoint,
int naifIdOfCenterPoint,
Point centerPoint)
Gets a point describing the position of a target location with respect
to a center location.
|
Point |
getTargetPoint(IProvideNaifIdCode targetPointProvider,
IProvideNaifIdCode centerPointProvider)
Gets a point describing the position of a target location with respect
to a center location.
|
Point |
getTargetPoint(IProvideNaifIdCode targetPointProvider,
IProvideNaifIdCode centerPointProvider,
Point centerPoint)
Gets a point describing the position of a target location with respect
to a center location.
|
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, enumerateDependencies, freeze, freezeAggregatedObjects, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
public JplSpkFile(@Nonnull String filename)
filename
- The full path and filename of the JPL SPK file.ArgumentNullException
- Thrown when filename
is null
.public JplSpkFile(@Nonnull StreamFactory streamFactory)
The streams created by streamFactory
must support seeking.
This means that the streams must implement
ISeekableStream
or
FileInputStream
.
streamFactory
- The factory to use to create streams to read the JPL SPK data.ArgumentNullException
- Thrown when streamFactory
is null
.protected JplSpkFile(@Nonnull JplSpkFile existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class DefinitionalObject
context
- The context to use to perform the copy.protected final boolean checkForSameDefinition(DefinitionalObject other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class DefinitionalObject
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected boolean checkForSameDefinition(JplSpkFile other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
JplSpkFile.checkForSameDefinition(agi.foundation.infrastructure.DefinitionalObject)
method.computeCurrentDefinitionHashCode
in class DefinitionalObject
@Nonnull public final Map<Integer,Integer> getNaifIdsOfAvailableTargetPointsAndCenterPoints()
@Nonnull public final Point getTargetPoint(@Nonnull IProvideNaifIdCode targetPointProvider, @Nonnull IProvideNaifIdCode centerPointProvider)
Gets a point describing the position of a target location with respect to a center location.
This overload requires that the
centerPointProvider
is a CentralBody
,
PlanetarySystemBarycenter
, or SolarSystemBarycenter
.
The currently configured center of mass point of the centerPointProvider
will then be used to locate the output point.
targetPointProvider
- An interface that provides the NAIF ID number
of the location of the target point.centerPointProvider
- An interface that provides the NAIF ID number
of the location of the central point.ArgumentOutOfRangeException
- Thrown when the centerPointProvider
is not a CentralBody
, PlanetarySystemBarycenter
,
or SolarSystemBarycenter
. Also, thrown when the *.bsp file does not contain direct information about
the target point with respect to the center point.ArgumentNullException
- Thrown when the targetPointProvider
or
centerPointProvider
are null
.UnsupportedCaseException
- Thrown when the *.bsp file uses an unsupported coordinate frame.
Currently, only frames 1, 17, and 1900017 are supported. Also, thrown when the *.bsp file uses an
unsupported SPK ephemeris type. Currently, only ephemeris types 1, 2, 3, 5, and 21 are supported.@Nonnull public final Point getTargetPoint(@Nonnull IProvideNaifIdCode targetPointProvider, @Nonnull IProvideNaifIdCode centerPointProvider, @Nonnull Point centerPoint)
targetPointProvider
- An interface that provides the NAIF ID number
of the location of the target point.centerPointProvider
- An interface that provides the NAIF ID number
of the location of the central point.centerPoint
- The central point that the target point is defined
with respect to.ArgumentNullException
- Thrown when the targetPointProvider
,
centerPointProvider
, or centerPoint
are null
.ArgumentOutOfRangeException
- Thrown when the *.bsp file does not contain direct information about
the target point with respect to the center point.UnsupportedCaseException
- Thrown when the *.bsp file uses an unsupported coordinate frame.
Currently, only frames 1, 17, and 1900017 are supported. Also, thrown when the *.bsp file uses an
unsupported SPK ephemeris type Currently, only ephemeris types 1, 2, 3, 5, and 21 are supported.@Nonnull public final Point getTargetPoint(int naifIdOfTargetPoint, int naifIdOfCenterPoint, @Nonnull Point centerPoint)
naifIdOfTargetPoint
- The NAIF ID number
of the location of the target point.naifIdOfCenterPoint
- The NAIF ID number
of the location of the central point.centerPoint
- The central point that the target point is defined
with respect to.ArgumentNullException
- Thrown when the centerPoint
is null
.ArgumentOutOfRangeException
- Thrown when the *.bsp file does not contain direct information about
the target point with respect to the center point.UnsupportedCaseException
- Thrown when the *.bsp file uses an unsupported coordinate frame.
Currently, only frames 1, 17, and 1900017 are supported. Also, thrown when the *.bsp file uses an
unsupported SPK ephemeris type Currently, only ephemeris types 2, 3, 5, 9, 13, and 21 are supported.