new plotter
This commit is contained in:
parent
bb9d6f4038
commit
400d5003a3
36
android-app-core/res/values/arrays.xml
Normal file
36
android-app-core/res/values/arrays.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!--
|
||||||
|
monochrome,
|
||||||
|
dashed,
|
||||||
|
dotted,
|
||||||
|
dash_dotted;
|
||||||
|
-->
|
||||||
|
<string-array name="cpp_plot_line_style_names">
|
||||||
|
<item>@string/cpp_solid_line_style</item>
|
||||||
|
<item>@string/cpp_dashed_line_style</item>
|
||||||
|
<item>@string/cpp_dotted_line_style</item>
|
||||||
|
<item>@string/cpp_dash_dotted_line_style</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="cpp_plot_line_color_type_names">
|
||||||
|
<item>@string/cpp_monochrome_line_color_type</item>
|
||||||
|
<item>@string/cpp_color_map_line_color_type</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="cpp_plot_line_color_names">
|
||||||
|
<item>@string/p_white_line_color</item>
|
||||||
|
<item>@string/p_grey_line_color</item>
|
||||||
|
<item>@string/p_red_line_color</item>
|
||||||
|
<item>@string/p_blue_line_color</item>
|
||||||
|
<item>@string/p_green_line_color</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="cpp_plot_line_color_values">
|
||||||
|
<item>white</item>
|
||||||
|
<item>grey</item>
|
||||||
|
<item>red</item>
|
||||||
|
<item>blue</item>
|
||||||
|
<item>green</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
</resources>
|
@ -289,5 +289,13 @@
|
|||||||
<string name="cpp_prefs_graph_plot_imag_title">Plot imaginary part of function</string>
|
<string name="cpp_prefs_graph_plot_imag_title">Plot imaginary part of function</string>
|
||||||
<string name="cpp_prefs_graph_plot_imag_summary">If checked imaginary part of function will be plotted</string>
|
<string name="cpp_prefs_graph_plot_imag_summary">If checked imaginary part of function will be plotted</string>
|
||||||
|
|
||||||
|
<string name="cpp_monochrome_line_color_type">Monochrome</string>
|
||||||
|
<string name="cpp_color_map_line_color_type">Color map</string>
|
||||||
|
|
||||||
|
<string name="cpp_solid_line_style">Solid (-----)</string>
|
||||||
|
<string name="cpp_dashed_line_style">Dashed (- - -)</string>
|
||||||
|
<string name="cpp_dotted_line_style">Dotted (. . .)</string>
|
||||||
|
<string name="cpp_dash_dotted_line_style">Dash dotted (-.-.-)</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.AndroidUtils;
|
||||||
import org.solovyev.android.calculator.math.MathType;
|
import org.solovyev.android.calculator.math.MathType;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
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.BooleanPreference;
|
||||||
import org.solovyev.android.prefs.IntegerPreference;
|
import org.solovyev.android.prefs.IntegerPreference;
|
||||||
import org.solovyev.android.prefs.LongPreference;
|
import org.solovyev.android.prefs.LongPreference;
|
||||||
@ -132,8 +132,8 @@ public final class CalculatorPreferences {
|
|||||||
|
|
||||||
public static class Graph {
|
public static class Graph {
|
||||||
public static final Preference<Boolean> interpolate = new BooleanPreference("graph_interpolate", true);
|
public static final Preference<Boolean> interpolate = new BooleanPreference("graph_interpolate", true);
|
||||||
public static final Preference<GraphLineColor> lineColorReal = StringPreference.newInstance("graph_line_color_real", GraphLineColor.white, GraphLineColor.class);
|
public static final Preference<PlotLineColor> lineColorReal = StringPreference.newInstance("graph_line_color_real", PlotLineColor.white, PlotLineColor.class);
|
||||||
public static final Preference<GraphLineColor> lineColorImag = StringPreference.newInstance("graph_line_color_imag", GraphLineColor.blue, GraphLineColor.class);
|
public static final Preference<PlotLineColor> lineColorImag = StringPreference.newInstance("graph_line_color_imag", PlotLineColor.blue, PlotLineColor.class);
|
||||||
public static final Preference<Boolean> plotImag = new BooleanPreference("graph_plot_imag", false);
|
public static final Preference<Boolean> plotImag = new BooleanPreference("graph_plot_imag", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.CalculatorPreferences;
|
import org.solovyev.android.calculator.CalculatorPreferences;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -53,7 +54,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef) {
|
public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) {
|
||||||
return plotter.addFunction(xyFunction, functionLineDef);
|
return plotter.addFunction(xyFunction, functionLineDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef) {
|
public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) {
|
||||||
return plotter.updateFunction(xyFunction, functionLineDef);
|
return plotter.updateFunction(xyFunction, functionLineDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +107,13 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
|
|||||||
plotter.clearAllFunctions();
|
plotter.clearAllFunctions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public PlotFunction getFunctionById(@NotNull String functionId) {
|
||||||
|
return plotter.getFunctionById(functionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<PlotFunction> getFunctions() {
|
public List<PlotFunction> getFunctions() {
|
||||||
return plotter.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);
|
plotter.setImagLineColor(imagLineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRealLineColor(@NotNull GraphLineColor realLineColor) {
|
public void setRealLineColor(@NotNull PlotLineColor realLineColor) {
|
||||||
plotter.setRealLineColor(realLineColor);
|
plotter.setRealLineColor(realLineColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
|
|
||||||
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
|
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
|
||||||
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotFunctionsActivity" android:theme="@style/cpp_gray_dialog_theme"/>
|
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotFunctionsActivity" android:theme="@style/cpp_gray_dialog_theme"/>
|
||||||
|
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotFunctionSettingsActivity" android:theme="@style/cpp_gray_dialog_theme"/>
|
||||||
|
|
||||||
<!-- todo serso: strings-->
|
<!-- todo serso: strings-->
|
||||||
<activity android:label="@string/c_plot_graph" android:name=".matrix.CalculatorMatrixActivity"/>
|
<activity android:label="@string/c_plot_graph" android:name=".matrix.CalculatorMatrixActivity"/>
|
||||||
|
@ -12,19 +12,19 @@ target=android-15
|
|||||||
android.library.reference.1=../android-app-core
|
android.library.reference.1=../android-app-core
|
||||||
android.library.reference.2=../android-app-widget
|
android.library.reference.2=../android-app-widget
|
||||||
android.library.reference.3=../android-app-onscreen
|
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.4=../android-app-core/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.5=../android-app-core/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.6=../android-app-core/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.7=../android-app-core/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.8=../android-app-core/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.9=../android-app-core/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.10=../android-app-core/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.11=../android-app-core/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.12=../android-app-core/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.13=../android-app-core/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.14=../android-app-core/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.15=../android-app-core/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.16=../android-app-core/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.17=../android-app-core/gen-external-apklibs/org.solovyev.android_android-common-keyboard_1.0.6
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
a:id="@+id/cpp_plot_function_expression_textview"
|
a:id="@+id/cpp_plot_function_expression_textview"
|
||||||
a:layout_width="0dp"
|
a:layout_width="0dp"
|
||||||
a:layout_height="wrap_content"
|
a:layout_height="wrap_content"
|
||||||
a:layout_weight="5"/>
|
a:layout_weight="3"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
a:id="@+id/cpp_plot_function_pinned_checkbox"
|
a:id="@+id/cpp_plot_function_pinned_checkbox"
|
||||||
@ -23,4 +23,11 @@
|
|||||||
a:layout_height="wrap_content"
|
a:layout_height="wrap_content"
|
||||||
a:layout_weight="1"/>
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
a:id="@+id/cpp_plot_function_settings_button"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_weight="1"
|
||||||
|
a:src="@drawable/ab_settings"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
10
android-app/res/layout/cpp_plot_function_settings_dialog.xml
Normal file
10
android-app/res/layout/cpp_plot_function_settings_dialog.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
|
a:layout_width="wrap_content"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:id="@+id/dialog_layout"
|
||||||
|
style="?cpp_dialog_style"
|
||||||
|
a:orientation="vertical">
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
|
a:id="@+id/main_fragment_layout"
|
||||||
|
style="?cpp_fragment_layout_style"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/ad" />
|
||||||
|
|
||||||
|
<TextView a:text="Line color type"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Spinner a:id="@+id/cpp_plot_function_line_color_type_spinner"
|
||||||
|
a:entries="@array/cpp_plot_line_color_type_names"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView a:text="Line color"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Spinner a:id="@+id/cpp_plot_function_line_color_spinner"
|
||||||
|
a:entries="@array/cpp_plot_line_color_names"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView a:text="Line style"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Spinner a:id="@+id/cpp_plot_function_line_style_spinner"
|
||||||
|
a:entries="@array/cpp_plot_line_style_names"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Button a:id="@+id/cpp_ok_button"
|
||||||
|
a:text="@string/ok"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -6,12 +6,6 @@
|
|||||||
a:layout_width="match_parent"
|
a:layout_width="match_parent"
|
||||||
a:layout_height="match_parent">
|
a:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
|
||||||
a:id="@+id/fragment_title"
|
|
||||||
a:layout_height="wrap_content"
|
|
||||||
a:layout_width="match_parent"
|
|
||||||
style="?cpp_fragment_title_style" />
|
|
||||||
|
|
||||||
<include layout="@layout/ad" />
|
<include layout="@layout/ad" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -37,6 +31,10 @@
|
|||||||
a:layout_weight="1"
|
a:layout_weight="1"
|
||||||
a:text="Visible"/>
|
a:text="Visible"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -87,19 +87,4 @@
|
|||||||
<item>bin</item>
|
<item>bin</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="graph_line_color_names">
|
|
||||||
<item>@string/p_white_line_color</item>
|
|
||||||
<item>@string/p_grey_line_color</item>
|
|
||||||
<item>@string/p_red_line_color</item>
|
|
||||||
<item>@string/p_blue_line_color</item>
|
|
||||||
<item>@string/p_green_line_color</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="graph_line_color_values">
|
|
||||||
<item>white</item>
|
|
||||||
<item>grey</item>
|
|
||||||
<item>red</item>
|
|
||||||
<item>blue</item>
|
|
||||||
<item>green</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -19,14 +19,14 @@
|
|||||||
<ListPreference a:key="graph_line_color_real"
|
<ListPreference a:key="graph_line_color_real"
|
||||||
a:title="@string/prefs_graph_real_color_title"
|
a:title="@string/prefs_graph_real_color_title"
|
||||||
a:summary="@string/prefs_graph_real_color_summary"
|
a:summary="@string/prefs_graph_real_color_summary"
|
||||||
a:entries="@array/graph_line_color_names"
|
a:entries="@array/cpp_plot_line_color_names"
|
||||||
a:entryValues="@array/graph_line_color_values"/>
|
a:entryValues="@array/cpp_plot_line_color_values"/>
|
||||||
|
|
||||||
<ListPreference a:key="graph_line_color_imag"
|
<ListPreference a:key="graph_line_color_imag"
|
||||||
a:title="@string/prefs_graph_imag_color_title"
|
a:title="@string/prefs_graph_imag_color_title"
|
||||||
a:summary="@string/prefs_graph_imag_color_summary"
|
a:summary="@string/prefs_graph_imag_color_summary"
|
||||||
a:entries="@array/graph_line_color_names"
|
a:entries="@array/cpp_plot_line_color_names"
|
||||||
a:entryValues="@array/graph_line_color_values"/>
|
a:entryValues="@array/cpp_plot_line_color_values"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.AndroidUtils;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
|
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
|
@ -7,7 +7,6 @@ import android.view.View;
|
|||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -19,7 +19,6 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.AndroidUtils;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,7 +7,6 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import com.actionbarsherlock.app.SherlockFragment;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package org.solovyev.android.calculator.about;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.calculator.CalculatorEditorFragment;
|
import org.solovyev.android.calculator.about.CalculatorAboutFragment;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
|
||||||
import org.solovyev.android.calculator.help.CalculatorHelpFaqFragment;
|
import org.solovyev.android.calculator.help.CalculatorHelpFaqFragment;
|
||||||
import org.solovyev.android.calculator.help.CalculatorHelpHintsFragment;
|
import org.solovyev.android.calculator.help.CalculatorHelpHintsFragment;
|
||||||
import org.solovyev.android.calculator.help.CalculatorHelpScreensFragment;
|
import org.solovyev.android.calculator.help.CalculatorHelpScreensFragment;
|
||||||
@ -14,7 +14,8 @@ import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment;
|
|||||||
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
|
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
|
||||||
import org.solovyev.android.calculator.matrix.CalculatorMatrixEditFragment;
|
import org.solovyev.android.calculator.matrix.CalculatorMatrixEditFragment;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorArityPlotFragment;
|
import org.solovyev.android.calculator.plot.CalculatorArityPlotFragment;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorPlotFunctionsFragment;
|
import org.solovyev.android.calculator.plot.CalculatorPlotFunctionSettingsActivity;
|
||||||
|
import org.solovyev.android.calculator.plot.CalculatorPlotFunctionsActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
@ -31,10 +32,12 @@ public enum CalculatorFragmentType {
|
|||||||
variables(CalculatorVarsFragment.class, R.layout.vars_fragment, R.string.c_vars),
|
variables(CalculatorVarsFragment.class, R.layout.vars_fragment, R.string.c_vars),
|
||||||
functions(CalculatorFunctionsFragment.class, R.layout.math_entities_fragment, R.string.c_functions),
|
functions(CalculatorFunctionsFragment.class, R.layout.math_entities_fragment, R.string.c_functions),
|
||||||
operators(CalculatorOperatorsFragment.class, R.layout.math_entities_fragment, R.string.c_operators),
|
operators(CalculatorOperatorsFragment.class, R.layout.math_entities_fragment, R.string.c_operators),
|
||||||
plotter(CalculatorArityPlotFragment.class, R.layout.plot_fragment, R.string.c_graph),
|
plotter(CalculatorArityPlotFragment.class, R.layout.cpp_plot_fragment, R.string.c_graph),
|
||||||
|
|
||||||
// todo serso: strings
|
// todo serso: strings
|
||||||
plotter_functions(CalculatorPlotFunctionsFragment.class, R.layout.plot_functions_fragment, R.string.c_graph),
|
plotter_functions(CalculatorPlotFunctionsActivity.CalculatorPlotFunctionsFragment.class, R.layout.cpp_plot_functions_fragment, R.string.c_graph),
|
||||||
|
plotter_function_settings(CalculatorPlotFunctionSettingsActivity.CalculatorPlotFunctionSettingsFragment.class, R.layout.cpp_plot_function_settings_fragment, R.string.c_graph),
|
||||||
|
|
||||||
about(CalculatorAboutFragment.class, R.layout.about_fragment, R.string.c_about),
|
about(CalculatorAboutFragment.class, R.layout.about_fragment, R.string.c_about),
|
||||||
faq(CalculatorHelpFaqFragment.class, R.layout.help_faq_fragment, R.string.c_faq),
|
faq(CalculatorHelpFaqFragment.class, R.layout.help_faq_fragment, R.string.c_faq),
|
||||||
hints(CalculatorHelpHintsFragment.class, R.layout.help_hints_fragment, R.string.c_hints),
|
hints(CalculatorHelpHintsFragment.class, R.layout.help_hints_fragment, R.string.c_hints),
|
@ -7,7 +7,6 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import com.actionbarsherlock.app.SherlockListFragment;
|
import com.actionbarsherlock.app.SherlockListFragment;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
|
@ -8,6 +8,7 @@ package org.solovyev.android.calculator.about;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,7 @@ import android.text.method.LinkMovementMethod;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.AndroidUtils;
|
||||||
import org.solovyev.android.calculator.CalculatorApplication;
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.common.text.StringUtils;
|
import org.solovyev.common.text.StringUtils;
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ package org.solovyev.android.calculator.help;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package org.solovyev.android.calculator.help;
|
package org.solovyev.android.calculator.help;
|
||||||
|
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package org.solovyev.android.calculator.help;
|
package org.solovyev.android.calculator.help;
|
||||||
|
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package org.solovyev.android.calculator.help;
|
package org.solovyev.android.calculator.help;
|
||||||
|
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -22,7 +22,7 @@ import com.actionbarsherlock.view.MenuItem;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||||
import org.solovyev.android.menu.*;
|
import org.solovyev.android.menu.*;
|
||||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
||||||
|
@ -11,7 +11,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.solovyev.android.calculator.Locator;
|
import org.solovyev.android.calculator.Locator;
|
||||||
import org.solovyev.android.calculator.CalculatorPreferences;
|
import org.solovyev.android.calculator.CalculatorPreferences;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
package org.solovyev.android.calculator.history;
|
package org.solovyev.android.calculator.history;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.Locator;
|
import org.solovyev.android.calculator.Locator;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -19,7 +19,7 @@ import com.actionbarsherlock.app.SherlockListFragment;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.menu.AMenuBuilder;
|
import org.solovyev.android.menu.AMenuBuilder;
|
||||||
import org.solovyev.android.menu.AMenuItem;
|
import org.solovyev.android.menu.AMenuItem;
|
||||||
import org.solovyev.android.menu.LabeledMenuItem;
|
import org.solovyev.android.menu.LabeledMenuItem;
|
||||||
|
@ -13,7 +13,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@ import jscl.math.function.IFunction;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
||||||
import org.solovyev.android.menu.AMenuItem;
|
import org.solovyev.android.menu.AMenuItem;
|
||||||
import org.solovyev.android.menu.LabeledMenuItem;
|
import org.solovyev.android.menu.LabeledMenuItem;
|
||||||
|
@ -11,7 +11,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.solovyev.android.calculator.Locator;
|
import org.solovyev.android.calculator.Locator;
|
||||||
import org.solovyev.android.calculator.CalculatorEventType;
|
import org.solovyev.android.calculator.CalculatorEventType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.menu.AMenuItem;
|
import org.solovyev.android.menu.AMenuItem;
|
||||||
import org.solovyev.android.menu.LabeledMenuItem;
|
import org.solovyev.android.menu.LabeledMenuItem;
|
||||||
import org.solovyev.common.text.StringUtils;
|
import org.solovyev.common.text.StringUtils;
|
||||||
|
@ -12,7 +12,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
||||||
import org.solovyev.android.calculator.AndroidVarCategory;
|
import org.solovyev.android.calculator.AndroidVarCategory;
|
||||||
import org.solovyev.android.calculator.VarCategory;
|
import org.solovyev.android.calculator.VarCategory;
|
||||||
|
@ -17,7 +17,7 @@ import jscl.math.function.IConstant;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.math.MathType;
|
import org.solovyev.android.calculator.math.MathType;
|
||||||
import org.solovyev.android.menu.AMenuItem;
|
import org.solovyev.android.menu.AMenuItem;
|
||||||
import org.solovyev.android.menu.LabeledMenuItem;
|
import org.solovyev.android.menu.LabeledMenuItem;
|
||||||
|
@ -3,8 +3,8 @@ package org.solovyev.android.calculator.matrix;
|
|||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
|
@ -5,8 +5,8 @@ import android.view.View;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
import org.solovyev.android.view.IntegerRange;
|
import org.solovyev.android.view.IntegerRange;
|
||||||
import org.solovyev.android.view.Picker;
|
import org.solovyev.android.view.Picker;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
|
|
||||||
|
|
||||||
public AbstractCalculatorPlotFragment() {
|
public AbstractCalculatorPlotFragment() {
|
||||||
super(CalculatorApplication.getInstance().createFragmentHelper(R.layout.plot_fragment, R.string.c_graph, false));
|
super(CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_plot_fragment, R.string.c_graph, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
plotData = Locator.getInstance().getPlotter().getPlotData();
|
plotData = Locator.getInstance().getPlotter().getPlotData();
|
||||||
createChart(plotData);
|
createChart(plotData);
|
||||||
createGraphicalView(getView(), plotData);
|
createGraphicalView(getView(), plotData);
|
||||||
getActivity().invalidateOptionsMenu();
|
getSherlockActivity().invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -138,7 +138,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
getUiHandler().post(new Runnable() {
|
getUiHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
getActivity().invalidateOptionsMenu();
|
getSherlockActivity().invalidateOptionsMenu();
|
||||||
|
|
||||||
createChart(plotData);
|
createChart(plotData);
|
||||||
|
|
||||||
@ -361,17 +361,17 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyToPaint(@NotNull PlotFunctionLineDef plotFunctionLineDef, @NotNull Paint paint) {
|
public static void applyToPaint(@NotNull PlotLineDef plotLineDef, @NotNull Paint paint) {
|
||||||
paint.setColor(plotFunctionLineDef.getLineColor());
|
paint.setColor(plotLineDef.getLineColor());
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
|
|
||||||
if ( plotFunctionLineDef.getLineWidth() == PlotFunctionLineDef.DEFAULT_LINE_WIDTH ) {
|
if ( plotLineDef.getLineWidth() == PlotLineDef.DEFAULT_LINE_WIDTH ) {
|
||||||
paint.setStrokeWidth(0);
|
paint.setStrokeWidth(0);
|
||||||
} else {
|
} else {
|
||||||
paint.setStrokeWidth(plotFunctionLineDef.getLineWidth());
|
paint.setStrokeWidth(plotLineDef.getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
final AndroidPlotLineStyle androidPlotLineStyle = AndroidPlotLineStyle.valueOf(plotFunctionLineDef.getLineStyle());
|
final AndroidPlotLineStyle androidPlotLineStyle = AndroidPlotLineStyle.valueOf(plotLineDef.getLineStyle());
|
||||||
if (androidPlotLineStyle != null) {
|
if (androidPlotLineStyle != null) {
|
||||||
androidPlotLineStyle.applyToPaint(paint);
|
androidPlotLineStyle.applyToPaint(paint);
|
||||||
}
|
}
|
||||||
|
@ -14,18 +14,18 @@ public class ArityPlotFunction {
|
|||||||
private Function function;
|
private Function function;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private PlotFunctionLineDef lineDef;
|
private PlotLineDef lineDef;
|
||||||
|
|
||||||
private ArityPlotFunction() {
|
private ArityPlotFunction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ArityPlotFunction newInstance(@NotNull Function function) {
|
public static ArityPlotFunction newInstance(@NotNull Function function) {
|
||||||
return newInstance(function, PlotFunctionLineDef.newDefaultInstance());
|
return newInstance(function, PlotLineDef.newDefaultInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ArityPlotFunction newInstance(@NotNull Function function, @NotNull PlotFunctionLineDef lineDef) {
|
public static ArityPlotFunction newInstance(@NotNull Function function, @NotNull PlotLineDef lineDef) {
|
||||||
final ArityPlotFunction result = new ArityPlotFunction();
|
final ArityPlotFunction result = new ArityPlotFunction();
|
||||||
|
|
||||||
result.function = function;
|
result.function = function;
|
||||||
@ -40,7 +40,7 @@ public class ArityPlotFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public PlotFunctionLineDef getLineDef() {
|
public PlotLineDef getLineDef() {
|
||||||
return lineDef;
|
return lineDef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class CalculatorArityPlotFragment extends AbstractCalculatorPlotFragment
|
|||||||
final Constant xVariable = xyFunction.getXVariable();
|
final Constant xVariable = xyFunction.getXVariable();
|
||||||
final Constant yVariable = xyFunction.getYVariable();
|
final Constant yVariable = xyFunction.getYVariable();
|
||||||
|
|
||||||
final int arity = xVariable == null ? 0 : (yVariable == null ? 1 : 2);
|
final int arity = xyFunction.getArity();
|
||||||
|
|
||||||
final Function arityFunction;
|
final Function arityFunction;
|
||||||
if (xyFunction.isImag()) {
|
if (xyFunction.isImag()) {
|
||||||
@ -63,7 +63,7 @@ public class CalculatorArityPlotFragment extends AbstractCalculatorPlotFragment
|
|||||||
arityFunction = new RealArityFunction(arity, expression, xVariable, yVariable);
|
arityFunction = new RealArityFunction(arity, expression, xVariable, yVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
arityFunctions.add(ArityPlotFunction.newInstance(arityFunction, plotFunction.getPlotFunctionLineDef()));
|
arityFunctions.add(ArityPlotFunction.newInstance(arityFunction, plotFunction.getPlotLineDef()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( plotData.isPlot3d() ) {
|
if ( plotData.isPlot3d() ) {
|
||||||
|
@ -6,8 +6,8 @@ import android.os.Bundle;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -0,0 +1,166 @@
|
|||||||
|
package org.solovyev.android.calculator.plot;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
import org.solovyev.android.calculator.Locator;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
|
|
||||||
|
public class CalculatorPlotFunctionSettingsActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
|
private static final String INPUT_FUNCTION_ID = "plot-function-id";
|
||||||
|
|
||||||
|
public static void startActivity(@NotNull Context context, @NotNull PlotFunction plotFunction) {
|
||||||
|
final Intent intent = new Intent(context, CalculatorPlotFunctionSettingsActivity.class);
|
||||||
|
intent.putExtra(INPUT_FUNCTION_ID, plotFunction.getXyFunction().getId());
|
||||||
|
context.startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.cpp_plot_function_settings_dialog);
|
||||||
|
|
||||||
|
final Intent intent = getIntent();
|
||||||
|
|
||||||
|
if (intent != null) {
|
||||||
|
final String plotFunctionId = intent.getStringExtra(INPUT_FUNCTION_ID);
|
||||||
|
|
||||||
|
if (plotFunctionId != null) {
|
||||||
|
final Bundle parameters = new Bundle();
|
||||||
|
parameters.putString(INPUT_FUNCTION_ID, plotFunctionId);
|
||||||
|
FragmentUtils.createFragment(this, CalculatorPlotFunctionSettingsFragment.class, R.id.dialog_layout, "plot-function-settings", parameters);
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CalculatorPlotFunctionSettingsFragment extends CalculatorFragment {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private PlotFunction plotFunction;
|
||||||
|
|
||||||
|
public CalculatorPlotFunctionSettingsFragment() {
|
||||||
|
super(CalculatorFragmentType.plotter_function_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
final String functionId = getArguments().getString(INPUT_FUNCTION_ID);
|
||||||
|
if (functionId != null) {
|
||||||
|
plotFunction = Locator.getInstance().getPlotter().getFunctionById(functionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View root, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(root, savedInstanceState);
|
||||||
|
|
||||||
|
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||||
|
|
||||||
|
final Spinner plotLineColorSpinner = (Spinner)root.findViewById(R.id.cpp_plot_function_line_color_spinner);
|
||||||
|
final Spinner plotLineColorTypeSpinner = (Spinner)root.findViewById(R.id.cpp_plot_function_line_color_type_spinner);
|
||||||
|
final Spinner plotLineStyleSpinner = (Spinner)root.findViewById(R.id.cpp_plot_function_line_style_spinner);
|
||||||
|
final Button okButton = (Button)root.findViewById(R.id.cpp_ok_button);
|
||||||
|
|
||||||
|
if (plotFunction != null) {
|
||||||
|
|
||||||
|
plotLineColorSpinner.setSelection(PlotLineColor.valueOf(plotFunction.getPlotLineDef().getLineColor()).ordinal());
|
||||||
|
plotLineColorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
final PlotLineColor newPlotLineColor = PlotLineColor.values()[position];
|
||||||
|
int newLineColor = newPlotLineColor.getColor();
|
||||||
|
if ( newLineColor != plotFunction.getPlotLineDef().getLineColor() ) {
|
||||||
|
final PlotFunction newPlotFunction = new PlotFunction(plotFunction.getXyFunction(), PlotLineDef.changeLineColor(plotFunction.getPlotLineDef(), newLineColor));
|
||||||
|
if(plotter.updateFunction(newPlotFunction)) {
|
||||||
|
plotFunction = newPlotFunction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
plotLineColorTypeSpinner.setSelection(plotFunction.getPlotLineDef().getLineColorType().ordinal());
|
||||||
|
plotLineColorTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
final PlotLineColorType newPlotLineColorType = PlotLineColorType.values()[position];
|
||||||
|
if ( newPlotLineColorType != plotFunction.getPlotLineDef().getLineColorType() ) {
|
||||||
|
final PlotFunction newPlotFunction = new PlotFunction(plotFunction.getXyFunction(), PlotLineDef.changeLineColorType(plotFunction.getPlotLineDef(), newPlotLineColorType));
|
||||||
|
if(plotter.updateFunction(newPlotFunction)) {
|
||||||
|
plotFunction = newPlotFunction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
plotLineStyleSpinner.setSelection(plotFunction.getPlotLineDef().getLineStyle().ordinal());
|
||||||
|
plotLineStyleSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
final PlotLineStyle newPlotLineStyle = PlotLineStyle.values()[position];
|
||||||
|
if ( newPlotLineStyle != plotFunction.getPlotLineDef().getLineStyle() ) {
|
||||||
|
final PlotFunction newPlotFunction = new PlotFunction(plotFunction.getXyFunction(), PlotLineDef.changeLineStyle(plotFunction.getPlotLineDef(), newPlotLineStyle));
|
||||||
|
if(plotter.updateFunction(newPlotFunction)) {
|
||||||
|
plotFunction = newPlotFunction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
okButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
if ( activity != null ) {
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
plotLineColorSpinner.setEnabled(false);
|
||||||
|
plotLineColorTypeSpinner.setEnabled(false);
|
||||||
|
plotLineStyleSpinner.setEnabled(false);
|
||||||
|
okButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,18 @@ package org.solovyev.android.calculator.plot;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
|
import org.solovyev.android.calculator.CalculatorListFragment;
|
||||||
|
import org.solovyev.android.calculator.Locator;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
|
import org.solovyev.android.list.ListItemArrayAdapter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
@ -21,4 +30,29 @@ public class CalculatorPlotFunctionsActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
FragmentUtils.createFragment(this, CalculatorPlotFunctionsFragment.class, R.id.dialog_layout, "plot-functions");
|
FragmentUtils.createFragment(this, CalculatorPlotFunctionsFragment.class, R.id.dialog_layout, "plot-functions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class CalculatorPlotFunctionsFragment extends CalculatorListFragment {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static final String INPUT = "plot_input";
|
||||||
|
|
||||||
|
public CalculatorPlotFunctionsFragment() {
|
||||||
|
super(CalculatorFragmentType.plotter_functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
final List<PlotFunctionListItem> items = Lists.transform(Locator.getInstance().getPlotter().getFunctions(), new Function<PlotFunction, PlotFunctionListItem>() {
|
||||||
|
@Override
|
||||||
|
public PlotFunctionListItem apply(@javax.annotation.Nullable PlotFunction input) {
|
||||||
|
assert input != null;
|
||||||
|
return new PlotFunctionListItem(input);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListItemArrayAdapter.createAndAttach(getListView(), this.getActivity(), items);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package org.solovyev.android.calculator.plot;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.solovyev.android.calculator.CalculatorListFragment;
|
|
||||||
import org.solovyev.android.calculator.Locator;
|
|
||||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
|
||||||
import org.solovyev.android.list.ListItemArrayAdapter;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CalculatorPlotFunctionsFragment extends CalculatorListFragment {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static final String INPUT = "plot_input";
|
|
||||||
|
|
||||||
public CalculatorPlotFunctionsFragment() {
|
|
||||||
super(CalculatorFragmentType.plotter_functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
final List<PlotFunctionListItem> items = Lists.transform(Locator.getInstance().getPlotter().getFunctions(), new Function<PlotFunction, PlotFunctionListItem>() {
|
|
||||||
@Override
|
|
||||||
public PlotFunctionListItem apply(@Nullable PlotFunction input) {
|
|
||||||
assert input != null;
|
|
||||||
return new PlotFunctionListItem(input);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ListItemArrayAdapter.createAndAttach(getListView(), this.getActivity(), items);
|
|
||||||
}
|
|
||||||
}
|
|
@ -94,7 +94,7 @@ class Graph3d {
|
|||||||
|
|
||||||
public void update(@NotNull GL11 gl, @NotNull ArityPlotFunction fpd, float zoom) {
|
public void update(@NotNull GL11 gl, @NotNull ArityPlotFunction fpd, float zoom) {
|
||||||
final Function function = fpd.getFunction();
|
final Function function = fpd.getFunction();
|
||||||
final PlotFunctionLineDef lineDef = fpd.getLineDef();
|
final PlotLineDef lineDef = fpd.getLineDef();
|
||||||
final int NTICK = useHighQuality3d ? 5 : 0;
|
final int NTICK = useHighQuality3d ? 5 : 0;
|
||||||
|
|
||||||
final float size = 4 * zoom;
|
final float size = 4 * zoom;
|
||||||
@ -285,7 +285,7 @@ class Graph3d {
|
|||||||
return maxAbsZ;
|
return maxAbsZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] prepareFunctionPolygonColors(PlotFunctionLineDef lineDef, float[] vertices, float maxAbsZ) {
|
private byte[] prepareFunctionPolygonColors(PlotLineDef lineDef, float[] vertices, float maxAbsZ) {
|
||||||
// 4 color components per polygon (color[i] = red, color[i+1] = green, color[i+2] = blue, color[i+3] = alpha )
|
// 4 color components per polygon (color[i] = red, color[i+1] = green, color[i+2] = blue, color[i+3] = alpha )
|
||||||
final byte colors[] = new byte[polygonsⁿ * COLOR_COMPONENTS_COUNT];
|
final byte colors[] = new byte[polygonsⁿ * COLOR_COMPONENTS_COUNT];
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ class Graph3d {
|
|||||||
final float z = vertices[j];
|
final float z = vertices[j];
|
||||||
|
|
||||||
if (!Float.isNaN(z)) {
|
if (!Float.isNaN(z)) {
|
||||||
if (lineDef.getLineColorType() == PlotFunctionLineColorType.color_map) {
|
if (lineDef.getLineColorType() == PlotLineColorType.color_map) {
|
||||||
final float color = z / maxAbsZ;
|
final float color = z / maxAbsZ;
|
||||||
final float abs = Math.abs(color);
|
final float abs = Math.abs(color);
|
||||||
colors[i] = floatToByte(color);
|
colors[i] = floatToByte(color);
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -52,7 +53,7 @@ public class PlotFunctionListItem implements ListItem {
|
|||||||
if ( this.tag.equals(viewTag) ) {
|
if ( this.tag.equals(viewTag) ) {
|
||||||
return view;
|
return view;
|
||||||
} else if (((String) viewTag).startsWith(PREFIX)) {
|
} else if (((String) viewTag).startsWith(PREFIX)) {
|
||||||
fillView(view);
|
fillView(view, context);
|
||||||
return view;
|
return view;
|
||||||
} else {
|
} else {
|
||||||
return build(context);
|
return build(context);
|
||||||
@ -66,7 +67,7 @@ public class PlotFunctionListItem implements ListItem {
|
|||||||
@Override
|
@Override
|
||||||
public View build(@NotNull Context context) {
|
public View build(@NotNull Context context) {
|
||||||
final View root = buildView(context);
|
final View root = buildView(context);
|
||||||
fillView(root);
|
fillView(root, context);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ public class PlotFunctionListItem implements ListItem {
|
|||||||
return viewBuilder.build(context);
|
return viewBuilder.build(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillView(@NotNull View root) {
|
private void fillView(@NotNull View root, @NotNull final Context context) {
|
||||||
root.setTag(tag);
|
root.setTag(tag);
|
||||||
|
|
||||||
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||||
@ -115,5 +116,13 @@ public class PlotFunctionListItem implements ListItem {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
visibleCheckBox.setChecked(plotFunction.isVisible());
|
visibleCheckBox.setChecked(plotFunction.isVisible());
|
||||||
|
|
||||||
|
final ImageButton settingsButton = (ImageButton) root.findViewById(R.id.cpp_plot_function_settings_button);
|
||||||
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
CalculatorPlotFunctionSettingsActivity.startActivity(context, plotFunction);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,15 @@
|
|||||||
package org.solovyev.android.fragments;
|
package org.solovyev.android.fragments;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.common.collections.CollectionsUtils;
|
import org.solovyev.common.collections.CollectionsUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,10 +19,18 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class FragmentUtils {
|
public class FragmentUtils {
|
||||||
|
|
||||||
|
public static void createFragment(@NotNull FragmentActivity activity,
|
||||||
|
@NotNull Class<? extends Fragment> fragmentClass,
|
||||||
|
int parentViewId,
|
||||||
|
@NotNull String tag) {
|
||||||
|
createFragment(activity, fragmentClass, parentViewId, tag, null);
|
||||||
|
}
|
||||||
|
|
||||||
public static void createFragment(@NotNull FragmentActivity activity,
|
public static void createFragment(@NotNull FragmentActivity activity,
|
||||||
@NotNull Class<? extends Fragment> fragmentClass,
|
@NotNull Class<? extends Fragment> fragmentClass,
|
||||||
int parentViewId,
|
int parentViewId,
|
||||||
@NotNull String tag) {
|
@NotNull String tag,
|
||||||
|
@Nullable Bundle args) {
|
||||||
final FragmentManager fm = activity.getSupportFragmentManager();
|
final FragmentManager fm = activity.getSupportFragmentManager();
|
||||||
|
|
||||||
Fragment messagesFragment = fm.findFragmentByTag(tag);
|
Fragment messagesFragment = fm.findFragmentByTag(tag);
|
||||||
@ -29,7 +38,7 @@ public class FragmentUtils {
|
|||||||
final FragmentTransaction ft = fm.beginTransaction();
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
try {
|
try {
|
||||||
if (messagesFragment == null) {
|
if (messagesFragment == null) {
|
||||||
messagesFragment = Fragment.instantiate(activity, fragmentClass.getName(), null);
|
messagesFragment = Fragment.instantiate(activity, fragmentClass.getName(), args);
|
||||||
ft.add(parentViewId, messagesFragment, tag);
|
ft.add(parentViewId, messagesFragment, tag);
|
||||||
} else {
|
} else {
|
||||||
if (messagesFragment.isDetached()) {
|
if (messagesFragment.isDetached()) {
|
||||||
|
@ -2,6 +2,7 @@ package org.solovyev.android.calculator.plot;
|
|||||||
|
|
||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -18,10 +19,10 @@ public interface CalculatorPlotter {
|
|||||||
boolean addFunction(@NotNull Generic expression);
|
boolean addFunction(@NotNull Generic expression);
|
||||||
boolean addFunction(@NotNull PlotFunction plotFunction);
|
boolean addFunction(@NotNull PlotFunction plotFunction);
|
||||||
boolean addFunction(@NotNull XyFunction xyFunction);
|
boolean addFunction(@NotNull XyFunction xyFunction);
|
||||||
boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef);
|
boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef);
|
||||||
|
|
||||||
boolean updateFunction(@NotNull PlotFunction newFunction);
|
boolean updateFunction(@NotNull PlotFunction newFunction);
|
||||||
boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef);
|
boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef);
|
||||||
|
|
||||||
boolean removeFunction(@NotNull PlotFunction plotFunction);
|
boolean removeFunction(@NotNull PlotFunction plotFunction);
|
||||||
boolean removeFunction(@NotNull XyFunction xyFunction);
|
boolean removeFunction(@NotNull XyFunction xyFunction);
|
||||||
@ -40,6 +41,9 @@ public interface CalculatorPlotter {
|
|||||||
|
|
||||||
void clearAllFunctions();
|
void clearAllFunctions();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
PlotFunction getFunctionById(@NotNull String functionId);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
List<PlotFunction> getFunctions();
|
List<PlotFunction> getFunctions();
|
||||||
|
|
||||||
@ -59,7 +63,7 @@ public interface CalculatorPlotter {
|
|||||||
|
|
||||||
void setPlotImag(boolean plotImag);
|
void setPlotImag(boolean plotImag);
|
||||||
|
|
||||||
void setRealLineColor(@NotNull GraphLineColor realLineColor);
|
void setRealLineColor(@NotNull PlotLineColor realLineColor);
|
||||||
|
|
||||||
void setImagLineColor(@NotNull GraphLineColor imagLineColor);
|
void setImagLineColor(@NotNull PlotLineColor imagLineColor);
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,10 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
|||||||
private int arity = 0;
|
private int arity = 0;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private GraphLineColor realLineColor;
|
private PlotLineColor realLineColor;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private GraphLineColor imagLineColor;
|
private PlotLineColor imagLineColor;
|
||||||
|
|
||||||
public CalculatorPlotterImpl(@NotNull Calculator calculator) {
|
public CalculatorPlotterImpl(@NotNull Calculator calculator) {
|
||||||
this.calculator = calculator;
|
this.calculator = calculator;
|
||||||
@ -164,12 +164,12 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef) {
|
public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) {
|
||||||
return addFunction(new PlotFunction(xyFunction, functionLineDef));
|
return addFunction(new PlotFunction(xyFunction, functionLineDef));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotFunctionLineDef functionLineDef) {
|
public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) {
|
||||||
final PlotFunction newFunction = new PlotFunction(xyFunction, functionLineDef);
|
final PlotFunction newFunction = new PlotFunction(xyFunction, functionLineDef);
|
||||||
|
|
||||||
return updateFunction(newFunction);
|
return updateFunction(newFunction);
|
||||||
@ -251,7 +251,20 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: this method must be called from synchronized block
|
@org.jetbrains.annotations.Nullable
|
||||||
|
@Override
|
||||||
|
public PlotFunction getFunctionById(@NotNull final String functionId) {
|
||||||
|
synchronized (functions) {
|
||||||
|
return Iterables.find(functions, new Predicate<PlotFunction>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(@Nullable PlotFunction function) {
|
||||||
|
return function != null && function.getXyFunction().getId().equals(functionId);
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: this method must be called from synchronized block
|
||||||
private void onFunctionsChanged() {
|
private void onFunctionsChanged() {
|
||||||
assert Thread.holdsLock(functions);
|
assert Thread.holdsLock(functions);
|
||||||
|
|
||||||
@ -345,12 +358,12 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRealLineColor(@NotNull GraphLineColor realLineColor) {
|
public void setRealLineColor(@NotNull PlotLineColor realLineColor) {
|
||||||
this.realLineColor = realLineColor;
|
this.realLineColor = realLineColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setImagLineColor(@NotNull GraphLineColor imagLineColor) {
|
public void setImagLineColor(@NotNull PlotLineColor imagLineColor) {
|
||||||
this.imagLineColor = imagLineColor;
|
this.imagLineColor = imagLineColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class PlotFunction {
|
|||||||
private XyFunction xyFunction;
|
private XyFunction xyFunction;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private PlotFunctionLineDef plotFunctionLineDef;
|
private PlotLineDef mPlotLineDef;
|
||||||
|
|
||||||
private boolean pinned = false;
|
private boolean pinned = false;
|
||||||
|
|
||||||
@ -21,20 +21,20 @@ public class PlotFunction {
|
|||||||
|
|
||||||
public PlotFunction(@NotNull XyFunction xyFunction) {
|
public PlotFunction(@NotNull XyFunction xyFunction) {
|
||||||
this.xyFunction = xyFunction;
|
this.xyFunction = xyFunction;
|
||||||
this.plotFunctionLineDef = PlotFunctionLineDef.newDefaultInstance();
|
this.mPlotLineDef = PlotLineDef.newDefaultInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotFunction(@NotNull XyFunction xyFunction,
|
public PlotFunction(@NotNull XyFunction xyFunction,
|
||||||
@NotNull PlotFunctionLineDef plotFunctionLineDef) {
|
@NotNull PlotLineDef plotLineDef) {
|
||||||
this.xyFunction = xyFunction;
|
this.xyFunction = xyFunction;
|
||||||
this.plotFunctionLineDef = plotFunctionLineDef;
|
this.mPlotLineDef = plotLineDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private PlotFunction copy() {
|
private PlotFunction copy() {
|
||||||
final PlotFunction copy = new PlotFunction(this.xyFunction);
|
final PlotFunction copy = new PlotFunction(this.xyFunction);
|
||||||
|
|
||||||
copy.plotFunctionLineDef = this.plotFunctionLineDef;
|
copy.mPlotLineDef = this.mPlotLineDef;
|
||||||
copy.pinned = this.pinned;
|
copy.pinned = this.pinned;
|
||||||
copy.visible = this.visible;
|
copy.visible = this.visible;
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ public class PlotFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public PlotFunctionLineDef getPlotFunctionLineDef() {
|
public PlotLineDef getPlotLineDef() {
|
||||||
return plotFunctionLineDef;
|
return mPlotLineDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPinned() {
|
public boolean isPinned() {
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
package org.solovyev.android.calculator.plot;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User: serso
|
|
||||||
* Date: 1/5/13
|
|
||||||
* Time: 7:41 PM
|
|
||||||
*/
|
|
||||||
public class PlotFunctionLineDef {
|
|
||||||
|
|
||||||
/*
|
|
||||||
**********************************************************************
|
|
||||||
*
|
|
||||||
* CONSTANTS
|
|
||||||
*
|
|
||||||
**********************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static final Float DEFAULT_LINE_WIDTH = -1f;
|
|
||||||
|
|
||||||
private static final int WHITE = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
**********************************************************************
|
|
||||||
*
|
|
||||||
* FIELDS
|
|
||||||
*
|
|
||||||
**********************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private PlotFunctionLineColorType lineColorType = PlotFunctionLineColorType.solid;
|
|
||||||
|
|
||||||
private int lineColor = WHITE;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private PlotLineStyle lineStyle = PlotLineStyle.solid;
|
|
||||||
|
|
||||||
private float lineWidth = -DEFAULT_LINE_WIDTH;
|
|
||||||
|
|
||||||
private PlotFunctionLineDef() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static PlotFunctionLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle) {
|
|
||||||
final PlotFunctionLineDef result = new PlotFunctionLineDef();
|
|
||||||
result.lineColor = lineColor;
|
|
||||||
result.lineStyle = lineStyle;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static PlotFunctionLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle, float lineWidth) {
|
|
||||||
final PlotFunctionLineDef result = new PlotFunctionLineDef();
|
|
||||||
result.lineColor = lineColor;
|
|
||||||
result.lineStyle = lineStyle;
|
|
||||||
result.lineWidth = lineWidth;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static PlotFunctionLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle, float lineWidth, @NotNull PlotFunctionLineColorType lineColorType) {
|
|
||||||
final PlotFunctionLineDef result = new PlotFunctionLineDef();
|
|
||||||
result.lineColor = lineColor;
|
|
||||||
result.lineColorType = lineColorType;
|
|
||||||
result.lineStyle = lineStyle;
|
|
||||||
result.lineWidth = lineWidth;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static PlotFunctionLineDef newDefaultInstance() {
|
|
||||||
return new PlotFunctionLineDef();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLineColor() {
|
|
||||||
return lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public PlotLineStyle getLineStyle() {
|
|
||||||
return lineStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getLineWidth() {
|
|
||||||
return lineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public PlotFunctionLineColorType getLineColorType() {
|
|
||||||
return lineColorType;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,13 @@
|
|||||||
package org.solovyev.android.calculator.plot;
|
package org.solovyev.android.calculator.plot;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
* Date: 10/4/12
|
* Date: 10/4/12
|
||||||
* Time: 10:08 PM
|
* Time: 10:08 PM
|
||||||
*/
|
*/
|
||||||
public enum GraphLineColor {
|
public enum PlotLineColor {
|
||||||
|
|
||||||
// Color.WHITE
|
// Color.WHITE
|
||||||
white(0xFFFFFFFF),
|
white(0xFFFFFFFF),
|
||||||
@ -23,7 +25,7 @@ public enum GraphLineColor {
|
|||||||
|
|
||||||
private final int color;
|
private final int color;
|
||||||
|
|
||||||
private GraphLineColor(int color) {
|
private PlotLineColor(int color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,4 +33,15 @@ public enum GraphLineColor {
|
|||||||
public int getColor() {
|
public int getColor() {
|
||||||
return this.color;
|
return this.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineColor valueOf(int color) {
|
||||||
|
for (PlotLineColor plotLineColor : PlotLineColor.values()) {
|
||||||
|
if ( plotLineColor.color == color ) {
|
||||||
|
return plotLineColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PlotLineColor.white;
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,8 +5,8 @@ package org.solovyev.android.calculator.plot;
|
|||||||
* Date: 1/5/13
|
* Date: 1/5/13
|
||||||
* Time: 10:45 PM
|
* Time: 10:45 PM
|
||||||
*/
|
*/
|
||||||
public enum PlotFunctionLineColorType {
|
public enum PlotLineColorType {
|
||||||
|
|
||||||
color_map,
|
monochrome,
|
||||||
solid;
|
color_map;
|
||||||
}
|
}
|
@ -0,0 +1,137 @@
|
|||||||
|
package org.solovyev.android.calculator.plot;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 1/5/13
|
||||||
|
* Time: 7:41 PM
|
||||||
|
*/
|
||||||
|
public class PlotLineDef {
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* CONSTANTS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static final Float DEFAULT_LINE_WIDTH = -1f;
|
||||||
|
|
||||||
|
private static final int WHITE = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* FIELDS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private PlotLineColorType lineColorType = PlotLineColorType.monochrome;
|
||||||
|
|
||||||
|
private int lineColor = WHITE;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private PlotLineStyle lineStyle = PlotLineStyle.solid;
|
||||||
|
|
||||||
|
private float lineWidth = -DEFAULT_LINE_WIDTH;
|
||||||
|
|
||||||
|
private PlotLineDef() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle) {
|
||||||
|
final PlotLineDef result = new PlotLineDef();
|
||||||
|
result.lineColor = lineColor;
|
||||||
|
result.lineStyle = lineStyle;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle, float lineWidth) {
|
||||||
|
final PlotLineDef result = new PlotLineDef();
|
||||||
|
result.lineColor = lineColor;
|
||||||
|
result.lineStyle = lineStyle;
|
||||||
|
result.lineWidth = lineWidth;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle, float lineWidth, @NotNull PlotLineColorType lineColorType) {
|
||||||
|
final PlotLineDef result = new PlotLineDef();
|
||||||
|
result.lineColor = lineColor;
|
||||||
|
result.lineColorType = lineColorType;
|
||||||
|
result.lineStyle = lineStyle;
|
||||||
|
result.lineWidth = lineWidth;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private PlotLineDef copy() {
|
||||||
|
final PlotLineDef copy = new PlotLineDef();
|
||||||
|
copy.lineColor = lineColor;
|
||||||
|
copy.lineColorType = lineColorType;
|
||||||
|
copy.lineStyle = lineStyle;
|
||||||
|
copy.lineWidth = lineWidth;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef changeLineColor(@NotNull PlotLineDef plotLineDef, int newLineColor) {
|
||||||
|
final PlotLineDef result = plotLineDef.copy();
|
||||||
|
result.lineColor = newLineColor;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef changeLineColorType(@NotNull PlotLineDef plotLineDef, @NotNull PlotLineColorType newPlotLineColorType) {
|
||||||
|
final PlotLineDef result = plotLineDef.copy();
|
||||||
|
result.lineColorType = newPlotLineColorType;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef changeLineStyle(@NotNull PlotLineDef plotLineDef, @NotNull PlotLineStyle newPlotLineStyle) {
|
||||||
|
final PlotLineDef result = plotLineDef.copy();
|
||||||
|
result.lineStyle = newPlotLineStyle;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef changeColor(@NotNull PlotLineDef plotLineDef, int newLineColor) {
|
||||||
|
final PlotLineDef result = plotLineDef.copy();
|
||||||
|
result.lineColor = newLineColor;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static PlotLineDef newDefaultInstance() {
|
||||||
|
return new PlotLineDef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLineColor() {
|
||||||
|
return lineColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public PlotLineStyle getLineStyle() {
|
||||||
|
return lineStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLineWidth() {
|
||||||
|
return lineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public PlotLineColorType getLineColorType() {
|
||||||
|
return lineColorType;
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import jscl.math.Generic;
|
|||||||
import jscl.math.function.Constant;
|
import jscl.math.function.Constant;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.common.text.StringUtils;
|
||||||
|
|
||||||
public class XyFunction {
|
public class XyFunction {
|
||||||
|
|
||||||
@ -15,22 +16,25 @@ public class XyFunction {
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final String id;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Generic expression;
|
private Generic expression;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String expressionString;
|
private String expressionString;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Constant xVariable;
|
private Constant xVariable;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String xVariableName;
|
private String xVariableName;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Constant yVariable;
|
private Constant yVariable;
|
||||||
|
|
||||||
private final boolean imag;
|
private boolean imag;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String yVariableName;
|
private String yVariableName;
|
||||||
@ -62,6 +66,8 @@ public class XyFunction {
|
|||||||
this.arity--;
|
this.arity--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.id = this.expressionString + "_" + StringUtils.getNotEmpty(this.xVariableName, "") + "_" + StringUtils.getNotEmpty(this.yVariableName, "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isImag() {
|
public boolean isImag() {
|
||||||
@ -92,6 +98,11 @@ public class XyFunction {
|
|||||||
return expressionString;
|
return expressionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getXVariableName() {
|
public String getXVariableName() {
|
||||||
return xVariableName;
|
return xVariableName;
|
||||||
@ -102,6 +113,7 @@ public class XyFunction {
|
|||||||
return yVariableName;
|
return yVariableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
@ -109,20 +121,13 @@ public class XyFunction {
|
|||||||
|
|
||||||
final XyFunction that = (XyFunction) o;
|
final XyFunction that = (XyFunction) o;
|
||||||
|
|
||||||
if (!expressionString.equals(that.expressionString)) return false;
|
if (!id.equals(that.id)) return false;
|
||||||
if (xVariableName != null ? !xVariableName.equals(that.xVariableName) : that.xVariableName != null)
|
|
||||||
return false;
|
|
||||||
if (yVariableName != null ? !yVariableName.equals(that.yVariableName) : that.yVariableName != null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = expressionString.hashCode();
|
return id.hashCode();
|
||||||
result = 31 * result + (xVariableName != null ? xVariableName.hashCode() : 0);
|
|
||||||
result = 31 * result + (yVariableName != null ? yVariableName.hashCode() : 0);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user