Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Mar 18, 2023
1 parent dbfdc04 commit bf7a46f
Show file tree
Hide file tree
Showing 15 changed files with 508 additions and 372 deletions.
29 changes: 29 additions & 0 deletions Crystallography.Controls/CheckLocation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

namespace Crystallography.Controls
{
public static class CheckLocation
{
public static void Adjust(Form form)
{
double fX = form.Location.X, fY = form.Location.Y, fW = form.Size.Width, fH = form.Size.Height;

var needsAdjust = true;
foreach (var scr in Screen.AllScreens)
{
double bX = scr.Bounds.X, bY = scr.Bounds.Y, bW = scr.Bounds.Width, bH = scr.Bounds.Height;
//どれかのウィンドウの中に20%以上含まれていたら、needsAdjustをfalse (=更新の必要なし) にする。
if ((fX - bX) / fW > -0.8 && (bX + bW - fX - fW) / fW > -0.8 && (fY - bY) / fH > -0.8 && (bY + bH - fY - fH) / fH > -0.8)
needsAdjust = false;
}

if (needsAdjust)
{
var scr = Screen.AllScreens.First(e => e.DeviceName == Screen.FromControl(form).DeviceName);
form.Location = new Point(scr.Bounds.X + 100, scr.Bounds.Y + 100);
}
}
}
}
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.3.8.0528</AssemblyVersion>
<FileVersion>2023.3.8.0528</FileVersion>
<AssemblyVersion>2023.3.18.0710</AssemblyVersion>
<FileVersion>2023.3.18.0710</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.Controls/Numeric/NumericBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,14 @@ public string ToolTip
public string HeaderText { set => labelHeader.Text = value; get => labelHeader.Text; }

[Category("Font && Color")]
[Localizable(true)]
[DefaultValue(typeof(Padding), "0,0,0,0")]

public Padding HeaderMargin { set => labelHeader.Margin = value; get => labelHeader.Margin; }


[Localizable(true)]
[DefaultValue(typeof(Font), "Segoe UI Symbol, 9.75pt")]
[Category("Font && Color")]

public Font HeaderFont { set => labelHeader.Font = value; get => labelHeader.Font; }

[DefaultValue(typeof(Color), "ControlText")]
Expand Down Expand Up @@ -218,6 +217,7 @@ public string ToolTip
public Color TextBoxBackColor { set => textBox.BackColor = value; get => textBox.BackColor; }

[DefaultValue(typeof(Font), "Segoe UI Symbol, 9.75pt")]
[Localizable(true)]
[Category("Font && Color")]
/// <summary>
/// font
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Atom/AtomStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2667,8 +2667,8 @@ public double FactorImaginaryAnnular(double kV, Vector3DBase g, double m, double
f_kPlusG += A * Math.Exp(-kPlusG * B / 100);
}
return f_kMinusG * f_kPlusG * (1 - Math.Exp(m * (gLen2 - kMinusG - kPlusG))); ;// * sinThetaを外に出して、少しでも早く
}, 0, 2 * Math.PI, 30) * sinθ;
}, inner, outer, 80);
}, 0, 2 * Math.PI, 20) * sinθ;
}, inner, outer, 60);
return gamma * k0 / 2 * result * 0.01;
}

Expand Down
52 changes: 48 additions & 4 deletions Crystallography/Atom/Atoms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Drawing;
using System.Numerics;
using System.Xml.Serialization;
using static System.Net.Mime.MediaTypeNames;

namespace Crystallography;

Expand Down Expand Up @@ -554,6 +553,11 @@ public enum Type { U, B }
/// </summary>
public double Biso000 => (B11 * a2 + B22 * b2 + B33 * c2 + 2 * B12 * ab + 2 * B23 * bc + 2 * B31 * ca) * 4.0 / 3.0;

/// <summary>
/// 温度因子がゼロの場合はtrue
/// </summary>
public bool IsZero => UseIso ? Biso == 0 : B11 == 0 && B22 == 0 && B33 == 0 && B12 == 0 && B23 == 0 && B31 == 0;

/// <summary>
/// unit: nm^2
/// </summary>
Expand Down Expand Up @@ -607,28 +611,68 @@ public enum Type { U, B }
/// </summary>
public double B31_err => OriginalType == Type.B ? Aniso31_err : Aniso31_err * coeff31;



#endregion

#region U type. Getのみ
/// <summary>
/// 単位は nm^2
/// </summary>
public double Uiso => OriginalType == Type.U ? Iso : Iso / PI2 / 8;
/// <summary>
/// 単位は nm^2
/// </summary>
public double Uiso_err => OriginalType == Type.U ? Iso_err : Iso_err / PI2 / 8;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U11 => OriginalType == Type.U ? Aniso11 : Aniso11 / coeff11;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U22 => OriginalType == Type.U ? Aniso22 : Aniso22 / coeff22;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U33 => OriginalType == Type.U ? Aniso33 : Aniso33 / coeff33;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U12 => OriginalType == Type.U ? Aniso12 : Aniso12 / coeff12;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U23 => OriginalType == Type.U ? Aniso23 : Aniso23 / coeff23;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U31 => OriginalType == Type.U ? Aniso31 : Aniso31 / coeff31;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U11_err => OriginalType == Type.U ? Aniso11_err : Aniso11_err / coeff11;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U22_err => OriginalType == Type.U ? Aniso22_err : Aniso22_err / coeff22;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U33_err => OriginalType == Type.U ? Aniso33_err : Aniso33_err / coeff33;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U12_err => OriginalType == Type.U ? Aniso12_err : Aniso12_err / coeff12;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U23_err => OriginalType == Type.U ? Aniso23_err : Aniso23_err / coeff23;
/// <summary>
/// 単位は nm^2
/// </summary>
public double U31_err => OriginalType == Type.U ? Aniso31_err : Aniso31_err / coeff31;
#endregion

#region オリジナルの値
#region オリジナルの値
/// <summary>
/// 単位は nm^2
/// </summary>
Expand Down
Loading

0 comments on commit bf7a46f

Please sign in to comment.