PRO sesRightMenu::SetView , type = type
	COMPILE_OPT IDL2
	oSystem = self.oSystem
	drawSize = [(oSystem.mainDraw).drawSize , $
	            (oSystem.CurrentPro).imageX , $
	            (oSystem.CurrentPro).imageY]

	Type = type

	sesViewSize, drawSize, Type = type				 	       , $
						 	ZoomRate = zoom			 	       , $
						 	windowVD = windowVD		           , $
							viewPlane = viewPlane	           , $
							viewDim = viewDim		           , $
							currentXY=currentXY                , $
							oDraw = (oSystem.mainDraw).drawID  , $
							oView = (oSystem.CurrentPro).oView , $
							viewLoc = viewLoc

	IF KeyWord_Set(viewDim) THEN (oSystem.CurrentPro).oView->SetProperty, Dimensions = viewDim
	IF KeyWord_Set(viewLoc) THEN (oSystem.CurrentPro).oView->SetProperty, Location = viewLoc
	IF KeyWord_Set(windowVD) THEN Widget_Control, (oSystem.mainDraw).drawID	, $
           Draw_XSize = windowVD[0], Draw_YSize = windowVD[1]

 	Widget_Control, (oSystem.mainDraw).drawID, Scr_XSize = (oSystem.mainDraw).drawSize[0], $
 						Scr_YSize = (oSystem.mainDraw).drawSize[1]

	(oSystem.CurrentPro).oModel->Reset
	(oSystem.CurrentPro).oModel->Scale, zoom, zoom, 1

	(oSystem.CurrentPro).oView->SetProperty, ViewPlane_Rect = viewPlane
	oSystem.oWindow -> Draw, oSystem.oScene
END
;+
;write single data
;+
PRO sesRightMenu::WriteData
	COMPILE_OPT IDL2
	oSystem = self.oSystem
	imageClass = oSystem.CurrentPro
	title = (oSystem.menuBar).Title
	title.titleModel->SetProperty,Hide = 1
	self->SetView , type = 'initSize'
	magModel = Obj_New('IDLgrModel', name='MagModel')
	imageClass.oView->Add, magModel
	magImage = Obj_New('IDLgrImage', name='magImage')
	magModel->Add,	magImage
	baseSize =  oSystem.baseSize
	obuffer = Obj_New('IDLgrBuffer', $
	                   dimensions=[baseSize[0] , baseSize[1] ])
	magModel->SetProperty, Hide=1
	obuffer->draw, imageClass.oView
	oImage = obuffer->Read()
	oImage->GetProperty, data=image
	imageClass.oView->GetProperty,Location = loc , Dimensions = dim
	data = image[*,loc[0]:(loc[0]+dim[0]-1),loc[1]:(loc[1]+dim[1]-1)]
	Obj_Destroy,obuffer
	Obj_Destroy,magModel
	Obj_Destroy,magImage

	Openw, lun, self.imageDir, /Get_Lun
	Writeu, lun, data[0,*,*]
	Writeu, lun, data[1,*,*]
	Writeu, lun, data[2,*,*]
	Free_Lun, lun
	title.titleModel->SetProperty,Hide = 0
	image = 0
	data = 0
END
;+
;associate image number
;+
PRO sesRightMenu::associateImage , item
	COMPILE_OPT IDL2
	item->GetProperty,Name = Name
	Info = strsplit(Name, '_', /Extract)
	self.imageNumber = Strtrim(Info[1],2)
END
;+
;get image data from memory
;+
PRO sesRightMenu::GetImage , image , dimX , dimY , content
	COMPILE_OPT IDL2
	sep = (self.oSystem).sep
	oSystem = self.oSystem
	self.SingleClass = (oSystem.menuBar).singleImage
	self.MultiClass = (oSystem.menuBar).multiImge
	imageDir = ''
	copyDir = ''
	name = ''
	dimX = ''
	dimY = ''
	imageType = ''
	type = ''
	seg = StrArr(2)
	filename = oSystem.tempDir+sep+'Data'+self.imageNumber+ $
		           sep+'text'+self.imageNumber+'.ini'
	content = StrArr(6)
	openr,lun,filename,/get_lun
	Readf,lun,imageDir,copyDir,name,dimX,dimY,imageType,type,content,seg
	self.strFile = [imageDir,copyDir,name,dimX,dimY,imageType , $
		            type,content,seg]
;	number = ['L','Q','U']
;	temp = Where(seg[1] EQ number,count)
;	IF count NE 0 THEN BEGIN
	minValue = ''
	maxValue = ''
	Readf,lun,minValue,maxValue
	self.MinMaxXY = [Float(minValue),Float(maxValue)]
	self.strFile = [imageDir,copyDir,name,dimX,dimY,imageType , $
	                type,content,seg,minValue,maxValue]
;	ENDIF
	Free_lun,lun
	image = BytArr(Fix(dimX),Fix(dimY))
	openr,lun,imageDir,/get_lun
	Readu, lun, image
	Free_Lun,lun

	self.imageDir = copyDir
	self.imageTitle = seg[1]


END
;+
;clean object
;+
PRO sesRightMenu::CleanObject
	COMPILE_OPT IDL2
	oSystem = self.oSystem
	IF Obj_Valid(self.MultiClass) THEN BEGIN
		oSystem.oScene->Remove, (self.MultiClass).oView
		Obj_Destroy,(self.MultiClass).oView
	ENDIF
	IF Obj_Valid(self.ChangeImage) THEN BEGIN
		oSystem.oScene->Remove, (self.ChangeImage).oView
		Obj_Destroy,(self.ChangeImage).oView
	ENDIF
	Obj_Destroy,self.MultiClass
	Obj_Destroy,self.ChangeImage
