update
This commit is contained in:
parent
fb27f182dd
commit
1f04de258a
|
@ -101,9 +101,12 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="MapRoute.cpp" />
|
||||||
|
<ClCompile Include="VisibleBox.cpp" />
|
||||||
<ClInclude Include="componentbasic_global.h" />
|
<ClInclude Include="componentbasic_global.h" />
|
||||||
<ClInclude Include="componentbasic.h" />
|
<ClInclude Include="componentbasic.h" />
|
||||||
<ClCompile Include="componentbasic.cpp" />
|
<ClInclude Include="MapRoute.h" />
|
||||||
|
<ClInclude Include="VisibleBox.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||||
|
|
|
@ -26,11 +26,22 @@
|
||||||
<ClInclude Include="componentbasic_global.h">
|
<ClInclude Include="componentbasic_global.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="componentbasic.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="componentbasic.h">
|
<ClInclude Include="componentbasic.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="VisibleBox.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="MapRoute.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="VisibleBox.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="MapRoute.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1 @@
|
||||||
|
#include "MapRoute.h"
|
|
@ -0,0 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
class MapRoute
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
#include "VisibleBox.h"
|
||||||
|
|
||||||
|
|
||||||
|
// ͨ¹ý ProcList ¼Ì³Ð
|
||||||
|
std::shared_ptr<Box3DDesc> Visible3DPlugin::execute(std::shared_ptr<const Get3DBox> in) {
|
||||||
|
auto ins = std::make_shared<Box3DDesc>();
|
||||||
|
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);
|
||||||
|
|
||||||
|
DBL_PEAK(_self_lla._lon_deg);
|
||||||
|
DBL_PEAK(_self_lla._lat_deg);
|
||||||
|
DBL_PEAK(_self_lla._alt_m);
|
||||||
|
|
||||||
|
DBL_PEAK(_self_posture._azimuth_deg);
|
||||||
|
DBL_PEAK(_self_posture._pitch_deg);
|
||||||
|
DBL_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);
|
||||||
|
|
||||||
|
DBL_SAVE(_self_lla._lon_deg);
|
||||||
|
DBL_SAVE(_self_lla._lat_deg);
|
||||||
|
DBL_SAVE(_self_lla._alt_m);
|
||||||
|
|
||||||
|
DBL_SAVE(_self_posture._azimuth_deg);
|
||||||
|
DBL_SAVE(_self_posture._pitch_deg);
|
||||||
|
DBL_SAVE(_self_posture._roll_deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<WsComponent> Visible3DPlugin::defaultNew() const {
|
||||||
|
auto copy = std::make_shared<Visible3DPlugin>();
|
||||||
|
copy->_bind_entity = _bind_entity;
|
||||||
|
copy->_self_d3 = _self_d3;
|
||||||
|
copy->_self_lla = _self_lla;
|
||||||
|
copy->_self_posture = _self_posture;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Visible3DPlugin::bindEntity(uint64_t entity_id) {
|
||||||
|
this->_bind_entity = entity_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Visible3DPlugin::name() const {
|
||||||
|
return NAME(Visible3DPlugin);
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
#pragma once
|
||||||
|
#include "componentbasic.h"
|
||||||
|
#include <messagebasic.h>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ¿ÉÊÓ»¯3dÌå»ýºÐ
|
||||||
|
/// </summary>
|
||||||
|
class COMPONENTBASIC_EXPORT Visible3DPlugin : public ProcList<
|
||||||
|
WsRespond<Get3DBox, Box3DDesc>
|
||||||
|
>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
uint64_t _bind_entity = 0;
|
||||||
|
D3Data _self_d3;
|
||||||
|
LLAPos _self_lla;
|
||||||
|
Posture _self_posture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Visible3DPlugin() = default;
|
||||||
|
|
||||||
|
// ͨ¹ý ProcList ¼Ì³Ð
|
||||||
|
void bindEntity(uint64_t entity_id) override;
|
||||||
|
QString name() const override;
|
||||||
|
|
||||||
|
std::shared_ptr<Box3DDesc> execute(std::shared_ptr<const Get3DBox> in) override;
|
||||||
|
|
||||||
|
std::shared_ptr<WsComponent> defaultNew() const override;
|
||||||
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
void saveTo(QJsonObject& obj) const override;
|
||||||
|
};
|
|
@ -1 +0,0 @@
|
||||||
#include "componentbasic.h"
|
|
|
@ -88,25 +88,3 @@ struct ProcList : public _ProcRoute_<Procs...>, public WsComponent
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <messagebasic.h>
|
|
||||||
class COMPONENTBASIC_EXPORT Visible3DPlugin : public ProcList<
|
|
||||||
WsRespond<Get3DVolume, Volume3DDesc>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// ͨ¹ý ProcList ¼Ì³Ð
|
|
||||||
std::shared_ptr<Volume3DDesc> execute(std::shared_ptr<const Get3DVolume> in) override;
|
|
||||||
|
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
|
||||||
|
|
||||||
void saveTo(QJsonObject& obj) const override;
|
|
||||||
|
|
||||||
std::shared_ptr<WsComponent> defaultNew() const override;
|
|
||||||
|
|
||||||
void bindEntity(uint64_t entity_id) override;
|
|
||||||
|
|
||||||
QString name() const override;
|
|
||||||
|
|
||||||
};
|
|
|
@ -119,84 +119,112 @@ uint64_t RespondDefault::sourceEntity() const
|
||||||
return _from_id;
|
return _from_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
Get3DVolume::Get3DVolume()
|
Get3DBox::Get3DBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Get3DVolume::reset(uint64_t from, uint64_t to)
|
void Get3DBox::reset(uint64_t from, uint64_t to)
|
||||||
{
|
{
|
||||||
_from_id = from;
|
_from_id = from;
|
||||||
_to_id = to;
|
_to_id = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Get3DVolume::recoveryFrom(const QJsonObject& obj)
|
void Get3DBox::recoveryFrom(const QJsonObject& obj)
|
||||||
{
|
{
|
||||||
from_to_recovery(_from_id, _to_id, obj);
|
from_to_recovery(_from_id, _to_id, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Get3DVolume::saveTo(QJsonObject& obj) const
|
void Get3DBox::saveTo(QJsonObject& obj) const
|
||||||
{
|
{
|
||||||
from_to_save(_from_id, _to_id, obj);
|
from_to_save(_from_id, _to_id, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Get3DVolume::topicString() const
|
QString Get3DBox::topicString() const
|
||||||
{
|
{
|
||||||
return NAME(Get3DVolume);
|
return NAME(Get3DBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Get3DVolume::targetEntity() const
|
uint64_t Get3DBox::targetEntity() const
|
||||||
{
|
{
|
||||||
return _to_id;
|
return _to_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Get3DVolume::sourceEntity() const
|
uint64_t Get3DBox::sourceEntity() const
|
||||||
{
|
{
|
||||||
return _from_id;
|
return _from_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
Volume3DDesc::Volume3DDesc()
|
Box3DDesc::Box3DDesc()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume3DDesc::reset(uint64_t from, uint64_t to, double l, double w, double h, double azi)
|
void Box3DDesc::setTarget(uint64_t from, uint64_t to) {
|
||||||
{
|
|
||||||
_from_id = from;
|
_from_id = from;
|
||||||
_to_id = to;
|
_to_id = to;
|
||||||
_length = l;
|
|
||||||
_width = w;
|
|
||||||
_height = h;
|
|
||||||
_azimuth_deg = azi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume3DDesc::recoveryFrom(const QJsonObject& obj)
|
void Box3DDesc::setVolume(const D3Data& d) {
|
||||||
|
this->_d3_data = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
D3Data Box3DDesc::volume() const { return this->_d3_data; }
|
||||||
|
|
||||||
|
void Box3DDesc::setPosture(const Posture& p) {
|
||||||
|
_posture_d3 = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
Posture Box3DDesc::posture() const { return this->_posture_d3; }
|
||||||
|
|
||||||
|
void Box3DDesc::setPosition(const LLAPos& lla) {
|
||||||
|
_lla_pos = lla;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLAPos Box3DDesc::position() const { return this->_lla_pos; }
|
||||||
|
|
||||||
|
void Box3DDesc::recoveryFrom(const QJsonObject& obj)
|
||||||
{
|
{
|
||||||
from_to_recovery(_from_id, _to_id, obj);
|
from_to_recovery(_from_id, _to_id, obj);
|
||||||
_length = obj["length"].toDouble();
|
DBL_PEAK(this->_d3_data._height_m);
|
||||||
_width = obj["width"].toDouble();
|
DBL_PEAK(this->_d3_data._length_m);
|
||||||
_height = obj["height"].toDouble();
|
DBL_PEAK(this->_d3_data._width_m);
|
||||||
_azimuth_deg = obj["azimuth_deg"].toDouble();
|
|
||||||
|
DBL_PEAK(this->_lla_pos._lon_deg);
|
||||||
|
DBL_PEAK(this->_lla_pos._lat_deg);
|
||||||
|
DBL_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume3DDesc::saveTo(QJsonObject& obj) const
|
void Box3DDesc::saveTo(QJsonObject& obj) const
|
||||||
{
|
{
|
||||||
from_to_save(_from_id, _to_id, obj);
|
from_to_save(_from_id, _to_id, obj);
|
||||||
obj["length"] = _length;
|
|
||||||
obj["width"] = _width;
|
DBL_SAVE(this->_d3_data._height_m);
|
||||||
obj["height"] = _height;
|
DBL_SAVE(this->_d3_data._length_m);
|
||||||
obj["azimuth_deg"] = _azimuth_deg;
|
DBL_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);
|
||||||
|
|
||||||
|
DBL_SAVE(this->_posture_d3._azimuth_deg);
|
||||||
|
DBL_SAVE(this->_posture_d3._pitch_deg);
|
||||||
|
DBL_SAVE(this->_posture_d3._roll_deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Volume3DDesc::topicString() const
|
QString Box3DDesc::topicString() const
|
||||||
{
|
{
|
||||||
return NAME(Volume3DDesc);
|
return NAME(Box3DDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Volume3DDesc::targetEntity() const
|
uint64_t Box3DDesc::targetEntity() const
|
||||||
{
|
{
|
||||||
return _to_id;
|
return _to_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Volume3DDesc::sourceEntity() const
|
uint64_t Box3DDesc::sourceEntity() const
|
||||||
{
|
{
|
||||||
return _from_id;
|
return _from_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
#include "simsbasic.h"
|
#include "simsbasic.h"
|
||||||
|
|
||||||
#define NAME(v) #v
|
#define NAME(v) #v
|
||||||
|
#define DBL_SAVE(u) obj[NAME(u)] = u
|
||||||
|
#define DBL_PEAK(u) u = obj[NAME(u)].toDouble()
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ÍÆÑÝÇëÇó
|
/// ÍÆÑÝÇëÇó
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class MESSAGEBASIC_EXPORT DeduceRequest : public WsMessage {
|
class MESSAGEBASIC_EXPORT DeduceRequest : public WsMessage {
|
||||||
private:
|
private:
|
||||||
uint64_t _from_id, _to_id;
|
uint64_t _from_id = 0, _to_id = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DeduceRequest();
|
DeduceRequest();
|
||||||
|
@ -30,7 +32,7 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class MESSAGEBASIC_EXPORT RespondDefault : public WsMessage {
|
class MESSAGEBASIC_EXPORT RespondDefault : public WsMessage {
|
||||||
private:
|
private:
|
||||||
uint64_t _from_id, _to_id;
|
uint64_t _from_id = 0, _to_id = 0;
|
||||||
double _time_consume;
|
double _time_consume;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -53,7 +55,7 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class MESSAGEBASIC_EXPORT SyncRequest : public WsMessage {
|
class MESSAGEBASIC_EXPORT SyncRequest : public WsMessage {
|
||||||
private:
|
private:
|
||||||
uint64_t _from_id, _to_id;
|
uint64_t _from_id = 0, _to_id = 0;
|
||||||
double _time_current;
|
double _time_current;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -69,12 +71,16 @@ public:
|
||||||
uint64_t sourceEntity() const override;
|
uint64_t sourceEntity() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MESSAGEBASIC_EXPORT Get3DVolume : public WsMessage {
|
// 体积盒可视化插件定义消息 =======================================================
|
||||||
|
/// <summary>
|
||||||
|
/// 获取体积盒详细数据
|
||||||
|
/// </summary>
|
||||||
|
class MESSAGEBASIC_EXPORT Get3DBox : public WsMessage {
|
||||||
private:
|
private:
|
||||||
uint64_t _from_id = 0, _to_id = 0;
|
uint64_t _from_id = 0, _to_id = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Get3DVolume();
|
Get3DBox();
|
||||||
|
|
||||||
void reset(uint64_t from, uint64_t to);
|
void reset(uint64_t from, uint64_t to);
|
||||||
|
|
||||||
|
@ -86,16 +92,52 @@ public:
|
||||||
uint64_t sourceEntity() const override;
|
uint64_t sourceEntity() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MESSAGEBASIC_EXPORT Volume3DDesc : public WsMessage {
|
/// <summary>
|
||||||
|
/// WGS84坐标系坐标类型
|
||||||
|
/// </summary>
|
||||||
|
struct LLAPos {
|
||||||
|
double _lon_deg = 0;
|
||||||
|
double _lat_deg = 0;
|
||||||
|
double _alt_m = 0;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// 姿态数据结构定义
|
||||||
|
/// </summary>
|
||||||
|
struct Posture {
|
||||||
|
double _azimuth_deg = 0;
|
||||||
|
double _pitch_deg = 0;
|
||||||
|
double _roll_deg = 0;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// 三维数据结构定义
|
||||||
|
/// </summary>
|
||||||
|
struct D3Data{
|
||||||
|
double _length_m = 0;
|
||||||
|
double _width_m = 0;
|
||||||
|
double _height_m = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 体积盒详细数据定义
|
||||||
|
/// </summary>
|
||||||
|
class MESSAGEBASIC_EXPORT Box3DDesc : public WsMessage {
|
||||||
private:
|
private:
|
||||||
uint64_t _from_id, _to_id;
|
uint64_t _from_id = 0, _to_id = 0;
|
||||||
double _length, _width, _height;
|
D3Data _d3_data;
|
||||||
double _azimuth_deg;
|
Posture _posture_d3;
|
||||||
|
LLAPos _lla_pos;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Volume3DDesc();
|
Box3DDesc();
|
||||||
|
|
||||||
|
void setTarget(uint64_t from, uint64_t to);
|
||||||
|
void setVolume(const D3Data &d);
|
||||||
|
D3Data volume() const;
|
||||||
|
void setPosture(const Posture &p);
|
||||||
|
Posture posture() const;
|
||||||
|
void setPosition(const LLAPos &lla);
|
||||||
|
LLAPos position() const;
|
||||||
|
|
||||||
void reset(uint64_t from, uint64_t to, double l, double w, double h, double azi);
|
|
||||||
|
|
||||||
// ͨ¹ý WsMessage ¼Ì³Ð
|
// ͨ¹ý WsMessage ¼Ì³Ð
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
@ -103,4 +145,4 @@ public:
|
||||||
QString topicString() const override;
|
QString topicString() const override;
|
||||||
uint64_t targetEntity() const override;
|
uint64_t targetEntity() const override;
|
||||||
uint64_t sourceEntity() const override;
|
uint64_t sourceEntity() const override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue