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.
nmWATI/Include/mData/mProjectManager/DataModels/ZxDataSketch.h

144 lines
2.9 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QSqlError>
#include "ZxDataObjectStrUser.h"
#include "mProjectManager_global.h"
// 图片,临时
// 20171026 示意图应用
class M_PROJECTMANAGER_EXPORT ZxDataSketch : public ZxDataObjectStrUser
{
ZX_DECLARE_DYNAMIC
public:
ZxDataSketch(ZxDataObject* parent = 0);
ZxDataSketch(const ZxDataSketch &other);
virtual ~ZxDataSketch();
ZxDataSketch &operator = (const ZxDataSketch &other);
bool operator == (const ZxDataSketch &other) const;
bool operator != (const ZxDataSketch &other) const;
public:
// 接口
virtual ZxDataObject* clone();
virtual QString type() const;
// 加载保存
virtual bool _parseData(VecVariant vec, int& n); //解析
virtual bool _sumUpData(VecVariant& vec);
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
// Icon
virtual QIcon getIcon(bool expanded) const;
// 自动组织加载和保存
// 先从当前工区如果没有则从系统db
bool loadSketch(QByteArray& o);
// 保存指定的db, nMode = 0:当前工区1系统配置
bool saveSketch(int nMode);
private:
// 由于示意图涉及到系统db和工区db所以特殊处理
// 根据当前的选项获取示意图
QByteArray _loadSketch(QSqlDatabase& db);
// 保存
bool _saveSketch(QSqlDatabase& db);
public:
// MstID
// virtual void setCode(const QString &sCode);
//ModelSeries
// virtual void setName(const QString &sName);
void setWBS(const QString& s);
QString getWBS() const;
void setWEL(const QString& s);
QString getWEL() const;
void setRES(const QString& s);
QString getRES() const;
void setBDY(const QString& s);
QString getBDY() const;
void setOthers(const QString& s);
QString getOthers() const;
void setSketch(const QByteArray& s);
QByteArray getSketch() const;
protected:
//MstID
//ModelSeries
QString m_sWBS;
QString m_sWEL;
QString m_sRES;
QString m_sBDY;
QString m_sOthers;
QByteArray m_arrSketch;
};
// 本类的目的通过单例实现对系统下面的示意图配置管理
// 主要为了速度
class M_PROJECTMANAGER_EXPORT ZxDataPictureHelper
{
public:
// 获取对象,单例模式
static ZxDataPictureHelper* getInstance();
// 关闭
static void closeSysDb();
// 获得数据库连接
QSqlDatabase getSysDb();
//
void reLoadSketches();
//
bool checkSketch(QString sSeries,
QString sWbs,
QString sWel,
QString sRes,
QString sBdy,
QByteArray& o);
private:
ZxDataPictureHelper();
~ZxDataPictureHelper();
private:
static ZxDataPictureHelper* spZxDbSys;
QSqlDatabase m_db;
VVecVariant m_vvecSketchs;
};