Commit fb7f3be1 authored by 刘乐's avatar 刘乐

1, 水质分析

parent 7807280c
...@@ -10,40 +10,28 @@ void CivNode::addItem(NodeTable table) ...@@ -10,40 +10,28 @@ void CivNode::addItem(NodeTable table)
mTables.push_back(table); mTables.push_back(table);
} }
void CivNode::addItems(std::list<NodeTable> tables)
{
// mTables.merge(tables);
}
void CivPipe::addItem(PipesTable table) void CivPipe::addItem(PipesTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivPipe::addItems(std::list<PipesTable> tables)
{
//mTables.merge(tables);
}
void CivTank::addItem(TankTable table) void CivTank::addItem(TankTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivTank::addItems(std::list<TankTable> tables)
{
//mTables.merge(tables);
}
void CivValve::addItem(ValveTable table) void CivValve::addItem(ValveTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivValve::addItems(std::list<ValveTable> tables)
{
//mTables.merge(tables);
}
void CivPumps::addItem(PumpTable table) void CivPumps::addItem(PumpTable table)
...@@ -51,138 +39,81 @@ void CivPumps::addItem(PumpTable table) ...@@ -51,138 +39,81 @@ void CivPumps::addItem(PumpTable table)
mTables.push_back(table); mTables.push_back(table);
} }
void CivPumps::addItems(std::list<PumpTable> tables)
{
//mTables.merge(tables);
}
void CivReservoirs::addItem(ReservoirsTable table) void CivReservoirs::addItem(ReservoirsTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivReservoirs::addItems(std::list<ReservoirsTable> tables)
{
//mTables.merge(tables);
}
void CivEmitters::addItem(EmittersTable table) void CivEmitters::addItem(EmittersTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivEmitters::addItems(std::list<EmittersTable> tables)
{
//mTables.merge(tables);
}
void CivCoordinates::addItem(CoordTable table) void CivCoordinates::addItem(CoordTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivCoordinates::addItems(std::list<CoordTable> tables)
{
//mTables.merge(tables);
}
void CivMixing::addItem(MixingTable table) void CivMixing::addItem(MixingTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivMixing::addItems(std::list<MixingTable> tables)
{
//mTables.merge(tables);
}
void CivParameter::addItem(ParamTable table) void CivParameter::addItem(ParamTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivParameter::addItems(std::list<ParamTable> tables)
{
//mTables.merge(tables);
}
void CivPatterns::addItem(PatternTable table) void CivPatterns::addItem(PatternTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivPatterns::addItems(std::list<PatternTable> tables)
{
//mTables.merge(tables);
}
void CivCurves::addItem(CurvesTable table) void CivCurves::addItem(CurvesTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivCurves::addItems(std::list<CurvesTable> tables)
{
//mTables.merge(tables);
}
void CivDemands::addItem(DemandsTable table) void CivDemands::addItem(DemandsTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivDemands::addItems(std::list<DemandsTable> tables)
{
//mTables.merge(tables);
}
void CivSources::addItem(CurvesTable table) void CivSources::addItem(CurvesTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivSources::addItems(std::list<CurvesTable> tables)
{
//mTables.merge(tables);
}
void CivStatus::addItem(StatusTable table) void CivStatus::addItem(StatusTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivStatus::addItems(std::list<StatusTable> tables)
{
//mTables.merge(tables);
}
void CivQuality::addItem(QualityTable table) void CivQuality::addItem(QualityTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivQuality::addItems(std::list<QualityTable> tables)
{
//mTables.merge(tables);
}
void CivLabels::addItem(LabelTable table) void CivLabels::addItem(LabelTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
} }
void CivLabels::addItems(std::list<LabelTable> tables)
{
//mTables.merge(tables);
}
void CivTags::addItem(TagsTable table) void CivTags::addItem(TagsTable table)
{ {
mTables.push_back(table); mTables.push_back(table);
}
void CivTags::addItems(std::list<TagsTable> tables)
{
//mTables.merge(tables);
} }
\ No newline at end of file
...@@ -20,8 +20,6 @@ class CivTags; ...@@ -20,8 +20,6 @@ class CivTags;
*/ */
class CivAssembly class CivAssembly
{ {
public:
virtual Str toString();
}; };
/** /**
...@@ -39,8 +37,16 @@ public: ...@@ -39,8 +37,16 @@ public:
Str PatternId; Str PatternId;
} NodeTable; } NodeTable;
// 定义字段中文映射
typedef struct TableField
{
Str ID;
Str Elev;
Str Demand;
Str PatternId;
}NodeTableField;
void addItem(NodeTable table); void addItem(NodeTable table);
void addItems(std::list<NodeTable> tables);
std::list<NodeTable> mTables; std::list<NodeTable> mTables;
}; };
...@@ -65,8 +71,6 @@ public: ...@@ -65,8 +71,6 @@ public:
} PipesTable; } PipesTable;
void addItem(PipesTable table); void addItem(PipesTable table);
void addItems(std::list<PipesTable> tables);
std::list<PipesTable> mTables; std::list<PipesTable> mTables;
}; };
...@@ -91,8 +95,6 @@ public: ...@@ -91,8 +95,6 @@ public:
} TankTable; } TankTable;
void addItem(TankTable table); void addItem(TankTable table);
void addItems(std::list<TankTable> tables);
std::list<TankTable> mTables; std::list<TankTable> mTables;
}; };
...@@ -123,8 +125,6 @@ public: ...@@ -123,8 +125,6 @@ public:
} ValveTable; } ValveTable;
void addItem(ValveTable table); void addItem(ValveTable table);
void addItems(std::list<ValveTable> tables);
std::list<ValveTable> mTables; std::list<ValveTable> mTables;
}; };
...@@ -144,8 +144,6 @@ public: ...@@ -144,8 +144,6 @@ public:
} PumpTable; } PumpTable;
void addItem(PumpTable table); void addItem(PumpTable table);
void addItems(std::list<PumpTable> tables);
std::list<PumpTable> mTables; std::list<PumpTable> mTables;
}; };
...@@ -168,7 +166,6 @@ public: ...@@ -168,7 +166,6 @@ public:
} ReservoirsTable; } ReservoirsTable;
void addItem(ReservoirsTable table); void addItem(ReservoirsTable table);
void addItems(std::list<ReservoirsTable> tables);
std::list<ReservoirsTable> mTables; std::list<ReservoirsTable> mTables;
}; };
...@@ -190,7 +187,6 @@ public: ...@@ -190,7 +187,6 @@ public:
} EmittersTable; } EmittersTable;
void addItem(EmittersTable table); void addItem(EmittersTable table);
void addItems(std::list<EmittersTable> tables);
std::list<EmittersTable> mTables; std::list<EmittersTable> mTables;
}; };
...@@ -209,8 +205,6 @@ public: ...@@ -209,8 +205,6 @@ public:
} CoordTable; } CoordTable;
void addItem(CoordTable table); void addItem(CoordTable table);
void addItems(std::list<CoordTable> tables);
std::list<CoordTable> mTables; std::list<CoordTable> mTables;
}; };
...@@ -233,8 +227,6 @@ public: ...@@ -233,8 +227,6 @@ public:
} MixingTable; } MixingTable;
void addItem(MixingTable table); void addItem(MixingTable table);
void addItems(std::list<MixingTable> tables);
std::list<MixingTable> mTables; std::list<MixingTable> mTables;
}; };
...@@ -258,8 +250,6 @@ public: ...@@ -258,8 +250,6 @@ public:
} ParamTable; } ParamTable;
void addItem(ParamTable table); void addItem(ParamTable table);
void addItems(std::list<ParamTable> tables);
void setType(const std::string& type) { mType = type; } void setType(const std::string& type) { mType = type; }
std::string mType; std::string mType;
...@@ -279,8 +269,6 @@ public: ...@@ -279,8 +269,6 @@ public:
} PatternTable; } PatternTable;
void addItem(PatternTable table); void addItem(PatternTable table);
void addItems(std::list<PatternTable> tables);
std::list<PatternTable> mTables; std::list<PatternTable> mTables;
}; };
...@@ -298,8 +286,6 @@ public: ...@@ -298,8 +286,6 @@ public:
} CurvesTable; } CurvesTable;
void addItem(CurvesTable table); void addItem(CurvesTable table);
void addItems(std::list<CurvesTable> tables);
std::list<CurvesTable> mTables; std::list<CurvesTable> mTables;
}; };
...@@ -324,8 +310,6 @@ public: ...@@ -324,8 +310,6 @@ public:
} DemandsTable; } DemandsTable;
void addItem(DemandsTable table); void addItem(DemandsTable table);
void addItems(std::list<DemandsTable> tables);
std::list<DemandsTable> mTables; std::list<DemandsTable> mTables;
}; };
...@@ -348,8 +332,6 @@ public: ...@@ -348,8 +332,6 @@ public:
} CurvesTable; } CurvesTable;
void addItem(CurvesTable table); void addItem(CurvesTable table);
void addItems(std::list<CurvesTable> tables);
std::list<CurvesTable> mTables; std::list<CurvesTable> mTables;
}; };
...@@ -368,8 +350,6 @@ public: ...@@ -368,8 +350,6 @@ public:
} StatusTable; } StatusTable;
void addItem(StatusTable table); void addItem(StatusTable table);
void addItems(std::list<StatusTable> tables);
std::list<StatusTable> mTables; std::list<StatusTable> mTables;
}; };
...@@ -388,8 +368,6 @@ public: ...@@ -388,8 +368,6 @@ public:
} QualityTable; } QualityTable;
void addItem(QualityTable table); void addItem(QualityTable table);
void addItems(std::list<QualityTable> tables);
std::list<QualityTable> mTables; std::list<QualityTable> mTables;
}; };
...@@ -412,7 +390,6 @@ public: ...@@ -412,7 +390,6 @@ public:
} LabelTable; } LabelTable;
void addItem(LabelTable table); void addItem(LabelTable table);
void addItems(std::list<LabelTable> tables);
std::list<LabelTable> mTables; std::list<LabelTable> mTables;
}; };
...@@ -434,8 +411,6 @@ public: ...@@ -434,8 +411,6 @@ public:
} TagsTable; } TagsTable;
void addItem(TagsTable table); void addItem(TagsTable table);
void addItems(std::list<TagsTable> tables);
std::list<TagsTable> mTables; std::list<TagsTable> mTables;
}; };
......
#include "CivBuilder.h" #include "CivBuilder.h"
#include "CivTypes.h" #include "CivTypes.h"
CivBuilder::CivBuilder()
{
}
CivBuilder::~CivBuilder()
{
}
CivNewInp* CivBuilder::getNewInp()
{
return mNewInp;
}
CivInpBuilder::CivInpBuilder() CivInpBuilder::CivInpBuilder()
:mDbConn(nullptr) :mDbConn(nullptr)
{ {
mNewInp = new CivNewInp();
} }
CivInpBuilder::CivInpBuilder(CivDbConn* dbConn) CivInpBuilder::CivInpBuilder(CivDbConn* dbConn)
:mDbConn(dbConn) :mDbConn(dbConn)
{ {
mNewInp = new CivNewInp();
} }
CivInpBuilder::~CivInpBuilder() CivInpBuilder::~CivInpBuilder()
...@@ -426,7 +442,6 @@ CivNewInp* CivInpBuilder::getNewInp() ...@@ -426,7 +442,6 @@ CivNewInp* CivInpBuilder::getNewInp()
} }
void CivInpBuilder::buildPatterns() void CivInpBuilder::buildPatterns()
{ {
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
class CivBuilder class CivBuilder
{ {
public: public:
CivBuilder();
~CivBuilder();
virtual void buildNode() = 0; virtual void buildNode() = 0;
virtual void buildPipe() = 0; virtual void buildPipe() = 0;
virtual void buildTank() = 0; virtual void buildTank() = 0;
...@@ -33,7 +36,11 @@ public: ...@@ -33,7 +36,11 @@ public:
virtual void buildRules() = 0; virtual void buildRules() = 0;
virtual void buildDemands() = 0; virtual void buildDemands() = 0;
virtual CivNewInp* getNewInp() = 0; virtual CivNewInp* getNewInp();
protected:
CivNewInp* mNewInp;
}; };
...@@ -43,8 +50,8 @@ public: ...@@ -43,8 +50,8 @@ public:
class CivInpBuilder:public CivBuilder class CivInpBuilder:public CivBuilder
{ {
public: public:
CivInpBuilder(); explicit CivInpBuilder();
CivInpBuilder(CivDbConn* dbConn); explicit CivInpBuilder(CivDbConn* dbConn);
~CivInpBuilder(); ~CivInpBuilder();
// 注册数据库连接 // 注册数据库连接
......
#include "CivInpDirector.h" #include "CivInpDirector.h"
#include "CivBuilder.h" #include "CivBuilder.h"
void CivInpDirector::create(CivBuilder* builder)
void CivInpDirector::setBuilder(CivBuilder* builder)
{ {
builder->buildNode(); mBuilder = builder;
builder->buildPipe(); }
builder->buildTank();
builder->buildReservoir(); void CivInpDirector::create()
builder->buildPump(); {
builder->buildVavle(); if (mBuilder == NULL)
builder->buildEmitter(); return;
builder->buildPatterns();
builder->buildParamter(); mBuilder->buildNode();
builder->buildCoordnates(); mBuilder->buildPipe();
builder->buildVertices(); mBuilder->buildTank();
builder->buildLabels(); mBuilder->buildReservoir();
builder->buildTags(); mBuilder->buildPump();
builder->buildBackDrop(); mBuilder->buildVavle();
builder->buildQuality(); mBuilder->buildEmitter();
builder->buildSources(); mBuilder->buildPatterns();
builder->buildMixing(); mBuilder->buildParamter();
builder->buildCurves(); mBuilder->buildCoordnates();
builder->buildStatus(); mBuilder->buildVertices();
builder->buildControls(); mBuilder->buildLabels();
builder->buildRules(); mBuilder->buildTags();
builder->buildDemands(); mBuilder->buildBackDrop();
mBuilder->buildQuality();
mBuilder->buildSources();
mBuilder->buildMixing();
mBuilder->buildCurves();
mBuilder->buildStatus();
mBuilder->buildControls();
mBuilder->buildRules();
mBuilder->buildDemands();
} }
\ No newline at end of file
...@@ -7,7 +7,11 @@ class CivBuilder; ...@@ -7,7 +7,11 @@ class CivBuilder;
class CivInpDirector class CivInpDirector
{ {
public: public:
void create(CivBuilder* builder); void setBuilder(CivBuilder* builder);
void create();
private:
CivBuilder* mBuilder;
}; };
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "CivTableTemp.h" #include "CivTableTemp.h"
#define DBEXPORT __declspec(dllexport) #define DBEXPORT __declspec(dllexport)
/** /**
数据库连接接口 数据库连接接口
*/ */
...@@ -42,6 +43,8 @@ public: ...@@ -42,6 +43,8 @@ public:
*/ */
bool createTable(StrQuote tableName, StrQuote schema, CivTableTemp::TableType tableType); bool createTable(StrQuote tableName, StrQuote schema, CivTableTemp::TableType tableType);
private:
/** /**
*@brief 获取管网组件数据:管线,节点,水源等(必须组件) *@brief 获取管网组件数据:管线,节点,水源等(必须组件)
*@tableName: 组件表 *@tableName: 组件表
...@@ -90,7 +93,7 @@ public: ...@@ -90,7 +93,7 @@ public:
bool isValid() const; bool isValid() const;
private:
/** /**
*@brief 根据code值寻数据 *@brief 根据code值寻数据
*@table: 线表 *@table: 线表
......
...@@ -30,6 +30,11 @@ void CivTableTemp::addPropertys(FiledPropertys props) ...@@ -30,6 +30,11 @@ void CivTableTemp::addPropertys(FiledPropertys props)
mPropertys.insert(mPropertys.end(), props.begin(), props.end()); mPropertys.insert(mPropertys.end(), props.begin(), props.end());
} }
Str CivTableTemp::name()
{
return mTableName;
}
Str CivTableTemp::createSql() Str CivTableTemp::createSql()
{ {
switch (mTableType) switch (mTableType)
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
FILED_DATE FILED_DATE
}; };
explicit CivTableTemp(Str tableName, TableType tableType); explicit CivTableTemp(Str tableName);
~CivTableTemp(); ~CivTableTemp();
...@@ -54,22 +54,245 @@ public: ...@@ -54,22 +54,245 @@ public:
*@fileName:字段名 *@fileName:字段名
*@filedType:字段类型 *@filedType:字段类型
*/ */
void addProperty(std::string fileName, FieldType filedType); virtual void addProperty(std::string fileName, FieldType filedType);
// 添加批量属性字段 // 添加批量属性字段
void addPropertys(FiledPropertys props); void addPropertys(FiledPropertys props);
// 返回创建表的sql语句 // 返回创建表的sql语句
Str createSql(); Str createSql();
/*
private: * @brief 表名
Str mTableName; // 表明 */
TableType mTableType; // 表类型 Str name();
protected:
Str mTableName; // 表名
FiledPropertys mPropertys; // 字段和字段属性 FiledPropertys mPropertys; // 字段和字段属性
std::map< FieldType, Str> mFieldTyepMap; std::map< FieldType, Str> mFieldTyepMap;
}; };
/**
节点表模板
*/
class CivJunctionTableTemp :public CivTableTemp
{
public:
// 字段名
typedef struct TableFileds
{
Str ID = "id";
Str geom = "geom";
Str thePoint = "本点号";
Str xCoord = "横坐标";
Str yCoord = "纵坐标";
Str elev = "高程";
Str demand = "需水量";
Str pattern = "需水量模式";
Str head = "总水头";
Str freeHead = "自由水头";
Str actualDemand = "实际需水量";
Str code = "code";
Str createUser = "create_user";
Str modifyUser = "modify_user";
Str createTime = "create_time";
Str modifyTime = "modify_time";
Str symbolAngle = "symbol_angle";
Str compType = "组分类型";
Str pressure = "压力";
Str quality = "水质";
};
CivJunctionTableTemp(Str tableName);
};
/**
管线表模板
*/
class CivPipeTableTemp :public CivTableTemp
{
public:
// 字段名
typedef struct TableFileds
{
Str ID = "id";
Str geom = "geom";
Str snNo = "编号";
Str thePoint = "上点号";
Str lastPoint = "本点号";
Str length = "管长";
Str material = "管材";
Str diameter = "管径";
Str friction = "摩阻系数";
Str localLoss = "局部损失系";
Str initStatus = "初始状态";
Str buryingTime = "埋设时间";
Str flow = "流量";
Str velocity = "流速";
Str unitHeadLoss = "单位水头损";
Str headLoss = "水头总损失";
Str unitPressLoss = "单位压力损";
Str pressLoss = "压力总损失";
Str lastHead = "上点水头";
Str theHead = "本点水头";
Str lastPress = "上点压力";
Str thePress = "本点压力";
Str localHeadLoss = "局部水头损";
Str fracHeadLoss = "摩擦水头损";
Str status = "状态";
Str guid = "guid";
Str code = "code";
Str fromCode = "from_code";
Str fromLayer = "from_layer";
Str toCode = "to_code";
Str toLayer = "to_layer";
Str createUser = "create_user";
Str modifyUser = "modify_user";
Str createTime = "create_time";
Str modifyTime = "modify_time";
Str remarks = "备注";
Str quality = "水质";
};
CivPipeTableTemp();
};
/**
水泵
*/
class CivPumpTableTemp :public CivTableTemp
{
public:
typedef struct TableFiled
{
Str ID = "id";
Str geom = "geom";
Str thePoint = "本点号";
Str xCoord = "横坐标";
Str yCoord = "纵坐标";
Str startPoint = "起始节点";
Str endPoint = "终止节点";
Str ID = "下游管段";
Str ID = "高程";
Str ID = "水泵状态";
Str ID = "水泵曲线";
Str ID = "转速比";
Str ID = "流量";
Str ID = "入口水头";
Str ID = "出口水头";
Str pattern = "扬程曲线";
Str status = "状态";
Str code = "code";
Str createUser = "create_user";
Str modifyUser = "modify_user";
Str createTime = "create_time";
Str modifyTime = "modify_time";
Str SymbolAngle = "symbol_angle";
Str compType = "组分类型";
Str ID = "功率";
};
CivPumpTableTemp();
};
/**
水池
*/
class CivTankTableTemp :public CivTableTemp
{
public:
typedef struct TableField
{
Str ID = "id";
Str geom = "geom";
Str thePoint = "本点号";
Str xCoord = "横坐标";
Str yCoord = "纵坐标";
Str elev = "高程";
Str diametor = "直径";
Str baseLevel = "基础水位";
Str initLevel= "初始水位";
Str highLevel = "最高水位";
Str lowLevel = "最低水位";
Str flowIn = "输入流量";
Str flowOut = "输出流量";
Str leveHeight = "液位高度";
Str capacity = "容量";
Str percentage = "装满水池百";
Str status = "状态";
Str code = "code";
Str createUser = "create_user";
Str modifyUser = "modify_user";
Str createTime = "create_time";
Str modifyTime = "modify_time";
Str SymbolAngle = "symbol_angle";
Str compType = "组分类型";
};
CivTankTableTemp();
};
/**
水库
*/
class CivResourcesTableTemp :public CivTableTemp
{
public:
typedef struct TableField
{
Str ID = "id";
Str geom = "geom";
Str thePoint = "本点号";
Str xCoord = "横坐标";
Str yCoord = "纵坐标";
Str headPattern = "水头模式曲";
Str elev = "高程";
Str head = "水头";
Str flow = "流出流量";
Str code = "code";
Str createUser = "create_user";
Str modifyUser = "modify_user";
Str createTime = "create_time";
Str modifyTime = "modify_time";
Str SymbolAngle = "symbol_angle";
Str compType = "组分类型";
};
CivResourcesTableTemp();
};
/**
阀门
*/
class CivValveTableTemp :public CivTableTemp
{
public:
typedef struct TableField
{
Str id = "本点号";
Str geom = "geom";
Str xCoord = "横坐标";
Str yCoord = "纵坐标";
Str startPoint = "起始节点";
Str endPoint = "终止节点";
Str diameter = "直径";
Str status = "状态";
Str type = "阀门类型";
Str setting = "阀门设置";
Str loss = "损失系数";
Str flow = "流量 ";
Str veclocity = "流速";
Str headLoss = "水头损失";
Str code= "code";
Str createUser= "create_user" ;
Str modityUser = "modify_user";
Str createTime= "create_time";
Str modifyTime = "modify_time" ;
Str symbolAngle= "symbol_angle";
Str compType = "组分类型";
};
CivValveTableTemp();
};
#endif // !CIVTABLETEMP_H #endif // !CIVTABLETEMP_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment