#include "entityproperty.h"
#include "ui_entityproperty.h"

#include <QDebug>

EntityProperty::EntityProperty(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::EntityProperty)
{
    ui->setupUi(this);
}

EntityProperty::~EntityProperty()
{
    delete ui;
}

void EntityProperty::setID(const QString &id, const QString& name, QImage image)
{
    mID = id;
    ui->lineEditID->setText(mID);
    ui->lineEditName->setText(name);
    QImage _image = image.scaled(QSize(ui->labelIcon->width(), ui->labelIcon->height()));
    ui->labelIcon->setPixmap(QPixmap::fromImage(_image));
}

void EntityProperty::setEntityRealTimeInfo(QList<MoveEntity> list)
{
    for(auto i : list)
    {
        if(i.id == mID)
        {
            MoveEntity info = i;

            // ui->lineEditID->setText(info.id);
            // ui->lineEditName->setText("名称");
            ui->lineEditLongitude->setText(QString::number(info.longitude));
            ui->lineEditLatitude->setText(QString::number(info.latitude));
            ui->lineEditAltitude->setText(QString::number(info.altitude));
            ui->lineEditPitch->setText(QString::number(info.pitch));
            ui->lineEditYaw->setText(QString::number(info.yaw));
            ui->lineEditRoll->setText(QString::number(info.roll));
            ui->lineEditSpeed->setText("60km/h");
        }
    }
}


