diff --git a/dashboard.py b/dashboard.py index 47379cc..2392f92 100644 --- a/dashboard.py +++ b/dashboard.py @@ -17,10 +17,6 @@ from GHA_triaxial.panou_2013_2GHA_num import gha2_num app = Dash(__name__, suppress_callback_exceptions=True) app.title = "Geodätische Hauptaufgaben" - -def abplattung(a, b): - return (a - b) / a - def ellipsoid_figure(ell: EllipsoidTriaxial, title="Dreiachsiges Ellipsoid"): fig = go.Figure() @@ -196,6 +192,7 @@ app.layout = html.Div( placeholder="ay...[m]", style={"marginBottom": "10px", "display": "block", "width": "300px"}, ), + dcc.Input( id="input-b", type="number", @@ -204,16 +201,6 @@ app.layout = html.Div( style={"marginBottom": "20px", "display": "block", "width": "300px"}, ), - html.Button( - "Ellipsoid berechnen", - id="calc-ell", - n_clicks=0, - style={"marginRight": "10px", "marginBottom": "20px"}, - ), - - # Ausgabebereich für Ellipsoid-Berechnung - html.Div(id="output-area", style={"marginBottom": "20px"}), - # Tabs für beide Hauptaufgaben - Inhalt wird per Funktion generiert s.u. dcc.Tabs( id="tabs-GHA", @@ -281,31 +268,6 @@ def fill_inputs_from_dropdown(selected_ell): b = ell.b return ax, ay, b -# Funktion zur Berechnung der Ellipsoid-Parameter -@app.callback( - Output("output-area", "children"), - Input("calc-ell", "n_clicks"), - State("input-ax", "value"), - State("input-ay", "value"), - State("input-b", "value"), -) -def update_output(n_clicks, ax, ay, b): - if not n_clicks: - return "" - if n_clicks and ax is None or ay is None or b is None: - return html.Span("Bitte Ellipsoid auswählen!", style={"color": "red"}) - if ay >= ax or b >= ay or ax <= 0 or ay <= 0 or b <= 0: - return html.Span("Eingabe inkorrekt.", style={"color": "red"}) - ell = EllipsoidTriaxial(ax, ay, b) - out_ell = [] - out_ell.append( - html.Div([ - html.P(f"eₓ = {round(ell.ex, 6)}, eᵧ = {round(ell.ey, 6)}, eₑ = {round(ell.ee, 6)}"), - #html.Br(), - html.P(f"Eₓ = {round(ell.Ex, 3)}, Eᵧ = {round(ell.Ey, 3)}, Eₑ = {round(ell.Ee, 3)}"), - ])) - return out_ell - # Funktion zur Generierung der Tab-Inhalte @app.callback( Output("tabs-GHA-out", "children"), @@ -604,7 +566,7 @@ def compute_gha1_ana(n1, beta11, lamb11, s, a_deg, ax, ay, b, method1): html.Br(), html.Span(f"kartesisch: x₂={x2:.4f} m, y₂={y2:.4f} m, z₂={z2:.4f} m"), html.Br(), - html.Span(f"ellipsoidisch: {aus.gms('β₂', beta2, 4)}, {aus.gms('λ₂', lamb2, 4)}"), + html.Span(f"elliptisch: {aus.gms('β₂', beta2, 4)}, {aus.gms('λ₂', lamb2, 4)}"), html.Br(), ]) @@ -821,10 +783,10 @@ def render_all(ax, ay, b, store_gha1_ana, store_gha1_num, store_gha2_num, store_ fig = ellipsoid_figure(ell, title="") fig = figure_constant_lines(fig, ell, "ell") - def add_from_store(store): + def add_from_store(fig, store): if not store: - return - pts = store.get("points") + return fig + pts = store.get("points") or [] if pts: fig = figure_points(fig, pts) line = store.get("polyline") @@ -833,13 +795,9 @@ def render_all(ax, ay, b, store_gha1_ana, store_gha1_num, store_gha2_num, store_ return fig for st in (store_gha1_ana, store_gha1_num, store_gha2_num, store_gha2_stoch): - res = add_from_store(st) - if res is not None: - fig = res + fig = add_from_store(fig, st) return fig - - if __name__ == "__main__": app.run(debug=False)