|
|
|
|
|
#ifndef NMDATARECTOUTLINE_H
|
|
|
|
|
|
#define NMDATARECTOUTLINE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmData_global.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <QColor>
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmDefines.h"
|
|
|
|
|
|
#include "nmDataAttribute.h"
|
|
|
|
|
|
#include "nmDataBase.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NM_DATA_EXPORT nmDataOutline : public nmDataBase {
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
nmDataOutline();
|
|
|
|
|
|
nmDataOutline(const nmDataOutline& other); // 拷贝构造函数
|
|
|
|
|
|
nmDataOutline& operator=(const nmDataOutline& other); // 赋值运算符
|
|
|
|
|
|
~nmDataOutline();
|
|
|
|
|
|
|
|
|
|
|
|
// 实现 nmDataBase 的抽象方法:将当前 C++ 对象序列化为 RapidJSON Value
|
|
|
|
|
|
virtual rapidjson::Value ToJsonValue(rapidjson::Document::AllocatorType& allocator) const override;
|
|
|
|
|
|
// 实现 nmDataBase 的抽象方法:从 RapidJSON Value 反序列化数据到当前 C++ 对象
|
|
|
|
|
|
virtual void FromJsonValue(const rapidjson::Value& jsonValue) override;
|
|
|
|
|
|
|
|
|
|
|
|
QString getName();
|
|
|
|
|
|
void setName(const QString& sName);
|
|
|
|
|
|
|
|
|
|
|
|
QVector<QPointF> getOutlinePoints();
|
|
|
|
|
|
void setOutlinePoints(const QVector<QPointF>& vecPts);
|
|
|
|
|
|
|
|
|
|
|
|
int getOutlinePointCount() const;
|
|
|
|
|
|
nmDataAttribute* getPointXAttribute(int nIndex) const;
|
|
|
|
|
|
nmDataAttribute* getPointYAttribute(int nIndex) const;
|
|
|
|
|
|
|
|
|
|
|
|
nmDataAttribute& getLeftAttribute();
|
|
|
|
|
|
nmDataAttribute& getRightAttribute();
|
|
|
|
|
|
nmDataAttribute& getTopAttribute();
|
|
|
|
|
|
nmDataAttribute& getBottomAttribute();
|
|
|
|
|
|
nmDataAttribute& getCenterXAttribute();
|
|
|
|
|
|
nmDataAttribute& getCenterYAttribute();
|
|
|
|
|
|
nmDataAttribute& getRadiusAttribute();
|
|
|
|
|
|
|
|
|
|
|
|
QVector<int> getFlowTypeList() const;
|
|
|
|
|
|
void setFlowTypeList(const QVector<int>& vecFlowTypeList);
|
|
|
|
|
|
|
|
|
|
|
|
NM_Data_Outline_Type getOutlineType() const;
|
|
|
|
|
|
void setOutlineType(NM_Data_Outline_Type eOutlineType);
|
|
|
|
|
|
|
|
|
|
|
|
QPointF getCenter() const;
|
|
|
|
|
|
void setCenter(const QPointF& ptCenter);
|
|
|
|
|
|
|
|
|
|
|
|
double getRadius() const;
|
|
|
|
|
|
void setRadius(double dRadius);
|
|
|
|
|
|
|
|
|
|
|
|
bool getPlotVisible() const;
|
|
|
|
|
|
void setPlotVisible(const bool newState);
|
|
|
|
|
|
|
|
|
|
|
|
// 视觉属性(画笔宽度、填充色、透明度)
|
|
|
|
|
|
double getPenWidth() const;
|
|
|
|
|
|
void setPenWidth(double dWidth);
|
|
|
|
|
|
QColor getBackgrdColor() const;
|
|
|
|
|
|
void setBackgrdColor(const QColor& clr);
|
|
|
|
|
|
int getBackgrdAlpha() const;
|
|
|
|
|
|
void setBackgrdAlpha(int nAlpha);
|
|
|
|
|
|
|
|
|
|
|
|
// 视觉属性是否有效(仅从已保存文件加载后为true,新建时为false)
|
|
|
|
|
|
bool hasVisualProps() const;
|
|
|
|
|
|
void setVisualPropsValid(bool bValid);
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
// 参数面板修改数据后,通知 Binder 刷新图元。
|
|
|
|
|
|
void sigOutlineDataChanged();
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void onGeometryAttributeChanged();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
void initGeometryAttributes();
|
|
|
|
|
|
void clearPointAttributes();
|
|
|
|
|
|
void syncGeometryAttributes();
|
|
|
|
|
|
void syncPointAttributes();
|
|
|
|
|
|
void syncRectAttributes();
|
|
|
|
|
|
void syncRoundAttributes();
|
|
|
|
|
|
void updateRectPointsFromAttributes();
|
|
|
|
|
|
void updateRoundPointsFromAttributes();
|
|
|
|
|
|
|
|
|
|
|
|
// m_vecPts 及固定几何量的面板绑定属性,不单独参与序列化。
|
|
|
|
|
|
QVector<nmDataAttribute*> m_vPointXAttributes;
|
|
|
|
|
|
QVector<nmDataAttribute*> m_vPointYAttributes;
|
|
|
|
|
|
nmDataAttribute m_left;
|
|
|
|
|
|
nmDataAttribute m_right;
|
|
|
|
|
|
nmDataAttribute m_top;
|
|
|
|
|
|
nmDataAttribute m_bottom;
|
|
|
|
|
|
nmDataAttribute m_centerX;
|
|
|
|
|
|
nmDataAttribute m_centerY;
|
|
|
|
|
|
nmDataAttribute m_radius;
|
|
|
|
|
|
// 防止“点集 -> 属性 -> 点集”递归同步。
|
|
|
|
|
|
bool m_bSyncingGeometryAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
QString m_sName;// 边界名称
|
|
|
|
|
|
QVector<QPointF> m_vecPts; // 边界点的数据;
|
|
|
|
|
|
QVector<int> m_vFlowTypeList; //边界压力类型
|
|
|
|
|
|
|
|
|
|
|
|
NM_Data_Outline_Type m_eOutlineType; // 边界类型
|
|
|
|
|
|
|
|
|
|
|
|
// 对于圆形边界,特殊处理
|
|
|
|
|
|
QPointF m_ptCenter; // 圆心
|
|
|
|
|
|
double m_dRadius; // 半径
|
|
|
|
|
|
|
|
|
|
|
|
bool m_bPlotVisible; // 图元是否可见
|
|
|
|
|
|
|
|
|
|
|
|
// 视觉属性
|
|
|
|
|
|
double m_dPenWidth; // 画笔宽度
|
|
|
|
|
|
QColor m_clrBackgrd; // 填充背景色
|
|
|
|
|
|
int m_nBackgrdAlpha; // 填充透明度 (0-255)
|
|
|
|
|
|
bool m_bHasVisualProps; // 视觉属性是否有效(从文件加载后为true)
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // NMDATARECTOUTLINE_H
|