Skip to content
Snippets Groups Projects
Commit 73242bf1 authored by Yves Gouriou's avatar Yves Gouriou
Browse files

MousMotion callback

Activate the PAN function when QC mode is active
A PAN zone is defined in the bottom (5%) of PlotAxes(1)
parent 1b35415a
No related branches found
No related tags found
No related merge requests found
......@@ -675,6 +675,13 @@ end
% turns interactive zooming off
% -----------------------------
zoom off;
% Set the right limit and interval to the 3 axes
% ----------------------------------------------
for iaxe = 1:3
set(hPlotAxes(iaxe),'XTickMode','auto')
datetick(hPlotAxes(iaxe),'x','keeplimits')
end
% Turns off the automatic adaptation of date ticks
% ------------------------------------------------
......@@ -727,6 +734,13 @@ end
% -------------------------
pan off;
% Set the right limit and interval to the 3 axes
% ----------------------------------------------
for iaxe = 1:3
set(hPlotAxes(iaxe),'XTickMode','auto')
datetick(hPlotAxes(iaxe),'x','keeplimits')
end
% Turns off the automatic adaptation of date ticks
% ------------------------------------------------
panAdaptiveDateTicks('off');
......@@ -750,10 +764,10 @@ end
% Disallows a pan operation on the MAP axes objects
% --------------------------------------------------
setAllowAxesPan(hPan, hPlotAxes(4), false);
% turns on interactive pan (same effect than pan on) but prevent
% side effect on another figure
% -------------------------------------------------------------------
% --------------------------------------------------------------
set(hPan,'enable', 'on');
% Turns on the automatic adaptation of date ticks
......@@ -973,58 +987,98 @@ end
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Get the mouse position
% ----------------------
point = get(gcf,'CurrentPoint');
if point(1) > .05 && point(2) > .6 && point(1) < .95 && point(2) < .92
% Get current position of cusor and return its coordinates in
% axes with handle h_axes
% -----------------------------------------------------------
[x, y] = gpos(hPlotAxes(1));
% Dynamically display data in uicontrol
% -------------------------------------
if x > tsg.DAYD(1) && x < tsg.DAYD(end)
indCursor = find( tsg.DAYD > x);
set( hInfoDateText, 'String',...
datestr(tsg.DAYD(indCursor(1)),'dd/mm/yyyy HH:MM'));
set( hInfoLatText, 'String', dd2dm(tsg.LATX(indCursor(1)),0));
set( hInfoLongText, 'String', dd2dm(tsg.LONX(indCursor(1)),1));
set( hInfoSSPSText, 'String', tsg.SSPS(indCursor(1)));
set( hInfoSSJTText, 'String', tsg.SSJT(indCursor(1)));
if ~isempty(tsg.SSTP)
set( hInfoSSTPText, 'String', tsg.SSTP(indCursor(1)));
% Get current position of cusor and return its coordinates in
% axes with handle h_axes
% -----------------------------------------------------------
[x, y] = gpos(hPlotAxes(1));
% Code to Activate the PAN function when QC mode is active
% A PAN zone is defined in the bottom (5%) of PlotAxes(1)
% 2 callback are needed :
% 1 - one to desactivate QC when Pan is set to on.
% 2 - one to reactivate QC once the pan has been used.
% ---------------------------------------------------------
qcState = get(hQCToggletool, 'state' );
if strcmp(qcState, 'on' );
limx = get(hPlotAxes(1), 'XLim');
limy = get(hPlotAxes(1), 'YLim');
% Suppose that Y axes is increasing from the bottom to the top
% ------------------------------------------------------------
limy2 = limy(1) + (limy(2)-limy(1)) * 0.05;
if x > limx(1) && x < limx(2) && y <= limy2
hPan = pan(hMainFig);
set(hPan,'ActionPreCallback', @prePanCallback);
set(hPan,'ActionPostCallback', @postPanCallback);
set(hPan,'Enable','on');
else
pan off
end
end
% Dynamically display data in uicontrol
% -------------------------------------
if x > tsg.DAYD(1) && x < tsg.DAYD(end)
indCursor = find( tsg.DAYD > x);
set( hInfoDateText, 'String',...
datestr(tsg.DAYD(indCursor(1)),'dd/mm/yyyy HH:MM'));
set( hInfoLatText, 'String', dd2dm(tsg.LATX(indCursor(1)),0));
set( hInfoLongText, 'String', dd2dm(tsg.LONX(indCursor(1)),1));
set( hInfoSSPSText, 'String', tsg.SSPS(indCursor(1)));
set( hInfoSSJTText, 'String', tsg.SSJT(indCursor(1)));
if ~isempty(tsg.SSTP)
set( hInfoSSTPText, 'String', tsg.SSTP(indCursor(1)));
end
% Plot the position on the map if this one is active
% --------------------------------------------------
if strcmp( get(hMapPanel, 'Visible'), 'on')
% Select the map axes
% -------------------
axes( hPlotAxes(4));
if isempty( get(hMapPanel, 'UserData'))
hMarker = m_line( ...
tsg.LONX(indCursor(1)), tsg.LATX(indCursor(1)),...
'Marker','o','MarkerSize',5, ...
'Color','r', 'MarkerFaceColor','r');
set(hMapPanel, 'UserData', hMarker)
else
delete(get(hMapPanel, 'UserData'));
hMarker = m_line( ...
tsg.LONX(indCursor(1)), tsg.LATX(indCursor(1)),...
'Marker','o','MarkerSize',5, ...
'Color','r', 'MarkerFaceColor','r');
set(hMapPanel, 'UserData', hMarker);
end
% Plot the position on the map if this one is active
% --------------------------------------------------
if strcmp( get(hMapPanel, 'Visible'), 'on')
% Select the map axes
% -------------------
axes( hPlotAxes(4));
if isempty( get(hMapPanel, 'UserData'))
hMarker = m_line( ...
tsg.LONX(indCursor(1)), tsg.LATX(indCursor(1)),...
'Marker','o','MarkerSize',5, ...
'Color','r', 'MarkerFaceColor','r');
set(hMapPanel, 'UserData', hMarker)
else
delete(get(hMapPanel, 'UserData'));
hMarker = m_line( ...
tsg.LONX(indCursor(1)), tsg.LATX(indCursor(1)),...
'Marker','o','MarkerSize',5, ...
'Color','r', 'MarkerFaceColor','r');
set(hMapPanel, 'UserData', hMarker);
end
end
end
end
end
end
%% prePanCallback
function prePanCallback(obj, evd)
set(hQCToggletool, 'state', 'off' );
end
%% postPanCallback
function postPanCallback(obj, evd)
set(hQCToggletool, 'state', 'on' );
% Set the right limit and interval to the 3 axes
% ----------------------------------------------
for iaxe = 1:3
set(hPlotAxes(iaxe),'XTickMode','auto')
datetick(hPlotAxes(iaxe),'x','keeplimits')
end
end
%% Map_OffMenuCallback
%---------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment