Esempio n. 1
0
void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig)
{
    // Ensure uniqueness of name.
    QString name = devConfig->name();
    if (hasConfig(name)) {
        const QString nameTemplate = name + QLatin1String(" (%1)");
        int suffix = 2;
        do
            name = nameTemplate.arg(QString::number(suffix++));
        while (hasConfig(name));
    }
    devConfig->setName(name);

    devConfig->setInternalId(m_nextId++);
    beginInsertRows(QModelIndex(), rowCount(), rowCount());
    if (!defaultDeviceConfig(devConfig->osType()))
        devConfig->setDefault(true);
    m_devConfigs << devConfig;
    endInsertRows();
}
Esempio n. 2
0
char * RMANAGER::INI(VESSEL * v)
{
	if (!v)
		return NULL;
	if (!hasConfig(v))
		return NULL;
	if (isSpacecraft(v))
		return v->GetName();
	else
		return v->GetClassName();
	return NULL;
}
Esempio n. 3
0
float RobotConfig::getConfig( const std::string & name ) const
{
	if (!hasConfig(name))
		return 0.0f;
	RobotPtr r = robot.lock();
	if (!r)
	{
		VR_WARNING << "Robot is already deleted..." << endl;
		return 0.0f;
	}
	RobotNodePtr rn = r->getRobotNode(name);
	THROW_VR_EXCEPTION_IF(!rn,"Did not find robot node with name " << name);
	std::map< RobotNodePtr, float >::const_iterator i = configs.find(rn);
	if (i==configs.end())
	{
		VR_ERROR << "Internal error..." << endl;
		return 0.0f;
	}
	return i->second;
}
Esempio n. 4
0
void RMANAGER::TimeStep()
{
	VESSEL * v = NULL;
	OBJHANDLE hVes = NULL;

	char ini[255];
	for (int i = 0; i < oapiGetVesselCount(); i++)
	{
		hVes = oapiGetVesselByIndex(i);
		if (!oapiIsVessel(hVes))
			continue;
		v    = oapiGetVesselInterface(hVes);
		if (isAttended(v))
			continue;
		if (!hasConfig(v))
			continue;
		sprintf(ini,"./Config/orbReentryStream/%s.ini",INI(v));
		atList.push_back(ReadAndAssign(ini,v));
	}
	VOBJ * vbj = NULL;
	for (int i = 0; i < atList.size(); i++)
	{
		if (!atList[i])
			continue;
		if (!oapiIsVessel(atList[i]->hook))
			continue;
		vbj  = atList[i];
		v    = oapiGetVesselInterface(vbj->hook);
		hVes = v->GetHandle();
		if (calcFlux(v) > vbj->flux)
		{
			if (!vbj->th)
				CreateResourceAndStreams(vbj);
			v->SetThrusterLevel(vbj->th,1);
		}else if (vbj->th)
			v->SetThrusterLevel(vbj->th,0);
	}
}