49 lines
1.7 KiB
C++
49 lines
1.7 KiB
C++
#pragma once
|
|
#include "Tool.h"
|
|
static QWidget* create_planisphere_plot() {
|
|
class TimeAxis;
|
|
class Planisphere_Plot : public YSG::Plot {
|
|
public:
|
|
YSG::Axis* xAxis{};
|
|
YSG::Axis* yAxis{};
|
|
YSG::Planisphere* mPlanisphere{};
|
|
YSG::Muti_Select_Rect* msr{};
|
|
QMenu* mMenu{};
|
|
void init() override {
|
|
Plot::init();
|
|
object_name = "PlanispherePlot";
|
|
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
|
|
.set_tick_length(-10)
|
|
.set_sub_tick_length(-5).build();
|
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical).build();
|
|
mPlanisphere = YSG::Planisphere::Builder(xAxis, yAxis)
|
|
.set_layerName("plottable")
|
|
.set_continue_millisecond(2000).build();
|
|
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
xAxis->set_x(0);
|
|
xAxis->set_y(height() - 1);
|
|
xAxis->set_pixel_size(width());
|
|
yAxis->set_x(0);
|
|
yAxis->set_y(0);
|
|
yAxis->set_pixel_size(height());
|
|
mPlanisphere->set_to_axis_center();
|
|
}
|
|
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 Planisphere_Plot;
|
|
w->init();
|
|
return w;
|
|
}
|