#include "plane.h"
#include "translator.h"

Plane::Plane()
{

}

Plane::Plane(QString planeName,int planeType, double lon, double lat)
{
    this->planeName = planeName;
    m_pGeoPoint = new UGGeoPoint();
    m_pGeoPoint->SetX(lon);
    m_pGeoPoint->SetY(lat);
    m_pGeoPoint->SetStyle(getPlaneStyle(planeType));
}

//设置飞机位置
void Plane::setPosition(double lon,double lat)
{
    m_pGeoPoint->SetX(lon);
    m_pGeoPoint->SetY(lat);
}

double Plane::getPointX()
{
    return m_pGeoPoint->GetX();
}

double Plane::getPointY()
{
    return m_pGeoPoint->GetY();
}

UGGeoPoint *Plane::getGeometry()
{
    return m_pGeoPoint;
}

QString Plane::getPlaneName()
{
    return planeName;
}

// 获取飞机图标
UGStyle* Plane::getPlaneStyle(int planeType)
{
    UGStyle* pStyle = new UGStyle;
    pStyle->SetMarkerSize(8);
    pStyle->SetMarkerAngle(-90);
    switch (planeType) {
    case 0:// 98

        break;
    case 1: // 981a

        break;
    case 2: //981c
//        pStyle->SetMarkerStyle(1);
        pStyle->SetPicturePath(Translator::QStr2UGStr("D:/supermap-iobjectscpp/MyProject/MapDisplay/Resources/Plane/FH-981C.png"));
        break;
    case 3: //预留

        break;
    default:
        break;
    }

    return pStyle;
}