mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
FeatureWebAPIUtils: Add method to open Sky Map and find a target.
This commit is contained in:
parent
2be14f944a
commit
10993b447b
@ -210,3 +210,56 @@ bool FeatureWebAPIUtils::satelliteLOS(const QString name)
|
|||||||
// Not currently required by any features
|
// Not currently required by any features
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open a Sky Map feature and find the specified target
|
||||||
|
bool FeatureWebAPIUtils::openSkyMapAndFind(const QString& target)
|
||||||
|
{
|
||||||
|
return SkyMapOpener::open(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SkyMapOpener::open(const QString& target)
|
||||||
|
{
|
||||||
|
// Create a SkyMap feature
|
||||||
|
MainCore *mainCore = MainCore::instance();
|
||||||
|
PluginAPI::FeatureRegistrations *featureRegistrations = mainCore->getPluginManager()->getFeatureRegistrations();
|
||||||
|
int nbRegistrations = featureRegistrations->size();
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (; index < nbRegistrations; index++)
|
||||||
|
{
|
||||||
|
if (featureRegistrations->at(index).m_featureId == "SkyMap") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < nbRegistrations)
|
||||||
|
{
|
||||||
|
new SkyMapOpener(target);
|
||||||
|
|
||||||
|
MainCore::MsgAddFeature *msg = MainCore::MsgAddFeature::create(0, index);
|
||||||
|
mainCore->getMainMessageQueue()->push(msg);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "Sky Map feature not available";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SkyMapOpener::SkyMapOpener(const QString& target) :
|
||||||
|
m_target(target)
|
||||||
|
{
|
||||||
|
connect(MainCore::instance(), &MainCore::featureAdded, this, &SkyMapOpener::onSkyMapAdded);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkyMapOpener::onSkyMapAdded(int featureSetIndex, Feature *feature)
|
||||||
|
{
|
||||||
|
if (feature->getURI() == "sdrangel.feature.skymap")
|
||||||
|
{
|
||||||
|
disconnect(MainCore::instance(), &MainCore::featureAdded, this, &SkyMapOpener::onSkyMapAdded);
|
||||||
|
FeatureWebAPIUtils::skyMapFind(m_target, featureSetIndex, feature->getIndexInFeatureSet());
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -27,12 +27,29 @@
|
|||||||
|
|
||||||
class Feature;
|
class Feature;
|
||||||
|
|
||||||
|
class SkyMapOpener : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QString m_target;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SkyMapOpener(const QString& target);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool open(const QString& target);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onSkyMapAdded(int featureSetIndex, Feature *feature);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class SDRBASE_API FeatureWebAPIUtils
|
class SDRBASE_API FeatureWebAPIUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool mapFind(const QString& target, int featureSetIndex=-1, int featureIndex=-1);
|
static bool mapFind(const QString& target, int featureSetIndex=-1, int featureIndex=-1);
|
||||||
static bool mapSetDateTime(const QDateTime& dateTime, int featureSetIndex=-1, int featureIndex=-1);
|
static bool mapSetDateTime(const QDateTime& dateTime, int featureSetIndex=-1, int featureIndex=-1);
|
||||||
static bool skyMapFind(const QString& target, int featureSetIndex=-1, int featureIndex=-1);
|
static bool skyMapFind(const QString& target, int featureSetIndex=-1, int featureIndex=-1);
|
||||||
|
static bool openSkyMapAndFind(const QString& target);
|
||||||
static Feature *getFeature(int& featureSetIndex, int& featureIndex, const QString& uri);
|
static Feature *getFeature(int& featureSetIndex, int& featureIndex, const QString& uri);
|
||||||
static bool satelliteAOS(const QString name, const QDateTime aos, const QDateTime los);
|
static bool satelliteAOS(const QString name, const QDateTime aos, const QDateTime los);
|
||||||
static bool satelliteLOS(const QString name);
|
static bool satelliteLOS(const QString name);
|
||||||
|
Loading…
Reference in New Issue
Block a user