You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
3.1 KiB
C
127 lines
3.1 KiB
C
|
4 years ago
|
#pragma once
|
||
|
|
|
||
|
|
#include "lp_defect_node.h"
|
||
|
|
|
||
|
|
#include <QWidget>
|
||
|
|
#include <QScrollArea>
|
||
|
|
#include <QGridLayout>
|
||
|
|
#include <QSharedPointer>
|
||
|
|
#include <QLabel>
|
||
|
|
#include <QMutex>
|
||
|
|
|
||
|
|
class lpRuler;
|
||
|
|
class lpDefectViewer;
|
||
|
|
class lpRefLine;
|
||
|
|
class lpDefectGlobalView;
|
||
|
|
|
||
|
|
class LP_QT_UTILS_EXPORT lpDefectMap : public QFrame
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
public:
|
||
|
|
lpDefectMap(int view_w, int view_h,
|
||
|
|
int ruler_breadth, bool enable_opengl, QWidget* parent = 0);
|
||
|
|
lpDefectMap(QWidget* parent = 0);
|
||
|
|
~lpDefectMap();
|
||
|
|
|
||
|
|
/*
|
||
|
|
* reset the view area with given width and height
|
||
|
|
*/
|
||
|
|
void reset(int view_w = 480, int view_h = 480);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* adjust view size to fit the widget
|
||
|
|
*/
|
||
|
|
void fitInWindow();
|
||
|
|
|
||
|
|
/*
|
||
|
|
* increase the view width/height.
|
||
|
|
* step must above 0
|
||
|
|
*/
|
||
|
|
void incViewWidth(int step);
|
||
|
|
void incViewHeight(int step);
|
||
|
|
|
||
|
|
const QSize viewSize() const {
|
||
|
|
return QSize(view_width_, view_height_);
|
||
|
|
};
|
||
|
|
|
||
|
|
/*
|
||
|
|
* add a new flaw node.
|
||
|
|
* if node has not uuid, this method will return an uuid generated inner
|
||
|
|
*/
|
||
|
|
QString addNode(const LP_DEFECT_NODE& node);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* set all nodes whether is visible for special type.
|
||
|
|
* @param type: user defined
|
||
|
|
*/
|
||
|
|
void showGroupNodes(int type, bool is_show);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* remove all nodes from view for special type.
|
||
|
|
* @param type: user defined
|
||
|
|
*/
|
||
|
|
void clearGroupNodes(int type);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* same as showGroupNodes and clearGroupNodes, but for single node
|
||
|
|
*/
|
||
|
|
void showNode(const QString& uuid, bool is_show);
|
||
|
|
void clearNode(const QString& uuid);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* remove all nodes from view
|
||
|
|
*/
|
||
|
|
void clearAllNodes();
|
||
|
|
|
||
|
|
/*
|
||
|
|
* set the ruler description.
|
||
|
|
* @param is_horz: true for horizontal ruler. false for vertical ruler.
|
||
|
|
*/
|
||
|
|
void setRulerDescription(const QString& description, bool is_horz);
|
||
|
|
|
||
|
|
/*
|
||
|
|
* set the ruler original point value
|
||
|
|
* @param is_horz: true for horizontal ruler. false for vertical ruler.
|
||
|
|
*/
|
||
|
|
void setRulerOriginValue(float ori_val, bool is_horz);
|
||
|
|
|
||
|
|
|
||
|
|
signals:
|
||
|
|
void sigScaled(qreal scale);
|
||
|
|
void sigNodeSelected(QSharedPointer<LP_DEFECT_NODE>);
|
||
|
|
void sigNodesVisiable(QList<QSharedPointer<LP_DEFECT_NODE>>);
|
||
|
|
void sigNodeCount(qint64 total, qint64 visible);
|
||
|
|
|
||
|
|
private:
|
||
|
|
void init();
|
||
|
|
Q_SLOT void onNodeSelected(QSharedPointer<LP_DEFECT_NODE> node_ptr);
|
||
|
|
Q_SLOT void onNodeUnselected();
|
||
|
|
Q_SLOT void onImgPosChanged(qreal x, qreal y);
|
||
|
|
|
||
|
|
|
||
|
|
QMutex mutex_;
|
||
|
|
bool is_inited_{ false };
|
||
|
|
|
||
|
|
QGridLayout *layout{ nullptr };
|
||
|
|
lpRuler *vert_ruler_ptr_{ nullptr };
|
||
|
|
lpRuler *horz_ruler_ptr_{ nullptr };
|
||
|
|
QLabel *empty_label_{ nullptr };
|
||
|
|
QScrollArea *scroll_area_ptr_{ nullptr };
|
||
|
|
lpDefectViewer* defect_viewer_ptr_{ nullptr };
|
||
|
|
|
||
|
|
QSharedPointer<lpRefLine> selected_ref_line_h_ptr_{ nullptr };
|
||
|
|
QSharedPointer<lpRefLine> selected_ref_line_v_ptr_{ nullptr };
|
||
|
|
|
||
|
|
QLabel *empty_label2_{ nullptr };
|
||
|
|
lpDefectGlobalView *global_viewer_ptr_{ nullptr };
|
||
|
|
|
||
|
|
|
||
|
|
bool is_node_selected_{ false };
|
||
|
|
void updateRefLine();
|
||
|
|
|
||
|
|
int view_width_{ 480 };
|
||
|
|
int view_height_{ 480 };
|
||
|
|
int ruler_breadth_{ 80 };
|
||
|
|
bool enable_opengl_{ false };
|
||
|
|
|
||
|
|
};
|