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();
}
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);
}
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();
}
Aggregations