Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SetupGUI()
- exec('berechnung.sce');
- exec('setup_helpWindow.sce');
- exec('setup_constWindow.sce');
- exec('export.sce');
- mainWindow = setup_mainWindow();
- mainWindow.immediate_drawing = "off";
- setup_menubar();
- subWindow_inputs_tab = setup_subWindow_inputs();
- subWindow_button = setup_subWindow_button();
- subWindow_diagramms = setup_subWindow_diagramms();
- tab = createTab("tab");
- mainWindow.immediate_drawing = "on";
- setup_helpWindow();
- setup_constWindow();
- endfunction
- function [mainWindow_local] = setup_mainWindow() // Settings of the mainwindow
- mainWindow_local = figure( ...
- "dockable", "off", ...
- "infobar_visible", "off", ...
- "toolbar_visible", "off", ...
- "toolbar", "none", ...
- "menubar_visible", "on", ...
- "menubar", "none", ...
- "layout", "none", ...
- "resize", "off", ...
- "visible", "off");
- mainWindow_local.figure_id = 1;
- mainWindow_local.background = -2;
- mainWindow_local.color_map = jetcolormap(128);
- mainWindow_local.figure_position = [0 0];
- mainWindow_local.figure_name = gettext("Fahrradsimulator");
- mainWindow_local.axes_size = [1024 600];
- mainWindow_local.immediate_drawing = "on";
- mainWindow_local.visible = "on";
- endfunction
- function show_helpWindow()
- help_window = get_figure_handle(2);
- help_window.visible = "on";
- endfunction
- function show_constWindow()
- const_window = get_figure_handle(3);
- const_window.visible = "on";
- endfunction
- function setup_menubar() // Settings of the menubar
- mainWindow_para = get_figure_handle(1);
- menubar_datei = uimenu(mainWindow_para, "label", "Datei");
- //uimenu(menubar_datei, "label", "Exportieren als PDF", "callback", "export_pdf();");
- //uimenu(menubar_datei, "label", "Exportieren als JPG", "callback", "export_jpg();");
- //uimenu(menubar_datei, "label", "Exportieren als XLS", "callback", "export_xls();");
- uimenu(menubar_datei, "label", "Schließen", "callback", "mainwindow=get_figure_handle(1);delete(mainwindow);", "tag", "close_menu");
- menubar_help = uimenu(mainWindow_para, "label", "Hilfe");
- uimenu(menubar_help, "label", "Hilfe", "callback", "show_helpWindow();", "tag", "help_menu");
- menubar_const = uimenu(mainWindow_para, "label", "Einstellungen");
- uimenu(menubar_const, "label", "Konstanten", "callback", "show_constWindow();", "tag", "const_menu");
- endfunction
- function subWindow_inputs_tab = setup_subWindow_inputs()
- mainWindow_para = get_figure_handle(1);
- subWindow_inputs_local = uicontrol(mainWindow_para, ...
- "style", "frame", ...
- "position", [0 0 350 600], ...
- "backgroundcolor", [0.9 0.9 0.9], ...
- "layout", "none", ...
- "scrollable", "on");
- subWindow_inputs_header = uicontrol(subWindow_inputs_local, "style", "text");
- subWindow_inputs_header.layout = "none";
- subWindow_inputs_header.position = [133 550 100 20];
- subWindow_inputs_header.backgroundcolor = [0.9 0.9 0.9];
- subWindow_inputs_header.fontsize = 14;
- subWindow_inputs_header.fontweight = "bold";
- subWindow_inputs_header.string = "Eingabewerte";
- subWindow_inputs_tab = uicontrol(subWindow_inputs_local, ...
- "style", "frame", ...
- "position", [5 0 350 535], ...
- "layout", "border", ...
- "scrollable", "on");
- subWindow_inputs_grid = uicontrol(subWindow_inputs_tab, ...
- "style", "frame", ...
- "position", [5 0 350 535], ...
- "backgroundcolor", [1 1 1], ...
- "scrollable", "on", ...
- "layout", "grid");
- lay_opt = createLayoutOptions("grid", [21,3]);
- set(subWindow_inputs_grid, "layout_options", lay_opt);
- constraints_grid = createConstraints("grid");
- ListeEingaben = list("Masse Fahrrad", "spinner", 15, 5, 50, 0.1, "$kg$", ...
- "Masse Fahrer", "spinner", 75, 40, 150, 0.1, "$kg$", ...
- "Stirnfläche Fahrer", "spinner", 0.4, 0.1, 2 , 0.1, "$m^2$", ...
- "Raddurchmesser", "spinner", 28, 16, 34, 0.5, "$Zoll$", ...
- "Anzahl Speichen", "spinner", 36, 10, 50, 1, "$Stk$", ...
- "Pedalradius", "spinner", 0.18, 0.1, 0.3, 0.01, "$m$", ...
- "Gesamtwirkungsgrad", "spinner", 96, 0, 100, 0.1, "$\%$", ...
- "Fahrradtyp (cw-Wert)", "edit", 999, 999, 999, 0.1, "", ...
- "Zähnezahl vorne", "edit", 999, 999, 999, 1, "", ...
- "Zähnezahl hinten", "edit", 999, 999, 999, 1, "", ...
- "Rollwiderstandszahl", "spinner", 0.01, 0, 0.1, 0.001, "", ...
- "Bodenwerte", "edit", 999, 999, 999, 0.1, "", ...
- "Steigungswinkel", "spinner", 7, 0, 150, 0.1, "$\%$", ...
- "Fahrgeschwindigkeit", "spinner", 6, 1, 30, 0.1, "$m/s$", ...
- "Windgeschwindigkeit", "spinner", 0, 0, 10, 0.1, "$m/s$", ...
- "Windrichtung", "spinner", 180, -180, 180, 1, "$°$", ...
- "Zurückgelegte Strecke", "spinner", 5000, 100, 100000, 1, "$m$", ...
- "Transl. Beschleunigung", "spinner", 2, 0, 10, 0.1, "$m/s^2$", ...
- "Temperatur", "spinner", 293, 253, 313, 0.5, "$K$");
- myList = list(uicontrol);
- k = 0;
- for i = 1:21
- if i == 21 then
- uicontrol(subWindow_inputs_grid, "style", "frame");
- headerline1 = uicontrol(subWindow_inputs_grid, ...
- "style", "text", ...
- "layout", "none", ...
- "string", "Interne Größen", ...
- "horizontalalignment", "center", ...
- "fontsize", 12, ...
- "fontweight", "bold", ...
- "constraints", constraints_grid);
- uicontrol(subWindow_inputs_grid, "style", "frame");
- elseif i == 15 then
- uicontrol(subWindow_inputs_grid, "style", "frame");
- headline2 = uicontrol(subWindow_inputs_grid, ...
- "style", "text", ...
- "layout", "none", ...
- "string", "Externe Größen", ...
- "horizontalalignment", "center", ...
- "fontsize", 12, ...
- "fontweight", "bold", ...
- "constraints", constraints_grid);
- uicontrol(subWindow_inputs_grid, "style", "frame");
- else
- k = k + 1;
- myList(3*i-2) = uicontrol(subWindow_inputs_grid, ...
- "style", "text", ...
- "layout", "none", ...
- "string", ListeEingaben((19*7)-(7*k-7)), ...
- "constraints", constraints_grid);
- if i == 8 then
- auswahl = [
- "Harter Beton (1,0)", "#D0D0D0", "#000000";
- "Kopfsteinpfl. (1,5)", "#FFFFFF", "#000000";
- "Schlaglöcher (3,0)", "#D0D0D0", "#000000";
- "Fester Sand (4,0)", "#FFFFFF", "#000000";
- "Loser Sand (20,0)", "#D0D0D0", "#000000"];
- c = createConstraints("gridbag", [2, 4, 1, 1], [0 0], "both");
- myList(3*i-1)= uicontrol(subWindow_inputs_grid, "style", "popupmenu", ...
- "constraints", c, ...
- "margins", [5 5 5 5], ...
- "tag", ListeEingaben((19*7)-(7*k-1)), ...
- "string", auswahl, ...
- "value", 1);
- elseif i == 10 then
- auswahl = [
- "14", "#D0D0D0", "#000000";
- "15", "#FFFFFF", "#000000";
- "17", "#D0D0D0", "#000000";
- "20", "#FFFFFF", "#000000";
- "24", "#D0D0D0", "#000000";
- "30", "#FFFFFF", "#000000"];
- c = createConstraints("gridbag", [2, 4, 1, 1], [0 0], "both");
- myList(3*i-1)= uicontrol(subWindow_inputs_grid, "style", "popupmenu", ...
- "constraints", c, ...
- "margins", [5 5 5 5], ...
- "tag", ListeEingaben((19*7)-(7*k-1)), ...
- "string", auswahl, ...
- "value", 1);
- elseif i == 11 then
- auswahl = [
- "30", "#D0D0D0", "#000000";
- "38", "#FFFFFF", "#000000";
- "46", "#D0D0D0", "#000000"];
- c = createConstraints("gridbag", [2, 4, 1, 1], [0 0], "both");
- myList(3*i-1)= uicontrol(subWindow_inputs_grid, "style", "popupmenu", ...
- "constraints", c, ...
- "margins", [5 5 5 5], ...
- "tag", ListeEingaben((19*7)-(7*k-1)), ...
- "string", auswahl, ...
- "value", 1);
- elseif i == 12 then
- auswahl = [
- "BMX (1,10)", "#D0D0D0", "#000000";
- "Tourenrad (1,00)", "#FFFFFF", "#000000";
- "Rennrad (0,88)", "#D0D0D0", "#000000";
- "Rekordrad (0,11)", "#FFFFFF", "#000000";
- "Perf. Rad (0,05)", "#D0D0D0", "#000000"];
- c = createConstraints("gridbag", [2, 4, 1, 1], [0 0], "both");
- myList(3*i-1)= uicontrol(subWindow_inputs_grid, "style", "popupmenu", ...
- "constraints", c, ...
- "margins", [5 5 5 5], ...
- "tag", ListeEingaben((19*7)-(7*k-1)), ...
- "string", auswahl, ...
- "value", 1);
- else
- myList(3*i-1) = uicontrol(subWindow_inputs_grid, ...
- "style", ListeEingaben((19*7)-(7*k-2)), ...
- "layout", "none", ...
- "tag", ListeEingaben((19*7)-(7*k-1)), ...
- "value", ListeEingaben((19*7)-(7*k-3)), ...
- "min", ListeEingaben((19*7)-(7*k-4)), ...
- "max", ListeEingaben((19*7)-(7*k-5)), ...
- "sliderstep", ListeEingaben((19*7)-(7*k-6)), ...
- "constraints", constraints_grid);
- end
- myList(3*i) = uicontrol(subWindow_inputs_grid, ...
- "style", "text", ...
- "layout", "none", ...
- "string", ListeEingaben((19*7)-(7*k-1)), ...
- "constraints", constraints_grid);
- if modulo(i,2) == 0 then
- myList(3*i-2).backgroundcolor = [0.9 0.9 0.9];
- myList(3*i).backgroundcolor = [0.9 0.9 0.9];
- else
- myList(3*i-2).backgroundcolor = [0.8 0.8 0.8];
- myList(3*i).backgroundcolor = [0.8 0.8 0.8];
- end
- end
- end
- endfunction
- function [subWindow_button] = setup_subWindow_button()
- mainWindow_para = get_figure_handle(1);
- subWindow_button = uicontrol(get_figure_handle(1), ...
- "style", "pushbutton", ...
- "string", "Berechnung starten", ...
- "font", "bold", ...
- "fontsize", 14, ...
- "position", [351 0 672 50]);
- subWindow_button.callback = "Berechnung()";
- endfunction
- function [subWindow_diagramms_local] = setup_subWindow_diagramms()
- mainWindow_para = get_figure_handle(1);
- subWindow_diagramms_local = uicontrol(mainWindow_para, ...
- "style", "frame", ...
- "position", [351 50 674 532], ...
- "layout", "border", ...
- "tag", "subWindow_diagramms", ...
- "scrollable", "on");
- endfunction
- function tabs = createTab(uiType)
- subWindow_diagramms_local = findobj("tag", "subWindow_diagramms");
- tabs = uicontrol(subWindow_diagramms_local, "style", uiType, "tag" ,"tab", "constraints", createConstraints("border", "center"));
- tab_aufgabe2 = uicontrol(tabs, "style", "frame", "tag", "tab_aufgabe2", "string", "Rollwiderstandsleistung", "layout", "border");
- tab_ergebnisse = uicontrol(tabs, "style", "frame", "tag", "tab_ergebnisse", "string", "Ergebnisse", "layout", "border");
- subWindow_diagramms_local.visible = "on";
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement