'****************************************************************************
'* Copyright (C) 2007 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: Holds Class QS11analystCOM, see below *
'* for documentation. *
'* *
'****************************************************************************
'****************************************************************************
'* 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: QS11analystCOM.vb *
'* MAIN_CLASS: QS11analystCOM *
'* STRUCTS_AND_CLASSES: <none> *
'* TYPE: VISUAL_BASIC *
'* *
'* CREATED: PM 2007-07-24 Vrs 1.0. Cloned from QS20analystCOM.vb... *
'* UPDATED: PM 2007-xx-xx *
'* *
'****************************************************************************
'Relies on reference in project to a version specific Interop
'dll (generated by script "Vendor COM versioning.bat"). E.g.:
' Z:\zNEW\TRANSPORT\ToSDU\
' 2007-06-18\Interops\QS 1.1\byCMD\
'
' QS11.AxInterop.GraphControlLib.dll
'
' and
'
' QS11.Interop.GraphControlLib.dll
'
' and
'
' QS11.Interop.ExploreDataObjects.dll
'Analyst QS 2.0 COM objects/classes specific...
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Class QS11analystCOM
Inherits AnalystCOM
'If we get these compiler errors:
' Error 32 Type 'QS11.ExploreDataObjects.FMANSpecData' is not defined.
'
'then it is because there is no reference in the project to these DLLs:
'
' QS11.Interop.ExploreDataObjects.dll
' QS11.AxInterop.GraphControlLib.dll
' QS11.Interop.GraphControlLib.dll
Private mANALYSTCOM_Data3 As QS11.ExploreDataObjects.FMANSpecData
Private mANALYSTCOM_WFC3 As QS11.ExploreDataObjects.FMANWiffFileControl
Private mANALYSTCOM_WiffFile3 As QS11.ExploreDataObjects.FMANWiffFile
Private mANALYSTCOM_XYdata As QS11.ExploreDataObjects.XYData
'Changed PM_ANALYST_GRAPHZOOM_HANDLING 2007-07-25
'Private mANALYSTCOM_axControl As AxQS11_GraphControlLib.AxGraphControl
Private WithEvents mANALYSTCOM_axControl As _
AxQS11_GraphControlLib.AxGraphControl
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub New()
MyBase.New() 'Is this necessary? Yes!
mANALYSTCOM_Data3 = Nothing 'Lazy instantiation.
mANALYSTCOM_WFC3 = Nothing 'Lazy instantiation.
mANALYSTCOM_WiffFile3 = Nothing 'Lazy instantiation.
mANALYSTCOM_XYdata = Nothing 'Lazy instantiation.
mANALYSTCOM_axControl = Nothing 'Lazy instantiation.
End Sub 'New
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_XYdata_create( _
ByVal aXValuesAreSorted As Boolean)
mANALYSTCOM_XYdata = New QS11.ExploreDataObjects.XYData
mANALYSTCOM_XYdata.XValuesAreSorted = False 'This was the missing
' ' line!!! (can not do this for spectra).
End Sub '_derived_XYdata_create
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_NewInstance_data()
mANALYSTCOM_Data3 = New QS11.ExploreDataObjects.FMANSpecData
'mANALYSTCOM_Data3.AppendDataPoint(xValue double, yValue double)
End Sub '_derived_NewInstance_data
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_NewInstance_fileControl()
mANALYSTCOM_WFC3 = New QS11.ExploreDataObjects.FMANWiffFileControl
End Sub '_derived_NewInstance_data
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_NewInstance_WiffFile( _
ByRef aFileNameFullPath As String, _
ByVal aSampleNumberInRawFile As Integer)
Trace.Assert( _
Not mANALYSTCOM_WFC3 Is Nothing, _
"PIL ASSERT. mANALYSTCOM_WFC3 Is Nothing.")
'Note: If file does not exist then this exception can happen:
' System.Runtime.InteropServices.COMException()
'
mANALYSTCOM_WiffFile3 = _
mANALYSTCOM_WFC3.GetWiffFileObject( _
aFileNameFullPath, aSampleNumberInRawFile)
End Sub '_derived_NewInstance_data
'
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_NewInstance_axControl()
mANALYSTCOM_axControl = New AxQS11_GraphControlLib.AxGraphControl
End Sub '_derived_NewInstance_axControl
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_data_setWiffFileName( _
ByRef aFileNameFullPath As String)
mANALYSTCOM_Data3.WiffFileName = aFileNameFullPath
End Sub '_derived_data_setWiffFileName
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_data_SetSpectrum( _
ByVal anInSample As Integer, _
ByVal anInPeriod As Integer, _
ByVal anExperiment As Integer, _
ByVal anInStartTime As Single, _
ByVal anInEndTime As Single)
mANALYSTCOM_Data3.SetSpectrum( _
anInSample, _
anInPeriod, _
anExperiment, _
anInStartTime, _
anInEndTime)
End Sub '_derived_data_SetSpectrum
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_data_GetStartMass() _
As Double
Dim toReturn As Double = mANALYSTCOM_Data3.GetStartMass()
Return toReturn
End Function '_derived_data_GetStartMass
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_data_GetStopMass() _
As Double
Dim toReturn As Double = mANALYSTCOM_Data3.GetStopMass()
Return toReturn
End Function '_derived_data_GetStopMass
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_data_GetStartTime() _
As Single
Dim toReturn As Single = mANALYSTCOM_Data3.GetStartTime()
Return toReturn
End Function '_derived_data_GetStartTime
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_data_GetEndTime() _
As Single
Dim toReturn As Single = mANALYSTCOM_Data3.GetEndTime()
Return toReturn
End Function '_derived_data_GetEndTime
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_data_GetXValueRange( _
ByRef anOutMinimumXvalue As Double, _
ByRef anOutMaximumXvalue As Double)
mANALYSTCOM_Data3.GetXValueRange(anOutMinimumXvalue, anOutMaximumXvalue)
End Sub '_derived_data_GetXValueRange
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_data_GetClosestPointNumberForXValue( _
ByVal anInXvalue As Double, _
ByVal anInWhichClosestPoint As whichClosestPointTypeEnum, _
ByRef anOutPointNumber As Integer)
Dim whichClosestPoint As QS11.ExploreDataObjects.WhichClosestPointType
'Translate from our .NET enum to the enum for the
'particular COM component version (the COM names
'may be the same but the GUIDs could be different).
'
'We could cache the mapping in a hash, if needed.
Select Case anInWhichClosestPoint
Case whichClosestPointTypeEnum.enumCLOSEST_POINT
whichClosestPoint = _
QS11.ExploreDataObjects.WhichClosestPointType.CLOSEST_POINT
Case whichClosestPointTypeEnum.enumCLOSEST_POINT_HIGHER
whichClosestPoint = _
QS11.ExploreDataObjects.WhichClosestPointType.CLOSEST_POINT_HIGHER
Case whichClosestPointTypeEnum.enumCLOSEST_POINT_LOWER
whichClosestPoint = _
QS11.ExploreDataObjects.WhichClosestPointType.CLOSEST_POINT_LOWER
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
mANALYSTCOM_Data3.GetClosestPointNumberForXValue( _
anInXvalue, whichClosestPoint, anOutPointNumber)
End Sub '_derived_data_GetClosestPointNumberForXValue
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_data_GetDataPoint( _
ByVal anInPointerNumber As Integer, _
ByRef anOutXvalue As Double, _
ByRef anOutYvalue As Double)
mANALYSTCOM_Data3.GetDataPoint( _
anInPointerNumber, anOutXvalue, anOutYvalue)
End Sub '_derived_data_GetDataPoint
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_data_DataTitle() _
As String
Dim toReturn As String = _
mANALYSTCOM_Data3.DataTitle()
Return toReturn
End Function '_derived_data_GetDataPoint
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides _
Function _derived_wiffFile_GetActualTimeFromPeriodAndCycle( _
ByVal aInSample As Integer, _
ByVal aPeriod As Integer, _
ByVal anExperiment As Integer, _
ByVal aCycle As Integer) _
As Single
Dim toReturn As Single = _
mANALYSTCOM_WiffFile3.GetActualTimeFromPeriodAndCycle( _
aInSample, aPeriod, anExperiment, aCycle)
Return toReturn
End Function '_derived_wiffFile_GetActualTimeFromPeriodAndCycle
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides _
Function _derived_wiffFile_GetActualNumberOfCycles( _
ByVal aInSample As Integer, _
ByVal anInPeriod As Integer) _
As Integer
Dim toReturn As Integer = _
mANALYSTCOM_WiffFile3.GetActualNumberOfCycles( _
aInSample, anInPeriod)
Return toReturn
End Function '_derived_wiffFile_GetActualNumberOfCycles
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides _
Sub _derived_wiffFile_GetActualPeriodAndCycleFromTime( _
ByVal aInSample As Integer, _
ByVal aInExperiment As Integer, _
ByVal aInRetT As Single, _
ByRef anOutPeriod As Integer, _
ByRef anOutCycle As Integer)
mANALYSTCOM_WiffFile3.GetActualPeriodAndCycleFromTime( _
aInSample, _
aInExperiment, _
aInRetT, _
anOutPeriod, _
anOutCycle)
End Sub '_derived_wiffFile_GetActualPeriodAndCycleFromTime
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_BeginInit()
CType(mANALYSTCOM_axControl, _
System.ComponentModel.ISupportInitialize).BeginInit()
End Sub '_derived_axControl_BeginInit
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_axControl_setupControl( _
ByRef aResources As System.Resources.ResourceManager, _
ByVal anEnabled As Boolean, _
ByVal aLocation As System.Drawing.Point, _
ByRef anInSpectrumControlName As String, _
ByVal aSize As System.Drawing.Size, _
ByVal aTabIndex As Integer _
) _
As System.Windows.Forms.Control
mANALYSTCOM_axControl.Enabled = anEnabled
mANALYSTCOM_axControl.Location = aLocation
mANALYSTCOM_axControl.Name = anInSpectrumControlName
mANALYSTCOM_axControl.OcxState = _
CType(aResources.GetObject( _
anInSpectrumControlName & ".OcxState"), _
System.Windows.Forms.AxHost.State)
mANALYSTCOM_axControl.Size = aSize
mANALYSTCOM_axControl.TabIndex = aTabIndex
Return mANALYSTCOM_axControl
End Function '_derived_axControl_setupControl
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_axControl_getTitle() _
As String
Dim toReturn As String = _
mANALYSTCOM_axControl.SeriesColl.Item(1).Title.Text
Return toReturn
End Function '_derived_axControl_getTitle
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setXaxisMin( _
ByVal aMinX As Double)
mANALYSTCOM_axControl.GraphArea.XAxis.Min = aMinX
End Sub '_derived_axControl_setXaxisMin
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setXaxisMax( _
ByVal aMaxX As Double)
mANALYSTCOM_axControl.GraphArea.XAxis.Max = aMaxX
End Sub '_derived_axControl_setXaxisMax
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setYaxisMax( _
ByVal aMaxY As Double)
mANALYSTCOM_axControl.GraphArea.YAxis.Max = aMaxY
End Sub '_derived_axControl_setYaxisMax
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_getAxisRanges( _
ByRef anOutDataXmin As Double, _
ByRef anOutDataXmax As Double, _
ByRef anOutDataYmax As Double, _
ByRef anOutXmin As Double, _
ByRef anOutXmax As Double _
)
anOutDataXmin = mANALYSTCOM_axControl.GraphArea.XAxis.DataMin
anOutDataXmax = mANALYSTCOM_axControl.GraphArea.XAxis.DataMax
anOutDataYmax = mANALYSTCOM_axControl.GraphArea.YAxis.DataMax
anOutXmin = mANALYSTCOM_axControl.GraphArea.XAxis.Min
anOutXmax = mANALYSTCOM_axControl.GraphArea.XAxis.Max
End Sub '_derived_axControl_getAxisRanges
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setVisible( _
ByVal aState As Boolean)
mANALYSTCOM_axControl.Visible = aState
End Sub '_derived_axControl_setVisible
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setTitle( _
ByVal aCollIndex As Integer, ByRef anInTitle As String)
mANALYSTCOM_axControl.SeriesColl.Item(aCollIndex).Title.Text = anInTitle
End Sub '_derived_axControl_setTitle
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_InvalidateControl()
mANALYSTCOM_axControl.InvalidateControl()
End Sub '_derived_axControl_setTitle
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_axControl_CreateAddUserLabel( _
ByVal anIndex As Integer, _
ByRef anInText As String, _
ByVal anXpos As Double, _
ByVal anYpos As Double) _
As Integer
Dim toReturn As Integer = _
mANALYSTCOM_axControl.SeriesColl.Item( _
anIndex).SeriesCaptionColl.CreateAddUserLabel( _
anInText, anXpos, anYpos)
Return toReturn
End Function '_derived_axControl_CreateAddUserLabel
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_fontBoldItalic( _
ByVal aCollIndex As Integer, ByVal aSomeOtherIndex As Integer)
mANALYSTCOM_axControl.SeriesColl.Item( _
aCollIndex).SeriesCaptionColl.Item(aSomeOtherIndex).Font.Italic = _
True
mANALYSTCOM_axControl.SeriesColl.Item( _
aCollIndex).SeriesCaptionColl.Item(aSomeOtherIndex).Font.Bold = _
True
End Sub '_derived_axControl_fontBoldItalic
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Function _derived_axControl_SeriesCollCount() _
As Integer
Dim toReturn As Integer = _
mANALYSTCOM_axControl.SeriesColl.Count()
Return toReturn
End Function '_derived_axControl_SeriesCollCount
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_CreateAddSeries()
mANALYSTCOM_axControl.SeriesColl.CreateAddSeries()
End Sub '_derived_axControl_CreateAddSeries
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_SeriesRemoveAll( _
ByVal aColIndex As Integer)
mANALYSTCOM_axControl.SeriesColl.Item( _
aColIndex).SeriesCaptionColl.RemoveAll()
End Sub '_derived_axControl_SeriesRemoveAll
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_AutoCreateMetaData( _
ByVal aColIndex As Integer)
mANALYSTCOM_axControl.SeriesColl.Item( _
aColIndex).AutoCreateMetaData()
End Sub '_derived_axControl_AutoCreateMetaData
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setDataObject( _
ByVal aColIndex As Integer, ByRef anInSourceObject As Object)
Dim data As QS11analystCOM = DirectCast(anInSourceObject, QS11analystCOM)
'aColIndex is expected to be 1.
Trace.Assert( _
Not data.mANALYSTCOM_Data3 Is Nothing, _
"PIL ASSERT. data.mANALYSTCOM_Data3 does not exist...")
'Note: this resets zoom of spectrum display to full zoom!!!
mANALYSTCOM_axControl.SeriesColl.Item(aColIndex).DataObject = _
data.mANALYSTCOM_Data3
End Sub '_derived_axControl_setDataObject
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_setXYObject( _
ByVal aColIndex As Integer, ByRef anInSourceObject As Object)
Dim data As QS11analystCOM = DirectCast(anInSourceObject, QS11analystCOM)
'aColIndex is expected to be 2.
mANALYSTCOM_axControl.SeriesColl.Item(aColIndex).DataObject = _
data.mANALYSTCOM_XYdata
End Sub '_derived_axControl_setXYObject
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_CreateAddMarker( _
ByVal aColIndex As Integer, ByVal anInDpos As Double)
mANALYSTCOM_axControl.SeriesColl.Item( _
aColIndex).MarkerColl.CreateAddMarker( _
anInDpos)
End Sub '_derived_axControl_CreateAddMarker
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_getLocation( _
ByRef anOutX As Integer, ByRef anOutY As Integer)
anOutX = mANALYSTCOM_axControl.Location.X
anOutY = mANALYSTCOM_axControl.Location.Y
End Sub '_derived_axControl_getLocation
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_getSize( _
ByRef anOutSizeX As Integer, ByRef anOutSizeY As Integer)
Dim specSize As System.Drawing.Size = mANALYSTCOM_axControl.Size
anOutSizeX = specSize.Width
anOutSizeY = specSize.Height
End Sub '_derived_axControl_getSize
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_Refresh()
mANALYSTCOM_axControl.Refresh()
End Sub '_derived_axControl_Refresh
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_axControl_Focus()
mANALYSTCOM_axControl.Focus()
End Sub '_derived_axControl_Refresh
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub _derived_XYdata_AppendDataPoint( _
ByVal aXvalue As Double, ByVal aYvalue As Double)
mANALYSTCOM_XYdata.AppendDataPoint(aXvalue, aYvalue)
End Sub '_derived_XYdata_AppendDataPoint
'Changed PM_ANALYST_GRAPHZOOM_HANDLING 2007-07-25
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mANALYSTCOM_axControl_GraphZoom( _
ByVal aSender As Object, _
ByVal anEvent As _
AxQS11_GraphControlLib._DGraphControlEvents_GraphZoomEvent) _
Handles mANALYSTCOM_axControl.GraphZoom
'Pass on the event as a COM version independent event.
'From compiler:
' Derived classes cannot raise base class events.
' RaiseEvent GraphZoom2(Me, New System.EventArgs())
'
'Instead round-about:
doRaiseGraphZoomEvent(Me, 11)
End Sub 'mANALYSTCOM_axControl_GraphZoom
End Class 'QS11analystCOM
Generated by script codePublish.pl at 2009-01-05T15:20:59.