Search in sources :

Example 1 with PeakRenderer

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer in project mzmine2 by mzmine.

the class SpectraPlot method addDataSet.

// add Dataset with label generator
public synchronized void addDataSet(XYDataset dataSet, Color color, boolean transparency, XYItemLabelGenerator labelGenerator) {
    XYItemRenderer newRenderer;
    if (dataSet instanceof ScanDataSet) {
        ScanDataSet scanDataSet = (ScanDataSet) dataSet;
        Scan scan = scanDataSet.getScan();
        if (scan.getSpectrumType() == MassSpectrumType.CENTROIDED)
            newRenderer = new PeakRenderer(color, transparency);
        else {
            newRenderer = new ContinuousRenderer(color, transparency);
            ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
        }
        // Add label generator for the dataset
        newRenderer.setDefaultItemLabelGenerator(labelGenerator);
        newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
        newRenderer.setDefaultItemLabelPaint(labelsColor);
    } else {
        newRenderer = new PeakRenderer(color, transparency);
        // Add label generator for the dataset
        newRenderer.setDefaultItemLabelGenerator(labelGenerator);
        newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
        newRenderer.setDefaultItemLabelPaint(labelsColor);
    }
    plot.setDataset(numOfDataSets, dataSet);
    plot.setRenderer(numOfDataSets, newRenderer);
    numOfDataSets++;
    if (dataSet instanceof ScanDataSet)
        checkAndRunController();
}
Also used : ScanDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet) ContinuousRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.ContinuousRenderer) Scan(net.sf.mzmine.datamodel.Scan) PeakRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer)

Example 2 with PeakRenderer

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer in project mzmine2 by mzmine.

the class SpectraPlot method setPlotMode.

/**
 * This will set either centroid or continuous renderer to the first data set, assuming that
 * dataset with index 0 contains the raw data.
 */
public void setPlotMode(MassSpectrumType plotMode) {
    this.plotMode = plotMode;
    XYDataset dataSet = plot.getDataset(0);
    if (!(dataSet instanceof ScanDataSet))
        return;
    XYItemRenderer newRenderer;
    if (plotMode == MassSpectrumType.CENTROIDED) {
        newRenderer = new PeakRenderer(SpectraVisualizerWindow.scanColor, false);
    } else {
        newRenderer = new ContinuousRenderer(SpectraVisualizerWindow.scanColor, false);
        ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
    }
    // Add label generator for the dataset
    SpectraItemLabelGenerator labelGenerator = new SpectraItemLabelGenerator(this);
    newRenderer.setDefaultItemLabelGenerator(labelGenerator);
    newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
    newRenderer.setDefaultItemLabelPaint(labelsColor);
    plot.setRenderer(0, newRenderer);
}
Also used : ScanDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet) ContinuousRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.ContinuousRenderer) SpectraItemLabelGenerator(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.SpectraItemLabelGenerator) XYDataset(org.jfree.data.xy.XYDataset) PeakRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer)

Example 3 with PeakRenderer

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer in project mzmine2 by mzmine.

the class SpectraPlot method addDataSet.

public synchronized void addDataSet(XYDataset dataSet, Color color, boolean transparency) {
    XYItemRenderer newRenderer;
    if (dataSet instanceof ScanDataSet) {
        ScanDataSet scanDataSet = (ScanDataSet) dataSet;
        Scan scan = scanDataSet.getScan();
        if (scan.getSpectrumType() == MassSpectrumType.CENTROIDED)
            newRenderer = new PeakRenderer(color, transparency);
        else {
            newRenderer = new ContinuousRenderer(color, transparency);
            ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
        }
        // Add label generator for the dataset
        SpectraItemLabelGenerator labelGenerator = new SpectraItemLabelGenerator(this);
        newRenderer.setDefaultItemLabelGenerator(labelGenerator);
        newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
        newRenderer.setDefaultItemLabelPaint(labelsColor);
    } else {
        newRenderer = new PeakRenderer(color, transparency);
    }
    plot.setDataset(numOfDataSets, dataSet);
    plot.setRenderer(numOfDataSets, newRenderer);
    numOfDataSets++;
    if (dataSet instanceof ScanDataSet)
        checkAndRunController();
}
Also used : ScanDataSet(net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet) ContinuousRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.ContinuousRenderer) SpectraItemLabelGenerator(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.SpectraItemLabelGenerator) Scan(net.sf.mzmine.datamodel.Scan) PeakRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer)

Aggregations

ScanDataSet (net.sf.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet)3 ContinuousRenderer (net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.ContinuousRenderer)3 PeakRenderer (net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.PeakRenderer)3 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)3 Scan (net.sf.mzmine.datamodel.Scan)2 SpectraItemLabelGenerator (net.sf.mzmine.modules.visualization.spectra.simplespectra.renderers.SpectraItemLabelGenerator)2 XYDataset (org.jfree.data.xy.XYDataset)1