@@ -126,7 +126,7 @@ fn callback_error_msg(msg: &str) -> Box<dyn Error + Send + Sync> {
126126}
127127
128128/// Find events where a function crosses zero.
129- #[ wasm_bindgen]
129+ #[ wasm_bindgen( js_name= "findEvents" ) ]
130130pub fn find_events ( func : & Function , start : JsTime , times : Vec < f64 > ) -> Result < Vec < JsEvent > , JsValue > {
131131 let root_finder = Brent :: default ( ) ;
132132 let events = crate :: orbits:: events:: find_events (
@@ -148,7 +148,7 @@ pub fn find_events(func: &Function, start: JsTime, times: Vec<f64>) -> Result<Ve
148148}
149149
150150/// Find time windows where a function is positive.
151- #[ wasm_bindgen]
151+ #[ wasm_bindgen( js_name= "findWindows" ) ]
152152pub fn find_windows ( func : & Function , start : JsTime , end : JsTime , times : Vec < f64 > ) -> Result < Vec < JsWindow > , JsValue > {
153153 let root_finder = Brent :: default ( ) ;
154154 let windows = crate :: orbits:: events:: find_windows (
@@ -222,17 +222,15 @@ impl JsState {
222222 JsFrame :: from_inner ( self . 0 . reference_frame ( ) )
223223 }
224224
225- #[ wasm_bindgen]
226225 pub fn position ( & self ) -> Array {
227226 array_from_vec3 ( self . 0 . position ( ) )
228227 }
229228
230- #[ wasm_bindgen]
231229 pub fn velocity ( & self ) -> Array {
232230 array_from_vec3 ( self . 0 . velocity ( ) )
233231 }
234232
235- #[ wasm_bindgen]
233+ #[ wasm_bindgen( js_name= "toFrame" ) ]
236234 pub fn to_frame ( & self , frame : JsFrame , provider : Option < JsEopProvider > ) -> Result < JsState , JsValue > {
237235 let provider = provider. map ( |p| p. inner ( ) ) ;
238236 let origin = self . 0 . reference_frame ( ) ;
@@ -256,7 +254,7 @@ impl JsState {
256254 ) ) )
257255 }
258256
259- #[ wasm_bindgen]
257+ #[ wasm_bindgen( js_name= "toOrigin" ) ]
260258 pub fn to_origin ( & self , target : JsOrigin , ephemeris : & JsSpk ) -> Result < JsState , JsValue > {
261259 let frame = self . reference_frame ( ) ;
262260 let s = if frame. inner ( ) != DynFrame :: Icrf {
@@ -276,7 +274,7 @@ impl JsState {
276274 Ok ( s1)
277275 }
278276
279- #[ wasm_bindgen]
277+ #[ wasm_bindgen( js_name= "toKeplerian" ) ]
280278 pub fn to_keplerian ( & self ) -> Result < JsKeplerian , JsValue > {
281279 if self . 0 . reference_frame ( ) != DynFrame :: Icrf {
282280 return Err ( js_error_with_name (
@@ -291,7 +289,7 @@ impl JsState {
291289 ) )
292290 }
293291
294- #[ wasm_bindgen]
292+ #[ wasm_bindgen( js_name= "rotationLvlh" ) ]
295293 pub fn rotation_lvlh ( & self ) -> Result < Array , JsValue > {
296294 if self . 0 . reference_frame ( ) != DynFrame :: Icrf {
297295 return Err ( js_error_with_name (
@@ -304,7 +302,7 @@ impl JsState {
304302 Ok ( to_js_2d ( & rot) )
305303 }
306304
307- #[ wasm_bindgen]
305+ #[ wasm_bindgen( js_name= "toGroundLocation" ) ]
308306 pub fn to_ground_location ( & self ) -> Result < JsGroundLocation , JsValue > {
309307 Ok ( JsGroundLocation (
310308 self . 0
@@ -358,7 +356,7 @@ impl JsKeplerian {
358356 JsOrigin :: from_inner ( self . 0 . origin ( ) )
359357 }
360358
361- #[ wasm_bindgen( getter) ]
359+ #[ wasm_bindgen( getter, js_name = "semiMajorAxis" ) ]
362360 pub fn semi_major_axis ( & self ) -> f64 {
363361 self . 0 . semi_major_axis ( )
364362 }
@@ -388,7 +386,7 @@ impl JsKeplerian {
388386 self . 0 . true_anomaly ( )
389387 }
390388
391- #[ wasm_bindgen]
389+ #[ wasm_bindgen( js_name = "toCartesian" ) ]
392390 pub fn to_cartesian ( & self ) -> Result < JsState , JsValue > {
393391 Ok ( JsState ( self . 0 . to_cartesian ( ) ) )
394392 }
@@ -458,7 +456,6 @@ impl JsTrajectory {
458456 Ok ( windows. into_iter ( ) . map ( JsWindow ) . collect ( ) )
459457 }
460458
461- #[ wasm_bindgen]
462459 pub fn interpolate ( & self , time : JsValue ) -> Result < JsState , JsValue > {
463460 if let Ok ( delta) = time. clone ( ) . dyn_into :: < JsTimeDelta > ( ) {
464461 return Ok ( JsState ( self . 0 . interpolate ( delta. inner ( ) ) ) ) ;
@@ -498,19 +495,17 @@ pub struct JsEvent(Event<DynTimeScale>);
498495
499496#[ wasm_bindgen( js_class = "Event" ) ]
500497impl JsEvent {
501- #[ wasm_bindgen( js_name = "time" ) ]
502498 pub fn time ( & self ) -> JsTime {
503499 JsTime :: from_inner ( self . 0 . time ( ) )
504500 }
505501
506- #[ wasm_bindgen( js_name = "crossing" ) ]
507502 pub fn crossing ( & self ) -> String {
508503 self . 0 . crossing ( ) . to_string ( )
509504 }
510505
511506 #[ wasm_bindgen( js_name = "toString" ) ]
512- pub fn to_string_js ( & self ) -> String {
513- format ! ( "Event - {}crossing at {}" , self . crossing( ) , self . time( ) . to_string_js ( ) )
507+ pub fn to_string ( & self ) -> String {
508+ format ! ( "Event - {}crossing at {}" , self . crossing( ) , self . time( ) . to_string ( ) )
514509 }
515510}
516511
@@ -521,17 +516,14 @@ pub struct JsWindow(Window<DynTimeScale>);
521516
522517#[ wasm_bindgen( js_class = "Window" ) ]
523518impl JsWindow {
524- #[ wasm_bindgen( js_name = "start" ) ]
525519 pub fn start ( & self ) -> JsTime {
526520 JsTime :: from_inner ( self . 0 . start ( ) )
527521 }
528522
529- #[ wasm_bindgen( js_name = "end" ) ]
530523 pub fn end ( & self ) -> JsTime {
531524 JsTime :: from_inner ( self . 0 . end ( ) )
532525 }
533526
534- #[ wasm_bindgen( js_name = "duration" ) ]
535527 pub fn duration ( & self ) -> JsTimeDelta {
536528 JsTimeDelta :: from_inner ( self . 0 . duration ( ) )
537529 }
@@ -568,7 +560,6 @@ impl JsVallado {
568560 Ok ( JsVallado ( vallado) )
569561 }
570562
571- #[ wasm_bindgen]
572563 pub fn propagate ( & self , steps : JsValue ) -> Result < JsValue , JsValue > {
573564 if let Ok ( time) = steps. clone ( ) . dyn_into :: < JsTime > ( ) {
574565 let state = self . 0 . propagate ( time. inner ( ) ) . map_err ( JsValladoError ) ?;
@@ -601,7 +592,6 @@ impl JsGroundLocation {
601592 ) )
602593 }
603594
604- #[ wasm_bindgen]
605595 pub fn observables (
606596 & self ,
607597 state : JsState ,
@@ -656,7 +646,6 @@ impl JsGroundPropagator {
656646 JsGroundPropagator ( DynGroundPropagator :: with_dynamic ( location. 0 ) )
657647 }
658648
659- #[ wasm_bindgen]
660649 pub fn propagate ( & self , steps : JsValue ) -> Result < JsValue , JsValue > {
661650 if let Ok ( time) = steps. clone ( ) . dyn_into :: < JsTime > ( ) {
662651 let state = self
@@ -718,7 +707,6 @@ impl JsSgp4 {
718707 )
719708 }
720709
721- #[ wasm_bindgen]
722710 pub fn propagate (
723711 & self ,
724712 steps : JsValue ,
@@ -802,27 +790,23 @@ impl JsElevationMask {
802790 ) )
803791 }
804792
805- #[ wasm_bindgen( js_name = "fixed" ) ]
806793 pub fn fixed ( min_elevation : f64 ) -> Self {
807794 JsElevationMask ( ElevationMask :: with_fixed_elevation ( min_elevation) )
808795 }
809796
810- #[ wasm_bindgen( js_name = "variable" ) ]
811797 pub fn variable ( azimuth : Vec < f64 > , elevation : Vec < f64 > ) -> Result < Self , JsValue > {
812798 Ok ( JsElevationMask (
813799 ElevationMask :: new ( azimuth, elevation) . map_err ( JsElevationMaskError ) ?,
814800 ) )
815801 }
816802
817- #[ wasm_bindgen( js_name = "azimuth" ) ]
818803 pub fn azimuth ( & self ) -> Option < Vec < f64 > > {
819804 match & self . 0 {
820805 ElevationMask :: Fixed ( _) => None ,
821806 ElevationMask :: Variable ( series) => Some ( series. x ( ) . to_vec ( ) ) ,
822807 }
823808 }
824809
825- #[ wasm_bindgen( js_name = "elevation" ) ]
826810 pub fn elevation ( & self ) -> Option < Vec < f64 > > {
827811 match & self . 0 {
828812 ElevationMask :: Fixed ( _) => None ,
@@ -924,7 +908,6 @@ impl JsPass {
924908 . collect ( )
925909 }
926910
927- #[ wasm_bindgen]
928911 pub fn interpolate ( & self , time : JsTime ) -> Option < JsObservables > {
929912 self . 0 . interpolate ( time. inner ( ) ) . map ( JsObservables )
930913 }
0 commit comments