| 796 | } |
| 797 | |
| 798 | void TOPPViewBase::addData(const FeatureMapSharedPtrType& feature_map, |
| 799 | const ConsensusMapSharedPtrType& consensus_map, |
| 800 | vector<PeptideIdentification>& peptides, |
| 801 | const ExperimentSharedPtrType& peak_map, |
| 802 | const ODExperimentSharedPtrType& on_disc_peak_map, |
| 803 | LayerDataBase::DataType data_type, |
| 804 | bool show_as_1d, |
| 805 | bool show_options, |
| 806 | bool as_new_window, |
| 807 | const String& filename, |
| 808 | const String& caption, |
| 809 | UInt window_id, |
| 810 | Size spectrum_id) |
| 811 | { |
| 812 | // initialize flags with defaults from the parameters |
| 813 | bool maps_as_2d = (param_.getValue(user_section + "default_map_view") == "2d"); |
| 814 | bool maps_as_1d = false; |
| 815 | bool use_intensity_cutoff = (param_.getValue(user_section + "intensity_cutoff") == "on"); |
| 816 | bool is_dia_data = false; |
| 817 | |
| 818 | // feature, consensus feature and identifications can be merged |
| 819 | bool mergeable = ((data_type == LayerDataBase::DT_FEATURE) || |
| 820 | (data_type == LayerDataBase::DT_CONSENSUS) || |
| 821 | (data_type == LayerDataBase::DT_IDENT)); |
| 822 | |
| 823 | // only one peak spectrum? disable 2D as default |
| 824 | if (peak_map->size() == 1) { maps_as_2d = false; } |
| 825 | |
| 826 | // set the window where (new layer) data could be opened in |
| 827 | // get EnhancedTabBarWidget with given id |
| 828 | EnhancedTabBarWidgetInterface* tab_bar_target = ws_.getWidget(window_id); |
| 829 | |
| 830 | // cast to PlotWidget |
| 831 | PlotWidget* target_window = dynamic_cast<PlotWidget*>(tab_bar_target); |
| 832 | |
| 833 | if (tab_bar_target == nullptr) |
| 834 | { |
| 835 | target_window = getActivePlotWidget(); |
| 836 | } |
| 837 | else |
| 838 | { |
| 839 | as_new_window = false; |
| 840 | } |
| 841 | |
| 842 | // create dialog no matter if it is shown or not. It is used to determine the flags. |
| 843 | TOPPViewOpenDialog dialog(caption, as_new_window, maps_as_2d, use_intensity_cutoff, this); |
| 844 | |
| 845 | // disable opening in new window when there is no active window or feature/ID data is to be opened, but the current window is a 3D window |
| 846 | if (target_window == nullptr || (mergeable && dynamic_cast<Plot3DWidget*>(target_window))) |
| 847 | { |
| 848 | dialog.disableLocation(true); |
| 849 | } |
| 850 | |
| 851 | // for feature/consensus/identification maps |
| 852 | if (mergeable) |
| 853 | { |
| 854 | dialog.disableDimension(true); // disable 1d/2d/3d option |
| 855 | dialog.disableCutoff(false); |
nothing calls this directly
no test coverage detected