Commit 01ee45d7 authored by 潘栩锋's avatar 潘栩锋 🚴
parents fadc3776 68de2af9
...@@ -19,7 +19,7 @@ namespace FLY.ControlLibrary.Themes ...@@ -19,7 +19,7 @@ namespace FLY.ControlLibrary.Themes
AreaColors = new List<SolidColorBrush>(); AreaColors = new List<SolidColorBrush>();
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
AreaColors.Add(resourceDictionary[$"AreaColor{i}"] as SolidColorBrush); AreaColors.Add(resourceDictionary[$"AreaColors{i}"] as SolidColorBrush);
randomColors = new List<SolidColorBrush>(); randomColors = new List<SolidColorBrush>();
randomColors.AddRange(resourceDictionary["RandomColors"] as IEnumerable<SolidColorBrush>); randomColors.AddRange(resourceDictionary["RandomColors"] as IEnumerable<SolidColorBrush>);
......
#!/bin/bash
dest_path="../FLYAD7_Simulation_Wpf/bin/Debug"
src_path="资料/*"
if [ -e $dest_path ]; then
rm -rf $dest_path
fi
mkdir -p $dest_path
echo 复制 资料
cp -rf $src_path $dest_path
if [ $? != 0 ]; then
echo 复制失败
exit 1
fi
echo 完成
\ No newline at end of file
...@@ -500,5 +500,109 @@ namespace Misc ...@@ -500,5 +500,109 @@ namespace Misc
} }
return data_new; return data_new;
} }
/// <summary>
/// 对环形数据 分区移位
/// </summary>
/// <param name="data">原始数据</param>
/// <param name="map">key=old_idx, value=new_idx</param>
/// <returns></returns>
public static double[] Map(IEnumerable<double> data, Dictionary<int, int> map)
{
if (map == null || map.Count() == 0)
return data.ToArray();
double[] data_new = new double[data.Count()];
if (map.Count() == 1)
{
//只是平移而已
int old_idx0 = map.Keys.ElementAt(0);
int new_idx0 = map[old_idx0];
for (int i = 0; i < data.Count(); i++)
{
int new_idx = i;
int old_idx = (old_idx0 - new_idx0) + new_idx;
if (old_idx >= data.Count())
old_idx -= data.Count();
else if (old_idx < 0)
old_idx += data.Count();
data_new[new_idx] = data.ElementAt(old_idx);
}
return data_new;
}
for (int i = 0; i < map.Count(); i++)
{
int old_idx0 = map.Keys.ElementAt(i);
int new_idx0 = map[old_idx0];
int i_next = i + 1;
if (i_next >= map.Count())
i_next = 0;
int old_idx1 = map.Keys.ElementAt(i_next);
int new_idx1 = map[old_idx1];
int cnt = new_idx1 - new_idx0;
if (cnt < 0)
cnt += data.Count();
int cnt_old = old_idx1 - old_idx0;
if (cnt_old < 0)
cnt_old += data.Count();
double w = 1.0 * cnt_old / cnt;
for (int j = 0; j < cnt; j++)
{
int new_idx = j + new_idx0;
if (new_idx >= data.Count())
new_idx -= data.Count();
double old_idx = j * w + old_idx0;
int o1 = (int)Math.Ceiling(old_idx);
int o0 = (int)old_idx;
if (o0 == o1)
{
int old_idx_0 = o0;
if (old_idx_0 >= data.Count())
old_idx_0 -= data.Count();
data_new[new_idx] = data.ElementAt(old_idx_0);
}
else
{
int old_idx_0 = o0;
if (old_idx_0 >= data.Count())
old_idx_0 -= data.Count();
int old_idx_1 = o1;
if (old_idx_1 >= data.Count())
old_idx_1 -= data.Count();
if (double.IsNaN(data.ElementAt(old_idx_1)) && double.IsNaN(data.ElementAt(old_idx_0)))
{
data_new[new_idx] = (data.ElementAt(old_idx_1) * (old_idx - o0) + data.ElementAt(old_idx_0) * (o1 - old_idx));
}
else if (double.IsNaN(data.ElementAt(old_idx_0)))
{
data_new[new_idx] = data.ElementAt(old_idx_0);
}
else if (double.IsNaN(data.ElementAt(old_idx_1)))
{
data_new[new_idx] = data.ElementAt(old_idx_1);
}
else
{
data_new[new_idx] = double.NaN;
}
}
}
}
return data_new;
}
} }
} }
...@@ -117,7 +117,7 @@ namespace Misc ...@@ -117,7 +117,7 @@ namespace Misc
else else
{ {
cell.ToValue<T>(); cell.ToValue<T>();
var type = cell.Value.GetType(); //var type = cell.Value.GetType();
return (T)cell.Value; return (T)cell.Value;
} }
...@@ -133,12 +133,26 @@ namespace Misc ...@@ -133,12 +133,26 @@ namespace Misc
/// <param name="propertyName"></param> /// <param name="propertyName"></param>
/// <param name="defaultValue"></param> /// <param name="defaultValue"></param>
public void SetBinding<T>(INotifyPropertyChanged target, string propertyName, T defaultValue) public void SetBinding<T>(INotifyPropertyChanged target, string propertyName, T defaultValue)
{
SetBinding<T>(target, propertyName, propertyName, defaultValue);
}
/// <summary>
/// 双向绑定
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="src"></param>
/// <param name="target"></param>
/// <param name="propertyName"></param>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
public void SetBinding<T>(INotifyPropertyChanged target, string propertyName, string key, T defaultValue)
{ {
Type type_s = target.GetType(); Type type_s = target.GetType();
System.Reflection.PropertyInfo pi_t = type_s.GetProperty(propertyName); System.Reflection.PropertyInfo pi_t = type_s.GetProperty(propertyName);
if (pi_t == null) if (pi_t == null)
return; return;
object obj = GetValue<T>(propertyName, defaultValue); object obj = this.GetValue<T>(key, defaultValue);
pi_t.SetValue(target, obj); pi_t.SetValue(target, obj);
target.PropertyChanged += (s, e) => target.PropertyChanged += (s, e) =>
...@@ -146,19 +160,19 @@ namespace Misc ...@@ -146,19 +160,19 @@ namespace Misc
if (e.PropertyName == propertyName) if (e.PropertyName == propertyName)
{ {
object o = pi_t.GetValue(target); object o = pi_t.GetValue(target);
SetValue(propertyName, o); this.SetValue(key, o);
} }
}; };
ValueChanged += (s, e) => ValueChanged += (s, e) =>
{ {
if (e.Key == propertyName) { if (e.Key == key)
object o = GetValue<T>(propertyName, defaultValue); {
pi_t.SetValue(target, o); pi_t.SetValue(target, e.Value);
} }
}; };
} }
private string path; private string path;
public event UiParamDictionaryValueChangedHandler ValueChanged; public event UiParamDictionaryValueChangedHandler ValueChanged;
......
...@@ -20,7 +20,16 @@ namespace Misc ...@@ -20,7 +20,16 @@ namespace Misc
return from p in properties select p.Name; return from p in properties select p.Name;
} }
/// <summary>
/// 获取所有属性名。
/// </summary>
/// <returns></returns>
public static IEnumerable<string> GetAllPropertyNames(Type type)
{
PropertyInfo[] properties = type.GetProperties();
return from p in properties select p.Name;
}
/// <summary> /// <summary>
/// 设定参数(属性)的值,触发属性值变化“通知”,writeVal /// 设定参数(属性)的值,触发属性值变化“通知”,writeVal
/// </summary> /// </summary>
......
...@@ -37,6 +37,8 @@ namespace FLY.Thick.Base.UI.CustomMenu ...@@ -37,6 +37,8 @@ namespace FLY.Thick.Base.UI.CustomMenu
public void OnClick() public void OnClick()
{ {
if (!WdPassword.Authorize("CustomSetting"))
return;
var p = this.container.Resolve<PgCustomSections>(); var p = this.container.Resolve<PgCustomSections>();
FlyLayoutManager.NavigationService.Navigate(p); FlyLayoutManager.NavigationService.Navigate(p);
} }
......
...@@ -607,6 +607,9 @@ ...@@ -607,6 +607,9 @@
<PackageReference Include="PropertyChanged.Fody"> <PackageReference Include="PropertyChanged.Fody">
<Version>3.2.5</Version> <Version>3.2.5</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Unity">
<Version>5.11.2</Version>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Images\doorplate.jpg" /> <Resource Include="Images\doorplate.jpg" />
......
...@@ -249,8 +249,10 @@ namespace FLY.Thick.Base.UI ...@@ -249,8 +249,10 @@ namespace FLY.Thick.Base.UI
if (!File.Exists(file_path)) if (!File.Exists(file_path))
{
check_db();
return; return;
}
string json = File.ReadAllText(file_path); string json = File.ReadAllText(file_path);
......
...@@ -87,7 +87,7 @@ namespace FLY.Thick.Base.UI.UiModule ...@@ -87,7 +87,7 @@ namespace FLY.Thick.Base.UI.UiModule
viewModel.GetDatas(out double intervalms, out List<double> datas); viewModel.GetDatas(out double intervalms, out List<double> datas);
PgFixAnalyze p = new PgFixAnalyze(); PgFixAnalyze p = new PgFixAnalyze();
p.Init(intervalms, datas); p.Init(intervalms, datas);
(Application.Current.Properties["NavigationService"] as NavigationService).Navigate(p); MultiLayout.FlyLayoutManager.NavigationService.Navigate(p);
} }
} }
......
...@@ -20,7 +20,7 @@ namespace FLY.Thick.Base.UI.UiModule ...@@ -20,7 +20,7 @@ namespace FLY.Thick.Base.UI.UiModule
} }
public FixGraphParams() public FixGraphParams()
{ {
string path = System.IO.Path.Combine(FlyLayout.BasePath, "fixgraph.xml"); string path = System.IO.Path.Combine(FlyLayout.BasePath, "fixgraph.json");
FilePath = path; FilePath = path;
} }
static FixGraphParams current = null; static FixGraphParams current = null;
......
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -43,7 +43,7 @@ namespace WpfApp1 ...@@ -43,7 +43,7 @@ namespace WpfApp1
{ {
string xmindPath = openFileDialog.FileName; string xmindPath = openFileDialog.FileName;
string outDirPath = System.IO.Path.GetDirectoryName(xmindPath); string outDirPath = System.IO.Path.GetDirectoryName(xmindPath);
if (Xmind2UnityConfigCore.TopicExt.ToUnity(openFileDialog.FileName, null) == 0) { if (Xmind2UnityConfigCore.XMindTypeExt.ToUnity(openFileDialog.FileName, null, true) == 0) {
MessageBox.Show($@"完成 输出到{outDirPath}\unity"); MessageBox.Show($@"完成 输出到{outDirPath}\unity");
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{840673C1-3705-42EC-A3EB-6A7F803590CF}</ProjectGuid> <ProjectGuid>{840673C1-3705-42EC-A3EB-6A7F803590CF}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>Xmind2UnityConfigUI</RootNamespace> <RootNamespace>Xmind2UnityConfigUI</RootNamespace>
<AssemblyName>Xmind2UnityConfigUI</AssemblyName> <AssemblyName>Xmind2UnityConfigUI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
......
...@@ -17,11 +17,15 @@ namespace Xmind2UnityConfig ...@@ -17,11 +17,15 @@ namespace Xmind2UnityConfig
} }
else if (args.Length == 1) else if (args.Length == 1)
{ {
return Xmind2UnityConfigCore.TopicExt.ToUnity(args[0], null); return Xmind2UnityConfigCore.XMindTypeExt.ToUnity(args[0], null, true);
} }
else else if (args.Length == 2)
{ {
return Xmind2UnityConfigCore.TopicExt.ToUnity(args[0], args[1]); return Xmind2UnityConfigCore.XMindTypeExt.ToUnity(args[0], args[1], true);
}
else// if (args.Length == 2)
{
return Xmind2UnityConfigCore.XMindTypeExt.ToUnity(args[0], args[1], bool.Parse(args[2]));
} }
} }
} }
......
...@@ -39,6 +39,12 @@ namespace Xmind2UnityConfigCore ...@@ -39,6 +39,12 @@ namespace Xmind2UnityConfigCore
string filePath = System.IO.Path.Combine(tempPath, "content.json"); string filePath = System.IO.Path.Combine(tempPath, "content.json");
string json = File.ReadAllText(filePath); string json = File.ReadAllText(filePath);
//var xmind = JsonConvert.DeserializeObject<XMindRootTopic[]>(json);
//转义title
//string unescape = System.Text.RegularExpressions.Regex.Unescape(str);
JArray jArray = JsonConvert.DeserializeObject(json) as JArray; JArray jArray = JsonConvert.DeserializeObject(json) as JArray;
var jobject_topic = jArray.First() as JObject; var jobject_topic = jArray.First() as JObject;
...@@ -82,6 +88,7 @@ namespace Xmind2UnityConfigCore ...@@ -82,6 +88,7 @@ namespace Xmind2UnityConfigCore
return topic; return topic;
} }
static void ToUnity(Topic rootTopic, string path) static void ToUnity(Topic rootTopic, string path)
{ {
path = System.IO.Path.Combine(path, "unity"); path = System.IO.Path.Combine(path, "unity");
...@@ -97,6 +104,8 @@ namespace Xmind2UnityConfigCore ...@@ -97,6 +104,8 @@ namespace Xmind2UnityConfigCore
File.WriteAllText(System.IO.Path.Combine(path, "relationship.json"), json); File.WriteAllText(System.IO.Path.Combine(path, "relationship.json"), json);
} }
static RelationShip ToRelationShip(Topic topic, string path) static RelationShip ToRelationShip(Topic topic, string path)
{ {
RelationShip relationShip = new RelationShip(); RelationShip relationShip = new RelationShip();
...@@ -291,4 +300,6 @@ namespace Xmind2UnityConfigCore ...@@ -291,4 +300,6 @@ namespace Xmind2UnityConfigCore
xdoc.Save(filepath); xdoc.Save(filepath);
} }
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xmind2UnityConfigCore
{
public class XMindRootTopic
{
public XMindTopic rootTopic;
public override string ToString()
{
return rootTopic.ToString();
}
}
public class XMindTopic
{
public string title;
public XMindChildren children;
public override string ToString()
{
return title;
}
}
public class XMindChildren
{
public List<XMindTopic> attached;
}
}
This diff is collapsed.
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
<Compile Include="Topic.cs" /> <Compile Include="Topic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TopicExt.cs" /> <Compile Include="TopicExt.cs" />
<Compile Include="XMindType.cs" />
<Compile Include="XMindTypeExt.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
......
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