62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
#pragma once
|
|
#include "Tool.h"
|
|
|
|
static QWidget* createPlanispherePlot() {
|
|
class TimeAxis;
|
|
class PlanispherePlot : public YSG::Plot {
|
|
public:
|
|
YSG::Axis *xAxis{};
|
|
YSG::Axis *yAxis{};
|
|
YSG::Planisphere *mPlanisphere{};
|
|
YSG::MutiSelectRect *msr{};
|
|
QMenu *mMenu{};
|
|
void init() override {
|
|
Plot::init();
|
|
mObjectName = "PlanispherePlot";
|
|
|
|
|
|
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
|
|
.set_tickLength(-10)
|
|
.set_subTickLength(-5).build();
|
|
|
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical).build();
|
|
|
|
|
|
mPlanisphere = YSG::Planisphere::Builder(xAxis, yAxis)
|
|
.set_layerName("plottable")
|
|
.set_continueMillisecond(2000).build();
|
|
|
|
|
|
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
|
|
|
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
xAxis->set_x(0);
|
|
xAxis->set_y(height() - 1);
|
|
xAxis->set_pixelSize(width());
|
|
yAxis->set_x(0);
|
|
yAxis->set_y(0);
|
|
yAxis->set_pixelSize(height());
|
|
mPlanisphere->setToAxisCenter();
|
|
}
|
|
|
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
|
if(!mMenu) {
|
|
auto ws =
|
|
bw(cw(mPlanisphere, -1), "星座图") +
|
|
bw(cw(xAxis), "I轴") +
|
|
bw(cw(yAxis), "Q轴");
|
|
mMenu = createMenu(this, ws);
|
|
}
|
|
mMenu->exec(event->globalPos());
|
|
}
|
|
};
|
|
auto w = new PlanispherePlot;
|
|
w->init();
|
|
|
|
|
|
return w;
|
|
}
|