'****************************************************************************
'* Copyright (C) 2004 Peter Mortensen and Matthias Mann *
'* This file is part of MSQuant. *
'* *
'* MSQuant is distributed under the terms of *
'* the GNU General Public License. See src/COPYING.TXT or *
'* <http://www.gnu.org/licenses/gpl.txt> for details. *
'* *
'* MSQuant is free software; you can redistribute it *
'* and/or modify it under the terms of the GNU *
'* General Public License as published by the Free *
'* Software Foundation; either version 2 of the *
'* License, or (at your option) any later version. *
'* *
'* MSQuant is distributed in the hope that it will be *
'* useful, but WITHOUT ANY WARRANTY; without even the *
'* implied warranty of MERCHANTABILITY or FITNESS FOR *
'* A PARTICULAR PURPOSE. See the GNU General Public *
'* License for more details. *
'* *
'* You should have received a copy of the GNU General *
'* Public License along with MSQuant; if not, write to *
'* the Free Software Foundation, Inc., 59 Temple *
'* Place, Suite 330, Boston, MA 02111-1307 USA *
'* *
'* Purpose: abstract class to represent displaying spectra, hiding which *
'* particular spectrum type is used (e.g. Analyst/Finnigan/ *
'* Micromass). *
'* *
'****************************************************************************
'****************************************************************************
'* CEBI *
'* Software Development Group *
'* Peter Mortensen *
'* E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk *
'* WWW: http://www.cebi.sdu.dk/ *
'* *
'* Program for post-processing of result from search in mass *
'* spectrometric data. *
'* *
'* FILENAME: frmSpectrumDisplay.vb *
'* TYPE: VISUAL_BASIC *
'* *
'* CREATED: PM 2005-01-10 Vrs 1.0. Estimated.. *
'* UPDATED: PM 2005-xx-xx *
'* *
'****************************************************************************
' Future:
' 1. Refactor: put mInititalStartMass and mInititalEndMass into a massZoomStructure
' 2.
Option Strict On
Option Explicit On
'This class is a result of a refactoring, hiding (for the rest of the
'program) which particular spectrum is in use.
'Imports System.Text.RegularExpressions 'For Match
Imports SDUPutility 'For SDUPlogger
Imports massSpectrometryBase 'For rawDataFileHandling
'Changed PM_REFACTOR 2005-03-04
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Structure massZoomStructure
Dim startMass As Double
Dim endMass As Double
Dim maxYVal As Double 'Should this one be included??
End Structure 'markerStructure
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public MustInherit Class frmSpectrumDisplay
Inherits System.Windows.Forms.Form
Protected mMarking As SDUPspectrumMarking
'Changed PM_REFACTOR 2005-03-04
'This represents the current zoom state
'"Protected": direct access by sub-classes.
'Protected mStartMass As Double
'Protected mEndMass As Double
'Protected mMaxYVal As Double
Protected mZoom As massZoomStructure
Protected mStartingUp As Boolean = True
'This represents the max zoom'ed out state
Protected mInititalStartMass As Double 'This can be lower than the
' actual - if we want to provide more.
Protected mInititalEndMass As Double
'Changed PM_REFACTOR 2005-03-05
Protected mRawDataFileHandling As rawDataFileHandling
'Changed PM_REFACTOR 2005-08-03
Private mChargeStr(10) As String
'From form: Show()
'Public MustOverride Sub addMarker( _
' ByRef anInOutForm As Form, ByRef aFarOff As Point, _
' ByRef anInMarker As markerStructure, ByVal anInBaseLineLength As Integer)
'Public MustOverride Sub highLightMarker( _
' ByRef anInOutForm As Form, ByVal aTag As Integer)
'Public MustOverride Sub clearMarkers(ByRef anInOutForm As Form)
'Changed PM_QSTAR_BROKEN_QUANTITATION_FULLZOOMBUG 2007-10-10
Public MustOverride Function getCOMlogger() As SDUPlogger
Public MustOverride Sub setSpectrumTitle(ByVal aTitle As String)
'Changed PM_REFACTOR 2007-09-25
Public MustOverride Function getTitle() As String
''Public MustOverride Sub updateData(ByRef aSignal As ArrayList)
'Public MustOverride Sub updateData( _
' ByRef anInRawDataFileHandling As rawDataFileHandling)
Public MustOverride Sub updateData()
Public MustOverride Sub refresh2()
Protected MustOverride Sub spectrumControlLocAndSize( _
ByRef anOutXLoc As Integer, ByRef anOutYLoc As Integer, _
ByRef anOutXSize As Integer, ByRef anOutYSize As Integer)
Protected MustOverride Sub newZoom()
'Changed PM_ANALYST_MARKERS 2005-02-10
Public MustOverride Function yOffsetForMarkers() As Integer
Public MustOverride Function xOffsetForMarkers() As Integer
Public MustOverride Function xOffsetFromRightEdge() As Integer
'Changed PM_MS3_CLEAR_DISPLAY 2005-02-26
Protected MustOverride Sub derivedClearDisplay()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub New( _
ByRef anInRawDataFileHandling As rawDataFileHandling, _
ByRef anInOutMarker As SDUPspectrumMarking)
'Changed PM_REFACTOR 2007-09-19
'mParentForm = aParentForm
mMarking = anInOutMarker
'Changed PM_REFACTOR 2005-03-05
mRawDataFileHandling = anInRawDataFileHandling
mInititalStartMass = -10.0
mInititalEndMass = -10.0
'Changed PM_REFACTOR 2005-08-03
''Changed PM_QUANT_CHARGE_DISPLAY 2005-03-14
mChargeStr(0) = ""
mChargeStr(1) = "+"
mChargeStr(2) = "++"
mChargeStr(3) = "+++"
mChargeStr(4) = "++++"
mChargeStr(5) = "+++++"
mChargeStr(6) = "++++++"
mChargeStr(7) = "+++++++"
End Sub 'New
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub newRawFileObject( _
ByRef anInRawDataFileHandling As rawDataFileHandling)
mRawDataFileHandling = anInRawDataFileHandling
End Sub 'newRawFileObject
'Changed PM_MEMORY_ALLOCATION 2004-08-03
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Function getZoomRange() _
As massZoomStructure
'Changed PM_REFACTOR 2005-03-04
'anOutStartMass = mStartMass
'anOutEndMass = mEndMass
Return mZoom
End Function 'setZoomRange
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub setInitialZoom(ByVal aZoom As massZoomStructure)
mInititalStartMass = aZoom.startMass - 10.0
mInititalEndMass = aZoom.endMass + 10.0
Me.setZoomRange2(aZoom)
End Sub 'setInitialZoom
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub setZoomRange2(ByVal aZoom As massZoomStructure)
If mStartingUp Then
mStartingUp = False
End If
'Changed PM_REFACTOR 2005-03-04
'mStartMass = aStartMass
'mEndMass = anEndMass
'mMaxYVal = aMaxYVal
mZoom = aZoom
'Changed PM_REFACTOR 2007-09-19
If True Then
Dim specX As Integer
Dim specY As Integer
Dim sizeX As Integer
Dim sizeY As Integer
Me.spectrumControlLocAndSize(specX, specY, sizeX, sizeY)
mMarking.newZoomEtc(aZoom, specX, specY, sizeX, sizeY)
End If
Dim displayMassWindow As Double = aZoom.endMass - aZoom.startMass
If displayMassWindow < 0.000000001 Then
Trace.Assert(False, "PIL ASSERT. Empty display range.." & _
"This can happen if the buggy XCalibur 2.0 is used on older .RAW files.")
Else
Dim peter2 As Integer = 2
End If
'Changed PM_USER_EXACT_ZOOM 2005-03-03
'mInititalStartMass = mZoom.startMass - 10.0
'mInititalEndMass = mZoom.endMass + 10.0
'Somehow let the display be updated.
Me.newZoom()
'Changed PM_REFACTOR 2007-09-19
'Changed PM_USER_EXACT_ZOOM 2005-03-03
mMarking.updateMarkersPosition()
End Sub 'setZoomRange
'****************************************************************************
'* M A R K E R S , B E G I N *
'****************************************************************************
'Changed PM_REFACTOR 2007-09-19
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub addIonMarker( _
ByVal anIon As fragmentExStructure, _
ByVal aMCRdelta As Double, _
ByVal aToken As Integer)
'Pass on.
mMarking.addIonMarker(anIon, aMCRdelta, aToken)
End Sub 'addIonMarker
'Changed PM_REFACTOR 2007-09-19
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub addMarker2( _
ByRef anInMarker As markerStructure, _
ByVal anInBaseLineLength As Integer, _
ByVal anInHighlight As Boolean, _
ByVal anOverrideColour As Color, _
ByVal anInLabelDirection As labelDirectionEnum, _
ByVal anInYpixelOffset As Integer, _
ByVal anYdisplayLevel As Integer)
'anYdisplayLevel: low integers; 0, 1, 2, 3. Is NOT pixels.
'Pass on.
mMarking.addMarker2( _
anInMarker, _
anInBaseLineLength, _
anInHighlight, _
anOverrideColour, _
anInLabelDirection, _
anInYpixelOffset, _
anYdisplayLevel)
End Sub 'addMarker
'Changed PM_FINNEGAN_LABELS 2004-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub lastMarkerAdded(ByVal aHighestX As Double)
'Pass on.
mMarking.lastMarkerAdded(aHighestX)
End Sub 'lastMarkerAdded
'Changed PM_FINNEGAN_LABELS 2004-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub clearMarkers()
'Pass on.
mMarking.clearMarkers()
End Sub 'clearMarkers
'Changed PM_MS3INTEGRATION 2004-05-14
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub highLightMarker( _
ByRef anInOutForm As Form, ByVal aTag As Integer)
'Pass on.
mMarking.highLightMarker(aTag)
End Sub 'highLightMarker
'****************************************************************************
'* P R I V A T E *
'****************************************************************************
'Small helper function
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub getSignalInZoomRange( _
ByRef aOutSignal As Generic.List(Of massSpectrometryBase.signalStructure))
'Old:
' ByRef aOutSignal As ArrayList
'Changed PM_REFACTOR 2005-03-05
'Old first parameter.
' ByRef anInRawDataFileHandling As rawDataFileHandling, _
Dim rawFileID As Integer = mRawDataFileHandling.getCurrentRawFileTag()
'Changed PM_REFACTOR 2006-10-12
'aOutSignal = New ArrayList
aOutSignal = New Generic.List(Of massSpectrometryBase.signalStructure)
Dim dataPointsInfo As dataPointsInfoStructure2
Dim margin As Double = 0.2
Dim zoom As massZoomStructure = Me.getZoomRange()
mRawDataFileHandling.DataPoints( _
zoom.startMass - margin, zoom.endMass + margin, _
rawFileID, aOutSignal, dataPointsInfo)
End Sub 'getSignalInZoomRange
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub clearDisplay(ByRef aTitle As String)
mMarking.clearMarkers() 'Correct?
Me.derivedClearDisplay()
Me.setSpectrumTitle(aTitle)
End Sub 'clearDisplay
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Function chargeEncoding(ByVal aCharge As Integer) As String
Return mChargeStr(aCharge)
End Function 'chargeEncoding
End Class 'frmSpectrumDisplay
Generated by script codePublish.pl at 2008-09-23T11:59:18.