Post date: Mar 19, 2016 12:26:09 AM
The final piece of the project to be constructed is plotting the results onto a graph.
For this the Android GraphView library is used.
The ResultsActivity is responsible for both actually running the simulation and displaying the results. The reason for this is that to move data between activities requires serialization which is expensive both in time to write code and runtime.
When the activity loads it has just a button, whose tex value indicates the run status of the SPICE process. At this point in time it does nothing when pressed.
One observation that we made was that the user probably does not want to see every node in the circuit all at once, but to choose a subset.
This, on SPICE completion a ListView is populated with CheckBoxes, one for each series in the reuslts (except the time series which will become the X axis. The WaveformPickAdapter manages this list and keeps an boolean [] is_visible in sync with it. The user is presented with this and the previously inactive button changes to a 'draw graph' button.
The checkboxes default to all voltages selected and all currents not.
When this is pressed the listview is hidden and a GraphView consisting of the selected data is drawn. The drawSeriesOnGraph() function copies the data from each of the selected SpiceResults.Series into a LineGraphSeries and adds each of these to the graphView. The button also becomes a "Pick Waveforms" button to go back.
The two views are multiplexed onto the same activity using a FrameLayout.