public void Calculate() { double jul_ut = SweWrapper.ToJulianDay(this.moment); PlanetPosition pos = null; foreach (PlanetId id in Astrolabe.Concerned) { pos = SweWrapper.PositionOf(jul_ut, id, SeFlg.SEFLG_SPEED); if (this.starPositions.ContainsKey(id)) { this.starPositions[id] = pos; } else { this.starPositions.Add(id, pos); } //this.starPositions.Add(id, pos); //pos2 = PositionOf(jul_et, id); } SweWrapper.swe_close(); PlanetPosition posA, posB; patterns.Clear(); for (int i = 0; i < starPositions.Count - 1; i++) { KeyValuePair <PlanetId, PlanetPosition> kvp = starPositions.ElementAt(i); posA = kvp.Value; for (int j = i + 1; j < starPositions.Count; j++) { kvp = starPositions.ElementAt(j); posB = kvp.Value; if (Relation.HasRelation(posA, posB)) { Relation newRelation = new Relation(posA, posB); patterns.Add(newRelation.Kind, newRelation); } } } }
public List <Phenomenon> GetNearbyPhenonema() { List <Phenomenon> phenomena = new List <Phenomenon>(); PlanetPosition posA, posB; for (int i = 0; i < starPositions.Count - 1; i++) { KeyValuePair <PlanetId, PlanetPosition> kvp = starPositions.ElementAt(i); posA = kvp.Value; for (int j = i + 1; j < starPositions.Count; j++) { kvp = starPositions.ElementAt(j); posB = kvp.Value; Relation newRelation = new Relation(posA, posB); AspectHelper helper = new AspectHelper(newRelation.Kind, this.moment); Phenomenon newPhenom = helper.PhenomenonNearby(); if (newPhenom != null) { phenomena.Add(newPhenom); } //if (Relation.HasRelation(posA, posB)) //{ // Relation newRelation = new Relation(posA, posB); // AspectHelper helper = new AspectHelper(newRelation.Kind, this.moment); // Phenomenon newPhenom = helper.PhenomenonNearby(); // if (newPhenom != null) // phenomena.Add(newPhenom); //} } } SweWrapper.swe_close(); return(phenomena); }