pro spd_ui_draw_object::setCursor,location
compile_opt idl2,hidden
self.cursorloc = location
self->updateVBar,location,self.panelInfo
self->updateHBar,location,self.panelInfo
if self.rubberOn then begin
if ~self->rubberBand(self.rubberStart,self.cursorLoc - self.rubberStart) then begin
self.statusBar->update,'Problem drawing rubber band'
endif
endif
if self.legendOn eq 1 && ptr_valid(self.panelInfo) then begin
for i = 0,n_elements(*self.panelInfo)-1 do begin
panel = ((*self.panelInfo)[i])
if self->inBounds(panel) then begin
xposnorm = (location[0] - panel.xplotpos[0])/(panel.xplotpos[1]-panel.xplotpos[0])
yposnorm = (location[1] - panel.yplotpos[0])/(panel.yplotpos[1]-panel.yplotpos[0])
if obj_valid(panel.legendModel) then begin
panel.legendModel->setProperty,hide=0
endif
if obj_valid(panel.legendAnnoModel) then begin
panel.legendAnnoModel->setProperty,hide=0
endif
self->setVarHide,panel,0
self->updatelegend,[xposnorm,yposnorm],panel
endif else begin
if obj_valid(panel.legendModel) then begin
panel.legendModel->setProperty,hide=1
endif
if obj_valid(panel.legendAnnoModel) then begin
panel.legendAnnoModel->setProperty,hide=1
endif
self->setVarHide,panel,1
endelse
endfor
endif else if self.legendOn eq 2 && ptr_valid(self.panelInfo) then begin
drawlegend = 0
for i = 0,n_elements(*self.panelInfo)-1 do begin
panel = ((*self.panelInfo)[i])
if self->inBounds(panel) then begin
drawlegend = 1
inBoundsIndex = i
xposnorm = (location[0] - panel.xplotpos[0])/(panel.xplotpos[1]-panel.xplotpos[0])
yposnorm = (location[1] - panel.yplotpos[0])/(panel.yplotpos[1]-panel.yplotpos[0])
endif
endfor
if drawlegend then begin
for i = 0,n_elements(*self.panelInfo)-1 do begin
panel = ((*self.panelInfo)[i])
if obj_valid(panel.legendModel) then begin
panel.legendModel->setProperty,hide=0
endif
if obj_valid(panel.legendAnnoModel) then begin
panel.legendAnnoModel->setProperty,hide=0
endif
self->setVarHide,panel,0
if i eq inBoundsIndex then begin
self->updatelegend,[xposnorm,yposnorm],panel
endif else begin
self->updatelegend,[xposnorm,yposnorm],panel,/noyvalue
endelse
endfor
endif else begin
for i = 0,n_elements(*self.panelInfo)-1 do begin
panel = ((*self.panelInfo)[i])
if obj_valid(panel.legendModel) then begin
panel.legendModel->setProperty,hide=1
endif
if obj_valid(panel.legendAnnoModel) then begin
panel.legendAnnoModel->setProperty,hide=1
endif
self->setVarHide,panel,1
self->updateLegend,[0,0],panel,/blank
endfor
endelse
endif else if ptr_valid(self.panelInfo) then begin
for i = 0,n_elements(*self.panelInfo)-1 do begin
panel = ((*self.panelInfo)[i])
if obj_valid(panel.legendModel) then begin
panel.legendModel->setProperty,hide=1
endif
if obj_valid(panel.legendAnnoModel) then begin
panel.legendAnnoModel->setProperty,hide=1
endif
self->setVarHide,panel,1
endfor
endif
if self.markerOn eq 1 && $
ptr_valid(self.panelInfo) && $
ptr_valid(self.currentMarkers) then begin
panels = *self.panelInfo
for i=0,n_elements(panels)-1 do begin
if self->inBounds(panels[i]) && $
self->inBounds(panels[i],location=self.markerStart) then begin
xstart = (self.markerStart[0] - panels[i].xplotpos[0])/(panels[i].xplotpos[1]-panels[i].xplotpos[0])
xstop = (self.cursorloc[0] - panels[i].xplotpos[0])/(panels[i].xplotpos[1]-panels[i].xplotpos[0])
self->drawMarker,[xstart,xstop],panels[i],(*self.currentMarkers)[0]
endif
endfor
endif else if self.markerOn eq 2 && $
ptr_valid(self.panelInfo) && $
ptr_valid(self.currentMarkers) then begin
panels = *self.panelInfo
inBounds = 0
for i = 0,n_elements(panels)-1 do begin
if self->inBounds(panels[i]) && $
self->inBounds(panels[i],location=self.markerstart) then begin
inBounds = 1
xstart = (self.markerStart[0] - panels[i].xplotpos[0])/(panels[i].xplotpos[1]-panels[i].xplotpos[0])
xstop = (self.cursorloc[0] - panels[i].xplotpos[0])/(panels[i].xplotpos[1]-panels[i].xplotpos[0])
endif
endfor
if inBounds then begin
markers = *self.currentMarkers
for i = 0,n_elements(panels)-1 do begin
self->drawMarker,[xstart,xstop],panels[i],markers[i]
endfor
endif
endif
if ptr_valid(self.panelInfo) then begin
panels = *self.panelInfo
for i = 0,n_elements(panels) -1 do begin
if ptr_valid(panels[i].markerInfo) then begin
xloc = (location[0] - panels[i].xplotpos[0])/(panels[i].xplotpos[1]-panels[i].xplotpos[0])
marked = 0
for j = n_elements(*panels[i].markerInfo)-1,0,-1 do begin
marker = (*panels[i].markerInfo)[j]
if marker.displayed then begin
if (xloc ge marker.pos[0] && xloc le marker.pos[1] && ~marked && self->inBounds(panels[i])) && marker.selected then begin
marked = 1
marker.frames[0]->setProperty,color=self->convertColor(self->hueRotation(marker.color))
marker.frames[1]->setProperty,color=self->convertColor(self->hueRotation(marker.color))
panels[i].markerIdx = j
endif else if xloc ge marker.pos[0] && xloc le marker.pos[1] && ~marked && self->inBounds(panels[i]) then begin
marked = 1
marker.frames[0]->setProperty,color=self->convertColor(self->hueRotation(marker.color))
marker.frames[1]->setProperty,color=self->convertColor(self->hueRotation(marker.color))
panels[i].markerIdx = j
endif else if marker.selected then begin
marker.frames[0]->setProperty,color=self->convertColor(self->huerotation(self->hueRotation(marker.color)))
marker.frames[1]->setProperty,color=self->convertColor(self->huerotation(self->hueRotation(marker.color)))
endif else begin
marker.frames[0]->setProperty,color=self->convertColor(marker.color)
marker.frames[1]->setProperty,color=self->convertColor(marker.color)
endelse
endif
endfor
if ~marked then begin
panels[i].markerIdx = -1
endif
endif
endfor
ptr_free,self.panelInfo
self.panelInfo = ptr_new(panels)
endif
self->draw
end