Commit fb7f3be1 authored by 刘乐's avatar 刘乐

1, 水质分析

parent 7807280c
......@@ -10,40 +10,28 @@ void CivNode::addItem(NodeTable table)
mTables.push_back(table);
}
void CivNode::addItems(std::list<NodeTable> tables)
{
// mTables.merge(tables);
}
void CivPipe::addItem(PipesTable table)
{
mTables.push_back(table);
}
void CivPipe::addItems(std::list<PipesTable> tables)
{
//mTables.merge(tables);
}
void CivTank::addItem(TankTable table)
{
mTables.push_back(table);
}
void CivTank::addItems(std::list<TankTable> tables)
{
//mTables.merge(tables);
}
void CivValve::addItem(ValveTable table)
{
mTables.push_back(table);
}
void CivValve::addItems(std::list<ValveTable> tables)
{
//mTables.merge(tables);
}
void CivPumps::addItem(PumpTable table)
......@@ -51,138 +39,81 @@ void CivPumps::addItem(PumpTable table)
mTables.push_back(table);
}
void CivPumps::addItems(std::list<PumpTable> tables)
{
//mTables.merge(tables);
}
void CivReservoirs::addItem(ReservoirsTable table)
{
mTables.push_back(table);
}
void CivReservoirs::addItems(std::list<ReservoirsTable> tables)
{
//mTables.merge(tables);
}
void CivEmitters::addItem(EmittersTable table)
{
mTables.push_back(table);
}
void CivEmitters::addItems(std::list<EmittersTable> tables)
{
//mTables.merge(tables);
}
void CivCoordinates::addItem(CoordTable table)
{
mTables.push_back(table);
}
void CivCoordinates::addItems(std::list<CoordTable> tables)
{
//mTables.merge(tables);
}
void CivMixing::addItem(MixingTable table)
{
mTables.push_back(table);
}
void CivMixing::addItems(std::list<MixingTable> tables)
{
//mTables.merge(tables);
}
void CivParameter::addItem(ParamTable table)
{
mTables.push_back(table);
}
void CivParameter::addItems(std::list<ParamTable> tables)
{
//mTables.merge(tables);
}
void CivPatterns::addItem(PatternTable table)
{
mTables.push_back(table);
}
void CivPatterns::addItems(std::list<PatternTable> tables)
{
//mTables.merge(tables);
}
void CivCurves::addItem(CurvesTable table)
{
mTables.push_back(table);
}
void CivCurves::addItems(std::list<CurvesTable> tables)
{
//mTables.merge(tables);
}
void CivDemands::addItem(DemandsTable table)
{
mTables.push_back(table);
}
void CivDemands::addItems(std::list<DemandsTable> tables)
{
//mTables.merge(tables);
}
void CivSources::addItem(CurvesTable table)
{
mTables.push_back(table);
}
void CivSources::addItems(std::list<CurvesTable> tables)
{
//mTables.merge(tables);
}
void CivStatus::addItem(StatusTable table)
{
mTables.push_back(table);
}
void CivStatus::addItems(std::list<StatusTable> tables)
{
//mTables.merge(tables);
}
void CivQuality::addItem(QualityTable table)
{
mTables.push_back(table);
}
void CivQuality::addItems(std::list<QualityTable> tables)
{
//mTables.merge(tables);
}
void CivLabels::addItem(LabelTable table)
{
mTables.push_back(table);
}
void CivLabels::addItems(std::list<LabelTable> tables)
{
//mTables.merge(tables);
}
void CivTags::addItem(TagsTable table)
{
mTables.push_back(table);
}
void CivTags::addItems(std::list<TagsTable> tables)
{
//mTables.merge(tables);
mTables.push_back(table);
}
\ No newline at end of file
......@@ -20,8 +20,6 @@ class CivTags;
*/
class CivAssembly
{
public:
virtual Str toString();
};
/**
......@@ -32,15 +30,23 @@ class CivNode: public CivAssembly
public:
typedef struct Table
{
// ; ID Elev Demand Pattern
// ; ID Elev Demand Pattern
Str ID;
Str Elev;
Str Demand;
Str PatternId;
} NodeTable;
// 定义字段中文映射
typedef struct TableField
{
Str ID;
Str Elev;
Str Demand;
Str PatternId;
}NodeTableField;
void addItem(NodeTable table);
void addItems(std::list<NodeTable> tables);
std::list<NodeTable> mTables;
};
......@@ -65,8 +71,6 @@ public:
} PipesTable;
void addItem(PipesTable table);
void addItems(std::list<PipesTable> tables);
std::list<PipesTable> mTables;
};
......@@ -79,7 +83,7 @@ class CivTank:public CivAssembly
public:
typedef struct Table
{
// ; ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
// ; ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
Str ID;
Str Elev;
Str InitLevel;
......@@ -91,8 +95,6 @@ public:
} TankTable;
void addItem(TankTable table);
void addItems(std::list<TankTable> tables);
std::list<TankTable> mTables;
};
......@@ -123,8 +125,6 @@ public:
} ValveTable;
void addItem(ValveTable table);
void addItems(std::list<ValveTable> tables);
std::list<ValveTable> mTables;
};
......@@ -136,7 +136,7 @@ class CivPumps :public CivAssembly
public:
typedef struct Table
{
// ;ID Node1 Node2 Parameters
// ;ID Node1 Node2 Parameters
Str ID;
Str Node1;
Str Node2;
......@@ -144,8 +144,6 @@ public:
} PumpTable;
void addItem(PumpTable table);
void addItems(std::list<PumpTable> tables);
std::list<PumpTable> mTables;
};
......@@ -168,7 +166,6 @@ public:
} ReservoirsTable;
void addItem(ReservoirsTable table);
void addItems(std::list<ReservoirsTable> tables);
std::list<ReservoirsTable> mTables;
};
......@@ -190,7 +187,6 @@ public:
} EmittersTable;
void addItem(EmittersTable table);
void addItems(std::list<EmittersTable> tables);
std::list<EmittersTable> mTables;
};
......@@ -202,15 +198,13 @@ class CivCoordinates :public CivAssembly
public:
typedef struct Table
{
// ; ;Node X-Coord Y-Coord
// ; ;Node X-Coord Y-Coord
Str ID;
Str XCoord;
Str YCoord;
} CoordTable;
void addItem(CoordTable table);
void addItems(std::list<CoordTable> tables);
std::list<CoordTable> mTables;
};
......@@ -233,8 +227,6 @@ public:
} MixingTable;
void addItem(MixingTable table);
void addItems(std::list<MixingTable> tables);
std::list<MixingTable> mTables;
};
......@@ -258,8 +250,6 @@ public:
} ParamTable;
void addItem(ParamTable table);
void addItems(std::list<ParamTable> tables);
void setType(const std::string& type) { mType = type; }
std::string mType;
......@@ -279,8 +269,6 @@ public:
} PatternTable;
void addItem(PatternTable table);
void addItems(std::list<PatternTable> tables);
std::list<PatternTable> mTables;
};
......@@ -298,8 +286,6 @@ public:
} CurvesTable;
void addItem(CurvesTable table);
void addItems(std::list<CurvesTable> tables);
std::list<CurvesTable> mTables;
};
......@@ -324,8 +310,6 @@ public:
} DemandsTable;
void addItem(DemandsTable table);
void addItems(std::list<DemandsTable> tables);
std::list<DemandsTable> mTables;
};
......@@ -339,7 +323,7 @@ public:
节点ID标签
源头类型(CONCEN, MASS, FLOWPACED或SETPOINT)
基准源头强度
时间模式ID(可选);Node Type Quality Pattern
时间模式ID(可选);Node Type Quality Pattern
*/
Str ID;
Str Type;
......@@ -348,8 +332,6 @@ public:
} CurvesTable;
void addItem(CurvesTable table);
void addItems(std::list<CurvesTable> tables);
std::list<CurvesTable> mTables;
};
......@@ -361,15 +343,13 @@ public:
{
/*
管段ID标签
状态或者设置 ID Status/Setting
状态或者设置 ID Status/Setting
*/
Str ID;
Str Setting;
} StatusTable;
void addItem(StatusTable table);
void addItems(std::list<StatusTable> tables);
std::list<StatusTable> mTables;
};
......@@ -388,8 +368,6 @@ public:
} QualityTable;
void addItem(QualityTable table);
void addItems(std::list<QualityTable> tables);
std::list<QualityTable> mTables;
};
......@@ -412,7 +390,6 @@ public:
} LabelTable;
void addItem(LabelTable table);
void addItems(std::list<LabelTable> tables);
std::list<LabelTable> mTables;
};
......@@ -434,8 +411,6 @@ public:
} TagsTable;
void addItem(TagsTable table);
void addItems(std::list<TagsTable> tables);
std::list<TagsTable> mTables;
};
......
#include "CivBuilder.h"
#include "CivTypes.h"
CivBuilder::CivBuilder()
{
}
CivBuilder::~CivBuilder()
{
}
CivNewInp* CivBuilder::getNewInp()
{
return mNewInp;
}
CivInpBuilder::CivInpBuilder()
:mDbConn(nullptr)
{
mNewInp = new CivNewInp();
}
CivInpBuilder::CivInpBuilder(CivDbConn* dbConn)
:mDbConn(dbConn)
{
mNewInp = new CivNewInp();
}
CivInpBuilder::~CivInpBuilder()
......@@ -426,7 +442,6 @@ CivNewInp* CivInpBuilder::getNewInp()
}
void CivInpBuilder::buildPatterns()
{
......
......@@ -10,6 +10,9 @@
class CivBuilder
{
public:
CivBuilder();
~CivBuilder();
virtual void buildNode() = 0;
virtual void buildPipe() = 0;
virtual void buildTank() = 0;
......@@ -33,7 +36,11 @@ public:
virtual void buildRules() = 0;
virtual void buildDemands() = 0;
virtual CivNewInp* getNewInp() = 0;
virtual CivNewInp* getNewInp();
protected:
CivNewInp* mNewInp;
};
......@@ -43,8 +50,8 @@ public:
class CivInpBuilder:public CivBuilder
{
public:
CivInpBuilder();
CivInpBuilder(CivDbConn* dbConn);
explicit CivInpBuilder();
explicit CivInpBuilder(CivDbConn* dbConn);
~CivInpBuilder();
// 注册数据库连接
......
#include "CivInpDirector.h"
#include "CivBuilder.h"
void CivInpDirector::create(CivBuilder* builder)
void CivInpDirector::setBuilder(CivBuilder* builder)
{
mBuilder = builder;
}
void CivInpDirector::create()
{
builder->buildNode();
builder->buildPipe();
builder->buildTank();
builder->buildReservoir();
builder->buildPump();
builder->buildVavle();
builder->buildEmitter();
builder->buildPatterns();
builder->buildParamter();
builder->buildCoordnates();
builder->buildVertices();
builder->buildLabels();
builder->buildTags();
builder->buildBackDrop();
builder->buildQuality();
builder->buildSources();
builder->buildMixing();
builder->buildCurves();
builder->buildStatus();
builder->buildControls();
builder->buildRules();
builder->buildDemands();
if (mBuilder == NULL)
return;
mBuilder->buildNode();
mBuilder->buildPipe();
mBuilder->buildTank();
mBuilder->buildReservoir();
mBuilder->buildPump();
mBuilder->buildVavle();
mBuilder->buildEmitter();
mBuilder->buildPatterns();
mBuilder->buildParamter();
mBuilder->buildCoordnates();
mBuilder->buildVertices();
mBuilder->buildLabels();
mBuilder->buildTags();
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;
class CivInpDirector
{
public:
void create(CivBuilder* builder);
void setBuilder(CivBuilder* builder);
void create();
private:
CivBuilder* mBuilder;
};
......
......@@ -4,6 +4,7 @@
#include "CivTableTemp.h"
#define DBEXPORT __declspec(dllexport)
/**
数据库连接接口
*/
......@@ -42,6 +43,8 @@ public:
*/
bool createTable(StrQuote tableName, StrQuote schema, CivTableTemp::TableType tableType);
private:
/**
*@brief 获取管网组件数据:管线,节点,水源等(必须组件)
*@tableName: 组件表
......@@ -90,7 +93,7 @@ public:
bool isValid() const;
private:
/**
*@brief 根据code值寻数据
*@table: 线表
......
......@@ -30,6 +30,11 @@ void CivTableTemp::addPropertys(FiledPropertys props)
mPropertys.insert(mPropertys.end(), props.begin(), props.end());
}
Str CivTableTemp::name()
{
return mTableName;
}
Str CivTableTemp::createSql()
{
switch (mTableType)
......
......@@ -45,7 +45,7 @@ public:
FILED_DATE
};
explicit CivTableTemp(Str tableName, TableType tableType);
explicit CivTableTemp(Str tableName);
~CivTableTemp();
......@@ -54,22 +54,245 @@ public:
*@fileName:字段名
*@filedType:字段类型
*/
void addProperty(std::string fileName, FieldType filedType);
virtual void addProperty(std::string fileName, FieldType filedType);
// 添加批量属性字段
void addPropertys(FiledPropertys props);
// 返回创建表的sql语句
Str createSql();
private:
Str mTableName; // 表明
TableType mTableType; // 表类型
/*
* @brief 表名
*/
Str name();
protected:
Str mTableName; // 表名
FiledPropertys mPropertys; // 字段和字段属性
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
......
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