graphic refactoring
graphic buttons menu for save and export enable grid in config and save it in session remove traceX traceY
This commit is contained in:
@@ -167,9 +167,7 @@ public:
|
||||
};
|
||||
enum FloatingAxisType {
|
||||
Free,
|
||||
TraceXY,
|
||||
TraceX,
|
||||
TraceY
|
||||
Trace
|
||||
};
|
||||
Q_DECLARE_FLAGS(Buttons, Button)
|
||||
|
||||
@@ -222,7 +220,6 @@ public:
|
||||
bool LODOptimization() const { return m_LODOptimization; }
|
||||
bool isAutofitted() const { return isFit; }
|
||||
int currentGraphic() const { return curGraphic; }
|
||||
int currentTraceGraphic() const { return curTrace; }
|
||||
int graphicsCount() const { return graphics.size(); }
|
||||
Graphic::Buttons buttons() const { return buttons_; }
|
||||
Graphic::Alignment buttonsPosition() const { return align; }
|
||||
@@ -247,18 +244,13 @@ public:
|
||||
GraphicsData graphicsData() const;
|
||||
QByteArray graphicsDataRaw() const;
|
||||
QWidget * viewport() const { return canvas; }
|
||||
|
||||
QByteArray save();
|
||||
void load(QByteArray ba);
|
||||
|
||||
GraphicType graphic(int arg) {
|
||||
if (arg < 0 || arg >= graphics.size()) return GraphicType();
|
||||
return graphics[arg];
|
||||
}
|
||||
GraphicType graphic(int arg);
|
||||
const QVector<GraphicType> & allGraphics() const { return graphics; }
|
||||
void setAllGraphics(const QVector<GraphicType> & g, bool update = true) {
|
||||
graphics = g;
|
||||
if (update) updateLegend();
|
||||
}
|
||||
void setAllGraphics(const QVector<GraphicType> & g, bool update = true);
|
||||
|
||||
double canvas2realX(double px) const;
|
||||
double canvas2realY(double py) const;
|
||||
@@ -268,121 +260,50 @@ public:
|
||||
QPointF real2canvas(QPointF real_point) const { return QPointF(real2canvasX(real_point.x()), real2canvasY(real_point.y())); }
|
||||
QPolygonF real2canvas(const QPolygonF & real_polygon) const;
|
||||
QPolygonF canvas2real(const QPolygonF & canvas_polygon) const;
|
||||
double getScaleX() const { return real2canvasX(1.) - real2canvasX(0.); }
|
||||
double getScaleY() const { return real2canvasY(1.) - real2canvasY(0.); }
|
||||
double getScaleX() const;
|
||||
double getScaleY() const;
|
||||
QPointF getScale() const { return QPointF(getScaleX(), getScaleY()); }
|
||||
|
||||
public slots:
|
||||
void setCaption(const QString & str);
|
||||
void setLabelX(const QString & str) {
|
||||
label_x = str;
|
||||
hasLblX = (str.length() > 0);
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setLabelY(const QString & str) {
|
||||
label_y = str;
|
||||
hasLblY = (str.length() > 0);
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicName(const QString & str, int index) {
|
||||
graphics[index].name = str;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicName(const QString & str) {
|
||||
graphics[curGraphic].name = str;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setBackgroundColor(const QColor & color) {
|
||||
back_color = color;
|
||||
if (aupdate) update();
|
||||
updateLegend();
|
||||
}
|
||||
void setTextColor(const QColor & color) {
|
||||
text_color = color;
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicColor(const QColor & color, int index) {
|
||||
graphics[index].pen.setColor(color);
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicColor(const QColor & color) { setGraphicColor(color, curGraphic); }
|
||||
void setGridColor(const QColor & color) {
|
||||
grid_pen.setColor(color);
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setSelectionColor(const QColor & color) { selpen.setColor(color); }
|
||||
void setGraphicStyle(const Qt::PenStyle & style, int index) {
|
||||
graphics[index].pen.setStyle(style);
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicStyle(const Qt::PenStyle & style) { setGraphicStyle(style, curGraphic); }
|
||||
void setGridStyle(const Qt::PenStyle & style) {
|
||||
grid_pen.setStyle(style);
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setSelectionStyle(const Qt::PenStyle & style) { selpen.setStyle(style); }
|
||||
void setLabelX(const QString & str);
|
||||
void setLabelY(const QString & str);
|
||||
void setGraphicName(const QString & str, int index);
|
||||
void setGraphicName(const QString & str);
|
||||
void setBackgroundColor(const QColor & color);
|
||||
void setTextColor(const QColor & color);
|
||||
void setGraphicColor(const QColor & color, int index);
|
||||
void setGraphicColor(const QColor & color);
|
||||
void setGridColor(const QColor & color);
|
||||
void setSelectionColor(const QColor & color);
|
||||
void setGraphicStyle(const Qt::PenStyle & style, int index);
|
||||
void setGraphicStyle(const Qt::PenStyle & style);
|
||||
void setGridStyle(const Qt::PenStyle & style);
|
||||
void setSelectionStyle(const Qt::PenStyle & style);
|
||||
void setGraphicVisible(bool visible, int index);
|
||||
void setGraphicVisible(bool visible) { setGraphicVisible(visible, curGraphic); }
|
||||
void setGraphicLineWidth(double w, int index) {
|
||||
if (qRound(w) == w)
|
||||
graphics[index].pen.setWidth(qRound(w));
|
||||
else
|
||||
graphics[index].pen.setWidthF(w);
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicLineWidth(double w) { setGraphicLineWidth(w, curGraphic); }
|
||||
void setGraphicPointWidth(double w, int index) {
|
||||
graphics[index].pointWidth = w;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicPointWidth(double w) { setGraphicPointWidth(w, curGraphic); }
|
||||
void setGraphicFillColor(const QColor & w, int index) {
|
||||
graphics[index].fill_color = w;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicFillColor(const QColor & w) { setGraphicFillColor(w, curGraphic); }
|
||||
void setGraphicLinesEnabled(bool w, int index) {
|
||||
graphics[index].lines = w;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicLinesEnabled(bool w) { setGraphicLinesEnabled(w, curGraphic); }
|
||||
void setGraphicPointsEnabled(bool w, int index) {
|
||||
graphics[index].points = w;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicPointsEnabled(bool w) { setGraphicPointsEnabled(w, curGraphic); }
|
||||
void setGraphicFillEnabled(bool w, int index) {
|
||||
graphics[index].fill = w;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicFillEnabled(bool w) { setGraphicFillEnabled(w, curGraphic); }
|
||||
void setGraphicPen(const QPen & pen, int index) {
|
||||
graphics[index].pen = pen;
|
||||
updateLegend();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraphicPen(const QPen & pen) { setGraphicPen(pen, curGraphic); }
|
||||
void setGridPen(const QPen & pen) {
|
||||
grid_pen = pen;
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setSelectionPen(const QPen & pen) { selpen = pen; }
|
||||
void setSelectionBrush(const QBrush & brush) { selbrush = brush; }
|
||||
void setNavigationEnabled(bool on) { navigation = on; }
|
||||
void setLODOptimization(bool yes) { m_LODOptimization = yes; }
|
||||
void setGraphicVisible(bool visible);
|
||||
void setGraphicLineWidth(double w, int index);
|
||||
void setGraphicLineWidth(double w);
|
||||
void setGraphicPointWidth(double w, int index);
|
||||
void setGraphicPointWidth(double w);
|
||||
void setGraphicFillColor(const QColor & w, int index);
|
||||
void setGraphicFillColor(const QColor & w);
|
||||
void setGraphicLinesEnabled(bool w, int index);
|
||||
void setGraphicLinesEnabled(bool w);
|
||||
void setGraphicPointsEnabled(bool w, int index);
|
||||
void setGraphicPointsEnabled(bool w);
|
||||
void setGraphicFillEnabled(bool w, int index);
|
||||
void setGraphicFillEnabled(bool w);
|
||||
void setGraphicPen(const QPen & pen, int index);
|
||||
void setGraphicPen(const QPen & pen);
|
||||
void setGridPen(const QPen & pen);
|
||||
void setSelectionPen(const QPen & pen);
|
||||
void setSelectionBrush(const QBrush & brush);
|
||||
void setNavigationEnabled(bool on);
|
||||
void setLODOptimization(bool yes);
|
||||
void setOpenGL(bool on);
|
||||
void setAntialiasing(bool enabled);
|
||||
void setAutoUpdate(bool enabled) { aupdate = enabled; }
|
||||
void setAutoUpdate(bool enabled);
|
||||
void setGridEnabled(bool enabled);
|
||||
void setBorderInputsVisible(bool visible);
|
||||
void setStatusVisible(bool visible);
|
||||
@@ -392,107 +313,49 @@ public slots:
|
||||
void setButtonsPosition(Graphic::Alignment a);
|
||||
void setHistorySize(double val);
|
||||
void setMaxVisibleTime(double val);
|
||||
void setAutoXIncrement(double val) { inc_x = val; }
|
||||
void setLimit(const QRectF & val) { limit_ = val; }
|
||||
void setMargins(const QRect & val) {
|
||||
margins_ = val;
|
||||
update();
|
||||
}
|
||||
void setMargins(int left_, int right_, int top_, int bottom_) { setMargins(QRect(left_, bottom_, right_, top_)); }
|
||||
void setLeftMargin(int value) {
|
||||
margins_.moveLeft(value);
|
||||
setMargins(margins_);
|
||||
}
|
||||
void setRightMargin(int value) {
|
||||
margins_.setWidth(value);
|
||||
setMargins(margins_);
|
||||
}
|
||||
void setTopMargin(int value) {
|
||||
margins_.setHeight(value);
|
||||
setMargins(margins_);
|
||||
}
|
||||
void setBottomMargin(int value) {
|
||||
margins_.moveTop(value);
|
||||
setMargins(margins_);
|
||||
}
|
||||
void setMinimumRepaintInterval(const int & val) { min_repaint_int = val; }
|
||||
void setAutoXIncrement(double val);
|
||||
void setLimit(const QRectF & val);
|
||||
void setMargins(const QRect & val);
|
||||
void setMargins(int left_, int right_, int top_, int bottom_);
|
||||
void setLeftMargin(int value);
|
||||
void setRightMargin(int value);
|
||||
void setTopMargin(int value);
|
||||
void setBottomMargin(int value);
|
||||
void setMinimumRepaintInterval(const int & val);
|
||||
void setOnlyExpandY(bool yes);
|
||||
void setOnlyExpandX(bool yes);
|
||||
void setGesturesNavigation(bool yes);
|
||||
void setGraphicsData(const GraphicsData & gd);
|
||||
void setGraphicsDataRaw(const QByteArray & ba);
|
||||
|
||||
void setGridNumbersMultiplierX(double value) {
|
||||
grid_numbers_x = value;
|
||||
updateGraphics();
|
||||
}
|
||||
void setGridNumbersMultiplierY(double value) {
|
||||
grid_numbers_y = value;
|
||||
updateGraphics();
|
||||
}
|
||||
void setGraduationX(Graduation value) {
|
||||
grad_x = value;
|
||||
if (aupdate) update();
|
||||
;
|
||||
}
|
||||
void setGraduationY(Graduation value) {
|
||||
grad_y = value;
|
||||
if (aupdate) update();
|
||||
;
|
||||
}
|
||||
void setGraduationStepX(double sx) {
|
||||
gridx = sx;
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraduationStepY(double sy) {
|
||||
gridy = sy;
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGraduationSteps(double sx, double sy) {
|
||||
gridx = sx;
|
||||
gridy = sy;
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setAxisType(AxisType t) {
|
||||
axis_type_x = t;
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setFloatingAxisType(FloatingAxisType t) {
|
||||
floating_axis_type = t;
|
||||
setGuidesCursor();
|
||||
if (aupdate) update();
|
||||
}
|
||||
void setGridNumbersMultiplierX(double value);
|
||||
void setGridNumbersMultiplierY(double value);
|
||||
void setGraduationX(Graduation value);
|
||||
void setGraduationY(Graduation value);
|
||||
void setGraduationStepX(double sx);
|
||||
void setGraduationStepY(double sy);
|
||||
void setGraduationSteps(double sx, double sy);
|
||||
void setAxisType(AxisType t);
|
||||
void setFloatingAxisType(FloatingAxisType t);
|
||||
void setFloatingAxisEnabled(bool on);
|
||||
|
||||
void addPoint(const QPointF & p, int graphic, bool update_ = true);
|
||||
void addPoint(const QPointF & p, bool update = true) { addPoint(p, curGraphic, update); }
|
||||
void addPoint(double x, double y, int graphic, bool update = true) { addPoint(QPointF(x, y), graphic, update); }
|
||||
void addPoint(double x, double y, bool update = true) { addPoint(QPointF(x, y), update); }
|
||||
void addPoint(double y, int graphic, bool update = true) {
|
||||
if (graphics[graphic].polyline.isEmpty())
|
||||
addPoint(QPointF(0.0, y), graphic, update);
|
||||
else
|
||||
addPoint(QPointF(graphics[graphic].max_x + inc_x, y), graphic, update);
|
||||
}
|
||||
void addPoint(double y, bool update = true) {
|
||||
if (graphics[curGraphic].polyline.isEmpty())
|
||||
addPoint(QPointF(0.0, y), update);
|
||||
else
|
||||
addPoint(QPointF(graphics[curGraphic].max_x + inc_x, y), update);
|
||||
}
|
||||
void addPoint(const QPointF & p, bool update = true);
|
||||
void addPoint(double x, double y, int graphic, bool update = true);
|
||||
void addPoint(double x, double y, bool update = true);
|
||||
void addPoint(double y, int graphic, bool update = true);
|
||||
void addPoint(double y, bool update = true);
|
||||
void addPoints(const QPolygonF & pts, int graphic, bool update_ = true);
|
||||
void addPoints(const QPolygonF & pts, bool update = true) { addPoints(pts, curGraphic, update); }
|
||||
void addPoints(const QPolygonF & pts, bool update = true);
|
||||
void addPoints(const QVector<double> & pts, int graphic, bool update_ = true);
|
||||
void addPoints(const QVector<double> & pts, bool update = true) { addPoints(pts, curGraphic, update); }
|
||||
void addPoints(const QVector<double> & pts, bool update = true);
|
||||
void setGraphicData(const QVector<QPointF> & g, int graphic, bool update_ = true);
|
||||
void setGraphicData(const QVector<QPointF> & g) { setGraphicData(g, curGraphic); }
|
||||
void setGraphicData(const QVector<QPointF> & g);
|
||||
void setGraphicProperties(const QString & name,
|
||||
const QColor & color = Qt::darkRed,
|
||||
Qt::PenStyle style = Qt::SolidLine,
|
||||
double width = 0.,
|
||||
bool visible = true) {
|
||||
setGraphicProperties(curGraphic, name, color, style, width, visible);
|
||||
}
|
||||
bool visible = true);
|
||||
void setGraphicProperties(int graphic,
|
||||
const QString & name,
|
||||
const QColor & color = Qt::darkRed,
|
||||
@@ -504,30 +367,16 @@ public slots:
|
||||
Qt::PenStyle style = Qt::SolidLine,
|
||||
double width = 0.,
|
||||
bool visible = true);
|
||||
void addGraphic(const GraphicType & gd, bool update = true) {
|
||||
graphics << gd;
|
||||
if (update) updateLegend();
|
||||
}
|
||||
void addGraphic(const GraphicType & gd);
|
||||
void setVisualRect(const QRectF & rect);
|
||||
void setDefaultRect(const QRectF & rect);
|
||||
void autofit() { on_graphic_buttonAutofit_clicked(); }
|
||||
void autofit();
|
||||
void saveImage(QString filename);
|
||||
void exportGraphics(QString filename, QChar decimal_point);
|
||||
void clear();
|
||||
void update(bool force);
|
||||
void update() { update(false); }
|
||||
void updateGraphics() {
|
||||
findGraphicsRect();
|
||||
update();
|
||||
}
|
||||
void setCurrentGraphic(int arg) {
|
||||
if (arg < 0 || arg >= graphics.size()) return;
|
||||
curGraphic = arg;
|
||||
}
|
||||
void setTraceGraphic(int arg) {
|
||||
if (arg < 0 || arg >= graphics.size()) return;
|
||||
curTrace = arg;
|
||||
}
|
||||
void update();
|
||||
void updateGraphics();
|
||||
void setCurrentGraphic(int arg);
|
||||
void setGraphicsCount(int arg, bool update = true);
|
||||
void removeGraphic(int arg, bool update = true);
|
||||
void setCustomGridMarkFuncs(std::function<QString(double val)> fx, std::function<QString(double val)> fy);
|
||||
@@ -560,11 +409,7 @@ protected:
|
||||
void findGraphicsRect(double start_x = 0., double end_x = 0., double start_y = 0., double end_y = 0.);
|
||||
void tick(int index, bool slide = true, bool update = true);
|
||||
void calcLOD(int index);
|
||||
void repaintCanvas(bool force = false) {
|
||||
if (tm.elapsed() < min_repaint_int && !force) return;
|
||||
tm.restart();
|
||||
canvas->update();
|
||||
}
|
||||
void repaintCanvas(bool force = false);
|
||||
void drawGraphics();
|
||||
void drawGrid();
|
||||
void drawGuides();
|
||||
@@ -597,7 +442,7 @@ protected:
|
||||
QPen grid_pen, selpen;
|
||||
QColor back_color, text_color;
|
||||
QVector<GraphicType> graphics;
|
||||
int curGraphic, curTrace;
|
||||
int curGraphic;
|
||||
GraphicAction curaction, prevaction;
|
||||
QRectF grect, selrect, limit_, def_rect;
|
||||
QRect margins_;
|
||||
@@ -642,43 +487,24 @@ protected slots:
|
||||
void canvasKeyPressEvent(QKeyEvent *);
|
||||
void graphicVisibleChange(bool checked);
|
||||
void graphicAllVisibleChange(bool checked);
|
||||
void lineXMinChanged(double value) {
|
||||
selrect.setLeft(value);
|
||||
checkLines();
|
||||
}
|
||||
void lineXMaxChanged(double value) {
|
||||
selrect.setRight(value);
|
||||
checkLines();
|
||||
}
|
||||
void lineYMinChanged(double value) {
|
||||
selrect.setBottom(value);
|
||||
checkLines();
|
||||
}
|
||||
void lineYMaxChanged(double value) {
|
||||
selrect.setTop(value);
|
||||
checkLines();
|
||||
}
|
||||
void on_graphic_buttonClose_clicked() { emit closeRequest(this); }
|
||||
void on_graphic_buttonClear_clicked() {
|
||||
clear();
|
||||
emit cleared();
|
||||
}
|
||||
void lineXMinChanged(double value);
|
||||
void lineXMaxChanged(double value);
|
||||
void lineYMinChanged(double value);
|
||||
void lineYMaxChanged(double value);
|
||||
void on_graphic_buttonClose_clicked();
|
||||
void on_graphic_buttonClear_clicked();
|
||||
void on_graphic_buttonAutofit_clicked();
|
||||
void on_graphic_buttonConfigure_clicked();
|
||||
void on_graphic_buttonFullscreen_clicked() { fullscreen(); }
|
||||
void on_graphic_buttonSave_clicked();
|
||||
void on_graphic_buttonExport_clicked();
|
||||
void on_graphic_buttonFullscreen_clicked();
|
||||
void on_graphic_actionSaveImage_triggered();
|
||||
void on_graphic_actionExportCSV_triggered();
|
||||
void on_graphic_buttonRecord_clicked(bool checked);
|
||||
void on_graphic_checkGrid_toggled(bool checked) {
|
||||
grid = checked;
|
||||
update();
|
||||
}
|
||||
void on_graphic_checkGuides_toggled(bool checked);
|
||||
void on_graphic_actionExpandX_triggered(bool checked);
|
||||
void on_graphic_actionExpandY_triggered(bool checked);
|
||||
void on_graphic_checkBorderInputs_toggled(bool checked) { setBorderInputsVisible(checked); }
|
||||
void on_graphic_checkLegend_toggled(bool checked) { setLegendVisible(checked); }
|
||||
void on_graphic_checkPause_toggled(bool checked) { setPaused(checked); }
|
||||
void on_graphic_checkBorderInputs_toggled(bool checked);
|
||||
void on_graphic_checkLegend_toggled(bool checked);
|
||||
void on_graphic_checkPause_toggled(bool checked);
|
||||
void actionGuidesTriggered(QAction * a);
|
||||
void enterFullscreen();
|
||||
void leaveFullscreen();
|
||||
|
||||
Reference in New Issue
Block a user