Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Package
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.Package
Commits
d8aa0168
Commit
d8aa0168
authored
Jan 03, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段树获取
parent
143b88fa
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
872 additions
and
5 deletions
+872
-5
VIZ.Package.Domain/Info/VizTreeNodeInfo.cs
+35
-0
VIZ.Package.Domain/Model/ControlObject/ControlFieldNodeModel.cs
+129
-0
VIZ.Package.Domain/Model/ControlObject/ControlObjectModel.cs
+100
-0
VIZ.Package.Domain/VIZ.Package.Domain.csproj
+5
-3
VIZ.Package.Module/ControlObject/FieldTree/ViewModel/FieldTreeViewModel.cs
+46
-1
VIZ.Package.Service/VIZ.Package.Service.csproj
+1
-0
VIZ.Package.Service/Viz/VizCommandControlObjectService.cs
+364
-0
VIZ.Package.Service/Viz/VizCommandService.cs
+1
-1
VIZ.Package.Storage/Entity/ControlObject/ControlDynamicFieldEntity.cs
+25
-0
VIZ.Package.Storage/Entity/ControlObject/ControlFieldEntity.cs
+36
-0
VIZ.Package.Storage/Enum/VizControlFieldType.cs
+57
-0
VIZ.Package.Storage/Enum/VizControlObjectParameters.cs
+49
-0
VIZ.Package.Storage/ProjectDbContext.cs
+20
-0
VIZ.Package.Storage/VIZ.Package.Storage.csproj
+4
-0
No files found.
VIZ.Package.Domain/Info/VizTreeNodeInfo.cs
0 → 100644
View file @
d8aa0168
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Domain
{
/// <summary>
/// Viz树节点信息
/// </summary>
public
class
VizTreeNodeInfo
{
/// <summary>
/// 节点路径
/// </summary>
/// <remarks>
/// Example: 1/3/3
/// </remarks>
public
string
Path
{
get
;
set
;
}
/// <summary>
/// 节点编号
/// </summary>
/// <remarks>
/// Example: 407
/// </remarks>
public
string
Num
{
get
;
set
;
}
/// <summary>
/// 节点名称
/// </summary>
public
string
Name
{
get
;
set
;
}
}
}
VIZ.Package.Domain/Model/ControlObject/ControlFieldNodeModel.cs
0 → 100644
View file @
d8aa0168
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Domain
{
/// <summary>
/// 控制字段节点模型
/// </summary>
public
class
ControlFieldNodeModel
:
ModelBase
{
#
region
Route
--
属性路由
private
List
<
string
>
route
;
/// <summary>
/// 属性路由
/// </summary>
public
List
<
string
>
Route
{
get
{
return
route
;
}
set
{
route
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Route
));
}
}
#
endregion
#
region
TreeNodePath
--
树节点路径
private
string
treeNodePath
;
/// <summary>
/// 树节点路径
/// </summary>
public
string
TreeNodePath
{
get
{
return
treeNodePath
;
}
set
{
treeNodePath
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TreeNodePath
));
}
}
#
endregion
#
region
FieldIdentifier
--
字段名称
private
string
fieldIdentifier
;
/// <summary>
/// 字段名称
/// </summary>
public
string
FieldIdentifier
{
get
{
return
fieldIdentifier
;
}
set
{
fieldIdentifier
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
FieldIdentifier
));
}
}
#
endregion
#
region
Description
--
描述
private
string
description
;
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
{
return
description
;
}
set
{
description
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Description
));
}
}
#
endregion
#
region
Value
--
字段值
private
string
_value
;
/// <summary>
/// 字段值
/// </summary>
public
string
Value
{
get
{
return
_value
;
}
set
{
_value
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Value
));
}
}
#
endregion
#
region
Type
--
字段类型
private
VizControlFieldType
type
;
/// <summary>
/// 字段类型
/// </summary>
public
VizControlFieldType
Type
{
get
{
return
type
;
}
set
{
type
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Type
));
}
}
#
endregion
#
region
TypeSchema
--
字段类型定义
private
string
typeSchema
;
/// <summary>
/// 字段类型定义
/// </summary>
public
string
TypeSchema
{
get
{
return
typeSchema
;
}
set
{
typeSchema
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TypeSchema
));
}
}
#
endregion
#
region
Items
--
子节点集合
private
List
<
ControlFieldNodeModel
>
items
=
new
List
<
ControlFieldNodeModel
>();
/// <summary>
/// 子节点集合
/// </summary>
public
List
<
ControlFieldNodeModel
>
Items
{
get
{
return
items
;
}
set
{
items
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Items
));
}
}
#
endregion
}
}
VIZ.Package.Domain/Model/ControlObject/ControlObjectModel.cs
0 → 100644
View file @
d8aa0168
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
namespace
VIZ.Package.Domain
{
/// <summary>
/// 控制对象模型
/// </summary>
public
class
ControlObjectModel
:
ModelBase
{
#
region
TreeNodeName
--
所在场景节点名称
private
string
treeNodeName
;
/// <summary>
/// 所在场景节点名称
/// </summary>
public
string
TreeNodeName
{
get
{
return
treeNodeName
;
}
set
{
treeNodeName
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TreeNodeName
));
}
}
#
endregion
#
region
TreeNodePath
--
所在场景节点路径
private
string
treeNodePath
;
/// <summary>
/// 所在场景节点路径
/// </summary>
public
string
TreeNodePath
{
get
{
return
treeNodePath
;
}
set
{
treeNodePath
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TreeNodePath
));
}
}
#
endregion
#
region
Description
--
描述
private
string
description
;
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
{
return
description
;
}
set
{
description
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Description
));
}
}
#
endregion
#
region
UseAllDirectors
--
使用所有的控制器
private
bool
useAllDirectors
;
/// <summary>
/// 使用所有的控制器
/// </summary>
public
bool
UseAllDirectors
{
get
{
return
useAllDirectors
;
}
set
{
useAllDirectors
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
UseAllDirectors
));
}
}
#
endregion
#
region
FieldNodes
--
字段节点集合
private
List
<
ControlFieldNodeModel
>
fieldNodes
=
new
List
<
ControlFieldNodeModel
>();
/// <summary>
/// 字段节点集合
/// </summary>
public
List
<
ControlFieldNodeModel
>
FieldNodes
{
get
{
return
fieldNodes
;
}
set
{
fieldNodes
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
FieldNodes
));
}
}
#
endregion
#
region
AllFiledNodes
--
所有字段节点集合
private
List
<
ControlFieldNodeModel
>
allFiledNodes
=
new
List
<
ControlFieldNodeModel
>();
/// <summary>
/// 所有字段节点集合
/// </summary>
public
List
<
ControlFieldNodeModel
>
AllFiledNodes
{
get
{
return
allFiledNodes
;
}
set
{
allFiledNodes
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AllFiledNodes
));
}
}
#
endregion
}
}
VIZ.Package.Domain/VIZ.Package.Domain.csproj
View file @
d8aa0168
...
...
@@ -71,6 +71,7 @@
<Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" />
<Compile Include="Info\VizTreeNodeInfo.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" />
<Compile Include="Message\Page\PageInitedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" />
...
...
@@ -80,6 +81,8 @@
<Compile Include="Model\Conn\ConnGroupModel.cs" />
<Compile Include="Model\Conn\ConnModel.cs" />
<Compile Include="Core\IPackageEndpointManager.cs" />
<Compile Include="Model\ControlObject\ControlFieldNodeModel.cs" />
<Compile Include="Model\ControlObject\ControlObjectModel.cs" />
<Compile Include="Model\Page\PageGroupModel.cs" />
<Compile Include="Model\Page\PageModel.cs" />
<Compile Include="Model\Page\PageModelBase.cs" />
...
...
@@ -122,8 +125,6 @@
<Name>VIZ.Package.Storage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Model\Viz\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
VIZ.Package.Module/ControlObject/FieldTree/ViewModel/FieldTreeViewModel.cs
View file @
d8aa0168
...
...
@@ -4,6 +4,8 @@ using System.Linq;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
namespace
VIZ.Package.Module
{
...
...
@@ -12,6 +14,48 @@ namespace VIZ.Package.Module
/// </summary>
public
class
FieldTreeViewModel
:
ViewModelBase
{
public
FieldTreeViewModel
()
{
// 初始化消息
this
.
InitMessage
();
}
/// <summary>
/// 初始化消息
/// </summary>
private
void
InitMessage
()
{
ApplicationDomainEx
.
MessageManager
.
Register
<
PageInitedMessage
>(
this
,
this
.
OnPageInitedMessage
);
}
// =============================================================
// Service & Controller
// =============================================================
/// <summary>
/// Viz 控制对象命令服务
/// </summary>
private
VizCommandControlObjectService
vizCommandControlObjectService
=
new
VizCommandControlObjectService
();
// =============================================================
// Property
// =============================================================
// =============================================================
// Command
// =============================================================
// =============================================================
// Message
// =============================================================
/// <summary>
/// 页初始化完成消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnPageInitedMessage
(
PageInitedMessage
msg
)
{
var
test
=
this
.
vizCommandControlObjectService
.
GetControlObject
(
ApplicationDomainEx
.
PreviewConn
);
}
}
}
}
\ No newline at end of file
VIZ.Package.Service/VIZ.Package.Service.csproj
View file @
d8aa0168
...
...
@@ -73,6 +73,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Viz\GHResourceService.cs" />
<Compile Include="Viz\GHService.cs" />
<Compile Include="Viz\VizCommandControlObjectService.cs" />
<Compile Include="Viz\VizCommandService.cs" />
</ItemGroup>
<ItemGroup>
...
...
VIZ.Package.Service/Viz/VizCommandControlObjectService.cs
0 → 100644
View file @
d8aa0168
using
System
;
using
System.Collections.Generic
;
using
System.Dynamic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Web.UI.WebControls
;
using
System.Xml.Linq
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Service
{
/// <summary>
/// VIZ命令ControlObject服务
/// </summary>
public
class
VizCommandControlObjectService
{
/// <summary>
/// 获取控制对象XML数据
/// </summary>
/// <param name="xml">xml内容</param>
/// <param name="schema">定义信息</param>
/// <param name="columns">列信息</param>
/// <param name="items">数据源</param>
/// <returns></returns>
//public void GetControlObjectXmlData(string xml, ControlObject_Schema_Node schema, out List<GridColumnDefinition> columns, out List<ExpandoObject> items)
//{
// columns = new List<GridColumnDefinition>();
// items = new List<ExpandoObject>();
// bool isCreatedColumns = false;
// using (System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(xml)))
// {
// XElement element = XElement.Load(ms);
// ControlObject_Entry_Node root = new ControlObject_Entry_Node();
// root.FromXmlElement(element);
// foreach (var row in root.Elements)
// {
// IDictionary<string, object> obj = new ExpandoObject();
// ControlObject_Entry_Node data = row.Entrys.FirstOrDefault(p => p.Name == "data");
// if (data == null)
// continue;
// foreach (var cell in data.Entrys)
// {
// obj[cell.Name] = cell.Value;
// if (!isCreatedColumns)
// {
// ControlObject_Field_node node = schema.Fields.FirstOrDefault(p => p.Name == cell.Name);
// GridColumnDefinition column = new GridColumnDefinition();
// column.FieldName = cell.Name;
// if (cell.Name == node?.Description)
// {
// column.Header = cell.Name;
// }
// else
// {
// column.Header = $"({node?.Description}){cell.Name}";
// }
// columns.Add(column);
// }
// }
// isCreatedColumns = true;
// items.Add(obj as ExpandoObject);
// }
// }
//}
/// <summary>
/// 获取控制对象XML数据
/// </summary>
/// <param name="items">控制对象数据</param>
/// <returns>XML数据</returns>
public
string
GetControlObjectXml
(
List
<
ExpandoObject
>
items
)
{
ControlObject_Entry_Node
root
=
new
ControlObject_Entry_Node
();
foreach
(
IDictionary
<
string
,
object
>
row
in
items
)
{
ControlObject_Element_Node
element
=
new
ControlObject_Element_Node
();
ControlObject_Entry_Node
data
=
new
ControlObject_Entry_Node
();
data
.
Name
=
"data"
;
foreach
(
var
kv
in
row
)
{
ControlObject_Entry_Node
cell
=
new
ControlObject_Entry_Node
();
cell
.
Name
=
kv
.
Key
;
cell
.
Value
=
kv
.
Value
==
null
?
string
.
Empty
:
kv
.
Value
.
ToString
();
data
.
Entrys
.
Add
(
cell
);
}
element
.
Entrys
.
Add
(
data
);
root
.
Elements
.
Add
(
element
);
}
XElement
root_element
=
root
.
ToXmlElement
();
return
$"<?xml version=\"1.0\"?>
{
root_element
.
ToString
(
SaveOptions
.
DisableFormatting
)}
"
;
}
/// <summary>
/// 获取场景树节点信息
/// </summary>
/// <param name="conn">连接</param>
/// <returns>场景树节点信息</returns>
public
List
<
VizTreeNodeInfo
>
GetTreeNodeList
(
ConnModel
conn
)
{
List
<
VizTreeNodeInfo
>
list
=
new
List
<
VizTreeNodeInfo
>();
string
cmd
=
$"MAIN_SCENE*TREE GET"
;
string
result
=
conn
.
EndpointManager
.
Request
(
cmd
);
List
<
string
>
nodes
=
result
.
Split
(
'{'
).
Select
(
p
=>
p
.
Replace
(
"}"
,
""
)).
ToList
();
foreach
(
string
node
in
nodes
)
{
if
(
string
.
IsNullOrWhiteSpace
(
node
))
continue
;
// 1 29073 object 1
string
[]
pars
=
node
.
Split
(
' '
);
VizTreeNodeInfo
info
=
new
VizTreeNodeInfo
();
info
.
Path
=
pars
[
0
];
info
.
Num
=
pars
[
1
];
info
.
Name
=
pars
[
2
];
// pars[3] 有的节点有,有的节点没有
list
.
Add
(
info
);
}
return
list
;
}
/// <summary>
/// 获取控制对象ID集合
/// </summary>
/// <param name="conn">连接</param>
/// <returns>控制对象ID集合</returns>
public
List
<
string
>
GetControlObjectIds
(
ConnModel
conn
)
{
string
cmd
=
$"MAIN_SCENE*TREE SEARCH_FOR_CONTAINER_WITH_PROPERTY BUILT_IN*FUNCTION BUILT_IN*FUNCTION*ControlObject"
;
string
result
=
conn
.
EndpointManager
.
Request
(
cmd
);
string
[]
source
=
result
.
Trim
().
Split
(
' '
);
return
source
.
ToList
();
}
/// <summary>
/// 获取控制对象信息
/// </summary>
/// <param name="conn">连接</param>
/// <returns>控制对象列表</returns>
public
ControlObjectModel
GetControlObject
(
ConnModel
conn
)
{
ControlObjectModel
obj
=
new
ControlObjectModel
();
// Step 1. 获取场景树信息
List
<
VizTreeNodeInfo
>
treeNodeList
=
this
.
GetTreeNodeList
(
conn
);
Dictionary
<
string
,
VizTreeNodeInfo
>
treeNodeDic
=
treeNodeList
.
ToDictionary
(
p
=>
$"#
{
p
.
Num
}
"
,
p
=>
p
);
// Step 2. 获取控制对象ID集合
List
<
string
>
ids
=
this
.
GetControlObjectIds
(
conn
);
// Step 3. 获取控制对象信息, 只获取第一个控制对象
string
id
=
ids
.
FirstOrDefault
();
if
(
string
.
IsNullOrWhiteSpace
(
id
))
return
obj
;
if
(!
treeNodeDic
.
TryGetValue
(
id
,
out
VizTreeNodeInfo
objTreeNodeInfo
))
return
obj
;
// Step 4. 获取第一个控制对象的信息
obj
.
TreeNodePath
=
objTreeNodeInfo
.
Path
;
obj
.
TreeNodeName
=
objTreeNodeInfo
.
Name
;
obj
.
Description
=
this
.
GetControlObjectParameter
(
conn
,
obj
.
TreeNodePath
,
VizControlObjectParameters
.
description
);
obj
.
UseAllDirectors
=
this
.
GetControlObjectParameter
(
conn
,
obj
.
TreeNodePath
,
VizControlObjectParameters
.
use_all_directors
)
==
"1"
;
// Step 5. 获取第一个控制对象的字段描述
string
fieldDetails
=
this
.
GetControlObjectResult
(
conn
,
obj
.
TreeNodePath
);
foreach
(
string
fieldDetail
in
fieldDetails
.
Split
(
'\n'
))
{
// 返回示例: BTNAME:#10245*GEOM*TEXT:text:::-1:BTNAME:single_line, location_id=#10245, location=2/3/5
if
(
string
.
IsNullOrWhiteSpace
(
fieldDetail
))
continue
;
string
[]
pars
=
fieldDetail
.
Split
(
':'
);
if
(!
treeNodeDic
.
TryGetValue
(
pars
[
1
],
out
VizTreeNodeInfo
treeNodeInfo
))
continue
;
ControlFieldNodeModel
node
=
new
ControlFieldNodeModel
();
node
.
FieldIdentifier
=
pars
[
0
];
node
.
TreeNodePath
=
treeNodeInfo
.
Path
;
node
.
Route
=
node
.
TreeNodePath
.
Split
(
'/'
).
ToList
();
node
.
TypeSchema
=
pars
[
2
];
node
.
Type
=
this
.
GetControlFieldType
(
node
.
TypeSchema
);
node
.
Value
=
this
.
GetControlFieldValue
(
conn
,
node
.
TreeNodePath
,
node
.
FieldIdentifier
);
obj
.
AllFiledNodes
.
Add
(
node
);
}
// Step 6. 根据字段FieldIdentifier构建树形结构
int
count
=
1
;
List
<
ControlFieldNodeModel
>
fieldNodes
=
obj
.
AllFiledNodes
.
Where
(
p
=>
p
.
Route
.
Count
==
count
).
ToList
();
List
<
ControlFieldNodeModel
>
parents
=
fieldNodes
;
while
(
true
)
{
++
count
;
List
<
ControlFieldNodeModel
>
items
=
obj
.
AllFiledNodes
.
Where
(
p
=>
p
.
Route
.
Count
==
count
).
ToList
();
if
(
items
.
Count
==
0
)
break
;
foreach
(
ControlFieldNodeModel
item
in
items
)
{
string
parentTreeNodePath
=
string
.
Join
(
"."
,
item
.
Route
.
Take
(
count
-
1
));
ControlFieldNodeModel
parent
=
parents
.
FirstOrDefault
(
p
=>
p
.
TreeNodePath
==
parentTreeNodePath
);
if
(
parent
==
null
)
continue
;
parent
.
Items
.
Add
(
item
);
}
parents
=
items
;
}
obj
.
FieldNodes
=
fieldNodes
;
return
obj
;
}
/// <summary>
/// 获取控制对象参数
/// </summary>
/// <param name="conn">连接</param>
/// <param name="treeNodePath">场景数路径</param>
/// <param name="parameter">参数</param>
/// <returns>描述</returns>
public
string
GetControlObjectParameter
(
ConnModel
conn
,
string
treeNodePath
,
VizControlObjectParameters
parameter
)
{
string
cmd
=
$"MAIN_SCENE*TREE*
{
treeNodePath
}
*FUNCTION*ControlObject*
{
parameter
}
GET"
;
string
result
=
conn
.
EndpointManager
.
Request
(
cmd
);
return
result
;
}
/// <summary>
/// 获取控制对象返回值
/// </summary>
/// <remarks>
/// 返回结果按照“:”进行分割
/// FieldIdentifier:VizID_SetGetfunction:Type:Min:Max:MaxChar:Description:AuxField:
/// </remarks>
/// <param name="conn">连接</param>
/// <param name="treeNodePath">场景树路径</param>
/// <returns>控制对象返回值</returns>
public
string
GetControlObjectResult
(
ConnModel
conn
,
string
treeNodePath
)
{
conn
.
EndpointManager
.
Send
(
$"MAIN_SCENE*TREE*
{
treeNodePath
}
*FUNCTION*ControlObject*in SET LIST"
);
string
result
=
conn
.
EndpointManager
.
Request
(
$"MAIN_SCENE*TREE*
{
treeNodePath
}
*FUNCTION*ControlObject*result GET"
);
return
result
;
}
/// <summary>
/// 获取控制对象字段值
/// </summary>
/// <param name="connection"></param>
/// <param name="treeNodePath">场景树路径</param>
/// <param name="fieldIdentifier">字段</param>
/// <returns>字段值</returns>
public
string
GetControlFieldValue
(
ConnModel
connection
,
string
treeNodePath
,
string
fieldIdentifier
)
{
connection
.
EndpointManager
.
Send
(
$"MAIN_SCENE*TREE*
{
treeNodePath
}
*FUNCTION*ControlObject*in SET ON
{
fieldIdentifier
}
GET"
);
string
result
=
connection
.
EndpointManager
.
Request
(
$"MAIN_SCENE*TREE*
{
treeNodePath
}
*FUNCTION*ControlObject*result GET"
);
return
result
;
}
/// <summary>
/// 设置控制对象值
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="treeNodePath">场景节点路径</param>
/// <param name="fieldIdentifier">字段</param>
/// <param name="value">值</param>
public
void
SetControlObjectValue
(
ConnModel
connection
,
VizLayer
layer
,
string
treeNodePath
,
string
fieldIdentifier
,
string
value
)
{
connection
.
EndpointManager
.
Send
(
$"
{
layer
}
*TREE*
{
treeNodePath
}
*FUNCTION*ControlObject*in SET ON
{
fieldIdentifier
}
SET
{
value
}
"
);
}
/// <summary>
/// 设置控制对象值
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="obj">控制对象</param>
public
void
SetControlObjectValue
(
ConnModel
conn
,
ControlObjectModel
obj
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$"MAIN_SCENE*TREE*
{
obj
.
TreeNodePath
}
*FUNCTION*ControlObject*in SET ON "
);
foreach
(
ControlFieldNodeModel
field
in
obj
.
AllFiledNodes
)
{
sb
.
Append
(
$"
{
field
.
FieldIdentifier
}
SET
{
field
.
Value
}
\\0"
);
}
conn
.
EndpointManager
.
Send
(
sb
.
ToString
());
}
/// <summary>
/// 设置列表控制对象的值
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="listName">列表名称</param>
/// <param name="listLine">列表值位序</param>
/// <param name="fieldIdentifier">字段</param>
/// <param name="value">值</param>
public
void
SetxControlObjectListValue
(
ConnModel
connection
,
VizLayer
layer
,
string
listName
,
int
listLine
,
string
fieldIdentifier
,
string
value
)
{
connection
.
EndpointManager
.
Send
(
$"
{
layer
}
*TREE*$object*FUNCTION*ControlObject*in SET WITH
{
listName
}
INDEX
{
listLine
}
ON
{
fieldIdentifier
}
SET
{
value
}
"
);
}
/// <summary>
/// 获取控制字段类型
/// </summary>
/// <param name="type">字段类型</param>
/// <returns>控制对象字段类型</returns>
public
VizControlFieldType
GetControlFieldType
(
string
type
)
{
if
(
type
==
"text"
)
return
VizControlFieldType
.
text
;
if
(
type
==
"bool"
)
return
VizControlFieldType
.
boolean
;
if
(
type
==
"image"
)
return
VizControlFieldType
.
image
;
if
(
type
==
"richtext"
)
return
VizControlFieldType
.
richtext
;
if
(
type
==
"triplet"
)
return
VizControlFieldType
.
triplet
;
if
(
type
.
StartsWith
(
"<?xml"
))
return
VizControlFieldType
.
list
;
return
VizControlFieldType
.
none
;
}
}
}
VIZ.Package.Service/Viz/VizCommandService.cs
View file @
d8aa0168
...
...
@@ -25,7 +25,7 @@ namespace VIZ.Package.Service
throw
new
ArgumentNullException
(
nameof
(
conn
));
// 需要等待结果
conn
.
EndpointManager
.
Send
(
$"RENDERER*
{
layer
}
SET_OBJECT SCENE*
{
scene
}
"
);
conn
.
EndpointManager
.
Request
(
$"RENDERER*
{
layer
}
SET_OBJECT SCENE*
{
scene
}
"
);
}
/// <summary>
...
...
VIZ.Package.Storage/Entity/ControlObject/ControlDynamicFieldEntity.cs
0 → 100644
View file @
d8aa0168
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
/// <summary>
/// 控制动态字段实体
/// </summary>
public
class
ControlDynamicFieldEntity
:
ControlFieldEntity
{
/// <summary>
/// 所属字段
/// </summary>
public
string
OwnerFieldIdentifier
{
get
;
set
;
}
/// <summary>
/// 行数, 从0开始
/// </summary>
public
int
Row
{
get
;
set
;
}
}
}
VIZ.Package.Storage/Entity/ControlObject/ControlFieldEntity.cs
0 → 100644
View file @
d8aa0168
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
/// <summary>
/// 控制字段实体
/// </summary>
public
class
ControlFieldEntity
{
/// <summary>
/// 编号
/// </summary>
[
BsonId
(
true
)]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 字段名称
/// </summary>
public
string
FieldIdentifier
{
get
;
set
;
}
/// <summary>
/// 字段值
/// </summary>
public
string
Value
{
get
;
set
;
}
/// <summary>
/// 字段类型
/// </summary>
public
VizControlFieldType
Type
{
get
;
set
;
}
}
}
VIZ.Package.Storage/Enum/VizControlFieldType.cs
0 → 100644
View file @
d8aa0168
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
/// <summary>
/// Viz 控制字段类型
/// </summary>
public
enum
VizControlFieldType
{
/// <summary>
/// 未指定
/// </summary>
[
Description
(
"未指定"
)]
none
,
/// <summary>
/// 文本
/// </summary>
[
Description
(
"文本"
)]
text
,
/// <summary>
/// Bool值
/// </summary>
[
Description
(
"Bool值"
)]
boolean
,
/// <summary>
/// 富文本
/// </summary>
[
Description
(
"富文本"
)]
richtext
,
/// <summary>
/// 图片
/// </summary>
[
Description
(
"图片"
)]
image
,
/// <summary>
/// 列表
/// </summary>
[
Description
(
"列表"
)]
list
,
/// <summary>
/// 三元组
/// </summary>
[
Description
(
"三元组"
)]
triplet
}
}
VIZ.Package.Storage/Enum/VizControlObjectParameters.cs
0 → 100644
View file @
d8aa0168
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
/// <summary>
/// Viz控制对象参数
/// </summary>
public
enum
VizControlObjectParameters
{
/// <summary>
/// 描述
/// </summary>
description
,
/// <summary>
/// trio 是否已经加载
/// </summary>
trio_loadable
,
/// <summary>
/// Viz层
/// </summary>
viz_layer
,
/// <summary>
/// 使用所有的控制器
/// </summary>
use_all_directors
,
/// <summary>
/// 图层 0 FRONT_LAYER, 1 MAIN_LAYER, 2 BACK_LAYER
/// </summary>
layer
,
/// <summary>
/// 状态
/// </summary>
state
,
/// <summary>
/// 背景场景
/// </summary>
background
}
}
VIZ.Package.Storage/ProjectDbContext.cs
View file @
d8aa0168
...
...
@@ -60,6 +60,26 @@ namespace VIZ.Package.Storage
public
ILiteCollection
<
PageEntity
>
Page
{
get
;
private
set
;
}
/// <summary>
/// 根据ID获取控制字段, ID 为 TemplateID 或者 PageID
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
/// <returns>控制字段</returns>
public
ILiteCollection
<
ControlFieldEntity
>
GetControlFiled
(
Guid
id
)
{
return
this
.
Database
.
GetCollection
<
ControlFieldEntity
>(
id
.
ToString
());
}
/// <summary>
/// 根据ID获取控制动态字段, ID 为 TemplateID 或者 PageID
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
/// <returns>控制动态字段</returns>
public
ILiteCollection
<
ControlDynamicFieldEntity
>
GetControlDynamicFiled
(
Guid
id
)
{
return
this
.
Database
.
GetCollection
<
ControlDynamicFieldEntity
>(
id
.
ToString
());
}
/// <summary>
/// 销毁
/// </summary>
public
void
Dispose
()
...
...
VIZ.Package.Storage/VIZ.Package.Storage.csproj
View file @
d8aa0168
...
...
@@ -69,6 +69,8 @@
<ItemGroup>
<Compile Include="Entity\Conn\ConnEntity.cs" />
<Compile Include="Entity\Conn\ConnGroupEntity.cs" />
<Compile Include="Entity\ControlObject\ControlDynamicFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.cs" />
<Compile Include="Entity\Page\PageEntityBase.cs" />
<Compile Include="Entity\Page\PageEntity.cs" />
<Compile Include="Entity\Page\PageGroupEntity.cs" />
...
...
@@ -77,6 +79,8 @@
<Compile Include="Enum\EngineFullType.cs" />
<Compile Include="Enum\EngineType.cs" />
<Compile Include="Enum\PageType.cs" />
<Compile Include="Enum\VizControlFieldType.cs" />
<Compile Include="Enum\VizControlObjectParameters.cs" />
<Compile Include="Enum\VizLayer.cs" />
<Compile Include="LocalDbContext.cs" />
<Compile Include="ProjectDbContext.cs" />
...
...
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