Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hydraulicModel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘乐
hydraulicModel
Commits
ba785fcc
Commit
ba785fcc
authored
Jul 10, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,扩散分析输出结果调整
parent
58f1d6b0
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
418 additions
and
93 deletions
+418
-93
CivHydrCalc.h
pandaAnalysis/CivHydrCalc.h
+12
-13
CivHydrFuncInter.h
pandaAnalysis/CivHydrFuncInter.h
+23
-21
CivHydrSimulation.h
pandaAnalysis/CivHydrSimulation.h
+11
-11
CivInp.h
pandaAnalysis/CivInp.h
+11
-10
CivSimulResultCache.h
pandaAnalysis/CivSimulResultCache.h
+9
-9
CivDbConn.h
pandaDbManager/CivDbConn.h
+33
-16
CivPgConn.cpp
pandaDbManager/CivPgConn.cpp
+81
-0
CivPgConn.h
pandaDbManager/CivPgConn.h
+14
-8
CivTableTemp.cpp
pandaDbManager/CivTableTemp.cpp
+0
-3
CivTableTemp.h
pandaDbManager/CivTableTemp.h
+1
-2
CivTrackingResultCache.cpp
pandaDbManager/CivTrackingResultCache.cpp
+134
-0
CivTrackingResultCache.h
pandaDbManager/CivTrackingResultCache.h
+74
-0
pandaDbManager.vcxproj
pandaDbManager/pandaDbManager.vcxproj
+2
-0
pandaDbManager.vcxproj.filters
pandaDbManager/pandaDbManager.vcxproj.filters
+7
-0
常用地址.txt
常用地址.txt
+6
-0
水力模型产品研发计划.xlsx
建模文档/水力模型产品研发计划.xlsx
+0
-0
水力模型后台计算服务接口说明.docx
建模文档/水力模型后台计算服务接口说明.docx
+0
-0
水力模型测试报告.xlsx
建模文档/水力模型测试报告.xlsx
+0
-0
No files found.
pandaAnalysis/CivHydrCalc.h
View file @
ba785fcc
...
...
@@ -19,17 +19,17 @@ public:
/**
*@brief 水力模拟计算
*@inpFile:inp文件
*@rptFile: 输出文件
*@binOutFile: 二进制输出文件
*@
param
inpFile:inp文件
*@
param
rptFile: 输出文件
*@
param
binOutFile: 二进制输出文件
*/
bool
hydrSimulation
(
char
*
inpFile
,
char
*
rptFile
,
char
*
binOutFile
);
/**
*@brief 水质模拟计算
*@inpFile:inp文件
*@rptFile: 输出文件
*@binOutFile: 二进制输出文件
*@
param
inpFile:inp文件
*@
param
rptFile: 输出文件
*@
param
binOutFile: 二进制输出文件
*/
bool
qualitySimulation
(
char
*
inpFile
,
char
*
rptFile
,
char
*
binOutFile
);
...
...
@@ -43,33 +43,32 @@ public:
private
:
/**
*@brief 解析表字段名,按顺序写入
*@table:表
*@inp: inp文件对象
*@
param
table:表
*@
param
inp: inp文件对象
*/
void
assemble
(
const
std
::
string
&
table
,
CivInp
&
inp
);
/*
*@brief 获取节点计算结果
*@time: 时间
*@
param
time: 时间
*/
void
getNodeResult
(
short
time
);
/*
*@brief 获取管线计算结果
*@time: 时间
*@
param
time: 时间
*/
void
getLinkResult
(
short
time
);
/*
*@brief 获取节点的水质计算结果
*@time: 时间
*@
param
time: 时间
*/
void
getNodeQuality
(
short
time
);
/*
*@brief 获取管线水值计算结果
*@time: 时间
*@
param
time: 时间
*/
void
getLinkQuality
(
short
time
);
...
...
pandaAnalysis/CivHydrFuncInter.h
View file @
ba785fcc
...
...
@@ -8,64 +8,66 @@ extern "C" {
/**
*@brief 水力计算服务
*@uri:数据库连接地址
*@
param
uri:数据库连接地址
*@return 1:成功,其他值失败
*/
bool
DLLEXPORT
hdyrSimulation
(
char
*
uri
);
/**
*@brief 水质计算
*@uri:数据库连接地址
*@
param
uri:数据库连接地址
*@return 1:成功,其他值失败
*/
bool
DLLEXPORT
qualitySimulation
(
char
*
uri
);
/**
*@brief 水质追踪分析,扩散分析
*@uri:数据库连接地址
*@sN:追踪节点
*@hours:追踪小时
*@result:输出结果:json字符串
*@
param
uri:数据库连接地址
*@
param
sN:追踪节点
*@
param
hours:追踪小时
*@
param
result:输出结果:json字符串
*@return 1:成功,其他值失败
*/
bool
DLLEXPORT
trackingSimulation
(
char
*
uri
,
char
*
sN
,
int
hours
,
char
*
result
);
/**
*@brief 模拟计算
*@uri: 管网数据库连接
*@netName: 管网名
*@flag: 标记
*@
param
uri: 管网数据库连接
*@
param
netName: 管网名
*@
param
flag: 标记
*/
bool
DLLEXPORT
simulation
(
char
*
uri
,
char
*
netName
,
char
*
flag
);
/**
*@brief 水力模拟计算
*@uri: 管网数据库连接
*@netName: 管网名
*@
param
uri: 管网数据库连接
*@
param
netName: 管网名
*/
bool
DLLEXPORT
hdySimulation
(
char
*
uri
,
char
*
netName
);
/**
*@brief 水力模拟计算
*@uri: 管网数据库连接
*@netName: 管网名
*@type: 水质模拟类型选择,水龄,追踪,化学成分
*@
param
uri: 管网数据库连接
*@
param
netName: 管网名
*@
param
type: 水质模拟类型选择,水龄,追踪,化学成分
*/
//bool DLLEXPORT qualitySimulation(char* uri, char* netName, char* type);
/**
*@brief 水质追踪模拟计算
*@uri: 管网数据库连接
*@netName: 管网名
*@nodeSn: 追踪节点编号
*@time: 追踪时段
*@
param
uri: 管网数据库连接
*@
param
netName: 管网名
*@
param
nodeSn: 追踪节点编号
*@
param
time: 追踪时段
*/
bool
DLLEXPORT
qualityTrackingSimulation
(
char
*
uri
,
char
*
netName
,
char
*
nodeSn
,
char
*
time
);
/**
*@brief 获取管网计算特定时段的结果
*@uri: 管网数据库连接uri
*@date: 日期
*@interval: 时段,整数
*@param uri: 管网数据库连接uri
*@param date: 日期
*@param interval: 时段,整数
*@return 成功,失败
*/
bool
DLLEXPORT
getDataByInterval
(
char
*
uri
,
char
*
date
,
char
*
interval
);
...
...
pandaAnalysis/CivHydrSimulation.h
View file @
ba785fcc
...
...
@@ -14,8 +14,8 @@ public:
~
CivHydrSimulation
();
/**
*@b
ir
ef 注册数据库
*@
dbConn:
连接数据库指针
*@b
ri
ef 注册数据库
*@
param dbConn
连接数据库指针
*/
void
registDb
(
CivDbConn
*
dbConn
);
...
...
@@ -31,35 +31,35 @@ public:
/**
*@brief 追踪分析,本质仍然式水质分析
*@snNode:追踪的节点号
*@hours: 小时数
*@
param
snNode:追踪的节点号
*@
param
hours: 小时数
*/
bool
trackingSimulation
(
char
*
snNode
,
int
hours
);
/**
*@brief 导出inp文件
*@analyType: 水质分析类型:水龄,追踪,化合物,none
*@qulityName: 追踪节点值,或者化合物质
*@
param
analyType: 水质分析类型:水龄,追踪,化合物,none
*@
param
qulityName: 追踪节点值,或者化合物质
*/
bool
convertInp
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
);
/**
*@brief 获取追踪结果值
*@hours:追踪的小时数
*@
param
hours:追踪的小时数
*/
void
getTrackingResult
(
int
hours
,
std
::
string
&
result
);
/**
*@brief 同一天只保留最后一次模拟的结果值,须清除当前之前模拟的结果值
*@dbConn: 数据库连接对象指针
*@date: 日期
*@
param
dbConn: 数据库连接对象指针
*@
param
date: 日期
*/
bool
clearSamePeriodValue
(
CivDbConn
*
dbConn
,
const
std
::
string
&
date
);
/**
*@brief 及时更新最新模拟的数据到gis管网模型中,默认更新零时刻
*@dbConn: 数据库连接对象指针
*@time: 时段
*@
param
dbConn: 数据库连接对象指针
*@
param
time: 时段
*/
bool
updateLastestDataToGisNet
(
CivDbConn
*
dbConn
,
const
std
::
string
&
time
);
...
...
pandaAnalysis/CivInp.h
View file @
ba785fcc
...
...
@@ -68,16 +68,17 @@ public:
enum
TimeUnit
{
SECONDS
,
MINUTES
,
HOURS
,
DAYS
};
CivInp
(
TimeUnit
timetype
);
/**
*@brief 保存inp文件
*@fileName: 文件名
*@
param
fileName: 文件名
*/
bool
writeToFile
(
const
char
*
fileName
);
/**
*@brief 根据组件类型添加
*@items: 数据
*@type: 枚举类型
*@
param
items: 数据
*@
param
type: 枚举类型
*/
void
writeComponet
(
const
Civitems
&
items
,
SectType
type
);
...
...
@@ -88,28 +89,28 @@ public:
/**
*@brief 定义时间模式
*@pId: 模式id
*@pValue: 模式值
*@p
aram p
Id: 模式id
*@p
aram p
Value: 模式值
*/
void
setPattern
(
StrQuote
pId
,
std
::
vector
<
Str
>
pValue
);
/**
*@brief 定义不同的模拟选项。
*@options: 必选项
*@others: 选填字段
*@
param
options: 必选项
*@
param
others: 选填字段
*/
void
setOption
(
Options
options
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
others
=
std
::
map
<
std
::
string
,
std
::
string
>
());
/**
*@brief 设置模拟的历时
*@duration: 总时间
*@
param
duration: 总时间
*/
void
setDuration
(
int
duration
);
/**
*@brief 设置时间间隔
*@type:需要设置的时间步长计算模型:PATTERN,REPORT,QUALITY
*@step :间隔时长
*@
param
type:需要设置的时间步长计算模型:PATTERN,REPORT,QUALITY
*@
param
step :间隔时长
*/
void
setTimestep
(
Str
type
,
int
step
);
...
...
pandaAnalysis/CivSimulResultCache.h
View file @
ba785fcc
...
...
@@ -14,29 +14,29 @@ class CivSimulResultCache
public
:
/**
*@brief 缓存节点水质
*@quality:存储的值
*@interval:模拟第几次
*@sNo:本点号
*@
param
quality:存储的值
*@
param
interval:模拟第几次
*@
param
sNo:本点号
*/
void
addNodeQuality
(
float
quality
,
int
interval
,
Str
sNo
);
/**
*@brief 缓存管线水质
*@quality:存储的值
*@interval:模拟第几次
*@sNo:管线编号
*@
param
quality:存储的值
*@
param
interval:模拟第几次
*@
param
sNo:管线编号
*/
void
addLinkQuality
(
float
quality
,
int
interval
,
Str
sNo
);
/**
*@brief 缓存节点水力模拟情况
*@nodeItem:节点水力结果值
*@
param
nodeItem:节点水力结果值
*/
void
addNodeItems
(
const
NodeResultItem
&
nodeItem
);
/**
*@brief 缓存管线水力模拟情况
*@linkItem:管线模拟结果
*@
param
linkItem:管线模拟结果
*/
void
addLinkItems
(
const
LinkResultItem
&
linkItem
);
...
...
@@ -47,7 +47,7 @@ public:
/**
*@brief 缓存数据更新到数据库
*@dbConn:数据库连接对象
*@
param
dbConn:数据库连接对象
*/
bool
updateToDb
(
CivDbConnection
*
dbConn
);
...
...
pandaDbManager/CivDbConn.h
View file @
ba785fcc
...
...
@@ -47,51 +47,68 @@ public:
/**
*@brief 判断某张表是否存在,判断方法跟具体的数据库有关,延迟到子类实现
*@tableName: 表名称
*@
param
tableName: 表名称
*/
virtual
bool
tableExist
(
StrQuote
tableName
)
=
0
;
/**
*@brief 创建表格
*@tableName: 表名
*@schema:
*@tableType:表类型,点结果,线结果
*/
virtual
bool
createTable
(
CivTableTemp
&
temp
)
=
0
;
bool
isValid
()
const
;
/**
*@brief 根据字段值条件删除数据
*@table:表
*@filedName:字段名
*@fieldValue:字段值
*@
param
table:表
*@
param
filedName:字段名
*@
param
fieldValue:字段值
*/
virtual
bool
deleteByField
(
StrQuote
table
,
StrQuote
filedName
,
StrQuote
fieldValue
)
=
0
;
/**
*@brief 根据时段将结果电表的数据回填到管网节点表
*@param currDate 日期字符串, 格式: xxxx-xx-xx
*@param interval 时段
*/
virtual
bool
updateNodeByInterval
(
StrQuote
currDate
,
StrQuote
interval
)
=
0
;
/**
*@brief 根据时段将结果线表的数据回填到管网管线表
*@param currDate 日期字符串, 格式: xxxx-xx-xx
*@param interval 时段
*/
virtual
bool
updateLinkByInterval
(
StrQuote
currDate
,
StrQuote
interval
)
=
0
;
/**
*@brief 更新点表数据
*@nodeItems:需要更新的值
*@
param
nodeItems:需要更新的值
*/
virtual
bool
updateNode
(
const
NodeResultItems
&
nodeItems
)
=
0
;
/**
*@brief 更新线表的数据
*@lineItems: 线数据
*@
param:
lineItems: 线数据
*/
virtual
bool
updateLink
(
const
LinkResultItems
&
lineItems
)
=
0
;
// 获取当前执行错误信息
Str
getLastError
()
const
;
/**
*@brief 执行sql语句
*@sql: 需要执行的sql语句
*@param: sql 需要执行的sql语句
*/
virtual
bool
execSql
(
StrQuote
sql
)
=
0
;
/**
*@brief 获取指定表的字段信息
*@param fileds 需要查询那些字段
*@param result 查询的结果集
*/
virtual
bool
execSql
(
StrQuote
sql
)
=
0
;
virtual
bool
getFieldValueFromTable
(
const
std
::
string
&
table
,
const
std
::
vector
<
std
::
string
>&
fileds
,
std
::
vector
<
std
::
vector
<
std
::
string
>>&
result
)
=
0
;
// 获取当前执行错误信息
Str
getLastError
()
const
;
bool
isValid
()
const
;
protected
:
bool
mIsOpen
=
false
;
// 数据库连接信息
...
...
pandaDbManager/CivPgConn.cpp
View file @
ba785fcc
#include "CivPgConn.h"
#include "CivCommonUtils.h"
#include "CivSysLog.h"
#include "CivTypes.h"
#include <sstream>
...
...
@@ -862,5 +863,84 @@ bool CivPgConn::getLabels(CivLabels& labels)
bool
CivPgConn
::
getTags
(
CivTags
&
tags
)
{
return
true
;
}
bool
CivPgConn
::
getFieldValueFromTable
(
const
std
::
string
&
table
,
const
std
::
vector
<
std
::
string
>&
fileds
,
std
::
vector
<
std
::
vector
<
std
::
string
>>&
result
)
{
std
::
string
sql
;
sql
.
append
(
"select "
);
size_t
total
=
fileds
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
sql
.
append
(
fileds
[
i
]);
if
(
i
<
(
total
-
1
))
sql
.
append
(
","
);
}
sql
.
append
(
" from public.
\"
"
);
sql
.
append
(
table
);
sql
.
append
(
"
\"
"
);
std
::
string
utf8Sql
=
TransUTFCoding
(
sql
);
if
(
!
execSql
(
utf8Sql
))
{
CivSysLog
::
getInstance
()
->
error
(
mLastError
,
"CivPgConn"
,
__FUNCTION__
);
return
false
;
}
int
rows
=
PQntuples
(
mResult
);
int
columns
=
PQnfields
(
mResult
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
std
::
vector
<
std
::
string
>
vecRes
;
for
(
int
j
=
0
;
j
<
columns
;
i
++
)
{
std
::
string
res
=
PQgetvalue
(
mResult
,
i
,
j
);
vecRes
.
push_back
(
res
);
}
result
.
push_back
(
vecRes
);
}
PQclear
(
mResult
);
return
true
;
}
bool
CivPgConn
::
getFieldValueFromPipes
(
const
std
::
vector
<
std
::
string
>&
fileds
,
std
::
vector
<
std
::
vector
<
std
::
string
>>
&
result
)
{
std
::
string
sql
=
"select pipe1.
\"
编号
\"
,ST_X(ST_StartPoint(ST_GeometryN(pipe1.
\"
geom
\"
, 1))) as startX,\
ST_Y(ST_StartPoint(ST_GeometryN(pipe1.
\"
geom
\"
, 1))) as startY,\
ST_X(ST_EndPoint(ST_GeometryN(pipe1.
\"
geom
\"
, 1))) as endX,\
ST_Y(ST_EndPoint(ST_GeometryN(pipe1.
\"
geom
\"
, 1))) as endY\
from public.
\"
管段
\"
as pipe1"
;
std
::
string
utf8Sql
=
TransUTFCoding
(
sql
);
if
(
!
execSql
(
utf8Sql
))
{
CivSysLog
::
getInstance
()
->
error
(
mLastError
,
"CivPgConn"
,
__FUNCTION__
);
return
false
;
}
int
rows
=
PQntuples
(
mResult
);
int
columns
=
PQnfields
(
mResult
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
std
::
vector
<
std
::
string
>
vecRes
;
for
(
int
j
=
0
;
j
<
columns
;
i
++
)
{
std
::
string
res
=
PQgetvalue
(
mResult
,
i
,
j
);
vecRes
.
push_back
(
res
);
}
result
.
push_back
(
vecRes
);
}
PQclear
(
mResult
);
return
true
;
}
\ No newline at end of file
pandaDbManager/CivPgConn.h
View file @
ba785fcc
...
...
@@ -55,32 +55,38 @@ public:
/**
*@brief 创建表格
*@tableName: 表名
*@schema:
*@tableType:表类型,点结果,线结果
*@
param
tableName: 表名
*@
param
schema:
*@
param
tableType:表类型,点结果,线结果
*/
bool
createTable
(
CivTableTemp
&
temp
)
override
;
/**
*@brief 根据字段值条件删除数据
*@table:表
*@filedName:字段名
*@fieldValue:字段值
*@
param
table:表
*@
param
filedName:字段名
*@
param
fieldValue:字段值
*/
bool
deleteByField
(
StrQuote
table
,
StrQuote
filedName
,
StrQuote
fieldValue
)
override
;
bool
updateNodeByInterval
(
StrQuote
currDate
,
StrQuote
interval
)
override
;
bool
updateLinkByInterval
(
StrQuote
currDate
,
StrQuote
interval
)
override
;
/**
*@brief 更新点表数据
*@nodeItems:需要更新的值
*@
param
nodeItems:需要更新的值
*/
bool
updateNode
(
const
NodeResultItems
&
nodeItems
)
override
;
/**
*@brief 更新线表的数据
*@lineItems: 线数据
*@
param
lineItems: 线数据
*/
bool
updateLink
(
const
LinkResultItems
&
lineItems
)
override
;
bool
getFieldValueFromTable
(
const
std
::
string
&
table
,
const
std
::
vector
<
std
::
string
>&
fileds
,
std
::
vector
<
std
::
vector
<
std
::
string
>>&
result
)
override
;
private
:
PGconn
*
mConn
;
// 连接对象
PGresult
*
mResult
;
// 查询结果集
...
...
pandaDbManager/CivTableTemp.cpp
View file @
ba785fcc
...
...
@@ -132,7 +132,6 @@ CivPipeTableTemp::CivPipeTableTemp() :CivTableTemp()
addProperty
(
fileds
.
quality
,
CivTableTemp
::
FILED_VARCHAR
);
// "水质";
}
/**
水泵
*/
...
...
@@ -255,7 +254,6 @@ CivValveTableTemp::CivValveTableTemp() :CivTableTemp()
addProperty
(
fileds
.
compType
,
CivTableTemp
::
FILED_VARCHAR
);
// "组分类型";
}
/**
节点模拟结果存储表
*/
...
...
@@ -305,7 +303,6 @@ CivPipeResultTableTemp::CivPipeResultTableTemp() :CivTableTemp()
addProperty
(
pipeFileds
.
dModifyTime
,
CivTableTemp
::
FILED_DATETIME
);
}
/**
模式表
*/
...
...
pandaDbManager/CivTableTemp.h
View file @
ba785fcc
...
...
@@ -105,9 +105,8 @@ public:
};
/**
管线表模板
管线表模板
*/
class
CivPipeTableTemp
:
public
CivTableTemp
{
public
:
...
...
pandaDbManager/CivTrackingResultCache.cpp
0 → 100644
View file @
ba785fcc
#include "CivTrackingResultCache.h"
#include "CivPgConn.h"
void
CivTrackingResultCache
::
cacheInfoFromDb
(
CivDbConn
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
;
cacheJunctionInfoFromDb
(
dbConn
);
cachePipeInfoFromDb
(
dbConn
);
}
void
CivTrackingResultCache
::
transformToJsonStr
(
std
::
string
jsonStr
)
{
jsonStr
.
append
(
"{node:["
);
// 拼接节点缓存数据
jsonStr
.
append
(
"{"
);
for
(
auto
iter
=
mNodeCache
.
begin
();
iter
!=
mNodeCache
.
end
();
iter
++
)
{
std
::
string
sNo
=
iter
->
first
;
Junctions
junctions
=
iter
->
second
;
}
jsonStr
.
append
(
"}"
);
jsonStr
.
append
(
"],link:["
);
// 拼接管段缓存数据
jsonStr
.
append
(
"{"
);
for
(
auto
iter
=
mPipesCache
.
begin
();
iter
!=
mPipesCache
.
end
();
iter
++
)
{
}
jsonStr
.
append
(
"}]"
);
jsonStr
.
append
(
"}"
);
}
void
CivTrackingResultCache
::
cacheJunctionInfoFromDb
(
CivDbConn
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
;
std
::
vector
<
std
::
vector
<
std
::
string
>>
nodeResult
;
std
::
vector
<
std
::
string
>
fileds
;
fileds
.
push_back
(
"本点号"
);
fileds
.
push_back
(
"ST_X(geom) as xCoord"
);
fileds
.
push_back
(
"ST_Y(geom) as yCoord"
);
if
(
!
dbConn
->
getFieldValueFromTable
(
PIPENODE
,
fileds
,
nodeResult
))
{
return
;
}
// 缓存节点数据
int
rows
=
nodeResult
.
size
();
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
if
(
nodeResult
[
i
].
size
()
<
3
)
return
;
Junctions
junction
;
std
::
string
sn
=
nodeResult
[
i
][
0
];
junction
.
sNo
=
sn
;
junction
.
xCoord
=
nodeResult
[
i
][
1
];
junction
.
yCoord
=
nodeResult
[
i
][
2
];
mNodeCache
[
sn
]
=
junction
;
}
}
void
CivTrackingResultCache
::
cachePipeInfoFromDb
(
CivDbConn
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
;
std
::
vector
<
std
::
vector
<
std
::
string
>>
pipeResult
;
std
::
vector
<
std
::
string
>
fileds
;
fileds
.
push_back
(
"编号"
);
fileds
.
push_back
(
"ST_X(ST_StartPoint(ST_GeometryN(geom, 1))) as startX"
);
fileds
.
push_back
(
"ST_Y(ST_StartPoint(ST_GeometryN(geom, 1))) as startY"
);
fileds
.
push_back
(
"ST_X(ST_EndPoint(ST_GeometryN(geom, 1))) as endX"
);
fileds
.
push_back
(
"ST_Y(ST_EndPoint(ST_GeometryN(geom, 1))) as endY"
);
if
(
!
dbConn
->
getFieldValueFromTable
(
PIPELINE
,
fileds
,
pipeResult
))
{
return
;
}
// 缓存节点数据
int
rows
=
pipeResult
.
size
();
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
if
(
pipeResult
[
i
].
size
()
<
5
)
return
;
Pipes
pipes
;
std
::
string
sn
=
pipeResult
[
i
][
0
];
pipes
.
sNo
=
sn
;
pipes
.
startX
=
pipeResult
[
i
][
1
];
pipes
.
startY
=
pipeResult
[
i
][
2
];
pipes
.
endX
=
pipeResult
[
i
][
3
];
pipes
.
endY
=
pipeResult
[
i
][
4
];
mPipesCache
[
sn
]
=
pipes
;
}
}
void
CivTrackingResultCache
::
addNodeQuality
(
const
std
::
string
&
sn
,
double
quality
)
{
auto
iter
=
mNodeCache
.
find
(
sn
);
if
(
iter
==
mNodeCache
.
end
())
return
;
Junctions
junctions
=
iter
->
second
;
junctions
.
mQualitys
.
push_back
(
quality
);
}
void
CivTrackingResultCache
::
addPipeQuality
(
const
std
::
string
&
sn
,
double
quality
)
{
auto
iter
=
mPipesCache
.
find
(
sn
);
if
(
iter
==
mPipesCache
.
end
())
return
;
Pipes
pipes
=
iter
->
second
;
pipes
.
mQualitys
.
push_back
(
quality
);
}
\ No newline at end of file
pandaDbManager/CivTrackingResultCache.h
0 → 100644
View file @
ba785fcc
#pragma once
#include <map>
#include <string>
#include <vector>
class
CivDbConn
;
// 节点
typedef
struct
{
std
::
string
sNo
;
// 本点号
std
::
string
xCoord
;
// x坐标
std
::
string
yCoord
;
// y坐标
std
::
vector
<
double
>
mQualitys
;
// 时段需水量集合
}
Junctions
;
// 管段
typedef
struct
{
std
::
string
sNo
;
// 编号
std
::
string
startX
;
// 起始节点x
std
::
string
startY
;
// 起始节点Y
std
::
string
endX
;
// 终止节点X
std
::
string
endY
;
// 终止节点Y
std
::
vector
<
double
>
mQualitys
;
// 时段需水量集合
}
Pipes
;
/**
*追踪节点,管段信息缓存类
*/
class
CivTrackingResultCache
{
public
:
/**
*@brief 缓存数据库的信息
*@param dbConn 数据库连接
*/
void
cacheInfoFromDb
(
CivDbConn
*
dbConn
);
/**
*@brief 缓存信息转json字符串
*@param jsonStr 转的结果值
*/
void
transformToJsonStr
(
std
::
string
jsonStr
);
/**
*@brief 向节点添加时段水质值
*@param quality 水质值
*/
void
addNodeQuality
(
const
std
::
string
&
sn
,
double
quality
);
/**
*@brief 向管段添加时段水质值
*@param quality 水质值
*/
void
addPipeQuality
(
const
std
::
string
&
sn
,
double
quality
);
private
:
/**
*@brief 缓存数据库的节点数据
*@param dbConn 数据库连接
*/
void
cacheJunctionInfoFromDb
(
CivDbConn
*
dbConn
);
/**
*@brief 缓存数据管段信息
*@param dbConn
*/
void
cachePipeInfoFromDb
(
CivDbConn
*
dbConn
);
private
:
std
::
map
<
std
::
string
,
Junctions
>
mNodeCache
;
// 节点信息缓存
std
::
map
<
std
::
string
,
Pipes
>
mPipesCache
;
// 管段信息缓存
};
pandaDbManager/pandaDbManager.vcxproj
View file @
ba785fcc
...
...
@@ -163,6 +163,7 @@ copy CivAssembly.h $(OutDir)..\include /y
<ClInclude
Include=
"CivDbConnection.h"
/>
<ClInclude
Include=
"CivPgConn.h"
/>
<ClInclude
Include=
"CivTableTemp.h"
/>
<ClInclude
Include=
"CivTrackingResultCache.h"
/>
<ClInclude
Include=
"CivTypes.h"
/>
</ItemGroup>
<ItemGroup>
...
...
@@ -172,6 +173,7 @@ copy CivAssembly.h $(OutDir)..\include /y
<ClCompile
Include=
"CivDbConnection.cpp"
/>
<ClCompile
Include=
"CivPgConn.cpp"
/>
<ClCompile
Include=
"CivTableTemp.cpp"
/>
<ClCompile
Include=
"CivTrackingResultCache.cpp"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
...
...
pandaDbManager/pandaDbManager.vcxproj.filters
View file @
ba785fcc
...
...
@@ -36,6 +36,9 @@
<ClInclude
Include=
"CivAssembly.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivTrackingResultCache.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"CivDbConnection.cpp"
>
...
...
@@ -56,5 +59,8 @@
<ClCompile
Include=
"CivAssembly.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivTrackingResultCache.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
常用地址.txt
0 → 100644
View file @
ba785fcc
水力模型文档共享地址:
//192.168.12.113
熊猫智慧水务GCK平台地址
http://192.168.12.76:8088/web4/?client=city#
建模文档/水力模型产品研发计划.xlsx
View file @
ba785fcc
No preview for this file type
建模文档/水力模型后台计算服务接口说明.docx
View file @
ba785fcc
No preview for this file type
建模文档/水力模型测试报告.xlsx
View file @
ba785fcc
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment