本文整理汇总了C++中SolarSystem::getStar方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::getStar方法的具体用法?C++ SolarSystem::getStar怎么用?C++ SolarSystem::getStar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::getStar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotRefreshTree
void SolarSystemBrowser::slotRefreshTree()
{
Simulation* sim = appCore->getSimulation();
// Update the browser with the solar system closest to the active observer
SolarSystem* solarSys = sim->getUniverse()->getNearestSolarSystem(sim->getActiveObserver()->getPosition());
// Don't update the solar system browser if no solar system is nearby
if (!solarSys)
return;
Star* rootStar = solarSys->getStar();
// We want to show all gravitationally associated stars in the
// browser; follow the chain up the parent star or barycenter.
while (rootStar->getOrbitBarycenter() != NULL)
{
rootStar = rootStar->getOrbitBarycenter();
}
bool groupByClass = groupCheckBox->checkState() == Qt::Checked;
solarSystemModel->buildModel(rootStar, groupByClass);
treeView->resizeColumnToContents(SolarSystemTreeModel::NameColumn);
treeView->clearSelection();
// Automatically expand stars in the model (to a max depth of 2)
QModelIndex primary = solarSystemModel->index(0, 0, QModelIndex());
if (primary.isValid() && solarSystemModel->objectAtIndex(primary).star() != NULL)
{
treeView->setExpanded(primary, true);
QModelIndex secondary = solarSystemModel->index(0, 0, primary);
if (secondary.isValid() && solarSystemModel->objectAtIndex(secondary).star() != NULL)
{
treeView->setExpanded(secondary, true);
}
}
}