~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to source/VISUAL/VISUALIZER/MassAnalyzerVisualizer.C

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2013-12-20 11:30:16 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131220113016-wre5g9bteeheq6he
Tags: 1.11.1-3
* remove version number from libbost development package names;
* ensure that AUTHORS is correctly shipped in all packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- mode: C++; tab-width: 2; -*-
2
 
// vi: set ts=2:
3
 
//
4
 
// --------------------------------------------------------------------------
5
 
//                   OpenMS Mass Spectrometry Framework
6
 
// --------------------------------------------------------------------------
7
 
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
8
 
//
9
 
//  This library is free software; you can redistribute it and/or
10
 
//  modify it under the terms of the GNU Lesser General Public
11
 
//  License as published by the Free Software Foundation; either
12
 
//  version 2.1 of the License, or (at your option) any later version.
13
 
//
14
 
//  this library is distributed in the hope that it will be useful,
15
 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 
//  Lesser General Public License for more details.
18
 
//
19
 
//  You should have received a copy of the GNU Lesser General Public
20
 
//  License along with this library; if not, write to the Free Software
21
 
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
1
// --------------------------------------------------------------------------
 
2
//                   OpenMS -- Open-Source Mass Spectrometry
 
3
// --------------------------------------------------------------------------
 
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
 
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
 
6
//
 
7
// This software is released under a three-clause BSD license:
 
8
//  * Redistributions of source code must retain the above copyright
 
9
//    notice, this list of conditions and the following disclaimer.
 
10
//  * Redistributions in binary form must reproduce the above copyright
 
11
//    notice, this list of conditions and the following disclaimer in the
 
12
//    documentation and/or other materials provided with the distribution.
 
13
//  * Neither the name of any author or any participating institution
 
14
//    may be used to endorse or promote products derived from this software
 
15
//    without specific prior written permission.
 
16
// For a full list of authors, refer to the file AUTHORS.
 
17
// --------------------------------------------------------------------------
 
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
 
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
29
//
23
30
// --------------------------------------------------------------------------
24
31
// $Maintainer: Timo Sachsenberg $
38
45
 
