From 400d5003a3c4043cfbe4043bbaede34be15b4cb5 Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Mon, 14 Jan 2013 14:00:21 +0400 Subject: [PATCH] new plotter --- android-app-core/res/values/arrays.xml | 36 ++++ android-app-core/res/values/text_strings.xml | 8 + .../calculator/CalculatorPreferences.java | 6 +- .../plot/AndroidCalculatorPlotter.java | 17 +- android-app/AndroidManifest.xml | 1 + android-app/project.properties | 28 +-- ...lot_fragment.xml => cpp_plot_fragment.xml} | 0 .../layout/cpp_plot_function_list_item.xml | 9 +- .../cpp_plot_function_settings_dialog.xml | 10 ++ .../cpp_plot_function_settings_fragment.xml | 44 +++++ ...nt.xml => cpp_plot_functions_fragment.xml} | 10 +- android-app/res/values/arrays.xml | 15 -- android-app/res/xml/preferences_plot.xml | 8 +- .../calculator/CalculatorActivity.java | 1 - .../calculator/CalculatorActivityHelper.java | 1 - .../CalculatorActivityHelperImpl.java | 1 - .../calculator/CalculatorFragment.java | 1 - .../{about => }/CalculatorFragmentType.java | 15 +- .../calculator/CalculatorListFragment.java | 1 - .../about/CalculatorAboutActivity.java | 1 + .../about/CalculatorAboutFragment.java | 1 + .../about/CalculatorReleaseNotesFragment.java | 1 + .../help/CalculatorHelpActivity.java | 2 +- .../help/CalculatorHelpFaqFragment.java | 2 +- .../help/CalculatorHelpHintsFragment.java | 2 +- .../help/CalculatorHelpScreensFragment.java | 2 +- .../AbstractCalculatorHistoryFragment.java | 2 +- .../history/CalculatorHistoryActivity.java | 2 +- .../history/CalculatorHistoryFragment.java | 2 +- .../CalculatorSavedHistoryFragment.java | 2 +- .../edit/AbstractMathEntityListFragment.java | 2 +- .../edit/CalculatorFunctionsActivity.java | 2 +- .../edit/CalculatorFunctionsFragment.java | 2 +- .../edit/CalculatorOperatorsActivity.java | 2 +- .../edit/CalculatorOperatorsFragment.java | 2 +- .../math/edit/CalculatorVarsActivity.java | 2 +- .../math/edit/CalculatorVarsFragment.java | 2 +- .../matrix/CalculatorMatrixActivity.java | 2 +- .../matrix/CalculatorMatrixEditFragment.java | 2 +- .../plot/AbstractCalculatorPlotFragment.java | 16 +- .../calculator/plot/ArityPlotFunction.java | 8 +- .../plot/CalculatorArityPlotFragment.java | 4 +- .../plot/CalculatorPlotActivity.java | 2 +- ...alculatorPlotFunctionSettingsActivity.java | 166 ++++++++++++++++++ .../plot/CalculatorPlotFunctionsActivity.java | 34 ++++ .../plot/CalculatorPlotFunctionsFragment.java | 37 ---- .../android/calculator/plot/Graph3d.java | 6 +- .../calculator/plot/PlotFunctionListItem.java | 15 +- .../android/fragments/FragmentUtils.java | 19 +- .../calculator/plot/CalculatorPlotter.java | 12 +- .../plot/CalculatorPlotterImpl.java | 27 ++- .../android/calculator/plot/PlotFunction.java | 14 +- .../calculator/plot/PlotFunctionLineDef.java | 96 ---------- ...GraphLineColor.java => PlotLineColor.java} | 17 +- ...eColorType.java => PlotLineColorType.java} | 6 +- .../android/calculator/plot/PlotLineDef.java | 137 +++++++++++++++ .../android/calculator/plot/XyFunction.java | 31 ++-- 57 files changed, 625 insertions(+), 271 deletions(-) create mode 100644 android-app-core/res/values/arrays.xml rename android-app/res/layout/{plot_fragment.xml => cpp_plot_fragment.xml} (100%) rename {android-app-core => android-app}/res/layout/cpp_plot_function_list_item.xml (74%) create mode 100644 android-app/res/layout/cpp_plot_function_settings_dialog.xml create mode 100644 android-app/res/layout/cpp_plot_function_settings_fragment.xml rename android-app/res/layout/{plot_functions_fragment.xml => cpp_plot_functions_fragment.xml} (82%) rename android-app/src/main/java/org/solovyev/android/calculator/{about => }/CalculatorFragmentType.java (81%) create mode 100644 android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionSettingsActivity.java delete mode 100644 android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionsFragment.java rename {android-app-core => android-app}/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionListItem.java (85%) delete mode 100644 core/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionLineDef.java rename core/src/main/java/org/solovyev/android/calculator/plot/{GraphLineColor.java => PlotLineColor.java} (55%) rename core/src/main/java/org/solovyev/android/calculator/plot/{PlotFunctionLineColorType.java => PlotLineColorType.java} (61%) create mode 100644 core/src/main/java/org/solovyev/android/calculator/plot/PlotLineDef.java diff --git a/android-app-core/res/values/arrays.xml b/android-app-core/res/values/arrays.xml new file mode 100644 index 00000000..9e386e2c --- /dev/null +++ b/android-app-core/res/values/arrays.xml @@ -0,0 +1,36 @@ + + + + + @string/cpp_solid_line_style + @string/cpp_dashed_line_style + @string/cpp_dotted_line_style + @string/cpp_dash_dotted_line_style + + + + @string/cpp_monochrome_line_color_type + @string/cpp_color_map_line_color_type + + + + @string/p_white_line_color + @string/p_grey_line_color + @string/p_red_line_color + @string/p_blue_line_color + @string/p_green_line_color + + + white + grey + red + blue + green + + + \ No newline at end of file diff --git a/android-app-core/res/values/text_strings.xml b/android-app-core/res/values/text_strings.xml index 4865d4cb..fe48e74f 100644 --- a/android-app-core/res/values/text_strings.xml +++ b/android-app-core/res/values/text_strings.xml @@ -289,5 +289,13 @@ Plot imaginary part of function If checked imaginary part of function will be plotted + Monochrome + Color map + + Solid (-----) + Dashed (- - -) + Dotted (. . .) + Dash dotted (-.-.-) + \ No newline at end of file diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java index 0aee0bcf..11d6da38 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorPreferences.java @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; import org.solovyev.android.AndroidUtils; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; -import org.solovyev.android.calculator.plot.GraphLineColor; +import org.solovyev.android.calculator.plot.PlotLineColor; import org.solovyev.android.prefs.BooleanPreference; import org.solovyev.android.prefs.IntegerPreference; import org.solovyev.android.prefs.LongPreference; @@ -132,8 +132,8 @@ public final class CalculatorPreferences { public static class Graph { public static final Preference interpolate = new BooleanPreference("graph_interpolate", true); - public static final Preference lineColorReal = StringPreference.newInstance("graph_line_color_real", GraphLineColor.white, GraphLineColor.class); - public static final Preference lineColorImag = StringPreference.newInstance("graph_line_color_imag", GraphLineColor.blue, GraphLineColor.class); + public static final Preference lineColorReal = StringPreference.newInstance("graph_line_color_real", PlotLineColor.white, PlotLineColor.class); + public static final Preference lineColorImag = StringPreference.newInstance("graph_line_color_imag", PlotLineColor.blue, PlotLineColor.class); public static final Preference plotImag = new BooleanPreference("graph_plot_imag", false); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java b/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java index f19e9b49..fcfe0842 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java @@ -5,6 +5,7 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import jscl.math.Generic; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.solovyev.android.calculator.CalculatorPreferences; import java.util.List; @@ -53,7 +54,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } @Override - public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef) { + public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) { return plotter.addFunction(xyFunction, functionLineDef); } @@ -63,7 +64,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } @Override - public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef) { + public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) { return plotter.updateFunction(xyFunction, functionLineDef); } @@ -106,7 +107,13 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer plotter.clearAllFunctions(); } - @Override + @Nullable + @Override + public PlotFunction getFunctionById(@NotNull String functionId) { + return plotter.getFunctionById(functionId); + } + + @Override @NotNull public List getFunctions() { return plotter.getFunctions(); @@ -168,11 +175,11 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } } - public void setImagLineColor(@NotNull GraphLineColor imagLineColor) { + public void setImagLineColor(@NotNull PlotLineColor imagLineColor) { plotter.setImagLineColor(imagLineColor); } - public void setRealLineColor(@NotNull GraphLineColor realLineColor) { + public void setRealLineColor(@NotNull PlotLineColor realLineColor) { plotter.setRealLineColor(realLineColor); } } diff --git a/android-app/AndroidManifest.xml b/android-app/AndroidManifest.xml index 08d16d36..4b1d1037 100644 --- a/android-app/AndroidManifest.xml +++ b/android-app/AndroidManifest.xml @@ -53,6 +53,7 @@ + diff --git a/android-app/project.properties b/android-app/project.properties index 542cf64d..1b8a55be 100644 --- a/android-app/project.properties +++ b/android-app/project.properties @@ -12,19 +12,19 @@ target=android-15 android.library.reference.1=../android-app-core android.library.reference.2=../android-app-widget android.library.reference.3=../android-app-onscreen -android.library.reference.4=gen-external-apklibs/org.solovyev.android_android-common-all_1.0.6 -android.library.reference.5=gen-external-apklibs/org.solovyev.android_android-common-ads_1.0.6 -android.library.reference.6=gen-external-apklibs/org.solovyev.android_android-common-core_1.0.6 -android.library.reference.7=gen-external-apklibs/org.solovyev.android_android-common-billing_1.0.6 -android.library.reference.8=gen-external-apklibs/org.solovyev.android_android-common-db_1.0.6 -android.library.reference.9=gen-external-apklibs/org.solovyev.android_android-common-http_1.0.6 -android.library.reference.10=gen-external-apklibs/org.solovyev.android_android-common-list_1.0.6 -android.library.reference.11=gen-external-apklibs/org.solovyev.android_android-common-view_1.0.6 -android.library.reference.12=gen-external-apklibs/org.solovyev.android_android-common-preferences_1.0.6 -android.library.reference.13=gen-external-apklibs/org.solovyev.android_android-common-menu_1.0.6 -android.library.reference.14=gen-external-apklibs/org.solovyev.android_android-common-other_1.0.6 -android.library.reference.15=gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.0.6 -android.library.reference.16=gen-external-apklibs/com.actionbarsherlock_actionbarsherlock_4.2.0 -android.library.reference.17=gen-external-apklibs/org.solovyev.android_android-common-keyboard_1.0.6 +android.library.reference.4=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-all_1.0.6 +android.library.reference.5=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-ads_1.0.6 +android.library.reference.6=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-core_1.0.6 +android.library.reference.7=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-billing_1.0.6 +android.library.reference.8=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-db_1.0.6 +android.library.reference.9=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-http_1.0.6 +android.library.reference.10=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-list_1.0.6 +android.library.reference.11=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-view_1.0.6 +android.library.reference.12=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-preferences_1.0.6 +android.library.reference.13=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-menu_1.0.6 +android.library.reference.14=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-other_1.0.6 +android.library.reference.15=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.0.6 +android.library.reference.16=../android-app-core/gen-external-apklibs/com.actionbarsherlock_actionbarsherlock_4.2.0 +android.library.reference.17=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-keyboard_1.0.6 diff --git a/android-app/res/layout/plot_fragment.xml b/android-app/res/layout/cpp_plot_fragment.xml similarity index 100% rename from android-app/res/layout/plot_fragment.xml rename to android-app/res/layout/cpp_plot_fragment.xml diff --git a/android-app-core/res/layout/cpp_plot_function_list_item.xml b/android-app/res/layout/cpp_plot_function_list_item.xml similarity index 74% rename from android-app-core/res/layout/cpp_plot_function_list_item.xml rename to android-app/res/layout/cpp_plot_function_list_item.xml index 8c594072..ac16cb80 100644 --- a/android-app-core/res/layout/cpp_plot_function_list_item.xml +++ b/android-app/res/layout/cpp_plot_function_list_item.xml @@ -9,7 +9,7 @@ a:id="@+id/cpp_plot_function_expression_textview" a:layout_width="0dp" a:layout_height="wrap_content" - a:layout_weight="5"/> + a:layout_weight="3"/> + + \ No newline at end of file diff --git a/android-app/res/layout/cpp_plot_function_settings_dialog.xml b/android-app/res/layout/cpp_plot_function_settings_dialog.xml new file mode 100644 index 00000000..742f0b5c --- /dev/null +++ b/android-app/res/layout/cpp_plot_function_settings_dialog.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/android-app/res/layout/cpp_plot_function_settings_fragment.xml b/android-app/res/layout/cpp_plot_function_settings_fragment.xml new file mode 100644 index 00000000..3c7dcf38 --- /dev/null +++ b/android-app/res/layout/cpp_plot_function_settings_fragment.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + +