Commit 3163cced by liulongfei

添加ControlObject读取服务

parent 5f6b37e9
send RENDERER WINDOW_OPEN_ON_PARENT 0x3C10C4 784 361 ONAIR
send RENDERER WINDOW_OPEN_ON_PARENT 0x3C10C4 784 361 ONAIR
send RENDERER WINDOW_OPEN_ON_PARENT 0x130D32 400 300 ONAIR
send RENDERER WINDOW_RESIZE 300 300
"0 MAIN SHOW_COMMANDS 0"
00220CF6
Maximum number of supported texture units: 4
Maximum number of supported texture image units: 32
Maximum number of supported texture coords: 8
Maximum number of supported combined texture image units: 192
0 RENDERER*STAGE START
RENDERER SET_OBJECT SCENE*{0}
RENDERER*STAGE START
MyTestProject/Scenes/
RENDERER SET_OBJECT SCENE*MyTestProject/Scenes/24-GJB
RENDERER SET_OBJECT SCENE*Default/1
-o -P -db Admin:@localhost/VizDbServer:19396
-o -P -db Guest:@localhost/VizDbServer:19396
http://localhost:19398/folders/
http://localhost:19396/folders/
SET_SAFE_AREA
case "窗口嵌入": return $"send RENDERER WINDOW_OPEN_ON_PARENT 0x{this.vizPanelHwnd.ToString("X6")} {this.panelViz.Width} {this.panelViz.Height - 100} ONAIR";
case "加载场景": return $"send RENDERER SET_OBJECT SCENE*MyTestProject/Scenes/24-GJB";
case "Title Safe": return $"send RENDERER SET_TITLE_AREA 1";
case "Safe Area": return $"send RENDERER SET_SAFE_AREA 1";
case "Bounding box": return $"send RENDERER SHOW_BOUNDING_BOX 1";
case "Show RGB": return $"send RENDERER SET_KEY 0,RENDERER*KEY_INTERNAL*ACTIVE SET 0";
case "Show Key": return $"send RENDERER SET_KEY 1,RENDERER*KEY_INTERNAL*ACTIVE SET 0";
case "Show Keyd Preview": return $"send RENDERER SET_KEY 0,RENDERER*KEY_INTERNAL*IMAGE RESET,RENDERER*KEY_INTERNAL*ACTIVE SET 1";
string text = string.Format("{0:x}", _Handle.ToInt64());
this.Send("MAIN SWITCH_EXTERNAL");
this.Send("COMMAND SWITCH_ONAIR");
this.Send("MAIN*CONFIGURATION*DATABASE*AUTOLOGIN GET");
this.Send("MAIN*CONFIGURATION*TARGA3200*VIZLINK_MODE SET 1");
this.Send("MAIN*HARDWARE*NUMBER_VIDEOIN_CHANNELS GET");
this.Send("MAIN*CONFIGURATION*RENDER_OPTION*ONAIR_VGA_PREVIEW SET 1");
string text2 = this.Request("EDITOR CREATE RENDERER");
this.Send("MAIN*HARDWARE*NUMBER_CLIPIN_CHANNELS GET");
this.Send(string.Concat(new string[]
{
text2,
" WINDOW_OPEN_ON_PARENT ",
text,
" ",
Width.ToString(),
" ",
Height.ToString(),
" ONAIR"
}));
this.Send(string.Concat(new string[]
{
text2,
" WINDOW_RESIZE ",
Width.ToString(),
" ",
Height.ToString()
}));
this.Send(text2 + " REDRAW");
this.Send("MAIN ON_AIR ON");
this.Send("MAIN VERSION");
this.Send(text2 + " SET_KEY 0");
this.Send(text2 + "*KEY_INTERNAL*ACTIVE SET 0");
this.Send(text2 + " SET_OBJECT");
this.Send(text2 + " SHOW_BOUNDING_BOX 1");
this.Send(text2 + " REDRAW");
this.Send(text2 + " SET_TITLE_AREA 0");
this.Send(text2 + " SET_SAFE_AREA 0");
this.Send("MAIN*CONFIGURATION*RENDER_OPTION*FORCE_SLEEP SET 1");
this.Send("MAIN*TRIO*ACTIVE SET 1");
return text2;
// 获取ControlObject所有ID
MAIN_SCENE*TREE SEARCH_FOR_CONTAINER_WITH_PROPERTY BUILT_IN*FUNCTION BUILT_IN*FUNCTION*ControlObject
// 获取ControlObject描述
// 返回结果 "_" 分割 描述_名称_isRT
MAIN_SCENE*TREE*{VizID}*FUNCTION*ControlObject*description
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*use_all_directors GET
// Layer 返回: 0 FRONT_LAYER, 1 MAIN_LAYER, 2 BACK_LAYER
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*layer GET
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*state GET
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*background GET
// 返回值:“\n”分割 BT:#8349*GEOM*TEXT:text:::-1:BT:single_line, location_id=#8349, location=1/1/3
send MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*in SET LIST
request MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*result GET
// BT:#8349*GEOM*TEXT:text:::-1:BT:single_line, location_id=#8349, location=1/1/3
// 按照 ":" 分割
// 大于7个参数那么 FieldIdentifier:VizID_SetGetfunction:Type:Min:Max:MaxChar:Description:AuxField:
// 获取值
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*in SET ON {FieldIdentifier} GET
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*result GET
// 设置值
MAIN_LAYER*TREE*${VizID}*FUNCTION*ControlObject*in SET ON {Value};
MAIN_SCENE*TREE*#469*FUNCTION*ControlObject*description
MAIN_LAYER*TREE*{VizID}*FUNCTION*ControlObject*in SET LIST
MAIN_SCENE*TREE*#1529*FUNCTION*ControlObject*result GET
MAIN_SCENE*TREE*$object*FUNCTION*ControlObject*in SET ON FTITLE SET 1
MyTestProject/Scenes/24-GJB*TREE*$object*FUNCTION*ControlObject*in SET ON FTITLE SET 1
#7204 #7386 #7834 #8279 #8740 #9185 #9630
MAIN_SCENE*TREE*#7204*FUNCTION*ControlObject*description
MAIN_LAYER*TREE*#7204*FUNCTION*ControlObject*in SET LIST
MAIN_LAYER*TREE*#7204*FUNCTION*ControlObject*result GET
#7328 #7328
MAIN_LAYER*TREE*#7328*FUNCTION*ControlObject*in SET ON FD1 GET
MAIN_LAYER*TREE*#7204*FUNCTION*ControlObject*result GET
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Domain
{
/// <summary>
/// Viz树节点信息
/// </summary>
public class VizTreeNodeInfo
{
/// <summary>
/// 节点完整路径
/// </summary>
/// <remarks>
/// Example: 1/3/3
/// </remarks>
public string NodeFullPath { get; set; }
/// <summary>
/// 节点编号
/// </summary>
/// <remarks>
/// Example: 407
/// </remarks>
public string NodeNum { get; set; }
/// <summary>
/// 节点名称
/// </summary>
public string NodeName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Domain
{
/// <summary>
/// Viz控制对象字段模型
/// </summary>
public class VizControlObjectFieldModel : ModelBase
{
/// <summary>
/// Viz控制对象字段模型
/// </summary>
/// <param name="entity">实体</param>
public VizControlObjectFieldModel(VizControlObjectFieldEntity entity)
{
this.Entity = entity;
}
/// <summary>
/// 实体
/// </summary>
public VizControlObjectFieldEntity Entity { get; private set; }
#region TreeNodePath -- 所在场景节点路径
private string treeNodePath;
/// <summary>
/// 所在场景节点路径
/// </summary>
public string TreeNodePath
{
get { return treeNodePath; }
set { treeNodePath = value; this.RaisePropertyChanged(nameof(TreeNodePath)); }
}
#endregion
#region PropertyPath -- 属性路径
private string propertyPath;
/// <summary>
/// 属性路径
/// </summary>
public string PropertyPath
{
get { return propertyPath; }
set { propertyPath = value; this.RaisePropertyChanged(nameof(PropertyPath)); }
}
#endregion
#region FieldIdentifier -- 字段名称
private string fieldIdentifier;
/// <summary>
/// 字段名称
/// </summary>
public string FieldIdentifier
{
get { return fieldIdentifier; }
set { fieldIdentifier = value; this.RaisePropertyChanged(nameof(FieldIdentifier)); }
}
#endregion
#region Value --
private string _value;
/// <summary>
/// 值
/// </summary>
public string Value
{
get { return _value; }
set { _value = value; this.RaisePropertyChanged(nameof(Value)); }
}
#endregion
#region Description -- 描述
private string description;
/// <summary>
/// 描述
/// </summary>
public string Description
{
get { return description; }
set { description = value; this.RaisePropertyChanged(nameof(Description)); }
}
#endregion
#region Type -- 字段类型
private VizControlObjectFieldType type;
/// <summary>
/// 字段类型
/// </summary>
public VizControlObjectFieldType Type
{
get { return type; }
set { type = value; this.RaisePropertyChanged(nameof(Type)); }
}
#endregion
}
}
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.TVP.Storage;
namespace VIZ.TVP.Domain
{
/// <summary>
/// Viz控制对象模型
/// </summary>
public class VizControlObjectModel : ModelBase
{
/// <summary>
/// Viz控制对象模型
/// </summary>
/// <param name="entity">实体</param>
public VizControlObjectModel(VizControlObjectEntity entity)
{
this.Entity = entity;
}
/// <summary>
/// 实体
/// </summary>
public VizControlObjectEntity Entity { get; private set; }
#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 VizTreeNodeInfo -- 场景树节点信息
private VizTreeNodeInfo treeNodeInfo;
/// <summary>
/// 场景树节点信息
/// </summary>
public VizTreeNodeInfo TreeNodeInfo
{
get { return treeNodeInfo; }
set { treeNodeInfo = value; this.RaisePropertyChanged(nameof(TreeNodeInfo)); }
}
#endregion
#region Fields -- 字段结合
private ObservableCollection<VizControlObjectFieldModel> fields = new ObservableCollection<VizControlObjectFieldModel>();
/// <summary>
/// 字段结合
/// </summary>
public ObservableCollection<VizControlObjectFieldModel> Fields
{
get { return fields; }
set { fields = value; this.RaisePropertyChanged(nameof(Fields)); }
}
#endregion
}
}
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
<Compile Include="ApplicationDomainEx.cs" /> <Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Enum\PluginIDs.cs" /> <Compile Include="Enum\PluginIDs.cs" />
<Compile Include="Enum\ServiceKeys.cs" /> <Compile Include="Enum\ServiceKeys.cs" />
<Compile Include="Model\ControlObject\VizControlObjectFieldModel.cs" />
<Compile Include="Info\ControlObject\VizTreeNodeInfo.cs" />
<Compile Include="Manager\DataBaseManager.cs" /> <Compile Include="Manager\DataBaseManager.cs" />
<Compile Include="Manager\LocalVizManager.cs" /> <Compile Include="Manager\LocalVizManager.cs" />
<Compile Include="Manager\PluginManager.cs" /> <Compile Include="Manager\PluginManager.cs" />
...@@ -85,6 +87,7 @@ ...@@ -85,6 +87,7 @@
<Compile Include="Message\Program\ProgramListItemDeleteMessage.cs" /> <Compile Include="Message\Program\ProgramListItemDeleteMessage.cs" />
<Compile Include="Message\Project\ProjectChangedMessage.cs" /> <Compile Include="Message\Project\ProjectChangedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" /> <Compile Include="Message\Project\ProjectSaveMessage.cs" />
<Compile Include="Model\ControlObject\VizControlObjectModel.cs" />
<Compile Include="Model\Plugin\PluginConfigModel.cs" /> <Compile Include="Model\Plugin\PluginConfigModel.cs" />
<Compile Include="Model\Plugin\PluginGroupModel.cs" /> <Compile Include="Model\Plugin\PluginGroupModel.cs" />
<Compile Include="Model\Project\Program\ProgramListItemModel.cs" /> <Compile Include="Model\Project\Program\ProgramListItemModel.cs" />
......
...@@ -3,10 +3,17 @@ ...@@ -3,10 +3,17 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:VIZ.TVP.Module" xmlns:local="clr-namespace:VIZ.TVP.Module"
d:DataContext="{d:DesignInstance Type=local:ControlListViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<TextBlock Text="Control列表" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="36" Foreground="Red"></TextBlock> <TextBlock Text="Control列表" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="36" Foreground="Red"></TextBlock>
<Button Command="{Binding Path=LoadedCommand}"></Button>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -3,7 +3,10 @@ using System.Collections.Generic; ...@@ -3,7 +3,10 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Framework.Plugin; using VIZ.Framework.Plugin;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
namespace VIZ.TVP.Module namespace VIZ.TVP.Module
{ {
...@@ -12,6 +15,54 @@ namespace VIZ.TVP.Module ...@@ -12,6 +15,54 @@ namespace VIZ.TVP.Module
/// </summary> /// </summary>
public class ControlListViewModel : PluginViewModelBase public class ControlListViewModel : PluginViewModelBase
{ {
public ControlListViewModel()
{
// 初始化命令
this.initCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void initCommand()
{
this.LoadedCommand = new VCommand(this.Loaded);
}
// ==================================================================================
// Service & Control
// ==================================================================================
/// <summary>
/// ControlObject命令服务
/// </summary>
private IVizCommandControlObjectService vizCommandControlObjectService = new VizCommandControlObjectService();
// ==================================================================================
// Command
// ==================================================================================
#region LoadedCommand -- 加载命令
/// <summary>
/// 加载命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载
/// </summary>
private void Loaded()
{
var result = this.vizCommandControlObjectService.GetControlObjectList(ApplicationDomainEx.TVPConnectionManager.LocalConnection, Storage.VizSceneLayerEnum.MAIN_SCENE);
}
#endregion
// ==================================================================================
// Public Function
// ==================================================================================
/// <summary> /// <summary>
/// 销毁 /// 销毁
/// </summary> /// </summary>
...@@ -19,5 +70,6 @@ namespace VIZ.TVP.Module ...@@ -19,5 +70,6 @@ namespace VIZ.TVP.Module
{ {
} }
} }
} }
...@@ -77,7 +77,9 @@ ...@@ -77,7 +77,9 @@
<Compile Include="Program\Implementation\ProgramService.cs" /> <Compile Include="Program\Implementation\ProgramService.cs" />
<Compile Include="Program\Interface\IProgramService.cs" /> <Compile Include="Program\Interface\IProgramService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VIZ\Implementation\VizCommandControlObjectService.cs" />
<Compile Include="VIZ\Implementation\VizCommandService.cs" /> <Compile Include="VIZ\Implementation\VizCommandService.cs" />
<Compile Include="VIZ\Interface\IVizCommandControlObjectService.cs" />
<Compile Include="VIZ\Interface\IVizCommandService.cs" /> <Compile Include="VIZ\Interface\IVizCommandService.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Service
{
/// <summary>
/// VIZ命令ControlObject服务
/// </summary>
public class VizCommandControlObjectService : IVizCommandControlObjectService
{
/// <summary>
/// 获取场景树节点信息
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <returns>场景树节点信息</returns>
public List<VizTreeNodeInfo> GetTreeNodeList(TVPConnectionModel connection, VizSceneLayerEnum layer)
{
List<VizTreeNodeInfo> list = new List<VizTreeNodeInfo>();
string cmd = $"{layer}*TREE GET";
string result = connection.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.NodeFullPath = pars[0];
info.NodeNum = pars[1];
info.NodeName = pars[2];
// pars[3] 有的节点有,有的节点没有
list.Add(info);
}
return list;
}
/// <summary>
/// 获取控制对象列表
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <returns>控制对象列表</returns>
public List<VizControlObjectModel> GetControlObjectList(TVPConnectionModel connection, VizSceneLayerEnum layer)
{
List<VizControlObjectModel> list = new List<VizControlObjectModel>();
// Step 1. 获取场景树信息
List<VizTreeNodeInfo> treeNodeList = this.GetTreeNodeList(connection, layer);
// Step 2. 获取控制对象ID集合
List<string> ids = this.GetControlObjectIds(connection, layer);
// Step 3. 获取控制对象信息
foreach (string id in ids)
{
VizControlObjectModel obj = new VizControlObjectModel(new VizControlObjectEntity());
VizTreeNodeInfo info = treeNodeList.FirstOrDefault(p => id == $"#{p.NodeNum}");
if (info == null)
continue;
obj.TreeNodeInfo = info;
obj.TreeNodeName = info.NodeName;
obj.TreeNodePath = info.NodeFullPath;
obj.Description = this.GetControlObjectParameter(connection, layer, info.NodeNum, VizControlObjectParameters.description);
string str = this.GetControlObjectResult(connection, layer, info.NodeNum);
string[] lines = str.Split('\n');
// BTNAME:#10245*GEOM*TEXT:text:::-1:BTNAME:single_line, location_id=#10245, location=2/3/5
foreach (string line in lines)
{
if (string.IsNullOrWhiteSpace(line))
continue;
string[] pars = line.Split(':');
VizControlObjectFieldModel field = new VizControlObjectFieldModel(new VizControlObjectFieldEntity());
field.FieldIdentifier = pars[0];
field.TreeNodePath = obj.TreeNodePath;
field.PropertyPath = pars[1];
field.Type = this.getControlObjectFieldType(pars[2]);
field.Value = this.GetControlObjectFieldValue(connection, layer, info.NodeNum, field.FieldIdentifier);
obj.Fields.Add(field);
}
list.Add(obj);
}
return list;
}
/// <summary>
/// 获取控制对象ID集合
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <returns>控制对象ID集合</returns>
public List<string> GetControlObjectIds(TVPConnectionModel connection, VizSceneLayerEnum layer)
{
string cmd = $"{layer}*TREE SEARCH_FOR_CONTAINER_WITH_PROPERTY BUILT_IN*FUNCTION BUILT_IN*FUNCTION*ControlObject";
string result = connection.EndpointManager.Request(cmd);
string[] source = result.Trim().Split(' ');
return source.ToList();
}
/// <summary>
/// 获取控制对象参数
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="nodeNum">场景树编号</param>
/// <param name="parameter">参数</param>
/// <returns>描述</returns>
public string GetControlObjectParameter(TVPConnectionModel connection, VizSceneLayerEnum layer, string nodeNum, VizControlObjectParameters parameter)
{
string cmd = $"{layer}*TREE*#{nodeNum}*FUNCTION*ControlObject*{parameter} GET";
string result = connection.EndpointManager.Request(cmd);
return result;
}
/// <summary>
/// 获取控制对象返回值
/// </summary>
/// <remarks>
/// 返回结果按照“:”进行分割
/// FieldIdentifier:VizID_SetGetfunction:Type:Min:Max:MaxChar:Description:AuxField:
/// </remarks>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="nodeNum">场景树编号</param>
/// <returns>控制对象返回值</returns>
public string GetControlObjectResult(TVPConnectionModel connection, VizSceneLayerEnum layer, string nodeNum)
{
connection.EndpointManager.Send($"{layer}*TREE*#{nodeNum}*FUNCTION*ControlObject*in SET LIST");
string result = connection.EndpointManager.Request($"{layer}*TREE*#{nodeNum}*FUNCTION*ControlObject*result GET");
return result;
}
/// <summary>
/// 获取控制对象字段值
/// </summary>
/// <param name="connection"></param>
/// <param name="layer"></param>
/// <param name="nodeNum">场景树编号</param>
/// <param name="fieldIdentifier">字段</param>
/// <returns>字段值</returns>
public string GetControlObjectFieldValue(TVPConnectionModel connection, VizSceneLayerEnum layer, string nodeNum, string fieldIdentifier)
{
connection.EndpointManager.Send($"{layer}*TREE*#{nodeNum}*FUNCTION*ControlObject*in SET ON {fieldIdentifier} GET");
string result = connection.EndpointManager.Request($"{layer}*TREE*#{nodeNum}**FUNCTION*ControlObject*result GET");
return result;
}
/// <summary>
/// 设置控制对象值
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="fieldIdentifier">字段</param>
/// <param name="value">值</param>
public void SetControlObjectValue(TVPConnectionModel connection, VizSceneLayerEnum layer, string fieldIdentifier, string value)
{
connection.EndpointManager.Send($"{layer}*TREE*$object*FUNCTION*ControlObject*in SET ON {fieldIdentifier} SET {value}");
}
/// <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(TVPConnectionModel connection, VizSceneLayerEnum 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>
private VizControlObjectFieldType getControlObjectFieldType(string type)
{
if (type == "text")
return VizControlObjectFieldType.text;
if (type == "image")
return VizControlObjectFieldType.image;
if (type == "richtext")
return VizControlObjectFieldType.richtext;
if (type.StartsWith("<?xml"))
return VizControlObjectFieldType.xml;
return VizControlObjectFieldType.none;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Service
{
/// <summary>
/// VIZ命令ControlObject服务
/// </summary>
public interface IVizCommandControlObjectService
{
/// <summary>
/// 获取场景树节点信息
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <returns>场景树节点信息</returns>
List<VizTreeNodeInfo> GetTreeNodeList(TVPConnectionModel connection, VizSceneLayerEnum layer);
/// <summary>
/// 获取控制对象列表
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <returns>控制对象列表</returns>
List<VizControlObjectModel> GetControlObjectList(TVPConnectionModel connection, VizSceneLayerEnum layer);
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// Viz控制对象字段类型
/// </summary>
public enum VizControlObjectFieldType
{
/// <summary>
/// 未指定
/// </summary>
none,
/// <summary>
/// 文本
/// </summary>
text,
/// <summary>
/// 富文本
/// </summary>
richtext,
/// <summary>
/// 图片
/// </summary>
image,
/// <summary>
/// XML
/// </summary>
xml
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.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
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// VIZ场景层
/// </summary>
public enum VizSceneLayerEnum
{
/// <summary>
/// 前层
/// </summary>
[Description("前层")]
FRONT_SCENE,
/// <summary>
/// 主层
/// </summary>
[Description("主层")]
MAIN_SCENE,
/// <summary>
/// 背景层
/// </summary>
[Description("背景层")]
BACK_SCENE
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// Viz控制对象实体
/// </summary>
public class VizControlObjectEntity
{
/// <summary>
/// 编号
/// </summary>
[LiteDB.BsonId(true)]
public int Id { get; set; }
/// <summary>
/// 所在场景节点名称
/// </summary>
public string TreeNodeName { get; set; }
/// <summary>
/// 所在场景节点路径
/// </summary>
public string TreeNodePath { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// ControlObject字段
/// </summary>
public class VizControlObjectFieldEntity
{
/// <summary>
/// 编号
/// </summary>
[LiteDB.BsonId(true)]
public int Id { get; set; }
/// <summary>
/// 所在场景节点路径
/// </summary>
public string TreeNodePath { get; set; }
/// <summary>
/// 字段名称
/// </summary>
public string FieldIdentifier { get; set; }
/// <summary>
/// 属性路径
/// </summary>
public string PropertyPath { get; set; }
/// <summary>
/// 字段值
/// </summary>
public string Value { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 字段类型
/// </summary>
public VizControlObjectFieldType Type { get; set; }
}
}
...@@ -110,7 +110,12 @@ ...@@ -110,7 +110,12 @@
<Compile Include="LiteDB\Project\Program\ProgramListEntity.cs" /> <Compile Include="LiteDB\Project\Program\ProgramListEntity.cs" />
<Compile Include="LiteDB\Project\Program\ProgramTemplateEntity.cs" /> <Compile Include="LiteDB\Project\Program\ProgramTemplateEntity.cs" />
<Compile Include="LiteDB\Project\ProjectContext.cs" /> <Compile Include="LiteDB\Project\ProjectContext.cs" />
<Compile Include="LiteDB\VIZ\Enum\VizControlObjectFieldType.cs" />
<Compile Include="LiteDB\VIZ\VizControlObjectEntity.cs" />
<Compile Include="LiteDB\VIZ\Enum\VizControlObjectParameters.cs" />
<Compile Include="LiteDB\VIZ\Enum\VizLayerEnum.cs" /> <Compile Include="LiteDB\VIZ\Enum\VizLayerEnum.cs" />
<Compile Include="LiteDB\VIZ\Enum\VizSceneLayerEnum.cs" />
<Compile Include="LiteDB\VIZ\VizControlObjectFieldEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XML\GH\Enum\GH_Category_Term_Enums.cs" /> <Compile Include="XML\GH\Enum\GH_Category_Term_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Content_Type_Enums.cs" /> <Compile Include="XML\GH\Enum\GH_Content_Type_Enums.cs" />
......
ID,PluginID,Group,DisplayName,Type ID,PluginID,Group,DisplayName,Type
1,TestPlugin,,Բ,TemplatePlugin 1,TestPlugin,,Բ,TemplatePlugin
2,DayMatchUI,CBA,DayMatchUI,TemplatePlugin
\ No newline at end of file
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