Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
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
潘栩锋
Thick-Common
Commits
945d9eb7
Commit
945d9eb7
authored
Apr 11, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化 定点图 X轴,恢复 F1 格式
2.优化 CurveCollection, CurveCell 精简代码
parent
cf55a664
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
46 deletions
+134
-46
FixGraphVm.cs
...ck.Base/FLY.Thick.Base.UI/UiModule/FixGraph/FixGraphVm.cs
+1
-1
CurveCell.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Common/CurveCell.cs
+3
-11
ICurveService.cs
...t.FLY.Thick.Base/FLY.Thick.Base/IService/ICurveService.cs
+2
-7
CurveCollection.cs
...t.FLY.Thick.Base/FLY.Thick.Base/Server/CurveCollection.cs
+128
-27
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/UiModule/FixGraph/FixGraphVm.cs
View file @
945d9eb7
...
...
@@ -122,7 +122,7 @@ namespace FLY.Thick.Base.UI.UiModule
{
int
index
=
(
int
)
x
;
double
s
=
Interval
.
TotalSeconds
*
index
*
values_scale
;
return
$"
{
s
:
F
0
}
s"
;
return
$"
{
s
:
F
1
}
s"
;
};
YFormatter
=
(
y
)
=>
y
.
ToString
(
"F1"
);
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Common/CurveCell.cs
View file @
945d9eb7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.IO
;
using
Misc
;
using
System.Xml
;
using
System.ComponentModel
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
namespace
FLY.Thick.Base.Common
{
...
...
@@ -67,7 +59,7 @@ namespace FLY.Thick.Base.Common
/// <summary>
/// 曲线类型
/// </summary>
public
enum
CurveType
public
enum
CurveType
{
/// <summary>
/// 自然对数
...
...
@@ -82,7 +74,7 @@ namespace FLY.Thick.Base.Common
/// </summary>
X2
}
public
enum
CurveCorrectWay
public
enum
CurveCorrectWay
{
/// <summary>
/// 单点校正时,比例放大
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/IService/ICurveService.cs
View file @
945d9eb7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Collections.ObjectModel
;
using
FLY.Thick.Base.Common
;
using
System.ComponentModel
;
using
FLY.Thick.Base.Common
;
namespace
FLY.Thick.Base.IService
{
...
...
@@ -17,7 +12,7 @@ namespace FLY.Thick.Base.IService
/// <summary>
/// 标记,用于告诉 客户端,当前的曲线类型, 自然对数 / 直线拟合 / 二次拟合
/// </summary>
CurveType
Flag
{
get
;
}
CurveType
Flag
{
get
;
}
/// <summary>
/// 曲线
/// </summary>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/CurveCollection.cs
View file @
945d9eb7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
using
AutoMapper
;
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.IService
;
using
AutoMapper
;
using
System.IO
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
namespace
FLY.Thick.Base.Server
{
...
...
@@ -32,11 +28,11 @@ namespace FLY.Thick.Base.Server
#
endregion
public
event
ActiveEventHandler
ActiveEvent
;
public
struct
ExChange
{
public
ExChange
(
int
orgAd
,
int
currAd
)
{
public
ExChange
(
int
orgAd
,
int
currAd
)
{
OrgAD
=
orgAd
;
CurrAD
=
currAd
;
}
...
...
@@ -49,7 +45,7 @@ namespace FLY.Thick.Base.Server
List
<
ExChange
>
RevisingCurves
=
new
List
<
ExChange
>();
private
string
param_path
=
"curve.json"
;
public
CurveCollection
()
public
CurveCollection
()
{
SetDefault
();
ReviseCurve
();
...
...
@@ -61,7 +57,8 @@ namespace FLY.Thick.Base.Server
this
.
param_path
=
param_path
;
SetDefault
();
if
(!
Load
())
{
if
(!
Load
())
{
Save
();
}
Curves
=
Curves
.
OrderBy
(
c
=>
c
.
Value
).
ToArray
();
...
...
@@ -69,7 +66,7 @@ namespace FLY.Thick.Base.Server
ReviseCurve
();
}
void
SetDefault
()
void
SetDefault
()
{
CorrectWay
=
CurveCorrectWay
.
OnePointIsScale
;
Flag
=
CurveType
.
E
;
...
...
@@ -82,7 +79,7 @@ namespace FLY.Thick.Base.Server
new
CurveCell
()
{
AD
=
5650
,
Value
=
440
},
new
CurveCell
()
{
AD
=
3779
,
Value
=
528
},
new
CurveCell
()
{
AD
=
2513
,
Value
=
616
},
new
CurveCell
()
{
AD
=
1660
,
Value
=
704
}
new
CurveCell
()
{
AD
=
1660
,
Value
=
704
}
};
}
public
void
Apply
(
CurveCorrectWay
correctWay
,
CurveType
flag
,
CurveCell2
[]
curves
)
...
...
@@ -94,7 +91,6 @@ namespace FLY.Thick.Base.Server
ClearExChange
();
ReviseCurve
();
ActiveEvent
?.
Invoke
(
this
);
Save
();
}
...
...
@@ -170,7 +166,8 @@ namespace FLY.Thick.Base.Server
{
c
.
RevisedAD
=
(
int
)(
c
.
AD
*
ux
);
}
}
break
;
}
break
;
default
:
//case CurveCorrectWay.OnePointIsOffset:
{
...
...
@@ -180,7 +177,8 @@ namespace FLY.Thick.Base.Server
{
c
.
RevisedAD
=
c
.
AD
+
x
;
}
}
break
;
}
break
;
}
return
true
;
...
...
@@ -201,7 +199,7 @@ namespace FLY.Thick.Base.Server
}
}
#
region
E
#
region
Ad
To
Value
double
AD2Value_E
(
int
ad
,
AD2ValueFlag
flag
)
{
...
...
@@ -231,10 +229,10 @@ namespace FLY.Thick.Base.Server
break
;
}
}
if
(
i
>=
Curves
.
Count
())
if
(
i
>=
Curves
.
Count
())
i
=
Curves
.
Count
()
-
1
;
if
(
i
==
0
)
if
(
i
==
0
)
i
=
1
;
var
c0
=
Curves
[
i
-
1
];
...
...
@@ -257,8 +255,8 @@ namespace FLY.Thick.Base.Server
return
value
;
}
#
endregion
#
region
线性
double
AD2Value_Line
(
int
ad
,
AD2ValueFlag
flag
)
{
int
i
;
...
...
@@ -295,7 +293,8 @@ namespace FLY.Thick.Base.Server
}
}
}
else
{
else
{
if
(
isDescending
)
//降序排列
{
for
(
i
=
0
;
i
<
Curves
.
Count
();
i
++)
...
...
@@ -317,7 +316,7 @@ namespace FLY.Thick.Base.Server
}
}
}
if
(
i
>=
Curves
.
Count
())
i
=
Curves
.
Count
()
-
1
;
if
(
i
==
0
)
i
=
1
;
...
...
@@ -338,7 +337,7 @@ namespace FLY.Thick.Base.Server
value
=
(
ad2
-
ad0
)
*
u
+
c0
.
Value
;
return
value
;
}
#
endregion
public
double
AD2Value
(
int
ad
,
AD2ValueFlag
flag
)
{
...
...
@@ -354,6 +353,108 @@ namespace FLY.Thick.Base.Server
}
return
value
;
}
#
endregion
#
region
Value
To
Ad
/// <summary>
/// 基本没有用
/// </summary>
/// <param name="value"></param>
/// <param name="flag"></param>
/// <returns></returns>
public
int
Value2Ad
(
double
value
,
AD2ValueFlag
flag
)
{
int
ad
;
switch
(
Flag
)
{
case
CurveType
.
Line
:
ad
=
Value2Ad_Line
(
value
,
flag
);
break
;
default
:
ad
=
Value2Ad_E
(
value
,
flag
);
break
;
}
return
ad
;
}
int
Value2Ad_E
(
double
value
,
AD2ValueFlag
flag
)
{
int
i
;
int
ad
;
if
(
Curves
.
Count
()
<
1
)
return
-
1
;
for
(
i
=
0
;
i
<
Curves
.
Count
();
i
++)
{
if
(
value
>
Curves
[
i
].
Value
)
continue
;
else
break
;
}
if
(
i
>=
Curves
.
Count
())
i
=
Curves
.
Count
()
-
1
;
if
(
i
==
0
)
i
=
1
;
var
c0
=
Curves
[
i
-
1
];
var
c1
=
Curves
[
i
];
double
ad0
,
ad1
,
ad2
;
if
(
flag
==
AD2ValueFlag
.
NoRevised
)
{
ad0
=
Math
.
Log
(
c0
.
AD
,
Math
.
E
);
ad1
=
Math
.
Log
(
c1
.
AD
,
Math
.
E
);
//ad2 = Math.Log(ad, Math.E);
}
else
{
ad0
=
Math
.
Log
(
c0
.
RevisedAD
,
Math
.
E
);
ad1
=
Math
.
Log
(
c1
.
RevisedAD
,
Math
.
E
);
//ad2 = Math.Log(ad, Math.E);
}
double
u
=
(
c1
.
Value
-
c0
.
Value
)
/
(
ad1
-
ad0
);
ad2
=
(
value
-
c0
.
Value
)
/
u
+
ad0
;
ad
=
(
int
)
Math
.
Round
(
Math
.
Pow
(
Math
.
E
,
ad2
));
return
ad
;
}
int
Value2Ad_Line
(
double
value
,
AD2ValueFlag
flag
)
{
int
i
;
int
ad
;
if
(
Curves
.
Count
()
<
2
)
return
-
1
;
for
(
i
=
0
;
i
<
Curves
.
Count
();
i
++)
{
if
(
value
>
Curves
[
i
].
Value
)
continue
;
else
break
;
}
if
(
i
>=
Curves
.
Count
())
i
=
Curves
.
Count
()
-
1
;
if
(
i
==
0
)
i
=
1
;
var
c0
=
Curves
[
i
-
1
];
var
c1
=
Curves
[
i
];
double
ad0
,
ad1
,
ad2
;
if
(
flag
==
AD2ValueFlag
.
NoRevised
)
{
ad0
=
c0
.
AD
;
ad1
=
c1
.
AD
;
}
else
{
ad0
=
c0
.
RevisedAD
;
ad1
=
c1
.
RevisedAD
;
}
double
u
=
(
c1
.
Value
-
c0
.
Value
)
/
(
ad1
-
ad0
);
ad2
=
(
value
-
c0
.
Value
)
/
u
+
ad0
;
ad
=
(
int
)
Math
.
Round
(
ad2
);
return
ad
;
}
#
endregion
public
bool
Load
()
...
...
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