;+
;create image object
;+
PRO sesSingleImage::Create, image , imageHead
	COMPILE_OPT IDL2
	oSystem = self.oSystem
	self.oView = Obj_New('IDLgrView'		    , $
						  Color = [128,128,128]	, $
						  Eye = 21				, $
						  ZClip = [20,-1]		)

	oSystem.oScene->Add , self.oView

	self.oModel = Obj_New('IDLgrModel')

	self.oView->Add, self.oModel

	self.imageModel = Obj_New('IDLgrModel')

	self.oModel->Add, self.imageModel

	red = Indgen(256)
	green = Indgen(256)
	blue = Indgen(256)

	self.oPalette = Obj_New('IDLgrPalette', red, green, blue)

	self.oImage = Obj_New('IDLgrImage'         			    , $
			               Data = image	                    , $
			               Blend_Function = [3,4]		    , $
			               Interleave = 0                   , $
			               Location = [0,0,0]	               )

	self.imageModel->Add, self.oImage

	drawSize = [(oSystem.mainDraw).drawSize,self.imageX, self.imageY]

	Type = 'initSize'
	oSystem.zoomState = Type

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

	IF KeyWord_Set(viewDim) THEN self.oView->SetProperty, Dimensions = viewDim
	IF KeyWord_Set(viewLoc) THEN self.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]

	self.zoom = zoom
	self.oModel->Reset
	self.oModel->Scale, zoom, zoom, 1

	self.oView->SetProperty, ViewPlane_Rect = viewPlane
	imageType = Size(image,/N_Dimensions)
	IF imageType EQ 2 THEN BEGIN
		self.oImage->Setproperty, Palette = self.oPalette
	ENDIF

	oSystem.oWindow -> Draw, oSystem.oScene

END
;+
;clean up
;+
PRO sesSingleImage::CleanUp
	COMPILE_OPT IDL2
	Ptr_Free,self.head
	Ptr_Free,self.data
	Obj_Destroy , self.oView
	Obj_Destroy , self.oModel
	Obj_Destroy , self.imageModel
	Obj_Destroy , self.oPalette
	Obj_Destroy , self.oImage
END
;+
;initialize
;+
FUNCTION sesSingleImage::Init  , oSystem = oSystem       , $
                                 image = image           , $
                                 type = type             , $
                                 data = data             , $
                                 head  = head
	COMPILE_OPT IDL2
	self.oSystem = oSystem
	ImageSize = Size(image , /Dimensions)
	self.imageX = ImageSize[0]
	self.imageY = ImageSize[1]
	Ptr_Free,self.head
	self.head = Ptr_New(head)
	Ptr_Free,self.data
	self.data = Ptr_New(data)
	content = ['CONTENT','WAVELENG','HSOS_NO','T_START','T_END','TIME_POS']
	FOR i = 0 , 5 DO BEGIN
		 name = sxpar(head, content[i] )
		 self.titleContent[i] = name
	ENDFOR
	self->Create , Bytscl(image) , imageHead

	Return,1
END
;+
;SingImage class name
;+
PRO sesSingleImage__Define
	COMPILE_OPT IDL2
	void = { sesSingleImage                         , $
			 ;system parameter
			 imageX             :    0            , $
			 imageY             :    0            , $
			 titleContent       :    StrArr(6)    , $
			 zoom               :    1.           , $
			 ;system objct
			 oImage             :    Obj_New()    , $
			 oPalette           :    Obj_New()    , $
			 imageModel         :    Obj_New()    , $
			 oModel             :    Obj_New()    , $
	         oView              :    Obj_New()    , $
	         head               :    Ptr_New()    , $
	         data               :    Ptr_New()    , $
	         oSystem            :    Obj_New()      $

	        }

END