本文整理汇总了C++中SolarSystem::getFrameTree方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::getFrameTree方法的具体用法?C++ SolarSystem::getFrameTree怎么用?C++ SolarSystem::getFrameTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::getFrameTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTimeline
static bool CreateTimeline(Body* body,
PlanetarySystem* system,
Universe& universe,
Hash* planetData,
const string& path,
Disposition disposition,
BodyType bodyType)
{
FrameTree* parentFrameTree = NULL;
Selection parentObject = GetParentObject(system);
bool orbitsPlanet = false;
if (parentObject.body())
{
parentFrameTree = parentObject.body()->getOrCreateFrameTree();
orbitsPlanet = true;
}
else if (parentObject.star())
{
SolarSystem* solarSystem = universe.getSolarSystem(parentObject.star());
if (solarSystem == NULL)
solarSystem = universe.createSolarSystem(parentObject.star());
parentFrameTree = solarSystem->getFrameTree();
}
else
{
// Bad orbit barycenter specified
return false;
}
ReferenceFrame* defaultOrbitFrame = NULL;
ReferenceFrame* defaultBodyFrame = NULL;
if (bodyType == SurfaceObject)
{
defaultOrbitFrame = new BodyFixedFrame(parentObject, parentObject);
defaultBodyFrame = CreateTopocentricFrame(parentObject, parentObject, Selection(body));
defaultOrbitFrame->addRef();
defaultBodyFrame->addRef();
}
else
{
defaultOrbitFrame = parentFrameTree->getDefaultReferenceFrame();
defaultBodyFrame = parentFrameTree->getDefaultReferenceFrame();
}
// If there's an explicit timeline definition, parse that. Otherwise, we'll do
// things the old way.
Value* value = planetData->getValue("Timeline");
if (value != NULL)
{
if (value->getType() != Value::ArrayType)
{
clog << "Error: Timeline must be an array\n";
return false;
}
Timeline* timeline = CreateTimelineFromArray(body, universe, value->getArray(), path,
defaultOrbitFrame, defaultBodyFrame);
if (timeline == NULL)
{
return false;
}
else
{
body->setTimeline(timeline);
return true;
}
}
// Information required for the object timeline.
ReferenceFrame* orbitFrame = NULL;
ReferenceFrame* bodyFrame = NULL;
Orbit* orbit = NULL;
RotationModel* rotationModel = NULL;
double beginning = -numeric_limits<double>::infinity();
double ending = numeric_limits<double>::infinity();
// If any new timeline values are specified, we need to overrideOldTimeline will
// be set to true.
bool overrideOldTimeline = false;
// The interaction of Modify with timelines is slightly complicated. If the timeline
// is specified by putting the OrbitFrame, Orbit, BodyFrame, or RotationModel directly
// in the object definition (i.e. not inside a Timeline structure), it will completely
// replace the previous timeline if it contained more than one phase. Otherwise, the
// properties of the single phase will be modified individually, for compatibility with
// Celestia versions 1.5.0 and earlier.
if (disposition == ModifyObject)
{
const Timeline* timeline = body->getTimeline();
if (timeline->phaseCount() == 1)
{
const TimelinePhase* phase = timeline->getPhase(0);
orbitFrame = phase->orbitFrame();
bodyFrame = phase->bodyFrame();
orbit = phase->orbit();
rotationModel = phase->rotationModel();
beginning = phase->startTime();
ending = phase->endTime();
}
}
//.........这里部分代码省略.........