38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h> 49 #include <QRubberBand> 209 spectrum_widget_ = widget;
220 return spectrum_widget_;
243 return intensity_mode_;
257 intensity_mode_ = mod;
258 intensityModeChange_();
274 return layers_.getLayer(index);
279 return layers_.getLayer(index);
285 return layers_.getCurrentLayer();
290 return layers_.getCurrentLayer();
296 return layers_.getCurrentLayerIndex();
302 return getLayerFlag(layers_.getCurrentLayerIndex(), f);
308 setLayerFlag(layers_.getCurrentLayerIndex(), f, value);
314 return layers_.getLayer(layer).flags.test(f);
321 if (layers_.empty())
return;
323 layers_.getLayer(layer).flags.set(f, value);
324 update_buffer_ =
true;
331 if (layers_.empty())
return;
332 layers_.getCurrentLayer().label = label;
333 update_buffer_ =
true;
344 return visible_area_;
350 virtual void setFilters(
const DataFilters & filters);
355 return mz_to_x_axis_;
359 void mzToXAxis(
bool mz_to_x_axis);
367 inline Size getLayerCount()
const 370 return layers_.getLayerCount();
374 virtual void activateLayer(
Size layer_index) = 0;
376 virtual void removeLayer(
Size layer_index) = 0;
381 for (
Size i = getLayerCount(); i > 0; --i)
400 bool addLayer(ExperimentSharedPtrType map, ODExperimentSharedPtrType od_map,
const String & filename =
"");
410 bool addLayer(FeatureMapSharedPtrType map,
const String & filename =
"");
420 bool addLayer(ConsensusMapSharedPtrType map,
const String & filename =
"");
431 bool addLayer(std::vector<PeptideIdentification> & peptides,
432 const String & filename =
"");
437 return layers_.getCurrentLayer().getMinIntensity();
443 return layers_.getCurrentLayer().getMaxIntensity();
449 return getLayer(index).getMinIntensity();
455 return getLayer(index).getMaxIntensity();
459 void setLayerName(
Size i,
const String & name);
467 getCurrentLayer().param = param;
468 emit preferencesChange();
483 double getSnapFactor();
486 double getPercentageFactor()
const;
489 virtual void showCurrentLayerPreferences() = 0;
497 virtual void showMetaData(
bool modifiable =
false,
Int index = -1);
504 virtual void saveCurrentLayer(
bool visible) = 0;
514 void changeVisibility(
Size i,
bool b);
522 void changeLayerFilterState(
Size i,
bool b);
530 void showGridLines(
bool show);
539 void resetZoom(
bool repaint =
true);
547 void setVisibleArea(
const AreaType& area);
554 virtual void horizontalScrollBarChange(
int value);
561 virtual void verticalScrollBarChange(
int value);
564 void setAdditionalContextMenu(QMenu * menu);
573 void getVisiblePeakData(ExperimentType & map)
const;
583 void getVisibleFeatureData(FeatureMapType & map)
const;
592 void getVisibleConsensusData(ConsensusMapType & map)
const;
601 void getVisibleIdentifications(std::vector<PeptideIdentification> & peptides)
const;
604 virtual void updateLayer(
Size i) = 0;
612 dataToWidget_(x, y, point);
615 dataToWidget_(0, 0, zero);
634 void layerModficationChange(
Size layer,
bool modified);
637 void layerActivated(
QWidget * w);
640 void layerZoomChanged(
QWidget * w);
651 void sendCursorStatus(
double mz = -1.0,
double rt = -1.0);
654 void sendStatusMessage(std::string message,
OpenMS::UInt time);
657 void recalculateAxes();
660 void updateVScrollbar(
float,
float,
float,
float);
663 void updateHScrollbar(
float,
float,
float,
float);
666 void changeLegendVisibility();
669 void actionModeChange();
672 void preferencesChange();
677 void updateCursor_();
682 void drawText_(QPainter & painter, QStringList text);
685 double getIdentificationMZ_(
const Size layer_index,
689 virtual bool finishAdding_() = 0;
693 void popIncompleteLayer_(
const QString& error_message =
"");
697 void resizeEvent(QResizeEvent * e)
override;
698 void wheelEvent(QWheelEvent * e)
override;
699 void keyPressEvent(QKeyEvent * e)
override;
700 void keyReleaseEvent(QKeyEvent * e)
override;
701 void focusOutEvent(QFocusEvent * e)
override;
702 void leaveEvent(QEvent * e)
override;
703 void enterEvent(QEvent * e)
override;
707 virtual void intensityModeChange_();
719 virtual void changeVisibleArea_(
const AreaType & new_area,
bool repaint =
true,
bool add_to_stack =
false);
726 virtual void recalculateSnapFactor_();
730 virtual void zoom_(
int x,
int y,
bool zoom_in);
735 virtual void zoomForward_();
737 void zoomAdd_(
const AreaType & area);
744 virtual void translateLeft_(Qt::KeyboardModifiers m);
747 virtual void translateRight_(Qt::KeyboardModifiers m);
749 virtual void translateForward_();
751 virtual void translateBackward_();
759 virtual void updateScrollbars_();
775 visible_area_.minX() + (height() - y) / height() * visible_area_.width(),
776 visible_area_.minY() + x / width() * visible_area_.height()
782 visible_area_.minX() + x / width() * visible_area_.width(),
783 visible_area_.minY() + (height() - y) / height() * visible_area_.height()
791 return widgetToData_(pos.x(), pos.y());
810 point.setX(
int((y - visible_area_.minY()) / visible_area_.height() * width()));
815 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * width())
819 point.setY(height() -
int((x - visible_area_.minX()) / visible_area_.width() * height()));
823 point.setX(
int((x - visible_area_.minX()) / visible_area_.width() * width()));
827 point.setY(height() -
int((y - visible_area_.minY()) / visible_area_.height() * height()));
831 point.setY(height() -
int(
832 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * height()
839 virtual void paintGridLines_(QPainter & painter);
854 bool mz_to_x_axis_ =
true;
873 void recalculateRanges_(
UInt mz_dim,
UInt rt_dim,
UInt it_dim);
885 bool show_grid_ =
true;
890 std::vector<AreaType>::iterator zoom_pos_ = zoom_stack_.end();
901 virtual void update_(
const char * caller_name);
904 void modificationStatus_(
Size layer_index,
bool modified);
907 bool update_buffer_ =
false;
920 double percentage_factor_ = 1.0;
929 std::vector<double> snap_factors_ = {1.0};
935 QMenu* context_add_ =
nullptr;
938 bool show_timing_ =
false;
948 std::set<DataProcessing::ProcessingAction> actions;
949 actions.insert(action);
953 p->setProcessingActions(actions);
955 p->getSoftware().setName(
"PlotCanvas");
961 for (
Size i = 0; i < map.
size(); ++i)
963 map[i].getDataProcessing().push_back(p);
Description of the applied preprocessing steps.
Definition: DataProcessing.h:51
const AreaType & getVisibleArea() const
Returns the currently visible area.
Definition: PlotCanvas.h:342
PeakIndex selected_peak_
selected peak
Definition: PlotCanvas.h:941
ActionModes
Mouse action modes.
Definition: PlotCanvas.h:176
LayerStack layers_
Layer data.
Definition: PlotCanvas.h:851
bool getLayerFlag(Size layer, LayerDataBase::Flags f) const
returns a layer flag of the layer layer
Definition: PlotCanvas.h:312
A more convenient string class.
Definition: String.h:58
QPoint last_mouse_pos_
start position of mouse actions
Definition: PlotCanvas.h:913
void setLayerFlag(LayerDataBase::Flags f, bool value)
sets a layer flag of the current layer
Definition: PlotCanvas.h:306
PointType widgetToDataDistance(double x, double y)
compute distance in widget coordinates (unit axis as shown) when moving x/y px in chart coordinates ...
Definition: PlotCanvas.h:622
Size current_layer_
Definition: PlotCanvas.h:103
Size getCurrentLayerIndex() const
returns the index of the active layer
Definition: PlotCanvas.h:294
PointType widgetToData_(double x, double y)
Convert widget to chart coordinates.
Definition: PlotCanvas.h:770
A container for features.
Definition: FeatureMap.h:98
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
const LayerDataBase & getLayer(const Size index) const
Normal mode: f(x)=x.
Definition: PlotCanvas.h:186
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:134
std::unique_ptr< LayerDataBase > LayerDataBaseUPtr
Definition: PlotCanvas.h:65
A container for consensus elements.
Definition: ConsensusMap.h:82
void setLabel(LayerDataBase::LabelType label)
Definition: PlotCanvas.h:328
Size size() const
The number of spectra.
Definition: MSExperiment.h:147
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::vector< LayerDataBaseUPtr > layers_
Definition: PlotCanvas.h:101
LayerDataBase & getCurrentLayer()
returns the layer data of the active layer
Definition: PlotCanvas.h:288
Shows intensities normalized by layer maximum: f(x)=x/max(x)*100.
Definition: PlotCanvas.h:187
SpectrumType::PeakType PeakType
Peak type.
Definition: PlotCanvas.h:166
LayerDataBase & getLayer(Size index)
returns the layer data with index index
Definition: PlotCanvas.h:277
PeakIndex measurement_start_
start peak of measuring mode
Definition: PlotCanvas.h:943
boost::shared_ptr< OSWData > OSWDataSharedPtrType
SharedPtr on OSWData.
Definition: LayerDataBase.h:169
bool isMzToXAxis() const
Returns the mapping of m/z to axes.
Definition: PlotCanvas.h:353
bool getLayerFlag(LayerDataBase::Flags f) const
returns a layer flag of the current layer
Definition: PlotCanvas.h:300
QImage buffer_
Buffer that stores the actual peak information.
Definition: PlotCanvas.h:842
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
void removeCurrentLayer()
ProcessingAction
Definition: DataProcessing.h:58
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerDataBase.h:155
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:136
Shows the maximum displayed intensity as if it was the overall maximum intensity. ...
Definition: PlotCanvas.h:188
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:53
LayerDataBase::ExperimentType ExperimentType
Main data type (experiment)
Definition: PlotCanvas.h:146
Logarithmic mode.
Definition: PlotCanvas.h:189
float getMinIntensity(Size index) const
Returns the minimum intensity of the layer with index index.
Definition: PlotCanvas.h:447
LayerDataBase::FeatureMapSharedPtrType FeatureMapSharedPtrType
Main managed data type (features)
Definition: PlotCanvas.h:155
const LayerDataBase & getCurrentLayer() const
const LayerDataBase & getLayer(Size index) const
returns the layer data with index index
Definition: PlotCanvas.h:272
Int getActionMode() const
Returns the action mode.
Definition: PlotCanvas.h:229
LayerDataBase::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Main managed data type (consensus features)
Definition: PlotCanvas.h:159
Flags
Flags that determine which information is shown.
Definition: LayerDataBase.h:115
PlotWidget * getPlotWidget() const
Returns the spectrum widget.
Definition: PlotCanvas.h:218
LayerDataBase::OSWDataSharedPtrType OSWDataSharedPtrType
Definition: PlotCanvas.h:151
IntensityModes getIntensityMode() const
Returns the intensity mode.
Definition: PlotCanvas.h:241
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerDataBase.h:161
LabelType
Label used in visualization.
Definition: LayerDataBase.h:132
const LayerDataBase & getCurrentLayer() const
returns the layer data of the active layer
Definition: PlotCanvas.h:283
Management and storage of parameters / INI files.
Definition: Param.h:69
LayerDataBase::FeatureMapType FeatureMapType
Main data type (features)
Definition: PlotCanvas.h:153
void setCurrentLayer(Size index)
throws Exception::IndexOverflow unless index is smaller than getLayerCount()
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition: PlotCanvas.h:802
boost::shared_ptr< const ExperimentType > ConstExperimentSharedPtrType
Definition: LayerDataBase.h:163
IntensityModes
Display modes of intensity.
Definition: PlotCanvas.h:184
void addDataProcessing_(PeakMap &map, DataProcessing::ProcessingAction action) const
Data processing setter for peak maps.
Definition: PlotCanvas.h:946
static String getVersion()
Return the version number of OpenMS.
float getMaxIntensity(Size index) const
Returns the maximum intensity of the layer with index index.
Definition: PlotCanvas.h:453
QRubberBand rubber_band_
Rubber band for selected area.
Definition: PlotCanvas.h:932
float getCurrentMinIntensity() const
Returns the minimum intensity of the active layer.
Definition: PlotCanvas.h:435
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
LayerDataBase::ConstExperimentSharedPtrType ConstExperimentSharedPtrType
Definition: PlotCanvas.h:149
void setIntensityMode(IntensityModes mod)
Sets the intensity mode.
Definition: PlotCanvas.h:255
DPosition< 2 > PointType
Type of the Points.
Definition: PlotCanvas.h:169
DRange< 2 > AreaType
Types of Ranges/Areas.
Definition: PlotCanvas.h:171
LayerDataBase::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment)
Definition: PlotCanvas.h:148
void setCurrentLayerParameters(const Param ¶m)
Sets the parameters of the current layer.
Definition: PlotCanvas.h:465
bool gridLinesShown() const
Returns if the grid is currently shown.
Definition: PlotCanvas.h:266
void dataToWidgetDistance(double x, double y, QPoint &point)
converts a distance in axis values to pixel values
Definition: PlotCanvas.h:610
Size getCurrentLayerIndex() const
void setLayerFlag(Size layer, LayerDataBase::Flags f, bool value)
sets a layer flag of the layer layer
Definition: PlotCanvas.h:318
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Base class for visualization canvas classes.
Definition: PlotCanvas.h:135
static DateTime now()
Returns the current date and time.
DataFilter array providing some convenience functions.
Definition: DataFilters.h:51
LayerDataBase::ODExperimentSharedPtrType ODExperimentSharedPtrType
Definition: PlotCanvas.h:150
void removeLayers()
removes all layers by calling removeLayer() for all layer indices (from highest to lowest) ...
Definition: PlotCanvas.h:379
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra...
Definition: RangeManager.h:588
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: PlotCanvas.h:162
PointType widgetToData_(const QPoint &pos)
Calls widgetToData_ with x and y position of pos.
Definition: PlotCanvas.h:789
Definition: PlotCanvas.h:72
translate
Definition: PlotCanvas.h:178
void setPlotWidget(PlotWidget *widget)
Sets the spectrum widget.
Definition: PlotCanvas.h:207
int Int
Signed integer type.
Definition: Types.h:102
float getCurrentMaxIntensity() const
Returns the maximum intensity of the active layer.
Definition: PlotCanvas.h:441
void addLayer(LayerDataBaseUPtr new_layer)
zoom
Definition: PlotCanvas.h:179
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerDataBase.h:149
std::vector< AreaType > zoom_stack_
The zoom stack.
Definition: PlotCanvas.h:888
Class that stores the data for one layer.
Definition: LayerDataBase.h:97
SpectrumType::ConstIterator SpectrumConstIteratorType
Spectrum iterator type (iterates over peaks)
Definition: PlotCanvas.h:164
Index of a peak or feature.
Definition: PeakIndex.h:50
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63
Size getLayerCount() const
LayerDataBase::ConsensusMapType ConsensusMapType
Main data type (consensus features)
Definition: PlotCanvas.h:157
boost::shared_ptr< OnDiscMSExperiment > ODExperimentSharedPtrType
SharedPtr on On-Disc MSExperiment.
Definition: LayerDataBase.h:166
void removeLayer(Size layer_index)