diff --git a/ComponentBasic/VisibleBox.cpp b/ComponentBasic/VisibleBox.cpp index 1e394f0..cc62c80 100644 --- a/ComponentBasic/VisibleBox.cpp +++ b/ComponentBasic/VisibleBox.cpp @@ -2,44 +2,36 @@ // ͨ¹ý ProcList ¼Ì³Ð -std::shared_ptr Visible3DPlugin::execute(std::shared_ptr in) { - auto ins = std::make_shared(); - ins->setPosition(_self_lla); - ins->setPosture(_self_posture); - ins->setTarget(_bind_entity, in->sourceEntity()); - ins->setVolume(_self_d3); - return ins; -} void Visible3DPlugin::recoveryFrom(const QJsonObject& obj) { this->_bind_entity = obj["_bind_entity"].toVariant().toULongLong(); - DBL_PEAK(_self_d3._length_m); - DBL_PEAK(_self_d3._width_m); - DBL_PEAK(_self_d3._height_m); + DOUOBLE_PEAK(_self_d3._length_m); + DOUOBLE_PEAK(_self_d3._width_m); + DOUOBLE_PEAK(_self_d3._height_m); - DBL_PEAK(_self_lla._lon_deg); - DBL_PEAK(_self_lla._lat_deg); - DBL_PEAK(_self_lla._alt_m); + DOUOBLE_PEAK(_self_lla._lon_deg); + DOUOBLE_PEAK(_self_lla._lat_deg); + DOUOBLE_PEAK(_self_lla._alt_m); - DBL_PEAK(_self_posture._azimuth_deg); - DBL_PEAK(_self_posture._pitch_deg); - DBL_PEAK(_self_posture._roll_deg); + DOUOBLE_PEAK(_self_posture._azimuth_deg); + DOUOBLE_PEAK(_self_posture._pitch_deg); + DOUOBLE_PEAK(_self_posture._roll_deg); } void Visible3DPlugin::saveTo(QJsonObject& obj) const { obj["_bind_entity"] = QJsonValue::fromVariant(QVariant::fromValue(this->_bind_entity)); - DBL_SAVE(_self_d3._length_m); - DBL_SAVE(_self_d3._width_m); - DBL_SAVE(_self_d3._height_m); + DOUBLE_SAVE(_self_d3._length_m); + DOUBLE_SAVE(_self_d3._width_m); + DOUBLE_SAVE(_self_d3._height_m); - DBL_SAVE(_self_lla._lon_deg); - DBL_SAVE(_self_lla._lat_deg); - DBL_SAVE(_self_lla._alt_m); + DOUBLE_SAVE(_self_lla._lon_deg); + DOUBLE_SAVE(_self_lla._lat_deg); + DOUBLE_SAVE(_self_lla._alt_m); - DBL_SAVE(_self_posture._azimuth_deg); - DBL_SAVE(_self_posture._pitch_deg); - DBL_SAVE(_self_posture._roll_deg); + DOUBLE_SAVE(_self_posture._azimuth_deg); + DOUBLE_SAVE(_self_posture._pitch_deg); + DOUBLE_SAVE(_self_posture._roll_deg); } std::shared_ptr Visible3DPlugin::defaultNew() const { @@ -58,3 +50,13 @@ void Visible3DPlugin::bindEntity(uint64_t entity_id) { QString Visible3DPlugin::name() const { return NAME(Visible3DPlugin); } + +void Visible3DPlugin::execute(std::shared_ptr in, std::shared_ptr& out) +{ + auto ins = std::make_shared(); + ins->setPosition(_self_lla); + ins->setPosture(_self_posture); + ins->setTarget(_bind_entity, in->sourceEntity()); + ins->setVolume(_self_d3); + out = ins; +} diff --git a/ComponentBasic/VisibleBox.h b/ComponentBasic/VisibleBox.h index 73c2a4b..1cdc6c3 100644 --- a/ComponentBasic/VisibleBox.h +++ b/ComponentBasic/VisibleBox.h @@ -23,7 +23,7 @@ public: void bindEntity(uint64_t entity_id) override; QString name() const override; - std::shared_ptr execute(std::shared_ptr in) override; + void execute(std::shared_ptr in, std::shared_ptr& out) override; std::shared_ptr defaultNew() const override; void recoveryFrom(const QJsonObject& obj) override; diff --git a/ComponentBasic/componentbasic.h b/ComponentBasic/componentbasic.h index 90716cc..14c6139 100644 --- a/ComponentBasic/componentbasic.h +++ b/ComponentBasic/componentbasic.h @@ -27,15 +27,17 @@ public: /// ×ÓÀàÖÐʵ¼Ê´¦Àíº¯Êý /// /// - /// - virtual std::shared_ptr execute(std::shared_ptr in) = 0; + /// + virtual void execute(std::shared_ptr in, std::shared_ptr& out) = 0; /// /// WsRespond¹¹Ô캯Êý /// /// ×¢²áº¯Êý explicit WsRespond(QHash& map) { - WsRespondEntry ins = [=](std::shared_ptr in) -> std::shared_ptr { - return this->execute(std::static_pointer_cast(in)); + WsRespondEntry ins = [=](std::shared_ptr in, std::shared_ptr& out) { + std::shared_ptr o_ptr; + this->execute(std::static_pointer_cast(in), o_ptr); + out = o_ptr; }; map[SelfType::signature()] = ins; } @@ -71,12 +73,14 @@ struct ProcList : public _ProcRoute_, public WsComponent } return list; } - WsRespondEntry getEntryWithSignature(const WsRespondSignatureType& t) const override + QList getEntryWithSignature(const WsRespondSignatureType& t) const override { + QList list; for (auto key : _ProcRoute_<>::_execute_map.keys()) { if (key == t) - return _ProcRoute_<>::_execute_map[key]; + list.append(_ProcRoute_<>::_execute_map[key]); } + return list; } QList getEntrysWithInType(const QString& msg_type) const override { diff --git a/MessageBasic/messagebasic.cpp b/MessageBasic/messagebasic.cpp index 79c54e4..4547c7a 100644 --- a/MessageBasic/messagebasic.cpp +++ b/MessageBasic/messagebasic.cpp @@ -184,34 +184,34 @@ LLAPos Box3DDesc::position() const { return this->_lla_pos; } void Box3DDesc::recoveryFrom(const QJsonObject& obj) { from_to_recovery(_from_id, _to_id, obj); - DBL_PEAK(this->_d3_data._height_m); - DBL_PEAK(this->_d3_data._length_m); - DBL_PEAK(this->_d3_data._width_m); + DOUOBLE_PEAK(this->_d3_data._height_m); + DOUOBLE_PEAK(this->_d3_data._length_m); + DOUOBLE_PEAK(this->_d3_data._width_m); - DBL_PEAK(this->_lla_pos._lon_deg); - DBL_PEAK(this->_lla_pos._lat_deg); - DBL_PEAK(this->_lla_pos._alt_m); + DOUOBLE_PEAK(this->_lla_pos._lon_deg); + DOUOBLE_PEAK(this->_lla_pos._lat_deg); + DOUOBLE_PEAK(this->_lla_pos._alt_m); - DBL_PEAK(this->_posture_d3._azimuth_deg); - DBL_PEAK(this->_posture_d3._pitch_deg); - DBL_PEAK(this->_posture_d3._roll_deg); + DOUOBLE_PEAK(this->_posture_d3._azimuth_deg); + DOUOBLE_PEAK(this->_posture_d3._pitch_deg); + DOUOBLE_PEAK(this->_posture_d3._roll_deg); } void Box3DDesc::saveTo(QJsonObject& obj) const { from_to_save(_from_id, _to_id, obj); - DBL_SAVE(this->_d3_data._height_m); - DBL_SAVE(this->_d3_data._length_m); - DBL_SAVE(this->_d3_data._width_m); + DOUBLE_SAVE(this->_d3_data._height_m); + DOUBLE_SAVE(this->_d3_data._length_m); + DOUBLE_SAVE(this->_d3_data._width_m); - DBL_SAVE(this->_lla_pos._lon_deg); - DBL_SAVE(this->_lla_pos._lat_deg); - DBL_SAVE(this->_lla_pos._alt_m); + DOUBLE_SAVE(this->_lla_pos._lon_deg); + DOUBLE_SAVE(this->_lla_pos._lat_deg); + DOUBLE_SAVE(this->_lla_pos._alt_m); - DBL_SAVE(this->_posture_d3._azimuth_deg); - DBL_SAVE(this->_posture_d3._pitch_deg); - DBL_SAVE(this->_posture_d3._roll_deg); + DOUBLE_SAVE(this->_posture_d3._azimuth_deg); + DOUBLE_SAVE(this->_posture_d3._pitch_deg); + DOUBLE_SAVE(this->_posture_d3._roll_deg); } QString Box3DDesc::topicString() const diff --git a/MessageBasic/messagebasic.h b/MessageBasic/messagebasic.h index 4fc65f3..983b7c0 100644 --- a/MessageBasic/messagebasic.h +++ b/MessageBasic/messagebasic.h @@ -4,8 +4,8 @@ #include "simsbasic.h" #define NAME(v) #v -#define DBL_SAVE(u) obj[NAME(u)] = u -#define DBL_PEAK(u) u = obj[NAME(u)].toDouble() +#define DOUBLE_SAVE(u) obj[NAME(u)] = u +#define DOUOBLE_PEAK(u) u = obj[NAME(u)].toDouble() /// /// ÍÆÑÝÇëÇó diff --git a/SimsBasic/simsbasic.h b/SimsBasic/simsbasic.h index fc3c7ef..cdf8226 100644 --- a/SimsBasic/simsbasic.h +++ b/SimsBasic/simsbasic.h @@ -63,7 +63,7 @@ public: /// /// ËùÓÐÏûÏ¢´¦Àíµ¥ÔªÍ¨ÓÃ½Ó¿Ú /// -using WsRespondEntry = std::function(std::shared_ptr)>; +using WsRespondEntry = std::function, std::shared_ptr&)>; /// /// RespondÇ©ÃûÀàÐÍ /// @@ -103,7 +103,7 @@ public: /// /// ´¦ÀíÇ©Ãû /// ´¦Àí½Ó¿Ú - virtual WsRespondEntry getEntryWithSignature(const WsRespondSignatureType& t) const = 0; + virtual QList getEntryWithSignature(const WsRespondSignatureType& t) const = 0; /// /// ͨ¹ýÊäÈëÏûÏ¢ÀàÐÍ»ñÈ¡´¦ÀíÈë¿Ú /// diff --git a/SimsWorld.sln b/SimsWorld.sln index 98a9502..124b16c 100644 --- a/SimsWorld.sln +++ b/SimsWorld.sln @@ -1,15 +1,22 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.13.35825.156 d17.13 +VisualStudioVersion = 17.13.35825.156 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimsWorld", "SimsWorld\SimsWorld.vcxproj", "{46E3FBA5-6775-4638-AE2E-935675D3B9CE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimsBasic", "SimsBasic\SimsBasic.vcxproj", "{DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComponentBasic", "ComponentBasic\ComponentBasic.vcxproj", "{20CFC220-4F5B-4D39-97FA-74C70768F1A7}" + ProjectSection(ProjectDependencies) = postProject + {DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0} = {DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0} + {E1104048-F35B-40B7-995C-0320E689BF09} = {E1104048-F35B-40B7-995C-0320E689BF09} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MessageBasic", "MessageBasic\MessageBasic.vcxproj", "{E1104048-F35B-40B7-995C-0320E689BF09}" + ProjectSection(ProjectDependencies) = postProject + {DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0} = {DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution