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
6d69c949
Commit
6d69c949
authored
Dec 14, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, inp文件保存接口构建
parent
d5b0425e
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
247 additions
and
8 deletions
+247
-8
CivHydrTest.cpp
funcDemo/CivHydrTest.cpp
+2
-2
CivInpImpoter.cpp
pandaInpCore/CivInpImpoter.cpp
+49
-0
CivInpImpoter.h
pandaInpCore/CivInpImpoter.h
+7
-1
pandaInpCore.vcxproj
pandaInpCore/pandaInpCore.vcxproj
+2
-0
CivAttributeTable.cpp
pandaWaterCore/CivAttributeTable.cpp
+26
-0
CivAttributeTable.h
pandaWaterCore/CivAttributeTable.h
+33
-0
CivAttributes.cpp
pandaWaterCore/CivAttributes.cpp
+2
-1
CivAttributes.h
pandaWaterCore/CivAttributes.h
+2
-0
CivFeature.cpp
pandaWaterCore/CivFeature.cpp
+10
-0
CivFeature.h
pandaWaterCore/CivFeature.h
+17
-2
CivGeometry.cpp
pandaWaterCore/CivGeometry.cpp
+7
-0
CivGeometry.h
pandaWaterCore/CivGeometry.h
+8
-1
CivPoint.cpp
pandaWaterCore/CivPoint.cpp
+20
-0
CivPoint.h
pandaWaterCore/CivPoint.h
+24
-0
pandaWaterCore.h
pandaWaterCore/pandaWaterCore.h
+16
-0
pandaWaterCore.vcxproj
pandaWaterCore/pandaWaterCore.vcxproj
+6
-1
pandaWaterCore.vcxproj.filters
pandaWaterCore/pandaWaterCore.vcxproj.filters
+16
-0
No files found.
funcDemo/CivHydrTest.cpp
View file @
6d69c949
...
...
@@ -108,10 +108,10 @@ void CivProjSimulationTest::test(char* uri)
{
// 追踪节点编号
char
projCode
[
512
];
strcpy
(
projCode
,
"
e9443d7f-d05b-4768-94b7-084a5d0fe3ba
"
);
strcpy
(
projCode
,
"
aedbda8f-29fd-40ef-bb7e-961eed178f35
"
);
char
time
[
512
];
strcpy
(
time
,
"2020-
09-24 09
:00:00"
);
strcpy
(
time
,
"2020-
12-14 15
:00:00"
);
bool
isSucc
=
projSimulation
(
uri
,
projCode
,
time
);
...
...
pandaInpCore/CivInpImpoter.cpp
View file @
6d69c949
#include "CivInpImpoter.h"
#include "CivSysLog.h"
#include <stdio.h>
CivInpImpoter
::
CivInpImpoter
()
{
...
...
@@ -10,8 +12,55 @@ CivInpImpoter::~CivInpImpoter()
}
int
CivInpImpoter
::
handleline
(
int
linenum
,
char
*
text
)
{
printf
(
"line[%d]=[%s]
\n
"
,
linenum
,
text
);
return
0
;
}
bool
CivInpImpoter
::
load
(
const
std
::
string
&
inppath
)
{
FILE
*
fp
;
int
linenum
;
char
*
p
,
buf
[
1024
];
CivSysLog
::
getInstance
()
->
info
(
"开始解析:"
+
inppath
,
"CivInpImpoter"
,
__FUNCTION__
);
// 打开文件
fp
=
fopen
(
inppath
.
c_str
(),
"r"
);
if
(
fp
==
NULL
)
{
std
::
string
errInfo
=
"打开文件: "
+
inppath
+
"失败!"
;
CivSysLog
::
getInstance
()
->
error
(
errInfo
,
"CivInpImpoter"
,
__FUNCTION__
);
return
false
;
}
// 按行解析数据
for
(
linenum
=
1
;
fgets
(
buf
,
sizeof
(
buf
),
fp
)
!=
NULL
;
++
linenum
)
{
if
((
p
=
strchr
(
buf
,
'\n'
))
==
NULL
)
{
p
=
buf
+
strlen
(
buf
);
}
if
(
p
>
buf
&&
p
[
-
1
]
==
'\r'
)
{
--
p
;
}
*
p
=
'\0'
;
//空格跳过
for
(
p
=
buf
;
*
p
!=
'\0'
&&
isspace
((
int
)
*
p
);
++
p
)
{
;
}
if
(
*
p
==
'\0'
||
*
p
==
';'
)
{
continue
;
}
// 处理解析的行数据
if
(
handleline
(
linenum
,
p
)
!=
0
)
{
std
::
string
errInfo
=
"不能解析第:"
+
std
::
to_string
(
linenum
)
+
"行,跳过"
;
CivSysLog
::
getInstance
()
->
warning
(
errInfo
,
"CivInpImpoter"
,
__FUNCTION__
);
continue
;
}
}
fclose
(
fp
);
return
true
;
}
...
...
pandaInpCore/CivInpImpoter.h
View file @
6d69c949
...
...
@@ -2,7 +2,7 @@
#include <string>
/**
inpļ
inp文件导入类
*/
class
CivInpImpoter
{
...
...
@@ -10,10 +10,16 @@ public:
CivInpImpoter
();
~
CivInpImpoter
();
/**
* @brief 读取和解析inp文件
* @param [inppath] inp文件路径
*/
bool
load
(
const
std
::
string
&
inppath
);
bool
import
();
private
:
//
int
handleline
(
int
linenum
,
char
*
text
);
};
pandaInpCore/pandaInpCore.vcxproj
View file @
6d69c949
...
...
@@ -133,12 +133,14 @@
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
NDEBUG;_CONSOLE;PANDAINPCORE_DLL;PANDAINPCORE_EXPORTS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
<AdditionalIncludeDirectories>
$(OUTDIR)..\include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>
Console
</SubSystem>
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<AdditionalDependencies>
pandaLog.lib;%(AdditionalDependencies)
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
...
...
pandaWaterCore/CivAttributeTable.cpp
0 → 100644
View file @
6d69c949
#include "CivAttributeTable.h"
CivAttributeTable
::
CivAttributeTable
(
AttributeType
attriType
)
:
mAttriType
(
attriType
)
{
}
void
CivAttributeTable
::
regist
(
CivConnection
*
civconn
)
{
mConn
=
civconn
;
}
void
CivAttributeTable
::
unregist
()
{
mConn
=
nullptr
;
}
bool
CivAttributeTable
::
commitChanges
()
{
if
(
!
mConn
)
return
false
;
}
\ No newline at end of file
pandaWaterCore/CivAttributeTable.h
0 → 100644
View file @
6d69c949
#pragma once
class
CivConnection
;
/**
属性表类
*/
class
CivAttributeTable
{
public
:
// 属性表类型
enum
AttributeType
{
Geometry
,
// 空间几何信息表类型
System
// 系统属性表
};
// 构造函数
explicit
CivAttributeTable
(
AttributeType
attriType
);
// 注册数据库
void
regist
(
CivConnection
*
civconn
);
// 取消注册的数据库链接对象
void
unregist
();
// 提交保存
bool
commitChanges
();
private
:
AttributeType
mAttriType
;
CivConnection
*
mConn
=
nullptr
;
};
pandaWaterCore/CivAttributes.cpp
View file @
6d69c949
...
...
@@ -29,4 +29,4 @@ void CivAttributes::merge(const CivAttributes& attribute)
CivAttributes
::
Params
CivAttributes
::
attributes
()
const
{
return
mParams
;
}
}
\ No newline at end of file
pandaWaterCore/CivAttributes.h
View file @
6d69c949
...
...
@@ -18,6 +18,7 @@ public:
CivAttributes
()
=
default
;
CivAttributes
(
const
Params
&
params
);
/**
* @brief 添加单个属性
* @param [name] 属性名
...
...
@@ -41,6 +42,7 @@ public:
*@brief 获取所有属性
*/
Params
attributes
()
const
;
private
:
Params
mParams
;
};
pandaWaterCore/CivFeature.cpp
View file @
6d69c949
...
...
@@ -16,7 +16,17 @@ void CivFeature::setGeometry(const CivGeometry& geo)
mGeometry
=
geo
;
}
CivGeometry
CivFeature
::
geometry
()
const
{
return
mGeometry
;
}
void
CivFeature
::
addAttributes
(
const
CivAttributes
&
attributes
)
{
mAttributes
.
merge
(
attributes
);
}
std
::
string
CivFeature
::
params
()
const
{
}
pandaWaterCore/CivFeature.h
View file @
6d69c949
...
...
@@ -14,12 +14,27 @@ public:
CivFeature
(
const
CivGeometry
&
geom
);
CivFeature
()
=
default
;
~
CivFeature
();
/**
* @brief 要素的几何体
* @param [geo] 几何体
*/
void
setGeometry
(
const
CivGeometry
&
geo
);
// 返回几何体对象
CivGeometry
geometry
()
const
;
/**
* @brief 属性集合
* @param [attributes] 属性对象
*/
void
addAttributes
(
const
CivAttributes
&
attributes
);
/**
* @brief 按属性拼接字符串
* @param
*/
std
::
string
params
()
const
;
private
:
FeatureId
mFeaId
;
// 要素id
CivGeometry
mGeometry
;
// 几何体类型
...
...
pandaWaterCore/CivGeometry.cpp
View file @
6d69c949
...
...
@@ -13,4 +13,10 @@ CivGeometry::~CivGeometry()
CivGeometry
CivGeometry
::
fromWktext
(
const
std
::
string
&
json
)
{
}
String
CivGeometry
::
toJson
()
const
{
std
::
string
jsonStr
;
}
\ No newline at end of file
pandaWaterCore/CivGeometry.h
View file @
6d69c949
...
...
@@ -3,12 +3,15 @@
#include <vector>
#include <map>
#include "CivPoint.h"
typedef
std
::
string
String
;
/**
空间几何体对象
*/
class
CivGeometry
{
public
:
public
:
// 几何体类型
enum
GeometryType
{
...
...
@@ -30,6 +33,10 @@ public:
// 几何体类型
GeometryType
type
()
const
{
return
mGeometryType
;
}
/*几何体对象序列化*/
String
toJson
()
const
;
private
:
GeometryType
mGeometryType
;
std
::
vector
<
CivPoint
>
mPoints
;
};
pandaWaterCore/CivPoint.cpp
0 → 100644
View file @
6d69c949
#include "CivPoint.h"
CivPoint
::
CivPoint
(
double
x
,
double
y
,
double
z
)
:
mX
(
x
),
mY
(
y
),
mZ
(
z
)
{
}
CivPoint
CivPoint
::
operator
=
(
const
CivPoint
&
others
)
{
return
CivPoint
(
others
.
mX
,
others
.
mY
,
others
.
mZ
);
}
bool
CivPoint
::
operator
==
(
const
CivPoint
&
others
)
{
return
mX
==
others
.
mX
&&
mY
==
others
.
mY
&&
mZ
==
others
.
mZ
;
}
\ No newline at end of file
pandaWaterCore/CivPoint.h
0 → 100644
View file @
6d69c949
#pragma once
/**
*/
class
CivPoint
{
public
:
/**
* @brief ࣬
* @param [x]
* @param [y]
* @param [z]
*/
CivPoint
(
double
x
,
double
y
,
double
z
=
0
.
0
);
CivPoint
operator
=
(
const
CivPoint
&
others
);
bool
operator
==
(
const
CivPoint
&
others
);
private
:
double
mX
;
double
mY
;
double
mZ
;
};
pandaWaterCore/pandaWaterCore.h
0 → 100644
View file @
6d69c949
#pragma once
# if defined(PANDAWATERCORELIB_EXPORTS)
# if defined(_MSC_VER)
# define PANDAWATERCORELIB_API __declspec(dllexport)
# else
# define PANDAWATERCORELIB_API
# endif
# else
# if defined(_MSC_VER)
# define PANDAWATERCORELIB_API __declspec(dllimport)
# else
# define PANDAWATERCORELIB_API
# endif
# endif
\ No newline at end of file
pandaWaterCore/pandaWaterCore.vcxproj
View file @
6d69c949
...
...
@@ -130,7 +130,7 @@
<FunctionLevelLinking>
true
</FunctionLevelLinking>
<IntrinsicFunctions>
true
</IntrinsicFunctions>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<PreprocessorDefinitions>
NDEBUG;_CONSOLE;
PANDAWATERCORELIB_EXPORTS;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
</ClCompile>
<Link>
...
...
@@ -142,15 +142,20 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude
Include=
"CivAttributes.h"
/>
<ClInclude
Include=
"CivAttributeTable.h"
/>
<ClInclude
Include=
"CivFeature.h"
/>
<ClInclude
Include=
"CivGeometry.h"
/>
<ClInclude
Include=
"CivMetaType.h"
/>
<ClInclude
Include=
"CivPoint.h"
/>
<ClInclude
Include=
"CivVariant.h"
/>
<ClInclude
Include=
"pandaWaterCore.h"
/>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"CivAttributes.cpp"
/>
<ClCompile
Include=
"CivAttributeTable.cpp"
/>
<ClCompile
Include=
"CivFeature.cpp"
/>
<ClCompile
Include=
"CivGeometry.cpp"
/>
<ClCompile
Include=
"CivPoint.cpp"
/>
<ClCompile
Include=
"CivVariant.cpp"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
...
...
pandaWaterCore/pandaWaterCore.vcxproj.filters
View file @
6d69c949
...
...
@@ -30,6 +30,15 @@
<ClInclude
Include=
"CivVariant.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivPoint.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"pandaWaterCore.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivAttributeTable.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"CivAttributes.cpp"
>
...
...
@@ -44,5 +53,11 @@
<ClCompile
Include=
"CivVariant.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivPoint.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivAttributeTable.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
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