END
;+
;handle event
;+
PRO sesRightMenu::HandleEvent , event , UName
	COMPILE_OPT IDL2
	oSystem = self.oSystem
	CASE UName OF
		'rightSingle':BEGIN
			menuBar = (oSystem.menuBar)
        	menuBar.CurrentName = ''
			oSystem.oWindow->Draw, oSystem.oScene
			self->GetImage , image , dimX , dimY , content
			self->CleanObject
			number = ['L','Q','U']
			temp = Where(self.imageTitle EQ number,count)
			IF count NE 0 THEN BEGIN
				class = oSystem.menuBar
				class->MenuManage , 'openhigh'
				oSystem.toolBar->MenuManage , 'openhigh'
				class.type = 'High'
				class.MinMaxXY	= self.MinMaxXY
				menuButton = class.menuButton
				Widget_Control,menuButton[1,3],Sensitive = 0
				drawObjs = (oSystem.toolBar).objContainer->Get(/All, Count = dCount)
				drawObjs[9]->Sensitive , 0
			ENDIF ELSE BEGIN
				class = oSystem.menuBar
				oSystem.menuBar->MenuManage , 'openlow'
				oSystem.toolBar->MenuManage , 'openlow'
				menuButton = class.menuButton
				Widget_Control,menuButton[1,3],Sensitive = 0
				drawObjs = (oSystem.toolBar).objContainer->Get(/All, Count = dCount)
				drawObjs[9]->Sensitive , 0
			ENDELSE

			;close label base
			Widget_Control,(osystem.lable).lablebase,map=0

			self.ChangeImage = Obj_New('sesChangeImage'         , $
										oSystem = self.oSystem	, $
										image = image           , $
										dimX = dimX             , $
										dimY = dimY             , $
										content = content         $
			                          )
			Obj_Destroy,oSystem.CurrentPro
			oSystem.CurrentPro = self.ChangeImage
			class = (oSystem.menuBar)
			Obj_Destroy , class.Title
			class->AddTitle
		END
		'rightMulti':BEGIN
			menuBar = (oSystem.menuBar)
        	menuBar.CurrentName = ''
			self->WriteData
			oSystem.oWindow->Draw, oSystem.oScene
			self->CleanObject
			oSystem.menuBar->MenuManage , 'openmulti'
			oSystem.toolBar->MenuManage , 'openmulti'
			Numbers = (oSystem.menuBar).numbers
			Obj_Destroy,self.multiImge

			;close label base
			Widget_Control,(osystem.lable).lablebase,map=0

			self.multiImge = Obj_New('sesMultiImage'                           , $
									  Numbers = Numbers                        , $
									  tempDir = (self.oSystem).tempDir         , $
	                                  oSystem = self.oSystem	                 $
	                                )
	        Obj_Destroy,oSystem.CurrentPro
			oSystem.CurrentPro = self.multiImge
			oStatus = oSystem.oStatus
			Widget_Control, oStatus.statusID[1], Set_Value = ''
			Widget_Control, oStatus.statusID[3], Set_Value = ''
		END
	ELSE:
	ENDCASE
END
;+
;create menu
;+
PRO sesRightMenu::Create
	COMPILE_OPT IDL2

	self.Base = Widget_Base(self.wDraw            , $
	                   /Context_Menu              , $
    				   UName='RightMenu'            )

	Widget_Control , self.Base , /Realize

    self.rightSingle = Widget_Button(self.Base              , $
                                Value ='show single image'  , $
    	                        UName='rightSingle'         , $
    	                        /Separator                  , $
    	                        Sensitive=0                   )
    self.rightMulti = Widget_Button(self.Base             , $
                                Value ='show multi image' , $
    	                        UName='rightMulti'        , $
    	                        /Separator                , $
    	                        Sensitive=0                 )

END
;+
;clean up
;+
PRO sesRightMenu::CleanUp
	COMPILE_OPT IDL2
	Obj_Destroy, self.ChangeImage
	Obj_Destroy, self.multiImge
END
;+
;initialize
;+
FUNCTION sesRightMenu::Init, oSystem = oSystem
	COMPILE_OPT IDL2
	self.oSystem = oSystem
	self.wDraw = (oSystem.mainDraw).drawID
	self->Create

	Return,1
END
;+
;draw class name
;+
PRO sesRightMenu__Define
	COMPILE_OPT IDL2
	void = { sesRightMenu                            , $
			 ;system parameter
			 wDraw             :    0L               , $
			 Base              :    0L               , $
			 rightSingle       :    0L               , $
			 rightMulti        :    0L               , $
			 imageNumber       :    ''               , $
			 imageDir          :    ''               , $
			 imageTitle        :    ''               , $
			 MinMaxXY          :    [0.0,0.0]        , $
			 strFile           :    StrArr(20)       , $
			 ;system objct
			 ChangeImage       :    Obj_New()        , $
			 multiImge         :    Obj_New()        , $
			 oView             :    Obj_New()        , $
			 oModel            :    Obj_New()        , $
			 imageModel        :    Obj_New()        , $
			 oPalette          :    Obj_New()        , $
			 oImage            :    Obj_New()        , $
			 SingleClass       :    Obj_New()        , $
			 MultiClass        :    Obj_New()        , $
	         oSystem           :    Obj_New()          $

			}


END