本文整理汇总了C#中SwissEph类的典型用法代码示例。如果您正苦于以下问题:C# SwissEph类的具体用法?C# SwissEph怎么用?C# SwissEph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SwissEph类属于命名空间,在下文中一共展示了SwissEph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestOnLoadFile
public void TestOnLoadFile()
{
// No file loading defined
using (var target = new SwissEph()) {
Assert.AreEqual("100: not found", target.swe_get_planet_name(SwissEph.SE_AST_OFFSET + 100));
}
// File loading defined, but file not found
using (var target = new SwissEph()) {
target.OnLoadFile += (s, e) => {
e.File = null;
};
Assert.AreEqual("100: not found", target.swe_get_planet_name(SwissEph.SE_AST_OFFSET + 100));
}
// File loading defined
using (var target = new SwissEph()) {
target.OnLoadFile += (s, e) => {
if (e.FileName == @"[ephe]\seasnam.txt") {
e.File = new System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(@"
000096 Aegle
000097 Klotho
000098 Ianthe
000099 Dike
000100 Hekate
000101 Helena
000102 Miriam
000103 Hera
"));
} else
e.File = null;
};
Assert.AreEqual("Hekate", target.swe_get_planet_name(SwissEph.SE_AST_OFFSET + 100));
}
}
示例2: Test_swe_get_planet_name_Fictitious
public void Test_swe_get_planet_name_Fictitious()
{
using (var swe = new SwissEph()) {
Assert.AreEqual("Cupido", swe.swe_get_planet_name(SwissEph.SE_FICT_OFFSET));
Assert.AreEqual("name not found", swe.swe_get_planet_name(SwissEph.SE_FICT_MAX));
}
}
示例3: Test_swe_get_planet_name
public void Test_swe_get_planet_name()
{
using (var swe = new SwissEph()) {
Assert.AreEqual("Sun", swe.swe_get_planet_name(SwissEph.SE_SUN));
Assert.AreEqual("Moon", swe.swe_get_planet_name(SwissEph.SE_MOON));
Assert.AreEqual("Mercury", swe.swe_get_planet_name(SwissEph.SE_MERCURY));
Assert.AreEqual("Venus", swe.swe_get_planet_name(SwissEph.SE_VENUS));
Assert.AreEqual("Earth", swe.swe_get_planet_name(SwissEph.SE_EARTH));
Assert.AreEqual("Mars", swe.swe_get_planet_name(SwissEph.SE_MARS));
Assert.AreEqual("Jupiter", swe.swe_get_planet_name(SwissEph.SE_JUPITER));
Assert.AreEqual("Saturn", swe.swe_get_planet_name(SwissEph.SE_SATURN));
Assert.AreEqual("Uranus", swe.swe_get_planet_name(SwissEph.SE_URANUS));
Assert.AreEqual("Neptune", swe.swe_get_planet_name(SwissEph.SE_NEPTUNE));
Assert.AreEqual("Pluto", swe.swe_get_planet_name(SwissEph.SE_PLUTO));
Assert.AreEqual("mean Node", swe.swe_get_planet_name(SwissEph.SE_MEAN_NODE));
Assert.AreEqual("true Node", swe.swe_get_planet_name(SwissEph.SE_TRUE_NODE));
Assert.AreEqual("mean Apogee", swe.swe_get_planet_name(SwissEph.SE_MEAN_APOG));
Assert.AreEqual("osc. Apogee", swe.swe_get_planet_name(SwissEph.SE_OSCU_APOG));
Assert.AreEqual("Chiron", swe.swe_get_planet_name(SwissEph.SE_CHIRON));
Assert.AreEqual("Pholus", swe.swe_get_planet_name(SwissEph.SE_PHOLUS));
Assert.AreEqual("Ceres", swe.swe_get_planet_name(SwissEph.SE_CERES));
Assert.AreEqual("Pallas", swe.swe_get_planet_name(SwissEph.SE_PALLAS));
Assert.AreEqual("Juno", swe.swe_get_planet_name(SwissEph.SE_JUNO));
Assert.AreEqual("Vesta", swe.swe_get_planet_name(SwissEph.SE_VESTA));
Assert.AreEqual("intp. Apogee", swe.swe_get_planet_name(SwissEph.SE_INTP_APOG));
Assert.AreEqual("intp. Perigee", swe.swe_get_planet_name(SwissEph.SE_INTP_PERG));
Assert.AreEqual("Pluto", swe.swe_get_planet_name(SwissEph.SE_AST_OFFSET + 134340));
// Call twice the same planet for code coverage in swe_get_planet_name optimization planet name
Assert.AreEqual("Pluto", swe.swe_get_planet_name(SwissEph.SE_PLUTO));
Assert.AreEqual("Pluto", swe.swe_get_planet_name(SwissEph.SE_PLUTO));
}
}
示例4: Test_swe_set_topo
public void Test_swe_set_topo()
{
using (var swe = new SwissEph())
{
double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL);
double[] geopos = new double[] { 47.853333, 5.333889, 468 };
double[] xin1 = new double[6],
xin2 = new double[6],
xin3 = new double[6]
; String serr = null;
swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin1, ref serr);
Assert.AreEqual(0, xin1[0], 0.0000000000001);
Assert.AreEqual(0, xin1[1], 0.0000000000001);
Assert.AreEqual(0, xin1[2], 0.0000000000001);
swe.swe_set_topo(geopos[0], geopos[1], geopos[2]);
swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin2, ref serr);
Assert.AreEqual(142.78180233188, xin2[0], 0.000000000001);
Assert.AreEqual(6.06728560368863E-05, xin2[1], 0.000000000001);
Assert.AreEqual(1.01269577772231, xin2[2], 0.000000000001);
swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin3, ref serr);
Assert.AreEqual(142.78180233188, xin3[0], 0.000000000001);
Assert.AreEqual(6.06728560368863E-05, xin3[1], 0.0000000000001);
Assert.AreEqual(1.01269577772231, xin3[2], 0.0000000000001);
}
}
示例5: TestVersion
public void TestVersion()
{
using (var target = new SwissEph()) {
Assert.AreEqual("2.01.00", target.swe_version());
Assert.AreEqual("2.01.00-net-0006", target.swe_dotnet_version());
}
}
示例6: TestRevjul
public void TestRevjul()
{
using (var swe = new SwissEph()) {
int y = 0, m = 0, d = 0; double ut = 0;
swe.swe_revjul(0, SwissEph.SE_GREG_CAL, ref y, ref m, ref d, ref ut);
Assert.AreEqual(-4713, y);
Assert.AreEqual(11, m);
Assert.AreEqual(24, d);
Assert.AreEqual(12.0, ut);
swe.swe_revjul(0, SwissEph.SE_JUL_CAL, ref y, ref m, ref d, ref ut);
Assert.AreEqual(-4712, y);
Assert.AreEqual(1, m);
Assert.AreEqual(1, d);
Assert.AreEqual(12.0, ut);
swe.swe_revjul(2000000, SwissEph.SE_GREG_CAL, ref y, ref m, ref d, ref ut);
Assert.AreEqual(763, y);
Assert.AreEqual(9, m);
Assert.AreEqual(18, d);
Assert.AreEqual(12.0, ut);
swe.swe_revjul(2000000, SwissEph.SE_JUL_CAL, ref y, ref m, ref d, ref ut);
Assert.AreEqual(763, y);
Assert.AreEqual(9, m);
Assert.AreEqual(14, d);
Assert.AreEqual(12.0, ut);
swe.swe_revjul(2456774.20375, SwissEph.SE_GREG_CAL, ref y, ref m, ref d, ref ut);
Assert.AreEqual(2014, y);
Assert.AreEqual(4, m);
Assert.AreEqual(26, d);
Assert.AreEqual(16.8899999968708, ut, 0.0000000000001);
Assert.AreEqual(16.0, Math.Floor(ut));
Assert.AreEqual(1013, Math.Floor(ut * 60.0));
Assert.AreEqual(53.0, (Math.Floor(ut * 60.0)) % 60.0);
Assert.AreEqual(60803, Math.Floor(ut * 3600.0));
Assert.AreEqual(23.9999887347221, (ut * 3600.0) % 60.0, 0.0000000000001);
Assert.AreEqual(23, Math.Floor(ut * 3600.0) % 60.0);
swe.swe_revjul(2442275.47916667, SwissEph.SE_GREG_CAL, ref y, ref m, ref d, ref ut);
Assert.AreEqual(1974, y);
Assert.AreEqual(8, m);
Assert.AreEqual(15, d);
Assert.AreEqual(23.5000000745058, ut, 0.0000000000001);
Assert.AreEqual(23.0, Math.Floor(ut));
Assert.AreEqual(1410.0, Math.Floor(ut * 60.0));
Assert.AreEqual(30.0, (Math.Floor(ut * 60.0)) % 60.0);
Assert.AreEqual(84600, Math.Floor(ut * 3600.0));
Assert.AreEqual(0, Math.Floor(ut * 3600.0) % 60.0);
}
}
示例7: TestDMS
public void TestDMS()
{
using (var sweph=new SwissEph()) {
Assert.AreEqual("nan", sweph.DMS(double.NaN, 0, false));
Assert.AreEqual(" 0° 0' 0.0000", sweph.DMS(0, 0, false));
Assert.AreEqual(" 0° 0' 0.00000", sweph.DMS(0, 0, true));
Assert.AreEqual(" 12° 0' 0.0000", sweph.DMS(12, 0, false));
Assert.AreEqual(" 12° 0' 0.00000", sweph.DMS(12, 0, true));
Assert.AreEqual(" -12° 0' 0.0000", sweph.DMS(-12, 0, false));
Assert.AreEqual(" -12° 0' 0.00000", sweph.DMS(-12, 0, true));
Assert.AreEqual(" 123° 0' 0.0000", sweph.DMS(123, 0, false));
Assert.AreEqual(" 123° 0' 0.00000", sweph.DMS(123, 0, true));
Assert.AreEqual("-123° 0' 0.0000", sweph.DMS(-123, 0, false));
Assert.AreEqual("-123° 0' 0.00000", sweph.DMS(-123, 0, true));
Assert.AreEqual(" 12° 5'59.10000", sweph.DMS(12.1, 0, false));
Assert.AreEqual(" 12° 9' 0.0000", sweph.DMS(12.15, 0, false));
Assert.AreEqual(" 12°30' 0.00000", sweph.DMS(12.5, 0, true));
Assert.AreEqual(" 98°45'55.5556", sweph.DMS(98.7654321, 0, false));
Assert.AreEqual(" 98°45'55.55556", sweph.DMS(98.7654321, 0, true));
Assert.AreEqual(" 98h45'55.5556", sweph.DMS(98.7654321, SwissEph.SEFLG_EQUATORIAL, false));
Assert.AreEqual(" 98h45'55.55556", sweph.DMS(98.7654321, SwissEph.SEFLG_EQUATORIAL, true));
Assert.AreEqual(" 8 cn 45'55.5556", sweph.DMS(98.7654321, SwissEph.BIT_ZODIAC, false));
Assert.AreEqual(" 8 cn 45'55.55556", sweph.DMS(98.7654321, SwissEph.BIT_ZODIAC, true));
Assert.AreEqual(" 12°09'17.10000", sweph.DMS(12.155, SwissEph.BIT_LZEROES, false));
Assert.AreEqual(" 12°09'17.100000", sweph.DMS(12.155, SwissEph.BIT_LZEROES, true));
Assert.AreEqual(" 98°45'56\"", sweph.DMS(98.7654321, SwissEph.BIT_ROUND_SEC, false));
Assert.AreEqual(" 98°45'56\"", sweph.DMS(98.7654321, SwissEph.BIT_ROUND_SEC, true));
Assert.AreEqual(" 98°46'", sweph.DMS(98.7654321, SwissEph.BIT_ROUND_MIN, false));
Assert.AreEqual(" 98°46'", sweph.DMS(98.7654321, SwissEph.BIT_ROUND_MIN, true));
Assert.AreEqual(" 120ar009'17.10000", sweph.DMS(12.155, SwissEph.BIT_ZODIAC | SwissEph.BIT_LZEROES, false));
Assert.AreEqual(" 120ar009'17.100000", sweph.DMS(12.155, SwissEph.BIT_ZODIAC | SwissEph.BIT_LZEROES, true));
Assert.AreEqual(" 8 cn 45'56\"", sweph.DMS(98.7654321, SwissEph.BIT_ZODIAC | SwissEph.BIT_ROUND_SEC, false));
Assert.AreEqual(" 8 cn 45'56\"", sweph.DMS(98.7654321, SwissEph.BIT_ZODIAC | SwissEph.BIT_ROUND_SEC, true));
Assert.AreEqual(" 8 cn 46", sweph.DMS(98.7654321, SwissEph.BIT_ZODIAC | SwissEph.BIT_ROUND_MIN, false));
Assert.AreEqual(" 8 cn 46", sweph.DMS(98.7654321, SwissEph.BIT_ZODIAC | SwissEph.BIT_ROUND_MIN, true));
}
}
示例8: Test_swe_azalt_rev
public void Test_swe_azalt_rev()
{
using (var swe = new SwissEph()) {
double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL);
double[] geopos = new double[] { 47.853333, 5.333889, 468 };
double[] xin = new double[] { 249.64242931513104, -32.8340765334715 };
double[] xaz = new double[6];
swe.swe_azalt_rev(tjd, SwissEph.SE_ECL2HOR, geopos, xin, xaz);
Assert.AreEqual(142.779825047858, xaz[0], 0.000000000001);
Assert.AreEqual(-1.90862916755642E-05, xaz[1], 0.0000000000001);
Assert.AreEqual(0, xaz[2], 0.0000000000001);
}
}
示例9: Test_swe_azalt
public void Test_swe_azalt()
{
using (var swe = new SwissEph()) {
double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL);
double[] geopos = new double[] { 47.853333, 5.333889, 468 };
double[] xin = new double[6], xaz = new double[6]; String serr = null;
swe.swe_calc(tjd, SwissEph.SE_SUN, SwissEph.SEFLG_MOSEPH, xin, ref serr);
swe.swe_azalt(tjd, SwissEph.SE_ECL2HOR, geopos, 0, 0, xin, xaz);
Assert.AreEqual(249.642425229358, xaz[0], 0.000000001);
Assert.AreEqual(-32.8340786097275, xaz[1], 0.0000000001);
Assert.AreEqual(-32.8340786097275, xaz[2], 0.0000000001);
}
}
示例10: Test_swe_get_planet_name_Trace
public void Test_swe_get_planet_name_Trace()
{
using (var swe = new SwissEph()) {
List<String> trace_out = new List<string>();
swe.OnTrace += (s, e) => {
trace_out.Add(e.Message);
};
Assert.AreEqual("Sun", swe.swe_get_planet_name(SwissEph.SE_SUN));
CollectionAssert.AreEqual(new String[] {
"swe_get_planet_name: 0\tSun\t"
}, trace_out);
}
}
示例11: Test_swe_calc_ut
public void Test_swe_calc_ut()
{
using (var swe = new SwissEph()) {
double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL);
double[] geopos = new double[] { 47.853333, 5.333889, 468 };
double[] xx = new double[6]; String serr = null;
swe.swe_calc_ut(tjd, SwissEph.SE_SUN, SwissEph.SEFLG_MOSEPH, xx, ref serr);
Assert.AreEqual(142.780328315269, xx[0], 0.000000000001);
Assert.AreEqual(-1.57808056001826E-05, xx[1], 0.0000000000001);
Assert.AreEqual(1.01267244282576, xx[2], 0.0000000000001);
Assert.AreEqual(0, xx[3], 0.0000000000001);
Assert.AreEqual(0, xx[4], 0.0000000000001);
Assert.AreEqual(0, xx[5], 0.0000000000001);
}
}
示例12: Test_swe_calc
public void Test_swe_calc()
{
using (var swe = new SwissEph()) {
double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL);
double[] geopos = new double[] { 47.853333, 5.333889, 468 };
double[] xx = new double[6]; String serr = null;
swe.swe_calc(tjd, SwissEph.SE_SUN, SwissEph.SEFLG_MOSEPH, xx, ref serr);
Assert.AreEqual(142.779826288975, xx[0], 0.000000000001);
Assert.AreEqual(-1.57665386141208E-05, xx[1], 0.0000000000001);
Assert.AreEqual(1.01267253822512, xx[2], 0.0000000000001);
Assert.AreEqual(0, xx[3], 0.0000000000001);
Assert.AreEqual(0, xx[4], 0.0000000000001);
Assert.AreEqual(0, xx[5], 0.0000000000001);
}
}
示例13: TestJulDay
public void TestJulDay()
{
using (var swe = new SwissEph()) {
Assert.AreEqual(0.0, swe.swe_julday(-4713, 11, 24, 12.0, SwissEph.SE_GREG_CAL));
Assert.AreEqual(0.0, swe.swe_julday(-4712, 1, 1, 12.0, SwissEph.SE_JUL_CAL));
Assert.AreEqual(2000000.0, swe.swe_julday(763, 9, 18, 12.0, SwissEph.SE_GREG_CAL));
Assert.AreEqual(2000000.0, swe.swe_julday(763, 9, 14, 12.0, SwissEph.SE_JUL_CAL));
Assert.AreEqual(1063884, swe.swe_julday(-1800, 9, 18, 12.0, SwissEph.SE_GREG_CAL));
Assert.AreEqual(1063865, swe.swe_julday(-1800, 9, 14, 12.0, SwissEph.SE_JUL_CAL));
Assert.AreEqual(2442275.47916667, swe.swe_julday(1974, 8, 15, 23 + 30 / 60.0 + 0 / 3600.0, SwissEph.SE_GREG_CAL), 0.00000001);
Assert.AreEqual(2456774.20375, swe.swe_julday(2014, 4, 26, SwissEph.GetHourValue(16, 53, 24), SwissEph.SE_GREG_CAL));
}
}
示例14: TestGetPlanetName_Asteroid
public void TestGetPlanetName_Asteroid()
{
using (var swe = new SwissEph()) {
Assert.AreEqual("10000", swe.swe_get_planet_name(SwissEph.SE_AST_OFFSET));
}
}
示例15: SwemMoon
public SwemMoon(SwissEph se)
: base(se)
{
}