39
46
namespace OpenMS
40
47
{
41
 
        
42
 
        MassAnalyzerVisualizer::MassAnalyzerVisualizer(bool editable, QWidget* parent)
43
 
                : BaseVisualizerGUI(editable, parent),
44
 
                        BaseVisualizer<MassAnalyzer>()
45
 
        {
46
 
                addLabel_("Modify massanalyzer information.");  
47
 
                addSeparator_();  
48
 
                
49
 
                addIntLineEdit_(order_, "Order" );
50
 
                addComboBox_(type_, "Type");
51
 
                addComboBox_(res_method_, "Resolution method");
52
 
                addComboBox_(res_type_, "Resolution type");
53
 
                addComboBox_(scan_dir_, "Scan direction");
54
 
                addComboBox_(scan_law_, "Scan law");
55
 
                addComboBox_(reflectron_state_, "Reflectron state");
56
 
                        
57
 
                addDoubleLineEdit_(res_, "Resolution" );
58
 
                addDoubleLineEdit_(acc_, "Accuracy" );
59
 
                addDoubleLineEdit_(scan_rate_, "Scan rate (in s)" );
60
 
                addDoubleLineEdit_(scan_time_, "Scan time (in s)" );
61
 
                addDoubleLineEdit_(TOF_, "TOF Total path length (in meter)" );
62
 
                addDoubleLineEdit_(iso_, "Isolation width (in m/z)" );
63
 
                addDoubleLineEdit_(final_MS_, "Final MS exponent" );
64
 
                addDoubleLineEdit_(magnetic_fs_, "Magnetic field strength (in T)" );
65
 
                
66
 
                finishAdding_();
67
 
        }
68
 
        
69
 
        void MassAnalyzerVisualizer::update_()
70
 
        {
71
 
                if(! isEditable())
72
 
                {
73
 
                        fillComboBox_(type_,& temp_.NamesOfAnalyzerType[temp_.getType()] , 1);
74
 
                        fillComboBox_(res_method_,& temp_.NamesOfResolutionMethod[temp_.getResolutionMethod()] , 1);
75
 
                        fillComboBox_(res_type_,& temp_.NamesOfResolutionType[temp_.getResolutionType()] , 1);
76
 
                        fillComboBox_(scan_dir_,& temp_.NamesOfScanDirection[temp_.getScanDirection()] , 1);
77
 
                        fillComboBox_(scan_law_,& temp_.NamesOfScanLaw[temp_.getScanLaw()] , 1);
78
 
                        fillComboBox_(reflectron_state_,& temp_.NamesOfReflectronState[temp_.getReflectronState()] , 1);
79
 
                }
80
 
                else
81
 
                {
82
 
                        fillComboBox_(type_, temp_.NamesOfAnalyzerType , MassAnalyzer::SIZE_OF_ANALYZERTYPE);
83
 
                        fillComboBox_(res_method_, temp_.NamesOfResolutionMethod , MassAnalyzer::SIZE_OF_RESOLUTIONMETHOD);
84
 
                        fillComboBox_(res_type_, temp_.NamesOfResolutionType , MassAnalyzer::SIZE_OF_RESOLUTIONTYPE);
85
 
                        fillComboBox_(scan_dir_, temp_.NamesOfScanDirection , MassAnalyzer::SIZE_OF_SCANDIRECTION);
86
 
                        fillComboBox_(scan_law_, temp_.NamesOfScanLaw , MassAnalyzer::SIZE_OF_SCANLAW);
87
 
                        fillComboBox_(reflectron_state_, temp_.NamesOfReflectronState , MassAnalyzer::SIZE_OF_REFLECTRONSTATE);
88
 
                        
89
 
                        type_->setCurrentIndex(temp_.getType()); 
90
 
                        res_method_->setCurrentIndex(temp_.getResolutionMethod()); 
91
 
                        res_type_->setCurrentIndex(temp_.getResolutionType()); 
92
 
                        scan_dir_->setCurrentIndex(temp_.getScanDirection()); 
93
 
                        scan_law_->setCurrentIndex(temp_.getScanLaw()); 
94
 
                        reflectron_state_->setCurrentIndex(temp_.getReflectronState()); 
95
 
                }
96
 
 
97
 
                order_->setText(String(temp_.getOrder()).c_str());
98
 
                res_->setText(String( temp_.getResolution() ).c_str());
99
 
                acc_->setText(String( temp_.getAccuracy() ).c_str());
100
 
                scan_rate_->setText(String( temp_.getScanRate() ).c_str());
101
 
                scan_time_->setText(String( temp_.getScanTime() ).c_str());
102
 
                TOF_->setText(String( temp_.getTOFTotalPathLength() ).c_str());
103
 
                iso_->setText(String( temp_.getIsolationWidth() ).c_str());
104
 
                final_MS_->setText(String( temp_.getFinalMSExponent() ).c_str());
105
 
                magnetic_fs_->setText(String( temp_.getMagneticFieldStrength() ).c_str());
106
 
        }
107
 
        
108
 
        void MassAnalyzerVisualizer::store()
109
 
        {
110
 
                ptr_->setOrder(order_->text().toInt());
111
 
                ptr_->setType((MassAnalyzer::AnalyzerType)type_->currentIndex());               
112
 
                ptr_->setResolutionMethod((MassAnalyzer::ResolutionMethod)res_method_->currentIndex());         
113
 
                ptr_->setResolutionType((MassAnalyzer::ResolutionType)res_type_->currentIndex());               
114
 
                ptr_->setScanDirection((MassAnalyzer::ScanDirection)scan_dir_->currentIndex());         
115
 
                ptr_->setScanLaw((MassAnalyzer::ScanLaw)scan_law_->currentIndex());             
116
 
                ptr_->setReflectronState((MassAnalyzer::ReflectronState)reflectron_state_->currentIndex());             
117
 
                
118
 
                ptr_->setResolution(res_->text().toDouble());
119
 
                ptr_->setAccuracy(acc_->text().toDouble());
120
 
                ptr_->setScanRate(scan_rate_->text().toDouble());
121
 
                ptr_->setScanTime(scan_time_->text().toDouble());
122
 
                ptr_->setTOFTotalPathLength(TOF_->text().toDouble());
123
 
                ptr_->setIsolationWidth(iso_->text().toDouble());
124
 
                ptr_->setFinalMSExponent(final_MS_->text().toInt());
125
 
                ptr_->setMagneticFieldStrength(magnetic_fs_->text().toDouble() );
126
 
                
127
 
                temp_=(*ptr_);
128
 
        }
129
 
        
130
 
        void MassAnalyzerVisualizer::undo_()
131
 
        {
132
 
                update_();
133
 
        }
 
48
 
 
49
  MassAnalyzerVisualizer::MassAnalyzerVisualizer(bool editable, QWidget * parent) :
 
50
    BaseVisualizerGUI(editable, parent),
 
51
    BaseVisualizer<MassAnalyzer>()
 
52
  {
 
53
    addLabel_("Modify massanalyzer information.");
 
54
    addSeparator_();
 
55
 
 
56
    addIntLineEdit_(order_, "Order");
 
57
    addComboBox_(type_, "Type");
 
58
    addComboBox_(res_method_, "Resolution method");
 
59
    addComboBox_(res_type_, "Resolution type");
 
60
    addComboBox_(scan_dir_, "Scan direction");
 
61
    addComboBox_(scan_law_, "Scan law");
 
62
    addComboBox_(reflectron_state_, "Reflectron state");
 
63
 
 
64
    addDoubleLineEdit_(res_, "Resolution");
 
65
    addDoubleLineEdit_(acc_, "Accuracy");
 
66
    addDoubleLineEdit_(scan_rate_, "Scan rate (in s)");
 
67
    addDoubleLineEdit_(scan_time_, "Scan time (in s)");
 
68
    addDoubleLineEdit_(TOF_, "TOF Total path length (in meter)");
 
69
    addDoubleLineEdit_(iso_, "Isolation width (in m/z)");
 
70
    addDoubleLineEdit_(final_MS_, "Final MS exponent");
 
71
    addDoubleLineEdit_(magnetic_fs_, "Magnetic field strength (in T)");
 
72
 
 
73
    finishAdding_();
 
74
  }
 
75
 
 
76
  void MassAnalyzerVisualizer::update_()
 
77
  {
 
78
    if (!isEditable())
 
79
    {
 
80
      fillComboBox_(type_, &temp_.NamesOfAnalyzerType[temp_.getType()], 1);
 
81
      fillComboBox_(res_method_, &temp_.NamesOfResolutionMethod[temp_.getResolutionMethod()], 1);
 
82
      fillComboBox_(res_type_, &temp_.NamesOfResolutionType[temp_.getResolutionType()], 1);
 
83
      fillComboBox_(scan_dir_, &temp_.NamesOfScanDirection[temp_.getScanDirection()], 1);
 
84
      fillComboBox_(scan_law_, &temp_.NamesOfScanLaw[temp_.getScanLaw()], 1);
 
85
      fillComboBox_(reflectron_state_, &temp_.NamesOfReflectronState[temp_.getReflectronState()], 1);
 
86
    }
 
87
    else
 
88
    {
 
89
      fillComboBox_(type_, temp_.NamesOfAnalyzerType, MassAnalyzer::SIZE_OF_ANALYZERTYPE);
 
90
      fillComboBox_(res_method_, temp_.NamesOfResolutionMethod, MassAnalyzer::SIZE_OF_RESOLUTIONMETHOD);
 
91
      fillComboBox_(res_type_, temp_.NamesOfResolutionType, MassAnalyzer::SIZE_OF_RESOLUTIONTYPE);
 
92
      fillComboBox_(scan_dir_, temp_.NamesOfScanDirection, MassAnalyzer::SIZE_OF_SCANDIRECTION);
 
93
      fillComboBox_(scan_law_, temp_.NamesOfScanLaw, MassAnalyzer::SIZE_OF_SCANLAW);
 
94
      fillComboBox_(reflectron_state_, temp_.NamesOfReflectronState, MassAnalyzer::SIZE_OF_REFLECTRONSTATE);
 
95
 
 
96
      type_->setCurrentIndex(temp_.getType());
 
97
      res_method_->setCurrentIndex(temp_.getResolutionMethod());
 
98
      res_type_->setCurrentIndex(temp_.getResolutionType());
 
99
      scan_dir_->setCurrentIndex(temp_.getScanDirection());
 
100
      scan_law_->setCurrentIndex(temp_.getScanLaw());
 
101
      reflectron_state_->setCurrentIndex(temp_.getReflectronState());
 
102
    }
 
103
 
 
104
    order_->setText(String(temp_.getOrder()).c_str());
 
105
    res_->setText(String(temp_.getResolution()).c_str());
 
106
    acc_->setText(String(temp_.getAccuracy()).c_str());
 
107
    scan_rate_->setText(String(temp_.getScanRate()).c_str());
 
108
    scan_time_->setText(String(temp_.getScanTime()).c_str());
 
109
    TOF_->setText(String(temp_.getTOFTotalPathLength()).c_str());
 
110
    iso_->setText(String(temp_.getIsolationWidth()).c_str());
 
111
    final_MS_->setText(String(temp_.getFinalMSExponent()).c_str());
 
112
    magnetic_fs_->setText(String(temp_.getMagneticFieldStrength()).c_str());
 
113
  }
 
114
 
 
115
  void MassAnalyzerVisualizer::store()
 
116
  {
 
117
    ptr_->setOrder(order_->text().toInt());
 
118
    ptr_->setType((MassAnalyzer::AnalyzerType)type_->currentIndex());
 
119
    ptr_->setResolutionMethod((MassAnalyzer::ResolutionMethod)res_method_->currentIndex());
 
120
    ptr_->setResolutionType((MassAnalyzer::ResolutionType)res_type_->currentIndex());
 
121
    ptr_->setScanDirection((MassAnalyzer::ScanDirection)scan_dir_->currentIndex());
 
122
    ptr_->setScanLaw((MassAnalyzer::ScanLaw)scan_law_->currentIndex());
 
123
    ptr_->setReflectronState((MassAnalyzer::ReflectronState)reflectron_state_->currentIndex());
 
124
 
 
125
    ptr_->setResolution(res_->text().toDouble());
 
126
    ptr_->setAccuracy(acc_->text().toDouble());
 
127
    ptr_->setScanRate(scan_rate_->text().toDouble());
 
128
    ptr_->setScanTime(scan_time_->text().toDouble());
 
129
    ptr_->setTOFTotalPathLength(TOF_->text().toDouble());
 
130
    ptr_->setIsolationWidth(iso_->text().toDouble());
 
131
    ptr_->setFinalMSExponent(final_MS_->text().toInt());
 
132
    ptr_->setMagneticFieldStrength(magnetic_fs_->text().toDouble());
 
133
 
 
134
    temp_ = (*ptr_);
 
135
  }
 
136
 
 
137
  void MassAnalyzerVisualizer::undo_()
 
138
  {
 
139
    update_();
 
140
  }
134
141
 
135
142
}