Commit 77f8636b by liulongfei

VIZ渲染窗口开发

parent e38b649c
......@@ -99,6 +99,20 @@ namespace VIZ.TVP.Domain
#endregion
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set { path = value; this.RaisePropertyChanged(nameof(Path)); }
}
#endregion
#region Remark -- 备注
private string remark;
......@@ -223,6 +237,7 @@ namespace VIZ.TVP.Domain
this.TemplateID = template.TemplateID;
this.TemplateType = template.TemplateType;
this.SceneName = template.SceneName;
this.Path = template.Path;
this.Remark = template.Remark;
this.Layer = template.Layer;
this.EngineType = template.EngineType;
......@@ -239,6 +254,7 @@ namespace VIZ.TVP.Domain
this.ListID = this.Entity.ListID;
this.TemplateType = this.Entity.TemplateType;
this.SceneName = this.Entity.SceneName;
this.Path = this.Entity.Path;
this.Remark = this.Entity.Remark;
this.Thumbnail = this.Entity.Thumbnail;
this.Layer = this.Entity.Layer;
......@@ -256,6 +272,7 @@ namespace VIZ.TVP.Domain
this.Entity.ListID = this.ListID;
this.Entity.TemplateType = this.TemplateType;
this.Entity.SceneName = this.SceneName;
this.Entity.Path = this.Path;
this.Entity.Remark = this.Remark;
this.Entity.Thumbnail = this.Thumbnail;
this.Entity.Layer = this.Layer;
......
......@@ -70,6 +70,20 @@ namespace VIZ.TVP.Domain
#endregion
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set { path = value; this.RaisePropertyChanged(nameof(Path)); }
}
#endregion
#region Thumbnail -- 缩略图
private string thumbnail;
......
......@@ -18,6 +18,20 @@ namespace VIZ.TVP.Domain
/// </summary>
public GH_Entry_Node EntryNode { get; set; }
#region FloderModel -- 所属文件夹模型
private GHResourceFolderModel floderModel;
/// <summary>
/// 所属文件夹模型
/// </summary>
public GHResourceFolderModel FloderModel
{
get { return floderModel; }
set { floderModel = value; this.RaisePropertyChanged(nameof(FloderModel)); }
}
#endregion
#region Src --
private string src;
......@@ -60,6 +74,20 @@ namespace VIZ.TVP.Domain
#endregion
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set { path = value; this.RaisePropertyChanged(nameof(Path)); }
}
#endregion
// ---------------------------------------------------------------------
// 扩展属性
......
......@@ -18,6 +18,20 @@ namespace VIZ.TVP.Domain
/// </summary>
public GH_Entry_Node EntryNode { get; set; }
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set { path = value; this.RaisePropertyChanged(nameof(Path)); }
}
#endregion
#region Files -- 文件集合
private ObservableCollection<GHResourceFileModel> files;
......
......@@ -569,6 +569,7 @@ namespace VIZ.TVP.Module
ProgramTemplateModel model = new ProgramTemplateModel(new Storage.ProgramTemplateEntity());
model.TemplateID = Guid.NewGuid().ToString();
model.SceneName = fileModel.Name;
model.Path = fileModel.Path;
model.TemplateType = Storage.ProgramTemplateType.Scene;
model.Thumbnail = fileModel.Thumbnail;
model.ThumbnailBitmap = fileModel.ThumbnailBitmap;
......
......@@ -79,7 +79,7 @@ namespace VIZ.TVP.Module
ThreadHelper.SafeRun(() =>
{
List<GHResourceFileModel> files = ghResourceService.GetGHResourceFiles(link_related.href);
List<GHResourceFileModel> files = ghResourceService.GetGHResourceFiles(link_related.href, folder);
WPFHelper.BeginInvoke(() =>
{
......
......@@ -212,7 +212,10 @@ namespace VIZ.TVP.Module
{
try
{
List<GHResourceFolderModel> list = this.ghResourceService.GetGHResourceFolders("http://localhost:19398/folders/");
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
string url = $"http://{info.GH_IP}:{info.GH_Port}/folders/";
List<GHResourceFolderModel> list = this.ghResourceService.GetGHResourceFolders(url, null);
WPFHelper.BeginInvoke(() =>
{
......
......@@ -25,21 +25,48 @@
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Button Content="播放" Width="60" Height="30" Margin="10,0,0,0" Command="{Binding Path=PlayCommand}"></Button>
<Button Content="继续" Width="60" Height="30" Margin="10,0,0,0"></Button>
<Button Content="停止" Width="60" Height="30" Margin="10,0,0,0"></Button>
<Button Content="播放" Width="60" Height="30" Margin="5,0,0,0" Command="{Binding Path=PlayCommand}"></Button>
<Button Content="继续" Width="60" Height="30" Margin="5,0,0,0" Command="{Binding Path=ContinueCommand}"></Button>
<Button Content="停止" Width="60" Height="30" Margin="5,0,0,0" Command="{Binding Path=StopCommand}"></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">
<CheckBox Content="TA" Width="60" Height="30" Margin="10,0,0,0"></CheckBox>
<CheckBox Content="SA" Width="60" Height="30" Margin="10,0,0,0"></CheckBox>
<CheckBox Content="BB" Width="60" Height="30" Margin="10,0,0,0"></CheckBox>
<CheckBox Content="TA" Width="40" Height="30" Margin="5,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowTSCommand}"></dxmvvm:EventToCommand>
<dxmvvm:EventToCommand EventName="Unchecked" Command="{Binding Path=HideTSCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</CheckBox>
<CheckBox Content="SA" Width="40" Height="30" Margin="5,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowSACommand}"></dxmvvm:EventToCommand>
<dxmvvm:EventToCommand EventName="Unchecked" Command="{Binding Path=HideSACommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</CheckBox>
<CheckBox Content="BB" Width="40" Height="30" Margin="5,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowBBCommand}"></dxmvvm:EventToCommand>
<dxmvvm:EventToCommand EventName="Unchecked" Command="{Binding Path=HideBBCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</CheckBox>
<Rectangle Width="2" VerticalAlignment="Stretch" Fill="Red"></Rectangle>
<CheckBox Content="RGB" Width="60" Height="30" Margin="10,0,0,0"></CheckBox>
<CheckBox Content="Key" Width="60" Height="30" Margin="10,0,0,0"></CheckBox>
<CheckBox Content="KeyedPreveiew" Width="60" Height="30" Margin="10,0,0,0"></CheckBox>
<RadioButton Content="RGB" Width="40" Height="30" Margin="5,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowRGBCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Content="Key" Width="40" Height="30" Margin="5,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowKeyCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Content="KeyedPreveiew" Width="60" Height="30" Margin="5,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=ShowKeyPreviewCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
</StackPanel>
</Grid>
<!-- VIZ引擎 -->
......
......@@ -24,8 +24,9 @@ namespace VIZ.TVP.Service
/// 获取GH资源文件夹
/// </summary>
/// <param name="url">GH请求地址</param>
/// <param name="parent">父级节点</param>
/// <returns>GH资源树根节点</returns>
public List<GHResourceFolderModel> GetGHResourceFolders(string url)
public List<GHResourceFolderModel> GetGHResourceFolders(string url, GHResourceFolderModel parent)
{
List<GHResourceFolderModel> list = new List<GHResourceFolderModel>();
......@@ -39,6 +40,12 @@ namespace VIZ.TVP.Service
// 名称
child.Name = entry_node.title;
// 路径
if (parent != null)
{
child.Path = string.IsNullOrWhiteSpace(parent.Path) ? $"{child.Name}" : $"{parent.Path}/{child.Name}";
}
// 类型
if (entry_node.categorys.Any(p => p.term == GH_Category_Term_Enums.Project))
{
......@@ -54,7 +61,7 @@ namespace VIZ.TVP.Service
if (link_down == null)
continue;
List<GHResourceFolderModel> child_list = this.GetGHResourceFolders(link_down.href);
List<GHResourceFolderModel> child_list = this.GetGHResourceFolders(link_down.href, child);
foreach (GHResourceFolderModel item in child_list)
{
......@@ -72,8 +79,9 @@ namespace VIZ.TVP.Service
/// 获取GH资源文件
/// </summary>
/// <param name="url">GH请求地址</param>
/// <param name="parent">所属文件夹</param>
/// <returns>GH资源文件</returns>
public List<GHResourceFileModel> GetGHResourceFiles(string url)
public List<GHResourceFileModel> GetGHResourceFiles(string url, GHResourceFolderModel parent)
{
List<GHResourceFileModel> list = new List<GHResourceFileModel>();
......@@ -83,12 +91,13 @@ namespace VIZ.TVP.Service
{
GHResourceFileModel child = new GHResourceFileModel();
child.EntryNode = entry_node;
// 名称
child.FloderModel = parent;
child.Name = entry_node.title;
child.Src = entry_node.content.src;
child.Thumbnail = entry_node.thumbnail.url;
child.MimeType = entry_node.content.type;
child.Path = $"{parent.Path}/{child.Name}";
// 图片
if (entry_node.categorys.Any(p => p.term == GH_Category_Term_Enums.IMAGE))
......
......@@ -16,14 +16,16 @@ namespace VIZ.TVP.Service
/// 获取GH资源文件夹
/// </summary>
/// <param name="url">GH请求地址</param>
/// <param name="parent">父级节点</param>
/// <returns>GH资源树根节点</returns>
List<GHResourceFolderModel> GetGHResourceFolders(string url);
List<GHResourceFolderModel> GetGHResourceFolders(string url, GHResourceFolderModel parent);
/// <summary>
/// 获取GH资源文件
/// </summary>
/// <param name="url">GH请求地址</param>
/// <param name="parent">所属文件夹</param>
/// <returns>GH资源文件</returns>
List<GHResourceFileModel> GetGHResourceFiles(string url);
List<GHResourceFileModel> GetGHResourceFiles(string url, GHResourceFolderModel parent);
}
}
......@@ -14,6 +14,20 @@ namespace VIZ.TVP.Service
public class VizCommandService : IVizCommandService
{
/// <summary>
/// 设置场景
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
public void SetObject(TVPConnectionModel connection, string scene, VizLayerEnum layer)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER*{layer} SET_OBJECT SCENE*{scene}");
}
/// <summary>
/// 播放
/// </summary>
/// <param name="connection">连接</param>
......@@ -24,31 +38,131 @@ namespace VIZ.TVP.Service
if (connection == null)
throw new ArgumentNullException(nameof(connection));
if (layer == VizLayerEnum.RENDERER)
if (string.IsNullOrWhiteSpace(scene))
{
if (string.IsNullOrWhiteSpace(scene))
{
connection.EndpointManager.Send("RENDERER*STAGE START");
}
else
{
connection.EndpointManager.Send($"RENDERER*STAGE*DIRECTOR*{scene} START");
}
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE START");
}
else
{
if (string.IsNullOrWhiteSpace(scene))
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE START");
}
else
{
connection.EndpointManager.Send($"RENDERER SET_OBJECT SCENE*MyTestProject/Scenes/{scene}");
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE*DIRECTOR*MyTestProject/Scenes/{scene} START");
//connection.EndpointManager.Send($"0 RENDERER*{layer}*STAGE*DIRECTOR*{scene} START");
}
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE*DIRECTOR*{scene} START");
}
}
/// <summary>
/// 继续
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
public void Continue(TVPConnectionModel connection, string scene, VizLayerEnum layer)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
if (string.IsNullOrWhiteSpace(scene))
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE CONTINUE");
}
else
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE*DIRECTOR*{scene} CONTINUE");
}
}
/// <summary>
/// 停止
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
public void Stop(TVPConnectionModel connection, string scene, VizLayerEnum layer)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
if (string.IsNullOrWhiteSpace(scene))
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE STOP");
}
else
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE*DIRECTOR*{scene} STOP");
}
}
/// <summary>
/// 显示安全框
/// </summary>
/// <param name="connection">连接</param>
/// <param name="show">是否显示</param>
public void ShowTS(TVPConnectionModel connection, bool show)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER SET_TITLE_AREA {(show ? 1 : 0)}");
}
/// <summary>
/// 显示安区域
/// </summary>
/// <param name="connection">连接</param>
/// <param name="show">是否显示</param>
public void ShowSA(TVPConnectionModel connection, bool show)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER SET_SAFE_AREA {(show ? 1 : 0)}");
}
/// <summary>
/// 显示边界框
/// </summary>
/// <param name="connection">连接</param>
/// <param name="show">是否显示</param>
public void ShowBB(TVPConnectionModel connection, bool show)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER SHOW_BOUNDING_BOX {(show ? 1 : 0)}");
}
/// <summary>
/// 显示RGB
/// </summary>
/// <param name="connection">连接</param>
public void ShowRGB(TVPConnectionModel connection)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER SET_KEY 0,RENDERER*KEY_INTERNAL*ACTIVE SET 0");
}
/// <summary>
/// 显示键
/// </summary>
/// <param name="connection">连接</param>
public void ShowKey(TVPConnectionModel connection)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER SET_KEY 1,RENDERER*KEY_INTERNAL*ACTIVE SET 0");
}
/// <summary>
/// 显示预览键
/// </summary>
/// <param name="connection">连接</param>
public void ShowKeyPreview(TVPConnectionModel connection)
{
if (connection == null)
throw new ArgumentNullException(nameof(connection));
connection.EndpointManager.Send($"RENDERER SET_KEY 0,RENDERER*KEY_INTERNAL*IMAGE RESET,RENDERER*KEY_INTERNAL*ACTIVE SET 1");
}
}
}
......@@ -14,11 +14,74 @@ namespace VIZ.TVP.Service
public interface IVizCommandService
{
/// <summary>
/// 设置场景
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
void SetObject(TVPConnectionModel connection, string scene, VizLayerEnum layer);
/// <summary>
/// 播放
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
void Start(TVPConnectionModel connection, string scene, VizLayerEnum layer);
/// <summary>
/// 继续
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
void Continue(TVPConnectionModel connection, string scene, VizLayerEnum layer);
/// <summary>
/// 停止
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">图层</param>
void Stop(TVPConnectionModel connection, string scene, VizLayerEnum layer);
/// <summary>
/// 显示安全框
/// </summary>
/// <param name="connection">连接</param>
/// <param name="show">是否显示</param>
void ShowTS(TVPConnectionModel connection, bool show);
/// <summary>
/// 显示安区域
/// </summary>
/// <param name="connection">连接</param>
/// <param name="show">是否显示</param>
void ShowSA(TVPConnectionModel connection, bool show);
/// <summary>
/// 显示边界框
/// </summary>
/// <param name="connection">连接</param>
/// <param name="show">是否显示</param>
void ShowBB(TVPConnectionModel connection, bool show);
/// <summary>
/// 显示RGB
/// </summary>
/// <param name="connection">连接</param>
void ShowRGB(TVPConnectionModel connection);
/// <summary>
/// 显示键
/// </summary>
/// <param name="connection">连接</param>
void ShowKey(TVPConnectionModel connection);
/// <summary>
/// 显示预览键
/// </summary>
/// <param name="connection">连接</param>
void ShowKeyPreview(TVPConnectionModel connection);
}
}
......@@ -30,7 +30,7 @@ namespace VIZ.TVP.Storage
/// <summary>
/// GH 端口
/// </summary>
public int GH_Port { get; set; } = 19396;
public int GH_Port { get; set; } = 19398;
/// <summary>
/// GH 服务名
......
......@@ -38,6 +38,11 @@ namespace VIZ.TVP.Storage
public string SceneName { get; set; }
/// <summary>
/// 路径
/// </summary>
public string Path { get; set; }
/// <summary>
/// 缩略图
/// </summary>
public string Thumbnail { get; set; }
......
......@@ -33,6 +33,11 @@ namespace VIZ.TVP.Storage
public string SceneName { get; set; }
/// <summary>
/// 路径
/// </summary>
public string Path { get; set; }
/// <summary>
/// 缩略图
/// </summary>
public string Thumbnail { get; set; }
......
......@@ -28,12 +28,6 @@ namespace VIZ.TVP.Storage
/// 背景层
/// </summary>
[Description("背景层")]
BACK_LAYER,
/// <summary>
/// 渲染层
/// </summary>
[Description("渲染层")]
RENDERER
BACK_LAYER
}
}
......@@ -31,7 +31,7 @@ namespace VIZ.TVP.UnitTest
public void GHResourceServiceTest_GetFolder()
{
GHResourceService service = new GHResourceService();
var query = service.GetGHResourceFolders("http://localhost:19398/folders/");
var query = service.GetGHResourceFolders("http://localhost:19398/folders/", null);
}
}
}
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