init GitHub version "Hermes 1.0b"
This commit is contained in:
parent
abc4fb2c21
commit
1e06ba1042
59 changed files with 380125 additions and 0 deletions
28
3rd/css/autocomplete.css
Normal file
28
3rd/css/autocomplete.css
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
.ac-renderer{
|
||||
position: absolute;
|
||||
border: 1px solid #ccc;
|
||||
margin-top: -1px;
|
||||
max-width: 400px;
|
||||
}
|
||||
.ac-row {
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.ac-row .suffix {
|
||||
font-size:.8em;
|
||||
color:#ccc;
|
||||
padding:.1em 0 .1em 5px;
|
||||
}
|
||||
.ac-row .type {
|
||||
font-size:.7em;
|
||||
color:#aaa;
|
||||
display:block;
|
||||
width:100%;
|
||||
}
|
||||
.ac-highlighted {font-weight: bold;}
|
||||
.ac-active {background-color: #eee;}
|
||||
125
3rd/js/autocomplete.js
Normal file
125
3rd/js/autocomplete.js
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
// Part of open-source library at https://github.com/klokantech/javascript
|
||||
// compiled from https://github.com/klokantech/javascript/blob/master/src/osmnamesautocomplete.js
|
||||
(function(){var g,aa=aa||{},n=this;function p(a){return void 0!==a}function ba(a,b){var c=a.split("."),d=n;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&p(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}function ca(){}
|
||||
function ea(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
|
||||
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function q(a){return"array"==ea(a)}function fa(a){var b=ea(a);return"array"==b||"object"==b&&"number"==typeof a.length}function r(a){return"string"==typeof a}function t(a){return"number"==typeof a}function ga(a){return"function"==ea(a)}function ha(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ia(a){return a[ja]||(a[ja]=++ka)}var ja="closure_uid_"+(1E9*Math.random()>>>0),ka=0;
|
||||
function la(a,b,c){return a.call.apply(a.bind,arguments)}function ma(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function v(a,b,c){v=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?la:ma;return v.apply(null,arguments)}var w=Date.now||function(){return+new Date};
|
||||
function x(a,b){function c(){}c.prototype=b.prototype;a.o=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Uc=function(a,c,f){for(var h=Array(arguments.length-2),k=2;k<arguments.length;k++)h[k-2]=arguments[k];return b.prototype[c].apply(a,h)}};var na;var oa=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function pa(a){if(!qa.test(a))return a;-1!=a.indexOf("\x26")&&(a=a.replace(ra,"\x26amp;"));-1!=a.indexOf("\x3c")&&(a=a.replace(sa,"\x26lt;"));-1!=a.indexOf("\x3e")&&(a=a.replace(ta,"\x26gt;"));-1!=a.indexOf('"')&&(a=a.replace(ua,"\x26quot;"));-1!=a.indexOf("'")&&(a=a.replace(va,"\x26#39;"));-1!=a.indexOf("\x00")&&(a=a.replace(wa,"\x26#0;"));return a}
|
||||
var ra=/&/g,sa=/</g,ta=/>/g,ua=/"/g,va=/'/g,wa=/\x00/g,qa=/[\x00&<>"']/;function xa(a){return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")}function ya(a,b){return a<b?-1:a>b?1:0};var za=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(r(a))return r(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},y=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=r(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Aa=Array.prototype.filter?function(a,b,c){return Array.prototype.filter.call(a,
|
||||
b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,h=r(a)?a.split(""):a,k=0;k<d;k++)if(k in h){var l=h[k];b.call(c,l,k,a)&&(e[f++]=l)}return e},Ba=Array.prototype.map?function(a,b,c){return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=r(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e};
|
||||
function Ca(a){var b;a:{b=Da;for(var c=a.length,d=r(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return 0>b?null:r(a)?a.charAt(b):a[b]}function Ea(a,b){var c=za(a,b),d;(d=0<=c)&&Array.prototype.splice.call(a,c,1);return d}function Fa(a){return Array.prototype.concat.apply(Array.prototype,arguments)}function Ga(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]}
|
||||
function Ha(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};function Ia(a,b,c){for(var d in a)b.call(c,a[d],d,a)}function Ja(a,b){for(var c in a)if(b.call(void 0,a[c],c,a))return!0;return!1}function Ka(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function La(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function Ma(){var a=Na,b;for(b in a)return!1;return!0}var Oa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
|
||||
function Pa(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Oa.length;f++)c=Oa[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}}function Qa(a){var b=arguments.length;if(1==b&&q(arguments[0]))return Qa.apply(null,arguments[0]);for(var c={},d=0;d<b;d++)c[arguments[d]]=!0;return c};function Ra(a){if(a.L&&"function"==typeof a.L)return a.L();if(r(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Ka(a)}
|
||||
function Sa(a,b,c){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,c);else if(fa(a)||r(a))y(a,b,c);else{var d;if(a.getKeys&&"function"==typeof a.getKeys)d=a.getKeys();else if(a.L&&"function"==typeof a.L)d=void 0;else if(fa(a)||r(a)){d=[];for(var e=a.length,f=0;f<e;f++)d.push(f)}else d=La(a);for(var e=Ra(a),f=e.length,h=0;h<f;h++)b.call(c,e[h],d&&d[h],a)}};function Ta(a,b){this.P={};this.h=[];this.f=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.addAll(a)}g=Ta.prototype;g.Ab=function(){return this.f};g.L=function(){Ua(this);for(var a=[],b=0;b<this.h.length;b++)a.push(this.P[this.h[b]]);return a};g.getKeys=function(){Ua(this);return this.h.concat()};g.qa=function(a){return Va(this.P,a)};
|
||||
g.equals=function(a,b){if(this===a)return!0;if(this.f!=a.Ab())return!1;var c=b||Wa;Ua(this);for(var d,e=0;d=this.h[e];e++)if(!c(this.get(d),a.get(d)))return!1;return!0};function Wa(a,b){return a===b}g.isEmpty=function(){return 0==this.f};g.clear=function(){this.P={};this.f=this.h.length=0};g.remove=function(a){return Va(this.P,a)?(delete this.P[a],this.f--,this.h.length>2*this.f&&Ua(this),!0):!1};
|
||||
function Ua(a){if(a.f!=a.h.length){for(var b=0,c=0;b<a.h.length;){var d=a.h[b];Va(a.P,d)&&(a.h[c++]=d);b++}a.h.length=c}if(a.f!=a.h.length){for(var e={},c=b=0;b<a.h.length;)d=a.h[b],Va(e,d)||(a.h[c++]=d,e[d]=1),b++;a.h.length=c}}g.get=function(a,b){return Va(this.P,a)?this.P[a]:b};g.set=function(a,b){Va(this.P,a)||(this.f++,this.h.push(a));this.P[a]=b};g.addAll=function(a){var b;a instanceof Ta?(b=a.getKeys(),a=a.L()):(b=La(a),a=Ka(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};
|
||||
g.forEach=function(a,b){for(var c=this.getKeys(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};g.clone=function(){return new Ta(this)};function Va(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Xa=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Ya(a,b){if(a)for(var c=a.split("\x26"),d=0;d<c.length;d++){var e=c[d].indexOf("\x3d"),f,h=null;0<=e?(f=c[d].substring(0,e),h=c[d].substring(e+1)):f=c[d];b(f,h?decodeURIComponent(h.replace(/\+/g," ")):"")}};function Za(a,b,c){this.f=this.m=null;this.G=a||null;this.Bc=!!c}function z(a){a.m||(a.m=new Ta,a.f=0,a.G&&Ya(a.G,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))}g=Za.prototype;g.Ab=function(){z(this);return this.f};g.add=function(a,b){z(this);this.G=null;a=$a(this,a);var c=this.m.get(a);c||this.m.set(a,c=[]);c.push(b);this.f+=1;return this};g.remove=function(a){z(this);a=$a(this,a);return this.m.qa(a)?(this.G=null,this.f-=this.m.get(a).length,this.m.remove(a)):!1};
|
||||
g.clear=function(){this.m=this.G=null;this.f=0};g.isEmpty=function(){z(this);return 0==this.f};g.qa=function(a){z(this);a=$a(this,a);return this.m.qa(a)};g.getKeys=function(){z(this);for(var a=this.m.L(),b=this.m.getKeys(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};g.L=function(a){z(this);var b=[];if(r(a))this.qa(a)&&(b=Fa(b,this.m.get($a(this,a))));else{a=this.m.L();for(var c=0;c<a.length;c++)b=Fa(b,a[c])}return b};
|
||||
g.set=function(a,b){z(this);this.G=null;a=$a(this,a);this.qa(a)&&(this.f-=this.m.get(a).length);this.m.set(a,[b]);this.f+=1;return this};g.get=function(a,b){var c=a?this.L(a):[];return 0<c.length?String(c[0]):b};g.setValues=function(a,b){this.remove(a);0<b.length&&(this.G=null,this.m.set($a(this,a),Ga(b)),this.f+=b.length)};
|
||||
g.toString=function(){if(this.G)return this.G;if(!this.m)return"";for(var a=[],b=this.m.getKeys(),c=0;c<b.length;c++)for(var d=b[c],e=encodeURIComponent(String(d)),d=this.L(d),f=0;f<d.length;f++){var h=e;""!==d[f]&&(h+="\x3d"+encodeURIComponent(String(d[f])));a.push(h)}return this.G=a.join("\x26")};g.clone=function(){var a=new Za;a.G=this.G;this.m&&(a.m=this.m.clone(),a.f=this.f);return a};function $a(a,b){var c=String(b);a.Bc&&(c=c.toLowerCase());return c}
|
||||
g.extend=function(a){for(var b=0;b<arguments.length;b++)Sa(arguments[b],function(a,b){this.add(b,a)},this)};var ab;a:{var bb=n.navigator;if(bb){var cb=bb.userAgent;if(cb){ab=cb;break a}}ab=""}function A(a){return-1!=ab.indexOf(a)};function db(a){db[" "](a);return a}db[" "]=ca;function eb(a,b){try{return db(a[b]),!0}catch(c){}return!1}function fb(a,b){var c=gb;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var hb=A("Opera"),B=A("Trident")||A("MSIE"),D=A("Edge"),ib=D||B,E=A("Gecko")&&!(-1!=ab.toLowerCase().indexOf("webkit")&&!A("Edge"))&&!(A("Trident")||A("MSIE"))&&!A("Edge"),G=-1!=ab.toLowerCase().indexOf("webkit")&&!A("Edge"),H=A("Macintosh");function jb(){var a=n.document;return a?a.documentMode:void 0}var kb;
|
||||
a:{var lb="",mb=function(){var a=ab;if(E)return/rv\:([^\);]+)(\)|;)/.exec(a);if(D)return/Edge\/([\d\.]+)/.exec(a);if(B)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(G)return/WebKit\/(\S+)/.exec(a);if(hb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();mb&&(lb=mb?mb[1]:"");if(B){var nb=jb();if(null!=nb&&nb>parseFloat(lb)){kb=String(nb);break a}}kb=lb}var gb={};
|
||||
function I(a){return fb(a,function(){for(var b=0,c=oa(String(kb)).split("."),d=oa(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var h=c[f]||"",k=d[f]||"";do{h=/(\d*)(\D*)(.*)/.exec(h)||["","","",""];k=/(\d*)(\D*)(.*)/.exec(k)||["","","",""];if(0==h[0].length&&0==k[0].length)break;b=ya(0==h[1].length?0:parseInt(h[1],10),0==k[1].length?0:parseInt(k[1],10))||ya(0==h[2].length,0==k[2].length)||ya(h[2],k[2]);h=h[3];k=k[3]}while(0==b)}return 0<=b})}
|
||||
var ob=n.document,J=ob&&B?jb()||("CSS1Compat"==ob.compatMode?parseInt(kb,10):5):void 0;var pb=!B||9<=Number(J);!E&&!B||B&&9<=Number(J)||E&&I("1.9.1");B&&I("9");function K(a,b){this.x=p(a)?a:0;this.y=p(b)?b:0}g=K.prototype;g.clone=function(){return new K(this.x,this.y)};g.equals=function(a){return a instanceof K&&(this==a?!0:this&&a?this.x==a.x&&this.y==a.y:!1)};function qb(a,b){return new K(a.x-b.x,a.y-b.y)}g.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};g.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};g.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};
|
||||
g.translate=function(a,b){a instanceof K?(this.x+=a.x,this.y+=a.y):(this.x+=Number(a),t(b)&&(this.y+=b));return this};g.scale=function(a,b){var c=t(b)?b:a;this.x*=a;this.y*=c;return this};function rb(a,b){this.width=a;this.height=b}g=rb.prototype;g.clone=function(){return new rb(this.width,this.height)};g.nc=function(){return this.width*this.height};g.isEmpty=function(){return!this.nc()};g.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};g.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};g.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
|
||||
g.scale=function(a,b){var c=t(b)?b:a;this.width*=a;this.height*=c;return this};function L(a){return a?new sb(M(a)):na||(na=new sb)}function tb(a,b){Ia(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:ub.hasOwnProperty(d)?a.setAttribute(ub[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})}
|
||||
var ub={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function vb(a){var b=wb(a);a=xb(a);return B&&I("10")&&a.pageYOffset!=b.scrollTop?new K(b.scrollLeft,b.scrollTop):new K(a.pageXOffset||b.scrollLeft,a.pageYOffset||b.scrollTop)}
|
||||
function wb(a){return a.scrollingElement?a.scrollingElement:!G&&yb(a)?a.documentElement:a.body||a.documentElement}function xb(a){return a.parentWindow||a.defaultView}function zb(a,b,c,d){function e(c){c&&b.appendChild(r(c)?a.createTextNode(c):c)}for(;d<c.length;d++){var f=c[d];!fa(f)||ha(f)&&0<f.nodeType?e(f):y(Ab(f)?Ga(f):f,e)}}function yb(a){return"CSS1Compat"==a.compatMode}function Bb(a){for(var b;b=a.firstChild;)a.removeChild(b)}
|
||||
function M(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function Ab(a){if(a&&"number"==typeof a.length){if(ha(a))return"function"==typeof a.item||"string"==typeof a.item;if(ga(a))return"function"==typeof a.item}return!1}function Cb(a){return Db(a,function(a){return"FORM"==a.nodeName&&!0})}function Db(a,b){for(var c=0;a;){if(b(a))return a;a=a.parentNode;c++}return null}function sb(a){this.v=a||n.document||document}g=sb.prototype;
|
||||
g.getElement=function(a){return r(a)?this.v.getElementById(a):a};g.getElementsByTagName=function(a,b){return(b||this.v).getElementsByTagName(String(a))};g.setProperties=tb;
|
||||
g.zb=function(a,b,c){var d=this.v,e=arguments,f=String(e[0]),h=e[1];if(!pb&&h&&(h.name||h.type)){f=["\x3c",f];h.name&&f.push(' name\x3d"',pa(h.name),'"');if(h.type){f.push(' type\x3d"',pa(h.type),'"');var k={};Pa(k,h);delete k.type;h=k}f.push("\x3e");f=f.join("")}f=d.createElement(f);h&&(r(h)?f.className=h:q(h)?f.className=h.join(" "):tb(f,h));2<e.length&&zb(d,f,e,2);return f};g.createElement=function(a){return this.v.createElement(String(a))};g.createTextNode=function(a){return this.v.createTextNode(String(a))};
|
||||
g.appendChild=function(a,b){a.appendChild(b)};g.append=function(a,b){zb(M(a),a,arguments,1)};g.canHaveChildren=function(a){if(1!=a.nodeType)return!1;switch(a.tagName){case "APPLET":case "AREA":case "BASE":case "BR":case "COL":case "COMMAND":case "EMBED":case "FRAME":case "HR":case "IMG":case "INPUT":case "IFRAME":case "ISINDEX":case "KEYGEN":case "LINK":case "NOFRAMES":case "NOSCRIPT":case "META":case "OBJECT":case "PARAM":case "SCRIPT":case "SOURCE":case "STYLE":case "TRACK":case "WBR":return!1}return!0};
|
||||
g.Kc=Bb;g.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};g.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};function Eb(a){if(a.classList)return a.classList;a=a.className;return r(a)&&a.match(/\S+/g)||[]}function Fb(a,b){var c;a.classList?c=a.classList.contains(b):(c=Eb(a),c=0<=za(c,b));return c}function Gb(a,b){a.classList?a.classList.add(b):Fb(a,b)||(a.className+=0<a.className.length?" "+b:b)}function Hb(a,b){if(a.classList)y(b,function(b){Gb(a,b)});else{var c={};y(Eb(a),function(a){c[a]=!0});y(b,function(a){c[a]=!0});a.className="";for(var d in c)a.className+=0<a.className.length?" "+d:d}}
|
||||
function Ib(a,b){a.classList?a.classList.remove(b):Fb(a,b)&&(a.className=Aa(Eb(a),function(a){return a!=b}).join(" "))}function Jb(a,b){a.classList?y(b,function(b){Ib(a,b)}):a.className=Aa(Eb(a),function(a){return!(0<=za(b,a))}).join(" ")};function N(){0!=Kb&&(Lb[ia(this)]=this);this.ra=this.ra;this.La=this.La}var Kb=0,Lb={};N.prototype.ra=!1;N.prototype.X=function(){if(!this.ra&&(this.ra=!0,this.l(),0!=Kb)){var a=ia(this);delete Lb[a]}};N.prototype.l=function(){if(this.La)for(;this.La.length;)this.La.shift()()};function Mb(a){a&&"function"==typeof a.X&&a.X()};var Nb=!B||9<=Number(J),Ob=B&&!I("9");!G||I("528");E&&I("1.9b")||B&&I("8")||hb&&I("9.5")||G&&I("528");E&&!I("8")||B&&I("9");function O(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.fa=!1;this.$b=!0}O.prototype.stopPropagation=function(){this.fa=!0};O.prototype.preventDefault=function(){this.defaultPrevented=!0;this.$b=!1};function P(a,b){O.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.ja=this.state=null;if(a){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;e?E&&(eb(e,"nodeName")||(e=null)):"mouseover"==c?e=a.fromElement:
|
||||
"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;null===d?(this.offsetX=G||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=G||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.keyCode=
|
||||
a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.ja=a;a.defaultPrevented&&this.preventDefault()}}x(P,O);P.prototype.stopPropagation=function(){P.o.stopPropagation.call(this);this.ja.stopPropagation?this.ja.stopPropagation():this.ja.cancelBubble=!0};
|
||||
P.prototype.preventDefault=function(){P.o.preventDefault.call(this);var a=this.ja;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Ob)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Pb="closure_listenable_"+(1E6*Math.random()|0);function Qb(a){return!(!a||!a[Pb])}var Rb=0;function Sb(a,b,c,d,e){this.listener=a;this.Na=null;this.src=b;this.type=c;this.pa=!!d;this.Ca=e;this.key=++Rb;this.na=this.za=!1}function Ub(a){a.na=!0;a.listener=null;a.Na=null;a.src=null;a.Ca=null};function Vb(a){this.src=a;this.A={};this.xa=0}g=Vb.prototype;g.add=function(a,b,c,d,e){var f=a.toString();a=this.A[f];a||(a=this.A[f]=[],this.xa++);var h=Wb(a,b,d,e);-1<h?(b=a[h],c||(b.za=!1)):(b=new Sb(b,this.src,f,!!d,e),b.za=c,a.push(b));return b};g.remove=function(a,b,c,d){a=a.toString();if(!(a in this.A))return!1;var e=this.A[a];b=Wb(e,b,c,d);return-1<b?(Ub(e[b]),Array.prototype.splice.call(e,b,1),0==e.length&&(delete this.A[a],this.xa--),!0):!1};
|
||||
function Xb(a,b){var c=b.type;c in a.A&&Ea(a.A[c],b)&&(Ub(b),0==a.A[c].length&&(delete a.A[c],a.xa--))}g.Oa=function(a){a=a&&a.toString();var b=0,c;for(c in this.A)if(!a||c==a){for(var d=this.A[c],e=0;e<d.length;e++)++b,Ub(d[e]);delete this.A[c];this.xa--}return b};g.sa=function(a,b,c,d){a=this.A[a.toString()];var e=-1;a&&(e=Wb(a,b,c,d));return-1<e?a[e]:null};
|
||||
g.hasListener=function(a,b){var c=p(a),d=c?a.toString():"",e=p(b);return Ja(this.A,function(a){for(var h=0;h<a.length;++h)if(!(c&&a[h].type!=d||e&&a[h].pa!=b))return!0;return!1})};function Wb(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.na&&f.listener==b&&f.pa==!!c&&f.Ca==d)return e}return-1};var Yb="closure_lm_"+(1E6*Math.random()|0),Zb={},$b=0;function R(a,b,c,d,e){if(q(b)){for(var f=0;f<b.length;f++)R(a,b[f],c,d,e);return null}c=ac(c);return Qb(a)?a.D(b,c,d,e):bc(a,b,c,!1,d,e)}
|
||||
function bc(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var h=!!e,k=cc(a);k||(a[Yb]=k=new Vb(a));c=k.add(b,c,d,e,f);if(c.Na)return c;d=dc();c.Na=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,h);else if(a.attachEvent)a.attachEvent(ec(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");$b++;return c}
|
||||
function dc(){var a=fc,b=Nb?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function gc(a,b,c,d,e){if(q(b)){for(var f=0;f<b.length;f++)gc(a,b[f],c,d,e);return null}c=ac(c);return Qb(a)?a.lb(b,c,d,e):bc(a,b,c,!0,d,e)}function hc(a,b,c,d,e){if(q(b))for(var f=0;f<b.length;f++)hc(a,b[f],c,d,e);else c=ac(c),Qb(a)?a.F(b,c,d,e):a&&(a=cc(a))&&(b=a.sa(b,c,!!d,e))&&ic(b)}
|
||||
function ic(a){if(t(a)||!a||a.na)return;var b=a.src;if(Qb(b)){Xb(b.O,a);return}var c=a.type,d=a.Na;b.removeEventListener?b.removeEventListener(c,d,a.pa):b.detachEvent&&b.detachEvent(ec(c),d);$b--;(c=cc(b))?(Xb(c,a),0==c.xa&&(c.src=null,b[Yb]=null)):Ub(a)}function ec(a){return a in Zb?Zb[a]:Zb[a]="on"+a}function jc(a,b,c,d){var e=!0;if(a=cc(a))if(b=a.A[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.pa==c&&!f.na&&(f=kc(f,d),e=e&&!1!==f)}return e}
|
||||
function kc(a,b){var c=a.listener,d=a.Ca||a.src;a.za&&ic(a);return c.call(d,b)}
|
||||
function fc(a,b){if(a.na)return!0;if(!Nb){var c;if(!(c=b))a:{c=["window","event"];for(var d=n,e;e=c.shift();)if(null!=d[e])d=d[e];else{c=null;break a}c=d}e=c;c=new P(e,this);d=!0;if(!(0>e.keyCode||void 0!=e.returnValue)){a:{var f=!1;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(l){f=!0}if(f||void 0==e.returnValue)e.returnValue=!0}e=[];for(f=c.currentTarget;f;f=f.parentNode)e.push(f);for(var f=a.type,h=e.length-1;!c.fa&&0<=h;h--){c.currentTarget=e[h];var k=jc(e[h],f,!0,c),d=d&&k}for(h=0;!c.fa&&h<
|
||||
e.length;h++)c.currentTarget=e[h],k=jc(e[h],f,!1,c),d=d&&k}return d}return kc(a,new P(b,this))}function cc(a){a=a[Yb];return a instanceof Vb?a:null}var lc="__closure_events_fn_"+(1E9*Math.random()>>>0);function ac(a){if(ga(a))return a;a[lc]||(a[lc]=function(b){return a.handleEvent(b)});return a[lc]};function S(){N.call(this);this.O=new Vb(this);this.lc=this;this.ob=null}x(S,N);S.prototype[Pb]=!0;g=S.prototype;g.addEventListener=function(a,b,c,d){R(this,a,b,c,d)};g.removeEventListener=function(a,b,c,d){hc(this,a,b,c,d)};
|
||||
g.dispatchEvent=function(a){var b,c=this.ob;if(c)for(b=[];c;c=c.ob)b.push(c);var c=this.lc,d=a.type||a;if(r(a))a=new O(a,c);else if(a instanceof O)a.target=a.target||c;else{var e=a;a=new O(d,c);Pa(a,e)}var e=!0,f;if(b)for(var h=b.length-1;!a.fa&&0<=h;h--)f=a.currentTarget=b[h],e=mc(f,d,!0,a)&&e;a.fa||(f=a.currentTarget=c,e=mc(f,d,!0,a)&&e,a.fa||(e=mc(f,d,!1,a)&&e));if(b)for(h=0;!a.fa&&h<b.length;h++)f=a.currentTarget=b[h],e=mc(f,d,!1,a)&&e;return e};
|
||||
g.l=function(){S.o.l.call(this);this.O&&this.O.Oa(void 0);this.ob=null};g.D=function(a,b,c,d){return this.O.add(String(a),b,!1,c,d)};g.lb=function(a,b,c,d){return this.O.add(String(a),b,!0,c,d)};g.F=function(a,b,c,d){return this.O.remove(String(a),b,c,d)};function mc(a,b,c,d){b=a.O.A[String(b)];if(!b)return!0;b=b.concat();for(var e=!0,f=0;f<b.length;++f){var h=b[f];if(h&&!h.na&&h.pa==c){var k=h.listener,l=h.Ca||h.src;h.za&&Xb(a.O,h);e=!1!==k.call(l,d)&&e}}return e&&0!=d.$b}
|
||||
g.sa=function(a,b,c,d){return this.O.sa(String(a),b,c,d)};g.hasListener=function(a,b){return this.O.hasListener(p(a)?String(a):void 0,b)};function nc(a,b){S.call(this);this.ea=a||1;this.oa=b||n;this.Za=v(this.Qc,this);this.kb=w()}x(nc,S);g=nc.prototype;g.enabled=!1;g.g=null;g.setInterval=function(a){this.ea=a;this.g&&this.enabled?(this.stop(),this.start()):this.g&&this.stop()};
|
||||
g.Qc=function(){if(this.enabled){var a=w()-this.kb;0<a&&a<.8*this.ea?this.g=this.oa.setTimeout(this.Za,this.ea-a):(this.g&&(this.oa.clearTimeout(this.g),this.g=null),this.dispatchEvent("tick"),this.enabled&&(this.g=this.oa.setTimeout(this.Za,this.ea),this.kb=w()))}};g.start=function(){this.enabled=!0;this.g||(this.g=this.oa.setTimeout(this.Za,this.ea),this.kb=w())};g.stop=function(){this.enabled=!1;this.g&&(this.oa.clearTimeout(this.g),this.g=null)};g.l=function(){nc.o.l.call(this);this.stop();delete this.oa};
|
||||
function oc(a,b,c){if(ga(a))c&&(a=v(a,c));else if(a&&"function"==typeof a.handleEvent)a=v(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:n.setTimeout(a,b||0)};function pc(a){a=String(a);if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);};function qc(){}qc.prototype.yb=null;function rc(a){var b;(b=a.yb)||(b={},sc(a)&&(b[0]=!0,b[1]=!0),b=a.yb=b);return b};var tc;function uc(){}x(uc,qc);function vc(a){return(a=sc(a))?new ActiveXObject(a):new XMLHttpRequest}function sc(a){if(!a.Fb&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.Fb=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.Fb}tc=new uc;function wc(a){S.call(this);this.headers=new Ta;this.Wa=a||null;this.W=!1;this.Va=this.a=null;this.Ia=this.ib="";this.ca=this.cb=this.Fa=this.$a=!1;this.Sa=0;this.Ra=null;this.Zb=xc;this.ub=this.Ic=this.jc=!1}x(wc,S);var xc="",yc=/^https?$/i,zc=["POST","PUT"],Ac=[];function Bc(a,b){var c=new wc;Ac.push(c);b&&c.D("complete",b);c.lb("ready",c.rc);c.send(a,void 0,void 0,void 0);return c}g=wc.prototype;g.rc=function(){this.X();Ea(Ac,this)};
|
||||
g.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request\x3d"+this.ib+"; newUri\x3d"+a);b=b?b.toUpperCase():"GET";this.ib=a;this.Ia="";this.$a=!1;this.W=!0;this.a=this.Wa?vc(this.Wa):vc(tc);this.Va=this.Wa?rc(this.Wa):rc(tc);this.a.onreadystatechange=v(this.Vb,this);this.Ic&&"onprogress"in this.a&&(this.a.onprogress=v(function(a){this.Ub(a,!0)},this),this.a.upload&&(this.a.upload.onprogress=v(this.Ub,this)));try{this.cb=!0,this.a.open(b,String(a),!0),
|
||||
this.cb=!1}catch(f){Cc(this,f);return}a=c||"";var e=this.headers.clone();d&&Sa(d,function(a,b){e.set(b,a)});d=Ca(e.getKeys());c=n.FormData&&a instanceof n.FormData;!(0<=za(zc,b))||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset\x3dutf-8");e.forEach(function(a,b){this.a.setRequestHeader(b,a)},this);this.Zb&&(this.a.responseType=this.Zb);"withCredentials"in this.a&&this.a.withCredentials!==this.jc&&(this.a.withCredentials=this.jc);try{Dc(this),0<this.Sa&&((this.ub=Ec(this.a))?
|
||||
(this.a.timeout=this.Sa,this.a.ontimeout=v(this.cc,this)):this.Ra=oc(this.cc,this.Sa,this)),this.Fa=!0,this.a.send(a),this.Fa=!1}catch(f){Cc(this,f)}};function Ec(a){return B&&I(9)&&t(a.timeout)&&p(a.ontimeout)}function Da(a){return"content-type"==a.toLowerCase()}g.cc=function(){"undefined"!=typeof aa&&this.a&&(this.Ia="Timed out after "+this.Sa+"ms, aborting",this.dispatchEvent("timeout"),this.abort(8))};function Cc(a,b){a.W=!1;a.a&&(a.ca=!0,a.a.abort(),a.ca=!1);a.Ia=b;Fc(a);Gc(a)}
|
||||
function Fc(a){a.$a||(a.$a=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))}g.abort=function(){this.a&&this.W&&(this.W=!1,this.ca=!0,this.a.abort(),this.ca=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),Gc(this))};g.l=function(){this.a&&(this.W&&(this.W=!1,this.ca=!0,this.a.abort(),this.ca=!1),Gc(this,!0));wc.o.l.call(this)};g.Vb=function(){this.ra||(this.cb||this.Fa||this.ca?Hc(this):this.Fc())};g.Fc=function(){Hc(this)};
|
||||
function Hc(a){if(a.W&&"undefined"!=typeof aa&&(!a.Va[1]||4!=Ic(a)||2!=a.getStatus()))if(a.Fa&&4==Ic(a))oc(a.Vb,0,a);else if(a.dispatchEvent("readystatechange"),4==Ic(a)){a.W=!1;try{if(Jc(a))a.dispatchEvent("complete"),a.dispatchEvent("success");else{var b;try{b=2<Ic(a)?a.a.statusText:""}catch(c){b=""}a.Ia=b+" ["+a.getStatus()+"]";Fc(a)}}finally{Gc(a)}}}g.Ub=function(a,b){this.dispatchEvent(Kc(a,"progress"));this.dispatchEvent(Kc(a,b?"downloadprogress":"uploadprogress"))};
|
||||
function Kc(a,b){return{type:b,lengthComputable:a.lengthComputable,loaded:a.loaded,total:a.total}}function Gc(a,b){if(a.a){Dc(a);var c=a.a,d=a.Va[0]?ca:null;a.a=null;a.Va=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}}function Dc(a){a.a&&a.ub&&(a.a.ontimeout=null);t(a.Ra)&&(n.clearTimeout(a.Ra),a.Ra=null)}g.fb=function(){return!!this.a};
|
||||
function Jc(a){var b=a.getStatus(),c;a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:c=!0;break a;default:c=!1}if(!c){if(b=0===b)a=String(a.ib).match(Xa)[1]||null,!a&&n.self&&n.self.location&&(a=n.self.location.protocol,a=a.substr(0,a.length-1)),b=!yc.test(a?a.toLowerCase():"");c=b}return c}function Ic(a){return a.a?a.a.readyState:0}g.getStatus=function(){try{return 2<Ic(this)?this.a.status:-1}catch(a){return-1}};
|
||||
g.getResponseHeader=function(a){if(this.a&&4==Ic(this))return a=this.a.getResponseHeader(a),null===a?void 0:a};g.getAllResponseHeaders=function(){return this.a&&4==Ic(this)?this.a.getAllResponseHeaders():""};function Lc(a,b,c){S.call(this);this.U=a;this.Qa=c;this.I=b;R(b,[Mc,Nc,Oc,Pc],this.handleEvent,!1,this);this.K=null;this.j=[];this.Y=-1;this.B=0;this.ba=this.w=null;this.Hb={}}x(Lc,S);g=Lc.prototype;g.Ec=10;g.oc=!0;g.xb=!1;g.kc=!1;g.dc=!1;var Mc="hilite",Nc="select",Pc="dismiss",Oc="canceldismiss";g=Lc.prototype;
|
||||
g.handleEvent=function(a){var b=this.U;if(a.target==this.I)switch(a.type){case Mc:this.T(a.row);break;case Nc:var c=!1;if(t(a.row)){a=a.row;var d=this.j[Qc(this,a)],c=!!d&&b.gb&&b.gb(d);d&&!c&&this.Y!=a&&this.T(a)}c||Rc(this);break;case Oc:Sc(this);break;case Pc:Tc(this)}};g.getTarget=function(){return this.w};g.setTarget=function(a){this.w=a};
|
||||
function Uc(a){for(var b=a.B+a.j.length-1,c=a.Y,d=0;d<a.j.length;d++){if(c>=a.B&&c<b)c++;else if(-1==c)c=a.B;else if(a.xb&&c==b){a.T(-1);break}else if(a.kc&&c==b)c=a.B;else break;if(a.T(c))break}}function Vc(a){for(var b=a.B+a.j.length-1,c=a.Y,d=0;d<a.j.length;d++){if(c>a.B)c--;else if(a.xb&&c==a.B){a.T(-1);break}else if(!a.kc||-1!=c&&c!=a.B)break;else c=b;if(a.T(c))break}}g.T=function(a){var b=Qc(this,a),c=this.j[b];return c&&this.U.gb&&this.U.gb(c)?!1:(this.Y=a,this.I.T(a),-1!=b)};
|
||||
function Rc(a){var b=Qc(a,a.Y);if(-1!=b){var c=a.j[b],d=a.Qa;if(d.c){var e=c.toString();if(p(void 0)?0:d.ma){var f=Wc(d,d.c.value,Xc(d.c)[0]),h=Yc(d,d.c.value);d.Nc.test(e)||(e=e.replace(/[\s\xa0]+$/,"")+d.sc);d.Tc&&(0==f||/^[\s\xa0]*$/.test(h[f-1])||(e=" "+e),f==h.length-1&&(e+=" "));if(e!=h[f]){h[f]=e;e=d.c;(E||B&&I("9"))&&e.blur();e.value=h.join("");for(var k=0,l=0;l<=f;l++)k+=h[l].length;e.focus();f=k;h=d.c;e=f;Zc(h)?h.selectionStart=e:B&&!I("9")&&(k=$c(h),l=k[0],l.inRange(k[1])&&(e=ad(h,e),l.collapse(!0),
|
||||
l.move("character",e),l.select()));h=d.c;Zc(h)?h.selectionEnd=f:B&&!I("9")&&(k=$c(h),e=k[1],k[0].inRange(e)&&(f=ad(h,f),h=ad(h,Xc(h)[0]),e.collapse(!0),e.moveEnd("character",f-h),e.select()))}}else d.c.value=e;d.sb=!0}a.dc?(a.K=null,Tc(a)):a.S();a.dispatchEvent({type:"update",row:c,index:b});a.dc&&a.Qa.update(!0);return!0}a.S();a.dispatchEvent({type:"update",row:null,index:null});return!1}
|
||||
g.S=function(){this.Y=-1;this.K=null;this.B+=this.j.length;this.j=[];window.clearTimeout(this.ba);this.ba=null;this.I.S();this.dispatchEvent("suggestionsupdate");this.dispatchEvent(Pc)};function Tc(a){a.ba||(a.ba=window.setTimeout(v(a.S,a),100))}g.Gb=function(){return this.ba?(window.clearTimeout(this.ba),this.ba=null,!0):!1};function Sc(a){a.Gb()||window.setTimeout(v(a.Gb,a),10)}g.l=function(){Lc.o.l.call(this);delete this.Hb;this.I.X();this.Qa.X();this.U=null};
|
||||
g.Cc=function(a,b,c){this.K==a&&this.qb(b,c)};g.qb=function(a,b){var c="object"==ea(b)&&b,d=(c?c.Vc():b)?Qc(this,this.Y):-1;this.B+=this.j.length;this.j=a;for(var e=[],f=0;f<a.length;++f)e.push({id:this.B+f,data:a[f]});f=null;this.w&&(f=this.Hb[ia(this.w)]||this.w);this.I.mc=f;this.I.qb(e,this.K,this.w);f=this.oc;c&&void 0!==c.wc()&&(f=c.wc());this.Y=-1;(f||0<=d)&&0!=e.length&&this.K&&(0<=d?this.T(this.B+d):Uc(this));this.dispatchEvent("suggestionsupdate")};
|
||||
function Qc(a,b){var c=b-a.B;return 0>c||c>=a.j.length?-1:c}g.update=function(a){this.Qa.update(a)};var bd;Qa("A AREA BUTTON HEAD INPUT LINK MENU META OPTGROUP OPTION PROGRESS STYLE SELECT SOURCE TEXTAREA TITLE TRACK".split(" "));function cd(a,b){b?a.setAttribute("role",b):a.removeAttribute("role")}
|
||||
function dd(a,b,c){q(c)&&(c=c.join(" "));var d="aria-"+b;""===c||void 0==c?(bd||(bd={atomic:!1,autocomplete:"none",dropeffect:"none",haspopup:!1,live:"off",multiline:!1,multiselectable:!1,orientation:"vertical",readonly:!1,relevant:"additions text",required:!1,sort:"none",busy:!1,disabled:!1,hidden:!1,invalid:"false"}),c=bd,b in c?a.setAttribute(d,c[b]):a.removeAttribute(d)):a.setAttribute(d,c)}function ed(a,b){var c="";b&&(c=b.id);dd(a,"activedescendant",c)};function Xc(a){var b=0,c=0;if(Zc(a))b=a.selectionStart,c=-1;else if(B&&!I("9")){var d=$c(a),e=d[0],d=d[1];if(e.inRange(d)){e.setEndPoint("EndToStart",d);if("textarea"==a.type){d.duplicate();b=a=e.text;for(c=!1;!c;)0==e.compareEndPoints("StartToEnd",e)?c=!0:(e.moveEnd("character",-1),e.text==a?b+="\r\n":c=!0);e=[b.length,-1];return e}b=e.text.length;c=-1}}return[b,c]}
|
||||
function $c(a){var b=a.ownerDocument||a.document,c=b.selection.createRange();"textarea"==a.type?(b=b.body.createTextRange(),b.moveToElementText(a)):b=a.createTextRange();return[b,c]}function ad(a,b){"textarea"==a.type&&(b=a.value.substring(0,b).replace(/(\r\n|\r|\n)/g,"\n").length);return b}function Zc(a){try{return"number"==typeof a.selectionStart}catch(b){return!1}};function fd(a){N.call(this);this.ka=a;this.h={}}x(fd,N);var gd=[];g=fd.prototype;g.D=function(a,b,c,d){q(b)||(b&&(gd[0]=b.toString()),b=gd);for(var e=0;e<b.length;e++){var f=R(a,b[e],c||this.handleEvent,d||!1,this.ka||this);if(!f)break;this.h[f.key]=f}return this};g.lb=function(a,b,c,d){return hd(this,a,b,c,d)};function hd(a,b,c,d,e,f){if(q(c))for(var h=0;h<c.length;h++)hd(a,b,c[h],d,e,f);else{b=gc(b,c,d||a.handleEvent,e,f||a.ka||a);if(!b)return a;a.h[b.key]=b}return a}
|
||||
g.F=function(a,b,c,d,e){if(q(b))for(var f=0;f<b.length;f++)this.F(a,b[f],c,d,e);else c=c||this.handleEvent,e=e||this.ka||this,c=ac(c),d=!!d,b=Qb(a)?a.sa(b,c,d,e):a?(a=cc(a))?a.sa(b,c,d,e):null:null,b&&(ic(b),delete this.h[b.key]);return this};g.Oa=function(){Ia(this.h,function(a,b){this.h.hasOwnProperty(b)&&ic(a)},this);this.h={}};g.l=function(){fd.o.l.call(this);this.Oa()};g.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};function id(a,b,c,d,e,f){if(!(B||D||G&&I("525")))return!0;if(H&&e)return jd(a);if(e&&!d)return!1;t(b)&&(b=kd(b));e=17==b||18==b||H&&91==b;if((!c||H)&&e||H&&16==b&&(d||f))return!1;if((G||D)&&d&&c)switch(a){case 220:case 219:case 221:case 192:case 186:case 189:case 187:case 188:case 190:case 191:case 192:case 222:return!1}if(B&&d&&b==a)return!1;switch(a){case 13:return!0;case 27:return!(G||D)}return jd(a)}
|
||||
function jd(a){if(48<=a&&57>=a||96<=a&&106>=a||65<=a&&90>=a||(G||D)&&0==a)return!0;switch(a){case 32:case 43:case 63:case 64:case 107:case 109:case 110:case 111:case 186:case 59:case 189:case 187:case 61:case 188:case 190:case 191:case 192:case 222:case 219:case 220:case 221:return!0;default:return!1}}function kd(a){if(E)a=ld(a);else if(H&&G)a:switch(a){case 93:a=91;break a}return a}
|
||||
function ld(a){switch(a){case 61:return 187;case 59:return 186;case 173:return 189;case 224:return 91;case 0:return 224;default:return a}};function md(a,b){S.call(this);a&&nd(this,a,b)}x(md,S);g=md.prototype;g.b=null;g.Ga=null;g.hb=null;g.Ha=null;g.C=-1;g.Z=-1;g.Ya=!1;
|
||||
var od={3:13,12:144,63232:38,63233:40,63234:37,63235:39,63236:112,63237:113,63238:114,63239:115,63240:116,63241:117,63242:118,63243:119,63244:120,63245:121,63246:122,63247:123,63248:44,63272:46,63273:36,63275:35,63276:33,63277:34,63289:144,63302:45},pd={Up:38,Down:40,Left:37,Right:39,Enter:13,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"U+007F":46,Home:36,End:35,PageUp:33,PageDown:34,Insert:45},qd=B||D||G&&I("525"),rd=H&&E;g=md.prototype;
|
||||
g.xc=function(a){if(G||D)if(17==this.C&&!a.ctrlKey||18==this.C&&!a.altKey||H&&91==this.C&&!a.metaKey)this.Z=this.C=-1;-1==this.C&&(a.ctrlKey&&17!=a.keyCode?this.C=17:a.altKey&&18!=a.keyCode?this.C=18:a.metaKey&&91!=a.keyCode&&(this.C=91));qd&&!id(a.keyCode,this.C,a.shiftKey,a.ctrlKey,a.altKey,a.metaKey)?this.handleEvent(a):(this.Z=kd(a.keyCode),rd&&(this.Ya=a.altKey))};g.zc=function(a){this.Z=this.C=-1;this.Ya=a.altKey};
|
||||
g.handleEvent=function(a){var b=a.ja,c,d,e=b.altKey;B&&"keypress"==a.type?(c=this.Z,d=13!=c&&27!=c?b.keyCode:0):(G||D)&&"keypress"==a.type?(c=this.Z,d=0<=b.charCode&&63232>b.charCode&&jd(c)?b.charCode:0):hb&&!G?(c=this.Z,d=jd(c)?b.keyCode:0):(c=b.keyCode||this.Z,d=b.charCode||0,rd&&(e=this.Ya),H&&63==d&&224==c&&(c=191));var f=c=kd(c);c?63232<=c&&c in od?f=od[c]:25==c&&a.shiftKey&&(f=9):b.keyIdentifier&&b.keyIdentifier in pd&&(f=pd[b.keyIdentifier]);a=f==this.C;this.C=f;b=new sd(f,d,a,b);b.altKey=
|
||||
e;this.dispatchEvent(b)};g.getElement=function(){return this.b};function nd(a,b,c){a.Ha&&a.detach();a.b=b;a.Ga=R(a.b,"keypress",a,c);a.hb=R(a.b,"keydown",a.xc,c,a);a.Ha=R(a.b,"keyup",a.zc,c,a)}g.detach=function(){this.Ga&&(ic(this.Ga),ic(this.hb),ic(this.Ha),this.Ha=this.hb=this.Ga=null);this.b=null;this.Z=this.C=-1};g.l=function(){md.o.l.call(this);this.detach()};function sd(a,b,c,d){P.call(this,d);this.type="key";this.keyCode=a;this.charCode=b;this.repeat=c}x(sd,P);var td=A("iPhone")&&!A("iPod")&&!A("iPad")||A("iPod"),ud=A("iPad");function vd(a,b,c,d){N.call(this);d=d||150;this.ma=null!=c?c:!0;this.va=a||",;";this.sc=this.va.substring(0,1);a=this.ma?"[\\s"+this.va+"]+":"[\\s]+";this.ec=new RegExp("^"+a+"|"+a+"$","g");this.Nc=new RegExp("\\s*["+this.va+"]$");this.Lb=b||"";this.Hc=!1;this.Gc=this.ma;this.g=0<d?new nc(d):null;this.s=new fd(this);this.ya=new fd(this);this.ua=new md;this.Jb=-1}x(vd,N);var wd=(td||ud)&&!I("533.17.9");g=vd.prototype;g.Tc=!0;g.vc=!0;g.gc=!1;g.Pc=!0;g.Oc=!0;g.Xa=null;g.c=null;g.jb="";g.aa=!1;g.sb=!1;
|
||||
g.fc=!0;g.l=function(){vd.o.l.call(this);null!=this.Xa&&window.clearTimeout(this.Xa);this.s.X();delete this.s;this.ya.X();this.ua.X();Mb(this.g)};function xd(a){a.g?a.g.setInterval(300):a.g=new nc(300)}
|
||||
function yd(a,b){switch(b.keyCode){case 40:if(a.i.I.R){a.gc?Vc(a.i):Uc(a.i);b.preventDefault();return}if(!a.ma){a.update(!0);b.preventDefault();return}break;case 38:if(a.i.I.R){a.gc?Uc(a.i):Vc(a.i);b.preventDefault();return}break;case 9:if(!a.i.I.R||b.shiftKey||a.Hc)a.i.S();else if(a.update(),Rc(a.i)&&a.Gc){b.preventDefault();return}break;case 13:if(a.i.I.R){if(a.update(),Rc(a.i)){b.preventDefault();b.stopPropagation();return}}else a.i.S();break;case 27:if(a.i.I.R){a.i.S();b.preventDefault();b.stopPropagation();
|
||||
return}break;case 229:if(!a.aa){a.aa||(a.s.D(a.c,"keyup",a.Rb),a.s.D(a.c,"keypress",a.Qb),a.aa=!0);return}break;default:a.g&&!a.fc&&(a.g.stop(),a.g.start())}zd(a,b)}function zd(a,b){var c=a.ma&&b.charCode&&-1!=a.va.indexOf(String.fromCharCode(b.charCode));a.Pc&&c&&a.update();a.Oc&&c&&Rc(a.i)&&b.preventDefault()}g.yc=function(){return!1};g.bb=function(a){Ad(this,a.target||null)};
|
||||
function Ad(a,b){a.ya.Oa();a.i&&Sc(a.i);b!=a.c&&(a.c=b,a.g&&(a.g.start(),a.s.D(a.g,"tick",a.Wb)),a.jb=a.c.value,nd(a.ua,a.c),a.s.D(a.ua,"key",a.Sb),a.s.D(a.c,"mousedown",a.Tb),B&&a.s.D(a.c,"keypress",a.Ob))}g.ab=function(){wd?this.Xa=window.setTimeout(v(this.Xb,this),0):this.Xb()};
|
||||
g.Xb=function(){this.c&&(this.s.F(this.ua,"key",this.Sb),this.ua.detach(),this.s.F(this.c,"keyup",this.yc),this.s.F(this.c,"mousedown",this.Tb),B&&this.s.F(this.c,"keypress",this.Ob),this.aa&&Bd(this),this.c=null,this.g&&(this.g.stop(),this.s.F(this.g,"tick",this.Wb)),this.i&&Tc(this.i))};g.Wb=function(){this.update()};g.Pb=function(a){this.bb(a)};g.Sb=function(a){this.Jb=a.keyCode;this.i&&yd(this,a)};g.Qb=function(){this.aa&&229!=this.Jb&&Bd(this)};
|
||||
g.Rb=function(a){this.aa&&(13==a.keyCode||77==a.keyCode&&a.ctrlKey)&&Bd(this)};g.Tb=function(){};function Bd(a){a.aa&&(a.aa=!1,a.s.F(a.c,"keypress",a.Qb),a.s.F(a.c,"keyup",a.Rb))}g.Ob=function(a){zd(this,a)};
|
||||
g.update=function(a){if(this.c&&(a||this.c.value!=this.jb)){if(a||!this.sb){a=Xc(this.c)[0];var b=this.c.value;a=Yc(this,b)[Wc(this,b,a)];a=this.ec?String(a).replace(this.ec,""):a;this.i&&(this.i.setTarget(this.c),b=this.i,b.K!=a&&(b.K=a,Cd(b.U,b.K,b.Ec,v(b.Cc,b)),Sc(b)))}this.jb=this.c.value}this.sb=!1};function Wc(a,b,c){a=Yc(a,b);if(c==b.length)return a.length-1;for(var d=b=0,e=0;d<a.length&&e<=c;d++)e+=a[d].length,b=d;return b}
|
||||
function Yc(a,b){if(!a.ma)return[b];for(var c=String(b).split(""),d=[],e=[],f=0,h=!1;f<c.length;f++)a.Lb&&-1!=a.Lb.indexOf(c[f])?(a.vc&&!h&&(d.push(e.join("")),e.length=0),e.push(c[f]),h=!h):h||-1==a.va.indexOf(c[f])?e.push(c[f]):(e.push(c[f]),d.push(e.join("")),e.length=0);d.push(e.join(""));return d};function Dd(){S.call(this);this.J=Ed;this.endTime=this.startTime=null}x(Dd,S);var Ed=0;Dd.prototype.V=function(){this.M("begin")};Dd.prototype.$=function(){this.M("end")};Dd.prototype.M=function(a){this.dispatchEvent(a)};function Fd(a,b,c){N.call(this);this.mb=a;this.ea=b||0;this.ka=c;this.qc=v(this.tc,this)}x(Fd,N);g=Fd.prototype;g.ta=0;g.l=function(){Fd.o.l.call(this);this.stop();delete this.mb;delete this.ka};g.start=function(a){this.stop();this.ta=oc(this.qc,p(a)?a:this.ea)};g.stop=function(){this.fb()&&n.clearTimeout(this.ta);this.ta=0};g.fb=function(){return 0!=this.ta};g.tc=function(){this.ta=0;this.mb&&this.mb.call(this.ka)};var Na={},Gd=null;function Hd(a){a=ia(a);delete Na[a];Ma()&&Gd&&Gd.stop()}function Id(){Gd||(Gd=new Fd(function(){Jd()},20));var a=Gd;a.fb()||a.start()}function Jd(){var a=w();Ia(Na,function(b){Kd(b,a)});Ma()||Id()};function Ld(a,b,c,d){Dd.call(this);if(!q(a)||!q(b))throw Error("Start and end parameters must be arrays");if(a.length!=b.length)throw Error("Start and end points must be the same length");this.wa=a;this.uc=b;this.duration=c;this.vb=d;this.coords=[];this.H=0}x(Ld,Dd);g=Ld.prototype;
|
||||
g.play=function(a){if(a||this.J==Ed)this.H=0,this.coords=this.wa;else if(1==this.J)return!1;Hd(this);this.startTime=a=w();-1==this.J&&(this.startTime-=this.duration*this.H);this.endTime=this.startTime+this.duration;this.H||this.V();this.M("play");-1==this.J&&this.M("resume");this.J=1;var b=ia(this);b in Na||(Na[b]=this);Id();Kd(this,a);return!0};g.stop=function(a){Hd(this);this.J=Ed;a&&(this.H=1);Md(this,this.H);this.M("stop");this.$()};g.pause=function(){1==this.J&&(Hd(this),this.J=-1,this.M("pause"))};
|
||||
g.l=function(){this.J==Ed||this.stop(!1);this.M("destroy");Ld.o.l.call(this)};function Kd(a,b){b<a.startTime&&(a.endTime=b+a.endTime-a.startTime,a.startTime=b);a.H=(b-a.startTime)/(a.endTime-a.startTime);1<a.H&&(a.H=1);Md(a,a.H);1==a.H?(a.J=Ed,Hd(a),a.M("finish"),a.$()):1==a.J&&a.nb()}function Md(a,b){ga(a.vb)&&(b=a.vb(b));a.coords=Array(a.wa.length);for(var c=0;c<a.wa.length;c++)a.coords[c]=(a.uc[c]-a.wa[c])*b+a.wa[c]}g.nb=function(){this.M("animate")};
|
||||
g.M=function(a){this.dispatchEvent(new Nd(a,this))};function Nd(a,b){O.call(this,a);this.coords=b.coords;this.x=b.coords[0];this.y=b.coords[1];this.z=b.coords[2];this.duration=b.duration;this.H=b.H;this.state=b.J}x(Nd,O);function T(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}g=T.prototype;g.getWidth=function(){return this.right-this.left};g.getHeight=function(){return this.bottom-this.top};g.clone=function(){return new T(this.top,this.right,this.bottom,this.left)};g.contains=function(a){return this&&a?a instanceof T?a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom:!1};
|
||||
g.expand=function(a,b,c,d){ha(a)?(this.top-=a.top,this.right+=a.right,this.bottom+=a.bottom,this.left-=a.left):(this.top-=a,this.right+=Number(b),this.bottom+=Number(c),this.left-=Number(d));return this};g.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};
|
||||
g.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};g.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};g.translate=function(a,b){a instanceof K?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,t(b)&&(this.top+=b,this.bottom+=b));return this};
|
||||
g.scale=function(a,b){var c=t(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function Od(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}g=Od.prototype;g.clone=function(){return new Od(this.left,this.top,this.width,this.height)};g.intersects=function(a){return this.left<=a.left+a.width&&a.left<=this.left+this.width&&this.top<=a.top+a.height&&a.top<=this.top+this.height};
|
||||
g.contains=function(a){return a instanceof K?a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height:this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height};g.distance=function(a){var b=a.x<this.left?this.left-a.x:Math.max(a.x-(this.left+this.width),0);a=a.y<this.top?this.top-a.y:Math.max(a.y-(this.top+this.height),0);return Math.sqrt(b*b+a*a)};g.getSize=function(){return new rb(this.width,this.height)};
|
||||
g.getTopLeft=function(){return new K(this.left,this.top)};g.getCenter=function(){return new K(this.left+this.width/2,this.top+this.height/2)};g.getBottomRight=function(){return new K(this.left+this.width,this.top+this.height)};g.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};
|
||||
g.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};g.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};g.translate=function(a,b){a instanceof K?(this.left+=a.x,this.top+=a.y):(this.left+=a,t(b)&&(this.top+=b));return this};
|
||||
g.scale=function(a,b){var c=t(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};function U(a,b){var c=M(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,null))?c[b]||c.getPropertyValue(b)||"":""}function V(a,b){return U(a,b)||(a.currentStyle?a.currentStyle[b]:null)||a.style&&a.style[b]}
|
||||
function Pd(a){var b;try{b=a.getBoundingClientRect()}catch(c){return{left:0,top:0,right:0,bottom:0}}B&&a.ownerDocument.body&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
|
||||
function Qd(a){if(B&&!(8<=Number(J)))return a.offsetParent;var b=M(a),c=V(a,"position"),d="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(11==a.nodeType&&a.host&&(a=a.host),c=V(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return null}
|
||||
function Rd(a){for(var b=new T(0,Infinity,Infinity,0),c=L(a),d=c.v.body,e=c.v.documentElement,f=wb(c.v);a=Qd(a);)if(!(B&&0==a.clientWidth||G&&0==a.clientHeight&&a==d)&&a!=d&&a!=e&&"visible"!=V(a,"overflow")){var h=Sd(a),k=new K(a.clientLeft,a.clientTop);h.x+=k.x;h.y+=k.y;b.top=Math.max(b.top,h.y);b.right=Math.min(b.right,h.x+a.clientWidth);b.bottom=Math.min(b.bottom,h.y+a.clientHeight);b.left=Math.max(b.left,h.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=(xb(c.v)||
|
||||
window).document;c=yb(c)?c.documentElement:c.body;c=new rb(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?b:null}function Sd(a){var b=M(a),c=new K(0,0),d;d=b?M(b):document;d=!B||9<=Number(J)||yb(L(d).v)?d.documentElement:d.body;if(a==d)return c;a=Pd(a);b=vb(L(b).v);c.x=a.left+b.x;c.y=a.top+b.y;return c}function Td(a){"number"==typeof a&&(a+="px");return a}
|
||||
function Ud(a){var b=Vd;if("none"!=V(a,"display"))return b(a);var c=a.style,d=c.display,e=c.visibility,f=c.position;c.visibility="hidden";c.position="absolute";c.display="inline";a=b(a);c.display=d;c.position=f;c.visibility=e;return a}function Vd(a){var b=a.offsetWidth,c=a.offsetHeight,d=G&&!b&&!c;return p(b)&&!d||!a.getBoundingClientRect?new rb(b,c):(a=Pd(a),new rb(a.right-a.left,a.bottom-a.top))}var Wd=E?"MozUserSelect":G||D?"WebkitUserSelect":null;
|
||||
function Xd(a){var b=a.getElementsByTagName("*");if(Wd){var c="none";a.style&&(a.style[Wd]=c);if(b){a=0;for(var d;d=b[a];a++)d.style&&(d.style[Wd]=c)}}else if(B||hb)if(c="on",a.setAttribute("unselectable",c),b)for(a=0;d=b[a];a++)d.setAttribute("unselectable",c)}function Yd(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return+e}
|
||||
function Zd(a,b){var c=a.currentStyle?a.currentStyle[b]:null;return c?Yd(a,c):0}var $d={thin:2,medium:4,thick:6};function ae(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:null))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:null;return c in $d?$d[c]:Yd(a,c)}
|
||||
function be(a){if(B&&!(9<=Number(J))){var b=ae(a,"borderLeft"),c=ae(a,"borderRight"),d=ae(a,"borderTop");a=ae(a,"borderBottom");return new T(d,c,a,b)}b=U(a,"borderLeftWidth");c=U(a,"borderRightWidth");d=U(a,"borderTopWidth");a=U(a,"borderBottomWidth");return new T(parseFloat(d),parseFloat(c),parseFloat(a),parseFloat(b))};function W(a,b,c,d,e){Ld.call(this,b,c,d,e);this.element=a}x(W,Ld);W.prototype.Ua=ca;W.prototype.nb=function(){this.Ua();W.o.nb.call(this)};W.prototype.$=function(){this.Ua();W.o.$.call(this)};W.prototype.V=function(){this.Ua();W.o.V.call(this)};function X(a,b,c,d,e){t(b)&&(b=[b]);t(c)&&(c=[c]);W.call(this,a,b,c,d,e);if(1!=b.length||1!=c.length)throw Error("Start and end points must be 1D");this.Ja=ce}x(X,W);var de=1/1024,ce=-1;
|
||||
X.prototype.Ua=function(){var a=this.coords[0];if(Math.abs(a-this.Ja)>=de){var b=this.element.style;"opacity"in b?b.opacity=a:"MozOpacity"in b?b.MozOpacity=a:"filter"in b&&(b.filter=""===a?"":"alpha(opacity\x3d"+100*Number(a)+")");this.Ja=a}};X.prototype.V=function(){this.Ja=ce;X.o.V.call(this)};X.prototype.$=function(){this.Ja=ce;X.o.$.call(this)};X.prototype.show=function(){this.element.style.display=""};function ee(a,b,c){X.call(this,a,1,0,b,c)}x(ee,X);ee.prototype.V=function(){this.show();ee.o.V.call(this)};
|
||||
ee.prototype.$=function(){this.element.style.display="none";ee.o.$.call(this)};function fe(a,b,c){X.call(this,a,0,1,b,c)}x(fe,X);fe.prototype.V=function(){this.show();fe.o.V.call(this)};function ge(a,b){return(b&8&&"rtl"==V(a,"direction")?b^4:b)&-9};function Y(){}Y.eb=void 0;Y.Bb=function(){return Y.eb?Y.eb:Y.eb=new Y};Y.prototype.Mb=0;function he(a,b,c,d){S.call(this);this.pb=a||document.body;this.N=L(this.pb);this.Lc=!a;this.b=null;this.K="";this.j=[];this.ga=[];this.bc=this.Ea=-1;this.R=!1;this.className="ac-renderer";this.rb="ac-row";this.Kb="active";this.wb="ac-active";this.Ac="ac-highlighted";this.ia=b||null;this.Sc=null!=d?d:!0;this.Dc=!0;this.Da=!1;this.Mc=!!c;this.Ta=!1;this.Ka=0;this.ac=!1}x(he,S);g=he.prototype;g.pc=0;g.getElement=function(){return this.b};
|
||||
g.qb=function(a,b,c){this.K=b;this.j=a;this.Ea=-1;this.bc=w();this.w=c;this.ga=[];ie(this)};g.S=function(){this.R&&(this.R=!1,je(this,!1),0<this.Ka?(Mb(this.ha),this.ha=new ee(this.b,this.Ka),this.ha.play()):this.b.style.display="none")};g.show=function(){this.R||(this.R=!0,je(this,!0),0<this.Ka?(Mb(this.ha),this.ha=new fe(this.b,this.Ka),this.ha.play()):this.b.style.display="")};
|
||||
function je(a,b){a.w&&(dd(a.w,"haspopup",b),dd(a.b,"expanded",b),dd(a.w,"expanded",b),b?dd(a.w,"owns",a.b.id):(a.w.removeAttribute("aria-owns"),ed(a.w,null)))}
|
||||
function ke(a,b){var c=0<=b&&b<a.j.length?a.j[b]:void 0,d=0<=b&&b<a.ga.length?a.ga[b]:void 0;if(a.dispatchEvent({type:"rowhilite",Wc:d,row:c?c.data:null})&&(0<=a.Ea&&Jb(a.ga[a.Ea],[a.wb,a.Kb]),a.Ea=b,d)){Hb(d,[a.wb,a.Kb]);a.w&&ed(a.w,d);var c=a.b||wb(document),e;e=c||wb(document);var f=Sd(d),h=Sd(e),k=be(e);if(e==wb(document)){var l=f.x-e.scrollLeft,f=f.y-e.scrollTop;!B||10<=Number(J)||(l+=k.left,f+=k.top)}else l=f.x-h.x-k.left,f=f.y-h.y-k.top;var d=Vd(d),k=e.clientHeight-d.height,h=e.scrollLeft,
|
||||
u=e.scrollTop,h=h+Math.min(l,Math.max(l-(e.clientWidth-d.width),0)),u=u+Math.min(f,Math.max(f-k,0));e=new K(h,u);c.scrollLeft=e.x;c.scrollTop=e.y}}g.T=function(a){if(-1==a)ke(this,-1);else for(var b=0;b<this.j.length;b++)if(this.j[b].id==a){ke(this,b);break}};
|
||||
function le(a){if(!a.b){var b=a.N.zb("DIV",{style:"display:none"});a.ac&&(b.style.overflowY="auto");a.b=b;Hb(b,oa(a.className).split(" "));cd(b,"listbox");b.id=":"+(Y.Bb().Mb++).toString(36);a.N.appendChild(a.pb,b);R(b,"click",a.Cb,!1,a);R(b,"mousedown",a.Db,!1,a);R(b,"mouseover",a.Eb,!1,a)}}
|
||||
function ie(a){le(a);a.Ta&&(a.b.style.visibility="hidden");a.ic&&(a.b.style.minWidth=a.ic.clientWidth-a.pc+"px");a.ga.length=0;a.N.Kc(a.b);if(a.ia&&a.ia.render)a.ia.render(a,a.b,a.j,a.K);else{var b=null;y(a.j,function(a){var d=a;a=this.K;var e=this.N.zb("DIV",{className:this.rb,id:":"+(Y.Bb().Mb++).toString(36)});cd(e,"option");if(this.ia&&this.ia.Yb)this.ia.Yb(d,a,e);else if(d=d.data.toString(),"textContent"in e)e.textContent=d;else if(3==e.nodeType)e.data=d;else if(e.firstChild&&3==e.firstChild.nodeType){for(;e.lastChild!=
|
||||
e.firstChild;)e.removeChild(e.lastChild);e.firstChild.data=d}else Bb(e),e.appendChild(M(e).createTextNode(String(d)));a&&this.Sc&&(this.hc=!1,me(this,e,a));Gb(e,this.rb);this.ga.push(e);a=e;this.Ta?this.b.insertBefore(a,b):this.N.appendChild(this.b,a);b=a},a)}0==a.j.length?a.S():(a.show(),ne(a),Xd(a.b))}
|
||||
function ne(a){if(a.w&&a.Lc){var b=a.mc||a.w,c,d=a.Mc?5:1;a.Ta&&(d^=1);c=d;var e=65;a.ac&&(a.b.style.height="",e|=32);var d=a.b,f=c^1,h,k;if(h=d.offsetParent){var l="HTML"==h.tagName||"BODY"==h.tagName;l&&"static"==V(h,"position")||(k=Sd(h),l||(l=(l="rtl"==V(h,"direction"))&&E?-h.scrollLeft:!l||ib&&I("8")||"visible"==V(h,"overflowX")?h.scrollLeft:h.scrollWidth-h.clientWidth-h.scrollLeft,k=qb(k,new K(l,h.scrollTop))))}h=k||new K;k=Sd(b);l=Ud(b);k=new Od(k.x,k.y,l.width,l.height);if(l=Rd(b)){var u=
|
||||
new Od(l.left,l.top,l.right-l.left,l.bottom-l.top),l=Math.max(k.left,u.left),C=Math.min(k.left+k.width,u.left+u.width);if(l<=C){var Q=Math.max(k.top,u.top),u=Math.min(k.top+k.height,u.top+u.height);Q<=u&&(k.left=l,k.top=Q,k.width=C-l,k.height=u-Q)}}l=L(b);Q=L(d);if(l.v!=Q.v){C=l.v.body;var Q=xb(Q.v),u=new K(0,0),F;F=(F=M(C))?xb(F):window;if(eb(F,"parent")){var Tb=C;do{var da;F==Q?da=Sd(Tb):(da=Pd(Tb),da=new K(da.left,da.top));u.x+=da.x;u.y+=da.y}while(F&&F!=Q&&F!=F.parent&&(Tb=F.frameElement)&&(F=
|
||||
F.parent))}C=qb(u,Sd(C));!B||9<=Number(J)||yb(l.v)||(C=qb(C,vb(l.v)));k.left+=C.x;k.top+=C.y}b=ge(b,c);c=k.left;b&4?c+=k.width:b&2&&(c+=k.width/2);var b=new K(c,k.top+(b&1?k.height:0)),b=qb(b,h),m;e&&(m=Rd(d))&&(m.top-=h.y,m.right-=h.x,m.bottom-=h.y,m.left-=h.x);b=b.clone();h=ge(d,f);f=Ud(d);c=f.clone();b=b.clone();c=c.clone();k=0;0!=h&&(h&4?b.x-=c.width+0:h&2&&(b.x-=c.width/2),h&1&&(b.y-=c.height+0));e&&(m?(h=b,k=c,l=0,65==(e&65)&&(h.x<m.left||h.x>=m.right)&&(e&=-2),132==(e&132)&&(h.y<m.top||h.y>=
|
||||
m.bottom)&&(e&=-5),h.x<m.left&&e&1&&(h.x=m.left,l|=1),e&16&&(C=h.x,h.x<m.left&&(h.x=m.left,l|=4),h.x+k.width>m.right&&(k.width=Math.min(m.right-h.x,C+k.width-m.left),k.width=Math.max(k.width,0),l|=4)),h.x+k.width>m.right&&e&1&&(h.x=Math.max(m.right-k.width,m.left),l|=1),e&2&&(l|=(h.x<m.left?16:0)|(h.x+k.width>m.right?32:0)),h.y<m.top&&e&4&&(h.y=m.top,l|=2),e&32&&(C=h.y,h.y<m.top&&(h.y=m.top,l|=8),h.y+k.height>m.bottom&&(k.height=Math.min(m.bottom-h.y,C+k.height-m.top),k.height=Math.max(k.height,0),
|
||||
l|=8)),h.y+k.height>m.bottom&&e&4&&(h.y=Math.max(m.bottom-k.height,m.top),l|=2),e&8&&(l|=(h.y<m.top?64:0)|(h.y+k.height>m.bottom?128:0)),e=l):e=256,k=e);e=new Od(0,0,0,0);e.left=b.x;e.top=b.y;e.width=c.width;e.height=c.height;k&496||(b=e.getTopLeft(),b instanceof K?(m=b.x,b=b.y):(m=b,b=void 0),d.style.left=Td(m),d.style.top=Td(b),c=e.getSize(),f==c||f&&c&&f.width==c.width&&f.height==c.height||(e=c,m=yb(L(M(d)).v),!B||I("10")||m&&I("8")?(d=d.style,E?d.MozBoxSizing="border-box":G?d.WebkitBoxSizing=
|
||||
"border-box":d.boxSizing="border-box",d.width=Math.max(e.width,0)+"px",d.height=Math.max(e.height,0)+"px"):(f=d.style,m?(B?(m=Zd(d,"paddingLeft"),b=Zd(d,"paddingRight"),c=Zd(d,"paddingTop"),h=Zd(d,"paddingBottom"),m=new T(c,b,h,m)):(m=U(d,"paddingLeft"),b=U(d,"paddingRight"),c=U(d,"paddingTop"),h=U(d,"paddingBottom"),m=new T(parseFloat(c),parseFloat(b),parseFloat(h),parseFloat(m))),d=be(d),f.pixelWidth=e.width-d.left-m.left-m.right-d.right,f.pixelHeight=e.height-d.top-m.top-m.bottom-d.bottom):(f.pixelWidth=
|
||||
e.width,f.pixelHeight=e.height))));a.Ta&&(a.b.style.visibility="visible")}}g.getTarget=function(){return this.w||null};g.l=function(){this.b&&(hc(this.b,"click",this.Cb,!1,this),hc(this.b,"mousedown",this.Db,!1,this),hc(this.b,"mouseover",this.Eb,!1,this),this.N.removeNode(this.b),this.b=null,this.R=!1);Mb(this.ha);this.pb=null;he.o.l.call(this)};
|
||||
function me(a,b,c){if(a.Da||!a.hc)if(3==b.nodeType){var d=null;q(c)&&1<c.length&&!a.Da&&(d=Ha(c,1));c=oe(a,c);if(0!=c.length){var e=b.nodeValue,f=a.Dc?new RegExp("\\b(?:"+c+")","gi"):new RegExp(c,"gi");c=[];for(var h=0,k=f.exec(e),l=0;k;)l++,c.push(e.substring(h,k.index)),c.push(e.substring(k.index,f.lastIndex)),h=f.lastIndex,k=f.exec(e);c.push(e.substring(h));if(1<c.length){d=a.Da?l:1;for(e=0;e<d;e++)f=2*e,b.nodeValue=c[f],h=a.N.createElement("B"),h.className=a.Ac,a.N.appendChild(h,a.N.createTextNode(c[f+
|
||||
1])),h=b.parentNode.insertBefore(h,b.nextSibling),b.parentNode.insertBefore(a.N.createTextNode(""),h.nextSibling),b=h.nextSibling;b.nodeValue=Ha(c,2*d).join("");a.hc=!0}else d&&me(a,b,d)}}else for(b=b.firstChild;b;)d=b.nextSibling,me(a,b,c),b=d}
|
||||
function oe(a,b){var c="";if(!b)return c;q(b)&&(b=Aa(b,function(a){return!/^[\s\xa0]*$/.test(null==a?"":String(a))}));a.Da?q(b)?c=Ba(b,xa).join("|"):(c=b.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,""),c=xa(c),c=c.replace(/ /g,"|")):q(b)?c=0<b.length?xa(b[0]):"":/^\W/.test(b)||(c=xa(b));return c}function pe(a,b){for(;b&&b!=a.b&&!Fb(b,a.rb);)b=b.parentNode;return b?za(a.ga,b):-1}g.Cb=function(a){var b=pe(this,a.target);0<=b&&this.dispatchEvent({type:Nc,row:this.j[b].id});a.stopPropagation()};
|
||||
g.Db=function(a){a.stopPropagation();a.preventDefault()};g.Eb=function(a){a=pe(this,a.target);0<=a&&!(300>w()-this.bc)&&this.dispatchEvent({type:Mc,row:this.j[a].id})};function Z(a,b,c,d){this.Ma=null;d&&(this.Ma=new Za((location.hash||"").substr(1)));this.u=r(a)?document.getElementById(a):a;R(this.u,["focus","click"],function(){this.u.setSelectionRange(0,this.u.value.length)},!1,this);a=new he(null,{Yb:function(a,b,c){b='\x3cspan class\x3d"name"\x3e';var d=a.data.name_suffix;b=d?b+(a.data.name+'\x3c/span\x3e\x3cspan class\x3d"suffix"\x3e'+d):b+a.data.display_name;b+="\x3c/span\x3e";(a=a.data.type)&&(b+='\x3cspan class\x3d"type"\x3e'+a+"\x3c/span\x3e");c.innerHTML=
|
||||
b}});a.ic=this.u;this.U=new qe(b,c,this.Ma,this.u);this.da=new vd(null,null,!1);xd(this.da);this.da.fc=!1;this.da.i=this;Lc.call(this,this.U,a,this.da);this.Ba=!1;this.D("update",function(a){this.u.value=a.row?a.row.name:""},!1,this);this.enable(!0);if(this.Ma){var e=this.Ma.get("q");e&&r(e)&&setTimeout(v(function(){this.u.value=e.toString();this.da.update()},this),0)}}x(Z,Lc);
|
||||
Z.prototype.enable=function(a){if(this.Ba!=a)if(this.Ba=a){a=this.da;var b=this.u;ha(b)&&1==b.nodeType&&(cd(b,"combobox"),dd(b,"autocomplete","list"));a.s.D(b,"focus",a.bb);a.s.D(b,"blur",a.ab);if(!a.c&&(a.ya.D(b,"keydown",a.Pb),ha(b)&&1==b.nodeType)){var c;a:{var d=M(b);try{c=d&&d.activeElement;break a}catch(e){}c=null}c==b&&Ad(a,b)}}else c=this.da,a=this.u,ha(a)&&1==a.nodeType&&(a.removeAttribute("role"),a.removeAttribute("aria-autocomplete")),a==c.c&&c.ab(),c.s.F(a,"focus",c.bb),c.s.F(a,"blur",
|
||||
c.ab),c.c||c.ya.F(a,"keydown",c.Pb)};Z.prototype.tb=function(a){this.U.tb(a);this.Ba&&this.update(!0)};Z.prototype.Jc=function(a,b){b&&R(this.I,"rowhilite",function(b){b.row&&a(b.row)},!1,this);R(this,"update",function(b){b.row&&a(b.row)},!1,this);var c=v(function(b){b.preventDefault();this.Ba&&this.search(this.u.value,1,v(function(b,c){var d=c[0];d&&a(d)},this))},this),d=Cb(this.u);d&&R(d,"submit",c);R(this.u,["webkitspeechchange","speechchange"],c)};
|
||||
Z.prototype.search=function(a,b,c){Cd(this.U,a,b,c)};ba("kt.OsmNamesAutocomplete",Z);ba("kt.OsmNamesAutocomplete.prototype.registerCallback",Z.prototype.Jc);ba("kt.OsmNamesAutocomplete.prototype.setCountryCode",Z.prototype.tb);function qe(a,b,c,d){this.Rc=a||"https://search.osmnames.org/";this.Ib=b;this.Aa=c&&c.get("country_code")||null;this.la=c||null;this.u=d}qe.prototype.tb=function(a){this.Aa=a;this.la&&(this.la.set("country_code",this.Aa),location.hash=this.la.toString())};
|
||||
function Cd(a,b,c,d){a.u&&Ib(a.u,"working");a.Pa&&b!=a.Nb&&(a.Pa.abort(),a.Pa=null);b&&1!=b.length?(1==c&&(a.Nb=b),1<c&&b===a.Nb||(a.la&&(a.la.set("q",b),location.hash=a.la.toString()),c=a.Rc,a.Aa&&(c+=a.Aa+"/"),c+="q/"+encodeURIComponent(b)+".js",a.Ib&&(c+="?key\x3d"+a.Ib),a.u&&Gb(a.u,"working"),a.Pa=Bc(c,v(function(a){this.u&&Ib(this.u,"working");a=a.target;Jc(a)&&(a=a.a?pc(a.a.responseText):void 0,a=a.results,y(a,function(a){if(a=a.boundingbox)180<a[0]&&180<a[2]?(a[0]-=360,a[2]-=360):-180>a[0]&&
|
||||
-180>a[2]&&(a[0]+=360,a[2]+=360)},this),d(b,a),this.Pa=null)},a)))):d(b,[])};})();
|
||||
4
3rd/js/ics.deps.min.js
vendored
Normal file
4
3rd/js/ics.deps.min.js
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/*! ics.js Wed Aug 20 2014 17:23:02 */
|
||||
var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},v=function(t,u,d){if(!d){t=p(t)}var v=this,w=t.type,m=w===s,y,h=function(){l(v,"writestart progress write writeend".split(" "))},S=function(){if((f||m&&i)&&e.FileReader){var r=new FileReader;r.onloadend=function(){var t=f?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");var n=e.open(t,"_blank");if(!n)e.location.href=t;t=undefined;v.readyState=v.DONE;h()};r.readAsDataURL(t);v.readyState=v.INIT;return}if(!y){y=n().createObjectURL(t)}if(m){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}v.readyState=v.DONE;h();c(y)};v.readyState=v.INIT;if(o){y=n().createObjectURL(t);setTimeout(function(){r.href=y;r.download=u;a(r);h();c(y);v.readyState=v.DONE});return}S()},w=v.prototype,m=function(e,t,n){return new v(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=p(e)}return navigator.msSaveOrOpenBlob(e,t)}}w.abort=function(){};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return m}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!==null){define("FileSaver.js",function(){return saveAs})}
|
||||
|
||||
var ics=function(e,t){"use strict";{if(!(navigator.userAgent.indexOf("MSIE")>-1&&-1==navigator.userAgent.indexOf("MSIE 10"))){void 0===e&&(e="default"),void 0===t&&(t="Calendar");var r=-1!==navigator.appVersion.indexOf("Win")?"\r\n":"\n",n=[],i=["BEGIN:VCALENDAR","PRODID:"+t,"VERSION:2.0"].join(r),o=r+"END:VCALENDAR",a=["SU","MO","TU","WE","TH","FR","SA"];return{events:function(){return n},calendar:function(){return i+r+n.join(r)+o},addEvent:function(t,i,o,l,u,s){if(void 0===t||void 0===i||void 0===o||void 0===l||void 0===u)return!1;if(s&&!s.rrule){if("YEARLY"!==s.freq&&"MONTHLY"!==s.freq&&"WEEKLY"!==s.freq&&"DAILY"!==s.freq)throw"Recurrence rrule frequency must be provided and be one of the following: 'YEARLY', 'MONTHLY', 'WEEKLY', or 'DAILY'";if(s.until&&isNaN(Date.parse(s.until)))throw"Recurrence rrule 'until' must be a valid date string";if(s.interval&&isNaN(parseInt(s.interval)))throw"Recurrence rrule 'interval' must be an integer";if(s.count&&isNaN(parseInt(s.count)))throw"Recurrence rrule 'count' must be an integer";if(void 0!==s.byday){if("[object Array]"!==Object.prototype.toString.call(s.byday))throw"Recurrence rrule 'byday' must be an array";if(s.byday.length>7)throw"Recurrence rrule 'byday' array must not be longer than the 7 days in a week";s.byday=s.byday.filter(function(e,t){return s.byday.indexOf(e)==t});for(var c in s.byday)if(a.indexOf(s.byday[c])<0)throw"Recurrence rrule 'byday' values must include only the following: 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'"}}var g=new Date(l),d=new Date(u),f=new Date,S=("0000"+g.getFullYear().toString()).slice(-4),E=("00"+(g.getMonth()+1).toString()).slice(-2),v=("00"+g.getDate().toString()).slice(-2),y=("00"+g.getHours().toString()).slice(-2),A=("00"+g.getMinutes().toString()).slice(-2),T=("00"+g.getSeconds().toString()).slice(-2),b=("0000"+d.getFullYear().toString()).slice(-4),D=("00"+(d.getMonth()+1).toString()).slice(-2),N=("00"+d.getDate().toString()).slice(-2),h=("00"+d.getHours().toString()).slice(-2),I=("00"+d.getMinutes().toString()).slice(-2),R=("00"+d.getMinutes().toString()).slice(-2),M=("0000"+f.getFullYear().toString()).slice(-4),w=("00"+(f.getMonth()+1).toString()).slice(-2),L=("00"+f.getDate().toString()).slice(-2),O=("00"+f.getHours().toString()).slice(-2),p=("00"+f.getMinutes().toString()).slice(-2),Y=("00"+f.getMinutes().toString()).slice(-2),U="",V="";y+A+T+h+I+R!=0&&(U="T"+y+A+T,V="T"+h+I+R);var B,C=S+E+v+U,j=b+D+N+V,m=M+w+L+("T"+O+p+Y);if(s)if(s.rrule)B=s.rrule;else{if(B="rrule:FREQ="+s.freq,s.until){var x=new Date(Date.parse(s.until)).toISOString();B+=";UNTIL="+x.substring(0,x.length-13).replace(/[-]/g,"")+"000000Z"}s.interval&&(B+=";INTERVAL="+s.interval),s.count&&(B+=";COUNT="+s.count),s.byday&&s.byday.length>0&&(B+=";BYDAY="+s.byday.join(","))}(new Date).toISOString();var H=["BEGIN:VEVENT","UID:"+n.length+"@"+e,"CLASS:PUBLIC","DESCRIPTION:"+i,"DTSTAMP;VALUE=DATE-TIME:"+m,"DTSTART;VALUE=DATE-TIME:"+C,"DTEND;VALUE=DATE-TIME:"+j,"LOCATION:"+o,"SUMMARY;LANGUAGE=en-us:"+t,"TRANSP:TRANSPARENT","END:VEVENT"];return B&&H.splice(4,0,B),H=H.join(r),n.push(H),H},download:function(e,t){if(n.length<1)return!1;t=void 0!==t?t:".ics",e=void 0!==e?e:"calendar";var a,l=i+r+n.join(r)+o;if(-1===navigator.userAgent.indexOf("MSIE 10"))a=new Blob([l]);else{var u=new BlobBuilder;u.append(l),a=u.getBlob("text/x-vCalendar;charset="+document.characterSet)}return saveAs(a,e+t),l},build:function(){return!(n.length<1)&&i+r+n.join(r)+o}}}console.log("Unsupported Browser")}};
|
||||
12
3rd/js/isotope.pkgd.min.js
vendored
Normal file
12
3rd/js/isotope.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
3rd/js/tz.js
Normal file
1
3rd/js/tz.js
Normal file
File diff suppressed because one or more lines are too long
457
index.html
Normal file
457
index.html
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset=utf-8>
|
||||
<meta content="IE=edge" http-equiv=X-UA-Compatible>
|
||||
|
||||
<!--
|
||||
* load 3rd party stylesheets
|
||||
*-->
|
||||
<link rel="stylesheet" href="3rd/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="3rd/css/bootstrap-datetimepicker.css" />
|
||||
<link rel="stylesheet" href="3rd/css/nprogress.css" />
|
||||
<link rel="stylesheet" href="3rd/css/autocomplete.css" />
|
||||
|
||||
<!--
|
||||
* load 3rd party javascript libraries
|
||||
*-->
|
||||
<script type="text/javascript" src="3rd/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="3rd/js/jquery.loadTemplate.min.js"></script>
|
||||
<script type="text/javascript" src="3rd/js/moment.js"></script>
|
||||
<script type="text/javascript" src="3rd/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="3rd/js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="3rd/js/defiant.min.js"></script>
|
||||
<script type="text/javascript" src="3rd/js/nprogress.js"></script>
|
||||
<script type="text/javascript" src='3rd/js/ics.deps.min.js'></script>
|
||||
<script type="text/javascript" src='3rd/js/isotope.pkgd.min.js'></script>
|
||||
<script type="text/javascript" src='3rd/js/tz.js'></script>
|
||||
<script type="text/javascript" src="3rd/js/autocomplete.js"></script>
|
||||
|
||||
<!--
|
||||
* load SUBLUNAR ALMANAC libraries and sheets
|
||||
*-->
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<script type="text/javascript" src="js/SL.Astro.js"></script>
|
||||
<script type="text/javascript" src="js/SL.Calendar.js"></script>
|
||||
|
||||
<!--
|
||||
* load SUBLUNAR ALMANAC plugin modules
|
||||
*-->
|
||||
<script type="text/javascript" src="js/modules/planetary.js"></script>
|
||||
<script type="text/javascript" src="js/modules/moon.js"></script>
|
||||
<script type="text/javascript" src="js/modules/astrology.js"></script>
|
||||
<script type="text/javascript" src="js/modules/lunarmansions.js"></script>
|
||||
<script type="text/javascript" src="js/modules/hygromanteia.js"></script>
|
||||
<script type="text/javascript" src="js/modules/keyofsolomon.js"></script>
|
||||
<script type="text/javascript" src="js/modules/pgm.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!--
|
||||
* Bootstrap Navigation Bar
|
||||
*-->
|
||||
<div id="custom-bootstrap-menu" class="navbar navbar-default" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="navigation">
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<li><p class="navbar-btn"><a class="btn btn-default" data-toggle="modal" data-target="#settings" href="#"><span class="glyphicon glyphicon-cog"></span> Settings</a></p></li>
|
||||
<li><p class="navbar-btn"><a class="btn btn-default" id="about" data-toggle="modal" data-target="#aboutSLC" href="#"><span class="glyphicon glyphicon-info-sign"></span> About</a></p></li>
|
||||
<li><p class="navbar-btn"><a class="btn btn-default" id="filterreset" href="#"><span class="glyphicon glyphicon-remove-circle"></span> Reset</a></p></li>
|
||||
</ul>
|
||||
<ul id="filterList" class="nav navbar-nav navbar-right">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
||||
<!--
|
||||
* SUBLUNAR ALMANAC
|
||||
*-->
|
||||
<div id="calendar">
|
||||
<div id="grid">
|
||||
<center><h3 class="stoke">What is this? <a href="http://sublunar.space/drafts/sublunar-almanac.html#doc">Read!</a></h3></center>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a id="downloadAnchorElem" style="display:none"></a>
|
||||
|
||||
<!--
|
||||
* DOM object with all modal templates
|
||||
*-->
|
||||
<div id="modals">
|
||||
|
||||
<!--
|
||||
* Settings Modal
|
||||
*-->
|
||||
<div class="modal fade" id="settings" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><span class="glyphicon glyphicon-globe"></span> Settings</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="lon">Your Location</label>
|
||||
<input type="text" autocomplete="off" id="search" class="address form-control args" placeholder="City"/>
|
||||
|
||||
<!--
|
||||
* OSMnames autocomplete
|
||||
*-->
|
||||
<script>
|
||||
var autocomplete = new kt.OsmNamesAutocomplete(
|
||||
'search', 'https://geocoder.tilehosting.com/', 'kqIwOXlhKKgBoR5zVAnm');
|
||||
autocomplete.registerCallback(function(item) {
|
||||
SL.Calendar.getGeoCode(item);
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="datetime">Date and Time</label>
|
||||
<input type="text" class="form-control" id="datetime" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="offset">UTC Offset</label>
|
||||
<input type="text" class="coords form-control args" id="offset" placeholder="3"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="lat">Latitude</label>
|
||||
<input type="text" class="coords form-control args" id="lat" placeholder="37.2204674515" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="lon">Longitude</label>
|
||||
<input type="text" class="coords form-control args" id="lon" placeholder="38.9200813197"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="lon">Generate Days</label>
|
||||
<input type="text" id="days" class="form-control" value="7">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="lon">Filter Hours</label>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="future" type="checkbox"> Hide Past
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="lon">Zodiac System</label>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="zodiac" type="checkbox"> Sidereal
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="lon">Modules to Use</label>
|
||||
<div id="moduleSelect" class="checkbox form-check form-check-inline">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<label class="btn btn-default pull-left" id="fileInputLabel" for="fileInput">
|
||||
<input id="fileInput" type="file" style="display:none"
|
||||
onchange="$('#fileInputLabel').removeClass('btn-default').addClass('btn-success').find('span').html(this.files[0].name)">
|
||||
<span>Select File</span>
|
||||
</label>
|
||||
<button type="button" class="btn btn-primary" id="generate" >Generate</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
* jQuery.loadTemplate templates
|
||||
*-->
|
||||
|
||||
<!--
|
||||
* template for planetary hour
|
||||
*-->
|
||||
<script type="text/html" id="tpl-planetaryhour">
|
||||
<table>
|
||||
<tr>
|
||||
<td data-content="ruler"></td>
|
||||
<td data-content="date"></td>
|
||||
<td data-content="hournumber"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-content="hourstart"></td>
|
||||
<td data-content="hourruler"></td>
|
||||
<td data-content="hourend"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</script>
|
||||
|
||||
<!--
|
||||
* template for bootstrap modal
|
||||
*-->
|
||||
<script type="text/html" id="tpl-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" data-content="title"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4" data-content="left">
|
||||
</div>
|
||||
<div class="col-sm-8" data-content="right">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!--
|
||||
* main SUBLUNAR ALMANAC Javascript
|
||||
*-->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
/*--
|
||||
* Array of plugin modules to be loaded
|
||||
*/
|
||||
SL.Calendar.modules([
|
||||
'planetary_day_ruler',
|
||||
'planetary_hour_ruler',
|
||||
'lunarphase', 'lunarday',
|
||||
'sun', 'moon', 'mercury', 'venus', 'mars', 'jupiter', 'saturn',
|
||||
'aspects', 'motion',
|
||||
'lunarmansion',
|
||||
'pgm_lsign',
|
||||
'hygromanteia_hours',
|
||||
'hygromanteia_lunarday',
|
||||
'hygromanteia_lunarsign',
|
||||
'kos_pday', 'kos_phour', 'kos_astro'
|
||||
]);
|
||||
|
||||
/*--
|
||||
* init bootstrap DateTimePicker
|
||||
*/
|
||||
$(function () {
|
||||
$('#datetime').datetimepicker({ minDate: new moment("7 Jan 1970 20:35 UT") });
|
||||
$('#datetime').data("DateTimePicker").toggle().hide();
|
||||
});
|
||||
|
||||
/*--
|
||||
* init event listeners
|
||||
*/
|
||||
|
||||
// set timestamp when DateTimePicker changes
|
||||
$('#datetime').on("dp.change", function() {
|
||||
timestamp = $(this).data("DateTimePicker").date().utc().unix();
|
||||
});
|
||||
|
||||
// "About" modal
|
||||
$('#about').on('click', SL.Calendar.about);
|
||||
|
||||
// "Generate" button in Settings
|
||||
$('#generate').on("click", function(e) {
|
||||
var files = document.getElementById('fileInput').files;
|
||||
if (files.length <= 0) {
|
||||
if ( $("#lat").val() != '' && $("#lon").val() != '' && $("#offset").val() != '' ) {
|
||||
setTimeout( SL.Calendar.make, 100, $('#days').val(), timestamp, $('#lat').val(), $('#lon').val());
|
||||
$('#settings').modal('hide');
|
||||
NProgress.start();
|
||||
}
|
||||
} else {
|
||||
setTimeout( SL.Calendar.make, 100, 0, 0, 0, 0);
|
||||
$('#settings').modal('hide');
|
||||
NProgress.start();
|
||||
}
|
||||
});
|
||||
|
||||
// when modal is opened, simulate window reset
|
||||
$('.modal').on('shown.bs.modal', function (e) {
|
||||
SL.Calendar.reset();
|
||||
});
|
||||
|
||||
// "Reset" button in navbar menu bar
|
||||
$('#filterreset').on('click', function() {
|
||||
$('.filteroptions input').prop('checked', false);
|
||||
filters = {};
|
||||
$('#calendar').isotope({ filter: '*' });
|
||||
});
|
||||
|
||||
/*--
|
||||
* init Isotope filtering
|
||||
*/
|
||||
// store filter per group
|
||||
var filters = {};
|
||||
|
||||
// do stuff when checkbox change
|
||||
// from https://codepen.io/desandro/pen/JGKyrY
|
||||
$(document).on("change", ".actionlistfilter", function( event ) {
|
||||
var checkbox = event.target;
|
||||
var $checkbox = $( checkbox );
|
||||
var group = $checkbox.parents('.option-set').attr('data-group');
|
||||
var inclusives = [];
|
||||
$checkboxes = $("#"+group+"-tags input");
|
||||
// inclusive filters from checkboxes
|
||||
$checkboxes.each( function( i, elem ) {
|
||||
// if checkbox, use value if checked
|
||||
if ( elem.checked ) {
|
||||
inclusives.push( elem.value );
|
||||
}
|
||||
});
|
||||
// combine inclusive filters
|
||||
var filterValue = inclusives.length ? inclusives.join(', ') : '*';
|
||||
$("#"+group+"-actions").isotope({
|
||||
layoutMode: 'vertical',
|
||||
itemSelector: '.operation',
|
||||
filter: filterValue })
|
||||
});
|
||||
|
||||
// from https://codepen.io/desandro/pen/MebyMR
|
||||
$(document).on("change", ".filteroptions", function( event ) {
|
||||
var checkbox = event.target;
|
||||
var $checkbox = $( checkbox );
|
||||
var group = $checkbox.parents('.option-set').attr('data-group');
|
||||
// create array for filter group, if not there yet
|
||||
var filterGroup = filters[ group ];
|
||||
if ( !filterGroup ) {
|
||||
filterGroup = filters[ group ] = [];
|
||||
}
|
||||
// add/remove filter
|
||||
if ( checkbox.checked ) {
|
||||
// add filter
|
||||
filterGroup.push( checkbox.value );
|
||||
} else {
|
||||
// remove filter
|
||||
var index = filterGroup.indexOf( checkbox.value );
|
||||
filterGroup.splice( index, 1 );
|
||||
}
|
||||
|
||||
$('#calendar').isotope({
|
||||
transitionDuration: 0,
|
||||
itemSelector: '.planetaryhour',
|
||||
filter: SL.Calendar.comboFilter()
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- chupchik helped...
|
||||
|
||||
.,..
|
||||
.,::,,:,
|
||||
:;;::::::,..
|
||||
.;;;;;::::,:,,.
|
||||
,iiiii;;;:::,,...
|
||||
.ii11i;;;;;:;:::,.
|
||||
,iiiii;i;;;;;;;:,,.
|
||||
:i11;;;:;;;;::::::,.
|
||||
.;1iii;;;;;;;;;::;;::. ...
|
||||
.iii;;;;;;;;;;;;;;;;:,, .... ..
|
||||
::::::::;::::::;;;:;;::, .,...........
|
||||
:;::::::::::::::;:;;;;;:, .,.,,.. ..,,,.
|
||||
:;::::::::;::::::::;;;i;:,. .,,,,,. ...,:::.
|
||||
.;;;:::;;:::::::::::;::;i;:. ,,,,.. ....,,::;;,.
|
||||
,::::::::::::::;:::::::;;;;:, ..,,........,,,,,:::,
|
||||
,::::::;::::;;:::::::::::;;i;, ..,,,... .......,,::::,
|
||||
:;:;;;;;;;;;;;:::::::;;::;;;;:. .,.,... .. ...,,,,,::,.
|
||||
:;;;;:;;::;;::::::;:::;:::;:;;;:, .,:,,,. ...,.....,,,.
|
||||
.::::,::::::::::::::;:::;:;:;;ii;:... .,,,,. ... . . ....,.
|
||||
.,,,::::::::::::::::;::;;;::::;;ii;;:. .:::,,. .........
|
||||
.,::,:::::;:::::,,:::;::::::::;;i;ii::, ..:::,. . ...... .. ......
|
||||
.:;:;::;::::;:::::::::::;;;;ii;;;ii;;;1;, .:;:;;,... . ... .,,.
|
||||
:;;iii;;iiii;;;;;;;;;:;;;;;;iiii;i1iiiitt1;,. :1i:;;:,,. ... .......,...,,,,
|
||||
:i1111ii1iiiiiiiiii;;i;;;;;iii1i11t1iii1ffftii11ii1:i;;,..:;:,.,..,,. . .;t1;:;;:,,. ................,,.,,,,,.
|
||||
:i1i11111111t111i1iii1iiii1iiii1ttftfi1ttLLLLffffffftttt1tt111tt1ttt111;;:::,...,........ ..,;tt1i:;;:::,........ ....,,.,,,,,,,.
|
||||
,;i11111111tt11111111iiii1111ii11ttt11t1fffLfLLLLtffttLttfL11fLLfffLCLffftt1;i1t1fffttft11fttLft1ii1i;:,,,....... .........,,:,,,,,,.
|
||||
,;;ii111111111111111i1i11111iiii11111ttttttLfLfLtiftfffLCGLfLLLLLLLLLCLLLLftfLLftfLLffffffffftt11i1ii;;:.......,,,,,,,,,.,,,,,,,,,,.
|
||||
:ii;;iii111iiiiiiiii111111111ii11t111ttttttfLfLf1tfCGG0@8G8GCLCCLfLLLLCLCLtLCCLLLfCCCLffft11t1t1i111ii:,:,,.,,,,:,,.,,,,,,,,.......
|
||||
:ii;;;i111111iiiiiiii111111111i1tfft11ftffLfLfftLfLG8@@@@@@GCLLLLfffLCCLLfLGGGLLLLCCCLLff1it111i1iii;::::,,,,,,,.,,,,,,,,,,........
|
||||
.;iii;1tt1tttt1t11t1111111t111t11ffffttffLLLffLfffLL888@800GGCLLLLLtfCGCftfLGLfLLCGGGCGGLttftii;i1ti:::;,,,,,,,::,:,,,::::,,,,,,....
|
||||
.i1;i1ffffffttt1tf1ttttt11t1ttttttttfLffLLLLLLfLLff00CGGGfLLCLtfLLfftLGffffLCftfCCGCG@0GGCf1t1ii1ti;;::,::::,:;,,,:,,:::::,,,:,,:,,,,
|
||||
:i;;ittfLfftttttffftffttttt1tttftttfLffffLffffftffLCfffCfLLGft1fCCCCCCCLtfCCLt1tLLLC8800GCLft1tt1i;i;;;:;;:;:::::,,,::,,::,::::::,.,
|
||||
:;;ii11fffftfftttttttffffftttttfttLLLffLftff1tttLLffffCG8CLtt11C0CLCLCCCCLCCtiitfLCGG@@@88CLfft1t11i;;;:i;;,,:,,,:::::::,:;::;;;:,,.
|
||||
.:;ii11ttttttft111ttfffftffttffLfffCLftffffff1ttLfLCLLC88C1tfft8CCftfL8G0GCCtii11CGCC8@GCG0Lft11i111iiii;;;::,,:,,:,::;;:i;1iiii:,,.
|
||||
.:;i1tfffttt1t1t11111tttttftfffLLffLCLfftLLfLLffLCCLCLL00Cf1fLG8@@Cfttf@CG0@8C11ttL0GCLCCLLftt111;;1iiiii:i;:::::,:ii;;i;;ii1i;;:..,:
|
||||
:;111tLLLCLLft1111111t1tffffffffLfffffffLLGCCLCffCCCLCGGGCLttfG@@@08L1t@0G8@@8ftffCCCCLttftti111ti1t1i1iiii;i:::;::ii;;i;;i1ii:;:..,;.
|
||||
:;11fffffGGCLCLft1111ttfLfLffffffLLftfffLC08CLLttfCGLC0@@@0CftffGLL@0t1G88@@@@Gt1LC0CCt111tt1tfLti1t1itii11i1;;;i;;ii;;ii;i1:i::::,,::
|
||||
:i11tttttfGGGGGCLffftffLffffffffLLffft1tLCCG00CLftttLCC@@@@@Cft1ttt08CffCC0@888LfftG0L1i;;1tfLfGCttit1t1i;ii1iii;;iii;ii;i1i,:;;;i;,:,.
|
||||
:;ii11ttttfLLLCCCCCLLffffLftffffffLftLLLffCCC00Cft1tfG@@@@@@L11i;1L88LfGfC@@0@8ftffCL1;:,;if@C@GLf;1111i;;1ii11i;i;i:;i;;1;,:;:111;, ..
|
||||
.:;ii1tttffffLLLLLLLfffffftfLLffLfffLffttLLL0G8CLf1tG@@@@@@Lii;;itf0tfftL00008LfftLf1i;,,:iL0@8GL11i;;1i11iii1i;;;:;i;;;;,:;:;ii1i,. .
|
||||
,:;i1ttttffffLLLfLCLffftttfLffffftttt1tttftfLCGLf11fG@@@@0fiiii;1tttt11tLCCLCCftf11iii,,,,;10@8GLt;::;111111iiiii:;;:::;;i;:;i1t1i;,,.
|
||||
.:;11ttfffffffffLLCLfttttffffffftttft111ttttfffftt1tfC@@@@L1i;i1111111111tftfCLft1i1ii;:,:,,iC0@8Lt:,:ittftf1iit;;;;::::;ii;i11ft11i;,....
|
||||
,;i1tfttttffffffLfft11tfffffffftttft1111ttffLLffLCffLG@@@8L1i11tt1ttttii1LttLLft111;ii;:;:,:ifC@@Ci::;1LLftti1ii;:;,:;:::;;;itfffttti::,,,
|
||||
,;11ttfftttffLLLffft1ttttffffffffftttt1tfLCCG80080CCC008@0Lttttftfftti11tt1ttt1iiiiiii;;;;;;tf@@0t;;itf1i1i;;iii;;;:;i:::;i111ttttt1;;;:,.
|
||||
:ittttfttLCCCLLLfLft1tt1tffLLLLLffLffLfLC8@@@@@@@@@@@888CLttt1t1tttfttt111t1t111iii;;i:;;:;tL8@Ctii1t1ii;;;;;;;;:;;ii;;;iiiiii;iiii;;::,
|
||||
.;11tttttfLCCGCCCLLfffftfLLCCCLfLCLCGCLG8@@@@@@@@@@@@@@@@0ft111i1tftft1tiiiit111i;;;;;::::;itfftii1tttf111i;:::;;;;ii;;;i;;i;iiiii;;;:::.
|
||||
.;1111tfffLLCGGCLLLLLLLG08@@@00@@888LtC8@@0CGLC8@@@@@@@@@@Gfi;;ii11tt1ttt1itii1i;;::;;::,,,:;;;1tfLCCCGCCf1;;::;;;i;;i;;;;;:;ii1i;:;i;::,.
|
||||
.;i111tfLLLLLLLGGCCCC08@@@@@880CCCf1itG@8Lffft8@@@@8@0G8@@@C1;;:;;1ttfttf11iii;i;:::,;, ,.,,ifL0@@@@@@88@GLtiiii;iiiiiii1;:;;;i1ii:;;i;::..
|
||||
,i1tttfffffLL080@@@@@@@@0CLffftt1i;;t8@0Lfft8@@@@@@8GCGG8@8fi;::;itttt1tfiii1i;;;:,:. ,C@88088@8GGGG088Cft1111t11iii;::,:;iiiii;;:;;:,,.
|
||||
.;11tfffffCLG8@@@@@@@@@GLfttft111i;;t0@GLCCC0@@@@@@@GCGG@@@Lt;;;;i11111tt1111ii;:,:. ;80LLCG@@@0CLffLfC0LLftftfft1;:;:,:::;ii1;::ii:::,.
|
||||
,;ittfLffLL08@@@@@@8CGCCfttfttfft1;;if@8GCCC0@@@@@@0GGCC8@@Gfi;:::1111t11111ii;:,,, ,0CfLLG@@@8GCLti;iL08LtfLCGCf1ii;::,,:i111i1ii;;::,.
|
||||
,i11tttfLCG@@@@@8GGGLLLCLftffLfLLt1iitf08GCCG@@@@8G8GCC0@@@8f1::,;i11i1ttt11ii;:,,. ,fGtLLL8@@@@000f;:;t00f11tG0@0Lfti;;::;ii1111i;;:;:.
|
||||
,i11ffLCG0G0GCLLLLLLtttffLCGCCGGGGGLt11fC088GGGG8GGGCC8@@@@8fi;::;iiii111iii1;;,.. .:LLLfLC8@@@@@@8t;::t@0t;:11LL08CLL1i;;iiiiiiii;;:,.
|
||||
:i1ttfC0GGCCLffLLLLff1ttfLC8LG008@8GCftttffC0@8@0CG08@@@@@8CLfi;i1;;iii1i;ii;;:,.. ,iCGffLC08@@@@8t1t;108Ci,:;ii1ffCCLft111t1iiiii;;:.
|
||||
,;i1fLLCLfffLffLLLLLfttftLLfCCCG08@0@CLLft111tffLLLfttfC0G0@@C1t1;iii111iiii;:::,. ..:LCGLLLLG0@80Lfffff08G1,::;;iiii1fCLCLLLf1i;i;;::,
|
||||
.;11tftttttttffffLftt11tfffLfLLCG0808G8Gft1111ii;;;:;;1C8@@@@00fi11t1i111iii;;;::,,,;t0CLLCL8CCG0CCLLLG88Gi::ii1i;iiii1tLCGGCLt1i;;::,.
|
||||
,;i1tt1111i1111ttttt11111fffLfLLCG00G0GGCCLfftt1i;:;:iLC0@@@@8f1ttffttt111ii;i;;;:::1G000GLttL08000GG0CL1;;itffttft11111tfCCCLt1i;;:::.
|
||||
,;iiiiiii;;iiitffffLLf111tfLCCCCCCGGGC0000CCCCffttiitfCG@@@@0ffffLCLfff1t11i11i1ii;i1C@8Gf1;:;;11t1tt111i1fLLLCCLfLt1t1111ffftt1ii;;;:.
|
||||
.;iiiii;;;iii1tLCC8@GGLft1tfLLLCCLLLLCCG088@8CCLCf1tfLC0008CLLCLGGCLLfft11111111t11i1fG0Cti:,,,::;;it1tLCfLLLCCLLLLttti1tt1tftfftii;;.
|
||||
;i1iiiiiii1tffCG0GG88GCLfffttfffLCCCL000GGGCCLLLtfffCC8GCLC@80G8GGLLfftt11111tttft11ffCLf1i;:;i1111fffLCCLCCLffft1t1ii11111ttfft1i:
|
||||
,1ttt11111tfLGGLLLLffLLLLfLLLCCC0800G0GLLftttffftffLLCfffG88@@GC0GCLCftttt11tttffttfLL1ffttiiittfftffCCLLLf1t11iiiii;;i1iiiiiiiii;.
|
||||
,tfLLLfftfLCLCCLLftttttffttfttLfffCLLfttttffffftfffftttLLC080GGGG0GLLf1t11ttfffttL0Lft1tf1ii11tfLLLLLLLLftf1iiiiiiiiiiiii;:::,::,
|
||||
,tLffLLCLLCCLffffttt111t1111iiiii11111ttfffttt1ttt11t1tLC0800@@@80CCCffLfCLfttfLfLt1i11t1i1iittftfLLfftf1t1ttttii;;;ii;;:,.....
|
||||
,tLLGCCCCCCLLLffffft1111i;;;;;;;;i;ttLCLLffft1i11ii1tf0@@@8@@@800GCCCGGCft1fftttiiii1i1i;1ii11ffLfft11iii1i;:::;iii;:,,.....
|
||||
:fLLLCGGCCCLffffft1ii;;;:;::;;iiffC00@@@0LLfft11iiii1L0@@@@@@0GGCCG008CffLLtii;;;;;;;ii;i::ii1fLftti;;:,,,,:;iii;;:,.......
|
||||
:fLLLLCLffLffttt11ii;;;::;;i111LGLfLLfLCGLffti:,,:;i1C8@@@@@@8@08@@@8GCL1:::::::;ii;ii;:::;iii1tft1i;;;;i1iii;i;::,...,,.
|
||||
:fLLffLLfttt11ii;;;::,:;;;:;ii;;ii1tt111i;:,,::::;i1L8@@@@@@80@@8Gt;:,...::;;iii1tf1;,,:::::;;i1i;;iiiii1i;i;;:,::,,,.
|
||||
.iLLfffftt1iii;;;::::;;;;i11tffLCCLLLftii;:,::,::;1f8@@@@@@@0fi;,.. :i1ttLff0Gfi;:,.. ..,:,,:::;ii;;iii;;;;::,,.
|
||||
.iLLLtt1iiii;;;;:;;;iii1ttttfLLfLLfff11;::,,::,:;t0@@@@@Ci:,... .,:i11i;ii111i,. .,,,,,:;;:;iiiiiiii;;,,..
|
||||
:ttt1111ii;;:;;:;;;;iiiii1111tt11ii;::::::,,,,it0@@Gi:,..... .,,:::;;;i;::::,,. .,,:;;iiii;iiiii1iiii;;,,.
|
||||
;Lfft11ii;;;;;:;iii1tfftfLLft1iii;:::;;:;;;;itG8f;:::,,.. ..,:;ii1tttti;::,... ,::;;1t1111111iiiii;:.
|
||||
,tt111i;;::::;;iii11111t111ii1i;;;;iiiiii11C@Gt1i;:::,....,,,:;iiii1iti:,,....,,::;;;ii11iiii;;:,
|
||||
:1tti;;;::;:::;;;i;i1ii1iiii;;;;;;;;;1fC@@@8Cti;;::::,,,,:::;i;;;:;::,,...,,,::;;;;:::::::,..
|
||||
.;11iii;:::::;i;ii;11;ii;;;ii;;ii1tfLLGG00Cft1;;::::,,::::;;;:;;:,:,,..,,,:;;i;;:;;:,.
|
||||
,ff11;;;:;:;;;i::;;;;;;;ii1it11tft1tttt1111ii;::::::::::,::,,.... .,::;;;i;;:,
|
||||
.ii11i1i;;;i;,;::;:;iiii;;i;it;:1;i;;;;;;;;;;::::::,,.,,,.. ..,::;:.
|
||||
:1tftt;i;;::,::::;;;;:::;ii:;i:::,::,,:,,.,,,,... ..
|
||||
:LLi11;:::::::,::::::::;::;:,,:,:,,...
|
||||
.i1i;;;;::::,,::,,::::,,,.,::,...
|
||||
:iii;::::,:::::,,....,,...
|
||||
,;;;;::,,,,,,,........
|
||||
.;1i;:,,,,,... ...
|
||||
.,;:;i:........... .
|
||||
...........
|
||||
-->
|
||||
165
js/SL.Astro.js
Normal file
165
js/SL.Astro.js
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* SUBLUNAR ALMANAC
|
||||
*/
|
||||
var SL = SL || {};
|
||||
|
||||
/**
|
||||
* Astronomical and astrological calculations
|
||||
*/
|
||||
SL.Astro = (function() {
|
||||
|
||||
/**
|
||||
* Astronomical calculations
|
||||
* @public {Object} moon - holds definitions and labels
|
||||
* @public {function} moonPhase() - calculate moon phase from phase angle and lunar day
|
||||
*/
|
||||
var Nomy = (function() {
|
||||
|
||||
/**
|
||||
* moon object with definitions
|
||||
*/
|
||||
var moon = {
|
||||
phase : {
|
||||
symbol : [ "void", "🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘" ],
|
||||
name : ["void", "new", "waxing crescent", "first quarter", "waxing gibbous", "full", "waning gibbous", "last quarter", "waning crescent" ]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* moonPhase function returns the current phase of the moon
|
||||
* @param {Object} lunar - Object with lunar day, phase angle and phase (% illumination) of a moment
|
||||
* @return {int} phase - number from 1 (new moon) to 5 (full moon) to 8 (waning crescent)
|
||||
*/
|
||||
function moonPhase(lunar) {
|
||||
var sphase;
|
||||
var g;
|
||||
var phase;
|
||||
if ( lunar.angle < 180 ) sphase = "new";
|
||||
if ( lunar.angle < 168 ) sphase = "crescent";
|
||||
if ( lunar.angle < 95 ) sphase = "quarter";
|
||||
if ( lunar.angle < 85 ) sphase = "gibbous";
|
||||
if ( lunar.angle < 12 ) sphase = "full";
|
||||
// sweph returns the phase angle just between 0° and 180°, so in order
|
||||
// to find whether it is waxing or waning, we utilize the lunar day:
|
||||
if ( lunar.day < 16 ) g = "waxing";
|
||||
if ( lunar.day >= 16 ) g = "waning";
|
||||
if ( sphase == "new" ) phase = 1;
|
||||
if ( sphase == "full" ) phase = 5;
|
||||
if ( sphase == "quarter" && g == "waxing") phase = 3;
|
||||
if ( sphase == "quarter" && g == "waning") phase = 7;
|
||||
if ( sphase == "crescent" && g == "waxing" ) phase = 2;
|
||||
if ( sphase == "crescent" && g == "waning" ) phase = 8;
|
||||
if ( sphase == "gibbous" && g == "waxing" ) phase = 4;
|
||||
if ( sphase == "gibbous" && g == "waning" ) phase = 6;
|
||||
return phase;
|
||||
}
|
||||
return {
|
||||
moonPhase: moonPhase,
|
||||
moon : moon
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
* Astrological calculations
|
||||
* @public {Object} planet - holds definitions and labels
|
||||
* @public {Object} zodiac - holds definitions and labels
|
||||
* @public {function} zodToDeg() - calculates longitudes in the format "02° Aries 12" to float degrees
|
||||
* @public {function} getZodiac() - returns the zodiac sign for given degrees (tropical or sidereal)
|
||||
*/
|
||||
var Logy = (function() {
|
||||
/**
|
||||
* planet object with definitions
|
||||
*/
|
||||
var planet = {
|
||||
name : [ "void", "Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn" ],
|
||||
ruler : {
|
||||
greek : [ "void", "Helios", "Selene", "Ares", "Hermes", "Zeus", "Aphrodite", "Kronos" ],
|
||||
roman: [ "void", "Sol", "Luna", "Mars", "Mercury", "Jupiter", "Venus", "Saturn" ]
|
||||
},
|
||||
symbol : [ "void", "☉", "☽", "♂", "☿", "♃", "♀", "♄" ],
|
||||
day : [ "void", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
|
||||
order : [ 0, 1, 6, 4, 2, 7, 5, 3 ]
|
||||
}
|
||||
|
||||
/**
|
||||
* zodiac object with definitions
|
||||
*/
|
||||
var zodiac = {
|
||||
name : [ "void", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces" ],
|
||||
symbol : [ "void", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓" ],
|
||||
ruler : [ 0, 3, 6, 4, 2, 1, 4, 6, 3, 5, 7, 7, 5 ]
|
||||
}
|
||||
|
||||
/**
|
||||
* zodToDeg function converts zodiacal degree notation to degrees
|
||||
* @param {string} zcoord - a string in zodiacal degree notation, e.g. "14° Taurus 34"
|
||||
* @return {float} degrees
|
||||
*/
|
||||
function zodToDeg(zcoord) {
|
||||
var zdef = zodiac; // global variable needs to be declared before using this function
|
||||
if(zcoord) {
|
||||
var z = zcoord.split(" ");
|
||||
var m = 0;
|
||||
for (var i = 0, len = 13; i < len; i++) {
|
||||
if (zdef.name[i] == z[1] || zdef.symbol[i] == z[1] ) m = i-1;
|
||||
}
|
||||
return parseFloat(z[0]) + m * 30 + parseFloat(z[2]) / 60;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* degToZod function converts degrees to zodiacal degree notation
|
||||
* @param {string} deg - degrees
|
||||
* @param {int} - 1 for sidereal zodiac, anything else for tropical
|
||||
* @return {float} a string in zodiacal degree notation, e.g. "14° Taurus 34"
|
||||
*/
|
||||
function degToZod(deg, sidereal =-1) {
|
||||
var zdef = zodiac;
|
||||
if ( $("#zodiac").is(':checked') && sidereal != 0 ) sidereal = 1;
|
||||
if ( sidereal == 1 ) {
|
||||
deg -= 24.11722222222; // degrees difference between tropical and sidereal
|
||||
}
|
||||
if ( deg >= 360.0 ) deg = Math.abs(deg - 360.0);
|
||||
var zod = getZodiac(deg, 0);
|
||||
var diff = ( zod.sign - 1 ) * 30.0;
|
||||
var degrees = deg - diff;
|
||||
var first = Math.floor(degrees);
|
||||
var second = Math.round((degrees - first) * 60.0);
|
||||
return first+" "+zdef.symbol[zod.sign]+" "+second;
|
||||
}
|
||||
|
||||
/**
|
||||
* getZodiac function returns the zodiac sign and decan for a given longitude
|
||||
* @param {float} deg - decimal longitude degrees
|
||||
* @param {int} sidereal - 1 for sidereal zodiac, other number for tropical zodiac
|
||||
* @return {Object} obj.sign - zodiac sign 1-12, obj.decan - zodiac decan 1-36
|
||||
*/
|
||||
function getZodiac(deg, sidereal = -1) {
|
||||
if ( $("#zodiac").is(':checked') && sidereal != 0 ) sidereal = 1;
|
||||
if ( sidereal == 1 ) {
|
||||
deg -= 24.11722222222; // degrees difference between tropical and sidereal
|
||||
}
|
||||
if ( deg >= 360.0 ) deg = Math.abs(deg - 360.0);
|
||||
deg += 0.0001; // added to compensate rounding, resulting in 0° to 29.99° being Aries instead of 0° to 30°
|
||||
var obj = {
|
||||
sign: Math.ceil(deg / 30),
|
||||
decan: Math.ceil(deg / 10)
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
return {
|
||||
planet : planet,
|
||||
zodiac : zodiac,
|
||||
zodToDeg : zodToDeg,
|
||||
degToZod : degToZod,
|
||||
getZodiac : getZodiac
|
||||
}
|
||||
}());
|
||||
return {
|
||||
Nomy : Nomy,
|
||||
Logy : Logy,
|
||||
}
|
||||
}());
|
||||
588
js/SL.Calendar.js
Normal file
588
js/SL.Calendar.js
Normal file
|
|
@ -0,0 +1,588 @@
|
|||
/**
|
||||
* @preserve Copyright © 2018 T. F. Raaion, www.sublunar.space
|
||||
* (MIT): http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* SUBLUNAR ALMANAC
|
||||
*/
|
||||
var SL = SL || {};
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
/**
|
||||
* Methods and objects to generate the calendar
|
||||
* @public {function} modules() - loads all plugin modules defined in an Array in index.html and adds their filters to the navbar
|
||||
* @public {function} make() - creates the grid of planetary hours for given coordinates and time in Settings
|
||||
* @public {Array} moments - holds all the JSON Ephemeris objects to calculate the calendar data
|
||||
* @public {function} hourInfo() - creates a temporary DOM object to be displayed as hour info upon clicking a planetary hour object
|
||||
* @public {function} comboFilter() - is a filter function for Isotope to include all selected tags and operations within a filter but exclude between each other
|
||||
* @public {function} getGeoCode() - set latitude, longitude, and UTC-Offset form fields for a given place entered in Settings
|
||||
* @public {function} about() - creates a DOM object with the "About" text for SUBLUNAR ALMANAC.
|
||||
* @public {function} reset() - simulates a resizing of the browser window. Needed hack for a display glitch in the modals.
|
||||
* @public {function} resetFileInput() - resets the file selection button in Settings
|
||||
* @public {function} download() - download a JSON object as a file
|
||||
*/
|
||||
SL.Calendar = (function() {
|
||||
|
||||
/**
|
||||
* about function creates a DOM object with the "About" text for SUBLUNAR ALMANAC
|
||||
*/
|
||||
function about() {
|
||||
$('<div/>').loadTemplate($("#tpl-modal"), {
|
||||
title : '<center><h1 class="stoke">SUBLUNAR ALMANAC</h1></center>',
|
||||
right : '<center><p><style>.bmc-button img{width: 27px !important;margin-bottom: 1px !important;box-shadow: none !important;border: none !important;vertical-align: middle !important;}.bmc-button{line-height: 36px !important;height:37px !important;text-decoration: none !important;display:inline-flex !important;color:#000000 !important;background-color:#FFFFFF !important;border-radius: 3px !important;border: 1px solid transparent !important;padding: 1px 9px !important;font-size: 22px !important;letter-spacing: 0.6px !important;box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;margin: 0 auto !important;font-family:\'Cookie\', cursive !important;-webkit-box-sizing: border-box !important;box-sizing: border-box !important;-o-transition: 0.3s all linear !important;-webkit-transition: 0.3s all linear !important;-moz-transition: 0.3s all linear !important;-ms-transition: 0.3s all linear !important;transition: 0.3s all linear !important;}.bmc-button:hover, .bmc-button:active, .bmc-button:focus {-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;text-decoration: none !important;box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;opacity: 0.85 !important;color:#000000 !important;}</style><link href="https://fonts.googleapis.com/css?family=Cookie" rel="stylesheet"><a class="bmc-button" target="_blank" href="https://www.buymeacoffee.com/sublunar"><img src="https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg" alt="Buy me a coffee"><span style="margin-left:5px">Buy me a coffee</span></a> <a class="github-button" href="https://github.com/sublunarspace/sublunar.almanac" data-size="large" aria-label="Star sublunarspace/sublunar.almanac on GitHub">GitHub</a></p><p><a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a> © 2018 T. F. Raaion / <a href="http://sublunar.space">sublunar space</a></p></center><hr /><center><p>Astronomical calculations are based on <br /><a href="http://www.astro.com/swisseph/swephinfo_e.htm" target="_blank">Swiss Ephemeris API</a>, © 1997-2016 Astrodienst AG, <a href="https://opensource.org/licenses/GPL-2.0" target="_blank">(GPLv2.0+)</a><br />and the <a href="http://www.moshier.net/#Astronomy" target="_blank">Table of New Moon Dates</a> by Steve Moshier.</p><p>The front-end relies on the following Javascript Libraries:<br /><a href="https://jquery.com/" target="_blank">jQuery 3.2.1</a>, © JS Foundation, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a><br /><a href="https://getbootstrap.com/" target="_blank">Bootstrap 3.3.7</a>, © Twitter, Inc., <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a><br /><a href="https://github.com/codepb/jquery-template/" target="_blank">jQuery.loadTemplate</a>, © 2013 Paul Burgess and other contributors, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a><br /><a href="http://momentjs.com" target="_blank">MomentJS 2.18.1</a>, © Tim Wood, Iskren Chernev, Moment.js contributors, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a><br /><a href="http://isotope.metafizzy.co" target="_blank">Isotope 3.0.4</a>, © 2017 Metafizzy, <a href="https://opensource.org/licenses/GPL-3.0" target="_blank">(GPLv3)</a><br /><a href="http://defiantjs.com" target="_blank">DefiantJS 1.4.1</a>, © 2013-2017, Hakan Bilgin, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a><br /><a href="http://ricostacruz.com/nprogress" target="_blank">NProgress</a>, © 2013, 2014 Rico Sta. Cruz, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a><br /><a href="https://github.com/klokantech/javascript" target="_blank">OsmNamesAutocomplete</a>, © 2016 Klokan Technologies GmbH, <a href="https://opensource.org/licenses/GPL-3.0" target="_blank">(GPLv3)</a><br /><a href="https://github.com/darkskyapp/tz-lookup" target="_blank">tzlookup</a>, by The Dark Sky, LLC, <a href="https://creativecommons.org/publicdomain/zero/1.0/" target="_blank">(CC0 1.0 Universal)</a><br /><a href="https://github.com/nwcell/ics.js/" target="_blank">ics.js</a>, © 2018 Travis Krause, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a></p><p>The design is based on<br /><a href="http://bootswatch.com" target="_blank">bootswatch v3.3.7</a>, © 2012-2017 Thomas Park, <a href="https://opensource.org/licenses/MIT" target="_blank">(MIT)</a>.</center><script async defer src="https://buttons.github.io/buttons.js"></script>'
|
||||
})
|
||||
.appendTo('#modals')
|
||||
.attr('id', 'aboutSLC')
|
||||
.attr('tabindex', '-1')
|
||||
.attr('role', 'dialog')
|
||||
.addClass('modal fade autoModal')
|
||||
.find('.col-sm-4').closest('.row')
|
||||
.find('.col-sm-8').attr('class', 'col-sm-12').closest('.row')
|
||||
.find('.col-sm-4').remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* resetWindow function simulates a resizing of the browser window. Needed hack for a display glitch in the modals.
|
||||
*/
|
||||
function resetWindow() {
|
||||
var resizeEvent = window.document.createEvent('UIEvents');
|
||||
resizeEvent .initUIEvent('resize', true, false, window, 0);
|
||||
window.dispatchEvent(resizeEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* resetFileInput resets the file selection button in Settings
|
||||
*/
|
||||
function resetFileInput() {
|
||||
$('#fileInput').wrap('<form>').closest('form').get(0).reset();
|
||||
$('#fileInput').unwrap();
|
||||
$('#fileInputLabel').removeClass('btn-danger btn-success').addClass('btn-default').find('span').html('Select File');
|
||||
}
|
||||
|
||||
/**
|
||||
* download a JSON object as a file
|
||||
* @param {Object} exportObj - JSON Object to be downloaded
|
||||
* @param {string} exportName - file name for the JSON Object to be downloaded
|
||||
* found here: https://stackoverflow.com/questions/19721439/download-json-object-as-a-file-from-browser
|
||||
*/
|
||||
function download(exportObj, exportName, query = "query"){
|
||||
var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent('{"'+query+'":'+JSON.stringify(exportObj)+'}');
|
||||
var downloadAnchorNode = document.createElement('a');
|
||||
downloadAnchorNode.setAttribute("href", dataStr);
|
||||
downloadAnchorNode.setAttribute("download", exportName + ".json");
|
||||
document.body.appendChild(downloadAnchorNode); // required for firefox
|
||||
downloadAnchorNode.click();
|
||||
downloadAnchorNode.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* getGeoCode function to set latitude, longitude, and UTC-Offset form fields for a given place entered in Settings
|
||||
* @param {Object} item - JSON Object returned from kt.OsmNamesAutocomplete (see index.html)
|
||||
*/
|
||||
function getGeoCode(item) {
|
||||
$('#lat').addClass('loading');
|
||||
$('#lon').addClass('loading');
|
||||
$('#offset').addClass('loading');
|
||||
// find timezone with tzlookup for lat and long returned from kt.OsmNamesAutocomplete JSON
|
||||
// and extract UTC offset from a string in the format "(UTC+03:00)":
|
||||
$.getJSON( "https://raw.githubusercontent.com/dmfilipenko/timezones.json/master/timezones.json", function( zones ) {
|
||||
var off = JSON.search( zones, '//*[utc="'+tzlookup(item.lat, item.lon)+'"]');
|
||||
$('#lat').val(item.lat);
|
||||
$('#lon').val(item.lon);
|
||||
var os;
|
||||
// it's a dirty hack solution...
|
||||
if ( off[0].text ) {
|
||||
if ( off[0].text.split(')')[0] == '(UTC') os = 0;
|
||||
else {
|
||||
if ( item.lon < 0 ) os = parseInt(off[0].text.split(')')[0].split('-')[1].split(':')[0], 10)*-1;
|
||||
if ( item.lon > 0 ) os = parseInt(off[0].text.split(')')[0].split('+')[1].split(':')[0], 10);
|
||||
}
|
||||
} else os = "???";
|
||||
$('#offset').val(os);
|
||||
$('#lat').removeClass('loading');
|
||||
$('#lon').removeClass('loading');
|
||||
$('#offset').removeClass('loading');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hours object with variable and function to generate the grid of planetary hours
|
||||
* @public {Object} moments - JSON object holding all the data returned from the swiss ephemeris calculations done by pmom.c
|
||||
* @public {function} make() - creates the grid of planetary hours for given coordinates and time
|
||||
*/
|
||||
var Hours = (function() {
|
||||
|
||||
/**
|
||||
* moments JSON object with all returned moments from pmom.c. Filled by make()
|
||||
*/
|
||||
var moments = [];
|
||||
|
||||
/**
|
||||
* make function creates the grid of planetary hours for given coordinates and time in Settings
|
||||
* @param {int} days - number of days to be calculated
|
||||
* @param {int} ts - unix timestamp of first day of the calendar to be calculated
|
||||
* @param {float} lat - decimal degrees latitude of place on Earth
|
||||
* @param {float} lon - decimal degrees longitude of place on Earth
|
||||
*/
|
||||
function make(days, ts, lat, lon ) {
|
||||
if ( days > 60 ) {
|
||||
alert("Sorry, the calculation is limited to 60 days at the moment! Calculating the first 60 out of your desired "+days+" days!");
|
||||
days = 60;
|
||||
}
|
||||
$('#grid').empty();
|
||||
$('#download').remove();
|
||||
Filter.load();
|
||||
var files = document.getElementById('fileInput').files;
|
||||
// check if JSON file is loaded. If not, calculate...
|
||||
if (files.length <= 0) {
|
||||
var url = "pmom.php?days="+days+"&ts="+ts+"&lat="+lat+"&lon="+lon;
|
||||
fetch(url)
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(json) {
|
||||
Hours.moments = json.query;
|
||||
for (var i = 0, len = Hours.moments.length; i < len; i++) {
|
||||
var everyday = setTimeout( Hour.make, 10, Hours.moments[i], i, Hours.moments.length, everyday);
|
||||
NProgress.set(i/Hours.moments.length);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// display calendar data from JSON file
|
||||
var fr = new FileReader();
|
||||
fr.onloadend = function(e) {
|
||||
try {
|
||||
var result = JSON.parse(e.target.result);
|
||||
} catch (e) {
|
||||
NProgress.done();
|
||||
$('#settings').modal('show');
|
||||
$('#fileInputLabel').removeClass('btn-success').addClass('btn-danger').find('span').html('FILE ERROR');
|
||||
alert("Sorry, wrong file format!");
|
||||
SL.Calendar.resetFileInput();
|
||||
return false;
|
||||
}
|
||||
Hours.moments = result.query;
|
||||
if ( Hours.moments.length > 0 ) {
|
||||
for (var i = 0, len = Hours.moments.length; i < len; i++) {
|
||||
var everyday = setTimeout( Hour.make, 10, Hours.moments[i], i, Hours.moments.length, everyday);
|
||||
NProgress.set(i/Hours.moments.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
fr.readAsText(files.item(0));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
make: make,
|
||||
moments : moments,
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/**
|
||||
* Hour object with variable and function to generate a single planetary hour
|
||||
* @public {function} make() - creates a DOM object of a planetary hour based on a template defined in index.html
|
||||
* @public {function} info() - creates a temporary DOM object to be displayed as hour info upon clicking a planetary hour object
|
||||
*/
|
||||
var Hour = (function() {
|
||||
|
||||
/**
|
||||
* make function creates a DOM object of a planetary hour based on a template defined in index.html
|
||||
* @param {Object} data - a single hour JSON object with all data to build a DOM object
|
||||
* @param {int} j - increment number of hour object
|
||||
* @param {int} all - total number of objects to be created
|
||||
* @param {int} timeout - holds the ID value returned by setTimeout() in Hours.make()
|
||||
*/
|
||||
function make(data, j, all, timeout) {
|
||||
var now = new moment.utc().unix();
|
||||
var m = data;
|
||||
if ( $("#future").is(':checked') && now > m.ts ) return false;
|
||||
var zodiac = SL.Astro.Logy.getZodiac(m.ephemeris.sun.deg);
|
||||
var moonsign = SL.Astro.Logy.getZodiac(m.ephemeris.sun.deg);
|
||||
var extraData = Module.data(m);
|
||||
$('<div/>').loadTemplate($("#tpl-planetaryhour"), {
|
||||
ruler : SL.Astro.Logy.planet.symbol[(m.planetary.day.no+1)],
|
||||
date : new moment.unix(m.ts).utc().add($('#offset').val(), 'h').format('D/M'),
|
||||
hourstart : new moment.unix(m.planetary.hour.start).utc().add($('#offset').val(), 'h').format('HH:mm'),
|
||||
hourruler : m.planetary.hour.no+1,
|
||||
hournumber : SL.Astro.Logy.planet.symbol[SL.Astro.Logy.planet.order[((m.planetary.hour.no+1+(m.planetary.day.no*24) - 1) % 7 ) + 1]],
|
||||
hourend : new moment.unix(m.planetary.hour.end).utc().add($('#offset').val(), 'h').format('HH:mm'),
|
||||
})
|
||||
.addClass('col-md-2 centered planetaryhour')
|
||||
.addClass(Module.classes(extraData))
|
||||
.attr('id', 'moment_'+j)
|
||||
.attr('ts', m.ts)
|
||||
.appendTo('#grid');
|
||||
if ( m.planetary.hour.no > 11 ) {
|
||||
$('#moment_'+j).addClass('night-hour');
|
||||
}
|
||||
if ( j == all-1 ) {
|
||||
if ( $('#search').val() != '' && $('#fileInput').val() == '') {
|
||||
$('<button/>').attr('role', 'button').attr('target', '_blank').attr('id', 'download').html('Download File').addClass('btn btn-default pull-left').prependTo('#settings .modal-footer');
|
||||
$('#download').on('click', function() {
|
||||
SL.Calendar.download(Hours.moments, $('#search').val().split(' ').join('_')+'_'+new moment.unix(Hours.moments[0].ts).utc().format('DDMMMYYYY')+'-'+new moment.unix(Hours.moments[0].ts).utc().add($('#days').val(), 'days').format('DDMMMYYYY'));
|
||||
});
|
||||
}
|
||||
SL.Calendar.resetFileInput();
|
||||
$('.planetaryhour').on('click', SL.Calendar.hourInfo);
|
||||
NProgress.done();
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* info function creates a temporary DOM object to be displayed as hour info upon clicking a planetary hour object
|
||||
*/
|
||||
function info() {
|
||||
var myid = $(this).attr('id');
|
||||
var idx = myid.split('_')[1];
|
||||
var mom = Hours.moments[idx];
|
||||
var ts = mom.planetary.hour.start;
|
||||
if ( $("#hourinfo").length ) $("#hourinfo").remove();
|
||||
$('<div/>').loadTemplate($("#tpl-modal"), {
|
||||
title : SL.Astro.Logy.planet.day[mom.planetary.day.no+1]+", "+new moment.unix(mom.ts).utc().add($('#offset').val(), 'h').format('MMM D')+", Hour: "+(mom.planetary.hour.no+1),
|
||||
right : '<ul id="houractions" class="option-set"></ul>\n',
|
||||
left : '<ul id="hourinfos" class="option-set"></ul>\n'
|
||||
}).appendTo('#modals').attr('id', 'hourinfo').attr('tabindex', '-1').attr('role', 'dialog').addClass('modal fade autoModal');
|
||||
$('#p-info').html(
|
||||
$('#hourinfos').append(
|
||||
'<li> </li>\n'+
|
||||
'<li>Lunar Day: '+(mom.lunar.day+1)+'</li>\n'+
|
||||
'<li>'+SL.Astro.Nomy.moon.phase.symbol[SL.Astro.Nomy.moonPhase(mom.lunar)]+' '+SL.Astro.Nomy.moon.phase.name[SL.Astro.Nomy.moonPhase(mom.lunar)]+'</li>\n'+
|
||||
'<li>Phase: '+Math.round(mom.lunar.phase * 100)+'%</li>\n'+
|
||||
'<li>Angle: '+Math.round(mom.lunar.angle * 100) / 100+'°</li>\n'+
|
||||
'<li> </li>\n'
|
||||
));
|
||||
var chaldean = ["Moon", "Mercury", "Venus", "Sun", "Mars", "Jupiter", "Saturn"];
|
||||
chaldean.forEach(function(planet) {
|
||||
$('#hourinfos').append(
|
||||
'<li><b>'+planet+'</b></li>\n'+
|
||||
'<li>Position: '+SL.Astro.Logy.degToZod(eval("mom.ephemeris."+planet.toLowerCase(planet)+".deg"))+'</li>\n'+
|
||||
'<li>Sign: '+SL.Astro.Logy.zodiac.name[SL.Astro.Logy.getZodiac(eval("mom.ephemeris."+planet.toLowerCase()+".deg")).sign]+'</li>\n'+
|
||||
'<li>Ruler: '+SL.Astro.Logy.planet.name[SL.Astro.Logy.zodiac.ruler[SL.Astro.Logy.getZodiac(eval("mom.ephemeris."+planet.toLowerCase()+".deg")).sign]]+'</li>\n'+
|
||||
'<li> </li>\n');
|
||||
});
|
||||
$('#houractions').html('');
|
||||
var tags = [];
|
||||
var extData = Module.data(mom);
|
||||
Object.keys(extData).forEach(function(key) {
|
||||
if (!extData[key].hasOwnProperty("hide") || (extData[key].hasOwnProperty("hide") && extData[key].hide != "info"))
|
||||
tags.push(extData[key].tags);
|
||||
var appender = '#houractions .'+key+'-actions';
|
||||
if ( Module.modules[key].definitions.hasOwnProperty("group") && Module.modules[key].definitions.group.hasOwnProperty("info") ) {
|
||||
if ( !$('li.info-section-'+Module.modules[key].definitions.group.id).length ) {
|
||||
$('#houractions').append(
|
||||
$('<ul/>').append(
|
||||
'<li> </li>\n'+
|
||||
'<li class="info-section-'+Module.modules[key].definitions.group.id+'"><b>'+Module.modules[key].definitions.group.text+'</b></li>\n'+
|
||||
'<li><ul class="'+Module.modules[key].definitions.group.id+'-actions"></ul>\n</li>\n'
|
||||
)
|
||||
);
|
||||
}
|
||||
appender = '#houractions .'+Module.modules[key].definitions.group.id+'-actions';
|
||||
}
|
||||
else {
|
||||
$('#houractions').append(
|
||||
$('<ul/>').append(
|
||||
'<li> </li>\n'+
|
||||
'<li><b>'+Module.modules[key].definitions.name+'</b></li>\n'+
|
||||
'<li><ul class="'+key+'-actions"></ul>\n</li>\n'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (extData[key].data) extData[key].data.forEach(function(el) {
|
||||
if (!el.hasOwnProperty("hide") || (el.hasOwnProperty("hide") && el.hide != "info"))
|
||||
$(appender).append('<li>'+el.action+'</li>\n');
|
||||
});
|
||||
});
|
||||
var tagcloud = tags.join(" ").split(' ').sort();
|
||||
$('#houractions').append( '<br /><b>Tags</b><br />\n'+$.unique( tagcloud ).join(" "));
|
||||
var title = SL.Astro.Logy.planet.day[mom.planetary.day.no+1]+"+Hour+"+(mom.planetary.hour.no+1);
|
||||
var desc = $('#hourinfos').html()+'\n\n'+$('#houractions').text();
|
||||
$('<a/>').attr('role', 'button').attr('target', '_blank').attr('href',
|
||||
'http://www.google.com/calendar/render?action=TEMPLATE&text='
|
||||
+title
|
||||
+'&dates='+new moment.unix(mom.planetary.hour.start).format('YYYYMMDD[T]HHmmss[Z]')+'/'+new moment.unix(mom.planetary.hour.end).format('YYYYMMDD[T]HHmmss[Z]')
|
||||
+'&details='+encodeURIComponent(desc.replace(/<[^>]+>/g, ''))+'&trp=false&sf=true&output=xml'
|
||||
).html('to GCalendar').addClass('btn btn-default').prependTo('#hourinfo .modal-footer');
|
||||
$('<a/>').attr('role', 'button').attr('id', 'ics').attr('target', '_blank').html('iCal File').addClass('btn btn-default').prependTo('#hourinfo .modal-footer');
|
||||
$('#ics').on('click', function() {
|
||||
var iCal = ics();
|
||||
iCal.addEvent(title, desc.replace(/<[^>]+>/g, '').split('\n').join('\\n').split('\\n\\n').join('\\n').split(' ').join(''), $('#lat').val()+' '+$('#lon').val(), new moment.unix(mom.planetary.hour.start).utc().format('DD MMM YYYY HH:mm:ss [GMT]'), new moment.unix(mom.planetary.hour.end).utc().format('DD MMM YYYY HH:mm:ss [GMT]'));
|
||||
iCal.download('planetary-'+title);
|
||||
});
|
||||
$('#hourinfo').modal('show');
|
||||
}
|
||||
|
||||
return {
|
||||
make: make,
|
||||
info : info
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/**
|
||||
* Filter object with variable and functions to filter the planetary hours by the plugin modules
|
||||
* @public {function} load() - loads all plugin modules defined and adds their filters
|
||||
* @public {function} modal() - creates DOM objects to be displayed as navbar menu items and modal hosting all the filter options of a plugin module
|
||||
* @public {function} comboFilter() - is a filter function for Isotope to include all selected tags and operations within a filter but exclude between each other
|
||||
*/
|
||||
var Filter = (function() {
|
||||
|
||||
/**
|
||||
* load function loads all plugin modules defined in an Array in index.html and adds their filters
|
||||
*/
|
||||
function load() {
|
||||
$("#filterList").empty();
|
||||
Object.keys(Module.modules).forEach(function(plugin) {
|
||||
if ( $("#moduleSelect label .module_"+plugin).is(':checked') ) {
|
||||
var definitions = Module.modules[plugin].definitions;
|
||||
modal(plugin, definitions);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* modal function creates DOM objects to be displayed as navbar menu items and modal hosting all the filter options of a plugin module
|
||||
* @param {sting} id - id of a plugin module
|
||||
* @param {Object} pluginDefinitions - holds all the definitions defined in a plugin module
|
||||
*/
|
||||
function modal(id, pluginDefinitions) {
|
||||
var items = pluginDefinitions.actions;
|
||||
// check if filters navbar menu item should be grouped ("group" property in plugin module definition)
|
||||
// create bootstrap dropdown menu if needed
|
||||
if ( pluginDefinitions.hasOwnProperty("group") ) {
|
||||
if ( !$('#group_'+pluginDefinitions.group.id).length ) {
|
||||
var dropdown = '<li id="group_'+pluginDefinitions.group.id+'" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-filter"></span> '+pluginDefinitions.group.text+'<span class="caret"></span></a><ul class="dropdown-menu"></ul></li>';
|
||||
$(dropdown).appendTo("#filterList");
|
||||
}
|
||||
var navitem = '<li><a data-toggle="modal" data-target="#'+id+'" href="#">'+pluginDefinitions.name+'</a></li>\n';
|
||||
$('#group_'+pluginDefinitions.group.id+' ul').append(navitem);
|
||||
// otherwise just throw it into the menu bar
|
||||
} else {
|
||||
var navitem = '<li><p class="navbar-btn"><a class="btn btn-default" data-toggle="modal" data-target="#'+id+'" href="#"><span class="glyphicon glyphicon-filter"></span> '+pluginDefinitions.name+'</a></p></li>\n';
|
||||
$(navitem).appendTo("#filterList");
|
||||
}
|
||||
// prepare variables and juggle data to create Tags and Operations to be displayed in the filter modal
|
||||
var title = $('#navigation a[data-target="#'+id+'"]').clone();
|
||||
var tagline = "";
|
||||
var actions = "";
|
||||
var menuItems = {};
|
||||
var tags = [];
|
||||
items.forEach(function(item) {
|
||||
item.forEach(function(i) {
|
||||
if (!i.hasOwnProperty("hide") || (i.hasOwnProperty("hide") && i.hide != "filter")) {
|
||||
if (i.id)
|
||||
menuItems[i.id] = {action: i.action, tags: i.tags};
|
||||
if (i.tags) {
|
||||
i.tags.split(" ").forEach(function(tag) {
|
||||
tags.push(tag);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
var uniqtags = $.unique(tags);
|
||||
// create DOM objects
|
||||
uniqtags.sort().forEach(function(tag) {
|
||||
tagline += '<li><input type="checkbox" class="actiontag" value=".'+tag+'" id="'+id+'-'+tag+'" /> '+tag+'</li>\n';
|
||||
});
|
||||
Object.keys(menuItems).forEach(function(key) {
|
||||
actions += '<li class="operation '+menuItems[key].tags+'"><input type="checkbox" value=".'+id+'-'+key+'" id="'+id+'-'+key+'" /> '+menuItems[key].action+'</li>\n ';
|
||||
});
|
||||
// load template defined in index.html and append all filter data
|
||||
$('<div/>').loadTemplate($("#tpl-modal"), {
|
||||
title : 'Filter by '+pluginDefinitions.name,
|
||||
right : '<h4>Operations</h4><ul class="option-set">'+actions+'</ul>\n',
|
||||
left : '<h4>Tags</h4><ul class="option-set">'+tagline+'</ul>\n'
|
||||
}).appendTo('#modals').attr('id', id).attr('tabindex', '-1').attr('role', 'dialog').addClass('modal fade autoModal')
|
||||
.find('.col-sm-4')
|
||||
.addClass('actionlistfilter')
|
||||
.find('ul')
|
||||
.attr('id', id+'-tags' )
|
||||
.attr('data-group', id )
|
||||
.parents('.modal-body')
|
||||
.find('.col-sm-8')
|
||||
.addClass('filteroptions')
|
||||
.find('ul')
|
||||
.attr('id', id+'-actions')
|
||||
.attr('data-group', id+'-actions' );
|
||||
}
|
||||
|
||||
/**
|
||||
* comboFilter is a filter function for Isotope to include all selected tags and operations within a filter but exclude between each other
|
||||
* based on https://codepen.io/desandro/pen/MebyMR
|
||||
*/
|
||||
function comboFilter() {
|
||||
var combo = [];
|
||||
for ( var prop in filters ) {
|
||||
var group = filters[ prop ];
|
||||
if ( !group.length ) {
|
||||
// no filters in group, carry on
|
||||
continue;
|
||||
}
|
||||
// add first group
|
||||
if ( !combo.length ) {
|
||||
combo = group.slice(0);
|
||||
continue;
|
||||
}
|
||||
// add additional groups
|
||||
var nextCombo = [];
|
||||
// split group into combo: [ A, B ] & [ 1, 2 ] => [ A1, A2, B1, B2 ]
|
||||
for ( var i=0; i < combo.length; i++ ) {
|
||||
for ( var j=0; j < group.length; j++ ) {
|
||||
var item = combo[i] + group[j];
|
||||
nextCombo.push( item );
|
||||
}
|
||||
}
|
||||
combo = nextCombo;
|
||||
}
|
||||
var comboFilter = combo.join(', ');
|
||||
return comboFilter;
|
||||
}
|
||||
|
||||
return {
|
||||
load: load,
|
||||
modal: modal,
|
||||
comboFilter: comboFilter
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/**
|
||||
* Module object with variable and functions to load plugin modules and use them to calculate the data for each planetary hour
|
||||
* @public {Object} modules - holds all plugin modules
|
||||
* @public {function} load() - loads all plugin modules defined in an Array in index.html and adds their filters
|
||||
* @public {function} data() - collects all the tags and operations from all plugin modules for a single planetary hour and bundles them
|
||||
* @public {function} classes() - takes all operations() of all plugin modules for a single planetary hour and creates classes for the DOM object, so Isotope can filter them
|
||||
*/
|
||||
var Module = (function() {
|
||||
|
||||
/**
|
||||
* object to hold all plugin modules
|
||||
*/
|
||||
var modules = {};
|
||||
|
||||
/**
|
||||
* load function loads all plugin modules defined in an Array in index.html and adds their filters
|
||||
* @param {Array} array - IDs (variable names) of all plugin module to be loaded
|
||||
*/
|
||||
function load(array) {
|
||||
var mod = array;
|
||||
console.log(mod.length+' modules defined');
|
||||
mod.forEach(function(m) {
|
||||
extend(m, eval('module_'+m));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* extend function adds a plugin module to the modules Object
|
||||
* @param {string} name - id of the plugin module
|
||||
* @param {Object} plugin - the plugin Object
|
||||
*/
|
||||
function extend(name,plugin) {
|
||||
modules[name] = plugin;
|
||||
var groupname = '';
|
||||
var checked = '';
|
||||
if ( plugin.definitions.hasOwnProperty("core") && plugin.definitions.core == true ) checked = "checked";
|
||||
if ( plugin.definitions.hasOwnProperty("group") ) groupname = "<b>"+plugin.definitions.group.text+"</b> ";
|
||||
$("#moduleSelect").append('<label class="col-md-6"><input class="module_'+name+'" type="checkbox" '+checked+'> '+groupname+plugin.definitions.name+'</label>');
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate function pushes the astronomical data of a planetary hour to a plugin and returns the plugin's calculation
|
||||
* @param {Object} plugin - the plugin module Object
|
||||
* @param {Object} data - the astronomical data Object of a single planetary hour
|
||||
*/
|
||||
function calculate(plugin, data) {
|
||||
return plugin.calculate(plugin.definitions, plugin.property(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* operations function returns the list of tags and operations defined by a plugin module for a planetary hour
|
||||
* @param {Array} actionArray - the plugin module's response from above's calculate() function
|
||||
* @param {string} idstring - the ID of the plugin
|
||||
*/
|
||||
function operations(actionArray, idstring) {
|
||||
var tags = [];
|
||||
var actions = [];
|
||||
var tagstring = "";
|
||||
var actionstring = "";
|
||||
if ( idstring != "" ) idstring += "-";
|
||||
if (actionArray) {
|
||||
if (Array.isArray(actionArray) && actionArray.length > 0) {
|
||||
for (var i = 0, len = actionArray.length; i < len; i++) {
|
||||
if (!actionArray[i].hasOwnProperty("hide") || (actionArray[i].hasOwnProperty("hide") && actionArray[i].hide != "filter")) {
|
||||
if (actionArray[i].hasOwnProperty('tags') && actionArray[i].tags) tags.push(actionArray[i].tags);
|
||||
if (actionArray[i].hasOwnProperty('action') && actionArray[i].action) actions.push(actionArray[i]);
|
||||
}
|
||||
}
|
||||
if (tags) tagstring = $.unique(tags.join(" ").split(' ')).sort().join(" ");
|
||||
actionstring = actionArray.map(function(el) { return idstring + el.id; }).join(" ");
|
||||
actions.sort();
|
||||
}
|
||||
}
|
||||
var obj = {
|
||||
tags : tagstring,
|
||||
actions : actionstring,
|
||||
data : actionArray
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* data function collects all the list objects from operations() for a single planetary hour and bundles them
|
||||
* @param {Object} data - the astronomical data Object of a single planetary hour
|
||||
* @return {Object} extData - Object with all the operations() of all plugin modules for a single planetary houur
|
||||
*/
|
||||
function data(data) {
|
||||
extData = {};
|
||||
Object.keys(modules).forEach(function(plugin) {
|
||||
if ( $("#moduleSelect .module_"+plugin).is(':checked') )
|
||||
extData[plugin] = operations(calculate(modules[plugin], data), plugin);
|
||||
});
|
||||
return extData;
|
||||
}
|
||||
|
||||
/**
|
||||
* classes function takes all operations() of all plugin modules for a single planetary hour and creates classes for the DOM object, so Isotope can filter them
|
||||
* @param {Object} extData - Object with all the operations() of all plugin modules for a single planetary hour
|
||||
* @return {string} string - string of class names to be added to the DOM object
|
||||
*/
|
||||
function classes(extData) {
|
||||
tags = [];
|
||||
actions = [];
|
||||
string = "";
|
||||
Object.keys(extData).forEach(function(plugin) {
|
||||
//tags.push(extData[plugin].tags);
|
||||
actions.push(extData[plugin].actions);
|
||||
});
|
||||
//if (tags) string = $.unique(tags.join(" ").split(' ')).sort().join(" ") + " ";
|
||||
if (actions) string += actions.sort().join(" ");
|
||||
return string;
|
||||
}
|
||||
|
||||
return {
|
||||
load: load,
|
||||
modules: modules,
|
||||
data: data,
|
||||
classes: classes,
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
return {
|
||||
about : about,
|
||||
getGeoCode : getGeoCode,
|
||||
reset : resetWindow,
|
||||
modules : Module.load,
|
||||
comboFilter : Filter.comboFilter,
|
||||
hourInfo : Hour.info,
|
||||
make : Hours.make,
|
||||
moments : Hours.moments,
|
||||
resetFileInput : resetFileInput,
|
||||
download : download,
|
||||
}
|
||||
|
||||
}());
|
||||
1440
js/modules/astrology.js
Normal file
1440
js/modules/astrology.js
Normal file
File diff suppressed because it is too large
Load diff
1602
js/modules/hygromanteia.js
Normal file
1602
js/modules/hygromanteia.js
Normal file
File diff suppressed because it is too large
Load diff
401
js/modules/keyofsolomon.js
Normal file
401
js/modules/keyofsolomon.js
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_kos_pday = {
|
||||
|
||||
definitions: {
|
||||
name: "Planetary Day",
|
||||
group: {
|
||||
id: "kos",
|
||||
text: "Key of Solomon",
|
||||
info: "true"
|
||||
},
|
||||
actions: [
|
||||
[
|
||||
{
|
||||
"id": "92",
|
||||
"action": "profit",
|
||||
"tags": "business"
|
||||
},
|
||||
{
|
||||
"id": "215",
|
||||
"action": "increase of one's property",
|
||||
"tags": "success business"
|
||||
},
|
||||
{
|
||||
"id": "116",
|
||||
"action": "success",
|
||||
"tags": "success"
|
||||
},
|
||||
{
|
||||
"id": "202",
|
||||
"action": "luck",
|
||||
"tags": "success"
|
||||
},
|
||||
{
|
||||
"id": "203",
|
||||
"action": "for gain",
|
||||
"tags": "success"
|
||||
},
|
||||
{
|
||||
"id": "246",
|
||||
"action": "gain favor of kings and authorities",
|
||||
"tags": "authority"
|
||||
},
|
||||
{
|
||||
"id": "269",
|
||||
"action": "contracting friendships",
|
||||
"tags": "friendship"
|
||||
},
|
||||
{
|
||||
"id": "278",
|
||||
"action": "preparing any operations whatsoever of love, of kindness, and of invisibility",
|
||||
"tags": "love friendship magic"
|
||||
},
|
||||
{
|
||||
"id": "280",
|
||||
"action": "good for all extraordinary, uncommon, and unknown operations",
|
||||
"tags": "anything magic"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "274",
|
||||
"action": "embassies; voyages; envoys; messages; navigation; reconciliation; love; and the acquisition of merchandise by water",
|
||||
"tags": "love authority friendship business water"
|
||||
},
|
||||
{
|
||||
"id": "275",
|
||||
"action": "communicating and speaking with spirits",
|
||||
"tags": "magic"
|
||||
},
|
||||
{
|
||||
"id": "281",
|
||||
"action": "recover stolen property",
|
||||
"tags": "treasure"
|
||||
},
|
||||
{
|
||||
"id": "265",
|
||||
"action": "have familiar spirits visit in sleep",
|
||||
"tags": "magic dreams"
|
||||
},
|
||||
{
|
||||
"id": "282",
|
||||
"action": "preparing anything relaed to water",
|
||||
"tags": "water"
|
||||
},
|
||||
{
|
||||
"id": "300",
|
||||
"action": "works of necromancy",
|
||||
"tags": "dead magic"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "125",
|
||||
"action": "war and victory",
|
||||
"tags": "war"
|
||||
},
|
||||
{
|
||||
"id": "126",
|
||||
"action": "winning over an opponent",
|
||||
"tags": "war"
|
||||
},
|
||||
{
|
||||
"id": "222",
|
||||
"action": "destroying one's enemies and opponents",
|
||||
"tags": "war"
|
||||
},
|
||||
{
|
||||
"id": "230",
|
||||
"action": "destruction",
|
||||
"tags": "war"
|
||||
},
|
||||
{
|
||||
"id": "257",
|
||||
"action": "scatter your enemies",
|
||||
"tags": "war"
|
||||
},
|
||||
{
|
||||
"id": "267",
|
||||
"action": "to bring destruction and to give death, and to sow hatred and discord.",
|
||||
"tags": "harm war"
|
||||
},
|
||||
{
|
||||
"id": "275",
|
||||
"action": "communicating and speaking with spirits",
|
||||
"tags": "magic"
|
||||
},
|
||||
{
|
||||
"id": "277",
|
||||
"action": "summoning souls from Hades, especially of those slain in battle",
|
||||
"tags": "magic war"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "272",
|
||||
"action": "eloquence and intelligence; promptitude in business; science and divination; wonders; apparitions; and answers regarding the future",
|
||||
"tags": "business magic divination science"
|
||||
},
|
||||
{
|
||||
"id": "273",
|
||||
"action": "thefts; writings; deceit; and merchandise",
|
||||
"tags": "harm business"
|
||||
},
|
||||
{
|
||||
"id": "276",
|
||||
"action": "recovering thefts by the means of spirits",
|
||||
"tags": "magic treasure"
|
||||
},
|
||||
{
|
||||
"id": "279",
|
||||
"action": "undertaking experiments relating to games, raillery, jests, sports, and the like",
|
||||
"tags": "luck gambling games"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "268",
|
||||
"action": "obtain honours, acquire riches",
|
||||
"tags": "treasure business"
|
||||
},
|
||||
{
|
||||
"id": "269",
|
||||
"action": "contracting friendships",
|
||||
"tags": "friendship"
|
||||
},
|
||||
{
|
||||
"id": "270",
|
||||
"action": "preserving health",
|
||||
"tags": "healing"
|
||||
},
|
||||
{
|
||||
"id": "271",
|
||||
"action": "arriving at all you can desire",
|
||||
"tags": "anything"
|
||||
},
|
||||
{
|
||||
"id": "278",
|
||||
"action": "preparing any operations whatsoever of love, of kindness, and of invisibility",
|
||||
"tags": "love friendship magic"
|
||||
},
|
||||
{
|
||||
"id": "280",
|
||||
"action": "good for all extraordinary, uncommon, and unknown operations",
|
||||
"tags": "anything magic"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "269",
|
||||
"action": "contracting friendships",
|
||||
"tags": "friendship"
|
||||
},
|
||||
{
|
||||
"id": "63",
|
||||
"action": "love",
|
||||
"tags": "love"
|
||||
},
|
||||
{
|
||||
"id": "186",
|
||||
"action": "travelling",
|
||||
"tags": "travelling journey"
|
||||
},
|
||||
{
|
||||
"id": "278",
|
||||
"action": "preparing any operations whatsoever of love, of kindness, and of invisibility",
|
||||
"tags": "love friendship magic"
|
||||
},
|
||||
{
|
||||
"id": "280",
|
||||
"action": "good for all extraordinary, uncommon, and unknown operations",
|
||||
"tags": "anything magic"
|
||||
},
|
||||
{
|
||||
"id": "283",
|
||||
"action": "preparing lots, poisons, powders for madness and the like",
|
||||
"tags": "protection animals"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "263",
|
||||
"action": "summon the souls from Hades who died a natural death",
|
||||
"tags": "magic"
|
||||
},
|
||||
{
|
||||
"id": "264",
|
||||
"action": "bring good or bad fortune to buildings",
|
||||
"tags": "protection harm building"
|
||||
},
|
||||
{
|
||||
"id": "265",
|
||||
"action": "have familiar spirits visit in sleep",
|
||||
"tags": "magic dreams"
|
||||
},
|
||||
{
|
||||
"id": "266",
|
||||
"action": "cause good or ill in business, possessions, goods, seeds, fruits, and similar things, in order to acquire learning",
|
||||
"tags": "harm business food agriculture education"
|
||||
},
|
||||
{
|
||||
"id": "267",
|
||||
"action": "to bring destruction and to give death, and to sow hatred and discord.",
|
||||
"tags": "harm war"
|
||||
},
|
||||
{
|
||||
"id": "275",
|
||||
"action": "communicating and speaking with spirits",
|
||||
"tags": "magic"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
property: function(m) {
|
||||
return m.planetary.day.no;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
return definitions.actions[property];
|
||||
}
|
||||
};
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_kos_phour = {
|
||||
|
||||
definitions: {
|
||||
name: "Planetary Hour",
|
||||
group: {
|
||||
id: "kos",
|
||||
text: "Key of Solomon",
|
||||
info: "true"
|
||||
},
|
||||
actions: module_kos_pday.definitions.actions
|
||||
},
|
||||
property: function(m) {
|
||||
return m.planetary.hour.no;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
var hourruler = SL.Astro.Logy.planet.order[((property+1+(property*24) - 1) % 7 ) + 1];
|
||||
return definitions.actions[hourruler-1];
|
||||
}
|
||||
};
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_kos_astro = {
|
||||
|
||||
definitions: {
|
||||
name: "Astrological Timing",
|
||||
group: {
|
||||
id: "kos",
|
||||
text: "Key of Solomon",
|
||||
info: "true"
|
||||
},
|
||||
actions: [
|
||||
[
|
||||
{
|
||||
"id" : "301",
|
||||
"action" : "Invocation of Spirits, the Works of Necromancy, and the recovery of stolen property",
|
||||
"tags" : "magic dead treasure"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id" : "302",
|
||||
"action" : "love, grace, and invisibility",
|
||||
"tags" : "love good magic"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id" : "303",
|
||||
"action" : "hatred, discord, and destruction",
|
||||
"tags" : "harm war"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id" : "304",
|
||||
"action" : "experiments of a peculiar nature, which cannot be classed under any certain head",
|
||||
"tags" : "magic anything"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id" : "305",
|
||||
"action" : "commence nothing while the Moon is in conjunction with the Sun",
|
||||
"tags" : "nothing"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id" : "306",
|
||||
"action" : "especially auspicious to converse with spirits",
|
||||
"tags" : "magic"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
property: function(m) {
|
||||
return m;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
var array = [];
|
||||
var hourruler = SL.Astro.Logy.planet.order[((property.planetary.day.no+1+(property.planetary.day.no*24) - 1) % 7 ) + 1];
|
||||
var chaldean = ["void", "moon", "mercury", "venus", "sun", "mars", "jupiter", "saturn"];
|
||||
var sunsign = SL.Astro.Logy.getZodiac(property.ephemeris.sun.deg).sign;
|
||||
var moonsign = SL.Astro.Logy.getZodiac(property.ephemeris.moon.deg).sign;
|
||||
// Mars + Saturn conjunct Moon
|
||||
var combo = [[1,5],[1,7],[1,4]];
|
||||
var orb = 13.0;
|
||||
combo.forEach(function(c, idx) {
|
||||
var diff = eval("property.ephemeris."+chaldean[c[0]]+".deg") - eval("property.ephemeris."+chaldean[c[1]]+".deg");
|
||||
var angle = Math.min( Math.abs(diff), 360-Math.abs(diff) );
|
||||
if ( ( angle <= orb || Math.abs(angle - 90) <= orb || Math.abs(angle - 180) <= orb ) ) {
|
||||
if ( chaldean[c[1]] == "mars") {
|
||||
module_kos_pday.definitions.actions[2].forEach( function(c) {
|
||||
array.push(c);
|
||||
});
|
||||
}
|
||||
if ( chaldean[c[1]] == "saturn") {
|
||||
module_kos_pday.definitions.actions[6].forEach( function(c) {
|
||||
array.push(c);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Moon combust
|
||||
var orb = 15.0;
|
||||
if ( angle <= orb && chaldean[c[1]] == "sun" ) {
|
||||
array.push(definitions.actions[4][0]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Moon in Earth sign
|
||||
if ( moonsign == 2 || moonsign == 6 || moonsign == 10 )
|
||||
array.push(array.push(definitions.actions[0][0]));
|
||||
|
||||
// Moon in fiery sign
|
||||
if ( moonsign == 1 || moonsign == 5 || moonsign == 9 )
|
||||
array.push(array.push(definitions.actions[1][0]));
|
||||
|
||||
// Moon in watery sign
|
||||
if ( moonsign == 4 || moonsign == 8 || moonsign == 12 )
|
||||
array.push(array.push(definitions.actions[2][0]));
|
||||
|
||||
// Moon in airy sign
|
||||
if ( moonsign == 3 || moonsign == 7 || moonsign == 11 )
|
||||
array.push(array.push(definitions.actions[3][0]));
|
||||
|
||||
// Moon and Sun in airy sign
|
||||
if ( ( moonsign == 3 || moonsign == 7 || moonsign == 11 ) && ( sunsign == 3 || sunsign == 7 || sunsign == 11) && property.planetary.day.no == 4 && hourruler == 4 ) {
|
||||
array.push(array.push(definitions.actions[5][0]));
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
};
|
||||
688
js/modules/lunarmansions.js
Normal file
688
js/modules/lunarmansions.js
Normal file
|
|
@ -0,0 +1,688 @@
|
|||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
var module_lunarmansion = {
|
||||
|
||||
/**
|
||||
* plugin module definitions
|
||||
*/
|
||||
definitions: {
|
||||
name: "Mansion", // how it appears in the navbar menu and info modal
|
||||
group: {
|
||||
id: "lunar", // id of the group
|
||||
text: "Lunar" // label of the group's dropdown menu
|
||||
},
|
||||
actions: [ // array of actions and tags for the filters
|
||||
[0],
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"action": "1 Al-Sharatain / Alnath",
|
||||
"tags": "alsharatain alnath"
|
||||
},
|
||||
{
|
||||
"id": "46",
|
||||
"action": "going on a journey",
|
||||
"tags": "journey"
|
||||
},
|
||||
{
|
||||
"id": "231",
|
||||
"action": "taking medicine",
|
||||
"tags": "healing"
|
||||
},
|
||||
{
|
||||
"id": "232",
|
||||
"action": "making a servant flee",
|
||||
"tags": "harm"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "2",
|
||||
"action": "2 Al-Butain / Albotain",
|
||||
"tags": "albutain albotain"
|
||||
},
|
||||
{
|
||||
"id": "233",
|
||||
"action": "dig streams, wells",
|
||||
"tags": "water"
|
||||
},
|
||||
{
|
||||
"id": "234",
|
||||
"action": "finding lost treasures",
|
||||
"tags": "treasure"
|
||||
},
|
||||
{
|
||||
"id": "235",
|
||||
"action": "have plenty of corn",
|
||||
"tags": "agriculture food business"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "3",
|
||||
"action": "3 Al-Thuraiya / Azoraya",
|
||||
"tags": "althuraiya azoraya"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}, {
|
||||
"id": "237",
|
||||
"action": "protect sailors at sea",
|
||||
"tags": "sailing protection"
|
||||
}, {
|
||||
"id": "87",
|
||||
"action": "practicing alchemy",
|
||||
"tags": "alchemy"
|
||||
}, {
|
||||
"id": "144",
|
||||
"action": "doing something that has to do with fires",
|
||||
"tags": "fire"
|
||||
}, {
|
||||
"id": "205",
|
||||
"action": "causing love in a couple",
|
||||
"tags": "love couple"
|
||||
}
|
||||
], // 3
|
||||
[
|
||||
{
|
||||
"id": "4",
|
||||
"action": "4 Al-Dabaran / Aldebaran",
|
||||
"tags": "aldabaran aldebaran"
|
||||
},
|
||||
{
|
||||
"id": "238",
|
||||
"action": "make master shrink back from servant",
|
||||
"tags": "harm"
|
||||
}
|
||||
], // 4
|
||||
[
|
||||
{
|
||||
"id": "5",
|
||||
"action": "5 Al-Haqa / Almices",
|
||||
"tags": "alhaqa almices"
|
||||
},
|
||||
{
|
||||
"id": "205",
|
||||
"action": "causing love in a couple",
|
||||
"tags": "love couple"
|
||||
}, {
|
||||
"id": "239",
|
||||
"action": "set boys to learn skills",
|
||||
"tags": "children education"
|
||||
}, {
|
||||
"id": "240",
|
||||
"action": "safeguarding travellers",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}
|
||||
], // 5
|
||||
[
|
||||
{
|
||||
"id": "6",
|
||||
"action": "6 Al-Hana / Athaya",
|
||||
"tags": "alhana athaya"
|
||||
},
|
||||
{
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}
|
||||
], // 6
|
||||
[
|
||||
{
|
||||
"id": "7",
|
||||
"action": "7 Al-Dhira / Aldira",
|
||||
"tags": "aldira aldhira"
|
||||
},
|
||||
{
|
||||
"id": "237",
|
||||
"action": "protect sailors at sea",
|
||||
"tags": "sailing protection"
|
||||
}, {
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}, {
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "244",
|
||||
"action": "increase crops",
|
||||
"tags": "food agriculture business"
|
||||
}, {
|
||||
"id": "245",
|
||||
"action": "expel flies",
|
||||
"tags": "protection animals"
|
||||
}, {
|
||||
"id": "246",
|
||||
"action": "gain favor of kings and authorities",
|
||||
"tags": "authority"
|
||||
}
|
||||
], // 7
|
||||
[
|
||||
{
|
||||
"id": "8",
|
||||
"action": "8 Al-Nathrah / Annathra",
|
||||
"tags": "alnathrah annathra"
|
||||
},
|
||||
{
|
||||
"id": "46",
|
||||
"action": "going on a journey",
|
||||
"tags": "journey"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}, {
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}, {
|
||||
"id": "247",
|
||||
"action": "expel mice and bugs",
|
||||
"tags": "protection animals"
|
||||
}
|
||||
], // 8
|
||||
[
|
||||
{
|
||||
"id": "9",
|
||||
"action": "9 Al-Tarf / Atarf",
|
||||
"tags": "altarf atarf"
|
||||
},
|
||||
{
|
||||
"id": "248",
|
||||
"action": "protect from another man's claims",
|
||||
"tags": "protection business"
|
||||
}
|
||||
], // 9
|
||||
[
|
||||
{
|
||||
"id": "10",
|
||||
"action": "10 Al-Jabhah / Algebha",
|
||||
"tags": "aljabhah algebha"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}, {
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}, {
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}, {
|
||||
"id": "249",
|
||||
"action": "cause love between a man and a woman",
|
||||
"tags": "love"
|
||||
}
|
||||
], // 10
|
||||
[
|
||||
{
|
||||
"id": "11",
|
||||
"action": "11 Al-Zubrah / Azobra",
|
||||
"tags": "alzubrah azobra"
|
||||
},
|
||||
{
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}, {
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "250",
|
||||
"action": "release captives",
|
||||
"tags": "captivity"
|
||||
}, {
|
||||
"id": "251",
|
||||
"action": "travel safely in hot places",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "252",
|
||||
"action": "increase wealth of allies",
|
||||
"tags": "business friendship"
|
||||
}
|
||||
], // 11
|
||||
[
|
||||
{
|
||||
"id": "12",
|
||||
"action": "12 Al-Sarfah / Acarfa",
|
||||
"tags": "alsarfah acarfa"
|
||||
},
|
||||
{
|
||||
"id": "244",
|
||||
"action": "increase crops",
|
||||
"tags": "food agriculture business"
|
||||
}, {
|
||||
"id": "253",
|
||||
"action": "help allies, authorities, captives and servants",
|
||||
"tags": "aid friendship authorities captivity"
|
||||
}
|
||||
], // 12
|
||||
[
|
||||
{
|
||||
"id": "13",
|
||||
"action": "13 Al-Awwah / Alahue",
|
||||
"tags": "alawwah / alahue"
|
||||
},
|
||||
{
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "244",
|
||||
"action": "increase crops",
|
||||
"tags": "food agriculture business"
|
||||
}, {
|
||||
"id": "246",
|
||||
"action": "gain favor of kings and authorities",
|
||||
"tags": "authority"
|
||||
}, {
|
||||
"id": "250",
|
||||
"action": "release captives",
|
||||
"tags": "captivity"
|
||||
}, {
|
||||
"id": "251",
|
||||
"action": "travel safely in hot places",
|
||||
"tags": "journey protection"
|
||||
}
|
||||
], // 13
|
||||
[
|
||||
{
|
||||
"id": "14",
|
||||
"action": "14 Al-Simak / Azimech",
|
||||
"tags": "alsimak azimech"
|
||||
},
|
||||
{
|
||||
"id": "237",
|
||||
"action": "protect sailors at sea",
|
||||
"tags": "sailing protection"
|
||||
}, {
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}, {
|
||||
"id": "249",
|
||||
"action": "cause love between a man and a woman",
|
||||
"tags": "love"
|
||||
}, {
|
||||
"id": "254",
|
||||
"action": "heal the sick by drugs, medicine",
|
||||
"tags": "healing"
|
||||
}, {
|
||||
"id": "255",
|
||||
"action": "destroy lust",
|
||||
"tags": "harm love"
|
||||
}, {
|
||||
"id": "256",
|
||||
"action": "improve luck of kings",
|
||||
"tags": "authority"
|
||||
}
|
||||
], // 14
|
||||
[
|
||||
{
|
||||
"id": "15",
|
||||
"action": "15 Al-Ghafr / Algarfa",
|
||||
"tags": "alghafr algarfa"
|
||||
},
|
||||
{
|
||||
"id": "234",
|
||||
"action": "finding lost treasures",
|
||||
"tags": "treasure"
|
||||
}, {
|
||||
"id": "233",
|
||||
"action": "dig streams, wells",
|
||||
"tags": "water"
|
||||
}, {
|
||||
"id": "257",
|
||||
"action": "scatter your enemies",
|
||||
"tags": "war"
|
||||
}
|
||||
], // 15
|
||||
[0, {
|
||||
"id": "16",
|
||||
"action": "16 Al-Zubana / Azubene",
|
||||
"tags": "alzubana azubene"
|
||||
}], // 16
|
||||
[
|
||||
{
|
||||
"id": "17",
|
||||
"action": "17 Al-Iklil / Alichil",
|
||||
"tags": "aliklil alichil"
|
||||
},
|
||||
{
|
||||
"id": "237",
|
||||
"action": "protect sailors at sea",
|
||||
"tags": "sailing protection"
|
||||
}, {
|
||||
"id": "205",
|
||||
"action": "causing love in a couple",
|
||||
"tags": "love couple"
|
||||
}, {
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}, {
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}, {
|
||||
"id": "249",
|
||||
"action": "cause love between a man and a woman",
|
||||
"tags": "love"
|
||||
}
|
||||
], // 17
|
||||
[
|
||||
{
|
||||
"id": "18",
|
||||
"action": "18 Al-Qalb / Alcalb",
|
||||
"tags": "alqalb alcalb"
|
||||
},
|
||||
{
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}, {
|
||||
"id": "250",
|
||||
"action": "release captives",
|
||||
"tags": "captivity"
|
||||
}], // 18
|
||||
[
|
||||
{
|
||||
"id": "19",
|
||||
"action": "19 Al-Shaulah / Exaula",
|
||||
"tags": "alshaulah exaula"
|
||||
},
|
||||
{
|
||||
"id": "240",
|
||||
"action": "safeguarding travellers",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "244",
|
||||
"action": "increase crops",
|
||||
"tags": "food agriculture business"
|
||||
}], // 19
|
||||
[
|
||||
{
|
||||
"id": "20",
|
||||
"action": "20 Al-Naaim / Nahaym",
|
||||
"tags": "alnaaim nahaym"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}, {
|
||||
"id": "240",
|
||||
"action": "safeguarding travellers",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}, {
|
||||
"id": "259",
|
||||
"action": "tame vicious beasts",
|
||||
"tags": "animals"
|
||||
}, {
|
||||
"id": "260",
|
||||
"action": "people you want to come to you",
|
||||
"tags": "people"
|
||||
}, {
|
||||
"id": "261",
|
||||
"action": "for allying good men with each other",
|
||||
"tags": "friendship"
|
||||
}], // 20
|
||||
[
|
||||
{
|
||||
"id": "21",
|
||||
"action": "21 Al-Baldah / Elbelda",
|
||||
"tags": "albaldah elbelda"
|
||||
},
|
||||
{
|
||||
"id": "240",
|
||||
"action": "safeguarding travellers",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "244",
|
||||
"action": "increase crops",
|
||||
"tags": "food agriculture business"
|
||||
}], // 21
|
||||
[
|
||||
{
|
||||
"id": "22",
|
||||
"action": "22 Sa'd al-Dhabih / Caadaldeba",
|
||||
"tags": "sadaldhabih caadaldeba"
|
||||
},
|
||||
{
|
||||
"id": "254",
|
||||
"action": "heal the sick by drugs, medicine",
|
||||
"tags": "healing"
|
||||
}, {
|
||||
"id": "261",
|
||||
"action": "for allying good men with each other",
|
||||
"tags": "friendship"
|
||||
}], // 22
|
||||
[
|
||||
{
|
||||
"id": "23",
|
||||
"action": "23 Sa'd Bula / Caaddebolach",
|
||||
"tags": "sadbula caaddebolach"
|
||||
},
|
||||
{
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}, {
|
||||
"id": "254",
|
||||
"action": "heal the sick by drugs, medicine",
|
||||
"tags": "healing"
|
||||
}, {
|
||||
"id": "261",
|
||||
"action": "for allying good men with each other",
|
||||
"tags": "friendship"
|
||||
}], // 23
|
||||
[
|
||||
{
|
||||
"id": "24",
|
||||
"action": "24 Sa'd al Suud / Caddacohot",
|
||||
"tags": "sadalsuud caddacohot"
|
||||
},
|
||||
{
|
||||
"id": "205",
|
||||
"action": "causing love in a couple",
|
||||
"tags": "love couple"
|
||||
}, {
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "262",
|
||||
"action": "soldiers to report victory",
|
||||
"tags": "war"
|
||||
}], // 24
|
||||
[
|
||||
{
|
||||
"id": "25",
|
||||
"action": "25 Sa'd al-Akhbiyah / Caadalhacbia",
|
||||
"tags": "sadalakhbiyah caadalhacbia"
|
||||
},
|
||||
{
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}], // 25
|
||||
[
|
||||
{
|
||||
"id": "26",
|
||||
"action": "26 Al-Fargh al-Awwal / Almiquedam",
|
||||
"tags": "alfarghalawwal almiquedam"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}, {
|
||||
"id": "240",
|
||||
"action": "safeguarding travellers",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "241",
|
||||
"action": "improve buildings",
|
||||
"tags": "building"
|
||||
}, {
|
||||
"id": "242",
|
||||
"action": "bring friendship",
|
||||
"tags": "love friendship"
|
||||
}], // 26
|
||||
[
|
||||
{
|
||||
"id": "27",
|
||||
"action": "27 Al-Fargh al-Thani / Algarf almuehar",
|
||||
"tags": "alfarghalthani algarfalmuehar"
|
||||
},
|
||||
{
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "254",
|
||||
"action": "heal the sick by drugs, medicine",
|
||||
"tags": "healing"
|
||||
}, {
|
||||
"id": "261",
|
||||
"action": "for allying good men with each other",
|
||||
"tags": "friendship"
|
||||
}], // 27
|
||||
[
|
||||
{
|
||||
"id": "28",
|
||||
"action": "28 Batn al-Hut / Arrexhe",
|
||||
"tags": "batnalhut arrexhe"
|
||||
},
|
||||
{
|
||||
"id": "236",
|
||||
"action": "strengthen prisons",
|
||||
"tags": "protection war building captivity"
|
||||
}, {
|
||||
"id": "205",
|
||||
"action": "causing love in a couple",
|
||||
"tags": "love couple"
|
||||
}, {
|
||||
"id": "240",
|
||||
"action": "safeguarding travellers",
|
||||
"tags": "journey protection"
|
||||
}, {
|
||||
"id": "243",
|
||||
"action": "increase trade and profit",
|
||||
"tags": "business"
|
||||
}, {
|
||||
"id": "244",
|
||||
"action": "increase crops",
|
||||
"tags": "food agriculture business"
|
||||
}], // 28
|
||||
],
|
||||
mansion : {
|
||||
tropical : [
|
||||
"void",
|
||||
"12 Aries 51",
|
||||
"25 Aries 42",
|
||||
"8 Taurus 34",
|
||||
"21 Taurus 25",
|
||||
"4 Gemini 17",
|
||||
"17 Gemini 8",
|
||||
"0 Cancer 0",
|
||||
"12 Cancer 51",
|
||||
"25 Cancer 42",
|
||||
"8 Leo 34",
|
||||
"21 Leo 25",
|
||||
"4 Virgo 17",
|
||||
"17 Virgo 8",
|
||||
"0 Libra 0",
|
||||
"12 Libra 51",
|
||||
"25 Libra 42",
|
||||
"8 Scorpio 34",
|
||||
"21 Scorpio 25",
|
||||
"4 Sagittarius 17",
|
||||
"17 Sagittarius 8",
|
||||
"0 Capricorn 0",
|
||||
"12 Capricorn 51",
|
||||
"25 Capricorn 42",
|
||||
"8 Aquarius 34",
|
||||
"21 Aquarius 25",
|
||||
"4 Pisces 17",
|
||||
"17 Pisces 8",
|
||||
"360 Aries 0"
|
||||
],
|
||||
constellational : [
|
||||
"void",
|
||||
"3 Taurus 0",
|
||||
"18 Taurus 0",
|
||||
"29 Taurus 0",
|
||||
"10 Gemini 0",
|
||||
"24 Gemini 0",
|
||||
"9 Cancer 0",
|
||||
"20 Cancer 0",
|
||||
"7 Leo 0",
|
||||
"18 Leo 0",
|
||||
"28 Leo 0",
|
||||
"12 Virgo 0",
|
||||
"22 Virgo 0",
|
||||
"27 Virgo 0",
|
||||
"24 Libra 0",
|
||||
"4 Scorpio 0",
|
||||
"15 Scorpio 0",
|
||||
"3 Sagittarius 0",
|
||||
"10 Sagittarius 0",
|
||||
"24 Sagittarius 0",
|
||||
"13 Capricorn 0",
|
||||
"16 Capricorn 0",
|
||||
"4 Aquarius 0",
|
||||
"12 Aquarius 0",
|
||||
"23 Aquarius 0",
|
||||
"4 Pisces 0",
|
||||
"23 Pisces 0",
|
||||
"9 Aries 0",
|
||||
"0 Taurus 0",
|
||||
]
|
||||
}
|
||||
},
|
||||
/**
|
||||
* property defines the main set of the astronomical data of the planetary hour used to calculate a filterable definition of operations and tags
|
||||
*/
|
||||
property: function(m) {
|
||||
return m.ephemeris.moon.deg;
|
||||
},
|
||||
/**
|
||||
* calculate receives the definitions from above and the property from above and calculates a return array of objects with id, operation, and tags
|
||||
*/
|
||||
calculate: function(definitions, property) {
|
||||
var mansions = definitions.mansion.tropical;
|
||||
var mansion = 1;
|
||||
while ( property > SL.Astro.Logy.zodToDeg(mansions[mansion], 0) ) mansion++;
|
||||
return definitions.actions[mansion];
|
||||
}
|
||||
};
|
||||
394
js/modules/moon.js
Normal file
394
js/modules/moon.js
Normal file
|
|
@ -0,0 +1,394 @@
|
|||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_lunarphase = {
|
||||
|
||||
definitions: {
|
||||
core: true,
|
||||
name: "Phase",
|
||||
group: {
|
||||
id: "lunar",
|
||||
text: "Lunar"
|
||||
},
|
||||
actions: [
|
||||
[0],
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"action": "New Moon",
|
||||
"tags": "waning dark"
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"action": "Waning Moon",
|
||||
"tags": "waning"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "2",
|
||||
"action": "Waxing Crescent Moon",
|
||||
"tags": "waxing crescent"
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"action": "Waxing Moon",
|
||||
"tags": "waxing"
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"action": "Crescent Moon",
|
||||
"tags": "crescent"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "3",
|
||||
"action": "First Quarter Moon",
|
||||
"tags": "waxing quarter half"
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"action": "Waxing Moon",
|
||||
"tags": "waxing"
|
||||
},
|
||||
{
|
||||
"id": "13",
|
||||
"action": "Half Moon",
|
||||
"tags": "half"
|
||||
},
|
||||
{
|
||||
"id": "14",
|
||||
"action": "Quarter Moon",
|
||||
"tags": "quarter"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "4",
|
||||
"action": "Waxing Gibbous Moon",
|
||||
"tags": "waxing gibbous"
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"action": "Waxing Moon",
|
||||
"tags": "waxing"
|
||||
},
|
||||
{
|
||||
"id": "12",
|
||||
"action": "Gibbous Moon",
|
||||
"tags": "gibbous"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "5",
|
||||
"action": "Full Moon",
|
||||
"tags": "waxing full"
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"action": "Waxing Moon",
|
||||
"tags": "waxing"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "6",
|
||||
"action": "Waning Gibbous Moon",
|
||||
"tags": "waning gibbous"
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"action": "Waning Moon",
|
||||
"tags": "waning"
|
||||
},
|
||||
{
|
||||
"id": "12",
|
||||
"action": "Gibbous Moon",
|
||||
"tags": "gibbous"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "7",
|
||||
"action": "Last Quarter Moon",
|
||||
"tags": "waning quarter half"
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"action": "Waning Moon",
|
||||
"tags": "waning"
|
||||
},
|
||||
{
|
||||
"id": "13",
|
||||
"action": "Half Moon",
|
||||
"tags": "half"
|
||||
},
|
||||
{
|
||||
"id": "14",
|
||||
"action": "Quarter Moon",
|
||||
"tags": "quarter"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "8",
|
||||
"action": "Waning Crescent Moon",
|
||||
"tags": "waning crescent"
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"action": "Waning Moon",
|
||||
"tags": "waning"
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"action": "Crescent Moon",
|
||||
"tags": "crescent"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
property: function(m) {
|
||||
return SL.Astro.Nomy.moonPhase(m.lunar);
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
return definitions.actions[property];
|
||||
}
|
||||
};
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_lunarday = {
|
||||
|
||||
definitions: {
|
||||
core: true,
|
||||
name: "Day",
|
||||
group: {
|
||||
id: "lunar",
|
||||
text: "Lunar"
|
||||
},
|
||||
actions: [
|
||||
[0],
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"action": "Lunar Day 1",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "2",
|
||||
"action": "Lunar Day 2",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "3",
|
||||
"action": "Lunar Day 3",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "4",
|
||||
"action": "Lunar Day 4",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "5",
|
||||
"action": "Lunar Day 5",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "6",
|
||||
"action": "Lunar Day 6",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "7",
|
||||
"action": "Lunar Day 7",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "8",
|
||||
"action": "Lunar Day 8",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "9",
|
||||
"action": "Lunar Day 9",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "10",
|
||||
"action": "Lunar Day 10",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "11",
|
||||
"action": "Lunar Day 11",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "12",
|
||||
"action": "Lunar Day 12",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "13",
|
||||
"action": "Lunar Day 13",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "14",
|
||||
"action": "Lunar Day 14",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "15",
|
||||
"action": "Lunar Day 15",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "16",
|
||||
"action": "Lunar Day 16",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "17",
|
||||
"action": "Lunar Day 17",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "18",
|
||||
"action": "Lunar Day 18",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "19",
|
||||
"action": "Lunar Day 19",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "20",
|
||||
"action": "Lunar Day 20",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "21",
|
||||
"action": "Lunar Day 21",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "22",
|
||||
"action": "Lunar Day 22",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "23",
|
||||
"action": "Lunar Day 23",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "24",
|
||||
"action": "Lunar Day 24",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "25",
|
||||
"action": "Lunar Day 25",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "26",
|
||||
"action": "Lunar Day 26",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "27",
|
||||
"action": "Lunar Day 27",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "28",
|
||||
"action": "Lunar Day 28",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "29",
|
||||
"action": "Lunar Day 29",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "30",
|
||||
"action": "Lunar Day 30",
|
||||
"tags": ""
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
property: function(m) {
|
||||
return m.lunar.day;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
return definitions.actions[property];
|
||||
}
|
||||
};
|
||||
194
js/modules/pgm.js
Normal file
194
js/modules/pgm.js
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_pgm_lsign = {
|
||||
|
||||
definitions: {
|
||||
name: "Lunar Sign",
|
||||
group: {
|
||||
id: "pgm",
|
||||
text: "PGM",
|
||||
info: "true"
|
||||
},
|
||||
actions: [
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"action": "fire divination or love charm (VII.284ff)",
|
||||
"tags": "divination love"
|
||||
},
|
||||
{
|
||||
"id": "21",
|
||||
"action": "Oracle statue of Hermes (V.370ff)",
|
||||
"tags": "divination animation"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "2",
|
||||
"action": "Incantation to a lamp (VII.284ff)",
|
||||
"tags": "divination"
|
||||
},
|
||||
{
|
||||
"id": "22",
|
||||
"action": "Ring for success, favour and victory (animation) (XII.270ff)",
|
||||
"tags": "animation success"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "3",
|
||||
"action": "Spell for winning favour (VII.284ff)",
|
||||
"tags": "luck"
|
||||
},
|
||||
{
|
||||
"id": "13",
|
||||
"action": "Perform spells of binding (III.275ff)",
|
||||
"tags": "binding harm"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "4",
|
||||
"action": "Making Phylacteries (VII.284ff)",
|
||||
"tags": "protection"
|
||||
},
|
||||
{
|
||||
"id": "14",
|
||||
"action": "Perform spells of reconciliation, air divination (III.275ff)",
|
||||
"tags": "divination friendship reconciliation"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "5",
|
||||
"action": "Rings or binding spells (VII.284ff)",
|
||||
"tags": "binding harm protection"
|
||||
},
|
||||
{
|
||||
"id": "15",
|
||||
"action": "Making an amulet against gout (xiv.1003ff)",
|
||||
"tags": "healing"
|
||||
},
|
||||
{
|
||||
"id": "21",
|
||||
"action": "Oracle statue of Hermes (V.370ff)",
|
||||
"tags": "divination animation"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "6",
|
||||
"action": "Everything is rendered obtainable (VII.284ff)",
|
||||
"tags": "anything"
|
||||
},
|
||||
{
|
||||
"id": "16",
|
||||
"action": "Anything is obtainable, bowl divination, as you wish (III.275ff)",
|
||||
"tags": "anything divination"
|
||||
},
|
||||
{
|
||||
"id": "21",
|
||||
"action": "Oracle statue of Hermes (V.370ff)",
|
||||
"tags": "divination animation"
|
||||
},
|
||||
{
|
||||
"id": "22",
|
||||
"action": "Ring for success, favour and victory (animation) (XII.270ff)",
|
||||
"tags": "animation success"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "7",
|
||||
"action": "Necromancy (VII.284ff)",
|
||||
"tags": "necromancy"
|
||||
},
|
||||
{
|
||||
"id": "17",
|
||||
"action": "Perform invocation... spell of release... necromancy (III.275ff)",
|
||||
"tags": "invocation necromancy release"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "8",
|
||||
"action": "Anything inflicting evil (VII.284ff)",
|
||||
"tags": "harm war"
|
||||
},
|
||||
{
|
||||
"id": "22",
|
||||
"action": "Ring for success, favour and victory (animation) (XII.270ff)",
|
||||
"tags": "animation success"
|
||||
},
|
||||
{
|
||||
"id": "23",
|
||||
"action": "send a star ... down (xiv.1180f)",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "9",
|
||||
"action": "Invocations and incantations to the Sun and the Moon (VII.284ff)",
|
||||
"tags": "prayer invocation"
|
||||
},
|
||||
{
|
||||
"id": "18",
|
||||
"action": "Conduct business (III.275ff)",
|
||||
"tags": "business"
|
||||
},
|
||||
{
|
||||
"id": "21",
|
||||
"action": "Oracle statue of Hermes (V.370ff)",
|
||||
"tags": "divination animation"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "10",
|
||||
"action": "Say whatever you wish for best results (VII.284ff)",
|
||||
"tags": "anything"
|
||||
},
|
||||
{
|
||||
"id": "19",
|
||||
"action": "Do what is appropriate (III.275ff)",
|
||||
"tags": "anything"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "11",
|
||||
"action": "For a love charm (VII.284ff)",
|
||||
"tags": "love"
|
||||
},
|
||||
{
|
||||
"id": "22",
|
||||
"action": "Ring for success, favour and victory (animation) (XII.270ff)",
|
||||
"tags": "animation success"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "12",
|
||||
"action": "For foreknowledge (VII.284ff)",
|
||||
"tags": "divination"
|
||||
},
|
||||
{
|
||||
"id": "20",
|
||||
"action": "OIÔ rite... or love charm (III.275ff)",
|
||||
"tags": "love"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
property: function(m) {
|
||||
return SL.Astro.Logy.getZodiac(m.ephemeris.moon.deg).sign;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
return definitions.actions[property-1];
|
||||
}
|
||||
};
|
||||
94
js/modules/planetary.js
Normal file
94
js/modules/planetary.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
//Defines Calendar Objects and Methods
|
||||
var module_planetary_hour_ruler = {
|
||||
|
||||
definitions: {
|
||||
core: true,
|
||||
name: "Hour",
|
||||
group: {
|
||||
id : "planetary",
|
||||
text: "Planetary Time"
|
||||
},
|
||||
actions: [
|
||||
[0],
|
||||
[
|
||||
{
|
||||
"id": "4",
|
||||
"action": "Sun / Sol / Helios / Apollo",
|
||||
"tags": "sun sol helios success promotion fame wealth prosperity music athleticism ego self power pride authority leadership creativity spontaneity health vitality"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "7",
|
||||
"action": "Moon / Luna / Selene / Artemis",
|
||||
"tags": "moon luna selene illusion glamour sleep peace beauty prophesy dreams magic emotions travel fertility insight wisdom tenderness unconscious habit rhythm memory mood nurture home melancholy"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "3",
|
||||
"action": "Mars / Ares",
|
||||
"tags": "mars ares courage victory success strength conviction rebellion defense protection war sex confidence assertiveness aggression energy strength ambition impulsiveness malefic"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "6",
|
||||
"action": "Mercury / Hermes",
|
||||
"tags": "mercury hermes communication art transportation change luck gambling fortune chance creativity travel prudent crafty rationality reasoning adaptability variability"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "2",
|
||||
"action": "Jupiter / Zeus",
|
||||
"tags": "jupiter zeus abundance protection prosperity strength wealth healing charming hunting growth expansion prosperity fortune travel business education religion law freedom exploration gambling"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "5",
|
||||
"action": "Venus / Aphrodite",
|
||||
"tags": "venus aphrodite love birth fertility romance gentleness pregnancy friendship passion sex amorousness harmony resilience beauty refinement solidarity affection equality comfort partnership art fashion"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"action": "Saturn / Kronos",
|
||||
"tags": "saturn kronos banishing protection wisdom spirituality cleansing magic death cursing industrious melancholy tranquility malefic focus precision nobility ethics civility goals career achievements dedication authority hierarchy stability virtues productiveness lessons destiny tradition structure balance karma justice limitations restrictions boundaries anxiety tests practicality reality time duty commitment responsibility endurance hardship planning foresight"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
property: function(m) {
|
||||
return m.planetary;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
return definitions.actions[SL.Astro.Logy.planet.order[((property.hour.no+1+(property.day.no*24) - 1) % 7 ) + 1]];
|
||||
}
|
||||
};
|
||||
|
||||
var module_planetary_day_ruler = {
|
||||
|
||||
definitions: {
|
||||
core: true,
|
||||
name: "Day",
|
||||
group: {
|
||||
id : "planetary",
|
||||
text: "Planetary Time"
|
||||
},
|
||||
actions: module_planetary_hour_ruler.definitions.actions
|
||||
},
|
||||
property: function(m) {
|
||||
return m.planetary.day.no;
|
||||
},
|
||||
calculate: function(definitions, property) {
|
||||
return definitions.actions[property+1];
|
||||
}
|
||||
};
|
||||
1418
js/old/actions.js
Normal file
1418
js/old/actions.js
Normal file
File diff suppressed because it is too large
Load diff
316824
js/old/airports.json
Normal file
316824
js/old/airports.json
Normal file
File diff suppressed because it is too large
Load diff
279
js/old/astro.js
Normal file
279
js/old/astro.js
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
function findNewMoon( ts ) {
|
||||
var today = new moment.unix(ts);
|
||||
var year = parseFloat(today.format('YYYY'));
|
||||
var ydays = 365;
|
||||
var spd = 86400;
|
||||
if (today.isLeapYear() ) ydays++;
|
||||
var decimal = parseFloat(today.format('DDD')) / ydays * spd;
|
||||
var secs = parseFloat(today.format('H')) * 3600 + parseFloat(today.format('m')) * 60 + parseFloat(today.format('s'));
|
||||
decimal = (decimal + secs) / spd;
|
||||
var Y = year + decimal;
|
||||
// k is an integer for new moon incremented by 0.25 for first quarter 0.5 for new etc.
|
||||
var k=Math.floor((parseFloat(today.format('YYYY'))+((parseFloat(today.format('M'))-1)+parseFloat(today.format('D'))/30)/12-2000)*12.3685);
|
||||
// Time in Julian centuries since 2000.0
|
||||
var T=k/1236.85;
|
||||
// Sun's mean anomaly
|
||||
var M=rev(2.5534+29.10535669*k-0.0000218*T*T);
|
||||
// Moon's mean anomaly (M' in Meeus)
|
||||
var MP=rev(201.5643+385.81693528*k+0.0107438*T*T+0.00001239*T*T*T-0.00000011*T*T*T);
|
||||
var E=1-0.002516*T-0.0000074*T*T;
|
||||
// Moons argument of latitude
|
||||
var F=rev(160.7108+390.67050274*k-0.0016341*T*T-0.00000227*T*T*T+0.000000011*T*T*T*T);
|
||||
// Longitude of ascending node of lunar orbit
|
||||
var Omega=rev(124.7746-1.56375580*k+0.0020691*T*T+0.00000215*T*T*T);
|
||||
// The full planetary arguments include 14 terms, only used the 7 most significant
|
||||
var B = new Array();
|
||||
B[1]=rev(299.77+ 0.107408*k-0.009173*T*T);
|
||||
B[2]=rev(251.88+ 0.016321*k);
|
||||
B[3]=rev(251.83+26.651886*k);
|
||||
B[4]=rev(349.42+36.412478*k);
|
||||
B[5]=rev( 84.88+18.206239*k);
|
||||
B[6]=rev(141.74+53.303771*k);
|
||||
B[7]=rev(207.14+ 2.453732*k);
|
||||
|
||||
// New moon
|
||||
var JDE0=2451550.09765+29.530588853*k+0.0001337*T*T-0.000000150*T*T*T+0.00000000073*T*T*T*T;
|
||||
// Correct for TDT since 1 July 2015
|
||||
JDE0=JDE0-58.184/(24*60*60);
|
||||
var JDE=JDE0 -0.40720*sind(MP) +0.17241*E*sind(M) +0.01608*sind(2*MP) +0.01039*sind(2*F)
|
||||
+0.00739*E*sind(MP-M) -0.00514*E*sind(MP+M) +0.00208*E*E*sind(2*M) -0.00111*sind(MP-2*F)
|
||||
-0.00057*sind(MP+2*F) +0.00056*E*sind(2*MP+M) -0.00042*sind(3*MP) +0.00042*E*sind(M+2*F)
|
||||
+0.00038*E*sind(M-2*F) -0.00024*E*sind(2*MP-M) -0.00017*sind(Omega) -0.00007*sind(MP+2*M);
|
||||
|
||||
var F=0.000325*sind(B[1])+0.000165*sind(B[2])+0.000164*sind(B[3])+0.000126*sind(B[4])
|
||||
+0.000110*sind(B[5])+0.000062*sind(B[6])+0.000060*sind(B[7]);
|
||||
var newmoon = new moment(A.JulianDay.jdToDate(JDE + F)).subtract(2, 'h').unix();
|
||||
if ( ts < newmoon ) newmoon = findNewMoon( new moment.unix(ts).subtract(1, 'h').unix());
|
||||
return newmoon;
|
||||
} //End calcMoonPhase
|
||||
|
||||
function getZodiac(deg, sidereal = false) {
|
||||
if ( sidereal == true ) {
|
||||
deg += 27.74;
|
||||
if ( deg > 360 ) deg =- 360;
|
||||
}
|
||||
var obj = {
|
||||
sign: Math.ceil(deg / 30),
|
||||
decan: Math.ceil(deg / 10)
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function getLunarMansion(deg, sidereal = false) {
|
||||
// global variable def needs to be declared before using this function
|
||||
if (!sidereal) var mansion = def.moon.mansion.tropical;
|
||||
else var mansion = def.moon.mansion.constellational;
|
||||
var i = 1;
|
||||
var m;
|
||||
while ( deg > zodToDeg(mansion[i]) ) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
function sunRiseSet(ts, coord) {
|
||||
// calculate sunrise and sunset
|
||||
var today = new moment.unix(ts).startOf('d');
|
||||
var tomorrow = new moment.unix(ts).startOf('d').add(1, 'd');
|
||||
//var todaySolarSecs = A.Solar.times(new A.JulianDay(today.toDate()), coord);
|
||||
//var tomorrowSolarSecs = A.Solar.times(new A.JulianDay(tomorrow.toDate()), coord);
|
||||
|
||||
// fixed MeeusJS bug with working Peter Hayes code
|
||||
var todayHayes = SunRiseSet(parseFloat(today.format('YYYY')),parseFloat(today.format('M')),parseFloat(today.format('D')),parseFloat($('#lat').val()),parseFloat($('#lon').val()));
|
||||
var tomorrowHayes = SunRiseSet(parseFloat(tomorrow.format('YYYY')),parseFloat(tomorrow.format('M')),parseFloat(tomorrow.format('D')),parseFloat($('#lat').val()),parseFloat($('#lon').val()));
|
||||
var todaySolarSecs = {};
|
||||
var tomorrowSolarSecs = {};
|
||||
todaySolarSecs.rise = todayHayes[0] * 3600;
|
||||
todaySolarSecs.set = todayHayes[1] * 3600;
|
||||
tomorrowSolarSecs.rise = tomorrowHayes[0] * 3600;
|
||||
tomorrowSolarSecs.set = tomorrowHayes[1] * 3600;
|
||||
// end bugfix
|
||||
|
||||
var todayPlanetDayStart = new moment.unix(ts).startOf('day').unix() + todaySolarSecs.rise;
|
||||
var todayPlanetNightStart = new moment.unix(ts).startOf('day').unix() + todaySolarSecs.set;
|
||||
var tomorrowPlanetDayStart = new moment.unix(ts).add(1, 'd').startOf('day').unix() + tomorrowSolarSecs.rise;
|
||||
var tomorrowPlanetNightStart = new moment.unix(ts).add(1, 'd').startOf('day').unix() + tomorrowSolarSecs.set;
|
||||
|
||||
var planetaryDayHourSecs = (todayPlanetNightStart - todayPlanetDayStart) / 12;
|
||||
var planetaryNightHourSecs = (tomorrowPlanetDayStart - todayPlanetNightStart) / 12;
|
||||
|
||||
var sol = {
|
||||
day : {
|
||||
start : Math.floor(todayPlanetDayStart),
|
||||
hourSecs : Math.round(planetaryDayHourSecs),
|
||||
end : Math.floor(todayPlanetNightStart - 1)
|
||||
},
|
||||
night : {
|
||||
start: Math.floor(todayPlanetNightStart),
|
||||
hourSecs : Math.round(planetaryNightHourSecs),
|
||||
end : Math.floor(tomorrowPlanetDayStart - 1)
|
||||
}
|
||||
}
|
||||
return sol;
|
||||
}
|
||||
|
||||
function planetaryMoment(lat, lon, ts) {
|
||||
|
||||
var sidereal = false;
|
||||
var coord = A.EclCoord.fromWgs84(lat, lon, 0);
|
||||
var today = new moment.unix(ts);
|
||||
var tomorrow = new moment.unix(ts).add(1, 'd');
|
||||
var yesterday = new moment.unix(ts).subtract(1, 'd');
|
||||
var date = today.toDate();
|
||||
var jdo = new A.JulianDay(date);
|
||||
var suneq = A.Solar.apparentEquatorial(jdo);
|
||||
var mooneq = A.Moon.apparentEquatorial(jdo);
|
||||
var suntp = A.Solar.topocentricPosition(jdo, coord, true);
|
||||
var moontp = A.Moon.topocentricPosition(jdo, coord, true);
|
||||
var obliquity = A.Nutation.trueObliquity(jdo) * 180 / Math.PI;
|
||||
|
||||
// get sun rise and set times
|
||||
var sol = sunRiseSet(ts, coord);
|
||||
var ps = sol;
|
||||
|
||||
// calculate planetary hour of ts and when it starts and ends
|
||||
var phour = 0;
|
||||
var phstart;
|
||||
var phend;
|
||||
|
||||
if ( ts >= ps.day.start && ts < ps.night.start ) {
|
||||
phour = (ts - ps.day.start) / ps.day.hourSecs;
|
||||
phstart = ps.day.start + phour * ps.day.hourSecs;
|
||||
phend = phstart + ps.day.hourSecs - 1;
|
||||
}
|
||||
else {
|
||||
if ( ts < ps.day.start ) {
|
||||
ps = sunRiseSet(yesterday.unix(), coord);
|
||||
}
|
||||
phour = (ts - ps.night.start) / ps.night.hourSecs + 12;
|
||||
phstart = ps.night.start + (phour - 12) * ps.night.hourSecs;
|
||||
phend = phstart + ps.night.hourSecs - 1;
|
||||
}
|
||||
|
||||
// calculate planetary day of ts
|
||||
var pday = parseFloat(new moment.unix(ps.day.start).format('d'));
|
||||
|
||||
// planet longitudes
|
||||
var pldate = {
|
||||
year: parseFloat(today.format('YYYY')),
|
||||
month: parseFloat(today.format('M')),
|
||||
day: parseFloat(today.format('D')),
|
||||
hours: parseFloat(today.format('H')),
|
||||
minutes: parseFloat(today.format('m')),
|
||||
seconds: 0};
|
||||
$const.tlong = lon // longitude
|
||||
$const.tlat = lat // latitude
|
||||
$processor.init ();
|
||||
var mars = $moshier.body.mars;
|
||||
var mercury = $moshier.body.mercury;
|
||||
var jupiter = $moshier.body.jupiter;
|
||||
var venus = $moshier.body.venus;
|
||||
var saturn = $moshier.body.saturn;
|
||||
$processor.calc (pldate, mars);
|
||||
$processor.calc (pldate, mercury);
|
||||
$processor.calc (pldate, jupiter);
|
||||
$processor.calc (pldate, venus);
|
||||
$processor.calc (pldate, saturn);
|
||||
|
||||
// calculate lunar day
|
||||
var lastNewMoon = findNewMoon(ts);
|
||||
var nextNewMoon = findNewMoon(new moment.unix(lastNewMoon).add(31, 'd').unix());
|
||||
var startDate = new moment.unix(lastNewMoon).startOf('d');
|
||||
var endDate = new moment.unix(nextNewMoon).startOf('d');
|
||||
var cal = [];
|
||||
cal[0] = lastNewMoon;
|
||||
var daycount = 0;
|
||||
var rise = lastNewMoon + 1;
|
||||
while ( rise < nextNewMoon && rise < ts ) {
|
||||
var day = new moment(startDate.toDate()).add(daycount, 'd');
|
||||
var jdr = new A.JulianDay(day.toDate());
|
||||
var moontimes = A.Moon.times(jdr, coord);
|
||||
var hrs = MoonRise(parseFloat(day.format('YYYY')),parseFloat(day.format('M')),parseFloat(day.format('D')),0,parseFloat(lat),parseFloat(lon));
|
||||
if ( hrs[0] > 0 ) {
|
||||
var mt = hrs[0] * 60 * 60;
|
||||
var rise = day.add(mt, 's').unix();
|
||||
if ( rise > lastNewMoon && rise < nextNewMoon ) {
|
||||
cal.push(rise);
|
||||
}
|
||||
}
|
||||
daycount++;
|
||||
}
|
||||
var lday = 0;
|
||||
cal.forEach(function(lts, i, o) {
|
||||
if ( ts >= lts ) {
|
||||
lday = i;
|
||||
}
|
||||
});
|
||||
var luna = {
|
||||
day: lday + 1,
|
||||
start: cal[lday]
|
||||
}
|
||||
|
||||
var suncoords = eqToEclDeg(suneq, obliquity);
|
||||
var sunlng = suncoords.lng;
|
||||
|
||||
var mooncoords = eqToEclDeg(mooneq.eq, obliquity);
|
||||
var moonlng = mooncoords.lng;
|
||||
|
||||
// calculate lunar phase
|
||||
var i = A.MoonIllum.phaseAngleEq2(moontp.eq, suntp.eq);
|
||||
var k = A.MoonIllum.illuminated(i);
|
||||
var chi = A.MoonIllum.positionAngle(moontp.eq, suntp.eq);
|
||||
var angle = i * 180 / Math.PI;
|
||||
if ( chi < 0 ) angle = 360 - angle;
|
||||
var sphase;
|
||||
if ( angle < 10 ) sphase = 5;
|
||||
else if ( angle < 80 ) sphase = 6;
|
||||
else if ( angle < 95 ) sphase = 7;
|
||||
else if ( angle < 170 ) sphase = 8;
|
||||
else if ( angle < 190 ) sphase = 1;
|
||||
else if ( angle < 260 ) sphase = 2;
|
||||
else if ( angle < 280 ) sphase = 3;
|
||||
else if ( angle < 350 ) sphase = 4;
|
||||
else sphase = 5;
|
||||
|
||||
var phase = {
|
||||
simple: sphase,
|
||||
phase: angle,
|
||||
angle: chi,
|
||||
illumination : Math.round(k * 100)
|
||||
}
|
||||
|
||||
var obj = {
|
||||
ts: ts,
|
||||
planetary : {
|
||||
hour : {
|
||||
number: Math.round(phour),
|
||||
begin : phstart,
|
||||
end : phend
|
||||
},
|
||||
day : pday
|
||||
},
|
||||
solar : {
|
||||
day : sol,
|
||||
lng : Math.round(sunlng * 100) / 100
|
||||
},
|
||||
lunar : {
|
||||
day : luna,
|
||||
lng : Math.round(moonlng * 100) / 100,
|
||||
phase : phase,
|
||||
lastnew : lastNewMoon
|
||||
},
|
||||
planet : {
|
||||
mars : {
|
||||
lng : Math.round(mars.position.apparentLongitude * 100) / 100
|
||||
},
|
||||
mercury : {
|
||||
lng : Math.round(mercury.position.apparentLongitude * 100) / 100
|
||||
},
|
||||
jupiter : {
|
||||
lng : Math.round(jupiter.position.apparentLongitude * 100) / 100
|
||||
},
|
||||
venus : {
|
||||
lng : Math.round(venus.position.apparentLongitude * 100) / 100
|
||||
},
|
||||
saturn : {
|
||||
lng : Math.round(saturn.position.apparentLongitude * 100) / 100
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
446
js/old/calendar.js
Normal file
446
js/old/calendar.js
Normal file
|
|
@ -0,0 +1,446 @@
|
|||
var timestamp;
|
||||
|
||||
function getLocation() {
|
||||
navigator.geolocation.getCurrentPosition(function(position){
|
||||
setCoords(position);
|
||||
}, function () {
|
||||
setCoords({coords: { latitude: latitude, longitude: longitude }});
|
||||
});
|
||||
}
|
||||
|
||||
function getAirportLocation() {
|
||||
$.getJSON( "https://raw.githubusercontent.com/mwgg/Airports/master/airports.json", function( data ) {
|
||||
$('#iata input').addClass('loading');
|
||||
var iatacode = $('#iata input').val();
|
||||
Defiant.getSnapshot(data, function(snapshot) {
|
||||
var found = JSON.search(snapshot, '//*[iata="'+iatacode.toUpperCase()+'"]');
|
||||
/*
|
||||
var minlat = Math.floor($('#lat').val()) - 2;
|
||||
var maxlat = Math.ceil($('#lat').val()) + 2;
|
||||
var minlon = Math.floor($('#lon').val()) - 2;
|
||||
var maxlon = Math.ceil($('#lon').val()) + 2;
|
||||
var foundlat = JSON.search(snapshot, '//*[lat<'+maxlat+' and lat>'+minlat+']');
|
||||
var found = JSON.search(foundlat, '//*[lon<'+maxlon+' and lon>'+minlon+']');
|
||||
var distances = [];
|
||||
for (index = 0; index < found.length; ++index) {
|
||||
distances.push(getDistance($('#lat').val(), $('#lon').val(), found[index].lat, found[index].lon));
|
||||
}
|
||||
var idx = distances.indexOf(Math.min.apply(Math,distances));
|
||||
var airport = found[idx];
|
||||
*/
|
||||
var airport = found[0];
|
||||
$.getJSON( "https://raw.githubusercontent.com/dmfilipenko/timezones.json/master/timezones.json", function( zones ) {
|
||||
var off = JSON.search( zones, '//*[utc="'+airport.tz+'"]');
|
||||
$('#lat').val(airport.lat);
|
||||
$('#lon').val(airport.lon);
|
||||
$('#offset').val(off[0].offset);
|
||||
$('#iata-info').text(airport.name+', '+airport.city+', '+airport.country+' (Timezone: '+airport.tz+')');
|
||||
$('#iata input').removeClass('loading');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setCoords(location) {
|
||||
$('#lat').val(location.coords.latitude);
|
||||
$('#lon').val(location.coords.longitude);
|
||||
var now = new Date()
|
||||
var off = now.getTimezoneOffset();
|
||||
$('#offset').val(off/60*-1);
|
||||
}
|
||||
|
||||
function generate() {
|
||||
$('#grid').empty();
|
||||
var data = generateJSON((Math.floor($('#lat').val())+'-'+Math.floor($('#lon').val())), new moment().unix(), $('#offset').val(), ($('#days').val()-1), $('#lat').val(), $('#lon').val());
|
||||
var j = 0;
|
||||
function makePHour(j) {
|
||||
if ( j == data.planetaryhours.length-1 ) {
|
||||
clearTimeout(everyday);
|
||||
NProgress.done();
|
||||
var now = moment().subtract($('#offset').val(), 'h').unix();
|
||||
$('.planetaryhour').each( function( idx, element ) {
|
||||
if ( $(element).attr('ts') < now && now < $(element).next().attr('ts') ) {
|
||||
$(element).addClass('now');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
var m = data.planetaryhours[j];
|
||||
var localTime = new moment.unix(m.ts).add($('#offset').val(), 'h');
|
||||
var zodiac = getZodiac(m.solar.lng);
|
||||
var moonsign = getZodiac(m.lunar.lng);
|
||||
var mansion = getLunarMansion(m.lunar.lng);
|
||||
var hygromanteia = getActions(matrix.planetary.day[m.planetary.day].hour[m.planetary.hour.number].for, action, 'hygromanteia');
|
||||
var lunarday = getActions(matrix.lunar.day[m.lunar.day.day], action, 'lunarday');
|
||||
var lunarsign = getActions(matrix.lunar.sign[zodiac.sign].for, action, 'lunarsign');
|
||||
var lunarmansion = getActions(matrix.lunar.mansion[mansion], action, 'lunarmansion');
|
||||
var claviculaday = getActions(matrix.clavicula[m.planetary.day+1], action, 'clavicula');
|
||||
var claviculahour = getActions(matrix.clavicula[matrix.planetary.day[m.planetary.day].hour[m.planetary.hour.number].planet], action, 'clavicula');
|
||||
var clavicula = [claviculaday.actions.string, claviculahour.actions.string];
|
||||
$('<div/>').loadTemplate($("#tpl-planetaryhour"), {
|
||||
ruler : def.planet.symbol[m.planetary.day+1],
|
||||
date : new moment.unix(m.ts).format('D/M'),
|
||||
lunarday : '☾'+m.lunar.day.day+'☽',
|
||||
hourstart : new moment.unix(m.planetary.hour.begin).add($('#offset').val(), 'h').format('HH:mm'),
|
||||
hournumber : (m.planetary.hour.number+1)+'<br />'+def.planet.symbol[matrix.planetary.day[m.planetary.day].hour[m.planetary.hour.number].planet],
|
||||
hourend : new moment.unix(m.planetary.hour.end).add($('#offset').val(), 'h').format('HH:mm'),
|
||||
moonsign : def.zodiac.symbol[moonsign.sign],
|
||||
moonphase : def.moon.phase.symbol[m.lunar.phase.simple]+' <small>'+m.lunar.phase.illumination+'%</small>',
|
||||
moonmansion : '|'+mansion+'|'
|
||||
})
|
||||
.addClass(hygromanteia.actions.string)
|
||||
.addClass($.unique(clavicula.join(" ").split(' ')).join(" "))
|
||||
.addClass(lunarday.actions.string)
|
||||
.addClass(lunarsign.actions.string)
|
||||
.addClass(lunarmansion.actions.string)
|
||||
.addClass(addPlanetClasses(m.solar.lng, 'sun'))
|
||||
.addClass(addPlanetClasses(m.lunar.lng, 'moon'))
|
||||
.addClass(addPlanetClasses(m.planet.mars.lng, 'mars'))
|
||||
.addClass(addPlanetClasses(m.planet.mercury.lng, 'mercury'))
|
||||
.addClass(addPlanetClasses(m.planet.jupiter.lng, 'jupiter'))
|
||||
.addClass(addPlanetClasses(m.planet.venus.lng, 'venus'))
|
||||
.addClass(addPlanetClasses(m.planet.saturn.lng, 'saturn'))
|
||||
.addClass('col-md-2 centered planetaryhour')
|
||||
.attr('id', 'c'+j+'d'+m.planetary .day+'h'+m.planetary.hour.number )
|
||||
.attr('day', m.planetary.day)
|
||||
.attr('hour', m.planetary.hour.number)
|
||||
.attr('ts', m.ts)
|
||||
.attr('ts-end', new moment.unix(m.planetary.hour.end).add($('#offset').val(), 'h').unix())
|
||||
.attr('sun-lng', m.solar.lng)
|
||||
.attr('moon-lng', m.lunar.lng)
|
||||
.attr('moon-day', m.lunar.day.day)
|
||||
.attr('moon-phase', m.lunar.phase.simple)
|
||||
.attr('moon-angle', Math.round(m.lunar.phase.angle *100) / 100 )
|
||||
.attr('moon-illumination', m.lunar.phase.illumination)
|
||||
.attr('mars-lng', m.planet.mars.lng)
|
||||
.attr('mercury-lng', m.planet.mercury.lng)
|
||||
.attr('jupiter-lng', m.planet.jupiter.lng)
|
||||
.attr('venus-lng', m.planet.venus.lng)
|
||||
.attr('saturn-lng', m.planet.saturn.lng)
|
||||
.appendTo('#grid');
|
||||
if ( $('#c'+j+'d'+m.planetary .day+'h'+m.planetary.hour.number).attr('hour') > 11 ) {
|
||||
$('#c'+j+'d'+m.planetary .day+'h'+m.planetary.hour.number).addClass('night-hour');
|
||||
}
|
||||
NProgress.set(j/data.planetaryhours.length);
|
||||
}
|
||||
for (var i = 0, len = data.planetaryhours.length; i < len; i++) {
|
||||
var everyday = setTimeout( makePHour, 10, i);
|
||||
}
|
||||
}
|
||||
|
||||
function generateJSON(iata, timestamp, timeoffset, days, latitude, longitude) {
|
||||
var caldata = [];
|
||||
var queryday = new moment.unix(timestamp).startOf('day');
|
||||
var j = 0;
|
||||
while ( j <= days ) {
|
||||
var m = planetaryMoment(latitude, longitude, queryday.unix());
|
||||
var sol = m.solar.day;
|
||||
var h = 0;
|
||||
var interval;
|
||||
var start;
|
||||
var m;
|
||||
while ( h < 24 ) {
|
||||
if ( h < 12 ) {
|
||||
interval = sol.day.hourSecs;
|
||||
start = sol.day.start;
|
||||
m = h;
|
||||
} else {
|
||||
interval = sol.night.hourSecs;
|
||||
start = sol.night.start;
|
||||
m = h - 12;
|
||||
}
|
||||
var hm = start + m * interval;
|
||||
pm = planetaryMoment(latitude, longitude, hm);
|
||||
caldata.push(pm);
|
||||
h++;
|
||||
}
|
||||
queryday.add(1, 'd');
|
||||
j++;
|
||||
};
|
||||
console.log(caldata);
|
||||
var data = {
|
||||
iata: iata,
|
||||
time: {
|
||||
starttime: timestamp,
|
||||
days: days,
|
||||
offset: timeoffset
|
||||
},
|
||||
coords: {
|
||||
lat: latitude,
|
||||
lng: longitude
|
||||
},
|
||||
planetaryhours: caldata
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
function createFilterModal(id, getFunction) {
|
||||
var items = getFunction();
|
||||
var title = $('#navigation a[data-target="#'+id+'"]').clone();
|
||||
var tagfilters = "";
|
||||
var actions = "";
|
||||
for (var i = 0, len = items.tags.length; i < len; i++) {
|
||||
tagfilters += '<li><input type="checkbox" class="actiontag" value=".'+items.tags[i]+'" id="'+id+'-'+items.tags[i]+'" /> '+items.tags[i]+'</li>';
|
||||
}
|
||||
for (var i = 0, len = items.actions.length; i < len; i++) {
|
||||
actions += '<li class="operation '+items.actions[i].tags+'"><input type="checkbox" value=".'+id+'-'+items.actions[i].id+'" id="'+id+'-'+items.actions[i].id+'" /> '+items.actions[i].action+'</li> ';
|
||||
}
|
||||
$('<div/>').loadTemplate($("#tpl-modal"), {
|
||||
title : 'Filter by'+title[0].innerText,
|
||||
left : '<h4>Tags</h4><ul class="option-set">'+tagfilters+'</ul>',
|
||||
right : '<h4>Operations</h4><ul class="option-set">'+actions+'</ul>'
|
||||
}) .appendTo('#modals').attr('id', id).attr('tabindex', '-1').attr('role', 'dialog').addClass('modal fade')
|
||||
.find('.col-sm-4')
|
||||
.addClass('actionlistfilter')
|
||||
.find('ul')
|
||||
.attr('id', id+'-tags' )
|
||||
.attr('data-group', id )
|
||||
.parents('.modal-body')
|
||||
.find('.col-sm-8')
|
||||
.addClass('filteroptions')
|
||||
.find('ul')
|
||||
.attr('id', id+'-actions')
|
||||
.attr('data-group', id+'-actions' );
|
||||
}
|
||||
|
||||
function createInfoModal() {
|
||||
$('<div/>').loadTemplate($("#tpl-modal"), {
|
||||
title : 'Planetary Hour <span id="p-hour"></span>',
|
||||
left : '<div id="p-info"></div>',
|
||||
right : '<div id="p-actions"></div>'
|
||||
}) .appendTo('#modals').attr('id', 'hourinfo').attr('tabindex', '-1').attr('role', 'dialog').addClass('modal fade').modal({ show: false});
|
||||
}
|
||||
|
||||
function getHourInfo() {
|
||||
var ts = $(this).attr('ts');
|
||||
var tsend = $(this).attr('ts-end');
|
||||
var day = parseFloat($(this).attr('day'));
|
||||
var hour = parseFloat($(this).attr('hour'));
|
||||
var sunlng = parseFloat($(this).attr('sun-lng'));
|
||||
var moonlng = parseFloat($(this).attr('moon-lng'));
|
||||
var marslng = parseFloat($(this).attr('mars-lng'));
|
||||
var mercurylng = parseFloat($(this).attr('mercury-lng'));
|
||||
var jupiterlng = parseFloat($(this).attr('jupiter-lng'));
|
||||
var venuslng = parseFloat($(this).attr('venus-lng'));
|
||||
var saturnlng = parseFloat($(this).attr('saturn-lng'));
|
||||
var zodiac = getZodiac(sunlng);
|
||||
var moonsign = getZodiac(moonlng);
|
||||
var marssign = getZodiac(marslng);
|
||||
var mercurysign = getZodiac(mercurylng);
|
||||
var jupitersign = getZodiac(jupiterlng);
|
||||
var venussign = getZodiac(venuslng);
|
||||
var saturnsign = getZodiac(saturnlng);
|
||||
var mansion = getLunarMansion(moonlng);
|
||||
var moonday = parseFloat($(this).attr('moon-day'));
|
||||
var phase = parseFloat($(this).attr('moon-phase'));
|
||||
var angle = parseFloat($(this).attr('moon-angle'));
|
||||
var illumination = parseFloat($(this).attr('moon-illumination'));
|
||||
var hygromanteia = getActions(matrix.planetary.day[day].hour[hour].for, action);
|
||||
var lunarday = getActions(matrix.lunar.day[lunarday], action);
|
||||
var lunarsign = getActions(matrix.lunar.sign[moonsign.sign].for, action);
|
||||
var lunarmansion = getActions(matrix.lunar.mansion[mansion], action);
|
||||
var claviculaday = getActions(matrix.clavicula[day+1], action);
|
||||
var claviculahour = getActions(matrix.clavicula[matrix.planetary.day[day].hour[hour].planet], action);
|
||||
$('#p-hour').html((hour+1));
|
||||
$('#p-info').html(
|
||||
$('<ul/>').append(
|
||||
'<li><h4>Data</h4></li>'+
|
||||
'<li>Day: '+def.planet.day[day+1]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[day+1]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Hour: '+(hour+1)+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[matrix.planetary.day[day].hour[hour].planet]+'</li>'+
|
||||
'<li>Angel: '+matrix.planetary.day[day].hour[hour].angel+'</li>'+
|
||||
'<li>Demon: '+matrix.planetary.day[day].hour[hour].demon+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Zodiac Sign: '+def.zodiac.name[zodiac.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[zodiac.sign]]+'</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(sunlng * 100) / 100+'°</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Decan: '+zodiac.decan+'</li>'+
|
||||
'<li>Greek: '+def.decan.greek[zodiac.decan]+'</li>'+
|
||||
'<li>Latin: '+def.decan.latin[zodiac.decan]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[zodiac.sign]]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Lunar Day: '+moonday+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>'+def.moon.phase.symbol[phase]+' '+def.moon.phase.name[phase]+'</li>'+
|
||||
'<li>Angle: '+Math.round(angle * 180 / Math.PI * 100) / 100+'°</li>'+
|
||||
'<li>Illumination: '+illumination+'%</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Lunar Sign: '+def.zodiac.name[moonsign.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[moonsign.sign]]+'</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(moonlng * 100) / 100+'°</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Lunar Mansion: '+mansion+'</li>'+
|
||||
'<li>Arabic: '+def.moon.mansion.arabic[mansion]+'</li>'+
|
||||
'<li>Latin: '+def.moon.mansion.latin[mansion]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Lunar Decan: '+moonsign.decan+'</li>'+
|
||||
'<li>Greek: '+def.decan.greek[moonsign.decan]+'</li>'+
|
||||
'<li>Latin: '+def.decan.latin[moonsign.decan]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[moonsign.sign]]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Mars</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(marslng * 100) / 100+'°</li>'+
|
||||
'<li>Zodiac: '+def.zodiac.name[marssign.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[marssign.sign]]+'</li>'+
|
||||
'<li>Decan: '+marssign.decan+' ('+def.decan.greek[marssign.decan]+')</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[marssign.sign]]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Mercury</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(mercurylng * 100) / 100+'°</li>'+
|
||||
'<li>Zodiac: '+def.zodiac.name[mercurysign.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[mercurysign.sign]]+'</li>'+
|
||||
'<li>Decan: '+mercurysign.decan+' ('+def.decan.greek[mercurysign.decan]+')</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[mercurysign.sign]]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Jupiter</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(jupiterlng * 100) / 100+'°</li>'+
|
||||
'<li>Zodiac: '+def.zodiac.name[jupitersign.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[jupitersign.sign]]+'</li>'+
|
||||
'<li>Decan: '+jupitersign.decan+' ('+def.decan.greek[jupitersign.decan]+')</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[jupitersign.sign]]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Venus</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(venuslng * 100) / 100+'°</li>'+
|
||||
'<li>Zodiac: '+def.zodiac.name[venussign.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[venussign.sign]]+'</li>'+
|
||||
'<li>Decan: '+venussign.decan+' ('+def.decan.greek[venussign.decan]+')</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[venussign.sign]]+'</li>'+
|
||||
'<li> </li>'+
|
||||
'<li>Saturn</li>'+
|
||||
'<li>Ecliptic Lng.: '+Math.round(saturnlng * 100) / 100+'°</li>'+
|
||||
'<li>Zodiac: '+def.zodiac.name[saturnsign.sign]+'</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.zodiac.ruler[saturnsign.sign]]+'</li>'+
|
||||
'<li>Decan: '+saturnsign.decan+' ('+def.decan.greek[saturnsign.decan]+')</li>'+
|
||||
'<li>Ruler: '+def.planet.name[def.decan.ruler[saturnsign.sign]]+'</li>'
|
||||
)
|
||||
);
|
||||
$('#p-actions').html(
|
||||
$('<ul/>').append(
|
||||
'<li><h4>Operations</h4></li>'+
|
||||
'<li><b>Key of Solomon</b></li>'+
|
||||
'<li><ul class="kos-actions"></ul></li>'+
|
||||
'<li><b>Hygromanteia</b></li>'+
|
||||
'<li><ul class="hyg-actions"></ul></li>'+
|
||||
'<li><b>Lunar Day</b></li>'+
|
||||
'<li><ul class="lud-actions"></ul></li>'+
|
||||
'<li><b>Moon Sign</b></li>'+
|
||||
'<li><ul class="mos-actions"></ul></li>'+
|
||||
'<li><b>Lunar Mansion</b></li>'+
|
||||
'<li><ul class="lum-actions"></ul></li>'
|
||||
)
|
||||
);
|
||||
$('<li/>').text('All Day:').appendTo('ul.kos-actions');
|
||||
$.each(claviculaday.actions.list.sort(function (a, b) { return a.action.localeCompare( b.action ); }), function(i) {
|
||||
$('<li/>').text(claviculaday.actions.list[i].action).appendTo('ul.kos-actions');
|
||||
});
|
||||
$('<li/>').html(' ').appendTo('ul.kos-actions');
|
||||
$('<li/>').text('This Hour:').appendTo('ul.kos-actions');
|
||||
$.each(claviculahour.actions.list.sort(function (a, b) { return a.action.localeCompare( b.action ); }), function(i) {
|
||||
$('<li/>').text(claviculahour.actions.list[i].action).appendTo('ul.kos-actions');
|
||||
});
|
||||
$('<li/>').html(' ').appendTo('ul.kos-actions');
|
||||
$.each(hygromanteia.actions.list.sort(function (a, b) { return a.action.localeCompare( b.action ); }), function(i) {
|
||||
$('<li/>').text(hygromanteia.actions.list[i].action).appendTo('ul.hyg-actions');
|
||||
});
|
||||
$('<li/>').html(' ').appendTo('ul.hyg-actions');
|
||||
$.each(lunarday.actions.list.sort(function (a, b) { return a.action.localeCompare( b.action ); }), function(i) {
|
||||
$('<li/>').text(lunarday.actions.list[i].action).appendTo('ul.lud-actions');
|
||||
});
|
||||
$('<li/>').html(' ').appendTo('ul.lud-actions');
|
||||
$.each(lunarsign.actions.list.sort(function (a, b) { return a.action.localeCompare( b.action ); }), function(i) {
|
||||
$('<li/>').text(lunarsign.actions.list[i].action).appendTo('ul.mos-actions');
|
||||
});
|
||||
$('<li/>').html(' ').appendTo('ul.mos-actions');
|
||||
$.each(lunarmansion.actions.list.sort(function (a, b) { return a.action.localeCompare( b.action ); }), function(i) {
|
||||
$('<li/>').text(lunarmansion.actions.list[i].action).appendTo('ul.lum-actions');
|
||||
});
|
||||
if ( !$('.addtocalendar').length ) $('<button/>').attr('type', 'button').addClass('btn btn-default').append($('<span/>').addClass('addtocalendar addeventatc')).prependTo('#hourinfo .modal-footer');
|
||||
var desc = $('#p-info').html()+'\n\n'+$('#p-actions').html();
|
||||
$('.addtocalendar').empty().loadTemplate('#tpl-atc', {
|
||||
start : new moment.unix(ts).format('YYYY-MM-DD HH:mm:ss'),
|
||||
end : new moment.unix(tsend).format('YYYY-MM-DD HH:mm:ss'),
|
||||
timezone : 'UTC',
|
||||
title : 'Planetary Hour '+$('#p-hour').text(),
|
||||
description : toMarkdown(desc),
|
||||
location : $('#lat').val()+', '+$('#lon').val(),
|
||||
organizer : 'http://www.sublunar.space',
|
||||
email : 'calendar@sublunar.space'
|
||||
});
|
||||
if (window.addtocalendar)if(typeof window.addtocalendar.start == "function")return;
|
||||
window.addtocalendar.load();
|
||||
$('#hourinfo').modal('show');
|
||||
}
|
||||
|
||||
function addPlanetClasses(lng, planet) {
|
||||
var zodiac = getZodiac(lng);
|
||||
var zodiacClass = planet + '-zodiac-' + zodiac.sign;
|
||||
var decanClass = planet + '-decan-' + zodiac.decan;
|
||||
return zodiacClass + ' ' + decanClass;
|
||||
}
|
||||
|
||||
function getActions(array, action, idstring = "") {
|
||||
var tags = [];
|
||||
var actions = [];
|
||||
var tagstring = "";
|
||||
var actionstring = "";
|
||||
if ( idstring != "" ) idstring += "-";
|
||||
if (array) {
|
||||
if (Array.isArray(array)) {
|
||||
for (var i = 0, len = array.length; i < len; i++) {
|
||||
if (action[array[i]].tags) tags.push(action[array[i]].tags);
|
||||
if (action[array[i]].action) actions.push(action[array[i]]);
|
||||
}
|
||||
if (tags) tagstring = $.unique(tags.join(" ").split(' ')).sort().join(" ");
|
||||
actionstring = array.sort().map(function(el) { return idstring + el; }).join(" ");
|
||||
actions.sort();
|
||||
}
|
||||
else if (action[array].tags) {
|
||||
tagstring = action[array].tags;
|
||||
actionstring = idstring + array;
|
||||
actions.push(action[array]);
|
||||
}
|
||||
}
|
||||
var obj = {
|
||||
tags : {
|
||||
string : tagstring,
|
||||
list : $.unique(tags.join(" ").split(' ')).sort()
|
||||
},
|
||||
actions : {
|
||||
string : actionstring,
|
||||
list : actions
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// from https://codepen.io/desandro/pen/MebyMR
|
||||
function getComboFilter() {
|
||||
var combo = [];
|
||||
for ( var prop in filters ) {
|
||||
var group = filters[ prop ];
|
||||
if ( !group.length ) {
|
||||
// no filters in group, carry on
|
||||
continue;
|
||||
}
|
||||
// add first group
|
||||
if ( !combo.length ) {
|
||||
combo = group.slice(0);
|
||||
continue;
|
||||
}
|
||||
// add additional groups
|
||||
var nextCombo = [];
|
||||
// split group into combo: [ A, B ] & [ 1, 2 ] => [ A1, A2, B1, B2 ]
|
||||
for ( var i=0; i < combo.length; i++ ) {
|
||||
for ( var j=0; j < group.length; j++ ) {
|
||||
var item = combo[i] + group[j];
|
||||
nextCombo.push( item );
|
||||
}
|
||||
}
|
||||
combo = nextCombo;
|
||||
}
|
||||
var comboFilter = combo.join(', ');
|
||||
return comboFilter;
|
||||
}
|
||||
372
js/old/definitions.js
Normal file
372
js/old/definitions.js
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
var definitions = {
|
||||
"manuscripts" : [
|
||||
"void",
|
||||
"Harleianus 5596",
|
||||
"Gennadianus 45",
|
||||
"Atheniensis"
|
||||
],
|
||||
"moon" : {
|
||||
"phase" : {
|
||||
"symbol" : [
|
||||
"void",
|
||||
"🌑",
|
||||
"🌒",
|
||||
"🌓",
|
||||
"🌔",
|
||||
"🌕",
|
||||
"🌖",
|
||||
"🌗",
|
||||
"🌘"
|
||||
],
|
||||
"name" : [
|
||||
"void",
|
||||
"new",
|
||||
"waxing crescent",
|
||||
"first quarter",
|
||||
"waxing gibbous",
|
||||
"full",
|
||||
"waning gibbous",
|
||||
"last quarter",
|
||||
"waning crescent"
|
||||
]
|
||||
},
|
||||
"mansion" : {
|
||||
"tropical" : [
|
||||
"void",
|
||||
"12 Aries 51",
|
||||
"25 Aries 42",
|
||||
"8 Taurus 34",
|
||||
"21 Taurus 25",
|
||||
"4 Gemini 17",
|
||||
"17 Gemini 8",
|
||||
"0 Cancer 0",
|
||||
"12 Cancer 51",
|
||||
"25 Cancer 42",
|
||||
"8 Leo 34",
|
||||
"21 Leo 25",
|
||||
"4 Virgo 17",
|
||||
"17 Virgo 8",
|
||||
"0 Libra 0",
|
||||
"12 Libra 51",
|
||||
"25 Libra 42",
|
||||
"8 Scorpio 34",
|
||||
"21 Scorpio 25",
|
||||
"4 Sagittarius 17",
|
||||
"17 Sagittarius 8",
|
||||
"0 Capricorn 0",
|
||||
"12 Capricorn 51",
|
||||
"25 Capricorn 42",
|
||||
"8 Aquarius 34",
|
||||
"21 Aquarius 25",
|
||||
"4 Pisces 17",
|
||||
"17 Pisces 8",
|
||||
"360 Aries 0"
|
||||
],
|
||||
"constellational" : [
|
||||
"9 Aries 0",
|
||||
"0 Taurus 0",
|
||||
"3 Taurus 0", // Number 28
|
||||
"18 Taurus 0", // Number 1
|
||||
"29 Taurus 0",
|
||||
"10 Gemini 0",
|
||||
"24 Gemini 0",
|
||||
"9 Cancer 0",
|
||||
"20 Cancer 0",
|
||||
"7 Leo 0",
|
||||
"18 Leo 0",
|
||||
"28 Leo 0",
|
||||
"12 Virgo 0",
|
||||
"22 Virgo 0",
|
||||
"27 Virgo 0",
|
||||
"24 Libra 0",
|
||||
"4 Scorpio 0",
|
||||
"15 Scorpio 0",
|
||||
"3 Sagittarius 0",
|
||||
"10 Sagittarius 0",
|
||||
"24 Sagittarius 0",
|
||||
"13 Capricorn 0",
|
||||
"16 Capricorn 0",
|
||||
"4 Aquarius 0",
|
||||
"12 Aquarius 0",
|
||||
"23 Aquarius 0",
|
||||
"4 Pisces 0",
|
||||
"23 Pisces 0",
|
||||
],
|
||||
"arabic" : [
|
||||
"void",
|
||||
"Al-Sharatain",
|
||||
"Al-Butain",
|
||||
"Al-Thuraiya",
|
||||
"Al-Dabaran",
|
||||
"Al-Haqa",
|
||||
"Al-Hana",
|
||||
"Al-Dhira",
|
||||
"Al-Nathrah",
|
||||
"Al-Tarf",
|
||||
"Al-Jabhah",
|
||||
"Al-Zubrah",
|
||||
"Al-Sarfah",
|
||||
"Al-Awwa",
|
||||
"Al-Simak",
|
||||
"Al-Ghafr",
|
||||
"Al-Zubana",
|
||||
"Al-Iklil",
|
||||
"Al-Qalb",
|
||||
"Al-Shaulah",
|
||||
"Al-Naaim",
|
||||
"Al-Baldah",
|
||||
"Sa’d al-Dhabih",
|
||||
"Sa’d Bula",
|
||||
"Sa’d al Suud",
|
||||
"Sa’d al-Akhbiyah",
|
||||
"Al Fargh al-Awwal",
|
||||
"Al Fargh al-Thani",
|
||||
"Batn al-Hut"
|
||||
],
|
||||
"latin" : [
|
||||
"void",
|
||||
"Alnath",
|
||||
"Albotain",
|
||||
"Azoraya",
|
||||
"Aldebaran",
|
||||
"Almices",
|
||||
"Athaya",
|
||||
"Aldira",
|
||||
"Annathra",
|
||||
"Atarf",
|
||||
"Algebha",
|
||||
"Azobra",
|
||||
"Acarfa",
|
||||
"Alahue",
|
||||
"Azimech",
|
||||
"Algarfa",
|
||||
"Azubene",
|
||||
"Alichil",
|
||||
"Alcalb",
|
||||
"Exaula",
|
||||
"Nahaym",
|
||||
"Elbelda",
|
||||
"Caadaldeba",
|
||||
"Caaddebolach",
|
||||
"Caddacohot",
|
||||
"Caadalhacbia",
|
||||
"Almiquedam",
|
||||
"Algarf almuehar",
|
||||
"Arrexhe"
|
||||
]
|
||||
}
|
||||
},
|
||||
"planet": {
|
||||
"name" : [
|
||||
"void",
|
||||
"Sun",
|
||||
"Moon",
|
||||
"Mars",
|
||||
"Mercury",
|
||||
"Jupiter",
|
||||
"Venus",
|
||||
"Saturn"
|
||||
],
|
||||
"symbol" : [
|
||||
"void",
|
||||
"☉",
|
||||
"☽",
|
||||
"♂",
|
||||
"☿",
|
||||
"♃",
|
||||
"♀",
|
||||
"♄"
|
||||
],
|
||||
"day" : [
|
||||
"void",
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday"
|
||||
]
|
||||
},
|
||||
"zodiac": {
|
||||
"name" : [
|
||||
"void",
|
||||
"Aries",
|
||||
"Taurus",
|
||||
"Gemini",
|
||||
"Cancer",
|
||||
"Leo",
|
||||
"Virgo",
|
||||
"Libra",
|
||||
"Scorpio",
|
||||
"Sagittarius",
|
||||
"Capricorn",
|
||||
"Aquarius",
|
||||
"Pisces"
|
||||
],
|
||||
"symbol" : [
|
||||
"void",
|
||||
"♈",
|
||||
"♉",
|
||||
"♊",
|
||||
"♋",
|
||||
"♌",
|
||||
"♍",
|
||||
"♎",
|
||||
"♏",
|
||||
"♐",
|
||||
"♑",
|
||||
"♒",
|
||||
"♓"
|
||||
],
|
||||
"ruler" : [
|
||||
"void",
|
||||
3,
|
||||
6,
|
||||
4,
|
||||
2,
|
||||
1,
|
||||
4,
|
||||
6,
|
||||
3,
|
||||
5,
|
||||
7,
|
||||
7,
|
||||
5
|
||||
]
|
||||
},
|
||||
"decan" : {
|
||||
"greek" : [ // Le Livré Sacre sur les Décans
|
||||
"void",
|
||||
"Chenlachori",
|
||||
"Chontaret",
|
||||
"Siket",
|
||||
"Soou",
|
||||
"Aron",
|
||||
"Rhomenos",
|
||||
"Xocha",
|
||||
"Ouari",
|
||||
"Pepisoth",
|
||||
"Sotheir",
|
||||
"Ouphisit",
|
||||
"Chnouphos",
|
||||
"Chnoumos",
|
||||
"Ipi",
|
||||
"Phatiti",
|
||||
"Athoum",
|
||||
"Brysous",
|
||||
"Amphatham",
|
||||
"Sphoukou",
|
||||
"Nephthimes",
|
||||
"Phou",
|
||||
"Name",
|
||||
"Oustichos",
|
||||
"Aphebis",
|
||||
"Sebos",
|
||||
"Teuchmos",
|
||||
"Chthisar",
|
||||
"Tair",
|
||||
"Epitek",
|
||||
"Epichnaus",
|
||||
"Isi",
|
||||
"Sosomo",
|
||||
"Chonoumous",
|
||||
"Tetimo",
|
||||
"Sopphi",
|
||||
"Syro"
|
||||
],
|
||||
"latin" : [ // Liber Hermetis
|
||||
"void",
|
||||
"Aulathamas",
|
||||
"Sabaoth",
|
||||
"Disornafais",
|
||||
"Jaus",
|
||||
"Sarnotois",
|
||||
"Erchmubris",
|
||||
"Manuchos",
|
||||
"Samurois",
|
||||
"Azuel",
|
||||
"Seneptois",
|
||||
"Somachalmais",
|
||||
"Charmine",
|
||||
"Zaloias",
|
||||
"Zachor",
|
||||
"Frich",
|
||||
"Zamendres",
|
||||
"Magois",
|
||||
"Michulais",
|
||||
"Psineus",
|
||||
"Chusthisis",
|
||||
"Psamiatois",
|
||||
"Necbeuos",
|
||||
"Turmantis",
|
||||
"Psermes",
|
||||
"Clinothois",
|
||||
"Thursois",
|
||||
"Renethis",
|
||||
"Renpsois",
|
||||
"Manethois",
|
||||
"Marcois",
|
||||
"Ularis",
|
||||
"Luxois",
|
||||
"Crauxes",
|
||||
"Fambais",
|
||||
"Flugmois",
|
||||
"Piatris"
|
||||
],
|
||||
"egyptian" : [ // Bennu Society
|
||||
"void",
|
||||
"Qd",
|
||||
"Sasa Qd",
|
||||
"A'rt",
|
||||
"Khaw",
|
||||
"Msdjr Sah",
|
||||
"Rmn Khr Sah",
|
||||
"A'sah",
|
||||
"Sah",
|
||||
"Spdt",
|
||||
"Dpa'knmwt",
|
||||
"Knmt",
|
||||
"Khr Khp Knmwt",
|
||||
"Hadjat",
|
||||
"Phwy Djat",
|
||||
"Thmat Hrt",
|
||||
"Thmat Khrt",
|
||||
"Wasthy",
|
||||
"Bakathy",
|
||||
"Dpa'Khntt",
|
||||
"Khntt Hrt",
|
||||
"Khntt Khrt",
|
||||
"Thmsn Khntt",
|
||||
"Sapt Khnnw",
|
||||
"Hr Ab Wya",
|
||||
"Shsmw",
|
||||
"Knmw",
|
||||
"Smdt",
|
||||
"Dpa'smdt",
|
||||
"Srt",
|
||||
"Sasa Srt",
|
||||
"Khr Khpt Srt",
|
||||
"Khw Khw",
|
||||
"Ba Ba",
|
||||
"Khnt Hrw",
|
||||
"Hr Ab Khtw",
|
||||
"Khnt Khrw"
|
||||
],
|
||||
"ruler" : [
|
||||
"void",
|
||||
3, 1, 6,
|
||||
4, 2, 7,
|
||||
5, 3, 1,
|
||||
6, 4, 2,
|
||||
7, 5, 3,
|
||||
1, 6, 4,
|
||||
2, 7, 5,
|
||||
3, 1, 6,
|
||||
4, 2, 7,
|
||||
5, 3, 1,
|
||||
6, 4, 2,
|
||||
7, 5, 3
|
||||
]
|
||||
}
|
||||
};
|
||||
47
js/old/math.js
Normal file
47
js/old/math.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
function round2( x ) { return ( Math.round( 100*x )/100.0 );}
|
||||
function normalize( v ) { v = v - Math.floor( v ); if( v < 0 ) v = v + 1; return v;}
|
||||
|
||||
function radToDeg(ra, neg = true) {
|
||||
var deg = ra * 180 / Math.PI;
|
||||
if( deg < 0 ) deg = deg + 360;
|
||||
return deg;
|
||||
}
|
||||
|
||||
function eqToEclDeg(eqobj, epsilon) {
|
||||
// https://en.wikipedia.org/wiki/Celestial_coordinate_system#Equatorial_.E2.86.94_ecliptic
|
||||
// not sure why longitude is 90° off, so i fixed it, but it works :)
|
||||
var delta = eqobj.dec * 180 / Math.PI;
|
||||
var alpha = eqobj.ra * 180 / Math.PI;
|
||||
var x = sind(alpha) * cosd(epsilon) + tand(delta) * sind(epsilon);
|
||||
var y = cosd(alpha);
|
||||
var z = sind(delta) * cosd(epsilon) - cosd(delta) * sind(epsilon) * sind(alpha);
|
||||
var obj = {
|
||||
lng : 90 - atan2d(y, x),
|
||||
lat : asind(z)
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function zodToDeg(zcoord) {
|
||||
var zdef = def.zodiac; // global variable needs to be declared before using this function
|
||||
var z = zcoord.split(" ");
|
||||
var m = 0;
|
||||
for (var i = 0, len = 13; i < len; i++) {
|
||||
if (zdef.name[i] == z[1] || zdef.symbol[i] == z[1] ) m = i-1;
|
||||
}
|
||||
return parseFloat(z[0]) + m * 30 + parseFloat(z[2]) / 60;
|
||||
}
|
||||
|
||||
function getDistance(lat1,lon1,lat2,lon2) {
|
||||
var R = 6371; // Radius of the earth in km
|
||||
var dLat = (lat2-lat1) * (Math.PI/180); // deg2rad below
|
||||
var dLon = (lon2-lon1) * (Math.PI/180);
|
||||
var a =
|
||||
Math.sin(dLat/2) * Math.sin(dLat/2) +
|
||||
Math.cos( lat1 * (Math.PI/180) ) * Math.cos(lat2 * (Math.PI/180) ) *
|
||||
Math.sin(dLon/2) * Math.sin(dLon/2)
|
||||
;
|
||||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
||||
var d = R * c; // Distance in km
|
||||
return d;
|
||||
}
|
||||
1423
js/old/matrix.js
Normal file
1423
js/old/matrix.js
Normal file
File diff suppressed because it is too large
Load diff
5
js/require.js
Normal file
5
js/require.js
Normal file
File diff suppressed because one or more lines are too long
4
lib/sweph/.gitignore
vendored
Normal file
4
lib/sweph/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
*.o
|
||||
*.a
|
||||
libswe*
|
||||
/pmom
|
||||
54
lib/sweph/LICENSE
Normal file
54
lib/sweph/LICENSE
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
57
lib/sweph/Makefile
Normal file
57
lib/sweph/Makefile
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# $Header$
|
||||
# this Makefile creates a SwissEph library and a swetest sample on 64-bit
|
||||
# Redhat Enterprise Linux RHEL 6.
|
||||
|
||||
# The mode marked as 'Linux' should also work with the GNU C compiler
|
||||
# gcc on other systems.
|
||||
|
||||
# If you modify this makefile for another compiler, please
|
||||
# let us know. We would like to add as many variations as possible.
|
||||
# If you get warnings and error messages from your compiler, please
|
||||
# let us know. We like to fix the source code so that it compiles
|
||||
# free of warnings.
|
||||
# send email to the Swiss Ephemeris mailing list.
|
||||
#
|
||||
|
||||
CFLAGS = -g -Wall -fPIC -O2 # for Linux and other gcc systems
|
||||
OP=$(CFLAGS)
|
||||
CC=cc #for Linux
|
||||
|
||||
# compilation rule for general cases
|
||||
.o :
|
||||
$(CC) $(OP) -o $@ $? -lm
|
||||
.c.o:
|
||||
$(CC) -c $(OP) $<
|
||||
|
||||
SWEOBJ = swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swepcalc.o sweph.o\
|
||||
swepdate.o swephlib.o swecl.o swehel.o
|
||||
|
||||
pmom: pmom.o libswe.a
|
||||
$(CC) $(OP) -o pmom pmom.o -L. -lswe -lm -ldl
|
||||
|
||||
# create an archive and a dynamic link libary fro SwissEph
|
||||
# a user of this library will inlcude swephexp.h and link with -lswe
|
||||
|
||||
libswe.a: $(SWEOBJ)
|
||||
ar r libswe.a $(SWEOBJ)
|
||||
|
||||
libswe.so: $(SWEOBJ)
|
||||
$(CC) -shared -o libswe.so $(SWEOBJ)
|
||||
|
||||
clean:
|
||||
rm -f *.o pmom libswe*
|
||||
|
||||
###
|
||||
swecl.o: swejpl.h sweodef.h swephexp.h swedll.h sweph.h swephlib.h
|
||||
sweclips.o: sweodef.h swephexp.h swedll.h
|
||||
swedate.o: swephexp.h sweodef.h swedll.h
|
||||
swehel.o: swephexp.h sweodef.h swedll.h
|
||||
swehouse.o: swephexp.h sweodef.h swedll.h swephlib.h swehouse.h
|
||||
swejpl.o: swephexp.h sweodef.h swedll.h sweph.h swejpl.h
|
||||
swemini.o: swephexp.h sweodef.h swedll.h
|
||||
swemmoon.o: swephexp.h sweodef.h swedll.h sweph.h swephlib.h
|
||||
swemplan.o: swephexp.h sweodef.h swedll.h sweph.h swephlib.h swemptab.h
|
||||
swepcalc.o: swepcalc.h swephexp.h sweodef.h swedll.h
|
||||
sweph.o: swejpl.h sweodef.h swephexp.h swedll.h sweph.h swephlib.h
|
||||
swephlib.o: swephexp.h sweodef.h swedll.h sweph.h swephlib.h
|
||||
swetest.o: swephexp.h sweodef.h swedll.h
|
||||
BIN
lib/sweph/lib/semo_18.se1
Normal file
BIN
lib/sweph/lib/semo_18.se1
Normal file
Binary file not shown.
BIN
lib/sweph/lib/sepl_18.se1
Normal file
BIN
lib/sweph/lib/sepl_18.se1
Normal file
Binary file not shown.
328
lib/sweph/pmom.c
Normal file
328
lib/sweph/pmom.c
Normal file
File diff suppressed because one or more lines are too long
13
lib/sweph/sedeltat.txt.inactive
Normal file
13
lib/sweph/sedeltat.txt.inactive
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# This file allows to make new Delta T known to the Swiss Ephemeris.
|
||||
# Note, these values override the values given in the internal Delta T
|
||||
# table of the Swiss Ephemeris.
|
||||
#
|
||||
# If you want to use this file, change its file name and remove the
|
||||
# the extension '.inactive'. As soon as you do so, the values below
|
||||
# will be used, i.e. they will override the internal Delta T values
|
||||
# of the Swiss Ephemeris.
|
||||
#
|
||||
# Format: year and seconds (decimal)
|
||||
2007 65.15
|
||||
2008 65.46
|
||||
2009 65.78
|
||||
1548
lib/sweph/sefstars.txt
Normal file
1548
lib/sweph/sefstars.txt
Normal file
File diff suppressed because it is too large
Load diff
6
lib/sweph/seleapsec.txt
Normal file
6
lib/sweph/seleapsec.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# This file contains the dates of leap seconds to be taken into account
|
||||
# by the Swiss Ephemeris.
|
||||
# For each new leap second add the date of its insertion in the format
|
||||
# yyyymmdd, e.g. "20081231" for 31 december 2008.
|
||||
# The leap second is inserted at the end of the day.
|
||||
20081231
|
||||
86
lib/sweph/seorbel.txt
Normal file
86
lib/sweph/seorbel.txt
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# Orbital elements of ficticious planets
|
||||
# 27 Jan. 2000
|
||||
#
|
||||
# This file is part of the Swiss Ephemeris, from Version 1.52 on.
|
||||
#
|
||||
# Warning! These planets do not exist!
|
||||
#
|
||||
# The user can add his or her own elements.
|
||||
# 960 is the maximum number of ficticious planets.
|
||||
#
|
||||
# The elements order is as follows:
|
||||
# 1. epoch of elements (Julian day)
|
||||
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000")
|
||||
# 3. mean anomaly at epoch
|
||||
# 4. semi-axis
|
||||
# 5. eccentricity
|
||||
# 6. argument of perihelion (ang. distance of perihelion from node)
|
||||
# 7. ascending node
|
||||
# 8. inclination
|
||||
# 9. name of planet
|
||||
#
|
||||
# use '#' for comments
|
||||
# to compute a body with swe_calc(), use planet number
|
||||
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
|
||||
# e.g. number of Kronos is ipl = 39 + 4 = 43
|
||||
#
|
||||
# Witte/Sieggruen planets, refined by James Neely
|
||||
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
|
||||
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
|
||||
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
|
||||
J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
|
||||
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
|
||||
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
|
||||
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
|
||||
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
|
||||
#
|
||||
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
|
||||
# Strubell does not give an equinox. 1945 is taken in order to
|
||||
# reproduce the as best as ASTRON ephemeris. (This is a strange
|
||||
# choice, though.)
|
||||
# The epoch according to Strubell is 1772.76.
|
||||
# 1772 is a leap year!
|
||||
# The fraction is counted from 1 Jan. 1772
|
||||
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
|
||||
# Nibiru, elements from Christian Woeltge, Hannover
|
||||
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
|
||||
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
|
||||
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
|
||||
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
|
||||
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
|
||||
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
|
||||
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
|
||||
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
|
||||
# intramercurian hypothetical Vulcan acc. to L.H. Weston
|
||||
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
|
||||
# Selena/White Moon
|
||||
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
|
||||
# Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html
|
||||
# J1900, 170.73 + 51.05 * T
|
||||
J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
|
||||
# Waldemath's Second Earth Moon
|
||||
# Elements were derived by D.Koch from Waldemaths original elements as given in
|
||||
# David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons)
|
||||
# elements, which are based on the assumption that the "mean longitude" given
|
||||
# by Waldemath is an observation (a true longitude)
|
||||
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
|
||||
# which is obviously wrong.
|
||||
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
|
||||
# Colin R. Nicholl's Comet, according to "The Great Christ Comet", p. 223.
|
||||
1719500.7, J2000, 0.0, 1190.0, 0.9999, 9.47, 200.08, 178.3, Christ Comet # 20
|
||||
# Planet 9, according to: Fienga & alii, Constraints on the location of a
|
||||
# possible 9th planet, Astronomy & Astrophysics no. FiengaLaskar2016R5. The
|
||||
# authors provide true anomaly 117.8. Mean anomaly derived by D. Koch
|
||||
2457388.5,J2000,45.5272966,700,0.6,150,113,30,Planet_9 # 21
|
||||
# Comet Halley 12 BCE
|
||||
1717323.349, J2000, 0.0, 17.99571, 0.96737, 92.559, 35.904, 163.489, Halley 12BC # 22
|
||||
# 2015 RR245
|
||||
2457600.5,J2000,322.50413,81.2891975,0.5852663,261.41753,211.67680,7.57643,2015 RR245 # 23
|
||||
#
|
||||
# The following elements are for test only
|
||||
# (Selena without T)
|
||||
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
|
||||
# (Selena with T, gives exactly the same position)
|
||||
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17
|
||||
J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18
|
||||
J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18
|
||||
6302
lib/sweph/swecl.c
Normal file
6302
lib/sweph/swecl.c
Normal file
File diff suppressed because it is too large
Load diff
592
lib/sweph/swedate.c
Normal file
592
lib/sweph/swedate.c
Normal file
|
|
@ -0,0 +1,592 @@
|
|||
/*********************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $
|
||||
version 15-feb-89 16:30
|
||||
|
||||
swe_date_conversion()
|
||||
swe_revjul()
|
||||
swe_julday()
|
||||
|
||||
************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
/*
|
||||
swe_date_conversion():
|
||||
This function converts some date+time input {d,m,y,uttime}
|
||||
into the Julian day number tjd.
|
||||
The function checks that the input is a legal combination
|
||||
of dates; for illegal dates like 32 January 1993 it returns ERR
|
||||
but still converts the date correctly, i.e. like 1 Feb 1993.
|
||||
The function is usually used to convert user input of birth data
|
||||
into the Julian day number. Illegal dates should be notified to the user.
|
||||
|
||||
Be aware that we always use astronomical year numbering for the years
|
||||
before Christ, not the historical year numbering.
|
||||
Astronomical years are done with negative numbers, historical
|
||||
years with indicators BC or BCE (before common era).
|
||||
Year 0 (astronomical) = 1 BC historical.
|
||||
year -1 (astronomical) = 2 BC
|
||||
etc.
|
||||
Many users of Astro programs do not know about this difference.
|
||||
|
||||
Return: OK or ERR (for illegal date)
|
||||
*********************************************************/
|
||||
|
||||
# include "swephexp.h"
|
||||
# include "sweph.h"
|
||||
|
||||
static TLS AS_BOOL init_leapseconds_done = FALSE;
|
||||
|
||||
|
||||
int CALL_CONV swe_date_conversion(int y,
|
||||
int m,
|
||||
int d, /* day, month, year */
|
||||
double uttime, /* UT in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian] */
|
||||
double *tjd)
|
||||
{
|
||||
int rday, rmon, ryear;
|
||||
double rut, jd;
|
||||
int gregflag = SE_JUL_CAL;
|
||||
if (c == 'g')
|
||||
gregflag = SE_GREG_CAL;
|
||||
rut = uttime; /* hours UT */
|
||||
jd = swe_julday(y, m, d, rut, gregflag);
|
||||
swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut);
|
||||
*tjd = jd;
|
||||
if (rmon == m && rday == d && ryear == y) {
|
||||
return OK;
|
||||
} else {
|
||||
return ERR;
|
||||
}
|
||||
} /* end date_conversion */
|
||||
|
||||
/*************** swe_julday ********************************************
|
||||
* This function returns the absolute Julian day number (JD)
|
||||
* for a given calendar date.
|
||||
* The arguments are a calendar date: day, month, year as integers,
|
||||
* hour as double with decimal fraction.
|
||||
* If gregflag = SE_GREG_CAL (1), Gregorian calendar is assumed,
|
||||
* if gregflag = SE_JUL_CAL (0),Julian calendar is assumed.
|
||||
|
||||
The Julian day number is a system of numbering all days continously
|
||||
within the time range of known human history. It should be familiar
|
||||
to every astrological or astronomical programmer. The time variable
|
||||
in astronomical theories is usually expressed in Julian days or
|
||||
Julian centuries (36525 days per century) relative to some start day;
|
||||
the start day is called 'the epoch'.
|
||||
The Julian day number is a double representing the number of
|
||||
days since JD = 0.0 on 1 Jan -4712, 12:00 noon (in the Julian calendar).
|
||||
|
||||
Midnight has always a JD with fraction .5, because traditionally
|
||||
the astronomical day started at noon. This was practical because
|
||||
then there was no change of date during a night at the telescope.
|
||||
From this comes also the fact the noon ephemerides were printed
|
||||
before midnight ephemerides were introduced early in the 20th century.
|
||||
|
||||
NOTE: The Julian day number must not be confused with the Julian
|
||||
calendar system.
|
||||
|
||||
Be aware the we always use astronomical year numbering for the years
|
||||
before Christ, not the historical year numbering.
|
||||
Astronomical years are done with negative numbers, historical
|
||||
years with indicators BC or BCE (before common era).
|
||||
Year 0 (astronomical) = 1 BC
|
||||
year -1 (astronomical) = 2 BC
|
||||
etc.
|
||||
|
||||
Original author: Marc Pottenger, Los Angeles.
|
||||
with bug fix for year < -4711 15-aug-88 by Alois Treindl
|
||||
(The parameter sequence m,d,y still indicates the US origin,
|
||||
be careful because the similar function date_conversion() uses
|
||||
other parameter sequence and also Astrodienst relative juldate.)
|
||||
|
||||
References: Oliver Montenbruck, Grundlagen der Ephemeridenrechnung,
|
||||
Verlag Sterne und Weltraum (1987), p.49 ff
|
||||
|
||||
related functions: swe_revjul() reverse Julian day number: compute the
|
||||
calendar date from a given JD
|
||||
date_conversion() includes test for legal date values
|
||||
and notifies errors like 32 January.
|
||||
****************************************************************/
|
||||
|
||||
double CALL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
|
||||
{
|
||||
double jd;
|
||||
double u,u0,u1,u2;
|
||||
u = year;
|
||||
if (month < 3) u -=1;
|
||||
u0 = u + 4712.0;
|
||||
u1 = month + 1.0;
|
||||
if (u1 < 4) u1 += 12.0;
|
||||
jd = floor(u0*365.25)
|
||||
+ floor(30.6*u1+0.000001)
|
||||
+ day + hour/24.0 - 63.5;
|
||||
if (gregflag == SE_GREG_CAL) {
|
||||
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
|
||||
if (u < 0.0) u2 = -u2;
|
||||
jd = jd - u2 + 2;
|
||||
if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
|
||||
jd -=1;
|
||||
}
|
||||
return jd;
|
||||
}
|
||||
|
||||
/*** swe_revjul ******************************************************
|
||||
swe_revjul() is the inverse function to swe_julday(), see the description
|
||||
there.
|
||||
Arguments are julian day number, calendar flag (0=julian, 1=gregorian)
|
||||
return values are the calendar day, month, year and the hour of
|
||||
the day with decimal fraction (0 .. 23.999999).
|
||||
|
||||
Be aware the we use astronomical year numbering for the years
|
||||
before Christ, not the historical year numbering.
|
||||
Astronomical years are done with negative numbers, historical
|
||||
years with indicators BC or BCE (before common era).
|
||||
Year 0 (astronomical) = 1 BC historical year
|
||||
year -1 (astronomical) = 2 BC historical year
|
||||
year -234 (astronomical) = 235 BC historical year
|
||||
etc.
|
||||
|
||||
Original author Mark Pottenger, Los Angeles.
|
||||
with bug fix for year < -4711 16-aug-88 Alois Treindl
|
||||
*************************************************************************/
|
||||
void CALL_CONV swe_revjul (double jd, int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut)
|
||||
{
|
||||
double u0,u1,u2,u3,u4;
|
||||
u0 = jd + 32082.5;
|
||||
if (gregflag == SE_GREG_CAL) {
|
||||
u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
|
||||
if (jd >= 1830691.5) u1 +=1;
|
||||
u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
|
||||
}
|
||||
u2 = floor (u0 + 123.0);
|
||||
u3 = floor ( (u2 - 122.2) / 365.25);
|
||||
u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
|
||||
*jmon = (int) (u4 - 1.0);
|
||||
if (*jmon > 12) *jmon -= 12;
|
||||
*jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
|
||||
*jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
|
||||
*jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
|
||||
}
|
||||
|
||||
/* transform local time to UTC or UTC to local time
|
||||
*
|
||||
* input
|
||||
* iyear ... dsec date and time
|
||||
* d_timezone timezone offset
|
||||
* output
|
||||
* iyear_out ... dsec_out
|
||||
*
|
||||
* For time zones east of Greenwich, d_timezone is positive.
|
||||
* For time zones west of Greenwich, d_timezone is negative.
|
||||
*
|
||||
* For conversion from local time to utc, use +d_timezone.
|
||||
* For conversion from utc to local time, use -d_timezone.
|
||||
*/
|
||||
void CALL_CONV swe_utc_time_zone(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
double d_timezone,
|
||||
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
|
||||
int32 *ihour_out, int32 *imin_out, double *dsec_out
|
||||
)
|
||||
{
|
||||
double tjd, d;
|
||||
AS_BOOL have_leapsec = FALSE;
|
||||
double dhour;
|
||||
if (dsec >= 60.0) {
|
||||
have_leapsec = TRUE;
|
||||
dsec -= 1.0;
|
||||
}
|
||||
dhour = ((double) ihour) + ((double) imin) / 60.0 + dsec / 3600.0;
|
||||
tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL);
|
||||
dhour -= d_timezone;
|
||||
if (dhour < 0.0) {
|
||||
tjd -= 1.0;
|
||||
dhour += 24.0;
|
||||
}
|
||||
if (dhour >= 24.0) {
|
||||
tjd += 1.0;
|
||||
dhour -= 24.0;
|
||||
}
|
||||
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
|
||||
*ihour_out = (int) dhour;
|
||||
d = (dhour - (double) *ihour_out) * 60;
|
||||
*imin_out = (int) d;
|
||||
*dsec_out = (d - (double) *imin_out) * 60;
|
||||
if (have_leapsec)
|
||||
*dsec_out += 1.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* functions for the handling of UTC
|
||||
*/
|
||||
|
||||
/* Leap seconds were inserted at the end of the following days:*/
|
||||
#define NLEAP_SECONDS 27 // ignoring end mark '0'
|
||||
#define NLEAP_SECONDS_SPACE 100
|
||||
static TLS int leap_seconds[NLEAP_SECONDS_SPACE] = {
|
||||
19720630,
|
||||
19721231,
|
||||
19731231,
|
||||
19741231,
|
||||
19751231,
|
||||
19761231,
|
||||
19771231,
|
||||
19781231,
|
||||
19791231,
|
||||
19810630,
|
||||
19820630,
|
||||
19830630,
|
||||
19850630,
|
||||
19871231,
|
||||
19891231,
|
||||
19901231,
|
||||
19920630,
|
||||
19930630,
|
||||
19940630,
|
||||
19951231,
|
||||
19970630,
|
||||
19981231,
|
||||
20051231,
|
||||
20081231,
|
||||
20120630,
|
||||
20150630,
|
||||
20161231,
|
||||
0 /* keep this 0 as end mark */
|
||||
};
|
||||
#define J1972 2441317.5
|
||||
#define NLEAP_INIT 10
|
||||
|
||||
/* Read additional leap second dates from external file, if given.
|
||||
*/
|
||||
static int init_leapsec(void)
|
||||
{
|
||||
FILE *fp;
|
||||
int ndat, ndat_last;
|
||||
int tabsiz = 0;
|
||||
int i;
|
||||
char s[AS_MAXCH];
|
||||
char *sp;
|
||||
if (!init_leapseconds_done) {
|
||||
init_leapseconds_done = TRUE;
|
||||
tabsiz = NLEAP_SECONDS;
|
||||
ndat_last = leap_seconds[NLEAP_SECONDS - 1];
|
||||
/* no error message if file is missing */
|
||||
if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
|
||||
return NLEAP_SECONDS;
|
||||
while(fgets(s, AS_MAXCH, fp) != NULL) {
|
||||
sp = s;
|
||||
while (*sp == ' ' || *sp == '\t') sp++;
|
||||
sp++;
|
||||
if (*sp == '#' || *sp == '\n')
|
||||
continue;
|
||||
ndat = atoi(s);
|
||||
if (ndat <= ndat_last)
|
||||
continue;
|
||||
/* table space is limited. no error msg, if exceeded */
|
||||
if (tabsiz >= NLEAP_SECONDS_SPACE)
|
||||
return tabsiz;
|
||||
leap_seconds[tabsiz] = ndat;
|
||||
tabsiz++;
|
||||
}
|
||||
if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
|
||||
fclose(fp);
|
||||
return tabsiz;
|
||||
}
|
||||
/* find table size */
|
||||
tabsiz = 0;
|
||||
for (i = 0; i < NLEAP_SECONDS_SPACE; i++) {
|
||||
if (leap_seconds[i] == 0)
|
||||
break;
|
||||
else
|
||||
tabsiz++;
|
||||
}
|
||||
return tabsiz;
|
||||
}
|
||||
|
||||
/*
|
||||
* Input: Clock time UTC, year, month, day, hour, minute, second (decimal).
|
||||
* gregflag Calendar flag
|
||||
* serr error string
|
||||
* Output: An array of doubles:
|
||||
* dret[0] = Julian day number TT (ET)
|
||||
* dret[1] = Julian day number UT1
|
||||
*
|
||||
* Function returns OK or Error.
|
||||
*
|
||||
* - Before 1972, swe_utc_to_jd() treats its input time as UT1.
|
||||
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
|
||||
* UTC second was regularly changed, so that UTC remained very close to UT1.
|
||||
* - From 1972 on, input time is treated as UTC.
|
||||
* - If delta_t - nleap - 32.184 > 1, the input time is treated as UT1.
|
||||
* Note: Like this we avoid errors greater than 1 second in case that
|
||||
* the leap seconds table (or the Swiss Ephemeris version) is not updated
|
||||
* for a long time.
|
||||
*/
|
||||
int32 CALL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr)
|
||||
{
|
||||
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
|
||||
int iyear2, imonth2, iday2;
|
||||
int i, j, ndat, nleap, tabsiz_nleap;
|
||||
/*
|
||||
* error handling: invalid iyear etc.
|
||||
*/
|
||||
tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag);
|
||||
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
|
||||
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
|
||||
return ERR;
|
||||
}
|
||||
if (ihour < 0 || ihour > 23
|
||||
|| imin < 0 || imin > 59
|
||||
|| dsec < 0 || dsec >= 61
|
||||
|| (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
|
||||
return ERR;
|
||||
}
|
||||
dhour = (double) ihour + ((double) imin) / 60.0 + dsec / 3600.0;
|
||||
/*
|
||||
* before 1972, we treat input date as UT1
|
||||
*/
|
||||
if (tjd_ut1 < J1972) {
|
||||
dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag);
|
||||
dret[0] = dret[1] + swe_deltat_ex(dret[1], -1, NULL);
|
||||
return OK;
|
||||
}
|
||||
/*
|
||||
* if gregflag = Julian calendar, convert to gregorian calendar
|
||||
*/
|
||||
if (gregflag == SE_JUL_CAL) {
|
||||
gregflag = SE_GREG_CAL;
|
||||
swe_revjul(tjd_ut1, gregflag, &iyear, &imonth, &iday, &d);
|
||||
}
|
||||
/*
|
||||
* number of leap seconds since 1972:
|
||||
*/
|
||||
tabsiz_nleap = init_leapsec();
|
||||
nleap = NLEAP_INIT; /* initial difference between UTC and TAI in 1972 */
|
||||
ndat = iyear * 10000 + imonth * 100 + iday;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat <= leap_seconds[i])
|
||||
break;
|
||||
nleap++;
|
||||
}
|
||||
/*
|
||||
* For input dates > today:
|
||||
* If leap seconds table is not up to date, we'd better interpret the
|
||||
* input time as UT1, not as UTC. How do we find out?
|
||||
* Check, if delta_t - nleap - 32.184 > 0.9
|
||||
*/
|
||||
d = swe_deltat_ex(tjd_ut1, -1, NULL) * 86400.0;
|
||||
if (d - (double) nleap - 32.184 >= 1.0) {
|
||||
dret[1] = tjd_ut1 + dhour / 24.0;
|
||||
dret[0] = dret[1] + swe_deltat_ex(dret[1], -1, NULL);
|
||||
return OK;
|
||||
}
|
||||
/*
|
||||
* if input second is 60: is it a valid leap second ?
|
||||
*/
|
||||
if (dsec >= 60) {
|
||||
j = 0;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat == leap_seconds[i]) {
|
||||
j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j != 1) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", ihour, imin, dsec);
|
||||
return ERR;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* convert UTC to ET and UT1
|
||||
*/
|
||||
/* the number of days between input date and 1 jan 1972: */
|
||||
d = tjd_ut1 - J1972;
|
||||
/* SI time since 1972, ignoring leap seconds: */
|
||||
d += (double) ihour / 24.0 + (double) imin / 1440.0 + dsec / 86400.0;
|
||||
/* ET (TT) */
|
||||
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
|
||||
tjd_et = tjd_et_1972 + d + ((double) (nleap - NLEAP_INIT)) / 86400.0;
|
||||
d = swe_deltat_ex(tjd_et, -1, NULL);
|
||||
tjd_ut1 = tjd_et - swe_deltat_ex(tjd_et - d, -1, NULL);
|
||||
tjd_ut1 = tjd_et - swe_deltat_ex(tjd_ut1, -1, NULL);
|
||||
dret[0] = tjd_et;
|
||||
dret[1] = tjd_ut1;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Input: tjd_et Julian day number, terrestrial time (ephemeris time).
|
||||
* gregfalg Calendar flag
|
||||
* Output: UTC year, month, day, hour, minute, second (decimal).
|
||||
*
|
||||
* - Before 1 jan 1972 UTC, output UT1.
|
||||
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
|
||||
* UTC second was regularly changed, so that UTC remained very close to UT1.
|
||||
* - From 1972 on, output is UTC.
|
||||
* - If delta_t - nleap - 32.184 > 1, the output is UT1.
|
||||
* Note: Like this we avoid errors greater than 1 second in case that
|
||||
* the leap seconds table (or the Swiss Ephemeris version) has not been
|
||||
* updated for a long time.
|
||||
*/
|
||||
void CALL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
|
||||
{
|
||||
int i;
|
||||
int second_60 = 0;
|
||||
int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap;
|
||||
double d, tjd, tjd_et_1972, tjd_ut, dret[10];
|
||||
/*
|
||||
* if tjd_et is before 1 jan 1972 UTC, return UT1
|
||||
*/
|
||||
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
|
||||
d = swe_deltat_ex(tjd_et, -1, NULL);
|
||||
tjd_ut = tjd_et - swe_deltat_ex(tjd_et - d, -1, NULL);
|
||||
tjd_ut = tjd_et - swe_deltat_ex(tjd_ut, -1, NULL);
|
||||
if (tjd_et < tjd_et_1972) {
|
||||
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double) *ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double) *imin) * 60.0;
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* minimum number of leap seconds since 1972; we may be missing one leap
|
||||
* second
|
||||
*/
|
||||
tabsiz_nleap = init_leapsec();
|
||||
swe_revjul(tjd_ut-1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
|
||||
ndat = iyear2 * 10000 + imonth2 * 100 + iday2;
|
||||
nleap = 0;
|
||||
for (i = 0; i < tabsiz_nleap; i++) {
|
||||
if (ndat <= leap_seconds[i])
|
||||
break;
|
||||
nleap++;
|
||||
}
|
||||
/* date of potentially missing leapsecond */
|
||||
if (nleap < tabsiz_nleap) {
|
||||
i = leap_seconds[nleap];
|
||||
iyear2 = i / 10000;
|
||||
imonth2 = (i % 10000) / 100;;
|
||||
iday2 = i % 100;
|
||||
tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL);
|
||||
swe_revjul(tjd+1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
|
||||
swe_utc_to_jd(iyear2,imonth2,iday2, 0, 0, 0, SE_GREG_CAL, dret, NULL);
|
||||
d = tjd_et - dret[0];
|
||||
if (d >= 0) {
|
||||
nleap++;
|
||||
} else if (d < 0 && d > -1.0/86400.0) {
|
||||
second_60 = 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UTC, still unsure about one leap second
|
||||
*/
|
||||
tjd = J1972 + (tjd_et - tjd_et_1972) - ((double) nleap + second_60) / 86400.0;
|
||||
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double) *ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double) *imin) * 60.0 + second_60;
|
||||
/*
|
||||
* For input dates > today:
|
||||
* If leap seconds table is not up to date, we'd better interpret the
|
||||
* input time as UT1, not as UTC. How do we find out?
|
||||
* Check, if delta_t - nleap - 32.184 > 0.9
|
||||
*/
|
||||
d = swe_deltat_ex(tjd_et, -1, NULL);
|
||||
d = swe_deltat_ex(tjd_et - d, -1, NULL);
|
||||
if (d * 86400.0 - (double) (nleap + NLEAP_INIT) - 32.184 >= 1.0) {
|
||||
swe_revjul(tjd_et - d, SE_GREG_CAL, iyear, imonth, iday, &d);
|
||||
*ihour = (int32) d;
|
||||
d -= (double) *ihour;
|
||||
d *= 60;
|
||||
*imin = (int32) d;
|
||||
*dsec = (d - (double) *imin) * 60.0;
|
||||
}
|
||||
if (gregflag == SE_JUL_CAL) {
|
||||
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL);
|
||||
swe_revjul(tjd, gregflag, iyear, imonth, iday, &d);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Input: tjd_ut Julian day number, universal time (UT1).
|
||||
* gregfalg Calendar flag
|
||||
* Output: UTC year, month, day, hour, minute, second (decimal).
|
||||
*
|
||||
* - Before 1 jan 1972 UTC, output UT1.
|
||||
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
|
||||
* UTC second was regularly changed, so that UTC remained very close to UT1.
|
||||
* - From 1972 on, output is UTC.
|
||||
* - If delta_t - nleap - 32.184 > 1, the output is UT1.
|
||||
* Note: Like this we avoid errors greater than 1 second in case that
|
||||
* the leap seconds table (or the Swiss Ephemeris version) has not been
|
||||
* updated for a long time.
|
||||
*/
|
||||
void CALL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
|
||||
{
|
||||
double tjd_et = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
|
||||
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
|
||||
}
|
||||
82
lib/sweph/swedate.h
Normal file
82
lib/sweph/swedate.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*********************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
version 15-feb-89 16:30
|
||||
*********************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _SWEDLL_H
|
||||
extern EXP32 int swe_date_conversion (
|
||||
int y , int m , int d , /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tgmt);
|
||||
|
||||
extern EXP32 double *swe_julday(
|
||||
int year, int month, int day, double hour,
|
||||
int gregflag);
|
||||
|
||||
extern EXP32 void swe_revjul (
|
||||
double jd,
|
||||
int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
566
lib/sweph/swedll.h
Normal file
566
lib/sweph/swedll.h
Normal file
|
|
@ -0,0 +1,566 @@
|
|||
/* SWISSEPH
|
||||
* $Header: /home/dieter/sweph/RCS/swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
|
||||
*
|
||||
* Windows DLL interface imports for the Astrodienst SWISSEPH package
|
||||
*
|
||||
|
||||
**************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
/* $Id: swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifndef _SWEDLL_H
|
||||
#define _SWEDLL_H
|
||||
|
||||
#ifndef _SWEPHEXP_INCLUDED
|
||||
#include "swephexp.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_DLL16 /* 16bit DLL */
|
||||
#define DllImport extern
|
||||
#else
|
||||
# ifdef __cplusplus
|
||||
#define DllImport extern "C" __declspec( dllimport )
|
||||
# else
|
||||
#define DllImport __declspec( dllimport )
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* DLL defines
|
||||
Define UNDECO_DLL for un-decorated dll
|
||||
verify compiler option __cdecl for un-decorated and __stdcall for decorated */
|
||||
/*#define UNDECO_DLL */
|
||||
|
||||
#if defined (PASCAL) || defined(__stdcall)
|
||||
#if defined UNDECO_DLL
|
||||
#define CALL_CONV_IMP __cdecl
|
||||
#else
|
||||
#define CALL_CONV_IMP __stdcall
|
||||
#endif
|
||||
#else
|
||||
#define CALL_CONV_IMP
|
||||
#endif
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_heliacal_ut(double JDNDaysUTStart, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_heliacal_pheno_ut(double JDNDaysUT, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
|
||||
/* the following are secret, for Victor Reijs' */
|
||||
DllImport int32 CALL_CONV_IMP swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_degnorm(double deg);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_version(char *);
|
||||
DllImport char * CALL_CONV_IMP swe_get_library_path(char *);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_calc(
|
||||
double tjd, int ipl, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_calc_ut(
|
||||
double tjd_ut, int32 ipl, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar(
|
||||
char *star, double tjd, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar_ut(
|
||||
char *star, double tjd_ut, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar_mag(
|
||||
char *star, double *xx, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar2(
|
||||
char *star, double tjd, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar2_ut(
|
||||
char *star, double tjd_ut, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar2_mag(
|
||||
char *star, double *xx, char *serr);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_sidtime0(double tjd_ut, double ecl, double nut);
|
||||
DllImport double CALL_CONV_IMP swe_sidtime(double tjd_ut);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_deltat_ex(double tjd, int32 iflag, char *serr);
|
||||
DllImport double CALL_CONV_IMP swe_deltat(double tjd);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_houses(
|
||||
double tjd_ut, double geolat, double geolon, int hsys,
|
||||
double *hcusps, double *ascmc);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_houses_ex(
|
||||
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
|
||||
double *hcusps, double *ascmc);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_houses_armc(
|
||||
double armc, double geolat, double eps, int hsys,
|
||||
double *hcusps, double *ascmc);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_house_pos(
|
||||
double armc, double geolon, double eps, int hsys, double *xpin, char *serr);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_house_name(int hsys);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_gauquelin_sector(
|
||||
double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_set_sid_mode(
|
||||
int32 sid_mode, double t0, double ayan_t0);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_get_ayanamsa(double tjd_et);
|
||||
DllImport double CALL_CONV_IMP swe_get_ayanamsa_ut(double tjd_ut);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_get_ayanamsa_name(int32 isidmode);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_date_conversion(
|
||||
int y , int m , int d , /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tjd);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_julday(
|
||||
int year, int mon, int mday,
|
||||
double hour,
|
||||
int gregflag);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_revjul(
|
||||
double jd, int gregflag,
|
||||
int *year, int *mon, int *mday,
|
||||
double *hour);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_utc_time_zone(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
double d_timezone,
|
||||
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
|
||||
int32 *ihour_out, int32 *imin_out, double *dsec_out);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_utc_to_jd(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
int32 gregflag, double *dret, char *serr);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_jdet_to_utc(
|
||||
double tjd_et, int32 gregflag,
|
||||
int32 *iyear, int32 *imonth, int32 *iday,
|
||||
int32 *ihour, int32 *imin, double *dsec);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_jdut1_to_utc(
|
||||
double tjd_ut, int32 gregflag,
|
||||
int32 *iyear, int32 *imonth, int32 *iday,
|
||||
int32 *ihour, int32 *imin, double *dsec);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_time_equ(
|
||||
double tjd, double *e, char *serr);
|
||||
DllImport int CALL_CONV_IMP swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
|
||||
DllImport int CALL_CONV_IMP swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_get_tid_acc(void);
|
||||
DllImport void CALL_CONV_IMP swe_set_tid_acc(double tidacc);
|
||||
DllImport void CALL_CONV_IMP swe_set_delta_t_userdef(double dt);
|
||||
DllImport void CALL_CONV_IMP swe_set_ephe_path(char *path);
|
||||
DllImport void CALL_CONV_IMP swe_set_jpl_file(char *fname);
|
||||
DllImport void CALL_CONV_IMP swe_close(void);
|
||||
DllImport char * CALL_CONV_IMP swe_get_planet_name(int ipl, char *spname);
|
||||
DllImport void CALL_CONV_IMP swe_cotrans(double *xpo, double *xpn, double eps);
|
||||
DllImport void CALL_CONV_IMP swe_cotrans_sp(double *xpo, double *xpn, double eps);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_set_topo(double geolon, double geolat, double height);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_set_astro_models(char *samod, int32 iflag);
|
||||
DllImport void CALL_CONV_IMP swe_get_astro_models(char *samod, char *sdet, int32 iflag);
|
||||
|
||||
/****************************
|
||||
* from swecl.c
|
||||
****************************/
|
||||
|
||||
/* computes geographic location and attributes of solar
|
||||
* eclipse at a given tjd */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
/* finds time of next local eclipse */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
|
||||
/* finds time of next eclipse globally */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
|
||||
|
||||
/* finds time of next occultation globally */
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
|
||||
|
||||
/* computes attributes of a lunar eclipse for given tjd */
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_how(
|
||||
double tjd_ut,
|
||||
int32 ifl,
|
||||
double *geopos,
|
||||
double *attr,
|
||||
char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
/* planetary phenomena */
|
||||
DllImport int32 CALL_CONV_IMP swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
|
||||
DllImport double CALL_CONV_IMP swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
|
||||
DllImport void CALL_CONV_IMP swe_set_lapse_rate(double lapse_rate);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_azalt(
|
||||
double tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double atpress,
|
||||
double attemp,
|
||||
double *xin,
|
||||
double *xaz);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_azalt_rev(
|
||||
double tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double *xin,
|
||||
double *xout);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_rise_trans(
|
||||
double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double atpress, double attemp,
|
||||
double *tret,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_rise_trans_true_hor(
|
||||
double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double atpress, double attemp,
|
||||
double horhgt,
|
||||
double *tret,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_get_orbital_elements(double tjd_et, int32 ipl, int32 iflag, double *dret, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_orbit_max_min_true_distance(double tjd_et, int32 ipl, int32 iflag, double *dmax, double *dmin, double *dtrue, char *serr);
|
||||
|
||||
/*******************************************************
|
||||
* other functions from swephlib.c;
|
||||
* they are not needed for Swiss Ephemeris,
|
||||
* but may be useful to former Placalc users.
|
||||
********************************************************/
|
||||
|
||||
/* normalize argument into interval [0..DEG360] */
|
||||
DllImport centisec CALL_CONV_IMP swe_csnorm(centisec p);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [0..360[ */
|
||||
DllImport centisec CALL_CONV_IMP swe_difcsn (centisec p1, centisec p2);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_difdegn (double p1, double p2);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
|
||||
DllImport centisec CALL_CONV_IMP swe_difcs2n(centisec p1, centisec p2);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
|
||||
|
||||
DllImport double CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
|
||||
DllImport double CALL_CONV_IMP swe_difrad2n(double p1, double p2);
|
||||
DllImport double CALL_CONV_IMP swe_rad_midp(double x1, double x0);
|
||||
DllImport double CALL_CONV_IMP swe_deg_midp(double x1, double x0);
|
||||
|
||||
/* round second, but at 29.5959 always down */
|
||||
DllImport centisec CALL_CONV_IMP swe_csroundsec(centisec x);
|
||||
|
||||
/* double to int32 with rounding, no overflow check */
|
||||
DllImport int32 CALL_CONV_IMP swe_d2l(double x);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
|
||||
|
||||
/* monday = 0, ... sunday = 6 */
|
||||
DllImport int CALL_CONV_IMP swe_day_of_week(double jd);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_cs2degstr(CSEC t, char *a);
|
||||
|
||||
DllImport void CALL_CONV_IMP swe_set_interpolate_nut(AS_BOOL do_interpolate);
|
||||
|
||||
|
||||
/* additional functions for antiquated GFA basic DLL interface.
|
||||
* double -> double *
|
||||
* char -> char *
|
||||
* void -> int
|
||||
*/
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_calc_d(
|
||||
double *tjd, int ipl, int32 iflag,
|
||||
double *x,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_calc_ut_d(
|
||||
double *tjd, int16 ipl, int32 iflag,
|
||||
double *x,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar_d(
|
||||
char *star, double *tjd, int32 iflag,
|
||||
double *x,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_fixstar_ut_d(
|
||||
char *star, double *tjd, int32 iflag,
|
||||
double *x,
|
||||
char *serr);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_close_d(int ivoid);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_set_ephe_path_d(char *path);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_set_jpl_file_d(char *fname);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_get_planet_name_d(int ipl, char *spname);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_deltat_d(double *tjd, double *deltat);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_sidtime0_d(double *tjd_ut, double *eps,
|
||||
double *nut, double *sidt);
|
||||
DllImport int CALL_CONV_IMP swe_sidtime_d(double *tjd_ut, double *sidt);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_set_sid_mode_d(
|
||||
int32 sid_mode, double *t0, double *ayan_t0);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_get_ayanamsa_d(double *tjd_et, double *ayan);
|
||||
DllImport int CALL_CONV_IMP swe_get_ayanamsa_ut_d(double *tjd_et, double *ayan);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_cotrans_d(double *xpo, double *xpn, double *eps);
|
||||
DllImport int CALL_CONV_IMP swe_cotrans_sp_d(double *xpo, double *xpn, double *eps);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_set_topo_d(double *geolon, double *geolat, double *height);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_get_tid_acc_d(double *t_acc);
|
||||
DllImport int CALL_CONV_IMP swe_set_tid_acc_d(double *t_acc);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_degnorm_d(double *x);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_date_conversion_d(
|
||||
int y , int m , int d , /* year, month, day */
|
||||
double *utime, /* universal time in hours (decimal) */
|
||||
char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tjd);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_julday_d(
|
||||
int year, int month, int day, double *hour,
|
||||
int gregflag, double *tjd);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_revjul_d(
|
||||
double *tjd,
|
||||
int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_houses_d(
|
||||
double *tjd, double *geolat, double *geolon, int hsys,
|
||||
double *hcusps, double *ascmc);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_houses_ex_d(
|
||||
double *tjd_ut, int32 iflag, double *geolat, double *geolon, int hsys,
|
||||
double *hcusps, double *ascmc);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_houses_armc_d(
|
||||
double *armc, double *geolat, double *eps, int hsys,
|
||||
double *hcusps, double *ascmc);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_house_pos_d(
|
||||
double *armc, double *geolon, double *eps, int hsys, double *xpin, double *hpos, char *serr);
|
||||
|
||||
/* normalize argument into interval [0..DEG360] */
|
||||
DllImport centisec CALL_CONV_IMP swe_csnorm_d(centisec p);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [0..360[ */
|
||||
DllImport centisec CALL_CONV_IMP swe_difcsn_d(centisec p1, centisec p2);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_difdegn_d(double *p1, double *p2, double *diff);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
|
||||
DllImport centisec CALL_CONV_IMP swe_difcs2n_d(centisec p1, centisec p2);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_difdeg2n_d(double *p1, double *p2, double *diff);
|
||||
|
||||
/* round second, but at 29.5959 always down */
|
||||
DllImport centisec CALL_CONV_IMP swe_csroundsec_d(centisec x);
|
||||
|
||||
/* double to int32 with rounding, no overflow check */
|
||||
DllImport int32 CALL_CONV_IMP swe_d2l_d(double *x);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_split_deg_d(double *ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
|
||||
|
||||
/* monday = 0, ... sunday = 6 */
|
||||
DllImport int CALL_CONV_IMP swe_day_of_week_d(double *jd);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_cs2timestr_d(CSEC t, int sep, AS_BOOL suppressZero, char *a);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_cs2lonlatstr_d(CSEC t, char *pchar, char *mchar, char *s);
|
||||
|
||||
DllImport char * CALL_CONV_IMP swe_cs2degstr_d(CSEC t, char *a);
|
||||
|
||||
/****************************
|
||||
* from swecl.c
|
||||
****************************/
|
||||
|
||||
/* computes geographic location and attributes of solar
|
||||
* eclipse at a given tjd */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_where_d(double *tjd_ut, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_how_d(double *tjd_ut, int32 ifl, double geolon, double geolat, double geohgt, double *attr, char *serr);
|
||||
|
||||
/* finds time of next local eclipse */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_loc_d(double *tjd_start, int32 ifl, double *geopos, double *tret, double *attr, AS_BOOL backward, char *serr);
|
||||
|
||||
/* finds time of next eclipse globally */
|
||||
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_glob_d(double *tjd_start, int32 ifl, int32 ifltype,
|
||||
double *tret, AS_BOOL backward, char *serr);
|
||||
|
||||
/* computes attributes of a lunar eclipse for given tjd */
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_how_d(
|
||||
double *tjd_ut,
|
||||
int32 ifl,
|
||||
double *attr,
|
||||
char *serr);
|
||||
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when_d(double *tjd_start, int32 ifl, int32 ifltype,
|
||||
double *tret, AS_BOOL backward, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_pheno_d(double *tjd, int32 ipl, int32 iflag,
|
||||
double *attr, char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_pheno_ut_d(double *tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_refrac_d(double *inalt, double *atpress, double *attemp, int32 calc_flag, double *retalt);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_azalt_d(
|
||||
double *tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double *atpress,
|
||||
double *attemp,
|
||||
double *xin,
|
||||
double *xaz);
|
||||
|
||||
DllImport int CALL_CONV_IMP swe_azalt_rev_d(
|
||||
double *tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double *xin,
|
||||
double *xout);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_rise_trans_d(
|
||||
double *tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double *atpress, double *attemp,
|
||||
double *tret,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_nod_aps_d(double *tjd_et, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
|
||||
DllImport int32 CALL_CONV_IMP swe_nod_aps_ut_d(double *tjd_ut, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
|
||||
#endif /* !_SWEDLL_H */
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
3504
lib/sweph/swehel.c
Normal file
3504
lib/sweph/swehel.c
Normal file
File diff suppressed because it is too large
Load diff
2694
lib/sweph/swehouse.c
Normal file
2694
lib/sweph/swehouse.c
Normal file
File diff suppressed because it is too large
Load diff
87
lib/sweph/swehouse.h
Normal file
87
lib/sweph/swehouse.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/*******************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swehouse.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
module swehouse.h
|
||||
house and (simple) aspect calculation
|
||||
|
||||
*******************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
struct houses {
|
||||
double cusp[37];
|
||||
double ac;
|
||||
double mc;
|
||||
double vertex;
|
||||
double equasc;
|
||||
double coasc1;
|
||||
double coasc2;
|
||||
double polasc;
|
||||
double sundec; // declination of Sun for Sunshine houses
|
||||
char serr[AS_MAXCH];
|
||||
};
|
||||
|
||||
#define HOUSES struct houses
|
||||
#define VERY_SMALL 1E-10
|
||||
|
||||
#define degtocs(x) (d2l((x) * DEG))
|
||||
#define cstodeg(x) (double)((x) * CS2DEG)
|
||||
|
||||
#define sind(x) sin((x) * DEGTORAD)
|
||||
#define cosd(x) cos((x) * DEGTORAD)
|
||||
#define tand(x) tan((x) * DEGTORAD)
|
||||
#define asind(x) (asin(x) * RADTODEG)
|
||||
#define acosd(x) (acos(x) * RADTODEG)
|
||||
#define atand(x) (atan(x) * RADTODEG)
|
||||
#define atan2d(y, x) (atan2(y, x) * RADTODEG)
|
||||
930
lib/sweph/swejpl.c
Normal file
930
lib/sweph/swejpl.c
Normal file
|
|
@ -0,0 +1,930 @@
|
|||
|
||||
/*
|
||||
| $Header: /home/dieter/sweph/RCS/swejpl.c,v 1.76 2008/08/26 13:55:36 dieter Exp $
|
||||
|
|
||||
| Subroutines for reading JPL ephemerides.
|
||||
| derived from testeph.f as contained in DE403 distribution July 1995.
|
||||
| works with DE200, DE102, DE403, DE404, DE405, DE406, DE431
|
||||
| (attention, these ephemerides do not have exactly the same reference frame)
|
||||
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#if MSDOS
|
||||
#else
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "swephexp.h"
|
||||
#include "sweph.h"
|
||||
#include "swejpl.h"
|
||||
|
||||
#if MSDOS
|
||||
typedef __int64 off_t64;
|
||||
#define FSEEK _fseeki64
|
||||
#define FTELL _ftelli64
|
||||
#else
|
||||
typedef off_t off_t64;
|
||||
#define FSEEK fseeko
|
||||
#define FTELL ftello
|
||||
#endif
|
||||
|
||||
#define DEBUG_DO_SHOW FALSE
|
||||
|
||||
/*
|
||||
* local globals
|
||||
*/
|
||||
struct jpl_save {
|
||||
char *jplfname;
|
||||
char *jplfpath;
|
||||
FILE *jplfptr;
|
||||
short do_reorder;
|
||||
double eh_cval[400];
|
||||
double eh_ss[3], eh_au, eh_emrat;
|
||||
int32 eh_denum, eh_ncon, eh_ipt[39];
|
||||
char ch_cnam[6*400];
|
||||
double pv[78];
|
||||
double pvsun[6];
|
||||
double buf[1500];
|
||||
double pc[18], vc[18], ac[18], jc[18];
|
||||
short do_km;
|
||||
};
|
||||
|
||||
static TLS struct jpl_save *js;
|
||||
|
||||
static int state (double et, int32 *list, int do_bary,
|
||||
double *pv, double *pvsun, double *nut, char *serr);
|
||||
static int interp(double *buf, double t, double intv, int32 ncfin,
|
||||
int32 ncmin, int32 nain, int32 ifl, double *pv);
|
||||
static int32 fsizer(char *serr);
|
||||
static void reorder(char *x, int size, int number);
|
||||
static int read_const_jpl(double *ss, char *serr);
|
||||
|
||||
/* information about eh_ipt[] and buf[]
|
||||
DE200 DE102 DE403
|
||||
3 3 ipt[0] 3 body 0 (mercury) starts at buf[2]
|
||||
12 15 ipt[1] 14 body 0, ncf = coefficients per component
|
||||
4 2 ipt[2] 4 na = nintervals, tot 14*4*3=168
|
||||
147 93 ipt[3] 171 body 1 (venus) starts at buf[170]
|
||||
12 15 ipt[4] 10 ncf = coefficients per component
|
||||
1 1 ipt[5] 2 total 10*2*3=60
|
||||
183 138 ipt[6] 231 body 2 (earth) starts at buf[230]
|
||||
15 15 ipt[7] 13 ncf = coefficients per component
|
||||
2 2 ipt[8] 2 total 13*2*3=78
|
||||
273 228 ipt[9] 309 body 3 (mars) starts at buf[308]
|
||||
10 10 ipt[10] 11 ncf = coefficients per component
|
||||
1 1 ipt[11] 1 total 11*1*3=33
|
||||
303 258 ipt[12] 342 body 4 (jupiter) at buf[341]
|
||||
9 9 ipt[13] 8 total 8 * 1 * 3 = 24
|
||||
1 1 ipt[14] 1
|
||||
330 285 ipt[15] 366 body 5 (saturn) at buf[365]
|
||||
8 8 ipt[16] 7 total 7 * 1 * 3 = 21
|
||||
1 1 ipt[17] 1
|
||||
354 309 ipt[18] 387 body 6 (uranus) at buf[386]
|
||||
8 8 ipt[19] 6 total 6 * 1 * 3 = 18
|
||||
1 1 ipt[20] 1
|
||||
378 333 ipt[21] 405 body 7 (neptune) at buf[404]
|
||||
6 6 ipt[22] 6 total 18
|
||||
1 1 ipt[23] 1
|
||||
396 351 ipt[24] 423 body 8 (pluto) at buf[422]
|
||||
6 6 ipt[25] 6 total 18
|
||||
1 1 ipt[26] 1
|
||||
414 369 ipt[27] 441 body 9 (moon) at buf[440]
|
||||
12 15 ipt[28] 13 total 13 * 8 * 3 = 312
|
||||
8 8 ipt[29] 8
|
||||
702 729 ipt[30] 753 SBARY SUN, starts at buf[752]
|
||||
15 15 ipt[31] 11 SBARY SUN, ncf = coeff per component
|
||||
1 1 ipt[32] 2 total 11*2*3=66
|
||||
747 774 ipt[33] 819 nutations, starts at buf[818]
|
||||
10 0 ipt[34] 10 total 10 * 4 * 2 = 80
|
||||
4 0 ipt[35] 4 (nutation only two coordinates)
|
||||
0 0 ipt[36] 899 librations, start at buf[898]
|
||||
0 0 ipt[37] 10 total 10 * 4 * 3 = 120
|
||||
0 0 ipt[38] 4
|
||||
|
||||
last element of buf[1017]
|
||||
buf[0] contains start jd and buf[1] end jd of segment;
|
||||
each segment is 32 days in de403, 64 days in DE102, 32 days in DE200
|
||||
|
||||
Length of blocks: DE406 = 1456*4=5824 bytes = 728 double
|
||||
DE405 = 2036*4=8144 bytes = 1018 double
|
||||
DE404 = 1456*4=5824 bytes = 728 double
|
||||
DE403 = 2036*4=8144 bytes = 1018 double
|
||||
DE200 = 1652*4=6608 bytes = 826 double
|
||||
DE102 = 1546*4=6184 bytes = 773 double
|
||||
each DE102 record has 53*8=424 fill bytes so that
|
||||
the records have the same length as DE200.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This subroutine opens the file jplfname, with a phony record length,
|
||||
* reads the first record, and uses the info to compute ksize,
|
||||
* the number of single precision words in a record.
|
||||
* RETURN: ksize (record size of ephemeris data)
|
||||
* jplfptr is opened on return.
|
||||
* note 26-aug-2008: now record size is computed by fsizer(), not
|
||||
* set to a fixed value depending as in previous releases. The caller of
|
||||
* fsizer() will verify by data comparison whether it computed correctly.
|
||||
*/
|
||||
static int32 fsizer(char *serr)
|
||||
{
|
||||
/* Local variables */
|
||||
int32 ncon;
|
||||
double emrat;
|
||||
int32 numde;
|
||||
double au, ss[3];
|
||||
int i, kmx, khi, nd;
|
||||
int32 ksize, lpt[3];
|
||||
char ttl[6*14*3];
|
||||
if ((js->jplfptr = swi_fopen(SEI_FILE_PLANET, js->jplfname, js->jplfpath, serr)) == NULL) {
|
||||
return NOT_AVAILABLE;
|
||||
}
|
||||
/* ttl = ephemeris title, e.g.
|
||||
* "JPL Planetary Ephemeris DE404/LE404
|
||||
* Start Epoch: JED= 625296.5-3001 DEC 21 00:00:00
|
||||
* Final Epoch: JED= 2817168.5 3001 JAN 17 00:00:00c */
|
||||
fread((void *) &ttl[0], 1, 252, js->jplfptr);
|
||||
/* cnam = names of constants */
|
||||
fread((void *) js->ch_cnam, 1, 6*400, js->jplfptr);
|
||||
/* ss[0] = start epoch of ephemeris
|
||||
* ss[1] = end epoch
|
||||
* ss[2] = segment size in days */
|
||||
fread((void *) &ss[0], sizeof(double), 3, js->jplfptr);
|
||||
/* reorder ? */
|
||||
if (ss[2] < 1 || ss[2] > 200)
|
||||
js->do_reorder = TRUE;
|
||||
else
|
||||
js->do_reorder = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
js->eh_ss[i] = ss[i];
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_ss[0], sizeof(double), 3);
|
||||
/* plausibility test of these constants. Start and end date must be
|
||||
* between -20000 and +20000, segment size >= 1 and <= 200 */
|
||||
if (js->eh_ss[0] < -5583942 || js->eh_ss[1] > 9025909 || js->eh_ss[2] < 1 || js->eh_ss[2] > 200) {
|
||||
if (serr != NULL) {
|
||||
strcpy(serr, "alleged ephemeris file has invalid format.");
|
||||
if (strlen(serr) + strlen(js->jplfname) + 3 < AS_MAXCH) {
|
||||
sprintf(serr, "alleged ephemeris file (%s) has invalid format.", js->jplfname);
|
||||
}
|
||||
}
|
||||
return(NOT_AVAILABLE);
|
||||
}
|
||||
/* ncon = number of constants */
|
||||
fread((void *) &ncon, sizeof(int32), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &ncon, sizeof(int32), 1);
|
||||
/* au = astronomical unit */
|
||||
fread((void *) &au, sizeof(double), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &au, sizeof(double), 1);
|
||||
/* emrat = earth moon mass ratio */
|
||||
fread((void *) &emrat, sizeof(double), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &emrat, sizeof(double), 1);
|
||||
/* ipt[i+0]: coefficients of planet i start at buf[ipt[i+0]-1]
|
||||
* ipt[i+1]: number of coefficients (interpolation order - 1)
|
||||
* ipt[i+2]: number of intervals in segment */
|
||||
fread((void *) &js->eh_ipt[0], sizeof(int32), 36, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_ipt[0], sizeof(int32), 36);
|
||||
/* numde = number of jpl ephemeris "404" with de404 */
|
||||
fread((void *) &numde, sizeof(int32), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &numde, sizeof(int32), 1);
|
||||
/* read librations */
|
||||
fread(&lpt[0], sizeof(int32), 3, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &lpt[0], sizeof(int32), 3);
|
||||
/* fill librations into eh_ipt[36]..[38] */
|
||||
for (i = 0; i < 3; ++i)
|
||||
js->eh_ipt[i + 36] = lpt[i];
|
||||
rewind(js->jplfptr);
|
||||
/* find the number of ephemeris coefficients from the pointers */
|
||||
/* re-activated this code on 26-aug-2008 */
|
||||
kmx = 0;
|
||||
khi = 0;
|
||||
for (i = 0; i < 13; i++) {
|
||||
if (js->eh_ipt[i * 3] > kmx) {
|
||||
kmx = js->eh_ipt[i * 3];
|
||||
khi = i + 1;
|
||||
}
|
||||
}
|
||||
if (khi == 12)
|
||||
nd = 2;
|
||||
else
|
||||
nd = 3;
|
||||
ksize = (js->eh_ipt[khi * 3 - 3] + nd * js->eh_ipt[khi * 3 - 2] * js->eh_ipt[khi * 3 - 1] - 1L) * 2L;
|
||||
/*
|
||||
* de102 files give wrong ksize, because they contain 424 empty bytes
|
||||
* per record. Fixed by hand!
|
||||
*/
|
||||
if (ksize == 1546)
|
||||
ksize = 1652;
|
||||
#if 0 /* we prefer to compute ksize to be comaptible
|
||||
with new DE releases */
|
||||
switch (numde) {
|
||||
case 403:
|
||||
case 405:
|
||||
case 410:
|
||||
case 413:
|
||||
case 414:
|
||||
case 418:
|
||||
case 421:
|
||||
ksize = 2036;
|
||||
break;
|
||||
case 404:
|
||||
case 406:
|
||||
ksize = 1456;
|
||||
break;
|
||||
case 200:
|
||||
ksize = 1652;
|
||||
break;
|
||||
case 102:
|
||||
ksize = 1652; /* de102 is filled with blanks to length of de200 */
|
||||
break;
|
||||
default:
|
||||
if (serr != NULL)
|
||||
sprintf(serr,"unknown numde value %d;", numde);
|
||||
return ERR;
|
||||
}
|
||||
#endif
|
||||
if (ksize < 1000 || ksize > 5000) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "JPL ephemeris file does not provide valid ksize (%d)", ksize);/**/
|
||||
return NOT_AVAILABLE;
|
||||
}
|
||||
return ksize;
|
||||
}
|
||||
|
||||
/*
|
||||
* This subroutine reads the jpl planetary ephemeris
|
||||
* and gives the position and velocity of the point 'ntarg'
|
||||
* with respect to 'ncent'.
|
||||
* calling sequence parameters:
|
||||
* et = d.p. julian ephemeris date at which interpolation
|
||||
* is wanted.
|
||||
* ** note the entry dpleph for a doubly-dimensioned time **
|
||||
* the reason for this option is discussed in the
|
||||
* subroutine state
|
||||
* ntarg = integer number of 'target' point.
|
||||
* ncent = integer number of center point.
|
||||
* the numbering convention for 'ntarg' and 'ncent' is:
|
||||
* 0 = mercury 7 = neptune
|
||||
* 1 = venus 8 = pluto
|
||||
* 2 = earth 9 = moon
|
||||
* 3 = mars 10 = sun
|
||||
* 4 = jupiter 11 = solar-system barycenter
|
||||
* 5 = saturn 12 = earth-moon barycenter
|
||||
* 6 = uranus 13 = nutations (longitude and obliq)
|
||||
* 14 = librations, if on eph file
|
||||
* (if nutations are wanted, set ntarg = 13. for librations,
|
||||
* set ntarg = 14. set ncent=0.)
|
||||
* rrd = output 6-word d.p. array containing position and velocity
|
||||
* of point 'ntarg' relative to 'ncent'. the units are au and
|
||||
* au/day. for librations the units are radians and radians
|
||||
* per day. in the case of nutations the first four words of
|
||||
* rrd will be set to nutations and rates, having units of
|
||||
* radians and radians/day.
|
||||
* The option is available to have the units in km and km/sec.
|
||||
* For this, set do_km=TRUE (default FALSE).
|
||||
*/
|
||||
int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
|
||||
{
|
||||
int i, retc;
|
||||
int32 list[12];
|
||||
double *pv = js->pv;
|
||||
double *pvsun = js->pvsun;
|
||||
for (i = 0; i < 6; ++i)
|
||||
rrd[i] = 0.0;
|
||||
if (ntarg == ncent)
|
||||
return 0;
|
||||
for (i = 0; i < 12; ++i)
|
||||
list[i] = 0;
|
||||
/* check for nutation call */
|
||||
if (ntarg == J_NUT) {
|
||||
if (js->eh_ipt[34] > 0) {
|
||||
list[10] = 2;
|
||||
return(state(et, list, FALSE, pv, pvsun, rrd, serr));
|
||||
} else {
|
||||
if (serr != NULL)
|
||||
sprintf(serr,"No nutations on the JPL ephemeris file;");
|
||||
return (NOT_AVAILABLE);
|
||||
}
|
||||
}
|
||||
if (ntarg == J_LIB) {
|
||||
if (js->eh_ipt[37] > 0) {
|
||||
list[11] = 2;
|
||||
if ((retc = state(et, list, FALSE, pv, pvsun, rrd, serr)) != OK)
|
||||
return (retc);
|
||||
for (i = 0; i < 6; ++i)
|
||||
rrd[i] = pv[i + 60];
|
||||
return 0;
|
||||
} else {
|
||||
if (serr != NULL)
|
||||
sprintf(serr,"No librations on the ephemeris file;");
|
||||
return (NOT_AVAILABLE);
|
||||
}
|
||||
}
|
||||
/* set up proper entries in 'list' array for state call */
|
||||
if (ntarg < J_SUN)
|
||||
list[ntarg] = 2;
|
||||
if (ntarg == J_MOON) /* Mooon needs Earth */
|
||||
list[J_EARTH] = 2;
|
||||
if (ntarg == J_EARTH) /* Earth needs Moon */
|
||||
list[J_MOON] = 2;
|
||||
if (ntarg == J_EMB) /* EMB needs Earth */
|
||||
list[J_EARTH] = 2;
|
||||
if (ncent < J_SUN)
|
||||
list[ncent] = 2;
|
||||
if (ncent == J_MOON) /* Mooon needs Earth */
|
||||
list[J_EARTH] = 2;
|
||||
if (ncent == J_EARTH) /* Earth needs Moon */
|
||||
list[J_MOON] = 2;
|
||||
if (ncent == J_EMB) /* EMB needs Earth */
|
||||
list[J_EARTH] = 2;
|
||||
if ((retc = state(et, list, TRUE, pv, pvsun, rrd, serr)) != OK)
|
||||
return (retc);
|
||||
if (ntarg == J_SUN || ncent == J_SUN) {
|
||||
for (i = 0; i < 6; ++i)
|
||||
pv[i + 6*J_SUN] = pvsun[i];
|
||||
}
|
||||
if (ntarg == J_SBARY || ncent == J_SBARY) {
|
||||
for (i = 0; i < 6; ++i) {
|
||||
pv[i + 6*J_SBARY] = 0.;
|
||||
}
|
||||
}
|
||||
if (ntarg == J_EMB || ncent == J_EMB) {
|
||||
for (i = 0; i < 6; ++i)
|
||||
pv[i + 6*J_EMB] = pv[i + 6*J_EARTH];
|
||||
}
|
||||
if ((ntarg==J_EARTH && ncent==J_MOON) || (ntarg == J_MOON && ncent==J_EARTH)){
|
||||
for (i = 0; i < 6; ++i)
|
||||
pv[i + 6*J_EARTH] = 0.;
|
||||
|
||||
} else {
|
||||
if (list[J_EARTH] == 2) {
|
||||
for (i = 0; i < 6; ++i)
|
||||
pv[i + 6*J_EARTH] -= pv[i + 6*J_MOON] / (js->eh_emrat + 1.);
|
||||
}
|
||||
if (list[J_MOON] == 2) {
|
||||
for (i = 0; i < 6; ++i) {
|
||||
pv[i + 6*J_MOON] += pv[i + 6*J_EARTH];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 6; ++i)
|
||||
rrd[i] = pv[i + ntarg * 6] - pv[i + ncent * 6];
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This subroutine differentiates and interpolates a
|
||||
* set of chebyshev coefficients to give pos, vel, acc, and jerk
|
||||
* calling sequence parameters:
|
||||
* input:
|
||||
* buf 1st location of array of d.p. chebyshev coefficients of position
|
||||
* t is dp fractional time in interval covered by
|
||||
* coefficients at which interpolation is wanted, 0 <= t <= 1
|
||||
* intv is dp length of whole interval in input time units.
|
||||
* ncf number of coefficients per component
|
||||
* ncm number of components per set of coefficients
|
||||
* na number of sets of coefficients in full array
|
||||
* (i.e., number of sub-intervals in full interval)
|
||||
* ifl int flag: =1 for positions only
|
||||
* =2 for pos and vel
|
||||
* =3 for pos, vel, and acc
|
||||
* =4 for pos, vel, acc, and jerk
|
||||
* output:
|
||||
* pv d.p. interpolated quantities requested.
|
||||
* assumed dimension is pv(ncm,fl).
|
||||
*/
|
||||
static int interp(double *buf, double t, double intv, int32 ncfin,
|
||||
int32 ncmin, int32 nain, int32 ifl, double *pv)
|
||||
{
|
||||
/* Initialized data */
|
||||
static TLS int np, nv;
|
||||
static TLS int nac;
|
||||
static TLS int njk;
|
||||
static TLS double twot = 0.;
|
||||
double *pc = js->pc;
|
||||
double *vc = js->vc;
|
||||
double *ac = js->ac;
|
||||
double *jc = js->jc;
|
||||
int ncf = (int) ncfin;
|
||||
int ncm = (int) ncmin;
|
||||
int na = (int) nain;
|
||||
/* Local variables */
|
||||
double temp;
|
||||
int i, j, ni;
|
||||
double tc;
|
||||
double dt1, bma;
|
||||
double bma2, bma3;
|
||||
/*
|
||||
| get correct sub-interval number for this set of coefficients and then
|
||||
| get normalized chebyshev time within that subinterval.
|
||||
*/
|
||||
if (t >= 0)
|
||||
dt1 = floor(t);
|
||||
else
|
||||
dt1 = -floor(-t);
|
||||
temp = na * t;
|
||||
ni = (int) (temp - dt1);
|
||||
/* tc is the normalized chebyshev time (-1 <= tc <= 1) */
|
||||
tc = (fmod(temp, 1.0) + dt1) * 2. - 1.;
|
||||
/*
|
||||
* check to see whether chebyshev time has changed,
|
||||
* and compute new polynomial values if it has.
|
||||
* (the element pc(2) is the value of t1(tc) and hence
|
||||
* contains the value of tc on the previous call.)
|
||||
*/
|
||||
if (tc != pc[1]) {
|
||||
np = 2;
|
||||
nv = 3;
|
||||
nac = 4;
|
||||
njk = 5;
|
||||
pc[1] = tc;
|
||||
twot = tc + tc;
|
||||
}
|
||||
/*
|
||||
* be sure that at least 'ncf' polynomials have been evaluated
|
||||
* and are stored in the array 'pc'.
|
||||
*/
|
||||
if (np < ncf) {
|
||||
for (i = np; i < ncf; ++i)
|
||||
pc[i] = twot * pc[i - 1] - pc[i - 2];
|
||||
np = ncf;
|
||||
}
|
||||
/* interpolate to get position for each component */
|
||||
for (i = 0; i < ncm; ++i) {
|
||||
pv[i] = 0.;
|
||||
for (j = ncf-1; j >= 0; --j)
|
||||
pv[i] += pc[j] * buf[j + (i + ni * ncm) * ncf];
|
||||
}
|
||||
if (ifl <= 1)
|
||||
return 0;
|
||||
/*
|
||||
* if velocity interpolation is wanted, be sure enough
|
||||
* derivative polynomials have been generated and stored.
|
||||
*/
|
||||
bma = (na + na) / intv;
|
||||
vc[2] = twot + twot;
|
||||
if (nv < ncf) {
|
||||
for (i = nv; i < ncf; ++i)
|
||||
vc[i] = twot * vc[i - 1] + pc[i - 1] + pc[i - 1] - vc[i - 2];
|
||||
nv = ncf;
|
||||
}
|
||||
/* interpolate to get velocity for each component */
|
||||
for (i = 0; i < ncm; ++i) {
|
||||
pv[i + ncm] = 0.;
|
||||
for (j = ncf-1; j >= 1; --j)
|
||||
pv[i + ncm] += vc[j] * buf[j + (i + ni * ncm) * ncf];
|
||||
pv[i + ncm] *= bma;
|
||||
}
|
||||
if (ifl == 2)
|
||||
return 0;
|
||||
/* check acceleration polynomial values, and */
|
||||
/* re-do if necessary */
|
||||
bma2 = bma * bma;
|
||||
ac[3] = pc[1] * 24.;
|
||||
if (nac < ncf) {
|
||||
nac = ncf;
|
||||
for (i = nac; i < ncf; ++i)
|
||||
ac[i] = twot * ac[i - 1] + vc[i - 1] * 4. - ac[i - 2];
|
||||
}
|
||||
/* get acceleration for each component */
|
||||
for (i = 0; i < ncm; ++i) {
|
||||
pv[i + ncm * 2] = 0.;
|
||||
for (j = ncf-1; j >= 2; --j)
|
||||
pv[i + ncm * 2] += ac[j] * buf[j + (i + ni * ncm) * ncf];
|
||||
pv[i + ncm * 2] *= bma2;
|
||||
}
|
||||
if (ifl == 3)
|
||||
return 0;
|
||||
/* check jerk polynomial values, and */
|
||||
/* re-do if necessary */
|
||||
bma3 = bma * bma2;
|
||||
jc[4] = pc[1] * 192.;
|
||||
if (njk < ncf) {
|
||||
njk = ncf;
|
||||
for (i = njk; i < ncf; ++i)
|
||||
jc[i] = twot * jc[i - 1] + ac[i - 1] * 6. - jc[i - 2];
|
||||
}
|
||||
/* get jerk for each component */
|
||||
for (i = 0; i < ncm; ++i) {
|
||||
pv[i + ncm * 3] = 0.;
|
||||
for (j = ncf-1; j >= 3; --j)
|
||||
pv[i + ncm * 3] += jc[j] * buf[j + (i + ni * ncm) * ncf];
|
||||
pv[i + ncm * 3] *= bma3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
| ********** state ********************
|
||||
| this subroutine reads and interpolates the jpl planetary ephemeris file
|
||||
| calling sequence parameters:
|
||||
| input:
|
||||
| et dp julian ephemeris epoch at which interpolation is wanted.
|
||||
| list 12-word integer array specifying what interpolation
|
||||
| is wanted for each of the bodies on the file.
|
||||
| list(i)=0, no interpolation for body i
|
||||
| =1, position only
|
||||
| =2, position and velocity
|
||||
| the designation of the astronomical bodies by i is:
|
||||
| i = 0: mercury
|
||||
| = 1: venus
|
||||
| = 2: earth-moon barycenter, NOT earth!
|
||||
| = 3: mars
|
||||
| = 4: jupiter
|
||||
| = 5: saturn
|
||||
| = 6: uranus
|
||||
| = 7: neptune
|
||||
| = 8: pluto
|
||||
| = 9: geocentric moon
|
||||
| =10: nutations in longitude and obliquity
|
||||
| =11: lunar librations (if on file)
|
||||
| If called with list = NULL, only the header records are read and
|
||||
| stored in the global areas.
|
||||
| do_bary short, if true, barycentric, if false, heliocentric.
|
||||
| only the 9 planets 0..8 are affected by it.
|
||||
| output:
|
||||
| pv dp 6 x 11 array that will contain requested interpolated
|
||||
| quantities. the body specified by list(i) will have its
|
||||
| state in the array starting at pv(1,i). (on any given
|
||||
| call, only those words in 'pv' which are affected by the
|
||||
| first 10 'list' entries (and by list(11) if librations are
|
||||
| on the file) are set. the rest of the 'pv' array
|
||||
| is untouched.) the order of components starting in
|
||||
| pv is: x,y,z,dx,dy,dz.
|
||||
| all output vectors are referenced to the earth mean
|
||||
| equator and equinox of epoch. the moon state is always
|
||||
| geocentric; the other nine states are either heliocentric
|
||||
| or solar-system barycentric, depending on the setting of
|
||||
| common flags (see below).
|
||||
| lunar librations, if on file, are put into pv(k,10) if
|
||||
| list(11) is 1 or 2.
|
||||
| pvsun dp 6-word array containing the barycentric position and
|
||||
| velocity of the sun.
|
||||
| nut dp 4-word array that will contain nutations and rates,
|
||||
| depending on the setting of list(10). the order of
|
||||
| quantities in nut is:
|
||||
| d psi (nutation in longitude)
|
||||
| d epsilon (nutation in obliquity)
|
||||
| d psi dot
|
||||
| d epsilon dot
|
||||
| globals used:
|
||||
| do_km logical flag defining physical units of the output states.
|
||||
| TRUE = return km and km/sec, FALSE = return au and au/day
|
||||
| default value = FALSE (km determines time unit
|
||||
| for nutations and librations. angle unit is always radians.)
|
||||
*/
|
||||
static int state(double et, int32 *list, int do_bary,
|
||||
double *pv, double *pvsun, double *nut, char *serr)
|
||||
{
|
||||
int i, j, k;
|
||||
int32 nseg;
|
||||
off_t64 flen, nb;
|
||||
double *buf = js->buf;
|
||||
double aufac, s, t, intv, ts[4];
|
||||
int32 nrecl, ksize;
|
||||
int32 nr;
|
||||
double et_mn, et_fr;
|
||||
int32 *ipt = js->eh_ipt;
|
||||
char ch_ttl[252];
|
||||
static TLS int32 irecsz;
|
||||
static TLS int32 nrl, lpt[3], ncoeffs;
|
||||
if (js->jplfptr == NULL) {
|
||||
ksize = fsizer(serr); /* the number of single precision words in a record */
|
||||
nrecl = 4;
|
||||
if (ksize == NOT_AVAILABLE)
|
||||
return NOT_AVAILABLE;
|
||||
irecsz = nrecl * ksize; /* record size in bytes */
|
||||
ncoeffs = ksize / 2; /* # of coefficients, doubles */
|
||||
/* ttl = ephemeris title, e.g.
|
||||
* "JPL Planetary Ephemeris DE404/LE404
|
||||
* Start Epoch: JED= 625296.5-3001 DEC 21 00:00:00
|
||||
* Final Epoch: JED= 2817168.5 3001 JAN 17 00:00:00c */
|
||||
fread((void *) ch_ttl, 1, 252, js->jplfptr);
|
||||
/* cnam = names of constants */
|
||||
fread((void *) js->ch_cnam, 1, 2400, js->jplfptr);
|
||||
/* ss[0] = start epoch of ephemeris
|
||||
* ss[1] = end epoch
|
||||
* ss[2] = segment size in days */
|
||||
fread((void *) &js->eh_ss[0], sizeof(double), 3, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_ss[0], sizeof(double), 3);
|
||||
/* ncon = number of constants */
|
||||
fread((void *) &js->eh_ncon, sizeof(int32), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_ncon, sizeof(int32), 1);
|
||||
/* au = astronomical unit */
|
||||
fread((void *) &js->eh_au, sizeof(double), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_au, sizeof(double), 1);
|
||||
/* emrat = earth moon mass ratio */
|
||||
fread((void *) &js->eh_emrat, sizeof(double), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_emrat, sizeof(double), 1);
|
||||
/* ipt[i+0]: coefficients of planet i start at buf[ipt[i+0]-1]
|
||||
* ipt[i+1]: number of coefficients (interpolation order - 1)
|
||||
* ipt[i+2]: number of intervals in segment */
|
||||
fread((void *) &ipt[0], sizeof(int32), 36, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &ipt[0], sizeof(int32), 36);
|
||||
/* numde = number of jpl ephemeris "404" with de404 */
|
||||
fread((void *) &js->eh_denum, sizeof(int32), 1, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_denum, sizeof(int32), 1);
|
||||
fread((void *) &lpt[0], sizeof(int32), 3, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &lpt[0], sizeof(int32), 3);
|
||||
/* cval[]: other constants in next record */
|
||||
FSEEK(js->jplfptr, (off_t64) (1L * irecsz), 0);
|
||||
fread((void *) &js->eh_cval[0], sizeof(double), 400, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &js->eh_cval[0], sizeof(double), 400);
|
||||
/* new 26-aug-2008: verify correct block size */
|
||||
for (i = 0; i < 3; ++i)
|
||||
ipt[i + 36] = lpt[i];
|
||||
nrl = 0;
|
||||
/* is file length correct? */
|
||||
/* file length */
|
||||
FSEEK(js->jplfptr, (off_t64) 0L, SEEK_END);
|
||||
flen = FTELL(js->jplfptr);
|
||||
/* # of segments in file */
|
||||
nseg = (int32) ((js->eh_ss[1] - js->eh_ss[0]) / js->eh_ss[2]);
|
||||
/* sum of all cheby coeffs of all planets and segments */
|
||||
for(i = 0, nb = 0; i < 13; i++) {
|
||||
k = 3;
|
||||
if (i == 11)
|
||||
k = 2;
|
||||
nb += (ipt[i*3+1] * ipt[i*3+2]) * k * nseg;
|
||||
}
|
||||
/* add start and end epochs of segments */
|
||||
nb += 2 * nseg;
|
||||
/* doubles to bytes */
|
||||
nb *= 8;
|
||||
/* add size of header and constants section */
|
||||
nb += 2 * ksize * nrecl;
|
||||
if (flen != nb
|
||||
/* some of our files are one record too long */
|
||||
&& flen - nb != ksize * nrecl
|
||||
) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "JPL ephemeris file is mutilated; length = %d instead of %d.", (unsigned int) flen, (unsigned int) nb);
|
||||
if (strlen(serr) + strlen(js->jplfname) < AS_MAXCH - 1) {
|
||||
sprintf(serr, "JPL ephemeris file %s is mutilated; length = %d instead of %d.", js->jplfname, (unsigned int) flen, (unsigned int) nb);
|
||||
}
|
||||
}
|
||||
return(NOT_AVAILABLE);
|
||||
}
|
||||
/* check if start and end dates in segments are the same as in
|
||||
* file header */
|
||||
FSEEK(js->jplfptr, (off_t64) (2L * irecsz), 0);
|
||||
fread((void *) &ts[0], sizeof(double), 2, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &ts[0], sizeof(double), 2);
|
||||
FSEEK(js->jplfptr, (off_t64) ((nseg + 2 - 1) * ((off_t64) irecsz)), 0);
|
||||
fread((void *) &ts[2], sizeof(double), 2, js->jplfptr);
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &ts[2], sizeof(double), 2);
|
||||
if (ts[0] != js->eh_ss[0] || ts[3] != js->eh_ss[1]) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "JPL ephemeris file is corrupt; start/end date check failed. %.1f != %.1f || %.1f != %.1f", ts[0],js->eh_ss[0],ts[3],js->eh_ss[1]);
|
||||
return NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (list == NULL)
|
||||
return 0;
|
||||
s = et - .5;
|
||||
et_mn = floor(s);
|
||||
et_fr = s - et_mn; /* fraction of days since previous midnight */
|
||||
et_mn += .5; /* midnight before epoch */
|
||||
/* error return for epoch out of range */
|
||||
if (et < js->eh_ss[0] || et > js->eh_ss[1]) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr,"jd %f outside JPL eph. range %.2f .. %.2f;", et, js->eh_ss[0], js->eh_ss[1]);
|
||||
return BEYOND_EPH_LIMITS;
|
||||
}
|
||||
/* calculate record # and relative time in interval */
|
||||
nr = (int32) ((et_mn - js->eh_ss[0]) / js->eh_ss[2]) + 2;
|
||||
if (et_mn == js->eh_ss[1])
|
||||
--nr; /* end point of ephemeris, use last record */
|
||||
t = (et_mn - ((nr - 2) * js->eh_ss[2] + js->eh_ss[0]) + et_fr) / js->eh_ss[2];
|
||||
/* read correct record if not in core */
|
||||
if (nr != nrl) {
|
||||
nrl = nr;
|
||||
if (FSEEK(js->jplfptr, (off_t64) (nr * ((off_t64) irecsz)), 0) != 0) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "Read error in JPL eph. at %f\n", et);
|
||||
return NOT_AVAILABLE;
|
||||
}
|
||||
for (k = 1; k <= ncoeffs; ++k) {
|
||||
if ( fread((void *) &buf[k - 1], sizeof(double), 1, js->jplfptr) != 1) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "Read error in JPL eph. at %f\n", et);
|
||||
return NOT_AVAILABLE;
|
||||
}
|
||||
if (js->do_reorder)
|
||||
reorder((char *) &buf[k-1], sizeof(double), 1);
|
||||
}
|
||||
}
|
||||
if (js->do_km) {
|
||||
intv = js->eh_ss[2] * 86400.;
|
||||
aufac = 1.;
|
||||
} else {
|
||||
intv = js->eh_ss[2];
|
||||
aufac = 1. / js->eh_au;
|
||||
}
|
||||
/* interpolate ssbary sun */
|
||||
interp(&buf[(int) ipt[30] - 1], t, intv, ipt[31], 3L, ipt[32], 2L, pvsun);
|
||||
for (i = 0; i < 6; ++i) {
|
||||
pvsun[i] *= aufac;
|
||||
}
|
||||
/* check and interpolate whichever bodies are requested */
|
||||
for (i = 0; i < 10; ++i) {
|
||||
if (list[i] > 0) {
|
||||
interp(&buf[(int) ipt[i * 3] - 1], t, intv, ipt[i * 3 + 1], 3L,
|
||||
ipt[i * 3 + 2], list[i], &pv[i * 6]);
|
||||
for (j = 0; j < 6; ++j) {
|
||||
if (i < 9 && ! do_bary) {
|
||||
pv[j + i * 6] = pv[j + i * 6] * aufac - pvsun[j];
|
||||
} else {
|
||||
pv[j + i * 6] *= aufac;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* do nutations if requested (and if on file) */
|
||||
if (list[10] > 0 && ipt[34] > 0) {
|
||||
interp(&buf[(int) ipt[33] - 1], t, intv, ipt[34], 2L, ipt[35],
|
||||
list[10], nut);
|
||||
}
|
||||
/* get librations if requested (and if on file) */
|
||||
if (list[11] > 0 && ipt[37] > 0) {
|
||||
interp(&buf[(int) ipt[36] - 1], t, intv, ipt[37], 3L, ipt[38], list[1],
|
||||
&pv[60]);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* this entry obtains the constants from the ephemeris file
|
||||
* call state to initialize the ephemeris and read in the constants
|
||||
*/
|
||||
static int read_const_jpl(double *ss, char *serr)
|
||||
{
|
||||
int i, retc;
|
||||
retc = state(0.0, NULL, FALSE, NULL, NULL, NULL, serr);
|
||||
if (retc != OK)
|
||||
return (retc);
|
||||
for (i = 0; i < 3; i++)
|
||||
ss[i] = js->eh_ss[i];
|
||||
#if DEBUG_DO_SHOW
|
||||
{
|
||||
static const char *bname[] = {
|
||||
"Mercury", "Venus", "EMB", "Mars", "Jupiter", "Saturn",
|
||||
"Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr"};
|
||||
int j, k;
|
||||
int32 nb, nc;
|
||||
printf(" JPL TEST-EPHEMERIS program. Version October 1995.\n");
|
||||
for (i = 0; i < 13; i++) {
|
||||
j = i * 3;
|
||||
k = 3;
|
||||
if (i == 11) k = 2;
|
||||
nb = js->eh_ipt[j+1] * js->eh_ipt[j+2] * k;
|
||||
nc = (int32) (nb * 36525L / js->eh_ss[2] * 8L);
|
||||
printf("%s\t%d\tipt[%d]\t%3ld %2ld %2ld,\t",
|
||||
bname[i], i, j, js->eh_ipt[j], js->eh_ipt[j+1], js->eh_ipt[j+2]);
|
||||
printf("%3ld double, bytes per century = %6ld\n", nb, nc);
|
||||
fflush(stdout);
|
||||
}
|
||||
printf("%16.2f %16.2f %16.2f\n", js->eh_ss[0], js->eh_ss[1], js->eh_ss[2]);
|
||||
for (i = 0; i < js->eh_ncon; ++i)
|
||||
printf("%.6s\t%24.16f\n", js->ch_cnam + i * 6, js->eh_cval[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void reorder(char *x, int size, int number)
|
||||
{
|
||||
int i, j;
|
||||
char s[8];
|
||||
char *sp1 = x;
|
||||
char *sp2 = &s[0];
|
||||
for (i = 0; i < number; i++) {
|
||||
for (j = 0; j < size; j++)
|
||||
*(sp2 + j) = *(sp1 + size - j - 1);
|
||||
for (j = 0; j < size; j++)
|
||||
*(sp1 + j) = *(sp2 + j);
|
||||
sp1 += size;
|
||||
}
|
||||
}
|
||||
|
||||
void swi_close_jpl_file(void)
|
||||
{
|
||||
if (js != NULL) {
|
||||
if (js->jplfptr != NULL)
|
||||
fclose(js->jplfptr);
|
||||
if (js->jplfname != NULL)
|
||||
FREE((void *) js->jplfname);
|
||||
if (js->jplfpath != NULL)
|
||||
FREE((void *) js->jplfpath);
|
||||
FREE((void *) js);
|
||||
js = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
|
||||
{
|
||||
int retc = OK;
|
||||
/* if open, return */
|
||||
if (js != NULL && js->jplfptr != NULL)
|
||||
return OK;
|
||||
if ((js = (struct jpl_save *) CALLOC(1, sizeof(struct jpl_save))) == NULL
|
||||
|| (js->jplfname = MALLOC(strlen(fname)+1)) == NULL
|
||||
|| (js->jplfpath = MALLOC(strlen(fpath)+1)) == NULL
|
||||
) {
|
||||
if (serr != NULL)
|
||||
strcpy(serr, "error in malloc() with JPL ephemeris.");
|
||||
return ERR;
|
||||
}
|
||||
strcpy(js->jplfname, fname);
|
||||
strcpy(js->jplfpath, fpath);
|
||||
retc = read_const_jpl(ss, serr);
|
||||
if (retc != OK)
|
||||
swi_close_jpl_file();
|
||||
else {
|
||||
/* intializations for function interpol() */
|
||||
js->pc[0] = 1;
|
||||
js->pc[1] = 2;
|
||||
js->vc[1] = 1;
|
||||
js->ac[2] = 4;
|
||||
js->jc[3] = 24;
|
||||
}
|
||||
return retc;
|
||||
}
|
||||
|
||||
int32 swi_get_jpl_denum()
|
||||
{
|
||||
return js->eh_denum;
|
||||
}
|
||||
|
||||
104
lib/sweph/swejpl.h
Normal file
104
lib/sweph/swejpl.h
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
| $Header: /home/dieter/sweph/RCS/swejpl.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
|
|
||||
| Subroutines for reading JPL ephemerides.
|
||||
| derived from testeph.f as contained in DE403 distribution July 1995.
|
||||
| works with DE200, DE102, DE403, DE404, DE405, DE406, DE431
|
||||
| (attention, these ephemerides do not have exactly the same reference frame)
|
||||
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
**************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
|
||||
#include "sweodef.h"
|
||||
|
||||
#define J_MERCURY 0 /* jpl body indices, modified by Alois */
|
||||
#define J_VENUS 1 /* now they start at 0 and not at 1 */
|
||||
#define J_EARTH 2
|
||||
#define J_MARS 3
|
||||
#define J_JUPITER 4
|
||||
#define J_SATURN 5
|
||||
#define J_URANUS 6
|
||||
#define J_NEPTUNE 7
|
||||
#define J_PLUTO 8
|
||||
#define J_MOON 9
|
||||
#define J_SUN 10
|
||||
#define J_SBARY 11
|
||||
#define J_EMB 12
|
||||
#define J_NUT 13
|
||||
#define J_LIB 14
|
||||
|
||||
/*
|
||||
* compute position and speed at time et, for body ntarg with center
|
||||
* ncent. rrd must be double[6] to contain the return vectors.
|
||||
* ntarg can be all of the above, ncent all except J_NUT and J_LIB.
|
||||
* Librations and Nutations are not affected by ncent.
|
||||
*/
|
||||
extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr);
|
||||
|
||||
/*
|
||||
* read the ephemeris constants. ss[0..2] returns start, end and granule size.
|
||||
* If do_show is TRUE, a list of constants is printed to stdout.
|
||||
*/
|
||||
extern void swi_close_jpl_file(void);
|
||||
|
||||
extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr);
|
||||
|
||||
extern int32 swi_get_jpl_denum(void);
|
||||
|
||||
extern void swi_IERS_FK5(double *xin, double *xout, int dir);
|
||||
|
||||
132
lib/sweph/swemini.c
Normal file
132
lib/sweph/swemini.c
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
|
||||
/*
|
||||
$Header: /home/dieter/sweph/RCS/swemini.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
|
||||
swemini.c A minimal program to test the Swiss Ephemeris.
|
||||
|
||||
Input: a date (in gregorian calendar, sequence day.month.year)
|
||||
Output: Planet positions at midnight Universal time, ecliptic coordinates,
|
||||
geocentric apparent positions relative to true equinox of date, as
|
||||
usual in western astrology.
|
||||
|
||||
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
**************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
|
||||
#include "swephexp.h" /* this includes "sweodef.h" */
|
||||
|
||||
int main()
|
||||
{
|
||||
char sdate[AS_MAXCH], snam[40], serr[AS_MAXCH];
|
||||
int jday = 1, jmon = 1, jyear = 2000;
|
||||
double jut = 0.0;
|
||||
double tjd, te, x2[6];
|
||||
int32 iflag, iflgret;
|
||||
int p;
|
||||
swe_set_ephe_path(NULL);
|
||||
iflag = SEFLG_SPEED;
|
||||
while (TRUE) {
|
||||
printf("\nDate (d.m.y) ?");
|
||||
/*gets(sdate);*/
|
||||
if( !fgets(sdate, sizeof(sdate)-1, stdin) ) return OK;
|
||||
/*
|
||||
* stop if a period . is entered
|
||||
*/
|
||||
if (*sdate == '.')
|
||||
return OK;
|
||||
if (sscanf (sdate, "%d%*c%d%*c%d", &jday,&jmon,&jyear) < 1) exit(1);
|
||||
/*
|
||||
* we have day, month and year and convert to Julian day number
|
||||
*/
|
||||
tjd = swe_julday(jyear,jmon,jday,jut,SE_GREG_CAL);
|
||||
/*
|
||||
* compute Ephemeris time from Universal time by adding delta_t
|
||||
*/
|
||||
te = tjd + swe_deltat(tjd);
|
||||
printf("date: %02d.%02d.%d at 0:00 Universal time\n", jday, jmon, jyear);
|
||||
printf("planet \tlongitude\tlatitude\tdistance\tspeed long.\n");
|
||||
/*
|
||||
* a loop over all planets
|
||||
*/
|
||||
for (p = SE_SUN; p <= SE_CHIRON; p++) {
|
||||
if (p == SE_EARTH) continue;
|
||||
/*
|
||||
* do the coordinate calculation for this planet p
|
||||
*/
|
||||
iflgret = swe_calc(te, p, iflag, x2, serr);
|
||||
/*
|
||||
* if there is a problem, a negative value is returned and an
|
||||
* errpr message is in serr.
|
||||
*/
|
||||
if (iflgret < 0)
|
||||
printf("error: %s\n", serr);
|
||||
else if (iflgret != iflag)
|
||||
printf("warning: iflgret != iflag. %s\n", serr);
|
||||
/*
|
||||
* get the name of the planet p
|
||||
*/
|
||||
swe_get_planet_name(p, snam);
|
||||
/*
|
||||
* print the coordinates
|
||||
*/
|
||||
printf("%10s\t%11.7f\t%10.7f\t%10.7f\t%10.7f\n",
|
||||
snam, x2[0], x2[1], x2[2], x2[3]);
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
1931
lib/sweph/swemmoon.c
Normal file
1931
lib/sweph/swemmoon.c
Normal file
File diff suppressed because it is too large
Load diff
968
lib/sweph/swemplan.c
Normal file
968
lib/sweph/swemplan.c
Normal file
|
|
@ -0,0 +1,968 @@
|
|||
/* SWISSEPH
|
||||
$Header: /home/dieter/sweph/RCS/swemplan.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
Moshier planet routines
|
||||
|
||||
modified for SWISSEPH by Dieter Koch
|
||||
|
||||
**************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "swephexp.h"
|
||||
#include "sweph.h"
|
||||
#include "swephlib.h"
|
||||
#include "swemptab.h"
|
||||
|
||||
#define TIMESCALE 3652500.0
|
||||
|
||||
#define mods3600(x) ((x) - 1.296e6 * floor ((x)/1.296e6))
|
||||
|
||||
#define FICT_GEO 1
|
||||
#define KGAUSS_GEO 0.0000298122353216 /* Earth only */
|
||||
/* #define KGAUSS_GEO 0.00002999502129737 Earth + Moon */
|
||||
|
||||
static void embofs_mosh(double J, double *xemb);
|
||||
static int check_t_terms(double t, char *sinp, double *doutp);
|
||||
|
||||
static int read_elements_file(int32 ipl, double tjd,
|
||||
double *tjd0, double *tequ,
|
||||
double *mano, double *sema, double *ecce,
|
||||
double *parg, double *node, double *incl,
|
||||
char *pname, int32 *fict_ifl, char *serr);
|
||||
|
||||
static const int pnoint2msh[] = {2, 2, 0, 1, 3, 4, 5, 6, 7, 8, };
|
||||
|
||||
|
||||
/* From Simon et al (1994) */
|
||||
static const double freqs[] =
|
||||
{
|
||||
/* Arc sec per 10000 Julian years. */
|
||||
53810162868.8982,
|
||||
21066413643.3548,
|
||||
12959774228.3429,
|
||||
6890507749.3988,
|
||||
1092566037.7991,
|
||||
439960985.5372,
|
||||
154248119.3933,
|
||||
78655032.0744,
|
||||
52272245.1795
|
||||
};
|
||||
|
||||
static const double phases[] =
|
||||
{
|
||||
/* Arc sec. */
|
||||
252.25090552 * 3600.,
|
||||
181.97980085 * 3600.,
|
||||
100.46645683 * 3600.,
|
||||
355.43299958 * 3600.,
|
||||
34.35151874 * 3600.,
|
||||
50.07744430 * 3600.,
|
||||
314.05500511 * 3600.,
|
||||
304.34866548 * 3600.,
|
||||
860492.1546,
|
||||
};
|
||||
|
||||
static const struct plantbl *planets[] =
|
||||
{
|
||||
&mer404,
|
||||
&ven404,
|
||||
&ear404,
|
||||
&mar404,
|
||||
&jup404,
|
||||
&sat404,
|
||||
&ura404,
|
||||
&nep404,
|
||||
&plu404
|
||||
};
|
||||
|
||||
static TLS double ss[9][24];
|
||||
static TLS double cc[9][24];
|
||||
|
||||
static void sscc (int k, double arg, int n);
|
||||
|
||||
int swi_moshplan2 (double J, int iplm, double *pobj)
|
||||
{
|
||||
int i, j, k, m, k1, ip, np, nt;
|
||||
signed char *p;
|
||||
double *pl, *pb, *pr;
|
||||
double su, cu, sv, cv, T;
|
||||
double t, sl, sb, sr;
|
||||
const struct plantbl *plan = planets[iplm];
|
||||
|
||||
T = (J - J2000) / TIMESCALE;
|
||||
/* Calculate sin( i*MM ), etc. for needed multiple angles. */
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
if ((j = plan->max_harmonic[i]) > 0)
|
||||
{
|
||||
sr = (mods3600 (freqs[i] * T) + phases[i]) * STR;
|
||||
sscc (i, sr, j);
|
||||
}
|
||||
}
|
||||
|
||||
/* Point to start of table of arguments. */
|
||||
p = plan->arg_tbl;
|
||||
/* Point to tabulated cosine and sine amplitudes. */
|
||||
pl = plan->lon_tbl;
|
||||
pb = plan->lat_tbl;
|
||||
pr = plan->rad_tbl;
|
||||
sl = 0.0;
|
||||
sb = 0.0;
|
||||
sr = 0.0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* argument of sine and cosine */
|
||||
/* Number of periodic arguments. */
|
||||
np = *p++;
|
||||
if (np < 0)
|
||||
break;
|
||||
if (np == 0)
|
||||
{ /* It is a polynomial term. */
|
||||
nt = *p++;
|
||||
/* Longitude polynomial. */
|
||||
cu = *pl++;
|
||||
for (ip = 0; ip < nt; ip++)
|
||||
{
|
||||
cu = cu * T + *pl++;
|
||||
}
|
||||
sl += mods3600 (cu);
|
||||
/* Latitude polynomial. */
|
||||
cu = *pb++;
|
||||
for (ip = 0; ip < nt; ip++)
|
||||
{
|
||||
cu = cu * T + *pb++;
|
||||
}
|
||||
sb += cu;
|
||||
/* Radius polynomial. */
|
||||
cu = *pr++;
|
||||
for (ip = 0; ip < nt; ip++)
|
||||
{
|
||||
cu = cu * T + *pr++;
|
||||
}
|
||||
sr += cu;
|
||||
continue;
|
||||
}
|
||||
k1 = 0;
|
||||
cv = 0.0;
|
||||
sv = 0.0;
|
||||
for (ip = 0; ip < np; ip++)
|
||||
{
|
||||
/* What harmonic. */
|
||||
j = *p++;
|
||||
/* Which planet. */
|
||||
m = *p++ - 1;
|
||||
if (j)
|
||||
{
|
||||
k = j;
|
||||
if (j < 0)
|
||||
k = -k;
|
||||
k -= 1;
|
||||
su = ss[m][k]; /* sin(k*angle) */
|
||||
if (j < 0)
|
||||
su = -su;
|
||||
cu = cc[m][k];
|
||||
if (k1 == 0)
|
||||
{ /* set first angle */
|
||||
sv = su;
|
||||
cv = cu;
|
||||
k1 = 1;
|
||||
}
|
||||
else
|
||||
{ /* combine angles */
|
||||
t = su * cv + cu * sv;
|
||||
cv = cu * cv - su * sv;
|
||||
sv = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Highest power of T. */
|
||||
nt = *p++;
|
||||
/* Longitude. */
|
||||
cu = *pl++;
|
||||
su = *pl++;
|
||||
for (ip = 0; ip < nt; ip++)
|
||||
{
|
||||
cu = cu * T + *pl++;
|
||||
su = su * T + *pl++;
|
||||
}
|
||||
sl += cu * cv + su * sv;
|
||||
/* Latitiude. */
|
||||
cu = *pb++;
|
||||
su = *pb++;
|
||||
for (ip = 0; ip < nt; ip++)
|
||||
{
|
||||
cu = cu * T + *pb++;
|
||||
su = su * T + *pb++;
|
||||
}
|
||||
sb += cu * cv + su * sv;
|
||||
/* Radius. */
|
||||
cu = *pr++;
|
||||
su = *pr++;
|
||||
for (ip = 0; ip < nt; ip++)
|
||||
{
|
||||
cu = cu * T + *pr++;
|
||||
su = su * T + *pr++;
|
||||
}
|
||||
sr += cu * cv + su * sv;
|
||||
}
|
||||
pobj[0] = STR * sl;
|
||||
pobj[1] = STR * sb;
|
||||
pobj[2] = STR * plan->distance * sr + plan->distance;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Moshier ephemeris.
|
||||
* computes heliocentric cartesian equatorial coordinates of
|
||||
* equinox 2000
|
||||
* for earth and a planet
|
||||
* tjd julian day
|
||||
* ipli internal SWEPH planet number
|
||||
* xp array of 6 doubles for planet's position and speed
|
||||
* xe earth's
|
||||
* serr error string
|
||||
*/
|
||||
int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr)
|
||||
{
|
||||
int i;
|
||||
int do_earth = FALSE;
|
||||
double dx[3], x2[3], xxe[6], xxp[6];
|
||||
double *xp, *xe;
|
||||
double dt;
|
||||
char s[AS_MAXCH];
|
||||
int iplm = pnoint2msh[ipli];
|
||||
struct plan_data *pdp = &swed.pldat[ipli];
|
||||
struct plan_data *pedp = &swed.pldat[SEI_EARTH];
|
||||
double seps2000 = swed.oec2000.seps;
|
||||
double ceps2000 = swed.oec2000.ceps;
|
||||
if (do_save) {
|
||||
xp = pdp->x;
|
||||
xe = pedp->x;
|
||||
} else {
|
||||
xp = xxp;
|
||||
xe = xxe;
|
||||
}
|
||||
if (do_save || ipli == SEI_EARTH || xeret != NULL)
|
||||
do_earth = TRUE;
|
||||
/* tjd beyond ephemeris limits, give some margin for spped at edge */
|
||||
if (tjd < MOSHPLEPH_START - 0.3 || tjd > MOSHPLEPH_END + 0.3) {
|
||||
if (serr != NULL) {
|
||||
sprintf(s, "jd %f outside Moshier planet range %.2f .. %.2f ",
|
||||
tjd, MOSHPLEPH_START, MOSHPLEPH_END);
|
||||
if (strlen(serr) + strlen(s) < AS_MAXCH)
|
||||
strcat(serr, s);
|
||||
}
|
||||
return(ERR);
|
||||
}
|
||||
/* earth, for geocentric position */
|
||||
if (do_earth) {
|
||||
if (tjd == pedp->teval
|
||||
&& pedp->iephe == SEFLG_MOSEPH) {
|
||||
xe = pedp->x;
|
||||
} else {
|
||||
/* emb */
|
||||
swi_moshplan2(tjd, pnoint2msh[SEI_EMB], xe); /* emb hel. ecl. 2000 polar */
|
||||
swi_polcart(xe, xe); /* to cartesian */
|
||||
swi_coortrf2(xe, xe, -seps2000, ceps2000);/* and equator 2000 */
|
||||
embofs_mosh(tjd, xe); /* emb -> earth */
|
||||
if (do_save) {
|
||||
pedp->teval = tjd;
|
||||
pedp->xflgs = -1;
|
||||
pedp->iephe = SEFLG_MOSEPH;
|
||||
}
|
||||
/* one more position for speed. */
|
||||
swi_moshplan2(tjd - PLAN_SPEED_INTV, pnoint2msh[SEI_EMB], x2);
|
||||
swi_polcart(x2, x2);
|
||||
swi_coortrf2(x2, x2, -seps2000, ceps2000);
|
||||
embofs_mosh(tjd - PLAN_SPEED_INTV, x2);/**/
|
||||
for (i = 0; i <= 2; i++)
|
||||
dx[i] = (xe[i] - x2[i]) / PLAN_SPEED_INTV;
|
||||
/* store speed */
|
||||
for (i = 0; i <= 2; i++) {
|
||||
xe[i+3] = dx[i];
|
||||
}
|
||||
}
|
||||
if (xeret != NULL)
|
||||
for (i = 0; i <= 5; i++)
|
||||
xeret[i] = xe[i];
|
||||
}
|
||||
/* earth is the planet wanted */
|
||||
if (ipli == SEI_EARTH) {
|
||||
xp = xe;
|
||||
} else {
|
||||
/* other planet */
|
||||
/* if planet has already been computed, return */
|
||||
if (tjd == pdp->teval && pdp->iephe == SEFLG_MOSEPH) {
|
||||
xp = pdp->x;
|
||||
} else {
|
||||
swi_moshplan2(tjd, iplm, xp);
|
||||
swi_polcart(xp, xp);
|
||||
swi_coortrf2(xp, xp, -seps2000, ceps2000);
|
||||
if (do_save) {
|
||||
pdp->teval = tjd;/**/
|
||||
pdp->xflgs = -1;
|
||||
pdp->iephe = SEFLG_MOSEPH;
|
||||
}
|
||||
/* one more position for speed.
|
||||
* the following dt gives good speed for light-time correction
|
||||
*/
|
||||
#if 0
|
||||
for (i = 0; i <= 2; i++)
|
||||
dx[i] = xp[i] - pedp->x[i];
|
||||
dt = LIGHTTIME_AUNIT * sqrt(square_sum(dx));
|
||||
#endif
|
||||
dt = PLAN_SPEED_INTV;
|
||||
swi_moshplan2(tjd - dt, iplm, x2);
|
||||
swi_polcart(x2, x2);
|
||||
swi_coortrf2(x2, x2, -seps2000, ceps2000);
|
||||
for (i = 0; i <= 2; i++)
|
||||
dx[i] = (xp[i] - x2[i]) / dt;
|
||||
/* store speed */
|
||||
for (i = 0; i <= 2; i++) {
|
||||
xp[i+3] = dx[i];
|
||||
}
|
||||
}
|
||||
if (xpret != NULL)
|
||||
for (i = 0; i <= 5; i++)
|
||||
xpret[i] = xp[i];
|
||||
}
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
||||
/* Prepare lookup table of sin and cos ( i*Lj )
|
||||
* for required multiple angles
|
||||
*/
|
||||
static void sscc (int k, double arg, int n)
|
||||
{
|
||||
double cu, su, cv, sv, s;
|
||||
int i;
|
||||
|
||||
su = sin (arg);
|
||||
cu = cos (arg);
|
||||
ss[k][0] = su; /* sin(L) */
|
||||
cc[k][0] = cu; /* cos(L) */
|
||||
sv = 2.0 * su * cu;
|
||||
cv = cu * cu - su * su;
|
||||
ss[k][1] = sv; /* sin(2L) */
|
||||
cc[k][1] = cv;
|
||||
for (i = 2; i < n; i++)
|
||||
{
|
||||
s = su * cv + cu * sv;
|
||||
cv = cu * cv - su * sv;
|
||||
sv = s;
|
||||
ss[k][i] = sv; /* sin( i+1 L ) */
|
||||
cc[k][i] = cv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Adjust position from Earth-Moon barycenter to Earth
|
||||
*
|
||||
* J = Julian day number
|
||||
* xemb = rectangular equatorial coordinates of Earth
|
||||
*/
|
||||
static void embofs_mosh(double tjd, double *xemb)
|
||||
{
|
||||
double T, M, a, L, B, p;
|
||||
double smp, cmp, s2mp, c2mp, s2d, c2d, sf, cf;
|
||||
double s2f, sx, cx, xyz[6];
|
||||
double seps = swed.oec.seps;
|
||||
double ceps = swed.oec.ceps;
|
||||
int i;
|
||||
/* Short series for position of the Moon
|
||||
*/
|
||||
T = (tjd-J1900)/36525.0;
|
||||
/* Mean anomaly of moon (MP) */
|
||||
a = swe_degnorm(((1.44e-5*T + 0.009192)*T + 477198.8491)*T + 296.104608);
|
||||
a *= DEGTORAD;
|
||||
smp = sin(a);
|
||||
cmp = cos(a);
|
||||
s2mp = 2.0*smp*cmp; /* sin(2MP) */
|
||||
c2mp = cmp*cmp - smp*smp; /* cos(2MP) */
|
||||
/* Mean elongation of moon (D) */
|
||||
a = swe_degnorm(((1.9e-6*T - 0.001436)*T + 445267.1142)*T + 350.737486);
|
||||
a = 2.0 * DEGTORAD * a;
|
||||
s2d = sin(a);
|
||||
c2d = cos(a);
|
||||
/* Mean distance of moon from its ascending node (F) */
|
||||
a = swe_degnorm((( -3.e-7*T - 0.003211)*T + 483202.0251)*T + 11.250889);
|
||||
a *= DEGTORAD;
|
||||
sf = sin(a);
|
||||
cf = cos(a);
|
||||
s2f = 2.0*sf*cf; /* sin(2F) */
|
||||
sx = s2d*cmp - c2d*smp; /* sin(2D - MP) */
|
||||
cx = c2d*cmp + s2d*smp; /* cos(2D - MP) */
|
||||
/* Mean longitude of moon (LP) */
|
||||
L = ((1.9e-6*T - 0.001133)*T + 481267.8831)*T + 270.434164;
|
||||
/* Mean anomaly of sun (M) */
|
||||
M = swe_degnorm((( -3.3e-6*T - 1.50e-4)*T + 35999.0498)*T + 358.475833);
|
||||
/* Ecliptic longitude of the moon */
|
||||
L = L
|
||||
+ 6.288750*smp
|
||||
+ 1.274018*sx
|
||||
+ 0.658309*s2d
|
||||
+ 0.213616*s2mp
|
||||
- 0.185596*sin( DEGTORAD * M )
|
||||
- 0.114336*s2f;
|
||||
/* Ecliptic latitude of the moon */
|
||||
a = smp*cf;
|
||||
sx = cmp*sf;
|
||||
B = 5.128189*sf
|
||||
+ 0.280606*(a+sx) /* sin(MP+F) */
|
||||
+ 0.277693*(a-sx) /* sin(MP-F) */
|
||||
+ 0.173238*(s2d*cf - c2d*sf); /* sin(2D-F) */
|
||||
B *= DEGTORAD;
|
||||
/* Parallax of the moon */
|
||||
p = 0.950724
|
||||
+0.051818*cmp
|
||||
+0.009531*cx
|
||||
+0.007843*c2d
|
||||
+0.002824*c2mp;
|
||||
p *= DEGTORAD;
|
||||
/* Elongation of Moon from Sun
|
||||
*/
|
||||
L = swe_degnorm(L);
|
||||
L *= DEGTORAD;
|
||||
/* Distance in au */
|
||||
a = 4.263523e-5/sin(p);
|
||||
/* Convert to rectangular ecliptic coordinates */
|
||||
xyz[0] = L;
|
||||
xyz[1] = B;
|
||||
xyz[2] = a;
|
||||
swi_polcart(xyz, xyz);
|
||||
/* Convert to equatorial */
|
||||
swi_coortrf2(xyz, xyz, -seps, ceps);
|
||||
/* Precess to equinox of J2000.0 */
|
||||
swi_precess(xyz, tjd, 0, J_TO_J2000);/**/
|
||||
/* now emb -> earth */
|
||||
for (i = 0; i <= 2; i++)
|
||||
xemb[i] -= xyz[i] / (EARTH_MOON_MRAT + 1.0);
|
||||
}
|
||||
|
||||
/* orbital elements of planets that are computed from osculating elements
|
||||
* epoch
|
||||
* equinox
|
||||
* mean anomaly,
|
||||
* semi axis,
|
||||
* eccentricity,
|
||||
* argument of perihelion,
|
||||
* ascending node
|
||||
* inclination
|
||||
*/
|
||||
#define SE_NEELY /* use James Neely's revised elements
|
||||
* of Uranian planets*/
|
||||
static const char *plan_fict_nam[SE_NFICT_ELEM] =
|
||||
{"Cupido", "Hades", "Zeus", "Kronos",
|
||||
"Apollon", "Admetos", "Vulkanus", "Poseidon",
|
||||
"Isis-Transpluto", "Nibiru", "Harrington",
|
||||
"Leverrier", "Adams",
|
||||
"Lowell", "Pickering",};
|
||||
|
||||
char *swi_get_fict_name(int32 ipl, char *snam)
|
||||
{
|
||||
if (read_elements_file(ipl, 0, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
snam, NULL, NULL) == ERR)
|
||||
strcpy(snam, "name not found");
|
||||
return snam;
|
||||
}
|
||||
|
||||
static const double plan_oscu_elem[SE_NFICT_ELEM][8] = {
|
||||
#ifdef SE_NEELY
|
||||
{J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833},/* Cupido Neely */
|
||||
{J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500},/* Hades Neely */
|
||||
{J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000},/* Zeus Neely */
|
||||
{J1900, J1900, 169.0193, 64.81960, 0.00305, 208.8801, 0.0000, 0.0000},/* Kronos Neely */
|
||||
{J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000},/* Apollon Neely */
|
||||
{J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000},/* Admetos Neely */
|
||||
{J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000},/* Vulcanus Neely */
|
||||
{J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000},/* Poseidon Neely */
|
||||
#else
|
||||
{J1900, J1900, 104.5959, 40.99837, 0, 0, 0, 0}, /* Cupido */
|
||||
{J1900, J1900, 337.4517, 50.667443, 0, 0, 0, 0}, /* Hades */
|
||||
{J1900, J1900, 104.0904, 59.214362, 0, 0, 0, 0}, /* Zeus */
|
||||
{J1900, J1900, 17.7346, 64.816896, 0, 0, 0, 0}, /* Kronos */
|
||||
{J1900, J1900, 138.0354, 70.361652, 0, 0, 0, 0}, /* Apollon */
|
||||
{J1900, J1900, -8.678, 73.736476, 0, 0, 0, 0}, /* Admetos */
|
||||
{J1900, J1900, 55.9826, 77.445895, 0, 0, 0, 0}, /* Vulkanus */
|
||||
{J1900, J1900, 165.3595, 83.493733, 0, 0, 0, 0}, /* Poseidon */
|
||||
#endif
|
||||
/* Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
|
||||
* Strubell does not give an equinox. 1945 is taken to best reproduce
|
||||
* ASTRON ephemeris. (This is a strange choice, though.)
|
||||
* The epoch is 1772.76. The year is understood to have 366 days.
|
||||
* The fraction is counted from 1 Jan. 1772 */
|
||||
{2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0},
|
||||
/* Nibiru, elements from Christian Woeltge, Hannover */
|
||||
{1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708},
|
||||
/* Harrington, elements from Astronomical Journal 96(4), Oct. 1988 */
|
||||
{2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4},
|
||||
/* Leverrier's Neptune,
|
||||
according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63 */
|
||||
{2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0},
|
||||
/* Adam's Neptune */
|
||||
{2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0},
|
||||
/* Lowell's Pluto */
|
||||
{2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0},
|
||||
/* Pickering's Pluto */
|
||||
{2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15}, /**/
|
||||
#if 0 /* Ceres JPL 1600, without perturbations from other minor planets,
|
||||
* from following initial elements:
|
||||
* 2450600.5 2000 0 1 164.7073602 73.0340746 80.5995101
|
||||
* 10.5840296 0.07652422 0.0 2.770176095 */
|
||||
{2305447.5, J2000, 0.5874558977449977e+02, 0.2766536058742327e+01,
|
||||
0.7870946565779195e-01, 0.5809199028919189e+02,
|
||||
0.8650119410725021e+02, 0.1066835622280712e+02},
|
||||
/* Chiron, Bowell database 18-mar-1997 */
|
||||
{2450500.5, J2000, 7.258191, 13.67387471, 0.38174778, 339.558345, 209.379239, 6.933360}, /**/
|
||||
#endif
|
||||
};
|
||||
|
||||
/* computes a planet from osculating elements *
|
||||
* tjd julian day
|
||||
* ipl body number
|
||||
* ipli body number in planetary data structure
|
||||
* iflag flags
|
||||
*/
|
||||
int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr)
|
||||
{
|
||||
double pqr[9], x[6];
|
||||
double eps, K, fac, rho, cose, sine;
|
||||
double alpha, beta, zeta, sigma, M2, Msgn, M_180_or_0;
|
||||
double tjd0, tequ, mano, sema, ecce, parg, node, incl, dmot;
|
||||
double cosnode, sinnode, cosincl, sinincl, cosparg, sinparg;
|
||||
double M, E;
|
||||
struct plan_data *pedp = &swed.pldat[SEI_EARTH];
|
||||
struct plan_data *pdp = &swed.pldat[ipli];
|
||||
int32 fict_ifl = 0;
|
||||
int i;
|
||||
/* orbital elements, either from file or, if file not found,
|
||||
* from above built-in set
|
||||
*/
|
||||
if (read_elements_file(ipl, tjd, &tjd0, &tequ,
|
||||
&mano, &sema, &ecce, &parg, &node, &incl,
|
||||
NULL, &fict_ifl, serr) == ERR)
|
||||
return ERR;
|
||||
dmot = 0.9856076686 * DEGTORAD / sema / sqrt(sema); /* daily motion */
|
||||
if (fict_ifl & FICT_GEO)
|
||||
dmot /= sqrt(SUN_EARTH_MRAT);
|
||||
cosnode = cos(node);
|
||||
sinnode = sin(node);
|
||||
cosincl = cos(incl);
|
||||
sinincl = sin(incl);
|
||||
cosparg = cos(parg);
|
||||
sinparg = sin(parg);
|
||||
/* Gaussian vector */
|
||||
pqr[0] = cosparg * cosnode - sinparg * cosincl * sinnode;
|
||||
pqr[1] = -sinparg * cosnode - cosparg * cosincl * sinnode;
|
||||
pqr[2] = sinincl * sinnode;
|
||||
pqr[3] = cosparg * sinnode + sinparg * cosincl * cosnode;
|
||||
pqr[4] = -sinparg * sinnode + cosparg * cosincl * cosnode;
|
||||
pqr[5] = -sinincl * cosnode;
|
||||
pqr[6] = sinparg * sinincl;
|
||||
pqr[7] = cosparg * sinincl;
|
||||
pqr[8] = cosincl;
|
||||
/* Kepler problem */
|
||||
E = M = swi_mod2PI(mano + (tjd - tjd0) * dmot); /* mean anomaly of date */
|
||||
/* better E for very high eccentricity and small M */
|
||||
if (ecce > 0.975) {
|
||||
M2 = M * RADTODEG;
|
||||
if (M2 > 150 && M2 < 210) {
|
||||
M2 -= 180;
|
||||
M_180_or_0 = 180;
|
||||
} else
|
||||
M_180_or_0 = 0;
|
||||
if (M2 > 330)
|
||||
M2 -= 360;
|
||||
if (M2 < 0) {
|
||||
M2 = -M2;
|
||||
Msgn = -1;
|
||||
} else
|
||||
Msgn = 1;
|
||||
if (M2 < 30) {
|
||||
M2 *= DEGTORAD;
|
||||
alpha = (1 - ecce) / (4 * ecce + 0.5);
|
||||
beta = M2 / (8 * ecce + 1);
|
||||
zeta = pow(beta + sqrt(beta * beta + alpha * alpha), 1/3);
|
||||
sigma = zeta - alpha / 2;
|
||||
sigma = sigma - 0.078 * sigma * sigma * sigma * sigma * sigma / (1 + ecce);
|
||||
E = Msgn * (M2 + ecce * (3 * sigma - 4 * sigma * sigma * sigma))
|
||||
+ M_180_or_0;
|
||||
}
|
||||
}
|
||||
E = swi_kepler(E, M, ecce);
|
||||
/* position and speed, referred to orbital plane */
|
||||
if (fict_ifl & FICT_GEO)
|
||||
K = KGAUSS_GEO / sqrt(sema);
|
||||
else
|
||||
K = KGAUSS / sqrt(sema);
|
||||
cose = cos(E);
|
||||
sine = sin(E);
|
||||
fac = sqrt((1 - ecce) * (1 + ecce));
|
||||
rho = 1 - ecce * cose;
|
||||
x[0] = sema * (cose - ecce);
|
||||
x[1] = sema * fac * sine;
|
||||
x[3] = -K * sine / rho;
|
||||
x[4] = K * fac * cose / rho;
|
||||
/* transformation to ecliptic */
|
||||
xp[0] = pqr[0] * x[0] + pqr[1] * x[1];
|
||||
xp[1] = pqr[3] * x[0] + pqr[4] * x[1];
|
||||
xp[2] = pqr[6] * x[0] + pqr[7] * x[1];
|
||||
xp[3] = pqr[0] * x[3] + pqr[1] * x[4];
|
||||
xp[4] = pqr[3] * x[3] + pqr[4] * x[4];
|
||||
xp[5] = pqr[6] * x[3] + pqr[7] * x[4];
|
||||
/* transformation to equator */
|
||||
eps = swi_epsiln(tequ, 0);
|
||||
swi_coortrf(xp, xp, -eps);
|
||||
swi_coortrf(xp+3, xp+3, -eps);
|
||||
/* precess to J2000 */
|
||||
if (tequ != J2000) {
|
||||
swi_precess(xp, tequ, 0, J_TO_J2000);
|
||||
swi_precess(xp+3, tequ, 0, J_TO_J2000);
|
||||
}
|
||||
/* to solar system barycentre */
|
||||
if (fict_ifl & FICT_GEO) {
|
||||
for (i = 0; i <= 5; i++) {
|
||||
xp[i] += xearth[i];
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i <= 5; i++) {
|
||||
xp[i] += xsun[i];
|
||||
}
|
||||
}
|
||||
if (pdp->x == xp) {
|
||||
pdp->teval = tjd; /* for precession! */
|
||||
pdp->iephe = pedp->iephe;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* note: input parameter tjd is required for T terms in elements */
|
||||
static int read_elements_file(int32 ipl, double tjd,
|
||||
double *tjd0, double *tequ,
|
||||
double *mano, double *sema, double *ecce,
|
||||
double *parg, double *node, double *incl,
|
||||
char *pname, int32 *fict_ifl, char *serr)
|
||||
{
|
||||
int i, iline, iplan, retc, ncpos;
|
||||
FILE *fp = NULL;
|
||||
char s[AS_MAXCH], *sp;
|
||||
char *cpos[20], serri[AS_MAXCH];
|
||||
AS_BOOL elem_found = FALSE;
|
||||
double tt = 0;
|
||||
/* -1, because file information is not saved, file is always closed */
|
||||
if ((fp = swi_fopen(-1, SE_FICTFILE, swed.ephepath, serr)) == NULL) {
|
||||
/* file does not exist, use built-in bodies */
|
||||
if (ipl >= SE_NFICT_ELEM) {
|
||||
if (serr != NULL)
|
||||
sprintf(serr, "error no elements for fictitious body no %7.0f", (double) ipl);
|
||||
return ERR;
|
||||
}
|
||||
if (tjd0 != NULL)
|
||||
*tjd0 = plan_oscu_elem[ipl][0]; /* epoch */
|
||||
if (tequ != NULL)
|
||||
*tequ = plan_oscu_elem[ipl][1]; /* equinox */
|
||||
if (mano != NULL)
|
||||
*mano = plan_oscu_elem[ipl][2] * DEGTORAD; /* mean anomaly */
|
||||
if (sema != NULL)
|
||||
*sema = plan_oscu_elem[ipl][3]; /* semi-axis */
|
||||
if (ecce != NULL)
|
||||
*ecce = plan_oscu_elem[ipl][4]; /* eccentricity */
|
||||
if (parg != NULL)
|
||||
*parg = plan_oscu_elem[ipl][5] * DEGTORAD; /* arg. of peri. */
|
||||
if (node != NULL)
|
||||
*node = plan_oscu_elem[ipl][6] * DEGTORAD; /* asc. node */
|
||||
if (incl != NULL)
|
||||
*incl = plan_oscu_elem[ipl][7] * DEGTORAD; /* inclination */
|
||||
if (pname != NULL)
|
||||
strcpy(pname, plan_fict_nam[ipl]);
|
||||
return OK;
|
||||
}
|
||||
/*
|
||||
* find elements in file
|
||||
*/
|
||||
iline = 0;
|
||||
iplan = -1;
|
||||
while (fgets(s, AS_MAXCH, fp) != NULL) {
|
||||
iline++;
|
||||
sp = s;
|
||||
while(*sp == ' ' || *sp == '\t')
|
||||
sp++;
|
||||
swi_strcpy(s, sp);
|
||||
if (*s == '#')
|
||||
continue;
|
||||
if (*s == '\r')
|
||||
continue;
|
||||
if (*s == '\n')
|
||||
continue;
|
||||
if (*s == '\0')
|
||||
continue;
|
||||
if ((sp = strchr(s, '#')) != NULL)
|
||||
*sp = '\0';
|
||||
ncpos = swi_cutstr(s, ",", cpos, 20);
|
||||
sprintf(serri, "error in file %s, line %7.0f:", SE_FICTFILE, (double) iline);
|
||||
if (ncpos < 9) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s nine elements required", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
iplan++;
|
||||
if (iplan != ipl)
|
||||
continue;
|
||||
elem_found = TRUE;
|
||||
/* epoch of elements */
|
||||
if (tjd0 != NULL) {
|
||||
sp = cpos[0];
|
||||
for (i = 0; i < 5; i++)
|
||||
sp[i] = tolower(sp[i]);
|
||||
if (strncmp(sp, "j2000", 5) == OK)
|
||||
*tjd0 = J2000;
|
||||
else if (strncmp(sp, "b1950", 5) == OK)
|
||||
*tjd0 = B1950;
|
||||
else if (strncmp(sp, "j1900", 5) == OK)
|
||||
*tjd0 = J1900;
|
||||
else if (*sp == 'j' || *sp == 'b') {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s invalid epoch", serri);
|
||||
}
|
||||
goto return_err;
|
||||
} else
|
||||
*tjd0 = atof(sp);
|
||||
tt = tjd - *tjd0;
|
||||
}
|
||||
/* equinox */
|
||||
if (tequ != NULL) {
|
||||
sp = cpos[1];
|
||||
while(*sp == ' ' || *sp == '\t')
|
||||
sp++;
|
||||
for (i = 0; i < 5; i++)
|
||||
sp[i] = tolower(sp[i]);
|
||||
if (strncmp(sp, "j2000", 5) == OK)
|
||||
*tequ = J2000;
|
||||
else if (strncmp(sp, "b1950", 5) == OK)
|
||||
*tequ = B1950;
|
||||
else if (strncmp(sp, "j1900", 5) == OK)
|
||||
*tequ = J1900;
|
||||
else if (strncmp(sp, "jdate", 5) == OK)
|
||||
*tequ = tjd;
|
||||
else if (*sp == 'j' || *sp == 'b') {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s invalid equinox", serri);
|
||||
}
|
||||
goto return_err;
|
||||
} else
|
||||
*tequ = atof(sp);
|
||||
}
|
||||
/* mean anomaly t0 */
|
||||
if (mano != NULL) {
|
||||
retc = check_t_terms(tt, cpos[2], mano);
|
||||
*mano = swe_degnorm(*mano);
|
||||
if (retc == ERR) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s mean anomaly value invalid", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
/* if mean anomaly has t terms (which happens with fictitious
|
||||
* planet Vulcan), we set
|
||||
* epoch = tjd, so that no motion will be added anymore
|
||||
* equinox = tjd */
|
||||
if (retc == 1) {
|
||||
*tjd0 = tjd;
|
||||
}
|
||||
*mano *= DEGTORAD;
|
||||
}
|
||||
/* semi-axis */
|
||||
if (sema != NULL) {
|
||||
retc = check_t_terms(tt, cpos[3], sema);
|
||||
if (*sema <= 0 || retc == ERR) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s semi-axis value invalid", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
}
|
||||
/* eccentricity */
|
||||
if (ecce != NULL) {
|
||||
retc = check_t_terms(tt, cpos[4], ecce);
|
||||
if (*ecce >= 1 || *ecce < 0 || retc == ERR) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
}
|
||||
/* perihelion argument */
|
||||
if (parg != NULL) {
|
||||
retc = check_t_terms(tt, cpos[5], parg);
|
||||
*parg = swe_degnorm(*parg);
|
||||
if (retc == ERR) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s perihelion argument value invalid", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
*parg *= DEGTORAD;
|
||||
}
|
||||
/* node */
|
||||
if (node != NULL) {
|
||||
retc = check_t_terms(tt, cpos[6], node);
|
||||
*node = swe_degnorm(*node);
|
||||
if (retc == ERR) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s node value invalid", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
*node *= DEGTORAD;
|
||||
}
|
||||
/* inclination */
|
||||
if (incl != NULL) {
|
||||
retc = check_t_terms(tt, cpos[7], incl);
|
||||
*incl = swe_degnorm(*incl);
|
||||
if (retc == ERR) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s inclination value invalid", serri);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
*incl *= DEGTORAD;
|
||||
}
|
||||
/* planet name */
|
||||
if (pname != NULL) {
|
||||
sp = cpos[8];
|
||||
while(*sp == ' ' || *sp == '\t')
|
||||
sp++;
|
||||
swi_right_trim(sp);
|
||||
strcpy(pname, sp);
|
||||
}
|
||||
/* geocentric */
|
||||
if (fict_ifl != NULL && ncpos > 9) {
|
||||
for (sp = cpos[9]; *sp != '\0'; sp++)
|
||||
*sp = tolower(*sp);
|
||||
if (strstr(cpos[9], "geo") != NULL)
|
||||
*fict_ifl |= FICT_GEO;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!elem_found) {
|
||||
if (serr != NULL) {
|
||||
sprintf(serr, "%s elements for planet %7.0f not found", serri, (double) ipl);
|
||||
}
|
||||
goto return_err;
|
||||
}
|
||||
fclose(fp);
|
||||
return OK;
|
||||
return_err:
|
||||
fclose(fp);
|
||||
return ERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int check_t_terms(double t, char *sinp, double *doutp)
|
||||
{
|
||||
int i, isgn = 1, z;
|
||||
int retc = 0;
|
||||
char *sp;
|
||||
double tt[5], fac;
|
||||
tt[0] = t / 36525;
|
||||
tt[1] = tt[0];
|
||||
tt[2] = tt[1] * tt[1];
|
||||
tt[3] = tt[2] * tt[1];
|
||||
tt[4] = tt[3] * tt[1];
|
||||
if ((sp = strpbrk(sinp, "+-")) != NULL)
|
||||
retc = 1; /* with additional terms */
|
||||
sp = sinp;
|
||||
*doutp = 0;
|
||||
fac = 1;
|
||||
z = 0;
|
||||
while (1) {
|
||||
while(*sp != '\0' && strchr(" \t", *sp) != NULL)
|
||||
sp++;
|
||||
if (strchr("+-", *sp) || *sp == '\0') {
|
||||
if (z > 0)
|
||||
*doutp += fac;
|
||||
isgn = 1;
|
||||
if (*sp == '-')
|
||||
isgn = -1;
|
||||
fac = 1 * isgn;
|
||||
if (*sp == '\0')
|
||||
return retc;
|
||||
sp++;
|
||||
} else {
|
||||
while(*sp != '\0' && strchr("* \t", *sp) != NULL)
|
||||
sp++;
|
||||
if (*sp != '\0' && strchr("tT", *sp) != NULL) {
|
||||
/* a T */
|
||||
sp++;
|
||||
if (*sp != '\0' && strchr("+-", *sp))
|
||||
fac *= tt[0];
|
||||
else if ((i = atoi(sp)) <= 4 && i >= 0)
|
||||
fac *= tt[i];
|
||||
} else {
|
||||
/* a number */
|
||||
if (atof(sp) != 0 || *sp == '0')
|
||||
fac *= atof(sp);
|
||||
}
|
||||
while (*sp != '\0' && strchr("0123456789.", *sp))
|
||||
sp++;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
return retc; /* there have been additional terms */
|
||||
}
|
||||
10641
lib/sweph/swemptab.h
Normal file
10641
lib/sweph/swemptab.h
Normal file
File diff suppressed because it is too large
Load diff
2820
lib/sweph/swenut2000a.h
Normal file
2820
lib/sweph/swenut2000a.h
Normal file
File diff suppressed because it is too large
Load diff
342
lib/sweph/sweodef.h
Normal file
342
lib/sweph/sweodef.h
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/sweodef.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
definitions and constants for all Swiss Ephemeris source files,
|
||||
only required for compiling the libraries, not for the external
|
||||
interface of the libraries.
|
||||
|
||||
The definitions are a subset of Astrodienst's ourdef.h content
|
||||
and must be kept compatible. Everything not used in SwissEph
|
||||
has been deleted.
|
||||
|
||||
Does auto-detection of MSDOS (TURBO_C or MS_C), HPUNIX, Linux.
|
||||
Must be extended for more portability; there should be a way
|
||||
to detect byte order and file system type.
|
||||
|
||||
************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */
|
||||
#ifndef _SWEODEF_INCLUDED /* allow multiple #includes */
|
||||
#define _SWEODEF_INCLUDED
|
||||
|
||||
# define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
|
||||
# define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
|
||||
|
||||
/* TLS support
|
||||
*
|
||||
* Sun Studio C/C++, IBM XL C/C++, GNU C and Intel C/C++ (Linux systems) -> __thread
|
||||
* Borland, VC++ -> __declspec(thread)
|
||||
*/
|
||||
#if !defined(TLSOFF) && !defined( __APPLE__ ) && !defined(WIN32) && !defined(DOS32)
|
||||
#if defined( __GNUC__ )
|
||||
#define TLS __thread
|
||||
#else
|
||||
#define TLS __declspec(thread)
|
||||
#endif
|
||||
#else
|
||||
#define TLS
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
|
||||
# undef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
#include <wtypes.h>
|
||||
#include <objbase.h>
|
||||
#include <wincon.h>
|
||||
#include <winbase.h>
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
# define sleep(x) Sleep((x) * 1000)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define MS_VC
|
||||
#endif
|
||||
|
||||
#ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
|
||||
# define MSDOS MY_TRUE
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS /* already defined by some DOS compilers */
|
||||
# undef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
#endif
|
||||
|
||||
#ifdef __TURBOC__ /* defined by turboc */
|
||||
# ifndef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
# endif
|
||||
# define TURBO_C
|
||||
#endif
|
||||
|
||||
#ifdef __SC__ /* defined by Symantec C */
|
||||
# ifndef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
# endif
|
||||
# define SYMANTEC_C
|
||||
#endif
|
||||
|
||||
#ifdef __WATCOMC__ /* defined by WatcomC */
|
||||
# ifndef MSDOS
|
||||
# define MSDOS MY_TRUE
|
||||
# endif
|
||||
# define WATCOMC
|
||||
#endif
|
||||
|
||||
#ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
|
||||
# if macintosh && powerc
|
||||
# define MACOS MY_TRUE /* let it undefined otherwise */
|
||||
# define MSDOS MY_FALSE /* in case one above fired falsely */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS
|
||||
# define HPUNIX MY_FALSE
|
||||
# define INTEL_BYTE_ORDER 1
|
||||
# ifndef TURBO_C
|
||||
# define MS_C /* assume Microsoft C compiler */
|
||||
# endif
|
||||
# define UNIX_FS MY_FALSE
|
||||
#else
|
||||
# ifdef MACOS
|
||||
# define HPUNIX MY_FALSE
|
||||
# define UNIX_FS MY_FALSE
|
||||
# else
|
||||
# define MSDOS MY_FALSE
|
||||
# define HPUNIX MY_TRUE
|
||||
# ifndef _HPUX_SOURCE
|
||||
# define _HPUX_SOURCE
|
||||
# endif
|
||||
# define UNIX_FS MY_TRUE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef FILE
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if HPUNIX
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* if we have 16-bit ints, we define INT_16; we will need %ld to printf an int32
|
||||
* if we have 64-bit long, we define LONG_64
|
||||
* If none is defined, we have int = long = 32 bit, and use %d to printf an int32
|
||||
*/
|
||||
#include <limits.h>
|
||||
#if INT_MAX < 40000
|
||||
# define INT_16
|
||||
#else
|
||||
# if LONG_MAX > INT_MAX
|
||||
# define LONG_64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef BYTE_ORDER
|
||||
#ifdef LITTLE_ENDIAN
|
||||
# if BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define INTEL_BYTE_ORDER
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INT_16
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
typedef int int16;
|
||||
typedef double REAL8; /* real with at least 64 bit precision */
|
||||
typedef long INT4; /* signed integer with at least 32 bit precision */
|
||||
typedef unsigned long UINT4;
|
||||
/* unsigned integer with at least 32 bit precision */
|
||||
typedef int AS_BOOL;
|
||||
typedef unsigned int UINT2; /* unsigned 16 bits */
|
||||
# define ABS4 labs /* abs function for long */
|
||||
#else
|
||||
typedef int int32;
|
||||
typedef long long int64;
|
||||
typedef unsigned int uint32;
|
||||
typedef short int16;
|
||||
typedef double REAL8; /* real with at least 64 bit precision */
|
||||
typedef int INT4; /* signed integer with at least 32 bit precision */
|
||||
typedef unsigned int UINT4;
|
||||
/* unsigned integer with at least 32 bit precision */
|
||||
typedef int AS_BOOL;
|
||||
typedef unsigned short UINT2; /* unsigned 16 bits */
|
||||
# define ABS4 abs /* abs function for long */
|
||||
#endif
|
||||
|
||||
#if MSDOS
|
||||
# ifdef TURBO_C
|
||||
# include <alloc.h> /* MSC needs malloc ! */
|
||||
# else
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
# define SIGALRM SIGINT
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef OK
|
||||
# define OK (0)
|
||||
# define ERR (-1)
|
||||
#endif
|
||||
|
||||
/* hack because UCHAR is already used by mingw gcc */
|
||||
#ifdef __GNUC__
|
||||
#ifdef _WIN32
|
||||
#define UCHAR SWE_UCHAR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
#define UCP (UCHAR*)
|
||||
#define SCP (char*)
|
||||
|
||||
# define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
|
||||
|
||||
|
||||
|
||||
#ifndef HUGE
|
||||
# define HUGE 1.7E+308 /* biggest value for REAL8 */
|
||||
#endif
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
/* #define forward static obsolete */
|
||||
|
||||
#define AS_MAXCH 256 /* used for string declarations, allowing 255 char+\0 */
|
||||
|
||||
/*
|
||||
#define DEGTORAD 0.0174532925199433
|
||||
#define RADTODEG 57.2957795130823
|
||||
*/
|
||||
#define RADTODEG (180.0 / M_PI)
|
||||
#define DEGTORAD (M_PI / 180.0)
|
||||
|
||||
typedef int32 centisec; /* centiseconds used for angles and times */
|
||||
#define CS (centisec) /* use for casting */
|
||||
#define CSEC centisec /* use for typing */
|
||||
|
||||
#define DEG 360000 /* degree expressed in centiseconds */
|
||||
#define DEG7_30 (2700000) /* 7.5 degrees */
|
||||
#define DEG15 (15 * DEG)
|
||||
#define DEG24 (24 * DEG)
|
||||
#define DEG30 (30 * DEG)
|
||||
#define DEG60 (60 * DEG)
|
||||
#define DEG90 (90 * DEG)
|
||||
#define DEG120 (120 * DEG)
|
||||
#define DEG150 (150 * DEG)
|
||||
#define DEG180 (180 * DEG)
|
||||
#define DEG270 (270 * DEG)
|
||||
#define DEG360 (360 * DEG)
|
||||
|
||||
/* #define CSTORAD 4.84813681109536E-08 centisec to rad: pi / 180 /3600/100 */
|
||||
/* #define RADTOCS 2.06264806247096E+07 rad to centisec 180*3600*100/pi */
|
||||
#define CSTORAD (DEGTORAD / 360000.0)
|
||||
#define RADTOCS (RADTODEG * 360000.0)
|
||||
|
||||
#define CS2DEG (1.0/360000.0) /* centisec to degree */
|
||||
|
||||
/* control strings for fopen() */
|
||||
#if UNIX_FS
|
||||
# define BFILE_R_ACCESS "r" /* open binary file for reading */
|
||||
# define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
|
||||
# define BFILE_W_CREATE "w" /* create/open binary file for write*/
|
||||
# define BFILE_A_ACCESS "a+" /* create/open binary file for append*/
|
||||
# define FILE_R_ACCESS "r" /* open text file for reading */
|
||||
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
||||
# define FILE_W_CREATE "w" /* create/open text file for write*/
|
||||
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
|
||||
# define O_BINARY 0 /* for open(), not defined in Unix */
|
||||
# define OPEN_MODE 0666 /* default file creation mode */
|
||||
# define DIR_GLUE "/" /* glue string for directory/file */
|
||||
# define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
|
||||
#else
|
||||
# define BFILE_R_ACCESS "rb" /* open binary file for reading */
|
||||
# define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
|
||||
# define BFILE_W_CREATE "wb" /* create/open binary file for write*/
|
||||
# define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
|
||||
# define PATH_SEPARATOR ";" /* semicolon as PATH separator */
|
||||
# define OPEN_MODE 0666 /* default file creation mode */
|
||||
# ifdef MACOS
|
||||
# define FILE_R_ACCESS "r" /* open text file for reading */
|
||||
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
||||
# define FILE_W_CREATE "w" /* create/open text file for write*/
|
||||
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
|
||||
# define DIR_GLUE ":" /* glue string for directory/file */
|
||||
# else
|
||||
# define FILE_R_ACCESS "rt" /* open text file for reading */
|
||||
# define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
|
||||
# define FILE_W_CREATE "wt" /* create/open text file for write*/
|
||||
# define FILE_A_ACCESS "a+t" /* create/open text file for append*/
|
||||
/* attention, all backslashes for msdos directry names must be written as \\,
|
||||
because it is the C escape character */
|
||||
# define DIR_GLUE "\\" /* glue string for directory/file */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#endif /* _SWEODEF_INCLUDED */
|
||||
#endif /* _OURDEF_INCLUDED */
|
||||
583
lib/sweph/swepcalc.c
Normal file
583
lib/sweph/swepcalc.c
Normal file
|
|
@ -0,0 +1,583 @@
|
|||
/*****************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swepcalc.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
Placalc compatibility interface for Swiss Ephemeris.
|
||||
|
||||
*******************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is the PLACALC compatibility interface for Swiss Ephemeris.
|
||||
* It allows very easy porting of older Placalc application to the SwissEph.
|
||||
* A user has to replace #include "placalc.h" and "housasp.h" with
|
||||
* #include "swepcalc.h"
|
||||
* If he has used "ourdef.h" he replaces it with "sweodef.h".
|
||||
* Then he links his application with swepcalc.o and runs it against the
|
||||
* Swiss Ephemeris DLL or linkable library.
|
||||
*
|
||||
* All calls which were present in the placalc sources are contained
|
||||
* here, and either implemented directly or translated into Swiss Ephemeris
|
||||
* calls.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "swepcalc.h"
|
||||
#include "swephexp.h"
|
||||
|
||||
/************************************************************
|
||||
local globals, not exported
|
||||
************************************************************/
|
||||
|
||||
static const int plac2swe[] = {SE_SUN, SE_MOON, SE_MERCURY, SE_VENUS, SE_MARS, SE_JUPITER, SE_SATURN, SE_URANUS, SE_NEPTUNE, SE_PLUTO, SE_MEAN_NODE, SE_TRUE_NODE, SE_CHIRON, SE_MEAN_APOG, SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA,};
|
||||
|
||||
/* If there occurs an internal error in placalc, a message is
|
||||
* written into the string variable perrtx.
|
||||
* The message can be read with placalc_get_errtext();
|
||||
*/
|
||||
static TLS char perrtx[AS_MAXCH];
|
||||
static double ekl, nut;
|
||||
|
||||
/**********************************************************
|
||||
function nacalc ()
|
||||
calculates an array of planet longitudes and speeds,
|
||||
as needed for complete nathan data records.
|
||||
The function knows itself how many planets and in which mode
|
||||
they have to be calculated for Nathan.
|
||||
|
||||
return OK or ERR
|
||||
|
||||
The returned positions are in centiseconds, our standard
|
||||
coordinate format for fast mathematics with planetary positions.
|
||||
|
||||
This function is just a template of how the calc() package
|
||||
can be used.
|
||||
**********************************************************/
|
||||
int nacalc (double jd_ad, /* universal time relative julian date */
|
||||
centisec *plon, /* returned longitudes */
|
||||
centisec *pspe /* returned speeds, if not NULL pointer */
|
||||
)
|
||||
{
|
||||
char err[AS_MAXCH];
|
||||
int planet, flag;
|
||||
double rlng, rrad, rlat, rspeed;
|
||||
int result = OK;
|
||||
flag = CALC_BIT_SPEED; /* same, with speed */
|
||||
jd_ad += deltat( jd_ad ); /* ET = UT + Delta_T */
|
||||
for (planet = SUN; planet <= MAXPL_NACALC; planet++) {
|
||||
if (calc (planet, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
|
||||
plon [planet] = swe_csnorm(swe_d2l (rlng * DEG));
|
||||
if (pspe != NULL) pspe [planet] = swe_d2l (rspeed * DEG);
|
||||
} else {
|
||||
plon [planet] = -1;
|
||||
if (pspe != NULL) pspe [planet] = 0;
|
||||
if (result != ERR) { /* save first error message */
|
||||
strcpy(err, placalc_get_errtext());
|
||||
}
|
||||
result = ERR;
|
||||
}
|
||||
}
|
||||
if (result == ERR)
|
||||
strcpy(perrtx, err);
|
||||
return result;
|
||||
} /* end nacalc */
|
||||
|
||||
/******************************************************************
|
||||
function calc():
|
||||
This is the main routine for computing a planets position.
|
||||
The function has several modes, which are controlled by bits in
|
||||
the parameter 'flag'. The normal mode (flag == 0) computes
|
||||
a planets apparent geocentric position in ecliptic coordinates relative to
|
||||
the true equinox of date, without speed
|
||||
|
||||
Explanation of the arguments: see the functions header.
|
||||
|
||||
Returns OK or ERR (if some planet out of time range). OK and ERR are
|
||||
defined in ourdef.h and must not be confused with TRUE and FALSE.
|
||||
OK and ERR are of type int, not of type AS_BOOL.
|
||||
|
||||
Bits used in flag:
|
||||
CALC_BIT_HELIO 0 = geocentric, 1 = heliocentric
|
||||
CALC_BIT_NOAPP 0 = apparent positions, 1 = true positions
|
||||
CALC_BIT_NONUT 0 = do nutation (true equinox of date)
|
||||
1 = don't do nutation (mean equinox of date).
|
||||
|
||||
CALC_BIT_SPEED 0 = don't calc speed,
|
||||
1 = calc speed
|
||||
|
||||
Time range:
|
||||
The function can be used savely in the time range 3000 BC to
|
||||
3000 AD.
|
||||
|
||||
Getting ecliptic and nutation:
|
||||
calc(CALC_ONLY_ECL_NUT,teph,0,&nutv,&meaneklv,&eklv,NULL);
|
||||
will return the values for time teph.
|
||||
|
||||
******************************************************************/
|
||||
int calc(int planet, /* planet index as defined in placalc.h,
|
||||
SUN = 0, MOON = 1 etc.
|
||||
planet == -1 calc calculates only nut, ekl, meanekl */
|
||||
double jd_ad, /* relative Astrodienst Juldate, ephemeris time.
|
||||
Astrodienst Juldate is relative 31 Dec 1949, noon. */
|
||||
int flag, /* See definition of flag bits above */
|
||||
double *alng,
|
||||
double *arad,
|
||||
double *alat,
|
||||
double *alngspeed)
|
||||
/* pointers to the return variables:
|
||||
alng = ecliptic longitude in degrees
|
||||
arad = radius vector in AU (astronomic units)
|
||||
alat = ecliptic latitude in degrees
|
||||
alngspeed = speed of planet in degrees per day
|
||||
*/
|
||||
{
|
||||
double tjd = jd_ad + JUL_OFFSET;
|
||||
double x[6];
|
||||
int32 iflagret = 0, iflag = 0;
|
||||
int ipl;
|
||||
/* planet number
|
||||
*/
|
||||
/* ecliptic and nutation */
|
||||
if (planet == CALC_ONLY_ECL_NUT)
|
||||
ipl = SE_ECL_NUT;
|
||||
/* earth: placalc makes no difference between sun and earth,
|
||||
* swisseph does */
|
||||
else if (planet == SUN && (flag & CALC_BIT_HELIO))
|
||||
ipl = SE_EARTH;
|
||||
else if (planet >= SUN && planet <= VESTA)
|
||||
ipl = plac2swe[planet];
|
||||
else {
|
||||
sprintf(perrtx, "invalid planet number %d. ", planet);
|
||||
return ERR;
|
||||
}
|
||||
/* flag */
|
||||
if (flag & CALC_BIT_HELIO)
|
||||
if (ipl != SE_MEAN_NODE && ipl != SE_TRUE_NODE && ipl != SE_MEAN_APOG)
|
||||
iflag |= SEFLG_HELCTR; /* lunar node and apogee is always geocentric */
|
||||
if (flag & CALC_BIT_NOAPP)
|
||||
iflag |= SEFLG_TRUEPOS;
|
||||
if (flag & CALC_BIT_NONUT)
|
||||
iflag |= SEFLG_NONUT;
|
||||
if (flag & CALC_BIT_SPEED)
|
||||
iflag |= SEFLG_SPEED;
|
||||
/* ecliptic and nutation */
|
||||
if ((iflagret = swe_calc(tjd, ipl, iflag, x, perrtx)) == ERR)
|
||||
return iflagret;
|
||||
if (ipl == SE_ECL_NUT) {
|
||||
*alng = nut = x[2];
|
||||
*arad = x[1];
|
||||
*alat = ekl = x[0];
|
||||
} else {
|
||||
*alng = x[0];
|
||||
*arad = x[2];
|
||||
*alat = x[1];
|
||||
*alngspeed = x[3];
|
||||
}
|
||||
return (OK);
|
||||
} /* end calc */
|
||||
|
||||
/*
|
||||
* get the planet index for an AFL letter
|
||||
* returns -1 if the letter does not correspond to a planet.
|
||||
*/
|
||||
int afl2planet(int afl)
|
||||
{
|
||||
int p;
|
||||
switch (afl) {
|
||||
case AFL_SUN : p = SUN; break;
|
||||
case AFL_MON : p = MOON; break;
|
||||
case AFL_MER : p = MERCURY; break;
|
||||
case AFL_VEN : p = VENUS; break;
|
||||
case AFL_MAR : p = MARS; break;
|
||||
case AFL_JUP : p = JUPITER; break;
|
||||
case AFL_SAT : p = SATURN; break;
|
||||
case AFL_URA : p = URANUS; break;
|
||||
case AFL_NEP : p = NEPTUNE; break;
|
||||
case AFL_PLU : p = PLUTO; break;
|
||||
case AFL_MNODE : p = MEAN_NODE; break;
|
||||
case AFL_TNODE : p = TRUE_NODE; break;
|
||||
case AFL_CHI : p = CHIRON; break;
|
||||
case AFL_LIL : p = LILITH; break;
|
||||
case AFL_CER : p = CERES; break;
|
||||
case AFL_PAL : p = PALLAS; break;
|
||||
case AFL_JUN : p = JUNO; break;
|
||||
case AFL_VES : p = VESTA; break;
|
||||
case AFL_AC : p = AC; break;
|
||||
case AFL_MC : p = MC; break;
|
||||
default : p = -1; break;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* get the AFL letter for a planet
|
||||
* returns -1 if no letter corresponds to a planet.
|
||||
*/
|
||||
int planet2afl(int planet)
|
||||
{
|
||||
switch (planet) {
|
||||
case SUN: return AFL_SUN;
|
||||
case MOON: return AFL_MON;
|
||||
case MERCURY: return AFL_MER;
|
||||
case VENUS: return AFL_VEN;
|
||||
case MARS: return AFL_MAR;
|
||||
case JUPITER: return AFL_JUP;
|
||||
case SATURN: return AFL_SAT;
|
||||
case URANUS: return AFL_URA;
|
||||
case NEPTUNE: return AFL_NEP;
|
||||
case PLUTO: return AFL_PLU;
|
||||
case MEAN_NODE: return AFL_MNODE;
|
||||
case TRUE_NODE: return AFL_TNODE;
|
||||
case CHIRON: return AFL_CHI;
|
||||
case LILITH: return AFL_LIL;
|
||||
case CERES: return AFL_CER;
|
||||
case PALLAS: return AFL_PAL;
|
||||
case JUNO: return AFL_JUN;
|
||||
case VESTA: return AFL_VES;
|
||||
case AC: return AFL_AC;
|
||||
case MC: return AFL_MC;
|
||||
}
|
||||
if (planet >= FIRST_HSNR && planet <= LAST_HSNR)
|
||||
return AFL_HOUSE;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* get the 2-letter abbreviation for a planet
|
||||
* returns ?? if not defined
|
||||
*/
|
||||
char *planet2abbr2(int planet)
|
||||
{
|
||||
switch (planet) {
|
||||
case SUN: return "su";
|
||||
case MOON: return "mo";
|
||||
case MERCURY: return "me";
|
||||
case VENUS: return "ve";
|
||||
case MARS: return "ma";
|
||||
case JUPITER: return "ju";
|
||||
case SATURN: return "sa";
|
||||
case URANUS: return "ur";
|
||||
case NEPTUNE: return "ne";
|
||||
case PLUTO: return "pl";
|
||||
case MEAN_NODE: return "mn";
|
||||
case TRUE_NODE: return "tn";
|
||||
case CHIRON: return "ch";
|
||||
case LILITH: return "li";
|
||||
case CERES: return "ce";
|
||||
case PALLAS: return "pa";
|
||||
case JUNO: return "jn";
|
||||
case VESTA: return "vs";
|
||||
case AC: return "ac";
|
||||
case MC: return "mc";
|
||||
}
|
||||
return "??";
|
||||
}
|
||||
|
||||
/*
|
||||
* get the 3-letter abbreviation for a planet
|
||||
* returns ??? if not defined
|
||||
*/
|
||||
char *planet2abbr3(int planet)
|
||||
{
|
||||
switch (planet) {
|
||||
case SUN: return "sun";
|
||||
case MOON: return "mon";
|
||||
case MERCURY: return "mer";
|
||||
case VENUS: return "ven";
|
||||
case MARS: return "mar";
|
||||
case JUPITER: return "jup";
|
||||
case SATURN: return "sat";
|
||||
case URANUS: return "ura";
|
||||
case NEPTUNE: return "nep";
|
||||
case PLUTO: return "plu";
|
||||
case MEAN_NODE: return "mno";
|
||||
case TRUE_NODE: return "tno";
|
||||
case CHIRON: return "chi";
|
||||
case LILITH: return "lil";
|
||||
case CERES: return "cer";
|
||||
case PALLAS: return "pal";
|
||||
case JUNO: return "jun";
|
||||
case VESTA: return "ves";
|
||||
case AC: return "asc";
|
||||
case MC: return "mc ";
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
|
||||
char *placalc_set_ephepath(char *path)
|
||||
{
|
||||
static TLS char *epath;
|
||||
if (path == NULL) return epath;
|
||||
if (epath != NULL)
|
||||
free((void *) epath);
|
||||
epath = malloc(strlen(path) + 1);
|
||||
if (epath != NULL) {
|
||||
strcpy(epath, path);
|
||||
swe_set_ephe_path(epath);
|
||||
}
|
||||
return epath;
|
||||
}
|
||||
|
||||
char *placalc_get_errtext()
|
||||
{
|
||||
return perrtx;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
deltat(t): returns delta t (in julian days) from universal time t
|
||||
is included by users
|
||||
ET = UT + deltat
|
||||
******************************************************/
|
||||
double deltat (double jd_ad) /* Astrodienst relative julian date */
|
||||
{
|
||||
return swe_deltat(jd_ad + JUL_OFFSET);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
double diff8360 (double a, double b)
|
||||
/* a - b on a 360 degree circle, result -180..180*/
|
||||
{
|
||||
double d;
|
||||
d = a - b;
|
||||
if ( d >= 180.0 ) return( d - 360.0 );
|
||||
if ( d < -180.0 ) return( d + 360.0 );
|
||||
return( d );
|
||||
} /* diff8360 */
|
||||
|
||||
/*
|
||||
* originally in swephous.c
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
return in which house pp is;
|
||||
houses are numbered from 1 .. 12
|
||||
*************************************/
|
||||
int HouseNr(struct houses *hsp, CSEC pp)
|
||||
{
|
||||
CSEC cx;
|
||||
int i = 2;
|
||||
cx = swe_difcsn(pp, hsp->cusp [1]); /* distance from cusp 1 */
|
||||
while (i < 13 && cx >= difcsn(hsp->cusp[i], hsp->cusp[1])) i++;
|
||||
return (i - 1);
|
||||
}
|
||||
|
||||
/************************************
|
||||
returns the inp-house number, where pp is in
|
||||
houses are numbered from 1 .. 12
|
||||
************************************/
|
||||
int InpHouseNr (struct houses *hsp, CSEC pp, CSEC *coff)
|
||||
{
|
||||
CSEC cx;
|
||||
int i = 2;
|
||||
cx = swe_difcsn(pp, hsp->cusp [1] + coff [1]);
|
||||
while(i<13 && cx >= swe_difcsn(hsp->cusp[i] + coff[i], hsp->cusp[1] + coff[1]))
|
||||
i++;
|
||||
return (i - 1);
|
||||
}
|
||||
|
||||
/* variation of InpHouseNr(). Able to handle house pre-orbs that are
|
||||
* proportional to house size.
|
||||
* value 1 in doff[0] means that the offset is proportional to house size,
|
||||
* e.g. doff[ihs] = -5 means here:
|
||||
* doff[ihs] = -5 / 30 * preceding_house_size;
|
||||
* We first calculate the absolute offsets for each house of our birth chart,
|
||||
* then call the function InpHouseNr() with those values.
|
||||
*/
|
||||
int InpHouseNr2 (struct houses *hsp, CSEC pp, CSEC *coff)
|
||||
{
|
||||
int i, j;
|
||||
CSEC myoff[13];
|
||||
for (i = 0; i < 13; i++)
|
||||
myoff[i] = coff[i];
|
||||
if (myoff[0] == 1) {
|
||||
for (i = 1; i < 13; i++) {
|
||||
j = i + 1;
|
||||
if (j > 12) j = 1;
|
||||
myoff[j] = swe_degnorm((hsp->cusp[j] - hsp->cusp[i]) / 360000.0) / 30.0 * myoff[j];
|
||||
}
|
||||
}
|
||||
return InpHouseNr(hsp, pp, myoff);
|
||||
}
|
||||
|
||||
// *********************************************************
|
||||
// Houses:
|
||||
// *********************************************************
|
||||
// Koch and Placidus don't work in the polar circle.
|
||||
// We swap MC/IC so that MC is always before AC in the zodiac
|
||||
// We then divide the quadrants into 3 equal parts.
|
||||
// *********************************************************
|
||||
// All angles are expressed in centiseconds (1/100th of a
|
||||
// second of arc) and integer arithmetic is used for these.
|
||||
// *********************************************************
|
||||
// Arguments: th = sidereal time (angle 0..360 degrees
|
||||
// hsy = letter code for house system; implemen-
|
||||
// ted are P,K,C,R,E,V.
|
||||
// fi = geographic latitude
|
||||
// ekl = obliquity of the ecliptic
|
||||
// iteration_count = number of iterations in
|
||||
// Placidus calculation; is obsolete but kept for API continuity
|
||||
// *********************************************************
|
||||
void CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
|
||||
struct houses *hsp )
|
||||
{
|
||||
int retc = 0, i;
|
||||
double cs2deg = 360000;
|
||||
double cusps[13];
|
||||
double ascmc[10];
|
||||
/* iteration_count is always 2 */
|
||||
retc = swe_houses_armc(th / cs2deg, fi / cs2deg, mekl / cs2deg, (int) hsy,
|
||||
cusps, ascmc);
|
||||
for (i = 0; i < 13; i++)
|
||||
hsp->cusp[i] = swe_d2l(cusps[i] * cs2deg);
|
||||
hsp->ac = swe_d2l(ascmc[0] * cs2deg);
|
||||
hsp->mc = swe_d2l(ascmc[1] * cs2deg);
|
||||
/*
|
||||
* this is just to shut up lint
|
||||
*/
|
||||
retc += iteration_count;
|
||||
iteration_count = retc;
|
||||
} /* procedure houses */
|
||||
|
||||
/******************************/
|
||||
void RecalcAspects(struct AspectType *a)
|
||||
{
|
||||
centisec diff,orbis;
|
||||
int p1, p2, i;
|
||||
struct aspRec *arp;
|
||||
if (a->ppos2 == NULL) { /* no set ppos2, no interaspects */
|
||||
for (p1 = 0; p1 < a->NrOfPlanets; p1++) {
|
||||
a->Asp[p1][p1].index = 0; /* ignore p1 conjunct p1 */
|
||||
for (p2 = p1 + 1; p2 < a->NrOfPlanets; p2++) {
|
||||
arp = &(a->Asp[p1][p2]);
|
||||
diff = a->PlanetPos [p2] - a->PlanetPos [p1];
|
||||
if (diff >= DEG180)
|
||||
diff -= DEG360;
|
||||
else if (diff < - DEG180)
|
||||
diff += DEG360;
|
||||
i = 1;
|
||||
arp->index = 0;
|
||||
while (i <= a->NrOfAspects) {
|
||||
orbis = ABS4 (diff) - a->Angle [i];
|
||||
if (ABS4 (orbis) <= a->Maxorb [i]) {
|
||||
arp->index = i;
|
||||
arp->orb = orbis;
|
||||
break; /* out of while */
|
||||
}
|
||||
i++;
|
||||
}
|
||||
a->Asp [p2][p1].index = arp->index;
|
||||
a->Asp [p2][p1].orb = arp->orb;
|
||||
} /* for p2 */
|
||||
} /* for p1 */
|
||||
} else { /* interaspects between set 1 and set 2 */
|
||||
for (p1 = 0; p1 < a->NrOfPlanets; p1++) {
|
||||
for (p2 = 0; p2 < a->NrOfPlanets; p2++) {
|
||||
arp = &(a->Asp[p1][p2]);
|
||||
diff = a->ppos2 [p2] - a->PlanetPos [p1];
|
||||
if (diff >= DEG180)
|
||||
diff -= DEG360;
|
||||
else if (diff < - DEG180)
|
||||
diff += DEG360;
|
||||
i = 1;
|
||||
arp->index = 0;
|
||||
while (i <= a->NrOfAspects) {
|
||||
orbis = ABS4 (diff) - a->Angle [i];
|
||||
if (ABS4 (orbis) <= a->Maxorb [i]) {
|
||||
arp->index = i;
|
||||
arp->orb = orbis;
|
||||
break; /* out of while */
|
||||
}
|
||||
i++;
|
||||
}
|
||||
} /* for p2 */
|
||||
} /* for p1 */
|
||||
} /* else */
|
||||
a->dataValid = TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
function sidtime (t): returns sidereal time at greenwich;
|
||||
Parameters differ from ASYS version! after AESuppl. 1961, page 75
|
||||
version 24-oct-87
|
||||
***********************************************************/
|
||||
double sidtime (double jd_ad, double ecl, double nuta)
|
||||
/* jd_ad relative julian date */
|
||||
/* ecl, nuta ecliptic and nutation of date, in degrees */
|
||||
{
|
||||
return swe_sidtime0(jd_ad + JUL_OFFSET, ecl, nuta);
|
||||
}
|
||||
|
||||
# ifdef INTEL_BYTE_ORDER
|
||||
/********************************************************************/
|
||||
void longreorder (UCHAR *p, int n)
|
||||
/* p points to memory filled with int32 values; for
|
||||
each of the values the seqeuence of the four bytes
|
||||
has to be reversed, to translate HP-UX and VAX
|
||||
ordering to MSDOS/Turboc ordering */
|
||||
{
|
||||
int i;
|
||||
unsigned char c0, c1, c2, c3;
|
||||
for (i = 0; i < n; i += 4, p += 4) {
|
||||
c0 = *p;
|
||||
c1 = *(p + 1);
|
||||
c2 = *(p + 2);
|
||||
c3 = *(p + 3);
|
||||
*p = c3;
|
||||
*(p + 1) = c2;
|
||||
*(p + 2) = c1;
|
||||
*(p + 3) = c0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
438
lib/sweph/swepcalc.h
Normal file
438
lib/sweph/swepcalc.h
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swepcalc.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
Definitions and constants for Placalc interface to SwissEph
|
||||
|
||||
This should only be used for porting older Placalc applications.
|
||||
All new applications should directly use the Swiss Ephemeris API.
|
||||
|
||||
A programmer using the Placalc API needs only to include this file
|
||||
in his code, and link his application with the SwissEph library.
|
||||
|
||||
There is no documentation, as it is only intended for porting old
|
||||
existing Placalc applications.
|
||||
|
||||
The Placalc API is not supported in the Windows DLL versions of
|
||||
Swiss Ephemeris.
|
||||
************************************************************/
|
||||
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#ifndef _SWEPCALC_INCLUDED
|
||||
#define _SWEPCALC_INCLUDED
|
||||
|
||||
#include "swephexp.h"
|
||||
|
||||
#define degtocs(x) (d2l((x) * DEG))
|
||||
#define cstodeg(x) (double)((x) * CS2DEG)
|
||||
|
||||
/*
|
||||
* Some functions which came in the source files csec.c and d2l.c
|
||||
* are by default not included in the compatibility interface because
|
||||
* they have an identical counterpart in the SwissEph library.
|
||||
* It is very simple to adapt your code to it.
|
||||
* If you want to adapt your source code, turn the next TRUE into FALSE
|
||||
*/
|
||||
#if TRUE /* replace by if FALSE to deactivate macros */
|
||||
# define d2l(x) swe_d2l(x)
|
||||
# define difcsn(x,y) swe_difcsn(x,y)
|
||||
# define difcs2n(x,y) swe_difcs2n(x,y)
|
||||
# define difdegn(x,y) swe_difdegn(x,y)
|
||||
# define difdeg2n(x,y) swe_difdeg2n(x,y)
|
||||
# define csnorm(x) swe_csnorm(x)
|
||||
# define degnorm(x) swe_degnorm(x)
|
||||
# define roundsec(x) swe_csroundsec(x)
|
||||
#endif
|
||||
|
||||
/*************************************************************
|
||||
Exported functions, originally from placalc.c
|
||||
|
||||
In all functions the variable jd_ad indicates the use of
|
||||
Astrodienst relative julian days, and jd the use of absolute
|
||||
julian days.
|
||||
*************************************************************/
|
||||
extern int nacalc(double jd_ad, centisec *plon, centisec *pspe);
|
||||
extern int calc(int p,
|
||||
double jd_ad,
|
||||
int flag,
|
||||
double *alng,
|
||||
double *arad,
|
||||
double *alat,
|
||||
double *alngspeed);
|
||||
extern double fraction(double t);
|
||||
extern double sidtime(double jd_ad, double ecl, double nuta);
|
||||
extern double smod8360(double x);
|
||||
extern double mod8360(double x);
|
||||
extern double diff8360(double x, double y);
|
||||
extern double test_near_zero(double x);
|
||||
extern double deltat(double jd_ad);
|
||||
extern char *placalc_get_errtext();
|
||||
extern char *placalc_set_ephepath(char *new_path); /* sets ephepath;
|
||||
if called with NULL, returns current path */
|
||||
|
||||
/*
|
||||
* because deltat() required a relative Julian date due to historical reasons,
|
||||
* we define a function deltatjd() with absolute Juliand date argument.
|
||||
*/
|
||||
# define deltatjd(x) deltat((x) - JUL_OFFSET)
|
||||
|
||||
/*
|
||||
* get the planet index for an AFL letter
|
||||
* returns -1 if the letter does not correspond to a planet.
|
||||
*/
|
||||
extern int afl2planet(int afl);
|
||||
/*
|
||||
* get the AFL letter for a planet
|
||||
* returns -1 if planet has no letter.
|
||||
*/
|
||||
extern int planet2afl(int p);
|
||||
extern char *planet2abbr2(int planet);
|
||||
extern char *planet2abbr3(int planet);
|
||||
|
||||
/*************************************************************
|
||||
exported variables
|
||||
(these cannot be used by DLL clients)
|
||||
*************************************************************/
|
||||
|
||||
|
||||
/*************************************************************
|
||||
definitions
|
||||
*************************************************************/
|
||||
|
||||
/*
|
||||
* planet index numbers, used to identify a planet in calc() and
|
||||
* other related functions.
|
||||
*/
|
||||
#define CALC_ONLY_ECL_NUT (-1) /* pseudo planet index for calls to calc */
|
||||
#define SUN 0 /* used synonymously for earth too */
|
||||
#define EARTH 0
|
||||
#define MOON 1
|
||||
#define MERCURY 2
|
||||
#define VENUS 3
|
||||
#define MARS 4
|
||||
#define JUPITER 5
|
||||
#define SATURN 6
|
||||
#define URANUS 7
|
||||
#define NEPTUNE 8
|
||||
#define PLUTO 9
|
||||
#define LASTPLANET PLUTO
|
||||
#define MEAN_NODE 10
|
||||
#define TRUE_NODE 11
|
||||
#define CHIRON 12
|
||||
#define LILITH 13
|
||||
#define CALC_N 14 /* number of planets in placalc module */
|
||||
|
||||
#define CERES 14
|
||||
#define PALLAS 15
|
||||
#define JUNO 16
|
||||
#define VESTA 17
|
||||
#define EARTHHEL 18 /* heliocentric earth */
|
||||
#define PFORTUNAE 19
|
||||
/* next numbers after 19 are reserved for AC, MC, houses, signs;
|
||||
* see further below */
|
||||
#define MEAN_NODE_S 46
|
||||
#define TRUE_NODE_S 47
|
||||
|
||||
#define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */
|
||||
|
||||
/*
|
||||
* progressed planets have the same index (up to MC)
|
||||
* but with offset 50
|
||||
*/
|
||||
# define PROG_PLANET_OFFSET 50 /* progressed sun */
|
||||
# define PROG_OFF 50
|
||||
# define PROG_SUN (SUN + PROG_OFF)
|
||||
# define PROG_MOON (MOON + PROG_OFF)
|
||||
# define PROG_MERCURY (MERCURY + PROG_OFF)
|
||||
# define PROG_VENUS (VENUS + PROG_OFF)
|
||||
# define PROG_MARS (MARS + PROG_OFF)
|
||||
# define PROG_AC (AC + PROG_OFF)
|
||||
# define PROG_ASC (AC + PROG_OFF)
|
||||
# define PROG_MC (MC + PROG_OFF)
|
||||
|
||||
/*
|
||||
* houses and axes get also a 'planet' index number, but they
|
||||
* are not used by placalc itself
|
||||
* between chiron and AC we leave 6 places unused for some other celestial
|
||||
* bodies or chart factors.
|
||||
* Axes and houses cannot be computed with calls to calc(); they must
|
||||
* be computed with the housasp module functions.
|
||||
*/
|
||||
# define AC 20
|
||||
# define ASC 20
|
||||
# define MC 21
|
||||
# define CALC_N_MC 22 /* number of normal natal factors */
|
||||
|
||||
# define FIRST_HSNR 22
|
||||
# define LAST_HSNR 33
|
||||
#define MAX_PL_INDEX (LAST_HSNR + 1) /* don't reckon signs */
|
||||
# define NO_OF_HOUSES 12
|
||||
# define FIRST_SGNR (LAST_HSNR + 1)
|
||||
# define LAST_SGNR (FIRST_SGNR + 11)
|
||||
# define NO_OF_SIGNS 12
|
||||
/*
|
||||
* in a bitlist flag each planet is represented by a bit;
|
||||
* all 14 defined planets can be called at once with
|
||||
*/
|
||||
#define CALC_ALL_PLANET_BITS ((1 << CALC_N) - 1) /* bits 0..13 set */
|
||||
|
||||
/*
|
||||
* AFL: Astrological factor letters for use in selections strings.
|
||||
* Each factor (planet, house cusp etc) has a typical letter which
|
||||
* can be combined in a selection string for specifying a certain
|
||||
* sequence of factors for a table or other kind of display.
|
||||
* The function afl2planet() can be used to translate the AFL letters
|
||||
* into planet indices.
|
||||
* The function planet2afl translates a planext index into the AFL letter.
|
||||
*/
|
||||
|
||||
# define AFL_SUN '0'
|
||||
# define AFL_MON '1'
|
||||
# define AFL_MER '2'
|
||||
# define AFL_VEN '3'
|
||||
# define AFL_MAR '4'
|
||||
# define AFL_JUP '5'
|
||||
# define AFL_SAT '6'
|
||||
# define AFL_URA '7'
|
||||
# define AFL_NEP '8'
|
||||
# define AFL_PLU '9'
|
||||
# define AFL_CHI 'c'
|
||||
# define AFL_LIL 'i' /* mean Lilith: direction of lunar aphel */
|
||||
# define AFL_AC 'A'
|
||||
# define AFL_MC 'M'
|
||||
# define AFL_TNODE 'N' /* TRUE_NODE */
|
||||
# define AFL_MNODE 'n' /* MEAN_NODE */
|
||||
# define AFL_CER 'C'
|
||||
# define AFL_PAL 'P'
|
||||
# define AFL_JUN 'J'
|
||||
# define AFL_VES 'V'
|
||||
|
||||
/*
|
||||
* other AFL definitions not recognized by afl2planet()
|
||||
*/
|
||||
# define AFL_SIDT 's' /* sidereal time */
|
||||
# define AFL_WDAY 'd' /* day of week column */
|
||||
# define AFL_HOUSE 'H' /* any house cusp */
|
||||
|
||||
# define apl2planet afl2planet /* change of original name */
|
||||
|
||||
|
||||
# define J2000 2451545.0 /* Epoch of JPL ephemeris DE200, absolute */
|
||||
# define J1950 2433282.423 /* Epoch of JPL ephemeris DE102 */
|
||||
# define JUL_OFFSET 2433282.0 /* offset of Astrodienst relative Julian date */
|
||||
|
||||
#ifndef GREG_CAL
|
||||
# define GREG_CAL SE_GREG_CAL
|
||||
# define JUL_CAL SE_JUL_CAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* flag bits used in calc and calcserv
|
||||
*/
|
||||
# define CALC_BIT_HELIO 1 /* geo/helio */
|
||||
# define CALC_BIT_NOAPP 2 /* apparent/true positions */
|
||||
# define CALC_BIT_NONUT 4 /* true eq. of date/ mean equ. of date */
|
||||
# define CALC_BIT_EPHE 8 /* universal/ephemeris time */
|
||||
# define CALC_BIT_SPEED 16 /* without/with speed */
|
||||
# define CALC_BIT_BETA 32 /* without/with latitude */
|
||||
# define CALC_BIT_RGEO 64 /* without/with relative rgeo */
|
||||
# define CALC_BIT_RAU 128 /* without/with real radius */
|
||||
# define CALC_BIT_MUST_USE_EPHE 256 /* epheserv may not use calc */
|
||||
# define CALC_BIT_MAY_USE_EPHE 512 /* calcserv may use ephread */
|
||||
# define CALC_BIT_MUST_CALC 1024 /* ephread must calc */
|
||||
|
||||
|
||||
/*
|
||||
* functions exported by swepdate.c
|
||||
*/
|
||||
extern double julday(int month, int day, int year, double hour, int gregflag);
|
||||
extern void revjul (double u, int gregflag,
|
||||
int *jmon, int *jday, int *jyear, double *jut);
|
||||
extern int day_of_week(double t);
|
||||
/*
|
||||
* end swpdate.c
|
||||
*/
|
||||
|
||||
#define MAXPLANETS 16
|
||||
|
||||
/*
|
||||
* definitions for aspect numbering; we always have a name and an angle
|
||||
* due to historical reasons index 0 is unused, conjunct is 1.
|
||||
* We define three different names for the aspects:
|
||||
* ASP_CONJ (always 4 letters), ASP_0 and CONJ.
|
||||
*/
|
||||
# define ASP_CONJ 1
|
||||
# define ASP_0 1
|
||||
# define ASP_OPPO 2
|
||||
# define ASP_180 2
|
||||
# define ASP_SQUA 3
|
||||
# define ASP_90 3
|
||||
# define ASP_TRIN 4
|
||||
# define ASP_120 4
|
||||
# define ASP_SEXT 5
|
||||
# define ASP_60 5
|
||||
# define ASP_SMSX 6
|
||||
# define ASP_30 6
|
||||
# define ASP_QCNX 7
|
||||
# define ASP_150 7
|
||||
# define ASP_SMSQ 8
|
||||
# define ASP_45 8
|
||||
# define ASP_SQSQ 9
|
||||
# define ASP_135 9
|
||||
# define ASP_QINT 10
|
||||
# define ASP_72 10
|
||||
# define ASP_BQIN 11
|
||||
# define ASP_144 11
|
||||
|
||||
# define CONJ ASP_CONJ
|
||||
# define OPPO ASP_OPPO
|
||||
# define SQUA ASP_SQUA
|
||||
# define TRIN ASP_TRIN
|
||||
# define SEXT ASP_SEXT
|
||||
# define SMSX ASP_SMSX
|
||||
# define QCNX ASP_QCNX
|
||||
# define SMSQ ASP_SMSQ
|
||||
# define SQSQ ASP_SQSQ
|
||||
# define QINT ASP_QINT
|
||||
# define BQIN ASP_BQIN
|
||||
|
||||
#define MAXASPECTS ASP_BQIN
|
||||
|
||||
/*
|
||||
* for compact encoding of aspect lists we set bit 1 for CONJ, bit 2 for OPPO
|
||||
* and so on. asp_bit(asp) deleivers the mask.
|
||||
*/
|
||||
#define ALL_ASP_BITS 1022 /* bit mask with all aspect bits set */
|
||||
#define ALL_ASP_BITSQ (1022|bit(ASP_QINT)|bit(ASP_BQIN)) /* bit mask with all aspect bits incl. quintiles/biquint. */
|
||||
#define ALL_ASP_NO30 (HARD_ASP_BITS | asp_bit(ASP_SEXT)|asp_bit(ASP_QCNX)|asp_bit(ASP_SMSQ)|asp_bit(ASP_SQSQ))
|
||||
#define STRONG_ASP_BITS 62 /* bit mask with strong aspect bits set */
|
||||
#define HARD_ASP_BITS 14 /* bit mask with hard aspect bits set */
|
||||
|
||||
#define asp_bit(asp) (1 << (asp))
|
||||
|
||||
/*
|
||||
* sometimes it is desirable to have a compact way to express planet-aspect
|
||||
* combinations.
|
||||
* We define PASP(planet,aspect) as a constant, 100*planet + aspect.
|
||||
* We can then write things like:
|
||||
* case PASP(PLUTO, JONJ): ...
|
||||
* A definition like p << 8 + a would be faster but the combinations would
|
||||
* be harder to read.
|
||||
*/
|
||||
#define PASP(p,a) (100*(p) + (a))
|
||||
|
||||
/*
|
||||
* used to initialize an array centisec angles[MAXASPECTS+1]
|
||||
*/
|
||||
# define ASP_ANGLES {0, 0*DEG, 180*DEG, 90*DEG, 120*DEG,\
|
||||
60*DEG, 30*DEG, 150*DEG, 45*DEG, 135*DEG, 72*DEG, 144*DEG}
|
||||
|
||||
struct AspectType {
|
||||
AS_BOOL dataValid; /* used as boolean */
|
||||
int NrOfPlanets,
|
||||
NrOfAspects;
|
||||
centisec *PlanetPos; /* pointer to an array of planet positions
|
||||
[0..NrOfPlanets-1]; the user of the
|
||||
structure must set this pointer to his
|
||||
array of planet positions */
|
||||
centisec *ppos2; /* second set for mutual aspects only; if
|
||||
not NULL, interaspects are calculated */
|
||||
centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of
|
||||
maximum orbes; element[0] not used;
|
||||
the user of the structure must set this
|
||||
pointer to his array of maxorbs */
|
||||
centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the
|
||||
angles of aspects; [0] not used; the
|
||||
user must set this pointer to his array
|
||||
of angles */
|
||||
struct aspRec {
|
||||
int index; /* number of the found aspect */
|
||||
centisec orb;
|
||||
}
|
||||
Asp[MAXPLANETS][MAXPLANETS];
|
||||
};
|
||||
|
||||
struct houses {
|
||||
centisec cusp[13];
|
||||
centisec ac;
|
||||
centisec mc;
|
||||
};
|
||||
|
||||
# define HOUSES struct houses
|
||||
|
||||
extern int HouseNr(HOUSES *h, CSEC p);
|
||||
/*
|
||||
return in which house pp is,
|
||||
The caller is responsible for proper initialization of cusps
|
||||
*/
|
||||
|
||||
extern int InpHouseNr(HOUSES *h, CSEC p, CSEC *cuspoff);
|
||||
/* returns the interpretation-house number, where pp is in;
|
||||
* an interpretation house is defined differently from a normal
|
||||
* house: the cusps are offset, so that it begins and ends
|
||||
* a little earlier.
|
||||
* cusp[1..12] and cuspoff[1..12] must be initialized
|
||||
*/
|
||||
extern int InpHouseNr2(HOUSES *h, CSEC p, CSEC *cuspoff);
|
||||
/* variation of InpHouseNr(). Comment in swepcalc.c */
|
||||
|
||||
extern void CalcHouses(CSEC th, CSEC fi, CSEC ekl, char hsy, int icnt,
|
||||
struct houses *h);
|
||||
|
||||
extern void RecalcAspects(struct AspectType *a);
|
||||
|
||||
extern void longreorder (UCHAR *p, int n);
|
||||
|
||||
|
||||
#endif /* _SWEPCALC_INCLUDED */
|
||||
222
lib/sweph/swepdate.c
Normal file
222
lib/sweph/swepdate.c
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
/*****************************************************
|
||||
$Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $
|
||||
Placalc compatibility interface for Swiss Ephemeris.
|
||||
date functions
|
||||
|
||||
*******************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of the PLACALC compatibility interface for Swiss Ephemeris.
|
||||
* It allows very easy porting of older Placalc application to the SwissEph.
|
||||
* A user has to replace #include "placalc.h" and "housasp.h" with
|
||||
* #include "swepcalc.h"
|
||||
* If he has used "ourdef.h" he replaces it with "sweodef.h".
|
||||
* Then he links his application with swepcalc.o and runs it against the
|
||||
* Swiss Ephemeris DLL or linkable library.
|
||||
*
|
||||
* All calls which were present in the placalc sources are contained
|
||||
* here, and either implemented directly or translated into Swiss Ephemeris
|
||||
* calls.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "swepcalc.h"
|
||||
#include "swephexp.h"
|
||||
|
||||
/*************** julday ********************************************
|
||||
* This function returns the absolute Julian day number (JD)
|
||||
* for a given calendar date.
|
||||
* The arguments are a calendar date: day, month, year as integers,
|
||||
* hour as double with decimal fraction.
|
||||
* If gregflag = 1, Gregorian calendar is assumed, gregflag = 0
|
||||
* Julian calendar is assumed.
|
||||
*
|
||||
The Julian day number is system of numbering all days continously
|
||||
within the time range of known human history. It should be familiar
|
||||
for every astrological or astronomical programmer. The time variable
|
||||
in astronomical theories is usually expressed in Julian days or
|
||||
Julian centuries (36525 days per century) relative to some start day;
|
||||
the start day is called 'the epoch'.
|
||||
The Julian day number is a double representing the number of
|
||||
days since JD = 0.0 on 1 Jan -4712, 12:00 noon.
|
||||
|
||||
Midnight has always a JD with fraction .5, because traditionally
|
||||
the astronomical day started at noon. This was practical because
|
||||
then there was no change of date during a night at the telescope.
|
||||
From this comes also the fact the noon ephemerides were printed
|
||||
before midnight ephemerides were introduced early in the 20th century.
|
||||
|
||||
NOTE: The Julian day number is named after the monk Julianus. It must
|
||||
not be confused with the Julian calendar system, which is named after
|
||||
Julius Cesar, the Roman politician who introduced this calendar.
|
||||
The Julian century is named after Cesar, i.e. a century in the Julian
|
||||
calendar. The 'gregorian' century has a variable length.
|
||||
|
||||
Be aware the we always use astronomical year numbering for the years
|
||||
before Christ, not the historical year numbering.
|
||||
Astronomical years are done with negative numbers, historical
|
||||
years with indicators BC or BCE (before common era).
|
||||
Year 0 (astronomical) = 1 BC
|
||||
year -1 (astronomical) = 2 BC
|
||||
etc.
|
||||
|
||||
Original author: Marc Pottenger, Los Angeles.
|
||||
with bug fix for year < -4711 15-aug-88 by Alois Treindl
|
||||
(The parameter sequence m,d,y still indicates the US origin,
|
||||
be careful because the similar function date_conversion() uses
|
||||
other parameter sequence and also Astrodienst relative juldate.)
|
||||
|
||||
References: Oliver Montenbruck, Grundlagen der Ephemeridenrechnung,
|
||||
Verlag Sterne und Weltraum (1987), p.49 ff
|
||||
|
||||
related functions: revjul() reverse Julian day number: compute the
|
||||
calendar date from a given JD
|
||||
date_conversion() includes test for legal date values
|
||||
and notifies errors like 32 January.
|
||||
****************************************************************/
|
||||
|
||||
double julday(int month, int day, int year, double hour, int gregflag)
|
||||
{
|
||||
double jd;
|
||||
jd = swe_julday(year, month, day, hour, gregflag);
|
||||
return jd;
|
||||
}
|
||||
|
||||
/*
|
||||
* monday = 0, ... sunday = 6
|
||||
*/
|
||||
int day_of_week(double jd)
|
||||
{
|
||||
return (((int) floor (jd - 2433282 - 1.5) %7) + 7) % 7;
|
||||
}
|
||||
|
||||
|
||||
/*** revjul ******************************************************
|
||||
revjul() is the inverse function to julday(), see the description
|
||||
there.
|
||||
Arguments are julian day number, calendar flag (0=julian, 1=gregorian)
|
||||
return values are the calendar day, month, year and the hour of
|
||||
the day with decimal fraction (0 .. 23.999999).
|
||||
|
||||
Be aware the we use astronomical year numbering for the years
|
||||
before Christ, not the historical year numbering.
|
||||
Astronomical years are done with negative numbers, historical
|
||||
years with indicators BC or BCE (before common era).
|
||||
Year 0 (astronomical) = 1 BC historical year
|
||||
year -1 (astronomical) = 2 BC historical year
|
||||
year -234 (astronomical) = 235 BC historical year
|
||||
etc.
|
||||
|
||||
Original author Mark Pottenger, Los Angeles.
|
||||
with bug fix for year < -4711 16-aug-88 Alois Treindl
|
||||
*************************************************************************/
|
||||
void revjul (double jd, int gregflag,
|
||||
int *jmon, int *jday, int *jyear, double *jut)
|
||||
{
|
||||
swe_revjul(jd, gregflag, jyear, jmon, jday, jut);
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
$Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $
|
||||
version 15-feb-89 16:30
|
||||
|
||||
This function converts some date+time input {d,m,y,utime}
|
||||
into the Julian day number tgmt, which is an Astrodienst relative
|
||||
Julian date.
|
||||
The function checks that the input is a legal combination
|
||||
of dates; for illegal dates like 32 January 1993 it returns ERR
|
||||
but still converts the date correctly, i.e. like 1 Feb 1993.
|
||||
The function is usually used to convert user input of birth data
|
||||
into the Julian day number. Illegal dates should be notified to the user.
|
||||
|
||||
Be aware the we always use astronomical year numbering for the years
|
||||
before Christ, not the historical year numbering.
|
||||
Astronomical years are done with negative numbers, historical
|
||||
years with indicators BC or BCE (before common era).
|
||||
Year 0 (astronomical) = 1 BC historical.
|
||||
year -1 (astronomical) = 2 BC
|
||||
etc.
|
||||
Many users of Astro programs do not know about this difference.
|
||||
|
||||
Return: OK or ERR (for illegal date)
|
||||
*********************************************************/
|
||||
|
||||
int date_conversion (int d ,
|
||||
int m ,
|
||||
int y , /* day, month, year */
|
||||
centisec gutime, /* greenwich time in centiseconds */
|
||||
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
|
||||
double *tgmt
|
||||
/* julian date relative 0.Jan.1950 12:00 gmt */
|
||||
/* shift is 2433282 from absolute Julian date */
|
||||
)
|
||||
{
|
||||
int rday, rmon, ryear;
|
||||
double rut, jd;
|
||||
int gregflag = SE_JUL_CAL;
|
||||
if (c == 'g' || c == 'a')
|
||||
gregflag = SE_GREG_CAL;
|
||||
rut = gutime / 360000.0; /* hours GMT */
|
||||
jd = julday(m, d, y, rut, gregflag);
|
||||
revjul(jd, gregflag, &rmon, &rday, &ryear, &rut);
|
||||
*tgmt = jd - JUL_OFFSET;
|
||||
if (rmon == m && rday == d && ryear == y) {
|
||||
return OK;
|
||||
} else {
|
||||
return ERR;
|
||||
}
|
||||
} /* end date_conversion */
|
||||
7892
lib/sweph/sweph.c
Normal file
7892
lib/sweph/sweph.c
Normal file
File diff suppressed because it is too large
Load diff
664
lib/sweph/sweph.h
Normal file
664
lib/sweph/sweph.h
Normal file
|
|
@ -0,0 +1,664 @@
|
|||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/sweph.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
definitions and constants SWISSEPH
|
||||
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
/*
|
||||
* move over from swephexp.h
|
||||
*/
|
||||
|
||||
#define SE_VERSION "2.07.01"
|
||||
|
||||
#define J2000 2451545.0 /* 2000 January 1.5 */
|
||||
#define B1950 2433282.42345905 /* 1950 January 0.923 */
|
||||
#define J1900 2415020.0 /* 1900 January 0.5 */
|
||||
|
||||
#define MPC_CERES 1
|
||||
#define MPC_PALLAS 2
|
||||
#define MPC_JUNO 3
|
||||
#define MPC_VESTA 4
|
||||
#define MPC_CHIRON 2060
|
||||
#define MPC_PHOLUS 5145
|
||||
|
||||
#define SE_NAME_SUN "Sun"
|
||||
#define SE_NAME_MOON "Moon"
|
||||
#define SE_NAME_MERCURY "Mercury"
|
||||
#define SE_NAME_VENUS "Venus"
|
||||
#define SE_NAME_MARS "Mars"
|
||||
#define SE_NAME_JUPITER "Jupiter"
|
||||
#define SE_NAME_SATURN "Saturn"
|
||||
#define SE_NAME_URANUS "Uranus"
|
||||
#define SE_NAME_NEPTUNE "Neptune"
|
||||
#define SE_NAME_PLUTO "Pluto"
|
||||
#define SE_NAME_MEAN_NODE "mean Node"
|
||||
#define SE_NAME_TRUE_NODE "true Node"
|
||||
#define SE_NAME_MEAN_APOG "mean Apogee"
|
||||
#define SE_NAME_OSCU_APOG "osc. Apogee"
|
||||
#define SE_NAME_INTP_APOG "intp. Apogee"
|
||||
#define SE_NAME_INTP_PERG "intp. Perigee"
|
||||
#define SE_NAME_EARTH "Earth"
|
||||
#define SE_NAME_CERES "Ceres"
|
||||
#define SE_NAME_PALLAS "Pallas"
|
||||
#define SE_NAME_JUNO "Juno"
|
||||
#define SE_NAME_VESTA "Vesta"
|
||||
#define SE_NAME_CHIRON "Chiron"
|
||||
#define SE_NAME_PHOLUS "Pholus"
|
||||
|
||||
|
||||
#define SE_NAME_CUPIDO "Cupido"
|
||||
#define SE_NAME_HADES "Hades"
|
||||
#define SE_NAME_ZEUS "Zeus"
|
||||
#define SE_NAME_KRONOS "Kronos"
|
||||
#define SE_NAME_APOLLON "Apollon"
|
||||
#define SE_NAME_ADMETOS "Admetos"
|
||||
#define SE_NAME_VULKANUS "Vulkanus"
|
||||
#define SE_NAME_POSEIDON "Poseidon"
|
||||
#define SE_NAME_ISIS "Isis"
|
||||
#define SE_NAME_NIBIRU "Nibiru"
|
||||
#define SE_NAME_HARRINGTON "Harrington"
|
||||
#define SE_NAME_NEPTUNE_LEVERRIER "Leverrier"
|
||||
#define SE_NAME_NEPTUNE_ADAMS "Adams"
|
||||
#define SE_NAME_PLUTO_LOWELL "Lowell"
|
||||
#define SE_NAME_PLUTO_PICKERING "Pickering"
|
||||
#define SE_NAME_VULCAN "Vulcan"
|
||||
#define SE_NAME_WHITE_MOON "White Moon"
|
||||
|
||||
/*
|
||||
* earlier content
|
||||
*/
|
||||
|
||||
#define PI M_PI /* 3.14159265358979323846, math.h */
|
||||
#define TWOPI (2.0 * PI)
|
||||
|
||||
#define ENDMARK -99
|
||||
|
||||
#define SEI_EPSILON -2
|
||||
#define SEI_NUTATION -1
|
||||
#define SEI_EMB 0
|
||||
#define SEI_EARTH 0
|
||||
#define SEI_SUN 0
|
||||
#define SEI_MOON 1
|
||||
#define SEI_MERCURY 2
|
||||
#define SEI_VENUS 3
|
||||
#define SEI_MARS 4
|
||||
#define SEI_JUPITER 5
|
||||
#define SEI_SATURN 6
|
||||
#define SEI_URANUS 7
|
||||
#define SEI_NEPTUNE 8
|
||||
#define SEI_PLUTO 9
|
||||
#define SEI_SUNBARY 10 /* barycentric sun */
|
||||
#define SEI_ANYBODY 11 /* any asteroid */
|
||||
#define SEI_CHIRON 12
|
||||
#define SEI_PHOLUS 13
|
||||
#define SEI_CERES 14
|
||||
#define SEI_PALLAS 15
|
||||
#define SEI_JUNO 16
|
||||
#define SEI_VESTA 17
|
||||
|
||||
#define SEI_NPLANETS 18
|
||||
|
||||
#define SEI_MEAN_NODE 0
|
||||
#define SEI_TRUE_NODE 1
|
||||
#define SEI_MEAN_APOG 2
|
||||
#define SEI_OSCU_APOG 3
|
||||
#define SEI_INTP_APOG 4
|
||||
#define SEI_INTP_PERG 5
|
||||
|
||||
#define SEI_NNODE_ETC 6
|
||||
|
||||
#define SEI_FLG_HELIO 1
|
||||
#define SEI_FLG_ROTATE 2
|
||||
#define SEI_FLG_ELLIPSE 4
|
||||
#define SEI_FLG_EMBHEL 8 /* TRUE, if heliocentric earth is given
|
||||
* instead of barycentric sun
|
||||
* i.e. bary sun is computed from
|
||||
* barycentric and heliocentric earth */
|
||||
|
||||
#define SEI_FILE_PLANET 0
|
||||
#define SEI_FILE_MOON 1
|
||||
#define SEI_FILE_MAIN_AST 2
|
||||
#define SEI_FILE_ANY_AST 3
|
||||
#define SEI_FILE_FIXSTAR 4
|
||||
|
||||
#if 0
|
||||
#define SEI_FILE_TEST_ENDIAN (97L * 65536L + 98L * 256L + 99L) /*abc*/
|
||||
#endif
|
||||
#define SEI_FILE_TEST_ENDIAN (0x616263L) /* abc*/
|
||||
#define SEI_FILE_BIGENDIAN 0
|
||||
#define SEI_FILE_NOREORD 0
|
||||
#define SEI_FILE_LITENDIAN 1
|
||||
#define SEI_FILE_REORD 2
|
||||
|
||||
#define SEI_FILE_NMAXPLAN 50
|
||||
#define SEI_FILE_EFPOSBEGIN 500
|
||||
|
||||
#define SE_FILE_SUFFIX "se1"
|
||||
|
||||
#define SEI_NEPHFILES 7
|
||||
#define SEI_CURR_FPOS -1
|
||||
#define SEI_NMODELS 8
|
||||
|
||||
#define SEI_ECL_GEOALT_MAX 25000.0
|
||||
#define SEI_ECL_GEOALT_MIN (-500.0)
|
||||
|
||||
/* Chiron's orbit becomes chaotic
|
||||
* before 720 AD and after 4606 AD, because of close encounters
|
||||
* with Saturn. Accepting a maximum error of 5 degrees,
|
||||
* the ephemeris is good between the following dates:
|
||||
*/
|
||||
/*#define CHIRON_START 1958470.5 * 1.1.650 old limit until v. 2.00 */
|
||||
#define CHIRON_START 1967601.5 /* 1.1.675 */
|
||||
#define CHIRON_END 3419437.5 /* 1.1.4650 */
|
||||
|
||||
/* Pholus's orbit is unstable as well, because he sometimes
|
||||
* approaches Saturn.
|
||||
* Accepting a maximum error of 5 degrees,
|
||||
* the ephemeris is good after the following date:
|
||||
*/
|
||||
/* #define PHOLUS_START 314845.5 * 1.1.-3850 old limit until v. 2.00 */
|
||||
#define PHOLUS_START 640648.5 /* 1.1.-2958 jul */
|
||||
#define PHOLUS_END 4390617.5 /* 1.1.7309 */
|
||||
|
||||
#define MOSHPLEPH_START 625000.5
|
||||
#define MOSHPLEPH_END 2818000.5
|
||||
#define MOSHLUEPH_START 625000.5
|
||||
#define MOSHLUEPH_END 2818000.5
|
||||
/*#define MOSHNDEPH_START -254900.5 */ /* 14 Feb -5410 00:00 ET jul.cal.*/
|
||||
/*#define MOSHNDEPH_END 3697000.5 */ /* 11 Dec 5409 00:00 ET, greg. cal */
|
||||
#define MOSHNDEPH_START -3100015.5 /* 15 Aug -13200 00:00 ET jul.cal.*/
|
||||
#define MOSHNDEPH_END 8000016.5 /* 15 Mar 17191 00:00 ET, greg. cal */
|
||||
/*
|
||||
#define MOSHPLEPH_START -225000.5
|
||||
#define MOSHPLEPH_END 3600000.5
|
||||
#define MOSHLUEPH_START -225000.5
|
||||
#define MOSHLUEPH_END 3600000.5
|
||||
*/
|
||||
#define JPL_DE431_START -3027215.5
|
||||
#define JPL_DE431_END 7930192.5
|
||||
|
||||
#if FALSE /* Alois commented out, not used anywhere */
|
||||
#define JPLEPH_START 625307.5 /* about -3000 (DE406) */
|
||||
#define JPLEPH_END 2816848.5 /* about 3000 (DE406) */
|
||||
#define SWIEPH_START 625614.927151
|
||||
#define SWIEPH_END 2813641.5
|
||||
#define ALLEPH_START MOSHPLEPH_START
|
||||
#define ALLEPH_END MOSHPLEPH_END
|
||||
#define BEG_YEAR (-3000)
|
||||
#define END_YEAR 3000
|
||||
#endif
|
||||
|
||||
#define MAXORD 40
|
||||
|
||||
#define NCTIES 6.0 /* number of centuries per eph. file */
|
||||
|
||||
#define OK (0)
|
||||
#define ERR (-1)
|
||||
#define NOT_AVAILABLE (-2)
|
||||
#define BEYOND_EPH_LIMITS (-3)
|
||||
|
||||
#define J_TO_J2000 1
|
||||
#define J2000_TO_J -1
|
||||
|
||||
/* we always use Astronomical Almanac constants, if available */
|
||||
#define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */
|
||||
#define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */
|
||||
#define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */
|
||||
/* #define SUN_EARTH_MRAT 328900.561400 Su/(Ea+Mo) AA 2006 K7 */
|
||||
#define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) AA 2006 K7 */
|
||||
#define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */
|
||||
#if 0
|
||||
#define EARTH_MOON_MRAT 81.30056907419062 /* de431 */
|
||||
#endif
|
||||
#if 0
|
||||
#define EARTH_MOON_MRAT 81.30056 /* de406 */
|
||||
#endif
|
||||
#define AUNIT 1.49597870691e+11 /* au in meters, AA 2006 K6 */
|
||||
#define CLIGHT 2.99792458e+8 /* m/s, AA 1996 K6 */
|
||||
#if 0
|
||||
#define HELGRAVCONST 1.32712438e+20 /* G * M(sun), m^3/sec^2, AA 1996 K6 */
|
||||
#endif
|
||||
#define HELGRAVCONST 1.32712440017987e+20 /* G * M(sun), m^3/sec^2, AA 2006 K6 */
|
||||
#define GEOGCONST 3.98600448e+14 /* G * M(earth) m^3/sec^2, AA 1996 K6 */
|
||||
#define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */
|
||||
#define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */
|
||||
#define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */
|
||||
//#define EARTH_OBLATENESS (1.0/ 298.257223563) /* AA 1998 K13 */
|
||||
#define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */
|
||||
#define EARTH_ROT_SPEED (7.2921151467e-5 * 86400) /* in rad/day, expl. suppl., p 162 */
|
||||
|
||||
#define LIGHTTIME_AUNIT (499.0047838061/3600/24) /* 8.3167 minutes (days), AA 2006 K6 */
|
||||
#define PARSEC_TO_AUNIT 206264.8062471 /* 648000/PI, according to IAU Resolution B2, 2016 */
|
||||
|
||||
/* node of ecliptic measured on ecliptic 2000 */
|
||||
#define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD)
|
||||
/* node of ecliptic measured on solar system rotation plane */
|
||||
#define SSY_PLANE_NODE (107.58883388 * DEGTORAD)
|
||||
/* inclination of ecliptic against solar system rotation plane */
|
||||
#define SSY_PLANE_INCL (1.578701 * DEGTORAD)
|
||||
|
||||
#define KM_S_TO_AU_CTY 21.095 /* km/s to AU/century */
|
||||
#define MOON_SPEED_INTV 0.00005 /* 4.32 seconds (in days) */
|
||||
#define PLAN_SPEED_INTV 0.0001 /* 8.64 seconds (in days) */
|
||||
#define MEAN_NODE_SPEED_INTV 0.001
|
||||
#define NODE_CALC_INTV 0.0001
|
||||
#define NODE_CALC_INTV_MOSH 0.1
|
||||
#define NUT_SPEED_INTV 0.0001
|
||||
#define DEFL_SPEED_INTV 0.0000005
|
||||
|
||||
#define SE_LAPSE_RATE 0.0065 /* deg K / m, for refraction */
|
||||
|
||||
#define square_sum(x) (x[0]*x[0]+x[1]*x[1]+x[2]*x[2])
|
||||
#define dot_prod(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
|
||||
|
||||
#define PNOINT2JPL {J_EARTH, J_MOON, J_MERCURY, J_VENUS, J_MARS, J_JUPITER, J_SATURN, J_URANUS, J_NEPTUNE, J_PLUTO, J_SUN, }
|
||||
|
||||
/* planetary radii in meters */
|
||||
#define NDIAM (SE_VESTA + 1)
|
||||
static const double pla_diam[NDIAM] = {1392000000.0, /* Sun */
|
||||
3476300.0, /* Moon */
|
||||
2439000.0 * 2, /* Mercury */
|
||||
6052000.0 * 2, /* Venus */
|
||||
3397200.0 * 2, /* Mars */
|
||||
71398000.0 * 2, /* Jupiter */
|
||||
60000000.0 * 2, /* Saturn */
|
||||
25400000.0 * 2, /* Uranus */
|
||||
24300000.0 * 2, /* Neptune */
|
||||
2500000.0 * 2, /* Pluto */
|
||||
0, 0, 0, 0, /* nodes and apogees */
|
||||
6378140.0 * 2, /* Earth */
|
||||
0.0, /* Chiron */
|
||||
0.0, /* Pholus */
|
||||
913000.0, /* Ceres */
|
||||
523000.0, /* Pallas */
|
||||
244000.0, /* Juno */
|
||||
501000.0, /* Vesta */
|
||||
};
|
||||
|
||||
|
||||
/* Ayanamsas
|
||||
* For each ayanamsa, there are the following values:
|
||||
* t0 epoch of ayanamsa, TDT (can be ET or UT)
|
||||
* ayan_t0 ayanamsa value at epoch
|
||||
* t0_is_UT true, if t0 is UT
|
||||
*/
|
||||
struct aya_init {double t0, ayan_t0; AS_BOOL t0_is_UT;};
|
||||
static const struct aya_init ayanamsa[] = {
|
||||
{2433282.5, 24.042044444, FALSE}, /* 0: Fagan/Bradley (Default) */
|
||||
/*{J1900, 360 - 337.53953}, * 1: Lahiri (Robert Hand) */
|
||||
{2435553.5, 23.250182778 - 0.004660222, FALSE},
|
||||
/* 1: Lahiri (derived from: Indian
|
||||
* Astronomical Ephemeris 1989, p. 556;
|
||||
* the subtracted value is nutation) */
|
||||
{J1900, 360 - 333.58695, FALSE}, /* 2: Robert DeLuce (Constellational Astrology ... p. 5 */
|
||||
{J1900, 360 - 338.98556, FALSE}, /* 3: B.V. Raman (Robert Hand) */
|
||||
{J1900, 360 - 341.33904, FALSE}, /* 4: Usha/Shashi (Robert Hand) */
|
||||
{J1900, 360 - 337.636111, FALSE}, /* 5: Krishnamurti (Robert Hand) */
|
||||
{J1900, 360 - 333.0369024, FALSE}, /* 6: Djwhal Khool; (Graham Dawson)
|
||||
* Aquarius entered on 1 July 2117 */
|
||||
{J1900, 360 - 338.917778, FALSE}, /* 7: Shri Yukteshwar; (David Cochrane) */
|
||||
//{2412543.5, 20.91, TRUE}, /* 7: Shri Yukteshwar; (Holy Science, p. xx) */
|
||||
{J1900, 360 - 338.634444, FALSE}, /* 8: J.N. Bhasin; (David Cochrane) */
|
||||
{1684532.5, -3.36667, TRUE}, /* 9: Babylonian, Kugler 1 */
|
||||
{1684532.5, -4.76667, TRUE}, /*10: Babylonian, Kugler 2 */
|
||||
{1684532.5, -5.61667, TRUE}, /*11: Babylonian, Kugler 3 */
|
||||
{1684532.5, -4.46667, TRUE}, /*12: Babylonian, Huber */
|
||||
/*{1684532.5, -4.56667, TRUE}, *12: Babylonian, Huber (Swisseph has been wrong for many years!) */
|
||||
{1673941, -5.079167, TRUE}, /*13: Babylonian, Mercier;
|
||||
* eta Piscium culminates with zero point */
|
||||
{1684532.5, -4.44088389, TRUE}, /*14: t0 is defined by Aldebaran at 15 Taurus */
|
||||
{1674484, -9.33333, TRUE}, /*15: Hipparchos */
|
||||
{1927135.8747793, 0, TRUE}, /*16: Sassanian */
|
||||
//{1746412.236, 0, FALSE}, /*17: Galactic Center at 0 Sagittarius */
|
||||
{0, 0, FALSE}, /*17: Galactic Center at 0 Sagittarius */
|
||||
{J2000, 0, FALSE}, /*18: J2000 */
|
||||
{J1900, 0, FALSE}, /*19: J1900 */
|
||||
{B1950, 0, FALSE}, /*20: B1950 */
|
||||
{1903396.8128654, 0, TRUE}, /*21: Suryasiddhanta, assuming
|
||||
ingress of mean Sun into Aries at point
|
||||
of mean equinox of date on
|
||||
21.3.499, noon, Ujjain (75.7684565 E)
|
||||
= 7:30:31.57 UT */
|
||||
{1903396.8128654,-0.21463395, TRUE}, /*22: Suryasiddhanta, assuming
|
||||
ingress of mean Sun into Aries at
|
||||
true position of mean Sun at same epoch */
|
||||
{1903396.7895321, 0, TRUE}, /*23: Aryabhata, same date, but UT 6:56:55.57
|
||||
analogous 21 */
|
||||
{1903396.7895321,-0.23763238, TRUE}, /*24: Aryabhata, analogous 22 */
|
||||
{1903396.8128654,-0.79167046, TRUE}, /*25: SS, Revati/zePsc at polar long. 359°50'*/
|
||||
{1903396.8128654, 2.11070444, TRUE}, /*26: SS, Citra/Spica at polar long. 180° */
|
||||
{0, 0, FALSE}, /*27: True Citra (Spica exactly at 0 Libra) */
|
||||
{0, 0, FALSE}, /*28: True Revati (zeta Psc exactly at 29°50' Pisces) */
|
||||
{0, 0, FALSE}, /*29: True Pushya (delta Cnc exactly a 16 Cancer */
|
||||
{0, 0, FALSE}, /*30: R. Gil Brand; Galactic Center at golden section
|
||||
between 0 Sco and 0 Aqu; note: 0° Aqu/Leo is
|
||||
the symmetric axis of rulerships */
|
||||
{0, 0, FALSE}, /*31: Galactic Equator IAU 1958, i.e. galactic/ecliptic
|
||||
intersection point based on galactic coordinate system */
|
||||
{0, 0, FALSE}, /*32: Galactic Equator True, i.e. galactic/ecliptic
|
||||
intersection point based on the galactic pole as given in:
|
||||
Liu/Zhu/Zhang, „Reconsidering the galactic
|
||||
coordinate system“, A & A No. AA2010, Oct. 2010 */
|
||||
{0, 0, FALSE}, /*33: Galactic Equator Mula, i.e. galactic/ecliptic
|
||||
intersection point in the middle of lunar mansion Mula */
|
||||
{2451079.734892000, 30, FALSE}, /*34: Skydram/Galactic Alignment (R. Mardyks);
|
||||
autumn equinox aligned with Galactic Equator/Pole */
|
||||
{0, 0, FALSE}, /*35: Chandra Hari */
|
||||
{0, 0, FALSE}, /*36: Dhruva Galactic Centre Middle of Mula (Ernst Wilhelm) */
|
||||
{1911797.740782065, 0, TRUE}, /*37: Kali 3623 = 522 CE, Ujjain (75.7684565),
|
||||
* based on Kali midnight and SS year length */
|
||||
{1721057.5, -3.2, TRUE}, /*38: Babylonian (Britton 2010) */
|
||||
{0, 0, FALSE}, /*39: Sunil Sheoran ("Vedic") */
|
||||
/*{0, 0, FALSE}, *40: Galactic Center at 0 Capricon (Cochrane) */
|
||||
/*{2061539.789532065, 6.83333333, TRUE}, *41: Manjula's Laghumanasa, 10 March 932,
|
||||
* 12 PM LMT Ujjain (75.7684565 E),
|
||||
* ayanamsha = 6°50' */
|
||||
{0, 0, FALSE}, /*40: - */
|
||||
};
|
||||
|
||||
#define PLAN_DATA struct plan_data
|
||||
|
||||
/* obliquity of ecliptic */
|
||||
struct epsilon {
|
||||
double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
|
||||
};
|
||||
|
||||
/*
|
||||
extern struct epsilon oec2000;
|
||||
extern struct epsilon oec;
|
||||
*/
|
||||
|
||||
struct plan_data {
|
||||
/* the following data are read from file only once, immediately after
|
||||
* file has been opened */
|
||||
int ibdy; /* internal body number */
|
||||
int32 iflg; /* contains several bit flags describing the data:
|
||||
* SEI_FLG_HELIO: true if helio, false if bary
|
||||
* SEI_FLG_ROTATE: TRUE if coefficients are referred
|
||||
* to coordinate system of orbital plane
|
||||
* SEI_FLG_ELLIPSE: TRUE if reference ellipse */
|
||||
int ncoe; /* # of coefficients of ephemeris polynomial,
|
||||
is polynomial order + 1 */
|
||||
/* where is the segment index on the file */
|
||||
int32 lndx0; /* file position of begin of planet's index */
|
||||
int32 nndx; /* number of index entries on file: computed */
|
||||
double tfstart; /* file contains ephemeris for tfstart thru tfend */
|
||||
double tfend; /* for this particular planet !!! */
|
||||
double dseg; /* segment size (days covered by a polynomial) */
|
||||
/* orbital elements: */
|
||||
double telem; /* epoch of elements */
|
||||
double prot;
|
||||
double qrot;
|
||||
double dprot;
|
||||
double dqrot;
|
||||
double rmax; /* normalisation factor of cheby coefficients */
|
||||
/* in addition, if reference ellipse is used: */
|
||||
double peri;
|
||||
double dperi;
|
||||
double *refep; /* pointer to cheby coeffs of reference ellipse,
|
||||
* size of data is 2 x ncoe */
|
||||
/* unpacked segment information, only updated when a segment is read: */
|
||||
double tseg0, tseg1; /* start and end jd of current segment */
|
||||
double *segp; /* pointer to unpacked cheby coeffs of segment;
|
||||
* the size is 3 x ncoe */
|
||||
int neval; /* how many coefficients to evaluate. this may
|
||||
* be less than ncoe */
|
||||
/* result of most recent data evaluation for this body: */
|
||||
double teval; /* time for which previous computation was made */
|
||||
int32 iephe; /* which ephemeris was used */
|
||||
double x[6]; /* position and speed vectors equatorial J2000 */
|
||||
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
|
||||
double xreturn[24]; /* return positions:
|
||||
* xreturn+0 ecliptic polar coordinates
|
||||
* xreturn+6 ecliptic cartesian coordinates
|
||||
* xreturn+12 equatorial polar coordinates
|
||||
* xreturn+18 equatorial cartesian coordinates
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
* stuff exported from swemplan.c and swemmoon.c
|
||||
* and constants used inside these functions.
|
||||
************************************************************/
|
||||
|
||||
#define STR 4.8481368110953599359e-6 /* radians per arc second */
|
||||
|
||||
/* moon, s. moshmoon.c */
|
||||
extern int swi_mean_node(double jd, double *x, char *serr);
|
||||
extern int swi_mean_apog(double jd, double *x, char *serr);
|
||||
extern int swi_moshmoon(double tjd, AS_BOOL do_save, double *xpm, char *serr) ;
|
||||
extern int swi_moshmoon2(double jd, double *x);
|
||||
extern int swi_intp_apsides(double J, double *pol, int ipli);
|
||||
|
||||
/* planets, s. moshplan.c */
|
||||
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr);
|
||||
extern int swi_moshplan2(double J, int iplm, double *pobj);
|
||||
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr);
|
||||
extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr);
|
||||
extern int32 swi_init_swed_if_start(void);
|
||||
extern int32 swi_set_tid_acc(double tjd_ut, int32 iflag, int32 denum, char *serr);
|
||||
extern int32 swi_get_tid_acc(double tjd_ut, int32 iflag, int32 denum, int32 *denumret, double *tid_acc, char *serr);
|
||||
|
||||
extern int32 swi_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr);
|
||||
extern int32 swi_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr);
|
||||
extern int32 swi_get_ayanamsa_with_speed(double tjd_et, int32 iflag, double *daya, char *serr);
|
||||
|
||||
extern double swi_armc_to_mc(double armc, double eps);
|
||||
|
||||
extern int32 swi_get_denum(int32 ipli, int32 iflag);
|
||||
|
||||
|
||||
/* nutation */
|
||||
struct nut {
|
||||
double tnut;
|
||||
double nutlo[2]; /* nutation in longitude and obliquity */
|
||||
double snut, cnut; /* sine and cosine of nutation in obliquity */
|
||||
double matrix[3][3];
|
||||
};
|
||||
|
||||
struct plantbl {
|
||||
char max_harmonic[9];
|
||||
char max_power_of_t;
|
||||
signed char *arg_tbl;
|
||||
double *lon_tbl;
|
||||
double *lat_tbl;
|
||||
double *rad_tbl;
|
||||
double distance;
|
||||
};
|
||||
|
||||
struct file_data {
|
||||
char fnam[AS_MAXCH]; /* ephemeris file name */
|
||||
int fversion; /* version number of file */
|
||||
char astnam[50]; /* asteroid name, if asteroid file */
|
||||
int32 sweph_denum; /* DE number of JPL ephemeris, which this file
|
||||
* is derived from. */
|
||||
FILE *fptr; /* ephemeris file pointer */
|
||||
double tfstart; /* file may be used from this date */
|
||||
double tfend; /* through this date */
|
||||
int32 iflg; /* byte reorder flag and little/bigendian flag */
|
||||
short npl; /* how many planets in file */
|
||||
int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */
|
||||
};
|
||||
|
||||
struct gen_const {
|
||||
double clight,
|
||||
aunit,
|
||||
helgravconst,
|
||||
ratme,
|
||||
sunradius;
|
||||
};
|
||||
|
||||
struct save_positions {
|
||||
int ipl;
|
||||
double tsave;
|
||||
int32 iflgsave;
|
||||
/* position at t = tsave,
|
||||
* in ecliptic polar (offset 0),
|
||||
* ecliptic cartesian (offset 6),
|
||||
* equatorial polar (offset 12),
|
||||
* and equatorial cartesian coordinates (offset 18).
|
||||
* 6 doubles each for position and speed coordinates.
|
||||
*/
|
||||
double xsaves[24];
|
||||
};
|
||||
|
||||
struct node_data {
|
||||
/* result of most recent data evaluation for this body: */
|
||||
double teval; /* time for which last computation was made */
|
||||
int32 iephe; /* which ephemeris was used */
|
||||
double x[6]; /* position and speed vectors equatorial J2000 */
|
||||
int32 xflgs; /* hel., light-time, aberr., prec. flags etc. */
|
||||
double xreturn[24]; /* return positions:
|
||||
* xreturn+0 ecliptic polar coordinates
|
||||
* xreturn+6 ecliptic cartesian coordinates
|
||||
* xreturn+12 equatorial polar coordinates
|
||||
* xreturn+18 equatorial cartesian coordinates
|
||||
*/
|
||||
};
|
||||
|
||||
struct topo_data {
|
||||
double geolon, geolat, geoalt;
|
||||
double teval;
|
||||
double tjd_ut;
|
||||
double xobs[6];
|
||||
};
|
||||
|
||||
struct sid_data {
|
||||
int32 sid_mode;
|
||||
double ayan_t0;
|
||||
double t0;
|
||||
AS_BOOL t0_is_UT;
|
||||
};
|
||||
|
||||
struct fixed_star {
|
||||
char skey[40];
|
||||
char starname[40];
|
||||
char starbayer[40];
|
||||
char starno[10];
|
||||
double epoch, ra, de, ramot, demot, radvel, parall, mag;
|
||||
};
|
||||
|
||||
/* dpsi and deps loaded for 100 years after 1962 */
|
||||
#define SWE_DATA_DPSI_DEPS 36525
|
||||
|
||||
struct interpol {
|
||||
double tjd_nut0, tjd_nut2;
|
||||
double nut_dpsi0, nut_dpsi1, nut_dpsi2;
|
||||
double nut_deps0, nut_deps1, nut_deps2;
|
||||
};
|
||||
|
||||
/* if this is changed, then also update initialisation in sweph.c */
|
||||
struct swe_data {
|
||||
AS_BOOL ephe_path_is_set;
|
||||
AS_BOOL jpl_file_is_open;
|
||||
FILE *fixfp; /* fixed stars file pointer */
|
||||
char ephepath[AS_MAXCH];
|
||||
char jplfnam[AS_MAXCH];
|
||||
int32 jpldenum;
|
||||
int32 last_epheflag;
|
||||
AS_BOOL geopos_is_set;
|
||||
AS_BOOL ayana_is_set;
|
||||
AS_BOOL is_old_starfile;
|
||||
double eop_tjd_beg;
|
||||
double eop_tjd_beg_horizons;
|
||||
double eop_tjd_end;
|
||||
double eop_tjd_end_add;
|
||||
int eop_dpsi_loaded;
|
||||
double tid_acc;
|
||||
AS_BOOL is_tid_acc_manual;
|
||||
AS_BOOL init_dt_done;
|
||||
AS_BOOL swed_is_initialised;
|
||||
AS_BOOL delta_t_userdef_is_set;
|
||||
double delta_t_userdef;
|
||||
double ast_G;
|
||||
double ast_H;
|
||||
double ast_diam;
|
||||
char astelem[AS_MAXCH * 10];
|
||||
int i_saved_planet_name;
|
||||
char saved_planet_name[80];
|
||||
//double dpsi[36525]; /* works for 100 years after 1962 */
|
||||
//double deps[36525];
|
||||
double *dpsi;
|
||||
double *deps;
|
||||
int32 timeout;
|
||||
int32 astro_models[SEI_NMODELS];
|
||||
AS_BOOL do_interpolate_nut;
|
||||
struct interpol interpol;
|
||||
struct file_data fidat[SEI_NEPHFILES];
|
||||
struct gen_const gcdat;
|
||||
struct plan_data pldat[SEI_NPLANETS];
|
||||
#if 0
|
||||
struct node_data nddat[SEI_NNODE_ETC];
|
||||
#else
|
||||
struct plan_data nddat[SEI_NNODE_ETC];
|
||||
#endif
|
||||
struct save_positions savedat[SE_NPLANETS+1];
|
||||
struct epsilon oec;
|
||||
struct epsilon oec2000;
|
||||
struct nut nut;
|
||||
struct nut nut2000;
|
||||
struct nut nutv;
|
||||
struct topo_data topd;
|
||||
struct sid_data sidd;
|
||||
AS_BOOL n_fixstars_real; // real number of fixed stars in sefstars.txt
|
||||
AS_BOOL n_fixstars_named; // number of fixed stars with tradtional name
|
||||
AS_BOOL n_fixstars_records;// number of fixed stars records in fixed_stars
|
||||
struct fixed_star *fixed_stars;
|
||||
};
|
||||
|
||||
extern TLS struct swe_data swed;
|
||||
991
lib/sweph/swephexp.h
Normal file
991
lib/sweph/swephexp.h
Normal file
|
|
@ -0,0 +1,991 @@
|
|||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swephexp.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
|
||||
SWISSEPH: exported definitions and constants
|
||||
|
||||
This file represents the standard application interface (API)
|
||||
to the Swiss Ephemeris.
|
||||
|
||||
A C programmer needs only to include this file, and link his code
|
||||
with the SwissEph library.
|
||||
|
||||
The function calls are documented in the Programmer's documentation,
|
||||
which is online in HTML format.
|
||||
|
||||
Structure of this file:
|
||||
Public API definitions
|
||||
Internal developer's definitions
|
||||
Public API functions.
|
||||
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */
|
||||
#define _SWEPHEXP_INCLUDED
|
||||
|
||||
#include "sweodef.h"
|
||||
|
||||
/***********************************************************
|
||||
* definitions for use also by non-C programmers
|
||||
***********************************************************/
|
||||
|
||||
#define SE_AUNIT_TO_KM (149597870.691)
|
||||
#define SE_AUNIT_TO_LIGHTYEAR (1.0/63241.077088071)
|
||||
#define SE_AUNIT_TO_PARSEC (1.0/206264.8062471)
|
||||
|
||||
/* values for gregflag in swe_julday() and swe_revjul() */
|
||||
# define SE_JUL_CAL 0
|
||||
# define SE_GREG_CAL 1
|
||||
|
||||
/*
|
||||
* planet numbers for the ipl parameter in swe_calc()
|
||||
*/
|
||||
#define SE_ECL_NUT -1
|
||||
|
||||
#define SE_SUN 0
|
||||
#define SE_MOON 1
|
||||
#define SE_MERCURY 2
|
||||
#define SE_VENUS 3
|
||||
#define SE_MARS 4
|
||||
#define SE_JUPITER 5
|
||||
#define SE_SATURN 6
|
||||
#define SE_URANUS 7
|
||||
#define SE_NEPTUNE 8
|
||||
#define SE_PLUTO 9
|
||||
#define SE_MEAN_NODE 10
|
||||
#define SE_TRUE_NODE 11
|
||||
#define SE_MEAN_APOG 12
|
||||
#define SE_OSCU_APOG 13
|
||||
#define SE_EARTH 14
|
||||
#define SE_CHIRON 15
|
||||
#define SE_PHOLUS 16
|
||||
#define SE_CERES 17
|
||||
#define SE_PALLAS 18
|
||||
#define SE_JUNO 19
|
||||
#define SE_VESTA 20
|
||||
#define SE_INTP_APOG 21
|
||||
#define SE_INTP_PERG 22
|
||||
|
||||
#define SE_NPLANETS 23
|
||||
|
||||
#define SE_AST_OFFSET 10000
|
||||
#define SE_VARUNA (SE_AST_OFFSET + 20000)
|
||||
|
||||
#define SE_FICT_OFFSET 40
|
||||
#define SE_FICT_OFFSET_1 39
|
||||
#define SE_FICT_MAX 999
|
||||
#define SE_NFICT_ELEM 15
|
||||
|
||||
#define SE_COMET_OFFSET 1000
|
||||
|
||||
#define SE_NALL_NAT_POINTS (SE_NPLANETS + SE_NFICT_ELEM)
|
||||
|
||||
/* Hamburger or Uranian "planets" */
|
||||
#define SE_CUPIDO 40
|
||||
#define SE_HADES 41
|
||||
#define SE_ZEUS 42
|
||||
#define SE_KRONOS 43
|
||||
#define SE_APOLLON 44
|
||||
#define SE_ADMETOS 45
|
||||
#define SE_VULKANUS 46
|
||||
#define SE_POSEIDON 47
|
||||
/* other fictitious bodies */
|
||||
#define SE_ISIS 48
|
||||
#define SE_NIBIRU 49
|
||||
#define SE_HARRINGTON 50
|
||||
#define SE_NEPTUNE_LEVERRIER 51
|
||||
#define SE_NEPTUNE_ADAMS 52
|
||||
#define SE_PLUTO_LOWELL 53
|
||||
#define SE_PLUTO_PICKERING 54
|
||||
#define SE_VULCAN 55
|
||||
#define SE_WHITE_MOON 56
|
||||
#define SE_PROSERPINA 57
|
||||
#define SE_WALDEMATH 58
|
||||
|
||||
#define SE_FIXSTAR -10
|
||||
|
||||
#define SE_ASC 0
|
||||
#define SE_MC 1
|
||||
#define SE_ARMC 2
|
||||
#define SE_VERTEX 3
|
||||
#define SE_EQUASC 4 /* "equatorial ascendant" */
|
||||
#define SE_COASC1 5 /* "co-ascendant" (W. Koch) */
|
||||
#define SE_COASC2 6 /* "co-ascendant" (M. Munkasey) */
|
||||
#define SE_POLASC 7 /* "polar ascendant" (M. Munkasey) */
|
||||
#define SE_NASCMC 8
|
||||
|
||||
/*
|
||||
* flag bits for parameter iflag in function swe_calc()
|
||||
* The flag bits are defined in such a way that iflag = 0 delivers what one
|
||||
* usually wants:
|
||||
* - the default ephemeris (SWISS EPHEMERIS) is used,
|
||||
* - apparent geocentric positions referring to the true equinox of date
|
||||
* are returned.
|
||||
* If not only coordinates, but also speed values are required, use
|
||||
* flag = SEFLG_SPEED.
|
||||
*
|
||||
* The 'L' behind the number indicates that 32-bit integers (Long) are used.
|
||||
*/
|
||||
#define SEFLG_JPLEPH 1 /* use JPL ephemeris */
|
||||
#define SEFLG_SWIEPH 2 /* use SWISSEPH ephemeris */
|
||||
#define SEFLG_MOSEPH 4 /* use Moshier ephemeris */
|
||||
|
||||
#define SEFLG_HELCTR 8 /* heliocentric position */
|
||||
#define SEFLG_TRUEPOS 16 /* true/geometric position, not apparent position */
|
||||
#define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */
|
||||
#define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */
|
||||
#define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it,
|
||||
* SEFLG_SPEED is faster and more precise.) */
|
||||
#define SEFLG_SPEED 256 /* high precision speed */
|
||||
#define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */
|
||||
#define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */
|
||||
#define SEFLG_ASTROMETRIC (SEFLG_NOABERR|SEFLG_NOGDEFL) /* astrometric position,
|
||||
* i.e. with light-time, but without aberration and
|
||||
* light deflection */
|
||||
#define SEFLG_EQUATORIAL (2*1024) /* equatorial positions are wanted */
|
||||
#define SEFLG_XYZ (4*1024) /* cartesian, not polar, coordinates */
|
||||
#define SEFLG_RADIANS (8*1024) /* coordinates in radians, not degrees */
|
||||
#define SEFLG_BARYCTR (16*1024) /* barycentric position */
|
||||
#define SEFLG_TOPOCTR (32*1024) /* topocentric position */
|
||||
#define SEFLG_ORBEL_AA SEFLG_TOPOCTR /* used for Astronomical Almanac mode in
|
||||
* calculation of Kepler elipses */
|
||||
#define SEFLG_SIDEREAL (64*1024) /* sidereal position */
|
||||
#define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
|
||||
#define SEFLG_DPSIDEPS_1980 (256*1024) /* reproduce JPL Horizons
|
||||
* 1962 - today to 0.002 arcsec. */
|
||||
#define SEFLG_JPLHOR SEFLG_DPSIDEPS_1980
|
||||
#define SEFLG_JPLHOR_APPROX (512*1024) /* approximate JPL Horizons 1962 - today */
|
||||
|
||||
#define SE_SIDBITS 256
|
||||
/* for projection onto ecliptic of t0 */
|
||||
#define SE_SIDBIT_ECL_T0 256
|
||||
/* for projection onto solar system plane */
|
||||
#define SE_SIDBIT_SSY_PLANE 512
|
||||
/* with user-defined ayanamsha, t0 is UT */
|
||||
#define SE_SIDBIT_USER_UT 1024
|
||||
|
||||
/* sidereal modes (ayanamsas) */
|
||||
#define SE_SIDM_FAGAN_BRADLEY 0
|
||||
#define SE_SIDM_LAHIRI 1
|
||||
#define SE_SIDM_DELUCE 2
|
||||
#define SE_SIDM_RAMAN 3
|
||||
#define SE_SIDM_USHASHASHI 4
|
||||
#define SE_SIDM_KRISHNAMURTI 5
|
||||
#define SE_SIDM_DJWHAL_KHUL 6
|
||||
#define SE_SIDM_YUKTESHWAR 7
|
||||
#define SE_SIDM_JN_BHASIN 8
|
||||
#define SE_SIDM_BABYL_KUGLER1 9
|
||||
#define SE_SIDM_BABYL_KUGLER2 10
|
||||
#define SE_SIDM_BABYL_KUGLER3 11
|
||||
#define SE_SIDM_BABYL_HUBER 12
|
||||
#define SE_SIDM_BABYL_ETPSC 13
|
||||
#define SE_SIDM_ALDEBARAN_15TAU 14
|
||||
#define SE_SIDM_HIPPARCHOS 15
|
||||
#define SE_SIDM_SASSANIAN 16
|
||||
#define SE_SIDM_GALCENT_0SAG 17
|
||||
#define SE_SIDM_J2000 18
|
||||
#define SE_SIDM_J1900 19
|
||||
#define SE_SIDM_B1950 20
|
||||
#define SE_SIDM_SURYASIDDHANTA 21
|
||||
#define SE_SIDM_SURYASIDDHANTA_MSUN 22
|
||||
#define SE_SIDM_ARYABHATA 23
|
||||
#define SE_SIDM_ARYABHATA_MSUN 24
|
||||
#define SE_SIDM_SS_REVATI 25
|
||||
#define SE_SIDM_SS_CITRA 26
|
||||
#define SE_SIDM_TRUE_CITRA 27
|
||||
#define SE_SIDM_TRUE_REVATI 28
|
||||
#define SE_SIDM_TRUE_PUSHYA 29
|
||||
#define SE_SIDM_GALCENT_RGILBRAND 30
|
||||
#define SE_SIDM_GALEQU_IAU1958 31
|
||||
#define SE_SIDM_GALEQU_TRUE 32
|
||||
#define SE_SIDM_GALEQU_MULA 33
|
||||
#define SE_SIDM_GALALIGN_MARDYKS 34
|
||||
#define SE_SIDM_TRUE_MULA 35
|
||||
#define SE_SIDM_GALCENT_MULA_WILHELM 36
|
||||
#define SE_SIDM_ARYABHATA_522 37
|
||||
#define SE_SIDM_BABYL_BRITTON 38
|
||||
#define SE_SIDM_TRUE_SHEORAN 39
|
||||
//#define SE_SIDM_GALCENT_COCHRANE 40
|
||||
//#define SE_SIDM_MANJULA 41
|
||||
#define SE_SIDM_USER 255 /* user-defined ayanamsha, t0 is TT */
|
||||
|
||||
#define SE_NSIDM_PREDEF 40
|
||||
|
||||
/* used for swe_nod_aps(): */
|
||||
#define SE_NODBIT_MEAN 1 /* mean nodes/apsides */
|
||||
#define SE_NODBIT_OSCU 2 /* osculating nodes/apsides */
|
||||
#define SE_NODBIT_OSCU_BAR 4 /* same, but motion about solar system barycenter is considered */
|
||||
#define SE_NODBIT_FOPOINT 256 /* focal point of orbit instead of aphelion */
|
||||
|
||||
/* default ephemeris used when no ephemeris flagbit is set */
|
||||
#define SEFLG_DEFAULTEPH SEFLG_SWIEPH
|
||||
|
||||
#define SE_MAX_STNAME 256 /* maximum size of fixstar name;
|
||||
* the parameter star in swe_fixstar
|
||||
* must allow twice this space for
|
||||
* the returned star name.
|
||||
*/
|
||||
|
||||
/* defines for eclipse computations */
|
||||
|
||||
#define SE_ECL_CENTRAL 1
|
||||
#define SE_ECL_NONCENTRAL 2
|
||||
#define SE_ECL_TOTAL 4
|
||||
#define SE_ECL_ANNULAR 8
|
||||
#define SE_ECL_PARTIAL 16
|
||||
#define SE_ECL_ANNULAR_TOTAL 32
|
||||
#define SE_ECL_PENUMBRAL 64
|
||||
#define SE_ECL_ALLTYPES_SOLAR (SE_ECL_CENTRAL|SE_ECL_NONCENTRAL|SE_ECL_TOTAL|SE_ECL_ANNULAR|SE_ECL_PARTIAL|SE_ECL_ANNULAR_TOTAL)
|
||||
#define SE_ECL_ALLTYPES_LUNAR (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL)
|
||||
#define SE_ECL_VISIBLE 128
|
||||
#define SE_ECL_MAX_VISIBLE 256
|
||||
#define SE_ECL_1ST_VISIBLE 512 /* begin of partial eclipse */
|
||||
#define SE_ECL_PARTBEG_VISIBLE 512 /* begin of partial eclipse */
|
||||
#define SE_ECL_2ND_VISIBLE 1024 /* begin of total eclipse */
|
||||
#define SE_ECL_TOTBEG_VISIBLE 1024 /* begin of total eclipse */
|
||||
#define SE_ECL_3RD_VISIBLE 2048 /* end of total eclipse */
|
||||
#define SE_ECL_TOTEND_VISIBLE 2048 /* end of total eclipse */
|
||||
#define SE_ECL_4TH_VISIBLE 4096 /* end of partial eclipse */
|
||||
#define SE_ECL_PARTEND_VISIBLE 4096 /* end of partial eclipse */
|
||||
#define SE_ECL_PENUMBBEG_VISIBLE 8192 /* begin of penumbral eclipse */
|
||||
#define SE_ECL_PENUMBEND_VISIBLE 16384 /* end of penumbral eclipse */
|
||||
#define SE_ECL_OCC_BEG_DAYLIGHT 8192 /* occultation begins during the day */
|
||||
#define SE_ECL_OCC_END_DAYLIGHT 16384 /* occultation ends during the day */
|
||||
#define SE_ECL_ONE_TRY (32*1024)
|
||||
/* check if the next conjunction of the moon with
|
||||
* a planet is an occultation; don't search further */
|
||||
|
||||
/* for swe_rise_transit() */
|
||||
#define SE_CALC_RISE 1
|
||||
#define SE_CALC_SET 2
|
||||
#define SE_CALC_MTRANSIT 4
|
||||
#define SE_CALC_ITRANSIT 8
|
||||
#define SE_BIT_DISC_CENTER 256 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if rise or set of disc center is
|
||||
* required */
|
||||
#define SE_BIT_DISC_BOTTOM 8192 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if rise or set of lower limb of
|
||||
* disc is requried */
|
||||
#define SE_BIT_GEOCTR_NO_ECL_LAT 128 /* use geocentric rather than topocentric
|
||||
position of object and
|
||||
ignore its ecliptic latitude */
|
||||
#define SE_BIT_NO_REFRACTION 512 /* to be or'ed to SE_CALC_RISE/SET,
|
||||
* if refraction is to be ignored */
|
||||
#define SE_BIT_CIVIL_TWILIGHT 1024 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_NAUTIC_TWILIGHT 2048 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_ASTRO_TWILIGHT 4096 /* to be or'ed to SE_CALC_RISE/SET */
|
||||
#define SE_BIT_FIXED_DISC_SIZE 16384 /* or'ed to SE_CALC_RISE/SET:
|
||||
* neglect the effect of distance on
|
||||
* disc size */
|
||||
#define SE_BIT_FORCE_SLOW_METHOD 32768 /* This is only a Astrodienst in-house
|
||||
* test flag. It forces the usage
|
||||
* of the old, slow calculation of
|
||||
* risings and settings. */
|
||||
#define SE_BIT_HINDU_RISING (SE_BIT_DISC_CENTER|SE_BIT_NO_REFRACTION|SE_BIT_GEOCTR_NO_ECL_LAT)
|
||||
|
||||
/* for swe_azalt() and swe_azalt_rev() */
|
||||
#define SE_ECL2HOR 0
|
||||
#define SE_EQU2HOR 1
|
||||
#define SE_HOR2ECL 0
|
||||
#define SE_HOR2EQU 1
|
||||
|
||||
/* for swe_refrac() */
|
||||
#define SE_TRUE_TO_APP 0
|
||||
#define SE_APP_TO_TRUE 1
|
||||
|
||||
/*
|
||||
* only used for experimenting with various JPL ephemeris files
|
||||
* which are available at Astrodienst's internal network
|
||||
*/
|
||||
#define SE_DE_NUMBER 431
|
||||
#define SE_FNAME_DE200 "de200.eph"
|
||||
#define SE_FNAME_DE403 "de403.eph"
|
||||
#define SE_FNAME_DE404 "de404.eph"
|
||||
#define SE_FNAME_DE405 "de405.eph"
|
||||
#define SE_FNAME_DE406 "de406.eph"
|
||||
#define SE_FNAME_DE431 "de431.eph"
|
||||
#define SE_FNAME_DFT SE_FNAME_DE431
|
||||
#define SE_FNAME_DFT2 SE_FNAME_DE406
|
||||
#define SE_STARFILE_OLD "fixstars.cat"
|
||||
#define SE_STARFILE "sefstars.txt"
|
||||
#define SE_ASTNAMFILE "seasnam.txt"
|
||||
#define SE_FICTFILE "seorbel.txt"
|
||||
|
||||
/*
|
||||
* ephemeris path
|
||||
* this defines where ephemeris files are expected if the function
|
||||
* swe_set_ephe_path() is not called by the application.
|
||||
* Normally, every application should make this call to define its
|
||||
* own place for the ephemeris files.
|
||||
*/
|
||||
|
||||
#ifndef SE_EPHE_PATH
|
||||
#if MSDOS
|
||||
# define SE_EPHE_PATH "\\sweph\\ephe\\"
|
||||
#else
|
||||
# ifdef MACOS
|
||||
# define SE_EPHE_PATH ":ephe:"
|
||||
# else
|
||||
# define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
|
||||
/* At Astrodienst, we maintain two ephemeris areas for
|
||||
the thousands of asteroid files:
|
||||
the short files in /users/ephe/ast*,
|
||||
the long file in /users/ephe2/ast*. */
|
||||
# endif
|
||||
#endif
|
||||
#endif /* SE_EPHE_PATH */
|
||||
|
||||
/* defines for function swe_split_deg() (in swephlib.c) */
|
||||
# define SE_SPLIT_DEG_ROUND_SEC 1
|
||||
# define SE_SPLIT_DEG_ROUND_MIN 2
|
||||
# define SE_SPLIT_DEG_ROUND_DEG 4
|
||||
# define SE_SPLIT_DEG_ZODIACAL 8
|
||||
# define SE_SPLIT_DEG_NAKSHATRA 1024
|
||||
# define SE_SPLIT_DEG_KEEP_SIGN 16 /* don't round to next sign,
|
||||
* e.g. 29.9999999 will be rounded
|
||||
* to 29d59'59" (or 29d59' or 29d) */
|
||||
# define SE_SPLIT_DEG_KEEP_DEG 32 /* don't round to next degree
|
||||
* e.g. 13.9999999 will be rounded
|
||||
* to 13d59'59" (or 13d59' or 13d) */
|
||||
|
||||
/* for heliacal functions */
|
||||
#define SE_HELIACAL_RISING 1
|
||||
#define SE_HELIACAL_SETTING 2
|
||||
#define SE_MORNING_FIRST SE_HELIACAL_RISING
|
||||
#define SE_EVENING_LAST SE_HELIACAL_SETTING
|
||||
#define SE_EVENING_FIRST 3
|
||||
#define SE_MORNING_LAST 4
|
||||
#define SE_ACRONYCHAL_RISING 5 /* still not implemented */
|
||||
#define SE_ACRONYCHAL_SETTING 6 /* still not implemented */
|
||||
#define SE_COSMICAL_SETTING SE_ACRONYCHAL_SETTING
|
||||
|
||||
#define SE_HELFLAG_LONG_SEARCH 128
|
||||
#define SE_HELFLAG_HIGH_PRECISION 256
|
||||
#define SE_HELFLAG_OPTICAL_PARAMS 512
|
||||
#define SE_HELFLAG_NO_DETAILS 1024
|
||||
#define SE_HELFLAG_SEARCH_1_PERIOD (1 << 11) /* 2048 */
|
||||
#define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */
|
||||
#define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */
|
||||
/* the following undocumented defines are for test reasons only */
|
||||
#define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
|
||||
#define SE_HELFLAG_VISLIM_SCOTOPIC (1 << 15) /* 32768 */
|
||||
#define SE_HELFLAG_AV (1 << 16) /* 65536 */
|
||||
#define SE_HELFLAG_AVKIND_VR (1 << 16) /* 65536 */
|
||||
#define SE_HELFLAG_AVKIND_PTO (1 << 17)
|
||||
#define SE_HELFLAG_AVKIND_MIN7 (1 << 18)
|
||||
#define SE_HELFLAG_AVKIND_MIN9 (1 << 19)
|
||||
#define SE_HELFLAG_AVKIND (SE_HELFLAG_AVKIND_VR|SE_HELFLAG_AVKIND_PTO|SE_HELFLAG_AVKIND_MIN7|SE_HELFLAG_AVKIND_MIN9)
|
||||
#define TJD_INVALID 99999999.0
|
||||
#define SIMULATE_VICTORVB 1
|
||||
|
||||
#if 0 // unused and redundant
|
||||
#define SE_HELIACAL_LONG_SEARCH 128
|
||||
#define SE_HELIACAL_HIGH_PRECISION 256
|
||||
#define SE_HELIACAL_OPTICAL_PARAMS 512
|
||||
#define SE_HELIACAL_NO_DETAILS 1024
|
||||
#define SE_HELIACAL_SEARCH_1_PERIOD (1 << 11) /* 2048 */
|
||||
#define SE_HELIACAL_VISLIM_DARK (1 << 12) /* 4096 */
|
||||
#define SE_HELIACAL_VISLIM_NOMOON (1 << 13) /* 8192 */
|
||||
#define SE_HELIACAL_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
|
||||
#define SE_HELIACAL_AVKIND_VR (1 << 15) /* 32768 */
|
||||
#define SE_HELIACAL_AVKIND_PTO (1 << 16)
|
||||
#define SE_HELIACAL_AVKIND_MIN7 (1 << 17)
|
||||
#define SE_HELIACAL_AVKIND_MIN9 (1 << 18)
|
||||
#define SE_HELIACAL_AVKIND (SE_HELFLAG_AVKIND_VR|SE_HELFLAG_AVKIND_PTO|SE_HELFLAG_AVKIND_MIN7|SE_HELFLAG_AVKIND_MIN9)
|
||||
#endif
|
||||
|
||||
#define SE_PHOTOPIC_FLAG 0
|
||||
#define SE_SCOTOPIC_FLAG 1
|
||||
#define SE_MIXEDOPIC_FLAG 2
|
||||
|
||||
/* for swe_set_tid_acc() and ephemeris-dependent delta t:
|
||||
* intrinsic tidal acceleration in the mean motion of the moon,
|
||||
* not given in the parameters list of the ephemeris files but computed
|
||||
* by Chapront/Chapront-Touzé/Francou A&A 387 (2002), p. 705.
|
||||
*/
|
||||
#define SE_TIDAL_DE200 (-23.8946)
|
||||
#define SE_TIDAL_DE403 (-25.580) /* was (-25.8) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE404 (-25.580) /* was (-25.8) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE405 (-25.826) /* was (-25.7376) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */
|
||||
#define SE_TIDAL_DE421 (-25.85) /* JPL Interoffice Memorandum 14-mar-2008 on DE421 Lunar Orbit */
|
||||
#define SE_TIDAL_DE422 (-25.85) /* JPL Interoffice Memorandum 14-mar-2008 on DE421 (sic!) Lunar Orbit */
|
||||
#define SE_TIDAL_DE430 (-25.82) /* JPL Interoffice Memorandum 9-jul-2013 on DE430 Lunar Orbit */
|
||||
#define SE_TIDAL_DE431 (-25.80) /* IPN Progress Report 42-196 • February 15, 2014, p. 15; was (-25.82) in V. 2.00.00 */
|
||||
#define SE_TIDAL_26 (-26.0)
|
||||
#define SE_TIDAL_STEPHENSON_2016 (-25.85)
|
||||
#define SE_TIDAL_DEFAULT SE_TIDAL_DE431
|
||||
#define SE_TIDAL_AUTOMATIC 999999
|
||||
#define SE_TIDAL_MOSEPH SE_TIDAL_DE404
|
||||
#define SE_TIDAL_SWIEPH SE_TIDAL_DEFAULT
|
||||
#define SE_TIDAL_JPLEPH SE_TIDAL_DEFAULT
|
||||
|
||||
/* for function swe_set_delta_t_userdef() */
|
||||
#define SE_DELTAT_AUTOMATIC (-1E-10)
|
||||
|
||||
#define SE_MODEL_DELTAT 0
|
||||
#define SE_MODEL_PREC_LONGTERM 1
|
||||
#define SE_MODEL_PREC_SHORTTERM 2
|
||||
#define SE_MODEL_NUT 3
|
||||
#define SE_MODEL_BIAS 4
|
||||
#define SE_MODEL_JPLHOR_MODE 5
|
||||
#define SE_MODEL_JPLHORA_MODE 6
|
||||
#define SE_MODEL_SIDT 7
|
||||
#define NSE_MODELS 8
|
||||
|
||||
/* precession models */
|
||||
#define SEMOD_NPREC 10
|
||||
#define SEMOD_PREC_IAU_1976 1
|
||||
#define SEMOD_PREC_LASKAR_1986 2
|
||||
#define SEMOD_PREC_WILL_EPS_LASK 3
|
||||
#define SEMOD_PREC_WILLIAMS_1994 4
|
||||
#define SEMOD_PREC_SIMON_1994 5
|
||||
#define SEMOD_PREC_IAU_2000 6
|
||||
#define SEMOD_PREC_BRETAGNON_2003 7
|
||||
#define SEMOD_PREC_IAU_2006 8
|
||||
#define SEMOD_PREC_VONDRAK_2011 9
|
||||
#define SEMOD_PREC_OWEN_1990 10
|
||||
#define SEMOD_PREC_DEFAULT SEMOD_PREC_VONDRAK_2011
|
||||
/* SE versions before 1.70 used IAU 1976 precession for
|
||||
* a limited time range of 2 centuries in combination with
|
||||
* the long-term precession Simon 1994.
|
||||
*/
|
||||
#define SEMOD_PREC_DEFAULT_SHORT SEMOD_PREC_VONDRAK_2011
|
||||
|
||||
/* nutation models */
|
||||
#define SEMOD_NNUT 4
|
||||
#define SEMOD_NUT_IAU_1980 1
|
||||
#define SEMOD_NUT_IAU_CORR_1987 2 /* Herring's (1987) corrections to IAU 1980
|
||||
* nutation series. AA (1996) neglects them.*/
|
||||
#define SEMOD_NUT_IAU_2000A 3 /* very time consuming ! */
|
||||
#define SEMOD_NUT_IAU_2000B 4 /* fast, but precision of milli-arcsec */
|
||||
#define SEMOD_NUT_DEFAULT SEMOD_NUT_IAU_2000B /* fast, but precision of milli-arcsec */
|
||||
|
||||
/* methods for sidereal time */
|
||||
#define SEMOD_NSIDT 4
|
||||
#define SEMOD_SIDT_IAU_1976 1
|
||||
#define SEMOD_SIDT_IAU_2006 2
|
||||
#define SEMOD_SIDT_IERS_CONV_2010 3
|
||||
#define SEMOD_SIDT_LONGTERM 4
|
||||
#define SEMOD_SIDT_DEFAULT SEMOD_SIDT_LONGTERM
|
||||
//#define SEMOD_SIDT_DEFAULT SEMOD_SIDT_IERS_CONV_2010
|
||||
|
||||
/* frame bias methods */
|
||||
#define SEMOD_NBIAS 3
|
||||
#define SEMOD_BIAS_NONE 1 /* ignore frame bias */
|
||||
#define SEMOD_BIAS_IAU2000 2 /* use frame bias matrix IAU 2000 */
|
||||
#define SEMOD_BIAS_IAU2006 3 /* use frame bias matrix IAU 2006 */
|
||||
#define SEMOD_BIAS_DEFAULT SEMOD_BIAS_IAU2006
|
||||
|
||||
/* methods of JPL Horizons (iflag & SEFLG_JPLHOR),
|
||||
* using daily dpsi, deps; see explanations below */
|
||||
#define SEMOD_NJPLHOR 2
|
||||
#define SEMOD_JPLHOR_LONG_AGREEMENT 1 /* daily dpsi and deps from file are
|
||||
* limited to 1962 - today. JPL uses the
|
||||
* first and last value for all dates
|
||||
* beyond this time range. */
|
||||
#define SEMOD_JPLHOR_DEFAULT SEMOD_JPLHOR_LONG_AGREEMENT
|
||||
/* Note, currently this is the only option for SEMOD_JPLHOR..*/
|
||||
/* SEMOD_JPLHOR_LONG_AGREEMENT, if combined with SEFLG_JPLHOR provides good
|
||||
* agreement with JPL Horizons for 9998 BC (-9997) until 9999 CE.
|
||||
* - After 20-jan-1962 until today, Horizons uses correct dpsi and deps.
|
||||
* - For dates before that, it uses dpsi and deps of 20-jan-1962, which
|
||||
* provides a continuous ephemeris, but does not make sense otherwise.
|
||||
* - Before 1.1.1799 and after 1.1.2202, the precession model Owen 1990
|
||||
* is used, as in Horizons.
|
||||
* An agreement with Horizons to a couple of milli arc seconds is achieved
|
||||
* for the whole time range of Horizons. (BC 9998-Mar-20 to AD 9999-Dec-31 TT.)
|
||||
*/
|
||||
|
||||
/* methods of approximation of JPL Horizons (iflag & SEFLG_JPLHORA),
|
||||
* without dpsi, deps; see explanations below */
|
||||
#define SEMOD_NJPLHORA 3
|
||||
#define SEMOD_JPLHORA_1 1
|
||||
#define SEMOD_JPLHORA_2 2
|
||||
#define SEMOD_JPLHORA_3 3
|
||||
#define SEMOD_JPLHORA_DEFAULT SEMOD_JPLHORA_3
|
||||
/* With SEMOD_JPLHORA_1, planetary positions are always calculated
|
||||
* using a recent precession/nutation model. Frame bias matrix is applied
|
||||
* with some correction to RA and another correction added to epsilon.
|
||||
* This provides a very good approximation of JPL Horizons positions.
|
||||
*
|
||||
* With SEMOD_JPLHORA_2, frame bias as recommended by IERS Conventions 2003
|
||||
* and 2010 is *not* applied. Instead, dpsi_bias and deps_bias are added to
|
||||
* nutation. This procedure is found in some older astronomical software.
|
||||
* Equatorial apparent positions will be close to JPL Horizons
|
||||
* (within a few mas) between 1962 and current years. Ecl. longitude
|
||||
* will be good, latitude bad.
|
||||
*
|
||||
* With SEMOD_JPLHORA_3 works like SEMOD_JPLHORA_3 after 1962, but like
|
||||
* SEFLG_JPLHOR before that. This allows EXTREMELY good agreement with JPL
|
||||
* Horizons over its whole time range.
|
||||
*/
|
||||
|
||||
#define SEMOD_NDELTAT 5
|
||||
#define SEMOD_DELTAT_STEPHENSON_MORRISON_1984 1
|
||||
#define SEMOD_DELTAT_STEPHENSON_1997 2
|
||||
#define SEMOD_DELTAT_STEPHENSON_MORRISON_2004 3
|
||||
#define SEMOD_DELTAT_ESPENAK_MEEUS_2006 4
|
||||
#define SEMOD_DELTAT_STEPHENSON_ETC_2016 5
|
||||
//#define SEMOD_DELTAT_DEFAULT SEMOD_DELTAT_ESPENAK_MEEUS_2006
|
||||
#define SEMOD_DELTAT_DEFAULT SEMOD_DELTAT_STEPHENSON_ETC_2016
|
||||
|
||||
/**************************************************************
|
||||
* here follow some ugly definitions which are only required
|
||||
* if SwissEphemeris is compiled on Windows, either to use a DLL
|
||||
* or to create a DLL.
|
||||
* Unix users can savely ignore his section
|
||||
* and skip to the export function decarations below.
|
||||
************************************************************/
|
||||
#if defined(MAKE_DLL) || defined(USE_DLL) || defined(_WINDOWS)
|
||||
# include <windows.h>
|
||||
extern HANDLE dllhandle; // set by swedllst::DllMain,
|
||||
// defined in sweph.c
|
||||
// used by GetModuleFilename in sweph.c
|
||||
#endif
|
||||
|
||||
#ifdef USE_DLL
|
||||
# include "swedll.h"
|
||||
#endif
|
||||
|
||||
#if defined(DOS32) || !MSDOS || defined(WIN32)
|
||||
/* use compiler switch to define DOS32 */
|
||||
# define MALLOC malloc
|
||||
# define CALLOC calloc
|
||||
# define FREE free
|
||||
#else
|
||||
# ifdef __BORLANDC__
|
||||
# include <alloc.h>
|
||||
# define MALLOC farmalloc
|
||||
# define CALLOC farcalloc
|
||||
# define FREE farfree
|
||||
# else
|
||||
# define MALLOC _fmalloc
|
||||
# define CALLOC _fcalloc
|
||||
# define FREE _ffree
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* DLL defines
|
||||
Define UNDECO_DLL for un-decorated dll
|
||||
verify compiler option __cdecl for un-decorated and __stdcall for decorated */
|
||||
/*#define UNDECO_DLL*/
|
||||
#ifdef MAKE_DLL
|
||||
#if defined (PASCAL) || defined(__stdcall)
|
||||
#if defined UNDECO_DLL
|
||||
#define CALL_CONV __cdecl
|
||||
#else
|
||||
#define CALL_CONV __stdcall
|
||||
#endif
|
||||
#else
|
||||
#define CALL_CONV
|
||||
#endif
|
||||
#ifdef MAKE_DLL16 /* 16bit DLL */
|
||||
/* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x
|
||||
and the -WD or -WDE compiler switch. */
|
||||
#define EXP16 __export
|
||||
#define EXP32
|
||||
#else /* 32bit DLL */
|
||||
/* To export symbols in the new DLL model of Win32, Microsoft
|
||||
recommends the following approach */
|
||||
#define EXP16
|
||||
#define EXP32 __declspec( dllexport )
|
||||
#endif
|
||||
#else
|
||||
#define CALL_CONV
|
||||
#define EXP16
|
||||
#define EXP32
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _SWEDLL_H
|
||||
|
||||
/***********************************************************
|
||||
* exported functions
|
||||
***********************************************************/
|
||||
|
||||
#define ext_def(x) extern EXP32 x CALL_CONV EXP16
|
||||
/* ext_def(x) evaluates to x on Unix */
|
||||
|
||||
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
|
||||
ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
|
||||
ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
|
||||
|
||||
/* the following are secret, for Victor Reijs' */
|
||||
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
|
||||
ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
|
||||
|
||||
/* the following is secret, for Dieter, allows to test old models of
|
||||
* precession, nutation, etc. Search for SE_MODEL_... in this file */
|
||||
ext_def(void) swe_set_astro_models(char *samod, int32 iflag);
|
||||
ext_def(void) swe_get_astro_models(char *samod, char *sdet, int32 iflag);
|
||||
|
||||
/****************************
|
||||
* exports from sweph.c
|
||||
****************************/
|
||||
|
||||
ext_def(char *) swe_version(char *);
|
||||
ext_def(char *) swe_get_library_path(char *);
|
||||
|
||||
/* planets, moon, nodes etc. */
|
||||
ext_def( int32 ) swe_calc(
|
||||
double tjd, int ipl, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
|
||||
/* fixed stars */
|
||||
ext_def( int32 ) swe_fixstar(
|
||||
char *star, double tjd, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
|
||||
ext_def(int32) swe_fixstar_mag(char *star, double *mag, char *serr);
|
||||
|
||||
ext_def( int32 ) swe_fixstar2(
|
||||
char *star, double tjd, int32 iflag,
|
||||
double *xx,
|
||||
char *serr);
|
||||
|
||||
ext_def(int32) swe_fixstar2_ut(char *star, double tjd_ut, int32 iflag,
|
||||
double *xx, char *serr);
|
||||
|
||||
ext_def(int32) swe_fixstar2_mag(char *star, double *mag, char *serr);
|
||||
|
||||
/* close Swiss Ephemeris */
|
||||
ext_def( void ) swe_close(void);
|
||||
|
||||
/* set directory path of ephemeris files */
|
||||
ext_def( void ) swe_set_ephe_path(char *path);
|
||||
|
||||
/* set file name of JPL file */
|
||||
ext_def( void ) swe_set_jpl_file(char *fname);
|
||||
|
||||
/* get planet name */
|
||||
ext_def( char *) swe_get_planet_name(int ipl, char *spname);
|
||||
|
||||
/* set geographic position of observer */
|
||||
ext_def (void) swe_set_topo(double geolon, double geolat, double geoalt);
|
||||
|
||||
/* set sidereal mode */
|
||||
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);
|
||||
|
||||
/* get ayanamsa */
|
||||
ext_def(int32) swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr);
|
||||
ext_def(int32) swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr);
|
||||
ext_def(double) swe_get_ayanamsa(double tjd_et);
|
||||
ext_def(double) swe_get_ayanamsa_ut(double tjd_ut);
|
||||
|
||||
|
||||
ext_def(const char *) swe_get_ayanamsa_name(int32 isidmode);
|
||||
|
||||
/*ext_def(void) swe_set_timeout(int32 tsec);*/
|
||||
|
||||
/****************************
|
||||
* exports from swedate.c
|
||||
****************************/
|
||||
|
||||
ext_def( int ) swe_date_conversion(
|
||||
int y , int m , int d , /* year, month, day */
|
||||
double utime, /* universal time in hours (decimal) */
|
||||
char c, /* calendar g[regorian]|j[ulian] */
|
||||
double *tjd);
|
||||
|
||||
ext_def( double ) swe_julday(
|
||||
int year, int month, int day, double hour,
|
||||
int gregflag);
|
||||
|
||||
ext_def( void ) swe_revjul (
|
||||
double jd,
|
||||
int gregflag,
|
||||
int *jyear, int *jmon, int *jday, double *jut);
|
||||
|
||||
ext_def(int32) swe_utc_to_jd(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
int32 gregflag, double *dret, char *serr);
|
||||
|
||||
ext_def(void) swe_jdet_to_utc(
|
||||
double tjd_et, int32 gregflag,
|
||||
int32 *iyear, int32 *imonth, int32 *iday,
|
||||
int32 *ihour, int32 *imin, double *dsec);
|
||||
|
||||
ext_def(void) swe_jdut1_to_utc(
|
||||
double tjd_ut, int32 gregflag,
|
||||
int32 *iyear, int32 *imonth, int32 *iday,
|
||||
int32 *ihour, int32 *imin, double *dsec);
|
||||
|
||||
ext_def(void) swe_utc_time_zone(
|
||||
int32 iyear, int32 imonth, int32 iday,
|
||||
int32 ihour, int32 imin, double dsec,
|
||||
double d_timezone,
|
||||
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
|
||||
int32 *ihour_out, int32 *imin_out, double *dsec_out);
|
||||
|
||||
/****************************
|
||||
* exports from swehouse.c
|
||||
****************************/
|
||||
|
||||
ext_def( int ) swe_houses(
|
||||
double tjd_ut, double geolat, double geolon, int hsys,
|
||||
double *cusps, double *ascmc);
|
||||
|
||||
ext_def( int ) swe_houses_ex(
|
||||
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
|
||||
double *cusps, double *ascmc);
|
||||
|
||||
ext_def( int ) swe_houses_armc(
|
||||
double armc, double geolat, double eps, int hsys,
|
||||
double *cusps, double *ascmc);
|
||||
|
||||
ext_def(double) swe_house_pos(
|
||||
double armc, double geolat, double eps, int hsys, double *xpin, char *serr);
|
||||
|
||||
ext_def(char *) swe_house_name(int hsys);
|
||||
|
||||
|
||||
|
||||
/****************************
|
||||
* exports from swecl.c
|
||||
****************************/
|
||||
|
||||
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
|
||||
|
||||
/* computes geographic location and attributes of solar
|
||||
* eclipse at a given tjd */
|
||||
ext_def (int32) swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
|
||||
ext_def (int32) swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
|
||||
|
||||
/* finds time of next local eclipse */
|
||||
ext_def (int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl,
|
||||
double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
|
||||
/* finds time of next eclipse globally */
|
||||
ext_def (int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype,
|
||||
double *tret, int32 backward, char *serr);
|
||||
|
||||
/* finds time of next occultation globally */
|
||||
ext_def (int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype,
|
||||
double *tret, int32 backward, char *serr);
|
||||
|
||||
/* computes attributes of a lunar eclipse for given tjd */
|
||||
ext_def (int32) swe_lun_eclipse_how(
|
||||
double tjd_ut,
|
||||
int32 ifl,
|
||||
double *geopos,
|
||||
double *attr,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype,
|
||||
double *tret, int32 backward, char *serr);
|
||||
|
||||
ext_def (int32) swe_lun_eclipse_when_loc(double tjd_start, int32 ifl,
|
||||
double *geopos, double *tret, double *attr, int32 backward, char *serr);
|
||||
|
||||
/* planetary phenomena */
|
||||
ext_def (int32) swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
|
||||
ext_def(int32) swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
|
||||
|
||||
ext_def (double) swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
|
||||
|
||||
ext_def (double) swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
|
||||
|
||||
ext_def (void) swe_set_lapse_rate(double lapse_rate);
|
||||
|
||||
ext_def (void) swe_azalt(
|
||||
double tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double atpress,
|
||||
double attemp,
|
||||
double *xin,
|
||||
double *xaz);
|
||||
|
||||
ext_def (void) swe_azalt_rev(
|
||||
double tjd_ut,
|
||||
int32 calc_flag,
|
||||
double *geopos,
|
||||
double *xin,
|
||||
double *xout);
|
||||
|
||||
ext_def (int32) swe_rise_trans_true_hor(
|
||||
double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double atpress, double attemp,
|
||||
double horhgt,
|
||||
double *tret,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_rise_trans(
|
||||
double tjd_ut, int32 ipl, char *starname,
|
||||
int32 epheflag, int32 rsmi,
|
||||
double *geopos,
|
||||
double atpress, double attemp,
|
||||
double *tret,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
|
||||
ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
|
||||
int32 method,
|
||||
double *xnasc, double *xndsc,
|
||||
double *xperi, double *xaphe,
|
||||
char *serr);
|
||||
ext_def (int32) swe_get_orbital_elements(
|
||||
double tjd_et, int32 ipl, int32 iflag, double *dret, char *serr);
|
||||
|
||||
ext_def (int32) swe_orbit_max_min_true_distance(double tjd_et, int32 ipl, int32 iflag, double *dmax, double *dmin, double *dtrue, char *serr);
|
||||
|
||||
/****************************
|
||||
* exports from swephlib.c
|
||||
****************************/
|
||||
|
||||
/* delta t */
|
||||
ext_def( double ) swe_deltat(double tjd);
|
||||
ext_def(double) swe_deltat_ex(double tjd, int32 iflag, char *serr);
|
||||
|
||||
/* equation of time */
|
||||
ext_def(int32) swe_time_equ(double tjd, double *te, char *serr);
|
||||
ext_def(int32) swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
|
||||
ext_def(int32) swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
|
||||
|
||||
/* sidereal time */
|
||||
ext_def( double ) swe_sidtime0(double tjd_ut, double eps, double nut);
|
||||
ext_def( double ) swe_sidtime(double tjd_ut);
|
||||
ext_def( void ) swe_set_interpolate_nut(AS_BOOL do_interpolate);
|
||||
|
||||
/* coordinate transformation polar -> polar */
|
||||
ext_def( void ) swe_cotrans(double *xpo, double *xpn, double eps);
|
||||
ext_def( void ) swe_cotrans_sp(double *xpo, double *xpn, double eps);
|
||||
|
||||
/* tidal acceleration to be used in swe_deltat() */
|
||||
ext_def( double ) swe_get_tid_acc(void);
|
||||
ext_def( void ) swe_set_tid_acc(double t_acc);
|
||||
|
||||
/* set a user defined delta t to be returned by functions
|
||||
* swe_deltat() and swe_deltat_ex() */
|
||||
ext_def (void) swe_set_delta_t_userdef(double dt);
|
||||
|
||||
ext_def( double ) swe_degnorm(double x);
|
||||
ext_def( double ) swe_radnorm(double x);
|
||||
ext_def( double ) swe_rad_midp(double x1, double x0);
|
||||
ext_def( double ) swe_deg_midp(double x1, double x0);
|
||||
|
||||
ext_def( void ) swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
|
||||
|
||||
/*******************************************************
|
||||
* other functions from swephlib.c;
|
||||
* they are not needed for Swiss Ephemeris,
|
||||
* but may be useful to former Placalc users.
|
||||
********************************************************/
|
||||
|
||||
/* normalize argument into interval [0..DEG360] */
|
||||
ext_def( centisec ) swe_csnorm(centisec p);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [0..360[ */
|
||||
ext_def( centisec ) swe_difcsn (centisec p1, centisec p2);
|
||||
|
||||
ext_def( double ) swe_difdegn (double p1, double p2);
|
||||
|
||||
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
|
||||
ext_def( centisec ) swe_difcs2n(centisec p1, centisec p2);
|
||||
|
||||
ext_def( double ) swe_difdeg2n(double p1, double p2);
|
||||
ext_def( double ) swe_difrad2n(double p1, double p2);
|
||||
|
||||
/* round second, but at 29.5959 always down */
|
||||
ext_def( centisec ) swe_csroundsec(centisec x);
|
||||
|
||||
/* double to int32 with rounding, no overflow check */
|
||||
ext_def( int32 ) swe_d2l(double x);
|
||||
|
||||
/* monday = 0, ... sunday = 6 */
|
||||
ext_def( int ) swe_day_of_week(double jd);
|
||||
|
||||
ext_def( char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
|
||||
|
||||
ext_def( char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
|
||||
|
||||
ext_def( char *) swe_cs2degstr(CSEC t, char *a);
|
||||
|
||||
#endif /* #ifndef _SWEDLL_H */
|
||||
|
||||
#endif /* #ifndef _SWEPHEXP_INCLUDED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
4489
lib/sweph/swephlib.c
Normal file
4489
lib/sweph/swephlib.c
Normal file
File diff suppressed because it is too large
Load diff
190
lib/sweph/swephlib.h
Normal file
190
lib/sweph/swephlib.h
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
/************************************************************
|
||||
$Header: /home/dieter/sweph/RCS/swephlib.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
|
||||
|
||||
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
|
||||
|
||||
************************************************************/
|
||||
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
|
||||
|
||||
License conditions
|
||||
------------------
|
||||
|
||||
This file is part of Swiss Ephemeris.
|
||||
|
||||
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
or distributor accepts any responsibility for the consequences of using it,
|
||||
or for whether it serves any particular purpose or works at all, unless he
|
||||
or she says so in writing.
|
||||
|
||||
Swiss Ephemeris is made available by its authors under a dual licensing
|
||||
system. The software developer, who uses any part of Swiss Ephemeris
|
||||
in his or her software, must choose between one of the two license models,
|
||||
which are
|
||||
a) GNU public license version 2 or later
|
||||
b) Swiss Ephemeris Professional License
|
||||
|
||||
The choice must be made before the software developer distributes software
|
||||
containing parts of Swiss Ephemeris to others, and before any public
|
||||
service using the developed software is activated.
|
||||
|
||||
If the developer choses the GNU GPL software license, he or she must fulfill
|
||||
the conditions of that license, which includes the obligation to place his
|
||||
or her whole software project under the GNU GPL or a compatible license.
|
||||
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
If the developer choses the Swiss Ephemeris Professional license,
|
||||
he must follow the instructions as found in http://www.astro.com/swisseph/
|
||||
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
|
||||
and sign the corresponding license contract.
|
||||
|
||||
The License grants you the right to use, copy, modify and redistribute
|
||||
Swiss Ephemeris, but only under certain conditions described in the License.
|
||||
Among other things, the License requires that the copyright notices and
|
||||
this notice be preserved on all copies.
|
||||
|
||||
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
|
||||
|
||||
The authors of Swiss Ephemeris have no control or influence over any of
|
||||
the derived works, i.e. over software or services created by other
|
||||
programmers which use Swiss Ephemeris functions.
|
||||
|
||||
The names of the authors or of the copyright holder (Astrodienst) must not
|
||||
be used for promoting any software, product or service which uses or contains
|
||||
the Swiss Ephemeris. This copyright notice is the ONLY place where the
|
||||
names of the authors can legally appear, except in cases where they have
|
||||
given special permission in writing.
|
||||
|
||||
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
|
||||
for promoting such software, products or services.
|
||||
*/
|
||||
|
||||
#define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */
|
||||
#define PREC_IAU_2000_CTIES 2.0 /* J2000 +/- two centuries */
|
||||
/* we use P03 for whole ephemeris */
|
||||
#define PREC_IAU_2006_CTIES 75.0 /* J2000 +/- 75 centuries */
|
||||
|
||||
/* For reproducing JPL Horizons to 2 mas (SEFLG_JPLHOR):
|
||||
* The user has to keep the following files up to date which contain
|
||||
* the earth orientation parameters related to the IAU 1980 nutation
|
||||
* theory.
|
||||
* Download the file
|
||||
* datacenter.iers.org/eop/-/somos/5Rgv/document/tx13iers.u24/eopc04_08.62-now
|
||||
* and rename it as eop_1962_today.txt. For current data and estimations for
|
||||
* the near future, also download maia.usno.navy.mil/ser7/finals.all and
|
||||
* rename it as eop_finals.txt */
|
||||
#define DPSI_DEPS_IAU1980_FILE_EOPC04 "eop_1962_today.txt"
|
||||
#define DPSI_DEPS_IAU1980_FILE_FINALS "eop_finals.txt"
|
||||
#define DPSI_DEPS_IAU1980_TJD0_HORIZONS 2437684.5
|
||||
#define HORIZONS_TJD0_DPSI_DEPS_IAU1980 2437684.5
|
||||
#define DPSI_IAU1980_TJD0 (64.284 / 1000.0) // arcsec
|
||||
#define DEPS_IAU1980_TJD0 (6.151 / 1000.0) // arcsec
|
||||
|
||||
/* The above files must be available in order to reproduce JPL Horizons
|
||||
* in agreement with IERS Conventions 1996 (1992), p. 22.
|
||||
* Call swe_calc_ut() with iflag|SEFLG_JPLHOR.
|
||||
* This options works only, if the files DPSI_DEPS_IAU1980_FILE_EOPC04
|
||||
* and DPSI_DEPS_IAU1980_FILE_FINALS are in the ephemeris path.
|
||||
*
|
||||
* If the software does not find the earth orientation files
|
||||
* in the ephemeris path, then SEFLG_JPLHOR will run as
|
||||
* SEFLG_JPLHOR_APPROX.
|
||||
*/
|
||||
|
||||
/* coordinate transformation */
|
||||
extern void swi_coortrf(double *xpo, double *xpn, double eps);
|
||||
|
||||
/* coordinate transformation */
|
||||
extern void swi_coortrf2(double *xpo, double *xpn, double sineps, double coseps);
|
||||
|
||||
/* cartesian to polar coordinates */
|
||||
extern void swi_cartpol(double *x, double *l);
|
||||
|
||||
/* cartesian to polar coordinates with velocity */
|
||||
extern void swi_cartpol_sp(double *x, double *l);
|
||||
extern void swi_polcart_sp(double *l, double *x);
|
||||
|
||||
/* polar to cartesian coordinates */
|
||||
extern void swi_polcart(double *l, double *x);
|
||||
|
||||
/* GCRS to J2000 */
|
||||
extern void swi_bias(double *x, double tjd, int32 iflag, AS_BOOL backward);
|
||||
extern void swi_get_eop_time_range(void);
|
||||
/* GCRS to FK5 */
|
||||
extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward);
|
||||
|
||||
/* precession */
|
||||
extern int swi_precess(double *R, double J, int32 iflag, int direction );
|
||||
extern void swi_precess_speed(double *xx, double t, int32 iflag, int direction);
|
||||
|
||||
extern int32 swi_guess_ephe_flag();
|
||||
|
||||
/* from sweph.c, light deflection, aberration, etc. */
|
||||
extern void swi_deflect_light(double *xx, double dt, int32 iflag);
|
||||
extern void swi_aberr_light(double *xx, double *xe, int32 iflag);
|
||||
extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx);
|
||||
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag);
|
||||
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, int32 iflag);
|
||||
extern int swi_get_observer(double tjd, int32 iflag,
|
||||
AS_BOOL do_save, double *xobs, char *serr);
|
||||
extern void swi_force_app_pos_etc();
|
||||
|
||||
/* obliquity of ecliptic */
|
||||
extern void swi_check_ecliptic(double tjd, int32 iflag);
|
||||
extern double swi_epsiln(double J, int32 iflag);
|
||||
extern void swi_ldp_peps(double J, double *dpre, double *deps);
|
||||
|
||||
/* nutation */
|
||||
extern void swi_check_nutation(double tjd, int32 iflag);
|
||||
extern int swi_nutation(double J, int32 iflag, double *nutlo);
|
||||
extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward);
|
||||
|
||||
extern void swi_mean_lunar_elements(double tjd,
|
||||
double *node, double *dnode,
|
||||
double *peri, double *dperi);
|
||||
/* */
|
||||
extern double swi_mod2PI(double x);
|
||||
|
||||
/* evaluation of chebyshew series and derivative */
|
||||
extern double swi_echeb(double x, double *coef, int ncf);
|
||||
extern double swi_edcheb(double x, double *coef, int ncf);
|
||||
|
||||
/* cross product of vectors */
|
||||
extern void swi_cross_prod(double *a, double *b, double *x);
|
||||
/* dot product of vecotrs */
|
||||
extern double swi_dot_prod_unit(double *x, double *y);
|
||||
|
||||
extern double swi_angnorm(double x);
|
||||
|
||||
/* generation of SWISSEPH file names */
|
||||
extern void swi_gen_filename(double tjd, int ipli, char *fname);
|
||||
|
||||
/* cyclic redundancy checksum (CRC), 32 bit */
|
||||
extern uint32 swi_crc32(unsigned char *buf, int len);
|
||||
|
||||
extern int swi_cutstr(char *s, char *cutlist, char *cpos[], int nmax);
|
||||
extern char *swi_right_trim(char *s);
|
||||
|
||||
extern double swi_kepler(double E, double M, double ecce);
|
||||
|
||||
extern char *swi_get_fict_name(int32 ipl, char *s);
|
||||
|
||||
extern void swi_FK4_FK5(double *xp, double tjd);
|
||||
|
||||
extern char *swi_strcpy(char *to, char *from);
|
||||
extern char *swi_strncpy(char *to, char *from, size_t n);
|
||||
|
||||
extern double swi_deltat_ephe(double tjd_ut, int32 epheflag);
|
||||
|
||||
#ifdef TRACE
|
||||
# define TRACE_COUNT_MAX 10000
|
||||
extern TLS FILE *swi_fp_trace_c;
|
||||
extern TLS FILE *swi_fp_trace_out;
|
||||
extern TLS int32 swi_trace_count;
|
||||
extern void swi_open_trace(char *serr);
|
||||
static const char *fname_trace_c = "swetrace.c";
|
||||
static const char *fname_trace_out = "swetrace.txt";
|
||||
#ifdef FORCE_IFLAG
|
||||
static const char *fname_force_flg = "force.flg";
|
||||
#endif
|
||||
#endif /* TRACE */
|
||||
3643
lib/sweph/swetest.c
Normal file
3643
lib/sweph/swetest.c
Normal file
File diff suppressed because it is too large
Load diff
18
pmom.php
Normal file
18
pmom.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @preserve Copyright (c) 2018 T. F. Raaion, www.sublunar.space
|
||||
* License MIT: http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
header('Content-type: application/json');
|
||||
|
||||
$ts = $_GET['ts'];
|
||||
$lon = $_GET['lon'];
|
||||
$lat = $_GET['lat'];
|
||||
$days = $_GET['days'];
|
||||
|
||||
exec ("lib/sweph/pmom $days $ts $lat $lon", $output);
|
||||
|
||||
echo $output[0];
|
||||
?>
|
||||
197
style.css
Normal file
197
style.css
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
/* noto-sans-regular - greek_greek-ext_latin_latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Noto Sans'), local('NotoSans'),
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
||||
}
|
||||
/* noto-sans-italic - greek_greek-ext_latin_latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
src: local('Noto Sans Italic'), local('NotoSans-Italic'),
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
||||
}
|
||||
/* noto-sans-700italic - greek_greek-ext_latin_latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
src: local('Noto Sans Bold Italic'), local('NotoSans-BoldItalic'),
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-700italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-700italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
||||
}
|
||||
/* noto-sans-700 - greek_greek-ext_latin_latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Noto Sans Bold'), local('NotoSans-Bold'),
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
||||
url('3rd/fonts/noto-sans-v6-greek_greek-ext_latin_latin-ext-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
||||
}
|
||||
|
||||
/* stoke-300 - latin */
|
||||
@font-face {
|
||||
font-family: 'Stoke';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Stoke Light'), local('Stoke-Light'),
|
||||
url('3rd/fonts/stoke-v6-latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
||||
url('3rd/fonts/stoke-v6-latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
||||
}
|
||||
/* stoke-regular - latin */
|
||||
@font-face {
|
||||
font-family: 'Stoke';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Stoke Regular'), local('Stoke-Regular'),
|
||||
url('3rd/fonts/stoke-v6-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
||||
url('3rd/fonts/stoke-v6-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
||||
}
|
||||
|
||||
body {
|
||||
color: #9A8961;
|
||||
background-color: #090A0E;
|
||||
font-family: 'Noto Sans';
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
.nav-pills > li, .nav-pills > li+li {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.noto {
|
||||
font-family: 'Noto Sans'
|
||||
}
|
||||
|
||||
.stoke {
|
||||
font-family: 'Stoke'
|
||||
}
|
||||
|
||||
#grid {
|
||||
}
|
||||
|
||||
.loading {
|
||||
background-color: #ffffff;
|
||||
background-image: url("http://loadinggif.com/images/image-selection/3.gif");
|
||||
background-size: 15px 15px;
|
||||
background-position:right center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.dayrow {
|
||||
margin: 0;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.centered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.now {
|
||||
border: 1px solid #f00;
|
||||
}
|
||||
|
||||
.planetaryhour {
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
width: 15%;
|
||||
float: left;
|
||||
border: 1px solid #9A8961;
|
||||
}
|
||||
|
||||
.night-hour {
|
||||
color: #626FAC;
|
||||
border: 1px solid #626FAC;
|
||||
}
|
||||
|
||||
.planetaryhour table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.planetaryhour table td {
|
||||
font-family: 'Noto Sans';
|
||||
padding-bottom: 5px;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.planetaryhour table td:nth-child(1) {
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.planetaryhour table td:nth-child(3) {
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
.planetaryhour table tr:nth-child(1) td:nth-child(1), .planetaryhour table tr:nth-child(1) td:nth-child(3) {
|
||||
font-size: 1.4em;
|
||||
}
|
||||
|
||||
.planetaryhour table tr:nth-child(1) td:nth-child(2) {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.planetaryhour table tr:nth-child(2) td {
|
||||
border-top: 1px solid #9A8961;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.night-hour table tr:nth-child(2) td {
|
||||
border-top: 1px solid #626FAC;
|
||||
}
|
||||
|
||||
.planetaryhour table tr:nth-child(2) td, .planetaryhour table tr:nth-child(3) td {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.planetaryhour table tr:nth-child(2) td:nth-child(2) {
|
||||
font-size: 1.6em;
|
||||
font-family: 'Stoke';
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.planetaryhour table tr:nth-child(3) td:nth-child(3) {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.ac-renderer { z-index:1240; }
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media screen and (max-width:991px){
|
||||
.col-md-2{
|
||||
width:30%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width:420px){
|
||||
.col-md-2{
|
||||
width:45%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width:280px){
|
||||
.col-md-2{
|
||||
width:90%;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue