1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

API: added index in FeatureSet structure

This commit is contained in:
f4exb 2021-09-16 21:20:03 +02:00
parent 611171234a
commit e8ed80167c
7 changed files with 50 additions and 4 deletions

View File

@ -4913,8 +4913,12 @@ margin-bottom: 20px;
"description" : "Base feature report. Only the feature report corresponding to the feature specified in the featureType field is or should be present."
};
defs.FeatureSet = {
"required" : [ "featurecount" ],
"required" : [ "featurecount", "index" ],
"properties" : {
"index" : {
"type" : "integer",
"description" : "Index in the list of feature sets opened in this instance"
},
"featurecount" : {
"type" : "integer",
"description" : "Number of features in the set"
@ -50576,7 +50580,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-09-05T21:54:27.642+02:00
Generated 2021-09-12T20:10:39.058+02:00
</div>
</div>
</div>

View File

@ -2759,8 +2759,12 @@ definitions:
FeatureSet:
description: "Grouping of features"
required:
- index
- featurecount
properties:
index:
description: "Index in the list of feature sets opened in this instance"
type: integer
featurecount:
description: "Number of features in the set"
type: integer

View File

@ -3767,6 +3767,7 @@ void WebAPIAdapter::getFeatureSet(SWGSDRangel::SWGFeatureSet *swgFeatureSet, con
(void) featureSetIndex; // FIXME: the index should be present in the API FeatureSet structure
swgFeatureSet->init();
swgFeatureSet->setFeaturecount(featureSet->getNumberOfFeatures());
swgFeatureSet->setIndex(featureSetIndex);
QList<SWGSDRangel::SWGFeature*> *features = swgFeatureSet->getFeatures();
for (int i = 0; i < featureSet->getNumberOfFeatures(); i++)

View File

@ -2759,8 +2759,12 @@ definitions:
FeatureSet:
description: "Grouping of features"
required:
- index
- featurecount
properties:
index:
description: "Index in the list of feature sets opened in this instance"
type: integer
featurecount:
description: "Number of features in the set"
type: integer

View File

@ -4913,8 +4913,12 @@ margin-bottom: 20px;
"description" : "Base feature report. Only the feature report corresponding to the feature specified in the featureType field is or should be present."
};
defs.FeatureSet = {
"required" : [ "featurecount" ],
"required" : [ "featurecount", "index" ],
"properties" : {
"index" : {
"type" : "integer",
"description" : "Index in the list of feature sets opened in this instance"
},
"featurecount" : {
"type" : "integer",
"description" : "Number of features in the set"
@ -50576,7 +50580,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-09-05T21:54:27.642+02:00
Generated 2021-09-12T20:10:39.058+02:00
</div>
</div>
</div>

View File

@ -28,6 +28,8 @@ SWGFeatureSet::SWGFeatureSet(QString* json) {
}
SWGFeatureSet::SWGFeatureSet() {
index = 0;
m_index_isSet = false;
featurecount = 0;
m_featurecount_isSet = false;
features = nullptr;
@ -40,6 +42,8 @@ SWGFeatureSet::~SWGFeatureSet() {
void
SWGFeatureSet::init() {
index = 0;
m_index_isSet = false;
featurecount = 0;
m_featurecount_isSet = false;
features = new QList<SWGFeature*>();
@ -49,6 +53,7 @@ SWGFeatureSet::init() {
void
SWGFeatureSet::cleanup() {
if(features != nullptr) {
auto arr = features;
for(auto o: *arr) {
@ -69,6 +74,8 @@ SWGFeatureSet::fromJson(QString &json) {
void
SWGFeatureSet::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&featurecount, pJson["featurecount"], "qint32", "");
@ -89,6 +96,9 @@ SWGFeatureSet::asJson ()
QJsonObject*
SWGFeatureSet::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_index_isSet){
obj->insert("index", QJsonValue(index));
}
if(m_featurecount_isSet){
obj->insert("featurecount", QJsonValue(featurecount));
}
@ -99,6 +109,16 @@ SWGFeatureSet::asJsonObject() {
return obj;
}
qint32
SWGFeatureSet::getIndex() {
return index;
}
void
SWGFeatureSet::setIndex(qint32 index) {
this->index = index;
this->m_index_isSet = true;
}
qint32
SWGFeatureSet::getFeaturecount() {
return featurecount;
@ -124,6 +144,9 @@ bool
SWGFeatureSet::isSet(){
bool isObjectUpdated = false;
do{
if(m_index_isSet){
isObjectUpdated = true; break;
}
if(m_featurecount_isSet){
isObjectUpdated = true; break;
}

View File

@ -43,6 +43,9 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGFeatureSet* fromJson(QString &jsonString) override;
qint32 getIndex();
void setIndex(qint32 index);
qint32 getFeaturecount();
void setFeaturecount(qint32 featurecount);
@ -53,6 +56,9 @@ public:
virtual bool isSet() override;
private:
qint32 index;
bool m_index_isSet;
qint32 featurecount;
bool m_featurecount_isSet;