Example #1
0
QVariantMap StelObjectMgr::getObjectInfo(const StelObjectP obj)
{
	QVariantMap map;
	if (!obj)
	{
		qDebug() << "getObjectInfo WARNING - object not found";
		map.insert("found", false);
	}
	else
	{
		map=obj->getInfoMap(StelApp::getInstance().getCore());
		map.insert("found", true);
	}
	return map;
}
void TelescopeClientJsonRts2::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
{
	if (!isConnected())
		return;

	QUrl set(baseurl);
	set.setPath(baseurl.path() + "/api/cmd");

	QUrlQuery query;
	query.addQueryItem("d", telName);

	bool commanded = false;

	// if it's satellite, use move_tle
	if (selectObject)
	{
		QVariantMap objectMap = selectObject->getInfoMap(StelApp::getInstance().getCore());
		if (objectMap.contains("tle1") && objectMap.contains("tle2"))
		{
			query.addQueryItem("c", QString("move_tle+%22") + objectMap["tle1"].toString() + QString("%22+%22") + objectMap["tle2"].toString() + QString("%22"));
			commanded = true;
		}
	}

	if (commanded == false)
	{
		double ra, dec;
		StelUtils::rectToSphe(&ra, &dec, j2000Pos);

		query.addQueryItem("c", QString("move+%1+%2").arg(ra * 180 / M_PI).arg(dec * 180 / M_PI));
	}
	set.setQuery(query);

	QNetworkRequest setR;
	setR.setUrl(set);

	qDebug() << "TelescopeRTS2(" << name << ")::telescopeGoto: request: " << set.toString();

	networkManager.get(setR);
}