Changeset cf52b31


Ignore:
Timestamp:
Jul 12, 2010, 10:46:51 AM (8 years ago)
Author:
Michael Seifert <mseifert@…>
Branches:
master
Children:
70b8949
Parents:
3d01ad8
Message:

Fixed a bug that caused replay ids to have a wrong value after deserialization;

Changed APMChart to support the newest GRAL svn version

Location:
src/main/java/de/erichseifert/warp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/erichseifert/warp/ReplayDescriptor.java

    r3d01ad8 rcf52b31  
    3737        private int duration;
    3838        private String version;
    39         private transient long id;
     39        private long id;
    4040
    4141        /**
  • src/main/java/de/erichseifert/warp/gui/APMChart.java

    r3d01ad8 rcf52b31  
    3333
    3434import de.erichseifert.gral.DrawableConstants;
    35 import de.erichseifert.gral.DrawablePanel;
    36 import de.erichseifert.gral.InteractivePanel;
    3735import de.erichseifert.gral.Legend;
    3836import de.erichseifert.gral.DrawableConstants.Location;
     
    4543import de.erichseifert.gral.data.filters.KernelUtils;
    4644import de.erichseifert.gral.data.filters.Filter.Mode;
    47 import de.erichseifert.gral.data.statistics.Histogram;
     45import de.erichseifert.gral.data.statistics.Histogram1D;
     46import de.erichseifert.gral.data.statistics.Histogram1D.Orientation;
    4847import de.erichseifert.gral.plots.XYPlot;
    49 import de.erichseifert.gral.plots.areas.AreaRenderer2D;
     48import de.erichseifert.gral.plots.areas.AreaRenderer;
    5049import de.erichseifert.gral.plots.areas.DefaultAreaRenderer2D;
    5150import de.erichseifert.gral.plots.axes.Axis;
    52 import de.erichseifert.gral.plots.axes.AxisRenderer2D;
     51import de.erichseifert.gral.plots.axes.AxisRenderer;
    5352import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D;
    54 import de.erichseifert.gral.plots.lines.LineRenderer2D;
     53import de.erichseifert.gral.plots.lines.LineRenderer;
     54import de.erichseifert.gral.ui.DrawablePanel;
     55import de.erichseifert.gral.ui.InteractivePanel;
    5556import de.erichseifert.gral.util.Insets2D;
    5657import de.erichseifert.warp.ActionFilter;
     
    9596                        }
    9697                        // The following histogram calculates the number of occurrences of a value in each sector
    97                         Histogram actionsPerInterval = new Histogram(timeStamps, cells);
     98                        Histogram1D actionsPerInterval = new Histogram1D(timeStamps, Orientation.VERTICAL, cells);
    9899
    99100                        // Insert the number of occurrences (y-axis) per interval (x-axis) into a new data set
    100101                        DataTable apmData = new DataTable(Double.class, Long.class);
    101102                        for (Row row : actionsPerInterval) {
    102                                 Number x = actionsPerInterval.getCellLimits(0, row.getRow())[0];
     103                                Number x = actionsPerInterval.getCellLimits(0, row.getIndex())[0];
    103104                                Number y = row.get(0);
    104105                                apmData.add(x, y);
     
    106107                        // Transform the current data's unit (actions per second) to actions per minute
    107108                        Kernel kernelAPM = KernelUtils.getUniform(60, 30, 1.0);
    108                         Filter filterAPM = new Convolution(apmData, kernelAPM, Mode.MODE_ZERO, 1);
     109                        Filter filterAPM = new Convolution(apmData, kernelAPM, Mode.ZERO, 1);
    109110                        // Smooth the curve
    110111                        Kernel kernelAPMSmooth = KernelUtils.getBinomial(1.0);
    111                         Filter filterAPMSmooth = new Convolution(filterAPM, kernelAPMSmooth, Mode.MODE_ZERO, 1);
     112                        Filter filterAPMSmooth = new Convolution(filterAPM, kernelAPMSmooth, Mode.ZERO, 1);
    112113                        DataSeries playerSeries = new DataSeries(player.getName(), filterAPMSmooth, 0, 1);
    113114                        playerData[playerIndex] = playerSeries;
     
    129130                        Color playerColor = players[playerIndex].getColor();
    130131                        plot.setPointRenderer(playerSeries, null);
    131                         LineRenderer2D lineRenderer = new DefaultLineRenderer2D();
    132                         lineRenderer.setSetting(LineRenderer2D.COLOR, playerColor);
     132                        LineRenderer lineRenderer = new DefaultLineRenderer2D();
     133                        lineRenderer.setSetting(LineRenderer.COLOR, playerColor);
    133134                        plot.setLineRenderer(playerSeries, lineRenderer);
    134                         AreaRenderer2D areaRenderer = new DefaultAreaRenderer2D();
     135                        AreaRenderer areaRenderer = new DefaultAreaRenderer2D();
    135136                        Paint areaPaint = new GradientPaint(
    136137                                        new Point2D.Float(0f, 0f), new Color(playerColor.getRed(), playerColor.getGreen(), playerColor.getBlue(), 200),
    137138                                        new Point2D.Float(0f, 1f), new Color(playerColor.getRed(), playerColor.getGreen(), playerColor.getBlue(), 31));
    138                         areaRenderer.setSetting(AreaRenderer2D.COLOR, areaPaint);
     139                        areaRenderer.setSetting(AreaRenderer.COLOR, areaPaint);
    139140                        plot.setAreaRenderer(playerSeries, areaRenderer);
    140141                }
    141142                // Configure axes
    142                 AxisRenderer2D axisXRenderer = plot.getSetting(XYPlot.AXIS_X_RENDERER);
    143                 axisXRenderer.setSetting(AxisRenderer2D.LABEL, "Time [s]");
    144                 axisXRenderer.setSetting(AxisRenderer2D.TICKS_SPACING, 30.0);
    145                 axisXRenderer.setSetting(AxisRenderer2D.TICKS_MINOR_COUNT, 0);
    146                 AxisRenderer2D axisYRenderer = plot.getSetting(XYPlot.AXIS_Y_RENDERER);
    147                 axisYRenderer.setSetting(AxisRenderer2D.LABEL, "APM");
    148                 axisYRenderer.setSetting(AxisRenderer2D.LABEL_DISTANCE, 2.0);
    149                 axisYRenderer.setSetting(AxisRenderer2D.TICKS_SPACING, 10.0);
    150                 axisYRenderer.setSetting(AxisRenderer2D.TICKS_MINOR_COUNT, 0);
     143                AxisRenderer axisXRenderer = plot.getAxisRenderer(Axis.X);
     144                axisXRenderer.setSetting(AxisRenderer.LABEL, "Time [s]");
     145                axisXRenderer.setSetting(AxisRenderer.TICKS_SPACING, 30.0);
     146                axisXRenderer.setSetting(AxisRenderer.TICKS_MINOR_COUNT, 0);
     147                AxisRenderer axisYRenderer = plot.getAxisRenderer(Axis.Y);
     148                axisYRenderer.setSetting(AxisRenderer.LABEL, "APM");
     149                axisYRenderer.setSetting(AxisRenderer.LABEL_DISTANCE, 2.0);
     150                axisYRenderer.setSetting(AxisRenderer.TICKS_SPACING, 10.0);
     151                axisYRenderer.setSetting(AxisRenderer.TICKS_MINOR_COUNT, 0);
    151152                Axis axisX = plot.getAxis(Axis.X);
    152153                axisX.setMin(0);
    153154                Axis axisY = plot.getAxis(Axis.Y);
    154155                axisY.setMin(0);
    155                 double maxY = plot.getAxis(Axis.Y).getMax().doubleValue() + 2.0*axisYRenderer.<Double>getSetting(AxisRenderer2D.TICKS_SPACING);
     156                double maxY = plot.getAxis(Axis.Y).getMax().doubleValue() + 2.0*axisYRenderer.<Double>getSetting(AxisRenderer.TICKS_SPACING);
    156157                axisY.setMax(maxY);
    157158
Note: See TracChangeset for help on using the changeset viewer.