Struct libswe_sys::sweconst::House

source ·
pub struct House {
    pub object_id: i32,
    pub longitude: f64,
    pub split: SplitDegResult,
    pub angle: Angle,
}

Fields§

§object_id: i32§longitude: f64§split: SplitDegResult§angle: Angle

Implementations§

source§

impl House

source

pub fn new(object_id: i32, longitude: f64, angle: Angle) -> House

Examples found in repository?
examples/debug.rs (line 147)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
fn main() {
    println!("Swissephem C -> Rust");
    // let swe02_path_final = "/src/swisseph/sweph";
    // let swe02_path: String =
    //    env::var("CARGO_MANIFEST_DIR").unwrap() + swe02_path_final;
    let swe02_path: &str = "/Users/stephanebressani/Code/Rust/astro_compute_swisseph/lib/libswe-sys/src/swisseph/sweph/";
    println!("Set the path of ephemeris to: {}", swe02_path);
    handler_swe02::set_ephe_path(&swe02_path);
    println!("Version swephem: {}", handler_swe02::version());
    println!("Get path of library: {}", handler_swe02::get_library_path());

    const PATH: &str = "examples/data.json";
    let mut s = String::new();
    let mut file_path = PathBuf::new();
    file_path.push(env::current_dir().unwrap().as_path());
    file_path.push(PATH);
    File::open(file_path.as_path())
        .unwrap()
        .read_to_string(&mut s)
        .unwrap();
    let data: Data = serde_json::from_str(&s).unwrap();
    println!("Data: {:?}", data);
    let julday: f64 = handler_swe08::julday(
        data.year,
        data.month,
        data.day,
        data.hourf64,
        Calandar::Gregorian,
    );
    println!("Get julday: {:?}", julday);

    let mut object: Vec<Object> = Vec::new();
    let mut calc: handler_swe03::CalcUtResult;
    for bodies in Bodies::iter() {
        if bodies.clone().object_type() == ObjectType::PlanetOrStar {
            calc = handler_swe03::calc_ut(
                julday,
                bodies.clone(),
                OptionalFlag::Speed as i32,
            );
            object.push(Object::new(
                bodies.clone().as_static(),
                bodies.clone().object_type(),
                calc.longitude,
                calc.latitude,
            ));
        }
    }

    for o in object {
        println!("{:?}", o);
    }

    let pheno_ut: handler_swe07::PhenoUtResult = handler_swe07::pheno_ut(
        julday,
        Bodies::Sun,
        OptionalFlag::Speed as i32,
    );
    println!("PhenoUt: {:?}", pheno_ut);

    // let hsys = HouseSystem::Placidus;
    let name = handler_swe14::house_name('P');
    println!("Hsys: {}", name);

    let utc_time_zone: handler_swe08::UtcTimeZoneResult =
        handler_swe08::utc_time_zone(
            data.year, data.month, data.day, data.hour, data.min, data.sec, 2.0,
        );
    println!("utc_time_zone: {:?}", utc_time_zone);

    let utc_to_jd: handler_swe08::UtcToJdResult = handler_swe08::utc_to_jd(
        utc_time_zone.year[0],
        utc_time_zone.month[0],
        utc_time_zone.day[0],
        utc_time_zone.hour[0],
        utc_time_zone.min[0],
        utc_time_zone.sec[0],
        /*utc_time_zone.year[1],
        utc_time_zone.month[1],
        utc_time_zone.day[1],
        utc_time_zone.hour[1],
        utc_time_zone.min[1],
        utc_time_zone.sec[1],*/
        Calandar::Gregorian,
    );
    println!("utc_to_jd: {:?}", utc_to_jd);

    // Whole signs
    let result_w =
        handler_swe14::houses(utc_to_jd.julian_day_ut, data.lat, data.lng, 'W');
    //println!("House object: {:?}", result);
    let mut house2: Vec<House> = Vec::new();
    for (i, res) in result_w.clone().cusps.iter().enumerate() {
        if i > 0 {
            // No angle calculation when Nothing
            let angle = Angle::Nothing;
            house2.push(House::new(i as i32, res.clone(), angle));
            if i + 1 > 12 {
                break;
            }
        }
    }

    for h in house2 {
        println!("{:?}", h);
    }
    println!("House (wohle signs): {:?}", result_w.clone());

    // Wohle Signs
    let result =
        handler_swe14::houses(utc_to_jd.julian_day_ut, data.lat, data.lng, 'P');
    //println!("House object: {:?}", result);
    let mut house: Vec<House> = Vec::new();
    for (i, res) in result.clone().cusps.iter().enumerate() {
        if i > 0 {
            let angle;
            /*
            if result.clone().ascmc[0] == res.clone() {
                angle = Angle::Asc;
            }
            if result.clone().ascmc[1] == res.clone() {
                angle = Angle::Fc;
            }
            if result.clone().ascmc[2] == res.clone() {
                angle = Angle::Desc;
            }
            if result.clone().ascmc[3] == res.clone() {
                angle = Angle::Mc;
            }*/
            // This is tested with Placidus only
            // the line above ascmc[?] don't work for Desc and Mc
            angle = match i {
                1 => Angle::Asc,
                4 => Angle::Fc,
                7 => Angle::Desc,
                10 => Angle::Mc,
                _ => Angle::Nothing,
            };
            house.push(House::new(i as i32, res.clone(), angle));
            if i + 1 > 12 {
                break;
            }
        }
    }

    for h in house {
        println!("{:?}", h);
    }
    println!("House (Placidus): {:?}", result.clone());

    println!("Exit and free memory swephem");
    handler_swe02::close();
}

Trait Implementations§

source§

impl Clone for House

source§

fn clone(&self) -> House

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for House

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for House

§

impl RefUnwindSafe for House

§

impl Send for House

§

impl Sync for House

§

impl Unpin for House

§

impl UnwindSafe for House

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.