| 1 |
!----------------------------------------------------------------- |
| 2 |
! |
| 3 |
! This file is (or was) part of SPLASH, a visualisation tool |
| 4 |
! for Smoothed Particle Hydrodynamics written by Daniel Price: |
| 5 |
! |
| 6 |
! http://users.monash.edu.au/~dprice/splash |
| 7 |
! |
| 8 |
! SPLASH comes with ABSOLUTELY NO WARRANTY. |
| 9 |
! This is free software; and you are welcome to redistribute |
| 10 |
! it under the terms of the GNU General Public License |
| 11 |
! (see LICENSE file for details) and the provision that |
| 12 |
! this notice remains intact. If you modify this file, please |
| 13 |
! note section 2a) of the GPLv2 states that: |
| 14 |
! |
| 15 |
! a) You must cause the modified files to carry prominent notices |
| 16 |
! stating that you changed the files and the date of any change. |
| 17 |
! |
| 18 |
! Copyright (C) 2005-2025 Daniel Price. All rights reserved. |
| 19 |
! Contact: [email protected] |
| 20 |
! |
| 21 |
!----------------------------------------------------------------- |
| 22 |
|
| 23 |
module interactive_routines |
| 24 |
use colourbar, only:barisvertical,incolourbar,incolourbarlabel,adjustcolourbar |
| 25 |
implicit none |
| 26 |
public :: interactive_part,interactive_step,interactive_multi |
| 27 |
public :: set_movie_mode,save_limits |
| 28 |
private :: mvlegend,mvtitle,save_rotation |
| 29 |
private :: get_vptxy |
| 30 |
real, private :: xcursor = 0.5 |
| 31 |
real, private :: ycursor = 0.5 |
| 32 |
|
| 33 |
private |
| 34 |
|
| 35 |
contains |
| 36 |
! |
| 37 |
!--interactive tools on particle plots |
| 38 |
! allows user to change settings interactively |
| 39 |
! |
| 40 |
! Arguments: |
| 41 |
! |
| 42 |
! INPUT: |
| 43 |
! npart : number of particles plotted |
| 44 |
! iplotx : quantity plotted as x axis |
| 45 |
! iploty : quantity plotted as y axis |
| 46 |
! iplotz : quantity to use in selecting particles |
| 47 |
! irender : quantity rendered |
| 48 |
! xcoords(npart) : x coordinates of particles |
| 49 |
! ycoords(npart) : y coordinates of particles |
| 50 |
! zcoords(npart) : z coordinates (or third quantity) of particles |
| 51 |
! hi(npart) : smoothing lengths of particles |
| 52 |
! zmin, zmax : range of z within which to plot particles |
| 53 |
! istep : current step position |
| 54 |
! ilaststep : position of last timestep |
| 55 |
! |
| 56 |
! CHANGEABLE: |
| 57 |
! icolourpart(npart) : flag indicating colour of particles |
| 58 |
! xmin, xmax, ymin, ymax : current plot limits |
| 59 |
! rendermin, rendermax : current rendering limits |
| 60 |
! vecmax : maximum vector limits |
| 61 |
! |
| 62 |
! OUTPUT: |
| 63 |
! iadvance : integer telling the loop how to advance the timestep |
| 64 |
! irerender : if set, redo rendering. Anything which requires rendering |
| 65 |
! to be recalculated must set this |
| 66 |
! |
| 67 |
subroutine interactive_part(npart,iplotx,iploty,iplotz,irender,icontour,ivecx,ivecy, & |
| 68 |
xcoords,ycoords,zcoords,hi,icolourpart,iamtype,usetype,npartoftype,xmin,xmax,ymin,ymax, & |
| 69 |
rendermin,rendermax,renderminadapt,rendermaxadapt,contmin,contmax,& |
| 70 |
contminadapt,contmaxadapt,vecmax, & |
| 71 |
anglex,angley,anglez,ndim,xorigin,x_sec,zslicepos,dzslice, & |
| 72 |
zobserver,dscreen,use3Dopacity,rkappa,double_rendering,irerender,itrackpart,icolourscheme, & |
| 73 |
iColourBarStyle,labelrender,iadvance,istep,ilaststep,iframe,nframes,interactivereplot) |
| 74 |
use settings_xsecrot, only:setsequenceend |
| 75 |
use shapes, only:inshape,edit_shape,edit_textbox,delete_shape,nshapes,add_shape_interactive |
| 76 |
use multiplot, only:itrans |
| 77 |
use labels, only:is_coord,ix,get_sink_type |
| 78 |
use limits, only:assert_sensible_limits |
| 79 |
use settings_render, only:projlabelformat,iapplyprojformat |
| 80 |
use settings_data, only:ndataplots,ntypes,icoords,icoordsnew |
| 81 |
use plotlib, only:plot_qwin,plot_curs,plot_sfs,plot_circ,plot_line,plot_pt1, & |
| 82 |
plot_rect,plot_band,plot_sfs,plot_qcur,plot_left_click,plot_right_click,& |
| 83 |
plot_scroll_left,plot_scroll_right,plotlib_is_pgplot,& |
| 84 |
plot_shift_click,plot_lcur,plot_poly |
| 85 |
use params, only:int1,maxparttypes |
| 86 |
use part_utils, only:igettype |
| 87 |
use particleplots, only:plot_kernel_gr |
| 88 |
use legends, only:in_legend |
| 89 |
integer, intent(in) :: npart,icontour,ndim,iplotz,ivecx,ivecy,istep,ilaststep,iframe,nframes |
| 90 |
integer, intent(inout) :: irender,iColourBarStyle |
| 91 |
integer, intent(inout) :: iplotx,iploty,itrackpart,icolourscheme |
| 92 |
integer, intent(inout) :: iadvance |
| 93 |
integer, dimension(npart), intent(inout) :: icolourpart |
| 94 |
real, dimension(npart), intent(in) :: xcoords,ycoords,zcoords,hi |
| 95 |
integer(kind=int1), dimension(:), intent(in) :: iamtype |
| 96 |
logical, dimension(maxparttypes), intent(in) :: usetype |
| 97 |
integer, dimension(maxparttypes), intent(in) :: npartoftype |
| 98 |
real, intent(inout) :: xmin,xmax,ymin,ymax,rendermin,rendermax,vecmax,contmin,contmax,rkappa |
| 99 |
real, intent(inout) :: anglex,angley,anglez,zslicepos,dzslice,zobserver,dscreen |
| 100 |
real, intent(in) :: renderminadapt,rendermaxadapt,contminadapt,contmaxadapt |
| 101 |
real, intent(in), dimension(ndim) :: xorigin |
| 102 |
character(len=*), intent(inout) :: labelrender |
| 103 |
logical, intent(inout) :: x_sec |
| 104 |
logical, intent(out) :: irerender,interactivereplot |
| 105 |
logical, intent(in) :: use3Dopacity, double_rendering |
| 106 |
real, parameter :: pi=4.*atan(1.) |
| 107 |
integer, parameter :: maxpts = 64 |
| 108 |
integer :: i,iclosest,iclosestsink,ierr,ixsec,ishape,ilegend,itype,npts |
| 109 |
integer :: nmarked,ncircpart,itrackparttemp,iadvancenew,itypesink |
| 110 |
integer, dimension(1000) :: icircpart |
| 111 |
real :: xpt,ypt |
| 112 |
real :: xpt2,ypt2,xcen,ycen,xminwin,xmaxwin,yminwin,ymaxwin |
| 113 |
real :: xptmin,xptmax,yptmin,yptmax,zptmin,zptmax,rptmax2 |
| 114 |
real :: rmin,rminsink,rr,gradient,yint,dx,dy,dr,anglerad |
| 115 |
real :: xlength,ylength,renderlength,renderpt,zoomfac,scalefac |
| 116 |
real :: dxlength,dylength,xmaxin,ymaxin,contlength |
| 117 |
real, dimension(4) :: xline,yline |
| 118 |
real, dimension(maxpts) :: xpts,ypts |
| 119 |
character(len=1) :: char,char2 |
| 120 |
logical :: iexit, rotation, verticalbar, iamincolourbar, mixedtypes, use3Dperspective |
| 121 |
logical :: iadvanceset, leftclick, iselectpoly, iselectcircle |
| 122 |
logical, save :: print_help = .true. |
| 123 |
logical, save :: in_movie_mode = .false. |
| 124 |
|
| 125 |
if (plot_qcur()) then |
| 126 |
if (.not.print_help) print*,'entering interactive mode...press h in plot window for help' |
| 127 |
!print*, plot_left_click |
| 128 |
else |
| 129 |
!print*,'cannot enter interactive mode: device has no cursor' |
| 130 |
return |
| 131 |
endif |
| 132 |
|
| 133 |
mixedtypes = size(iamtype) >= npart |
| 134 |
use3Dperspective = abs(dscreen) > tiny(0.) |
| 135 |
iadvanceset = .false. |
| 136 |
|
| 137 |
char = 'A' |
| 138 |
xline = 0. |
| 139 |
yline = 0. |
| 140 |
! |
| 141 |
!--convert saved cursor position (saved in viewport coords) |
| 142 |
! back to coordinates |
| 143 |
! |
| 144 |
call plot_qwin(xminwin,xmaxwin,yminwin,ymaxwin) |
| 145 |
call get_posxy(xcursor,ycursor,xpt,ypt,xminwin,xmaxwin,yminwin,ymaxwin) |
| 146 |
|
| 147 |
! xpt = 0. |
| 148 |
! ypt = 0. |
| 149 |
xpt2 = 0. |
| 150 |
ypt2 = 0. |
| 151 |
xmaxin = xmax |
| 152 |
ymaxin = ymax |
| 153 |
zoomfac = 1.0 |
| 154 |
scalefac = 1.1 |
| 155 |
ncircpart = 0 |
| 156 |
itrackparttemp = itrackpart |
| 157 |
iexit = .false. |
| 158 |
rotation = .false. |
| 159 |
irerender = .false. |
| 160 |
interactivereplot = .false. |
| 161 |
if (is_coord(iplotx,ndim) .and. is_coord(iploty,ndim) .and. ndim >= 2) rotation = .true. |
| 162 |
verticalbar = barisvertical(iColourBarStyle) |
| 163 |
|
| 164 |
if (iplotz > 0 .and. x_sec) then |
| 165 |
zptmin = zslicepos - 0.5*dzslice |
| 166 |
zptmax = zslicepos + 0.5*dzslice |
| 167 |
else |
| 168 |
!--if not using z range, make it encompass all the particles |
| 169 |
zptmin = -huge(zptmin) |
| 170 |
zptmax = huge(zptmax) |
| 171 |
endif |
| 172 |
|
| 173 |
interactiveloop: do while (.not.iexit) |
| 174 |
if (print_help) then |
| 175 |
char = 'h' |
| 176 |
ierr = 0 |
| 177 |
print_help = .false. |
| 178 |
else |
| 179 |
ierr = plot_curs(xpt,ypt,char) |
| 180 |
endif |
| 181 |
! |
| 182 |
!--exit if the device is not interactive |
| 183 |
! |
| 184 |
if (ierr==1) return |
| 185 |
!print*,'x,y = ',xpt,ypt,' function = ',char,iachar(char) |
| 186 |
|
| 187 |
! |
| 188 |
!--find closest particle |
| 189 |
! |
| 190 |
rmin = huge(rmin) |
| 191 |
rminsink = huge(rmin) |
| 192 |
iclosest = 0 |
| 193 |
iclosestsink = 0 |
| 194 |
itypesink = get_sink_type(ntypes) |
| 195 |
xlength = xmax - xmin |
| 196 |
ylength = ymax - ymin |
| 197 |
if (xlength > tiny(xlength)) then |
| 198 |
dxlength = 1./xlength |
| 199 |
else |
| 200 |
dxlength = 0. |
| 201 |
endif |
| 202 |
if (ylength > tiny(ylength)) then |
| 203 |
dylength = 1./ylength |
| 204 |
else |
| 205 |
dylength = 0. |
| 206 |
endif |
| 207 |
itype = 1 |
| 208 |
over_npart: do i=1,npart |
| 209 |
if (ntypes > 1) then |
| 210 |
if (mixedtypes) then |
| 211 |
itype = int(iamtype(i)) |
| 212 |
else |
| 213 |
itype = igettype(i,npartoftype) |
| 214 |
endif |
| 215 |
if (.not.usetype(itype)) cycle over_npart |
| 216 |
endif |
| 217 |
!--use distance normalised on screen |
| 218 |
rr = ((xcoords(i)-xpt)*dxlength)**2 + ((ycoords(i)-ypt)*dylength)**2 |
| 219 |
if (rr < rmin) then |
| 220 |
iclosest = i |
| 221 |
rmin = rr |
| 222 |
endif |
| 223 |
if (itype==itypesink .and. rr < rminsink) then |
| 224 |
iclosestsink = i |
| 225 |
rminsink = rr |
| 226 |
endif |
| 227 |
enddo over_npart |
| 228 |
|
| 229 |
!--query the position of the colour bar |
| 230 |
iamincolourbar = incolourbar(iColourBarStyle,4,xpt,ypt,xmin,xmax,ymin,ymax) |
| 231 |
|
| 232 |
select case(char) |
| 233 |
! |
| 234 |
!--particle plot stuff |
| 235 |
! |
| 236 |
case('p') |
| 237 |
if (iclosest > 0 .and. iclosest <= npart) then |
| 238 |
print*,' closest particle = ',iclosest,'x = ',xcoords(iclosest),' y =',ycoords(iclosest) |
| 239 |
call plot_number(iclosest,xcoords(iclosest),ycoords(iclosest)) |
| 240 |
else |
| 241 |
print*,'error: could not determine closest particle' |
| 242 |
endif |
| 243 |
case('c') |
| 244 |
if (iclosest > 0 .and. iclosest <= npart) then |
| 245 |
print*,'plotting circle of interaction on particle ',iclosest, & |
| 246 |
' h = ',hi(iclosest) |
| 247 |
!--save settings for these |
| 248 |
ncircpart = ncircpart + 1 |
| 249 |
if (ncircpart > size(icircpart)) then |
| 250 |
print*,'WARNING: ncircles > array limits, cannot save' |
| 251 |
ncircpart = size(icircpart) |
| 252 |
else |
| 253 |
icircpart(ncircpart) = iclosest |
| 254 |
endif |
| 255 |
call plot_sfs(2) |
| 256 |
if (icoordsnew /= icoords) then |
| 257 |
call plot_kernel_gr(icoordsnew,icoords,iplotx,iploty,& |
| 258 |
xcoords(iclosest),ycoords(iclosest),zcoords(iclosest),2.*hi(iclosest)) |
| 259 |
else |
| 260 |
call plot_circ(xcoords(iclosest),ycoords(iclosest),2.*hi(iclosest)) |
| 261 |
endif |
| 262 |
else |
| 263 |
print*,'error: could not determine closest particle' |
| 264 |
endif |
| 265 |
case('t') |
| 266 |
!--track closest particle (must save to activate) |
| 267 |
if (itrackpart /= 0 .and. itrackparttemp==itrackpart) then |
| 268 |
itrackpart = 0 |
| 269 |
itrackparttemp = 0 |
| 270 |
print*,' particle tracking limits OFF' |
| 271 |
else |
| 272 |
if (iclosest > 0 .and. iclosest <= npart) then |
| 273 |
itrackparttemp = iclosest |
| 274 |
call plot_number(iclosest,xcoords(iclosest),ycoords(iclosest)) |
| 275 |
print*,' limits set to track particle ',itrackparttemp,' x, y = ', & |
| 276 |
xcoords(iclosest),ycoords(iclosest) |
| 277 |
print*,' save settings to activate ' |
| 278 |
else |
| 279 |
print*,'error: could not determine closest particle' |
| 280 |
endif |
| 281 |
endif |
| 282 |
case('g') ! draw a line between two points |
| 283 |
xline(2) = xpt |
| 284 |
yline(2) = ypt |
| 285 |
!--mark first point |
| 286 |
call plot_pt1(xpt,ypt,4) |
| 287 |
!--select second point |
| 288 |
print*,' select another point (using left click or g) to plot line ' |
| 289 |
ierr = plot_band(1,1,xline(2),yline(2),xline(3),yline(3),char2) |
| 290 |
!--draw line if left click or g |
| 291 |
select case(char2) |
| 292 |
case(plot_left_click,'g') |
| 293 |
print* |
| 294 |
!--mark second point |
| 295 |
call plot_pt1(xline(3),yline(3),4) |
| 296 |
xlength = xline(3)-xline(2) |
| 297 |
if (abs(xlength) < tiny(xlength)) then |
| 298 |
xline(1) = xline(2) |
| 299 |
xline(4) = xline(2) |
| 300 |
yline(1) = ymin |
| 301 |
yline(4) = ymax |
| 302 |
print*,' error: gradient = infinite' |
| 303 |
elseif (xline(2) < xline(3)) then |
| 304 |
xline(1) = xmin |
| 305 |
xline(4) = xmax |
| 306 |
else |
| 307 |
xline(1) = xmax |
| 308 |
xline(4) = xmin |
| 309 |
endif |
| 310 |
ylength = yline(3)-yline(2) |
| 311 |
dr = sqrt(xlength**2 + ylength**2) |
| 312 |
print*,' (x1,y1) = (',xline(2),',',yline(2),')' |
| 313 |
print*,' (x2,y2) = (',xline(3),',',yline(3),')' |
| 314 |
print*,' dr = ',dr,' dx = ',xlength,' dy = ',ylength |
| 315 |
if (abs(xlength) > tiny(xlength)) then |
| 316 |
gradient = ylength/xlength |
| 317 |
yint = yline(3) - gradient*xline(3) |
| 318 |
print*,' gradient = ',gradient,' y intercept = ',yint |
| 319 |
yline(1) = gradient*xline(1) + yint |
| 320 |
yline(4) = gradient*xline(4) + yint |
| 321 |
endif |
| 322 |
!--plot line joining the two points |
| 323 |
call plot_line(4,xline,yline) |
| 324 |
case default |
| 325 |
print*,' action cancelled' |
| 326 |
end select |
| 327 |
! |
| 328 |
!--help |
| 329 |
! |
| 330 |
case('h') |
| 331 |
print "(/,a)",' -------------- interactive mode commands -----------------------------' |
| 332 |
print*,' SPACE BAR : skip to next timestep/file' |
| 333 |
print*,' 0,1,2,3..9 and click : go forward/back n timesteps (back=r.click)' |
| 334 |
print*,' left click (or A) : zoom/select' |
| 335 |
print*,' right click (or X or b) : previous timestep' |
| 336 |
print*,' shift+left click : IRREGULAR particle selection' |
| 337 |
print*,' left click on colour bar : change rendering limits' |
| 338 |
print*,' +/- : zoom IN/OUT (_ for out by 20%) ' |
| 339 |
print*,' a : (a)dapt plot limits (inside box, over axes or colour bar)' |
| 340 |
print*,' l : (l)og / unlog axis (over x/y axis or colour bar)' |
| 341 |
print*,' o/C/n : re-centre plot on (o)rigin/(C)ursor/(n)earest sink position' |
| 342 |
print*,' backspace: delete annotation (over axes, legend, title or colour bar)' |
| 343 |
print*,' r : (r)eplot current plot' |
| 344 |
print*,' R : (R)eset/remove all range restrictions' |
| 345 |
print*,' p/c : label closest (p)article/plot (c)ircle of interaction' |
| 346 |
print*,' t : t)rack closest particle/turn tracking off (coord plots only)' |
| 347 |
print*,' g : plot a line and find its g)radient' |
| 348 |
print*,' ctrl-t, ^: add text or arrow(^) annotation at current position' |
| 349 |
print*,' ctrl-m : toggle Hollywood mode' |
| 350 |
print*,' G/T/H : move le(G)end, (T)itle or (H) vector legend to current position' |
| 351 |
print*,' m/M/i : change colour map (m=next,M=previous,i=invert) (rendered plots only)' |
| 352 |
if (irender > 0) print*,' f/F : f)lip to next/previous column in rendering (rendered plots only)' |
| 353 |
print*,' v/V/w : decrease/increase/adapt arrow size on vector plots (Z for x10)' |
| 354 |
if (ndim >= 3) then |
| 355 |
print*,' k/K : decrease/increase opacity on opacity-rendered plots (Z for x10)' |
| 356 |
endif |
| 357 |
print*,' e/E : use current frame/settings as end point to animation sequence' |
| 358 |
if (ndim > 1) then |
| 359 |
print*,' , . < > : rotate about z axis by +(-) 15,30 degrees (coord plots only)' |
| 360 |
if (ndim >= 3) then |
| 361 |
print*,' [ ] { } : rotate about x axis by +/- 15,30 degrees (coord plots only)' |
| 362 |
print*,' / \ ? | : rotate about y axis by +/- 15,30 degrees (coord plots only)' |
| 363 |
print*,' x : take cross section (coord plots only)' |
| 364 |
if (iplotz > 0) then |
| 365 |
print*,' u/U/d/D : move cross section/perspective pos. up/down (towards/away from observer)' |
| 366 |
endif |
| 367 |
endif |
| 368 |
endif |
| 369 |
print*,' s : (s)ave current settings for all steps' |
| 370 |
print*,' q/Q/esc : (q)uit plotting' |
| 371 |
print*,' z/Z(oom) : timestepping, zoom and limits-changing multiplied by 10' |
| 372 |
print*,'----------------------------------------------------------------------' |
| 373 |
case('s','S') |
| 374 |
itrackpart = itrackparttemp |
| 375 |
if (itrackpart<=0 .or. itrackpart > size(xcoords)) then |
| 376 |
call save_limits(iplotx,xmin,xmax) |
| 377 |
call save_limits(iploty,ymin,ymax) |
| 378 |
call save_itrackpart_recalcradius(itrackpart) ! set saved value to zero |
| 379 |
else |
| 380 |
print*,'tracking particle ',itrackpart,'x,y = ',xcoords(itrackpart),ycoords(itrackpart) |
| 381 |
if (is_coord(iplotx,ndim)) then |
| 382 |
call save_limits_track(iplotx,xmin,xmax,xcoords(itrackpart)) |
| 383 |
else |
| 384 |
call save_limits(iplotx,xmin,xmax) |
| 385 |
endif |
| 386 |
if (is_coord(iploty,ndim)) then |
| 387 |
call save_limits_track(iploty,ymin,ymax,ycoords(itrackpart)) |
| 388 |
else |
| 389 |
call save_limits(iploty,ymin,ymax) |
| 390 |
endif |
| 391 |
call save_itrackpart_recalcradius(itrackpart) |
| 392 |
endif |
| 393 |
if (irender > 0) call save_limits(irender,rendermin,rendermax) |
| 394 |
if (icontour > 0) then |
| 395 |
if (icontour==irender & |
| 396 |
.and. abs(rendermin-contmin) <= tiny(0.) & |
| 397 |
.and. abs(rendermax-contmax) <= tiny(0.)) then |
| 398 |
call reset_limits2(icontour) |
| 399 |
elseif (icontour==irender .and. .not.double_rendering) then |
| 400 |
call save_limits(icontour,contmin,contmax,setlim2=.true.) |
| 401 |
else |
| 402 |
call save_limits(icontour,contmin,contmax) |
| 403 |
endif |
| 404 |
endif |
| 405 |
if (ivecx > 0 .and. ivecy > 0) then |
| 406 |
call save_limits(ivecx,-vecmax,vecmax) |
| 407 |
call save_limits(ivecy,-vecmax,vecmax) |
| 408 |
endif |
| 409 |
if (ndim==3 .and. iplotz > 0 .and. irender > 0 .and. use3Dopacity) then |
| 410 |
call save_opacity(rkappa) |
| 411 |
endif |
| 412 |
if (ncircpart > 0) call save_circles(ncircpart,icircpart) |
| 413 |
if (rotation) call save_rotation(ndim,anglex,angley,anglez) |
| 414 |
if (iplotz > 0) then |
| 415 |
if (x_sec) then |
| 416 |
call save_xsecpos(zslicepos,x_sec) |
| 417 |
else |
| 418 |
call save_perspective(zobserver,dscreen) |
| 419 |
endif |
| 420 |
endif |
| 421 |
call save_windowsize() |
| 422 |
print*,'> interactively set limits saved <' |
| 423 |
! |
| 424 |
!--actions on left click |
| 425 |
! |
| 426 |
case(plot_left_click,plot_right_click,plot_shift_click) ! left click |
| 427 |
! |
| 428 |
!--change colour bar limits |
| 429 |
! |
| 430 |
leftclick = (char == plot_left_click) |
| 431 |
ishape = inshape(xpt,ypt,itrans(iplotx),itrans(iploty),xmin,xmax,ymin,ymax) |
| 432 |
if (ishape > 0) then |
| 433 |
call edit_shape(ishape,xpt,ypt,itrans(iplotx),itrans(iploty),first=.false.) |
| 434 |
iadvance = 0 |
| 435 |
interactivereplot = .true. |
| 436 |
iexit = .true. |
| 437 |
elseif (iamincolourbar .and. irender > 0 .and. leftclick) then |
| 438 |
if (incolourbarlabel(iColourBarStyle,4,xpt,ypt,xmin,xmax,ymin,ymax)) then |
| 439 |
if (verticalbar) then |
| 440 |
call edit_textbox(xpt,ypt,90.,0.,labelrender) |
| 441 |
projlabelformat = trim(labelrender) |
| 442 |
iapplyprojformat = irender |
| 443 |
else |
| 444 |
call edit_textbox(xpt,ypt,0.,0.,labelrender) |
| 445 |
projlabelformat = trim(labelrender) |
| 446 |
iapplyprojformat = irender |
| 447 |
endif |
| 448 |
iadvance = 0 |
| 449 |
interactivereplot = .true. |
| 450 |
iexit = .true. |
| 451 |
else |
| 452 |
print*,'click to set rendering limits' |
| 453 |
if (verticalbar) then |
| 454 |
ierr = plot_band(3,1,xpt,ypt,xpt2,ypt2,char2) |
| 455 |
else |
| 456 |
ierr = plot_band(4,1,xpt,ypt,xpt2,ypt2,char2) |
| 457 |
endif |
| 458 |
if (char2 == plot_left_click) then |
| 459 |
if (double_rendering) then |
| 460 |
call adjustcolourbar(iColourBarStyle,xpt,ypt,xpt2,ypt2,& |
| 461 |
xmin,xmax,ymin,ymax,contmin,contmax) |
| 462 |
!print*,'setting doublerender min = ',contmin |
| 463 |
!print*,'setting doublerender max = ',contmax |
| 464 |
else |
| 465 |
call adjustcolourbar(iColourBarStyle,xpt,ypt,xpt2,ypt2,& |
| 466 |
xmin,xmax,ymin,ymax,rendermin,rendermax) |
| 467 |
!print*,'setting render min = ',rendermin |
| 468 |
!print*,'setting render max = ',rendermax |
| 469 |
endif |
| 470 |
iadvance = 0 |
| 471 |
interactivereplot = .true. |
| 472 |
iexit = .true. |
| 473 |
endif |
| 474 |
endif |
| 475 |
! |
| 476 |
!--zoom or mark particles |
| 477 |
! |
| 478 |
else |
| 479 |
print*,'select area: ' |
| 480 |
!--Note: circle selection is not implemented in PGPLOT |
| 481 |
iselectpoly = (char==plot_shift_click .or.((.not.leftclick).and.plotlib_is_pgplot)) |
| 482 |
iselectcircle = (char==plot_right_click .and. .not.plotlib_is_pgplot) |
| 483 |
if (iselectpoly) then |
| 484 |
if (plotlib_is_pgplot) then |
| 485 |
print*,'left click/a)dd points; middle click/d)elete points; X/x)finish' |
| 486 |
else |
| 487 |
print*,'left click/a)dd points; middle click/d)elete points; q)uit/abort' |
| 488 |
if (irender <= 0) print*,'1-9 = close polygon and mark particles with colours 1-9' |
| 489 |
print*,'0 = close polygon and hide selected particles' |
| 490 |
print*,'p = close polygon and plot selected particles only' |
| 491 |
print*,'c = close polygon and plot circles of interaction on selected parts' |
| 492 |
endif |
| 493 |
else |
| 494 |
print*,'left click : zoom' |
| 495 |
if (irender <= 0) print*,'1-9 = mark selected particles with colours 1-9' |
| 496 |
print*,'0 = hide selected particles' |
| 497 |
print*,'p = plot selected particles only' |
| 498 |
print*,'c = plot circles of interaction on selected parts' |
| 499 |
endif |
| 500 |
if (leftclick .or. iselectcircle) then |
| 501 |
print*,'x = use particles within x parameter range only' |
| 502 |
print*,'y = use particles within y parameter range only' |
| 503 |
print*,'r = use particles within x and y parameter range only' |
| 504 |
print*,'R = remove all range restrictions' |
| 505 |
endif |
| 506 |
|
| 507 |
npts = 1 |
| 508 |
xpts(1) = xpt ! to avoid problems with uninitialised variables |
| 509 |
ypts(1) = ypt |
| 510 |
if (iselectpoly) then |
| 511 |
call plot_lcur(maxpts,npts,xpts,ypts,char2) |
| 512 |
if (plotlib_is_pgplot) then |
| 513 |
if (irender <= 0) print*,'1-9 = close polygon and mark particles with colours 1-9' |
| 514 |
print*,'0 = close polygon and hide selected particles' |
| 515 |
print*,'p = close polygon and plot selected particles only' |
| 516 |
print*,'c = close polygon and plot circles of interaction on selected parts' |
| 517 |
ierr = plot_band(0,1,xpt,ypt,xpt2,ypt2,char2) |
| 518 |
endif |
| 519 |
xptmin = minval(xpts(1:npts)) |
| 520 |
xptmax = maxval(xpts(1:npts)) |
| 521 |
yptmin = minval(ypts(1:npts)) |
| 522 |
yptmax = maxval(ypts(1:npts)) |
| 523 |
elseif (iselectcircle) then |
| 524 |
ierr = plot_band(8,1,xpt,ypt,xpt2,ypt2,char2) |
| 525 |
rptmax2 = (xpt2-xpt)**2 + (ypt2-ypt)**2 |
| 526 |
rr = sqrt(rptmax2) |
| 527 |
xptmin = xpt - rr |
| 528 |
xptmax = xpt + rr |
| 529 |
yptmin = ypt - rr |
| 530 |
yptmax = ypt + rr |
| 531 |
else ! left click: rectangle selection |
| 532 |
ierr = plot_band(2,1,xpt,ypt,xpt2,ypt2,char2) |
| 533 |
xptmin = min(xpt,xpt2) |
| 534 |
xptmax = max(xpt,xpt2) |
| 535 |
yptmin = min(ypt,ypt2) |
| 536 |
yptmax = max(ypt,ypt2) |
| 537 |
endif |
| 538 |
if (.not.(iselectcircle.or.iselectpoly) .or. char2==plot_left_click) then ! rectangle selection |
| 539 |
!print*,'xrange = ',xptmin,'->',xptmax |
| 540 |
!print*,'yrange = ',yptmin,'->',yptmax |
| 541 |
if (iplotz /= 0 .and. x_sec) then |
| 542 |
print*,'(zrange = ',zptmin,'->',zptmax,')' |
| 543 |
endif |
| 544 |
endif |
| 545 |
|
| 546 |
select case (char2) |
| 547 |
case(plot_left_click) ! zoom if another left click |
| 548 |
call plot_sfs(2) |
| 549 |
!--draw the selected shape in case zooming is slow |
| 550 |
if (iselectpoly) then |
| 551 |
call plot_poly(npts,xpts,ypts) |
| 552 |
elseif (iselectcircle) then |
| 553 |
call plot_circ(xpt,ypt,sqrt(rptmax2)) |
| 554 |
else |
| 555 |
call plot_rect(xpt,xpt2,ypt,ypt2) |
| 556 |
endif |
| 557 |
!--zoom is identical for rectangle, poly and circle selection |
| 558 |
xmin = xptmin |
| 559 |
xmax = xptmax |
| 560 |
ymin = yptmin |
| 561 |
ymax = yptmax |
| 562 |
iadvance = 0 |
| 563 |
interactivereplot = .true. |
| 564 |
irerender = .true. |
| 565 |
iexit = .true. |
| 566 |
case('0','1','2','3','4','5','6','7','8','9') ! mark particles |
| 567 |
nmarked = 0 |
| 568 |
if (irender <= 0 .or. char2=='0' .or. char2=='1') then |
| 569 |
do i=1,npart |
| 570 |
if (inslice(zcoords(i),zptmin,zptmax) .and. & |
| 571 |
(leftclick .and. inrectangle(xcoords(i),ycoords(i),xptmin,xptmax,yptmin,yptmax) & |
| 572 |
.or.(iselectcircle .and. incircle(xcoords(i)-xpt,ycoords(i)-ypt,rptmax2)) & |
| 573 |
.or.(iselectpoly .and. inpoly(xcoords(i),ycoords(i),xpts,ypts,npts)))) then |
| 574 |
read(char2,*,iostat=ierr) icolourpart(i) |
| 575 |
if (ierr /=0) then |
| 576 |
print*,'*** error marking particle' |
| 577 |
icolourpart(i) = 1 |
| 578 |
!--translate 0 to icolourpart = -1 for non-plotted particles |
| 579 |
elseif (icolourpart(i)==0) then |
| 580 |
icolourpart(i) = -1 |
| 581 |
endif |
| 582 |
nmarked = nmarked + 1 |
| 583 |
endif |
| 584 |
enddo |
| 585 |
print*,'marked ',nmarked,' particles in selected region' |
| 586 |
endif |
| 587 |
iadvance = 0 |
| 588 |
if (nmarked > 0) irerender = .true. |
| 589 |
interactivereplot = .true. |
| 590 |
iexit = .true. |
| 591 |
case('p') ! plot selected particles only |
| 592 |
nmarked = 0 |
| 593 |
do i=1,npart |
| 594 |
if (inslice(zcoords(i),zptmin,zptmax) .and. & |
| 595 |
(leftclick .and. inrectangle(xcoords(i),ycoords(i),xptmin,xptmax,yptmin,yptmax) & |
| 596 |
.or.(iselectcircle .and. incircle(xcoords(i)-xpt,ycoords(i)-ypt,rptmax2)) & |
| 597 |
.or.(iselectpoly .and. inpoly(xcoords(i),ycoords(i),xpts,ypts,npts)))) then |
| 598 |
nmarked = nmarked + 1 |
| 599 |
if (icolourpart(i) <= 0) icolourpart(i) = 1 |
| 600 |
else |
| 601 |
icolourpart(i) = -1 |
| 602 |
endif |
| 603 |
enddo |
| 604 |
print*,'plotting selected ',nmarked,' particles only' |
| 605 |
iadvance = 0 |
| 606 |
irerender = .true. |
| 607 |
interactivereplot = .true. |
| 608 |
iexit = .true. |
| 609 |
case('c') ! set circles of interaction in marked region |
| 610 |
ncircpart = 0 |
| 611 |
do i=1,npart |
| 612 |
if (inslice(zcoords(i),zptmin,zptmax) .and. & |
| 613 |
(leftclick .and. inrectangle(xcoords(i),ycoords(i),xptmin,xptmax,yptmin,yptmax) & |
| 614 |
.or.(iselectcircle .and. incircle(xcoords(i)-xpt,ycoords(i)-ypt,rptmax2)) & |
| 615 |
.or.(iselectpoly .and. inpoly(xcoords(i),ycoords(i),xpts,ypts,npts)))) then |
| 616 |
if (ncircpart < size(icircpart)) then |
| 617 |
ncircpart = ncircpart + 1 |
| 618 |
icircpart(ncircpart) = i |
| 619 |
call plot_sfs(2) |
| 620 |
call plot_circ(xcoords(i),ycoords(i),2.*hi(i)) |
| 621 |
endif |
| 622 |
endif |
| 623 |
enddo |
| 624 |
print*,'set ',ncircpart,' circles of interaction in selected region' |
| 625 |
if (ncircpart==size(icircpart)) print*,' (first ',size(icircpart),' only)' |
| 626 |
case('x') |
| 627 |
call restrict_range(iplotx,xptmin,xptmax) |
| 628 |
iadvance = 0 |
| 629 |
irerender = .true. |
| 630 |
interactivereplot = .true. |
| 631 |
iexit = .true. |
| 632 |
case('y') |
| 633 |
call restrict_range(iploty,yptmin,yptmax) |
| 634 |
iadvance = 0 |
| 635 |
irerender = .true. |
| 636 |
interactivereplot = .true. |
| 637 |
iexit = .true. |
| 638 |
case('r') |
| 639 |
call restrict_range(iplotx,xptmin,xptmax) |
| 640 |
call restrict_range(iploty,yptmin,yptmax) |
| 641 |
iadvance = 0 |
| 642 |
irerender = .true. |
| 643 |
interactivereplot = .true. |
| 644 |
iexit = .true. |
| 645 |
case('R') |
| 646 |
call reset_ranges |
| 647 |
iadvance = 0 |
| 648 |
irerender = .true. |
| 649 |
interactivereplot = .true. |
| 650 |
iexit = .true. |
| 651 |
case default |
| 652 |
print*,' action cancelled' |
| 653 |
end select |
| 654 |
endif |
| 655 |
! |
| 656 |
!--zooming |
| 657 |
! |
| 658 |
case('-','_','+','o','C','n','N') ! zoom in/out |
| 659 |
xlength = xmax - xmin |
| 660 |
ylength = ymax - ymin |
| 661 |
xcen = 0.5*(xmax + xmin) |
| 662 |
ycen = 0.5*(ymax + ymin) |
| 663 |
renderlength = rendermax - rendermin |
| 664 |
contlength = contmax - contmin |
| 665 |
select case(char) |
| 666 |
case('-') |
| 667 |
xlength = zoomfac*scalefac*xlength |
| 668 |
ylength = zoomfac*scalefac*ylength |
| 669 |
renderlength = zoomfac*scalefac*renderlength |
| 670 |
contlength = zoomfac*scalefac*contlength |
| 671 |
case('_') |
| 672 |
xlength = 1.2*zoomfac*scalefac*xlength |
| 673 |
ylength = 1.2*zoomfac*scalefac*ylength |
| 674 |
renderlength = 1.2*zoomfac*scalefac*renderlength |
| 675 |
contlength = 1.2*zoomfac*scalefac*contlength |
| 676 |
case('+') |
| 677 |
xlength = xlength/(zoomfac*scalefac) |
| 678 |
ylength = ylength/(zoomfac*scalefac) |
| 679 |
renderlength = renderlength/(zoomfac*scalefac) |
| 680 |
contlength = contlength/(zoomfac*scalefac) |
| 681 |
case('o') |
| 682 |
if (itrackpart > 0) then |
| 683 |
print*,'centreing limits on tracked particle ',itrackpart,'x,y = ',xcoords(itrackpart),ycoords(itrackpart) |
| 684 |
xcen = xcoords(itrackpart) |
| 685 |
ycen = ycoords(itrackpart) |
| 686 |
else |
| 687 |
if (is_coord(iplotx,ndim)) then |
| 688 |
xcen = xorigin(iplotx) |
| 689 |
else |
| 690 |
xcen = 0. |
| 691 |
endif |
| 692 |
if (is_coord(iploty,ndim)) then |
| 693 |
ycen = xorigin(iploty) |
| 694 |
else |
| 695 |
ycen = 0. |
| 696 |
endif |
| 697 |
print*,' centreing plot on origin x,y = ',xcen,ycen |
| 698 |
endif |
| 699 |
case('C') |
| 700 |
xcen = xpt |
| 701 |
ycen = ypt |
| 702 |
case('n','N') |
| 703 |
if (iclosestsink > 0) then |
| 704 |
xcen = xcoords(iclosestsink) |
| 705 |
ycen = ycoords(iclosestsink) |
| 706 |
print*,'centreing limits on sink particle ',iclosestsink,'x,y = ',xcen,ycen |
| 707 |
else |
| 708 |
print*,'error: could not find closest sink particle, using origin instead' |
| 709 |
xcen = 0. |
| 710 |
ycen = 0. |
| 711 |
endif |
| 712 |
end select |
| 713 |
if (iamincolourbar .and. irender > 0) then |
| 714 |
!--rendering zoom does not allow pan - renderpt is always centre of axis |
| 715 |
if (double_rendering) then |
| 716 |
renderpt = 0.5*(contmin + contmax) |
| 717 |
contmin = renderpt - 0.5*contlength |
| 718 |
contmax = renderpt + 0.5*contlength |
| 719 |
call assert_sensible_limits(contmin,contmax) |
| 720 |
!print*,'zooming on colour bar: min, max = ',contmin,contmax |
| 721 |
else |
| 722 |
renderpt = 0.5*(rendermin + rendermax) |
| 723 |
rendermin = renderpt - 0.5*renderlength |
| 724 |
rendermax = renderpt + 0.5*renderlength |
| 725 |
call assert_sensible_limits(rendermin,rendermax) |
| 726 |
!print*,'zooming on colour bar: min, max = ',rendermin,rendermax |
| 727 |
endif |
| 728 |
iadvance = 0 |
| 729 |
interactivereplot = .true. |
| 730 |
iexit = .true. |
| 731 |
else |
| 732 |
if (xpt >= xmin .and. xpt <= xmax .and. ypt <= ymaxin) then |
| 733 |
xmin = xcen - 0.5*xlength |
| 734 |
xmax = xcen + 0.5*xlength |
| 735 |
call assert_sensible_limits(xmin,xmax) |
| 736 |
iadvance = 0 |
| 737 |
interactivereplot = .true. |
| 738 |
irerender = .true. |
| 739 |
iexit = .true. |
| 740 |
endif |
| 741 |
if (ypt >= ymin .and. ypt <= ymax .and. xpt <= xmaxin) then |
| 742 |
ymin = ycen - 0.5*ylength |
| 743 |
ymax = ycen + 0.5*ylength |
| 744 |
call assert_sensible_limits(ymin,ymax) |
| 745 |
iadvance = 0 |
| 746 |
interactivereplot = .true. |
| 747 |
irerender = .true. |
| 748 |
iexit = .true. |
| 749 |
endif |
| 750 |
endif |
| 751 |
if (char=='o') then |
| 752 |
xpt = xcen |
| 753 |
ypt = ycen |
| 754 |
endif |
| 755 |
case('a') ! reset plot limits |
| 756 |
if (iamincolourbar .and. irender > 0) then |
| 757 |
if (double_rendering) then |
| 758 |
contmin = contminadapt |
| 759 |
contmax = contmaxadapt |
| 760 |
call assert_sensible_limits(contmin,contmax) |
| 761 |
else |
| 762 |
rendermax = rendermaxadapt |
| 763 |
if (itrans(irender)==1 .and. renderminadapt < rendermaxadapt-5.) then ! if logged |
| 764 |
if (abs(rendermin-(rendermaxadapt-4.)) > epsilon(0.)) then |
| 765 |
rendermin = rendermaxadapt - 4. ! if logged, do not give 20 orders of mag |
| 766 |
print "(a)",' *** MIN SET 4 DEX FROM MAX, PRESS ''a'' AGAIN TO GIVE FULL RANGE ***' |
| 767 |
else |
| 768 |
rendermin = renderminadapt |
| 769 |
endif |
| 770 |
else |
| 771 |
rendermin = renderminadapt |
| 772 |
endif |
| 773 |
call assert_sensible_limits(rendermin,rendermax) |
| 774 |
endif |
| 775 |
iadvance = 0 ! that it should change the render limits |
| 776 |
interactivereplot = .true. |
| 777 |
iexit = .true. |
| 778 |
else |
| 779 |
xmaxin = xmax |
| 780 |
ymaxin = ymax |
| 781 |
if (xpt >= xmin .and. xpt <= xmax .and. ypt <= ymaxin) then |
| 782 |
call adapt_limits_interactive('x',npart,xcoords,xmin,xmax,icolourpart,iamtype,usetype) |
| 783 |
iadvance = 0 |
| 784 |
interactivereplot = .true. |
| 785 |
irerender = .true. |
| 786 |
iexit = .true. |
| 787 |
endif |
| 788 |
if (ypt >= ymin .and. ypt <= ymax .and. xpt <= xmaxin) then |
| 789 |
call adapt_limits_interactive('y',npart,ycoords,ymin,ymax,icolourpart,iamtype,usetype) |
| 790 |
iadvance = 0 |
| 791 |
interactivereplot = .true. |
| 792 |
irerender = .true. |
| 793 |
iexit = .true. |
| 794 |
endif |
| 795 |
endif |
| 796 |
! |
| 797 |
!--zoom in/out on vector plots (arrow size) |
| 798 |
! |
| 799 |
case('v') |
| 800 |
if (ivecx > 0 .and. ivecy > 0) then |
| 801 |
!print*,'decreasing vector arrow size' |
| 802 |
vecmax = zoomfac*scalefac*vecmax |
| 803 |
iadvance = 0 |
| 804 |
interactivereplot = .true. |
| 805 |
iexit = .true. |
| 806 |
endif |
| 807 |
case('V') |
| 808 |
if (ivecx > 0 .and. ivecy > 0) then |
| 809 |
!print*,'increasing vector arrow size' |
| 810 |
vecmax = vecmax/(zoomfac*scalefac) |
| 811 |
iadvance = 0 |
| 812 |
interactivereplot = .true. |
| 813 |
iexit = .true. |
| 814 |
endif |
| 815 |
case('w','W') |
| 816 |
if (ivecx > 0 .and. ivecy > 0) then |
| 817 |
!print*,'adapting vector arrow size' |
| 818 |
vecmax = -1.0 |
| 819 |
iadvance = 0 |
| 820 |
interactivereplot = .true. |
| 821 |
iexit = .true. |
| 822 |
endif |
| 823 |
! |
| 824 |
!--change opacity on 3D opacity rendered plots |
| 825 |
! |
| 826 |
case('k') |
| 827 |
if (ndim==3 .and. iplotz > 0 .and. irender /= 0 .and. use3Dopacity) then |
| 828 |
print*,'decreasing opacity by factor of ',1.5*zoomfac*scalefac |
| 829 |
rkappa = rkappa/(zoomfac*scalefac) |
| 830 |
iadvance = 0 |
| 831 |
interactivereplot = .true. |
| 832 |
irerender = .true. |
| 833 |
iexit = .true. |
| 834 |
endif |
| 835 |
case('K') |
| 836 |
if (ndim==3 .and. iplotz > 0 .and. irender /= 0 .and. use3Dopacity) then |
| 837 |
print*,'increasing opacity by factor of ',1.5*zoomfac*scalefac |
| 838 |
rkappa = rkappa*(zoomfac*scalefac) |
| 839 |
iadvance = 0 |
| 840 |
interactivereplot = .true. |
| 841 |
irerender = .true. |
| 842 |
iexit = .true. |
| 843 |
endif |
| 844 |
! |
| 845 |
!--set/unset log axes |
| 846 |
! |
| 847 |
case('l') |
| 848 |
! |
| 849 |
!--change colour bar, y and x itrans between log / not logged |
| 850 |
! |
| 851 |
if (iamincolourbar .and. irender > 0) then |
| 852 |
if (double_rendering) then |
| 853 |
!call change_itrans(irender,rendermin,rendermax) |
| 854 |
call change_itrans(icontour,contmin,contmax) |
| 855 |
else |
| 856 |
if (icontour==irender) then |
| 857 |
call change_itrans2(irender,rendermin,rendermax,contmin,contmax) |
| 858 |
else |
| 859 |
call change_itrans(irender,rendermin,rendermax) |
| 860 |
endif |
| 861 |
endif |
| 862 |
iadvance = 0 |
| 863 |
interactivereplot = .true. |
| 864 |
irerender = .true. |
| 865 |
iexit = .true. |
| 866 |
elseif (xpt < xmin) then |
| 867 |
if (is_coord(iploty,ndim) .and. irender > 0) then |
| 868 |
print "(a)",'error: cannot log coordinate axes with rendering' |
| 869 |
else |
| 870 |
call change_itrans(iploty,ymin,ymax) |
| 871 |
iadvance = 0 |
| 872 |
interactivereplot = .true. |
| 873 |
iexit = .true. |
| 874 |
endif |
| 875 |
elseif (ypt < ymin) then |
| 876 |
if (is_coord(iplotx,ndim) .and. irender > 0) then |
| 877 |
print "(a)",'error: cannot log coordinate axes with rendering' |
| 878 |
else |
| 879 |
call change_itrans(iplotx,xmin,xmax) |
| 880 |
iadvance = 0 |
| 881 |
interactivereplot = .true. |
| 882 |
iexit = .true. |
| 883 |
endif |
| 884 |
endif |
| 885 |
! |
| 886 |
!--reset all range restrictions |
| 887 |
! |
| 888 |
case('R') |
| 889 |
call reset_ranges |
| 890 |
iadvance = 0 |
| 891 |
interactivereplot = .true. |
| 892 |
iexit = .true. |
| 893 |
! |
| 894 |
!--save as end point of animation sequence |
| 895 |
! |
| 896 |
case('e','E') |
| 897 |
call setsequenceend(istep,iplotx,iploty,irender,rotation, & |
| 898 |
anglex,angley,anglez,zobserver,use3Dopacity,rkappa, & |
| 899 |
x_sec,zslicepos,xmin,xmax,ymin,ymax,rendermin,rendermax) |
| 900 |
! |
| 901 |
!--rotation |
| 902 |
! |
| 903 |
case(',') |
| 904 |
if (rotation) then |
| 905 |
!print*,'changing z rotation angle by -15 degrees...' |
| 906 |
if (int(scalefac) > 1) then |
| 907 |
anglez = anglez - int(scalefac) |
| 908 |
else |
| 909 |
anglez = anglez - 15. |
| 910 |
endif |
| 911 |
iadvance = 0 |
| 912 |
interactivereplot = .true. |
| 913 |
irerender = .true. |
| 914 |
iexit = .true. |
| 915 |
endif |
| 916 |
case('<') |
| 917 |
if (rotation) then |
| 918 |
!print*,'changing z rotation angle by -30 degrees...' |
| 919 |
if (int(scalefac) > 1) then |
| 920 |
anglez = anglez - int(scalefac) |
| 921 |
else |
| 922 |
anglez = anglez - 30. |
| 923 |
endif |
| 924 |
iadvance = 0 |
| 925 |
interactivereplot = .true. |
| 926 |
irerender = .true. |
| 927 |
iexit = .true. |
| 928 |
endif |
| 929 |
case('.') |
| 930 |
if (rotation) then |
| 931 |
!print*,'changing z rotation angle by 15 degrees...' |
| 932 |
if (int(scalefac) > 1) then |
| 933 |
anglez = anglez + int(scalefac) |
| 934 |
else |
| 935 |
anglez = anglez + 15. |
| 936 |
endif |
| 937 |
iadvance = 0 |
| 938 |
interactivereplot = .true. |
| 939 |
irerender = .true. |
| 940 |
iexit = .true. |
| 941 |
endif |
| 942 |
case('>') |
| 943 |
if (rotation) then |
| 944 |
!print*,'changing z rotation angle by 30 degrees...' |
| 945 |
if (int(scalefac) > 1) then |
| 946 |
anglez = anglez + int(scalefac) |
| 947 |
else |
| 948 |
anglez = anglez + 30. |
| 949 |
endif |
| 950 |
iadvance = 0 |
| 951 |
interactivereplot = .true. |
| 952 |
irerender = .true. |
| 953 |
iexit = .true. |
| 954 |
endif |
| 955 |
case('/') |
| 956 |
if (rotation .and. ndim >= 2) then |
| 957 |
!print*,'changing y rotation angle by -15 degrees...' |
| 958 |
if (int(scalefac) > 1) then |
| 959 |
angley = angley - int(scalefac) |
| 960 |
else |
| 961 |
angley = angley - 15. |
| 962 |
endif |
| 963 |
iadvance = 0 |
| 964 |
interactivereplot = .true. |
| 965 |
irerender = .true. |
| 966 |
iexit = .true. |
| 967 |
endif |
| 968 |
case('?') |
| 969 |
if (rotation .and. ndim >= 2) then |
| 970 |
!print*,'changing y rotation angle by -30 degrees...' |
| 971 |
if (int(scalefac) > 1) then |
| 972 |
angley = angley - int(scalefac) |
| 973 |
else |
| 974 |
angley = angley - 30. |
| 975 |
endif |
| 976 |
iadvance = 0 |
| 977 |
interactivereplot = .true. |
| 978 |
irerender = .true. |
| 979 |
iexit = .true. |
| 980 |
endif |
| 981 |
case('\') |
| 982 |
if (rotation .and. ndim >= 2) then |
| 983 |
!print*,'changing y rotation angle by 15 degrees...' |
| 984 |
if (int(scalefac) > 1) then |
| 985 |
angley = angley + int(scalefac) |
| 986 |
else |
| 987 |
angley = angley + 15. |
| 988 |
endif |
| 989 |
iadvance = 0 |
| 990 |
interactivereplot = .true. |
| 991 |
irerender = .true. |
| 992 |
iexit = .true. |
| 993 |
endif |
| 994 |
case('|') |
| 995 |
if (rotation .and. ndim >= 2) then |
| 996 |
!print*,'changing y rotation angle by 30 degrees...' |
| 997 |
!print*,'changing y rotation angle by 15 degrees...' |
| 998 |
if (int(scalefac) > 1) then |
| 999 |
angley = angley + int(scalefac) |
| 1000 |
else |
| 1001 |
angley = angley + 30. |
| 1002 |
endif |
| 1003 |
iadvance = 0 |
| 1004 |
interactivereplot = .true. |
| 1005 |
irerender = .true. |
| 1006 |
iexit = .true. |
| 1007 |
endif |
| 1008 |
case('[') |
| 1009 |
if (rotation .and. ndim >= 3) then |
| 1010 |
!print*,'changing x rotation angle by -15 degrees...' |
| 1011 |
if (int(scalefac) > 1) then |
| 1012 |
anglex = anglex - int(scalefac) |
| 1013 |
else |
| 1014 |
anglex = anglex - 15. |
| 1015 |
endif |
| 1016 |
iadvance = 0 |
| 1017 |
interactivereplot = .true. |
| 1018 |
irerender = .true. |
| 1019 |
iexit = .true. |
| 1020 |
endif |
| 1021 |
case('{') |
| 1022 |
if (rotation .and. ndim >= 3) then |
| 1023 |
!print*,'changing x rotation angle by -30 degrees...' |
| 1024 |
if (int(scalefac) > 1) then |
| 1025 |
anglex = anglex - int(scalefac) |
| 1026 |
else |
| 1027 |
anglex = anglex - 30. |
| 1028 |
endif |
| 1029 |
iadvance = 0 |
| 1030 |
interactivereplot = .true. |
| 1031 |
irerender = .true. |
| 1032 |
iexit = .true. |
| 1033 |
endif |
| 1034 |
case(']') |
| 1035 |
if (rotation .and. ndim >= 3) then |
| 1036 |
!print*,'changing x rotation angle by 15 degrees...' |
| 1037 |
if (int(scalefac) > 1) then |
| 1038 |
anglex = anglex + int(scalefac) |
| 1039 |
else |
| 1040 |
anglex = anglex + 15. |
| 1041 |
endif |
| 1042 |
iadvance = 0 |
| 1043 |
interactivereplot = .true. |
| 1044 |
irerender = .true. |
| 1045 |
iexit = .true. |
| 1046 |
endif |
| 1047 |
case('}') |
| 1048 |
if (rotation .and. ndim >= 3) then |
| 1049 |
!print*,'changing x rotation angle by 30 degrees...' |
| 1050 |
if (int(scalefac) > 1) then |
| 1051 |
anglex = anglex + int(scalefac) |
| 1052 |
else |
| 1053 |
anglex = anglex + 30. |
| 1054 |
endif |
| 1055 |
iadvance = 0 |
| 1056 |
interactivereplot = .true. |
| 1057 |
irerender = .true. |
| 1058 |
iexit = .true. |
| 1059 |
endif |
| 1060 |
! |
| 1061 |
!--set cross section position |
| 1062 |
! |
| 1063 |
case('x') |
| 1064 |
if (rotation .and. ndim >= 3) then |
| 1065 |
xline(1) = xpt |
| 1066 |
yline(1) = ypt |
| 1067 |
!--work out which is the third dimension |
| 1068 |
do i=1,3 |
| 1069 |
if (i /= iplotx .and. i /= iploty) ixsec = i |
| 1070 |
enddo |
| 1071 |
print*,' select cross section position (using left click or x)' |
| 1072 |
ierr = plot_band(1,1,xline(1),yline(1),xline(2),yline(2),char2) |
| 1073 |
!--work out cross section if left click or x again |
| 1074 |
select case(char2) |
| 1075 |
case(plot_left_click,'x') |
| 1076 |
!--plot the cross section line |
| 1077 |
call plot_line(2,xline(1:2),yline(1:2)) |
| 1078 |
!--work out angle with the x axis |
| 1079 |
! and offset of line from origin |
| 1080 |
dx = xline(2) - xline(1) |
| 1081 |
dy = yline(2) - yline(1) |
| 1082 |
anglerad = atan2(dy,dx) |
| 1083 |
select case(ixsec) |
| 1084 |
case(1) |
| 1085 |
anglex = 180.*anglerad/pi + anglex |
| 1086 |
print*,'setting angle x = ',anglex |
| 1087 |
case(2) |
| 1088 |
angley = 180.*anglerad/pi + angley |
| 1089 |
print*,'setting angle y = ',angley |
| 1090 |
case(3) |
| 1091 |
anglez = 180.*anglerad/pi + anglez |
| 1092 |
print*,'setting angle z = ',anglez |
| 1093 |
end select |
| 1094 |
iploty = ixsec |
| 1095 |
!--work out offset of cross section line |
| 1096 |
! y intercept |
| 1097 |
yint = yline(2) - (dy/dx)*xline(2) |
| 1098 |
zslicepos = yint/cos(anglerad) |
| 1099 |
!--if we are in column density mode, change back to cross-section mode |
| 1100 |
x_sec = .true. |
| 1101 |
print*,'iploty = ',ixsec, ' xsecpos = ',zslicepos |
| 1102 |
iadvance = 0 |
| 1103 |
interactivereplot = .true. |
| 1104 |
irerender = .true. |
| 1105 |
iexit = .true. |
| 1106 |
case default |
| 1107 |
print*,' action cancelled' |
| 1108 |
end select |
| 1109 |
endif |
| 1110 |
! |
| 1111 |
!--cross sections |
| 1112 |
! |
| 1113 |
case('u') ! move cross section up by dxsec |
| 1114 |
if (iplotz > 0 .and. ndim==3) then |
| 1115 |
if (x_sec) then |
| 1116 |
if (int(scalefac) > 1) dzslice = scalefac |
| 1117 |
print*,'shifting cross section position up by ',dzslice |
| 1118 |
zslicepos = zslicepos + dzslice |
| 1119 |
iadvance = 0 |
| 1120 |
interactivereplot = .true. |
| 1121 |
irerender = .true. |
| 1122 |
iexit = .true. |
| 1123 |
elseif (use3Dperspective) then |
| 1124 |
if (abs(zobserver) < tiny(0.)) then |
| 1125 |
print*,'resetting z position' |
| 1126 |
zobserver = 1. |
| 1127 |
else |
| 1128 |
print*,'shifting perspective position up by factor of ',scalefac |
| 1129 |
zobserver = scalefac*zoomfac*zobserver |
| 1130 |
endif |
| 1131 |
iadvance = 0 |
| 1132 |
interactivereplot = .true. |
| 1133 |
irerender = .true. |
| 1134 |
iexit = .true. |
| 1135 |
endif |
| 1136 |
endif |
| 1137 |
case('U') ! move cross section up by 2*dxsec |
| 1138 |
if (iplotz > 0 .and. ndim==3) then |
| 1139 |
if (x_sec) then |
| 1140 |
print*,'shifting cross section position up by ',2.*dzslice |
| 1141 |
zslicepos = zslicepos + 2.*dzslice |
| 1142 |
iadvance = 0 |
| 1143 |
interactivereplot = .true. |
| 1144 |
irerender = .true. |
| 1145 |
iexit = .true. |
| 1146 |
elseif (use3Dperspective) then |
| 1147 |
if (abs(zobserver) < tiny(0.)) then |
| 1148 |
print*,'resetting z position' |
| 1149 |
zobserver = 1. |
| 1150 |
else |
| 1151 |
print*,'shifting perspective position up by factor of 2' |
| 1152 |
zobserver = 2.*scalefac*zoomfac*zobserver |
| 1153 |
endif |
| 1154 |
iadvance = 0 |
| 1155 |
interactivereplot = .true. |
| 1156 |
irerender = .true. |
| 1157 |
iexit = .true. |
| 1158 |
endif |
| 1159 |
endif |
| 1160 |
case('d') ! move cross section down by dxsec |
| 1161 |
if (iplotz > 0 .and. ndim==3) then |
| 1162 |
if (x_sec) then |
| 1163 |
if (int(scalefac) > 1) dzslice = scalefac |
| 1164 |
print*,'shifting cross section position down by ',dzslice |
| 1165 |
zslicepos = zslicepos - dzslice |
| 1166 |
elseif (use3Dperspective) then |
| 1167 |
if (abs(zobserver) < tiny(0.)) then |
| 1168 |
print*,'resetting z position' |
| 1169 |
zobserver = 1. |
| 1170 |
else |
| 1171 |
print*,'shifting perspective position down' |
| 1172 |
zobserver = zobserver/(zoomfac*scalefac) |
| 1173 |
endif |
| 1174 |
endif |
| 1175 |
iadvance = 0 |
| 1176 |
interactivereplot = .true. |
| 1177 |
irerender = .true. |
| 1178 |
iexit = .true. |
| 1179 |
endif |
| 1180 |
case('D') ! move cross section down by 2*dxsec |
| 1181 |
if (iplotz > 0 .and. ndim==3) then |
| 1182 |
if (x_sec) then |
| 1183 |
print*,'shifting cross section position down by ',2.*dzslice |
| 1184 |
zslicepos = zslicepos - 2.*dzslice |
| 1185 |
elseif (use3Dperspective) then |
| 1186 |
if (abs(zobserver) < tiny(0.)) then |
| 1187 |
print*,'resetting z position' |
| 1188 |
zobserver = 1. |
| 1189 |
else |
| 1190 |
print*,'shifting perspective position down by factor of 2' |
| 1191 |
zobserver = zobserver/(2.*zoomfac*scalefac) |
| 1192 |
endif |
| 1193 |
endif |
| 1194 |
iadvance = 0 |
| 1195 |
interactivereplot = .true. |
| 1196 |
irerender = .true. |
| 1197 |
iexit = .true. |
| 1198 |
endif |
| 1199 |
! |
| 1200 |
!--general plot stuff |
| 1201 |
! |
| 1202 |
case('G') ! move legend here |
| 1203 |
print*,'setting legend position to current location...' |
| 1204 |
call mvlegend(xpt,ypt,xmin,xmax,ymax) |
| 1205 |
iadvance = 0 |
| 1206 |
interactivereplot = .true. |
| 1207 |
iexit = .true. |
| 1208 |
case('T') ! move title here |
| 1209 |
print*,'setting title position to current location...' |
| 1210 |
call mvtitle(xpt,ypt,xmin,xmax,ymax) |
| 1211 |
iadvance = 0 |
| 1212 |
interactivereplot = .true. |
| 1213 |
iexit = .true. |
| 1214 |
case('H') ! move vector legend here |
| 1215 |
if (ivecx > 0 .and. ivecy > 0) then |
| 1216 |
print*,'setting vector plot legend to current location...' |
| 1217 |
call mvlegendvec(xpt,ypt,xmin,xmax,ymax) |
| 1218 |
endif |
| 1219 |
iadvance = 0 |
| 1220 |
interactivereplot = .true. |
| 1221 |
iexit = .true. |
| 1222 |
case('f') ! change rendered quantity (next) |
| 1223 |
if (irender /= 0 .and. ndim > 0) then |
| 1224 |
irender = irender + 1 |
| 1225 |
if (irender > ndataplots) irender = 1 |
| 1226 |
if (is_coord(irender,ndim)) irender = ix(ndim) + 1 |
| 1227 |
!if (irender==ndataplots+1) irender = 0 |
| 1228 |
iadvance = 0 |
| 1229 |
interactivereplot = .true. |
| 1230 |
irerender = .true. |
| 1231 |
iexit = .true. |
| 1232 |
else ! flip y axis |
| 1233 |
iploty = iploty + 1 |
| 1234 |
if (iploty > ndataplots) iploty = 1 |
| 1235 |
iadvance = 0 |
| 1236 |
interactivereplot = .true. |
| 1237 |
iexit = .true. |
| 1238 |
endif |
| 1239 |
case('F') ! change rendered quantity (previous) |
| 1240 |
if (irender /= 0 .and. ndim > 0) then |
| 1241 |
irender = irender - 1 |
| 1242 |
if (is_coord(irender,ndim)) irender = ix(1) - 1 |
| 1243 |
if (irender < 1) irender = ndataplots |
| 1244 |
!if (irender==ndim) irender = 0 |
| 1245 |
iadvance = 0 |
| 1246 |
interactivereplot = .true. |
| 1247 |
irerender = .true. |
| 1248 |
iexit = .true. |
| 1249 |
else ! flip y axis |
| 1250 |
iploty = iploty - 1 |
| 1251 |
if (iploty < 1) iploty = ndataplots |
| 1252 |
iadvance = 0 |
| 1253 |
interactivereplot = .true. |
| 1254 |
iexit = .true. |
| 1255 |
endif |
| 1256 |
case(achar(13)) |
| 1257 |
if (in_movie_mode) then |
| 1258 |
call unset_movie_mode() |
| 1259 |
in_movie_mode = .false. |
| 1260 |
else |
| 1261 |
call set_movie_mode(.true.) |
| 1262 |
in_movie_mode = .true. |
| 1263 |
endif |
| 1264 |
iadvance = 0 |
| 1265 |
interactivereplot = .true. |
| 1266 |
irerender = .true. |
| 1267 |
iexit = .true. |
| 1268 |
case('m') ! change colour map (next scheme) |
| 1269 |
call change_colourmap(icolourscheme,1) |
| 1270 |
iadvance = 0 |
| 1271 |
interactivereplot = .true. |
| 1272 |
!irerender = .true. |
| 1273 |
iexit = .true. |
| 1274 |
case('M') ! change colour map (previous scheme) |
| 1275 |
call change_colourmap(icolourscheme,-1) |
| 1276 |
iadvance = 0 |
| 1277 |
interactivereplot = .true. |
| 1278 |
iexit = .true. |
| 1279 |
case('i') ! invert colour map |
| 1280 |
icolourscheme = -icolourscheme |
| 1281 |
call change_colourmap(icolourscheme,0) |
| 1282 |
iadvance = 0 |
| 1283 |
interactivereplot = .true. |
| 1284 |
iexit = .true. |
| 1285 |
case('^') ! add arrow |
| 1286 |
call add_shape_interactive(xpt,ypt,itrans(iplotx),itrans(iploty),0,ierr,shape_type=3) |
| 1287 |
if (ierr==0) then |
| 1288 |
iadvance = 0 |
| 1289 |
interactivereplot = .true. |
| 1290 |
iexit = .true. |
| 1291 |
endif |
| 1292 |
case(achar(20)) ! add text shape |
| 1293 |
call add_shape_interactive(xpt,ypt,itrans(iplotx),itrans(iploty),0,ierr,shape_type=6) |
| 1294 |
if (ierr==0) then |
| 1295 |
iadvance = 0 |
| 1296 |
interactivereplot = .true. |
| 1297 |
iexit = .true. |
| 1298 |
endif |
| 1299 |
case(achar(8)) ! delete plot annotation / colour bar (backspace) |
| 1300 |
ishape = inshape(xpt,ypt,itrans(iplotx),itrans(iploty),xmin,xmax,ymin,ymax) |
| 1301 |
if (ishape > 0) then |
| 1302 |
call delete_shape(ishape,nshapes) |
| 1303 |
iadvance = 0 |
| 1304 |
interactivereplot = .true. |
| 1305 |
iexit = .true. |
| 1306 |
elseif (iamincolourbar .and. irender > 0) then |
| 1307 |
iColourBarStyle = 0 |
| 1308 |
iadvance = 0 |
| 1309 |
interactivereplot = .true. |
| 1310 |
irerender = .true. |
| 1311 |
iexit = .true. |
| 1312 |
elseif (xpt < xmin .or. xpt > xmax .or. ypt < ymin .or. ypt > ymax) then |
| 1313 |
call deleteaxes() |
| 1314 |
iadvance = 0 |
| 1315 |
interactivereplot = .true. |
| 1316 |
irerender = .true. |
| 1317 |
iexit = .true. |
| 1318 |
else |
| 1319 |
ilegend = in_legend(xpt,ypt) |
| 1320 |
if (legend_is_plotted(ilegend)) then |
| 1321 |
call delete_legend(ilegend) |
| 1322 |
iadvance = 0 |
| 1323 |
interactivereplot = .true. |
| 1324 |
iexit = .true. |
| 1325 |
else |
| 1326 |
print*,' nothing to delete at x,y =',xpt,',',ypt |
| 1327 |
endif |
| 1328 |
endif |
| 1329 |
! |
| 1330 |
!--timestepping |
| 1331 |
! |
| 1332 |
case('q','Q',achar(27),achar(3)) |
| 1333 |
iadvance = -666 |
| 1334 |
!print*,'quitting...' |
| 1335 |
iexit = .true. |
| 1336 |
case('b','B',plot_scroll_left) ! right click -> go back |
| 1337 |
iadvance = -abs(iadvance) |
| 1338 |
iexit = .true. |
| 1339 |
case('r') ! replot |
| 1340 |
iadvance = 0 |
| 1341 |
interactivereplot = .true. |
| 1342 |
irerender = .true. |
| 1343 |
iexit = .true. |
| 1344 |
case(' ',plot_scroll_right) ! space |
| 1345 |
iadvance = abs(iadvance) |
| 1346 |
iexit = .true. |
| 1347 |
case('0','1','2','3','4','5','6','7','8','9') |
| 1348 |
read(char,*,iostat=ierr) iadvancenew |
| 1349 |
if (ierr /=0) then |
| 1350 |
print*,'*** internal error setting timestep jump' |
| 1351 |
iadvancenew = 1 |
| 1352 |
endif |
| 1353 |
if ((iadvance > 1 .or. iadvanceset) .and. iadvance <= 9999) then |
| 1354 |
iadvance = 10*iadvance + iadvancenew |
| 1355 |
if (iadvance > 9999) iadvance = 1 |
| 1356 |
elseif (iadvancenew==0) then |
| 1357 |
iadvance = 10 |
| 1358 |
else |
| 1359 |
iadvance = iadvancenew |
| 1360 |
endif |
| 1361 |
iadvance = int(zoomfac*iadvance) |
| 1362 |
print*,' setting timestep jump / zoom factor = ',iadvance |
| 1363 |
iadvanceset = .true. |
| 1364 |
scalefac = iadvance |
| 1365 |
case(')') |
| 1366 |
iadvance = int(zoomfac*10) |
| 1367 |
print*,' setting timestep jump = ',iadvance |
| 1368 |
! |
| 1369 |
!--multiply everything by a factor of 10 |
| 1370 |
! |
| 1371 |
case('z','Z') |
| 1372 |
zoomfac = 10.*zoomfac |
| 1373 |
if (zoomfac > 1000000.) then |
| 1374 |
zoomfac = 1.0 |
| 1375 |
endif |
| 1376 |
print*,' LIMITS/TIMESTEPPING CHANGES NOW x ',zoomfac |
| 1377 |
! |
| 1378 |
!--unknown |
| 1379 |
! |
| 1380 |
case default |
| 1381 |
if (iachar(char) >= iachar('a')) then |
| 1382 |
print*,' x, y = ',xpt,ypt,'; unknown option "',trim(char), '" ',iachar(char) |
| 1383 |
endif |
| 1384 |
print*,' x, y = ',xpt,ypt,'; GOT ',iachar(char) |
| 1385 |
end select |
| 1386 |
|
| 1387 |
! |
| 1388 |
!--save cursor position relative to the viewport |
| 1389 |
! |
| 1390 |
call plot_qwin(xminwin,xmaxwin,yminwin,ymaxwin) |
| 1391 |
call get_vptxy(xpt,ypt,xcursor,ycursor) |
| 1392 |
|
| 1393 |
if (rotation) then |
| 1394 |
if (anglez >= 360.) anglez = anglez - 360. |
| 1395 |
if (anglez < 0.) anglez = anglez + 360. |
| 1396 |
if (ndim > 2) then |
| 1397 |
if (angley >= 360.) angley = angley - 360. |
| 1398 |
if (angley < 0.) angley = angley + 360. |
| 1399 |
if (anglex >= 360.) anglex = anglex - 360. |
| 1400 |
if (anglex < 0.) anglex = anglex + 360. |
| 1401 |
endif |
| 1402 |
endif |
| 1403 |
! |
| 1404 |
!--do not let timestep go outside of bounds |
| 1405 |
! if we are at the first/last step, just print message and do nothing |
| 1406 |
! if iadvance trips over the bounds, jump to last/first step |
| 1407 |
! |
| 1408 |
if (iadvance /= -666 .and. iexit) then |
| 1409 |
if (istep + iadvance > ilaststep .and. iframe==nframes) then |
| 1410 |
print "(1x,a)",'reached last timestep' |
| 1411 |
if (ilaststep-istep > 0) then |
| 1412 |
iadvance= ilaststep - istep |
| 1413 |
else |
| 1414 |
iexit = .false. |
| 1415 |
endif |
| 1416 |
elseif (istep + iadvance < 1 .and. iframe==1) then |
| 1417 |
print "(1x,a)",'reached first timestep: can''t go back' |
| 1418 |
if (1-istep < 0) then |
| 1419 |
iadvance= 1 - istep |
| 1420 |
else |
| 1421 |
iexit = .false. |
| 1422 |
endif |
| 1423 |
endif |
| 1424 |
endif |
| 1425 |
|
| 1426 |
enddo interactiveloop |
| 1427 |
return |
| 1428 |
end subroutine interactive_part |
| 1429 |
|
| 1430 |
! |
| 1431 |
! cut down version of interactive mode -> controls timestepping only |
| 1432 |
! used in powerspectrum / extra plots |
| 1433 |
! THIS IS NOW LARGELY OBSOLETE (superseded by interactive_multi) |
| 1434 |
! AND WILL BE REMOVED IN FUTURE VERSIONS |
| 1435 |
! |
| 1436 |
subroutine interactive_step(iadvance,istep,ilaststep,xmin,xmax,ymin,ymax,interactivereplot) |
| 1437 |
use plotlib, only:plot_qcur,plot_curs,plot_band,plot_rect,plot_left_click |
| 1438 |
integer, intent(inout) :: iadvance |
| 1439 |
integer, intent(in) :: istep,ilaststep |
| 1440 |
real, intent(inout) :: xmin,xmax,ymin,ymax |
| 1441 |
logical, intent(out) :: interactivereplot |
| 1442 |
integer :: ierr |
| 1443 |
real :: xpt,ypt,xpt2,ypt2 |
| 1444 |
real :: xlength, ylength, zoomfac |
| 1445 |
character(len=1) :: char,char2 |
| 1446 |
logical :: iexit |
| 1447 |
|
| 1448 |
if (plot_qcur()) then |
| 1449 |
print*,'entering interactive mode...press h in plot window for help' |
| 1450 |
else |
| 1451 |
!print*,'cannot enter interactive mode: device has no cursor' |
| 1452 |
return |
| 1453 |
endif |
| 1454 |
char = 'A' |
| 1455 |
xpt = 0. |
| 1456 |
ypt = 0. |
| 1457 |
zoomfac = 1.0 |
| 1458 |
iexit = .false. |
| 1459 |
interactivereplot = .false. |
| 1460 |
|
| 1461 |
do while (.not.iexit) |
| 1462 |
ierr = plot_curs(xpt,ypt,char) |
| 1463 |
! |
| 1464 |
!--exit if the device is not interactive |
| 1465 |
! |
| 1466 |
if (ierr==1) return |
| 1467 |
|
| 1468 |
print*,'x, y = ',xpt,ypt,' function = ',char |
| 1469 |
|
| 1470 |
select case(char) |
| 1471 |
case('h') |
| 1472 |
print*,'-------------- interactive mode commands --------------' |
| 1473 |
print*,' select area and zoom : left click (or A)' |
| 1474 |
print*,' zoom in by 10% : +' |
| 1475 |
print*,' zoom out by 10(20)% : - (_)' |
| 1476 |
print*,' (r)eplot current plot : r' |
| 1477 |
print*,' next timestep/plot : space, n' |
| 1478 |
print*,' previous timestep : right click (or X), b' |
| 1479 |
print*,' jump forward (back) by n timesteps : 0,1,2,3..9 then left (right) click' |
| 1480 |
print*,' G : move legend to current position' |
| 1481 |
print*,' T : move title to current position' |
| 1482 |
print*,' (h)elp : h' |
| 1483 |
print*,' (q)uit plotting : q, Q, esc' |
| 1484 |
print*,'-------------------------------------------------------' |
| 1485 |
|
| 1486 |
case(plot_left_click) ! left click |
| 1487 |
! |
| 1488 |
!--draw rectangle from the point and reset the limits |
| 1489 |
! |
| 1490 |
print*,'select area: ' |
| 1491 |
print*,'left click : zoom' |
| 1492 |
ierr = plot_band(2,1,xpt,ypt,xpt2,ypt2,char2) |
| 1493 |
print*,xpt,ypt,xpt2,ypt2,char2 |
| 1494 |
select case (char2) |
| 1495 |
case(plot_left_click) ! zoom if another left click |
| 1496 |
call plot_rect(xpt,xpt2,ypt,ypt2) |
| 1497 |
xmin = min(xpt,xpt2) |
| 1498 |
xmax = max(xpt,xpt2) |
| 1499 |
ymin = min(ypt,ypt2) |
| 1500 |
ymax = max(ypt,ypt2) |
| 1501 |
iadvance = 0 |
| 1502 |
interactivereplot = .true. |
| 1503 |
iexit = .true. |
| 1504 |
case default |
| 1505 |
print*,' action cancelled' |
| 1506 |
end select |
| 1507 |
! |
| 1508 |
!--zooming |
| 1509 |
! |
| 1510 |
case('-','_','+','o') ! zoom out by 10 or 20% |
| 1511 |
xlength = xmax - xmin |
| 1512 |
ylength = ymax - ymin |
| 1513 |
select case(char) |
| 1514 |
case('-') |
| 1515 |
xlength = 1.1*zoomfac*xlength |
| 1516 |
ylength = 1.1*zoomfac*ylength |
| 1517 |
case('_') |
| 1518 |
xlength = 1.2*zoomfac*xlength |
| 1519 |
ylength = 1.2*zoomfac*ylength |
| 1520 |
case('+') |
| 1521 |
xlength = 0.9/zoomfac*xlength |
| 1522 |
ylength = 0.9/zoomfac*ylength |
| 1523 |
case('o') !--reset cursor to origin |
| 1524 |
xpt = 0. |
| 1525 |
ypt = 0. |
| 1526 |
end select |
| 1527 |
if (xpt >= xmin .and. xpt <= xmax .and. ypt <= ymax) then |
| 1528 |
print*,'zooming on x axis' |
| 1529 |
xmin = xpt - 0.5*xlength |
| 1530 |
xmax = xpt + 0.5*xlength |
| 1531 |
iadvance = 0 |
| 1532 |
interactivereplot = .true. |
| 1533 |
iexit = .true. |
| 1534 |
endif |
| 1535 |
if (ypt >= ymin .and. ypt <= ymax .and. xpt <= xmax) then |
| 1536 |
print*,'zooming on y axis' |
| 1537 |
ymin = ypt - 0.5*ylength |
| 1538 |
ymax = ypt + 0.5*ylength |
| 1539 |
iadvance = 0 |
| 1540 |
interactivereplot = .true. |
| 1541 |
iexit = .true. |
| 1542 |
endif |
| 1543 |
! |
| 1544 |
!--general plot stuff |
| 1545 |
! |
| 1546 |
case('G') ! move legend here |
| 1547 |
print*,'setting legend position to current location...' |
| 1548 |
call mvlegend(xpt,ypt,xmin,xmax,ymax) |
| 1549 |
case('T') ! move title here |
| 1550 |
print*,'setting title position to current location...' |
| 1551 |
call mvtitle(xpt,ypt,xmin,xmax,ymax) |
| 1552 |
! |
| 1553 |
!--timestepping |
| 1554 |
! |
| 1555 |
case('q','Q',achar(27),achar(3)) |
| 1556 |
iadvance = -666 |
| 1557 |
print*,'quitting...' |
| 1558 |
iexit = .true. |
| 1559 |
case('X','b','B') ! right click -> go back |
| 1560 |
iadvance = -abs(iadvance) |
| 1561 |
iexit = .true. |
| 1562 |
case('r','R') ! replot |
| 1563 |
iadvance = 0 |
| 1564 |
interactivereplot = .true. |
| 1565 |
iexit = .true. |
| 1566 |
case(' ','n','N') ! space |
| 1567 |
iadvance = abs(iadvance) |
| 1568 |
iexit = .true. |
| 1569 |
case('0','1','2','3','4','5','6','7','8','9') |
| 1570 |
read(char,*,iostat=ierr) iadvance |
| 1571 |
if (ierr /=0) then |
| 1572 |
print*,'*** internal error setting timestep jump' |
| 1573 |
iadvance = 1 |
| 1574 |
endif |
| 1575 |
iadvance = int(zoomfac*iadvance) |
| 1576 |
print*,' setting timestep jump = ',iadvance |
| 1577 |
case(')') |
| 1578 |
iadvance = int(zoomfac*10) |
| 1579 |
print*,' setting timestep jump = ',iadvance |
| 1580 |
! |
| 1581 |
!--multiply everything by a factor of 10 |
| 1582 |
! |
| 1583 |
case('z','Z') |
| 1584 |
zoomfac = 10.*zoomfac |
| 1585 |
if (zoomfac > 1000000.) then |
| 1586 |
zoomfac = 1.0 |
| 1587 |
endif |
| 1588 |
print*,' LIMITS/TIMESTEPPING CHANGES NOW x ',zoomfac |
| 1589 |
! |
| 1590 |
!--unknown |
| 1591 |
! |
| 1592 |
case default |
| 1593 |
print*,' x, y = ',xpt,ypt,'; unknown option "',trim(char), '" ',iachar(char) |
| 1594 |
end select |
| 1595 |
! |
| 1596 |
!--do not let timestep go outside of bounds |
| 1597 |
! if we are at the first/last step, just print message and do nothing |
| 1598 |
! if iadvance trips over the bounds, jump to last/first step |
| 1599 |
! |
| 1600 |
if (iadvance /= -666 .and. iexit) then |
| 1601 |
if (istep + iadvance > ilaststep) then |
| 1602 |
print "(1x,a)",'reached last timestep' |
| 1603 |
if (ilaststep-istep > 0) then |
| 1604 |
iadvance= ilaststep - istep |
| 1605 |
else |
| 1606 |
iexit = .false. |
| 1607 |
endif |
| 1608 |
elseif (istep + iadvance < 1) then |
| 1609 |
print "(1x,a)",'reached first timestep: can''t go back' |
| 1610 |
if (1-istep < 0) then |
| 1611 |
iadvance= 1 - istep |
| 1612 |
else |
| 1613 |
iexit = .false. |
| 1614 |
endif |
| 1615 |
endif |
| 1616 |
endif |
| 1617 |
enddo |
| 1618 |
return |
| 1619 |
end subroutine interactive_step |
| 1620 |
|
| 1621 |
! |
| 1622 |
! interactive mode for multiple plots per page - requires determination of which plot/panel |
| 1623 |
! a mouse-click refers to from stored settings for the viewport and limits for each plot. |
| 1624 |
! (this could be made into the only subroutine required) |
| 1625 |
! |
| 1626 |
subroutine interactive_multi(iadvance,istep,ifirststeponpage,ilaststep,iframe,ifirstframeonpage,nframes, & |
| 1627 |
lastpanel,iplotxarr,iplotyarr,irenderarr,icontourarr,ivecarr,& |
| 1628 |
use_double_rendering,xmin,xmax,vptxmin,vptxmax,vptymin,vptymax, & |
| 1629 |
barwmulti,xminadapt,xmaxadapt,nacross,ndim,xorigin,icolourscheme, & |
| 1630 |
iColourBarStyle,interactivereplot) |
| 1631 |
use labels, only:is_coord,iamvec |
| 1632 |
use limits, only:assert_sensible_limits |
| 1633 |
use multiplot, only:itrans |
| 1634 |
use shapes, only:add_shape_interactive,inshape,edit_shape,delete_shape,nshapes |
| 1635 |
use plotlib, only:plot_qcur,plot_band,plot_qwin,plot_pt1,plot_curs,plot_line,plot_left_click |
| 1636 |
use legends, only:in_legend |
| 1637 |
integer, intent(inout) :: iadvance |
| 1638 |
integer, intent(inout) :: istep,iframe,lastpanel,iColourBarStyle |
| 1639 |
integer, intent(in) :: ifirststeponpage,ilaststep,nacross,ndim,ifirstframeonpage,nframes |
| 1640 |
integer, intent(inout) :: icolourscheme |
| 1641 |
integer, intent(in), dimension(:) :: iplotxarr,iplotyarr,irenderarr,icontourarr,ivecarr |
| 1642 |
real, dimension(:), intent(in) :: vptxmin,vptxmax,vptymin,vptymax,barwmulti |
| 1643 |
real, dimension(:), intent(inout) :: xmin,xmax,xminadapt,xmaxadapt |
| 1644 |
real, intent(in), dimension(ndim) :: xorigin |
| 1645 |
logical, intent(in) :: use_double_rendering |
| 1646 |
logical, intent(out) :: interactivereplot |
| 1647 |
integer :: ierr,ipanel,ipanel2,istepin,istepnew,i,istepjump,istepsonpage,ishape,ilegend |
| 1648 |
integer :: istepjumpnew,ivecx,ivecy |
| 1649 |
real :: xpt,ypt,xpt2,ypt2,xpti,ypti,renderpt,xptmin,xptmax,yptmin,yptmax |
| 1650 |
real :: xlength,ylength,renderlength,contlength,zoomfac,scalefac |
| 1651 |
real :: vptxi,vptyi,vptx2i,vpty2i,vptxceni,vptyceni |
| 1652 |
real :: xmini,xmaxi,ymini,ymaxi,xcen,ycen,gradient,dr,yint,xmaxin |
| 1653 |
real, dimension(4) :: xline,yline |
| 1654 |
character(len=1) :: char,char2 |
| 1655 |
logical :: iexit,iamincolourbar,verticalbar,double_render,istepjumpset |
| 1656 |
logical, save :: print_help = .true. |
| 1657 |
|
| 1658 |
if (plot_qcur()) then |
| 1659 |
if (.not.print_help) print*,'entering interactive mode...press h in plot window for help' |
| 1660 |
else |
| 1661 |
!print*,'cannot enter interactive mode: device has no cursor' |
| 1662 |
return |
| 1663 |
endif |
| 1664 |
char = 'A' |
| 1665 |
zoomfac = 1.0 |
| 1666 |
scalefac = 1.1 |
| 1667 |
xpt2 = 0. |
| 1668 |
ypt2 = 0. |
| 1669 |
verticalbar = barisvertical(iColourBarStyle) |
| 1670 |
|
| 1671 |
! |
| 1672 |
!--convert saved cursor position (saved in viewport coords) |
| 1673 |
! back to world coordinates: |
| 1674 |
! |
| 1675 |
!--query window limits in world coords |
| 1676 |
call plot_qwin(xmini,xmaxi,ymini,ymaxi) |
| 1677 |
|
| 1678 |
!--determine which plot the cursor falls on |
| 1679 |
!print*,' saved xcursor,ycursor = ',xcursor,ycursor,vptxmin,vptxmax,vptymin,vptymax |
| 1680 |
ipanel = getpanel(xcursor,ycursor) |
| 1681 |
!print*,' saved panel = ',ipanel |
| 1682 |
|
| 1683 |
!--set the window to correspond to the panel we last left the cursor in |
| 1684 |
call set_panel(ipanel) |
| 1685 |
|
| 1686 |
!--set the position in x,y relative to this panel |
| 1687 |
call getxy(xcursor,ycursor,xpt,ypt,ipanel) |
| 1688 |
!print*,' saved x,y = ',xpt,ypt |
| 1689 |
call get_vptxy(xpt,ypt,vptxi,vptyi) |
| 1690 |
!print*,'saved vptx,y = ',vptxi,vptyi,ipanel |
| 1691 |
|
| 1692 |
iexit = .false. |
| 1693 |
interactivereplot = .false. |
| 1694 |
istepin = istep |
| 1695 |
istepnew = ifirststeponpage - iadvance |
| 1696 |
istepsonpage = abs(istep - ifirststeponpage)/iadvance + 1 |
| 1697 |
istepjump = 1 |
| 1698 |
istepjumpset = .false. |
| 1699 |
! print*,'istep = ',istepnew |
| 1700 |
! print*,'steps on page = ',istepsonpage |
| 1701 |
|
| 1702 |
interactive_loop: do while (.not.iexit) |
| 1703 |
if (print_help) then |
| 1704 |
print_help = .false. |
| 1705 |
char = 'h' |
| 1706 |
ierr = 0 |
| 1707 |
else |
| 1708 |
ierr = plot_curs(xpt,ypt,char) |
| 1709 |
endif |
| 1710 |
! |
| 1711 |
!--exit if the device is not interactive |
| 1712 |
! |
| 1713 |
if (ierr==1) return |
| 1714 |
|
| 1715 |
!print*,'x, y = ',xpt,ypt,' function = ',char |
| 1716 |
! |
| 1717 |
!--determine which plot the cursor falls on |
| 1718 |
! |
| 1719 |
call get_vptxy(xpt,ypt,vptxi,vptyi) |
| 1720 |
ipanel = getpanel(vptxi,vptyi) |
| 1721 |
!print*,'xpt,ypt = ',xpt,ypt,vptxi,vptyi,ipanel |
| 1722 |
|
| 1723 |
!--translate vpt co-ords to x,y in current panel |
| 1724 |
call getxy(vptxi,vptyi,xpti,ypti,ipanel) |
| 1725 |
|
| 1726 |
!print*,'vptx,y = ',xpti,ypti,vptxi,vptyi,ipanel |
| 1727 |
!--query the position of the colour bar |
| 1728 |
if (ipanel > 0) then |
| 1729 |
if (barwmulti(ipanel) > tiny(barwmulti)) then |
| 1730 |
iamincolourbar = incolourbar(iColourBarStyle,4,xpti,ypti,xmin(iplotxarr(ipanel)), & |
| 1731 |
xmax(iplotxarr(ipanel)),xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 1732 |
else |
| 1733 |
!--for colour bars on tiled plots, use viewport coords |
| 1734 |
iamincolourbar = incolourbar(iColourBarStyle,0,vptxi,vptyi,& |
| 1735 |
minval(vptxmin),maxval(vptxmax),minval(vptymin),maxval(vptymax)) |
| 1736 |
endif |
| 1737 |
else |
| 1738 |
iamincolourbar = .false. |
| 1739 |
endif |
| 1740 |
|
| 1741 |
!--work out if this plot is double rendered or not |
| 1742 |
double_render = (icontourarr(ipanel) > 0 .and. use_double_rendering) |
| 1743 |
|
| 1744 |
select case(char) |
| 1745 |
case('h') |
| 1746 |
print "(/,a)",' ------- interactive mode commands (multiple plots per page) --------' |
| 1747 |
print*,' SPACE BAR (or n) : skip to next timestep/file' |
| 1748 |
print*,' 0,1,2,3..9 and click : go forward/back n timesteps (back=r.click)' |
| 1749 |
print*,' left click (or A) : zoom/select' |
| 1750 |
print*,' right click (or X or b) : previous timestep' |
| 1751 |
print*,' left click on colour bar : change rendering limits' |
| 1752 |
print*,' +/- : zoom IN/OUT (_ for out by 20%) ' |
| 1753 |
print*,' a : (a)dapt plot limits (inside box, over axes/colour bar)' |
| 1754 |
print*,' l : (l)og / unlog axis (over x/y axis or colour bar)' |
| 1755 |
print*,' o/C : re-centre plot on (o)rigin/(C)ursor position' |
| 1756 |
print*,' backspace: delete annotation (over axes/legend/title/colour bar)' |
| 1757 |
print*,' r : (r)eplot current plot' |
| 1758 |
print*,' R : (R)eset/remove all range restrictions' |
| 1759 |
print*,' g : plot a line and find its g)radient' |
| 1760 |
print*,' ctrl-t, ^: add text or arrow(^) at current position' |
| 1761 |
print*,' G/T/H : move le(G)end, (T)itle or (H) vector legend to current position' |
| 1762 |
print*,' m/M/i : change colour map (m=next,M=previous,i=invert) (rendered plots only)' |
| 1763 |
print*,' v/V/w : decrease/increase/adapt arrow size on vector plots (Z for x10)' |
| 1764 |
print*,' s : (s)ave current settings for all steps' |
| 1765 |
print*,' q/Q/esc : (q)uit plotting' |
| 1766 |
print*,' z/Z(oom) : timestepping, zoom and limits-changing multiplied by 10' |
| 1767 |
print*,'--------------------------------------------------------------------' |
| 1768 |
case('g') ! draw a line between two points |
| 1769 |
xline(2) = xpti |
| 1770 |
yline(2) = ypti |
| 1771 |
call set_panel(ipanel) |
| 1772 |
!--mark first point |
| 1773 |
call plot_pt1(xpti,ypti,4) |
| 1774 |
!--select second point |
| 1775 |
print*,' select another point (using left click or g) to plot line ' |
| 1776 |
ierr = plot_band(1,1,xline(2),yline(2),xline(3),yline(3),char2) |
| 1777 |
!--draw line if left click or g |
| 1778 |
select case(char2) |
| 1779 |
case(plot_left_click,'g') |
| 1780 |
print* |
| 1781 |
!--mark second point |
| 1782 |
call plot_pt1(xline(3),yline(3),4) |
| 1783 |
xlength = xline(3)-xline(2) |
| 1784 |
if (abs(xlength) < tiny(xlength)) then |
| 1785 |
xline(1) = xline(2) |
| 1786 |
xline(4) = xline(2) |
| 1787 |
yline(1) = xmin(iplotyarr(ipanel)) |
| 1788 |
yline(4) = xmax(iplotyarr(ipanel)) |
| 1789 |
print*,' error: gradient = infinite' |
| 1790 |
elseif (xline(2) < xline(3)) then |
| 1791 |
xline(1) = xmin(iplotxarr(ipanel)) |
| 1792 |
xline(4) = xmax(iplotxarr(ipanel)) |
| 1793 |
else |
| 1794 |
xline(1) = xmax(iplotxarr(ipanel)) |
| 1795 |
xline(4) = xmin(iplotxarr(ipanel)) |
| 1796 |
endif |
| 1797 |
ylength = yline(3)-yline(2) |
| 1798 |
dr = sqrt(xlength**2 + ylength**2) |
| 1799 |
print*,' (x1,y1) = (',xline(2),',',yline(2),')' |
| 1800 |
print*,' (x2,y2) = (',xline(3),',',yline(3),')' |
| 1801 |
print*,' dr = ',dr,' dx = ',xlength,' dy = ',ylength |
| 1802 |
if (abs(xlength) > tiny(xlength)) then |
| 1803 |
gradient = ylength/xlength |
| 1804 |
yint = yline(3) - gradient*xline(3) |
| 1805 |
print*,' gradient = ',gradient,' y intercept = ',yint |
| 1806 |
yline(1) = gradient*xline(1) + yint |
| 1807 |
yline(4) = gradient*xline(4) + yint |
| 1808 |
endif |
| 1809 |
!--plot line joining the two points |
| 1810 |
call plot_line(4,xline,yline) |
| 1811 |
call reset_panel |
| 1812 |
case default |
| 1813 |
print*,' action cancelled' |
| 1814 |
end select |
| 1815 |
case('s','S') |
| 1816 |
do i=1,size(vptxmin) |
| 1817 |
call save_limits(iplotxarr(i),xmin(iplotxarr(i)),xmax(iplotxarr(i))) |
| 1818 |
call save_limits(iplotyarr(i),xmin(iplotyarr(i)),xmax(iplotyarr(i))) |
| 1819 |
if (irenderarr(i) > 0) call save_limits(irenderarr(i),xmin(irenderarr(i)),xmax(irenderarr(i))) |
| 1820 |
if (icontourarr(i) > 0) call save_limits(icontourarr(i),xmin(icontourarr(i)),xmax(icontourarr(i))) |
| 1821 |
if (ivecarr(i) > 0) then |
| 1822 |
ivecx = iamvec(ivecarr(i)) + iplotxarr(i) - 1 |
| 1823 |
ivecy = iamvec(ivecarr(i)) + iplotyarr(i) - 1 |
| 1824 |
if (ivecx > 0) call save_limits(ivecx,-xmax(ivecx),xmax(ivecx)) |
| 1825 |
if (ivecy > 0) call save_limits(ivecy,-xmax(ivecy),xmax(ivecy)) |
| 1826 |
endif |
| 1827 |
enddo |
| 1828 |
call save_windowsize() |
| 1829 |
print*,'> interactively set limits saved <' |
| 1830 |
case(plot_left_click) ! left click |
| 1831 |
!ishape = inshape(xpt,ypt,itrans(iplotx),itrans(iploty)) |
| 1832 |
!if (ishape > 0) then |
| 1833 |
! call edit_shape(ishape,xpt,ypt,itrans(iplotx),itrans(iploty),first=.false.) |
| 1834 |
! iadvance = 0 |
| 1835 |
! interactivereplot = .true. |
| 1836 |
!! iexit = .true. |
| 1837 |
!endif |
| 1838 |
! |
| 1839 |
!--draw rectangle from the point and reset the limits |
| 1840 |
! |
| 1841 |
print*,'select area: ' |
| 1842 |
print*,'left click : zoom' |
| 1843 |
print*,'x = use particles within x parameter range only' |
| 1844 |
print*,'y = use particles within y parameter range only' |
| 1845 |
print*,'r = use particles within x and y parameter range only' |
| 1846 |
print*,'R = remove all range restrictions' |
| 1847 |
|
| 1848 |
! |
| 1849 |
!--change colour bar limits |
| 1850 |
! |
| 1851 |
if (ipanel > 0 .and. iamincolourbar .and. irenderarr(ipanel) > 0) then |
| 1852 |
print*,'click to set rendering limits' |
| 1853 |
if (verticalbar) then |
| 1854 |
ierr = plot_band(3,1,xpt,ypt,xpt2,ypt2,char2) |
| 1855 |
else |
| 1856 |
ierr = plot_band(4,1,xpt,ypt,xpt2,ypt2,char2) |
| 1857 |
endif |
| 1858 |
if (char2 == plot_left_click) then |
| 1859 |
call get_vptxy(xpt2,ypt2,vptx2i,vpty2i) |
| 1860 |
!--use centre point of first click and current click to |
| 1861 |
! better determine panel |
| 1862 |
vptxceni = 0.5*(vptxi + vptx2i) |
| 1863 |
vptyceni = 0.5*(vptyi + vpty2i) |
| 1864 |
ipanel2 = getpanel(vptxceni,vptyceni) |
| 1865 |
if (ipanel2 > 0 .and. ipanel2 /= ipanel) then |
| 1866 |
print*,'panel = ',ipanel2,' was ',ipanel |
| 1867 |
ipanel = ipanel2 |
| 1868 |
endif |
| 1869 |
call getxy(vptx2i,vpty2i,xpt2,ypt2,ipanel) |
| 1870 |
!--reset first point according to current panel |
| 1871 |
call getxy(vptxi,vptyi,xpti,ypti,ipanel) |
| 1872 |
double_render = (icontourarr(ipanel) > 0 .and. use_double_rendering) |
| 1873 |
|
| 1874 |
if (barwmulti(ipanel) > tiny(barwmulti)) then |
| 1875 |
if (double_render) then |
| 1876 |
call adjustcolourbar(iColourBarStyle,vptxi,vptyi,vptx2i,vpty2i,& |
| 1877 |
vptxmin(ipanel),vptxmax(ipanel),vptymin(ipanel),vptymax(ipanel),& |
| 1878 |
xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel))) |
| 1879 |
else |
| 1880 |
call adjustcolourbar(iColourBarStyle,vptxi,vptyi,vptx2i,vpty2i,& |
| 1881 |
vptxmin(ipanel),vptxmax(ipanel),vptymin(ipanel),vptymax(ipanel),& |
| 1882 |
xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel))) |
| 1883 |
endif |
| 1884 |
else |
| 1885 |
!--for global colour bars (ie. on tiled plots) use viewport co-ordinates to set render limits |
| 1886 |
if (double_render) then |
| 1887 |
call adjustcolourbar(iColourBarStyle,vptxi,vptyi,vptx2i,vpty2i,& |
| 1888 |
minval(vptxmin),maxval(vptxmax),minval(vptymin),maxval(vptymax),& |
| 1889 |
xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel))) |
| 1890 |
else |
| 1891 |
call adjustcolourbar(iColourBarStyle,vptxi,vptyi,vptx2i,vpty2i,& |
| 1892 |
minval(vptxmin),maxval(vptxmax),minval(vptymin),maxval(vptymax),& |
| 1893 |
xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel))) |
| 1894 |
endif |
| 1895 |
endif |
| 1896 |
if (double_render) then |
| 1897 |
print*,'setting double-render min, max = ',xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel)) |
| 1898 |
else |
| 1899 |
print*,'setting render min, max = ',xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel)) |
| 1900 |
endif |
| 1901 |
istep = istepnew |
| 1902 |
interactivereplot = .true. |
| 1903 |
iexit = .true. |
| 1904 |
endif |
| 1905 |
else |
| 1906 |
ierr = plot_band(2,1,xpt,ypt,xpt2,ypt2,char2) |
| 1907 |
!call pgrect(xpt,xpt2,ypt,ypt2) |
| 1908 |
call get_vptxy(xpt2,ypt2,vptx2i,vpty2i) |
| 1909 |
!--use centre point of first click and current click to |
| 1910 |
! better determine panel |
| 1911 |
vptxceni = 0.5*(vptxi + vptx2i) |
| 1912 |
vptyceni = 0.5*(vptyi + vpty2i) |
| 1913 |
ipanel2 = getpanel(vptxceni,vptyceni) |
| 1914 |
if (ipanel2 > 0 .and. ipanel2 /= ipanel) then |
| 1915 |
ipanel = ipanel2 |
| 1916 |
print*,'panel = ',ipanel |
| 1917 |
endif |
| 1918 |
if (ipanel <= 0) cycle interactive_loop |
| 1919 |
call getxy(vptx2i,vpty2i,xpt2,ypt2,ipanel) |
| 1920 |
!--reset first point according to current panel |
| 1921 |
call getxy(vptxi,vptyi,xpti,ypti,ipanel) |
| 1922 |
xptmin = min(xpti,xpt2) |
| 1923 |
xptmax = max(xpti,xpt2) |
| 1924 |
yptmin = min(ypti,ypt2) |
| 1925 |
yptmax = max(ypti,ypt2) |
| 1926 |
|
| 1927 |
select case (char2) |
| 1928 |
case(plot_left_click) ! zoom if another left click |
| 1929 |
xmin(iplotxarr(ipanel)) = xptmin |
| 1930 |
xmax(iplotxarr(ipanel)) = xptmax |
| 1931 |
xmin(iplotyarr(ipanel)) = yptmin |
| 1932 |
xmax(iplotyarr(ipanel)) = yptmax |
| 1933 |
print*,'setting limits: xmin = ',xmin(iplotxarr(ipanel)),' xmax = ',xmax(iplotxarr(ipanel)) |
| 1934 |
istep = istepnew |
| 1935 |
interactivereplot = .true. |
| 1936 |
iexit = .true. |
| 1937 |
case('x') |
| 1938 |
call restrict_range(iplotxarr(ipanel),xptmin,xptmax) |
| 1939 |
istep = istepnew |
| 1940 |
interactivereplot = .true. |
| 1941 |
iexit = .true. |
| 1942 |
case('y') |
| 1943 |
call restrict_range(iplotyarr(ipanel),yptmin,yptmax) |
| 1944 |
istep = istepnew |
| 1945 |
interactivereplot = .true. |
| 1946 |
iexit = .true. |
| 1947 |
case('r') |
| 1948 |
call restrict_range(iplotxarr(ipanel),xptmin,xptmax) |
| 1949 |
call restrict_range(iplotyarr(ipanel),yptmin,yptmax) |
| 1950 |
istep = istepnew |
| 1951 |
interactivereplot = .true. |
| 1952 |
iexit = .true. |
| 1953 |
case('R') |
| 1954 |
call reset_ranges |
| 1955 |
istep = istepnew |
| 1956 |
interactivereplot = .true. |
| 1957 |
iexit = .true. |
| 1958 |
case default |
| 1959 |
print*,' action cancelled' |
| 1960 |
end select |
| 1961 |
endif |
| 1962 |
! |
| 1963 |
!--zooming |
| 1964 |
! |
| 1965 |
case('-','_','+','o','C') ! zoom in/out |
| 1966 |
if (ipanel <= 0) cycle interactive_loop |
| 1967 |
xlength = xmax(iplotxarr(ipanel)) - xmin(iplotxarr(ipanel)) |
| 1968 |
ylength = xmax(iplotyarr(ipanel)) - xmin(iplotyarr(ipanel)) |
| 1969 |
xcen = 0.5*(xmax(iplotxarr(ipanel)) + xmin(iplotxarr(ipanel))) |
| 1970 |
ycen = 0.5*(xmax(iplotyarr(ipanel)) + xmin(iplotyarr(ipanel))) |
| 1971 |
if (irenderarr(ipanel) > 0) then |
| 1972 |
renderlength = xmax(irenderarr(ipanel)) - xmin(irenderarr(ipanel)) |
| 1973 |
else |
| 1974 |
renderlength = 0. |
| 1975 |
endif |
| 1976 |
if (icontourarr(ipanel) > 0) then |
| 1977 |
contlength = xmax(icontourarr(ipanel)) - xmin(icontourarr(ipanel)) |
| 1978 |
else |
| 1979 |
contlength = 0. |
| 1980 |
endif |
| 1981 |
select case(char) |
| 1982 |
case('-') |
| 1983 |
xlength = zoomfac*scalefac*xlength |
| 1984 |
ylength = zoomfac*scalefac*ylength |
| 1985 |
renderlength = zoomfac*scalefac*renderlength |
| 1986 |
contlength = zoomfac*scalefac*contlength |
| 1987 |
case('_') |
| 1988 |
xlength = 1.2*zoomfac*scalefac*xlength |
| 1989 |
ylength = 1.2*zoomfac*scalefac*ylength |
| 1990 |
renderlength = 1.2*zoomfac*scalefac*renderlength |
| 1991 |
contlength = 1.2*zoomfac*scalefac*contlength |
| 1992 |
case('+') |
| 1993 |
xlength = xlength/(zoomfac*scalefac) |
| 1994 |
ylength = ylength/(zoomfac*scalefac) |
| 1995 |
renderlength = renderlength/(zoomfac*scalefac) |
| 1996 |
contlength = contlength/(zoomfac*scalefac) |
| 1997 |
case('o') |
| 1998 |
if (is_coord(iplotxarr(ipanel),ndim)) then |
| 1999 |
xcen = xorigin(iplotxarr(ipanel)) |
| 2000 |
else |
| 2001 |
xcen = 0. |
| 2002 |
endif |
| 2003 |
if (is_coord(iplotyarr(ipanel),ndim)) then |
| 2004 |
ycen = xorigin(iplotyarr(ipanel)) |
| 2005 |
else |
| 2006 |
ycen = 0. |
| 2007 |
endif |
| 2008 |
print*,' centreing plot on origin x,y = ',xcen,ycen |
| 2009 |
case('C') |
| 2010 |
xcen = xpti |
| 2011 |
ycen = ypti |
| 2012 |
end select |
| 2013 |
xmaxin = xmax(iplotxarr(ipanel)) |
| 2014 |
if (iamincolourbar .and. irenderarr(ipanel) > 0) then |
| 2015 |
if (double_render) then |
| 2016 |
!--rendering zoom does not allow pan - renderpt is always centre of axis |
| 2017 |
renderpt = 0.5*(xmin(icontourarr(ipanel)) + xmax(icontourarr(ipanel))) |
| 2018 |
xmin(icontourarr(ipanel)) = renderpt - 0.5*contlength |
| 2019 |
xmax(icontourarr(ipanel)) = renderpt + 0.5*contlength |
| 2020 |
call assert_sensible_limits(xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel))) |
| 2021 |
!print*,'zooming on colour bar: min, max = ',xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel)) |
| 2022 |
else |
| 2023 |
!--rendering zoom does not allow pan - renderpt is always centre of axis |
| 2024 |
renderpt = 0.5*(xmin(irenderarr(ipanel)) + xmax(irenderarr(ipanel))) |
| 2025 |
xmin(irenderarr(ipanel)) = renderpt - 0.5*renderlength |
| 2026 |
xmax(irenderarr(ipanel)) = renderpt + 0.5*renderlength |
| 2027 |
call assert_sensible_limits(xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel))) |
| 2028 |
!print*,'zooming on colour bar: min, max = ',xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel)) |
| 2029 |
endif |
| 2030 |
istep = istepnew |
| 2031 |
interactivereplot = .true. |
| 2032 |
iexit = .true. |
| 2033 |
else |
| 2034 |
if (xpti >= xmin(iplotxarr(ipanel)) .and. xpti <= xmax(iplotxarr(ipanel)) .and. ypti <= xmax(iplotyarr(ipanel))) then |
| 2035 |
xmin(iplotxarr(ipanel)) = xcen - 0.5*xlength |
| 2036 |
xmax(iplotxarr(ipanel)) = xcen + 0.5*xlength |
| 2037 |
call assert_sensible_limits(xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel))) |
| 2038 |
!print*,'zooming on x axis: min, max = ',xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)) |
| 2039 |
istep = istepnew |
| 2040 |
interactivereplot = .true. |
| 2041 |
iexit = .true. |
| 2042 |
endif |
| 2043 |
if (ypti >= xmin(iplotyarr(ipanel)) .and. ypti <= xmax(iplotyarr(ipanel)) .and. xpti <= xmaxin) then |
| 2044 |
xmin(iplotyarr(ipanel)) = ycen - 0.5*ylength |
| 2045 |
xmax(iplotyarr(ipanel)) = ycen + 0.5*ylength |
| 2046 |
call assert_sensible_limits(xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 2047 |
!print*,'zooming on y axis: min, max = ',xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel)) |
| 2048 |
istep = istepnew |
| 2049 |
interactivereplot = .true. |
| 2050 |
iexit = .true. |
| 2051 |
endif |
| 2052 |
endif |
| 2053 |
|
| 2054 |
case('a') ! adapt plot limits |
| 2055 |
if (iamincolourbar .and. irenderarr(ipanel) > 0) then |
| 2056 |
if (double_render) then |
| 2057 |
!print*,'adapting double-render limits ',xminadapt(icontourarr(ipanel)),xmaxadapt(icontourarr(ipanel)) |
| 2058 |
xmin(icontourarr(ipanel)) = xminadapt(icontourarr(ipanel)) |
| 2059 |
xmax(icontourarr(ipanel)) = xmaxadapt(icontourarr(ipanel)) |
| 2060 |
call assert_sensible_limits(xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel))) |
| 2061 |
else |
| 2062 |
!print*,'adapting render limits ',xminadapt(irenderarr(ipanel)),xmaxadapt(irenderarr(ipanel)) |
| 2063 |
xmax(irenderarr(ipanel)) = xmaxadapt(irenderarr(ipanel)) |
| 2064 |
if (itrans(irenderarr(ipanel))==1 .and. & |
| 2065 |
xminadapt(irenderarr(ipanel)) < xmaxadapt(irenderarr(ipanel))-5.) then ! if logged |
| 2066 |
if (abs(xmin(irenderarr(ipanel))-(xmaxadapt(irenderarr(ipanel)) - 4.)) > epsilon(0.)) then |
| 2067 |
xmin(irenderarr(ipanel)) = xmaxadapt(irenderarr(ipanel)) - 4. |
| 2068 |
print "(a)",' *** MIN SET 4 DEX FROM MAX, PRESS ''a'' AGAIN TO GIVE FULL RANGE ***' |
| 2069 |
else |
| 2070 |
xmin(irenderarr(ipanel)) = xminadapt(irenderarr(ipanel)) |
| 2071 |
endif |
| 2072 |
else |
| 2073 |
xmin(irenderarr(ipanel)) = xminadapt(irenderarr(ipanel)) |
| 2074 |
endif |
| 2075 |
call assert_sensible_limits(xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel))) |
| 2076 |
endif |
| 2077 |
istep = istepnew |
| 2078 |
interactivereplot = .true. |
| 2079 |
iexit = .true. |
| 2080 |
else |
| 2081 |
!--save xmax before we go changing it so can check the y axis |
| 2082 |
xmaxin = xmax(iplotxarr(ipanel)) |
| 2083 |
if (xpti >= xmin(iplotxarr(ipanel)) .and. xpti <= xmax(iplotxarr(ipanel)) & |
| 2084 |
.and. ypti <= xmax(iplotyarr(ipanel))) then |
| 2085 |
print*,'adapting x limits ',xminadapt(iplotxarr(ipanel)),xmaxadapt(iplotxarr(ipanel)) |
| 2086 |
xmin(iplotxarr(ipanel)) = xminadapt(iplotxarr(ipanel)) |
| 2087 |
xmax(iplotxarr(ipanel)) = xmaxadapt(iplotxarr(ipanel)) |
| 2088 |
call assert_sensible_limits(xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel))) |
| 2089 |
istep = istepnew |
| 2090 |
interactivereplot = .true. |
| 2091 |
iexit = .true. |
| 2092 |
endif |
| 2093 |
if (ypti >= xmin(iplotyarr(ipanel)) .and. ypti <= xmax(iplotyarr(ipanel)) & |
| 2094 |
.and. xpti <= xmaxin) then |
| 2095 |
print*,'adapting y limits ',xminadapt(iplotyarr(ipanel)),xmaxadapt(iplotyarr(ipanel)) |
| 2096 |
xmin(iplotyarr(ipanel)) = xminadapt(iplotyarr(ipanel)) |
| 2097 |
xmax(iplotyarr(ipanel)) = xmaxadapt(iplotyarr(ipanel)) |
| 2098 |
call assert_sensible_limits(xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 2099 |
istep = istepnew |
| 2100 |
interactivereplot = .true. |
| 2101 |
iexit = .true. |
| 2102 |
endif |
| 2103 |
endif |
| 2104 |
! |
| 2105 |
!--zoom in/out on vector plots (arrow size) |
| 2106 |
! |
| 2107 |
case('v') |
| 2108 |
if (ivecarr(ipanel) > 0) then |
| 2109 |
!print*,'decreasing vector arrow size' |
| 2110 |
xmax(ivecarr(ipanel)) = zoomfac*scalefac*xmax(ivecarr(ipanel)) |
| 2111 |
istep = istepnew |
| 2112 |
interactivereplot = .true. |
| 2113 |
iexit = .true. |
| 2114 |
endif |
| 2115 |
case('V') |
| 2116 |
if (ivecarr(ipanel) > 0) then |
| 2117 |
!print*,'increasing vector arrow size' |
| 2118 |
xmax(ivecarr(ipanel)) = xmax(ivecarr(ipanel))/(zoomfac*scalefac) |
| 2119 |
istep = istepnew |
| 2120 |
interactivereplot = .true. |
| 2121 |
iexit = .true. |
| 2122 |
endif |
| 2123 |
case('w','W') |
| 2124 |
if (ivecarr(ipanel) > 0) then |
| 2125 |
!print*,'adapting vector arrow size' |
| 2126 |
xmax(ivecarr(ipanel)) = -1.0 |
| 2127 |
istep = istepnew |
| 2128 |
interactivereplot = .true. |
| 2129 |
iexit = .true. |
| 2130 |
endif |
| 2131 |
! |
| 2132 |
!--set/unset log axes |
| 2133 |
! |
| 2134 |
case('l') |
| 2135 |
! |
| 2136 |
!--change colour bar, y and x itrans between log / not logged |
| 2137 |
! |
| 2138 |
if (iamincolourbar .and. irenderarr(ipanel) > 0) then |
| 2139 |
if (double_render) then |
| 2140 |
call change_itrans2(icontourarr(ipanel),xmin(icontourarr(ipanel)),xmax(icontourarr(ipanel)),& |
| 2141 |
xminadapt(icontourarr(ipanel)),xmaxadapt(icontourarr(ipanel))) |
| 2142 |
else |
| 2143 |
call change_itrans2(irenderarr(ipanel),xmin(irenderarr(ipanel)),xmax(irenderarr(ipanel)),& |
| 2144 |
xminadapt(irenderarr(ipanel)),xmaxadapt(irenderarr(ipanel))) |
| 2145 |
endif |
| 2146 |
istep = istepnew |
| 2147 |
interactivereplot = .true. |
| 2148 |
iexit = .true. |
| 2149 |
elseif (xpti < xmin(iplotxarr(ipanel))) then |
| 2150 |
if (is_coord(iplotyarr(ipanel),ndim) .and. irenderarr(ipanel) > 0) then |
| 2151 |
print "(a)",'error: cannot log coordinate axes with rendering' |
| 2152 |
else |
| 2153 |
call change_itrans2(iplotyarr(ipanel),xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel)),& |
| 2154 |
xminadapt(iplotyarr(ipanel)),xmaxadapt(iplotyarr(ipanel))) |
| 2155 |
istep = istepnew |
| 2156 |
interactivereplot = .true. |
| 2157 |
iexit = .true. |
| 2158 |
endif |
| 2159 |
elseif (ypti < xmin(iplotyarr(ipanel))) then |
| 2160 |
if (is_coord(iplotxarr(ipanel),ndim) .and. irenderarr(ipanel) > 0) then |
| 2161 |
print "(a)",'error: cannot log coordinate axes with rendering' |
| 2162 |
else |
| 2163 |
call change_itrans2(iplotxarr(ipanel),xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)),& |
| 2164 |
xminadapt(iplotxarr(ipanel)),xmaxadapt(iplotxarr(ipanel))) |
| 2165 |
istep = istepnew |
| 2166 |
interactivereplot = .true. |
| 2167 |
iexit = .true. |
| 2168 |
endif |
| 2169 |
endif |
| 2170 |
! |
| 2171 |
!--reset all range restrictions |
| 2172 |
! |
| 2173 |
case('R') |
| 2174 |
call reset_ranges |
| 2175 |
interactivereplot = .true. |
| 2176 |
istep = istepnew |
| 2177 |
iexit = .true. |
| 2178 |
! |
| 2179 |
!--general plot stuff |
| 2180 |
! |
| 2181 |
case('G') ! move legend here |
| 2182 |
print*,'setting legend position to current location...' |
| 2183 |
if (ipanel > 0) then |
| 2184 |
call mvlegend(xpti,ypti,xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)),xmax(iplotyarr(ipanel)),ipanel) |
| 2185 |
istep = istepnew |
| 2186 |
interactivereplot = .true. |
| 2187 |
iexit = .true. |
| 2188 |
endif |
| 2189 |
case('T') ! move title here |
| 2190 |
if (ipanel > 0) then |
| 2191 |
print*,'setting title position to current location...' |
| 2192 |
call mvtitle(xpti,ypti,xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 2193 |
istep = istepnew |
| 2194 |
interactivereplot = .true. |
| 2195 |
iexit = .true. |
| 2196 |
endif |
| 2197 |
case('H') ! move vector legend here |
| 2198 |
if (ipanel > 0) then |
| 2199 |
if (ivecarr(ipanel) > 0) then |
| 2200 |
print*,'setting vector plot legend to current location...' |
| 2201 |
call mvlegendvec(xpti,ypti,xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 2202 |
istep = istepnew |
| 2203 |
interactivereplot = .true. |
| 2204 |
iexit = .true. |
| 2205 |
endif |
| 2206 |
endif |
| 2207 |
case('m') ! change colour map (next scheme) |
| 2208 |
call change_colourmap(icolourscheme,1) |
| 2209 |
istep = istepnew |
| 2210 |
interactivereplot = .true. |
| 2211 |
iexit = .true. |
| 2212 |
case('M') ! change colour map (previous scheme) |
| 2213 |
call change_colourmap(icolourscheme,-1) |
| 2214 |
istep = istepnew |
| 2215 |
interactivereplot = .true. |
| 2216 |
iexit = .true. |
| 2217 |
case('i') ! invert colour map |
| 2218 |
icolourscheme = -icolourscheme |
| 2219 |
call change_colourmap(icolourscheme,0) |
| 2220 |
istep = istepnew |
| 2221 |
interactivereplot = .true. |
| 2222 |
iexit = .true. |
| 2223 |
case('^') ! add arrow shape |
| 2224 |
call set_panel(ipanel) |
| 2225 |
print*,' adding arrow in panel ',ipanel |
| 2226 |
call add_shape_interactive(xpti,ypti,itrans(iplotxarr(ipanel)),itrans(iplotyarr(ipanel)),ipanel,ierr,shape_type=3) |
| 2227 |
if (ierr==0) then |
| 2228 |
istep = istepnew |
| 2229 |
interactivereplot = .true. |
| 2230 |
iexit = .true. |
| 2231 |
endif |
| 2232 |
case(achar(20)) ! add text shape |
| 2233 |
call set_panel(ipanel) |
| 2234 |
print*,' adding text in panel ',ipanel |
| 2235 |
call add_shape_interactive(xpti,ypti,itrans(iplotxarr(ipanel)),itrans(iplotyarr(ipanel)),ipanel,ierr) |
| 2236 |
if (ierr==0) then |
| 2237 |
istep = istepnew |
| 2238 |
interactivereplot = .true. |
| 2239 |
iexit = .true. |
| 2240 |
endif |
| 2241 |
case(achar(8)) ! delete plot annotation / colour bar (backspace) |
| 2242 |
ishape = inshape(xpti,ypti,itrans(iplotxarr(ipanel)),itrans(iplotxarr(ipanel)),& |
| 2243 |
xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)),& |
| 2244 |
xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 2245 |
if (ishape > 0) then |
| 2246 |
call delete_shape(ishape,nshapes) |
| 2247 |
istep = istepnew |
| 2248 |
interactivereplot = .true. |
| 2249 |
iexit = .true. |
| 2250 |
elseif (iamincolourbar .and. irenderarr(ipanel) > 0) then |
| 2251 |
iColourBarStyle = 0 |
| 2252 |
istep = istepnew |
| 2253 |
interactivereplot = .true. |
| 2254 |
iexit = .true. |
| 2255 |
elseif (xpti < xmin(iplotxarr(ipanel)) .or. xpti > xmax(iplotxarr(ipanel)) & |
| 2256 |
.or. ypti < xmin(iplotyarr(ipanel)) .or. ypti > xmax(iplotyarr(ipanel))) then |
| 2257 |
call deleteaxes() |
| 2258 |
istep = istepnew |
| 2259 |
interactivereplot = .true. |
| 2260 |
iexit = .true. |
| 2261 |
else |
| 2262 |
ilegend = in_legend(xpt,ypt) |
| 2263 |
if (legend_is_plotted(ilegend)) then |
| 2264 |
call delete_legend(ilegend) |
| 2265 |
iadvance = 0 |
| 2266 |
interactivereplot = .true. |
| 2267 |
iexit = .true. |
| 2268 |
else |
| 2269 |
print*,' nothing to delete at x,y =',xpti,',',ypti |
| 2270 |
endif |
| 2271 |
endif |
| 2272 |
|
| 2273 |
! |
| 2274 |
!--timestepping |
| 2275 |
! |
| 2276 |
case('q','Q',achar(27),achar(3)) |
| 2277 |
iadvance = -666 |
| 2278 |
print*,'quitting...' |
| 2279 |
iexit = .true. |
| 2280 |
case('X','b','B') ! right click -> go back |
| 2281 |
! iadvance = -abs(iadvance) |
| 2282 |
istep = istepin - (istepjump)*istepsonpage - iadvance*istepsonpage |
| 2283 |
lastpanel = 0 |
| 2284 |
iexit = .true. |
| 2285 |
case('r') ! replot |
| 2286 |
interactivereplot = .true. |
| 2287 |
istep = istepnew |
| 2288 |
iexit = .true. |
| 2289 |
case(' ','n','N') ! space |
| 2290 |
!iadvance = abs(iadvance) |
| 2291 |
istep = istepin + (istepjump-1)*istepsonpage |
| 2292 |
lastpanel = 0 |
| 2293 |
iexit = .true. |
| 2294 |
case('0','1','2','3','4','5','6','7','8','9') |
| 2295 |
read(char,*,iostat=ierr) istepjumpnew |
| 2296 |
if (ierr /=0) then |
| 2297 |
print*,'*** internal error setting timestep jump' |
| 2298 |
istepjumpnew = 1 |
| 2299 |
endif |
| 2300 |
if ((istepjump > 1 .or. istepjumpset) .and. istepjump <= 9999) then |
| 2301 |
istepjump = 10*istepjump + istepjumpnew |
| 2302 |
if (istepjump > 9999) istepjump = 1 |
| 2303 |
elseif (istepjumpnew==0) then |
| 2304 |
istepjump = 10 |
| 2305 |
else |
| 2306 |
istepjump = istepjumpnew |
| 2307 |
endif |
| 2308 |
istepjump = int(zoomfac*istepjump) |
| 2309 |
print*,' setting timestep jump / zoom factor = ',istepjump |
| 2310 |
istepjumpset = .true. |
| 2311 |
scalefac = istepjump |
| 2312 |
case(')') |
| 2313 |
istepjump = int(zoomfac*10) |
| 2314 |
print*,' setting timestep jump = ',istepjump |
| 2315 |
! |
| 2316 |
!--multiply everything by a factor of 10 |
| 2317 |
! |
| 2318 |
case('z','Z') |
| 2319 |
zoomfac = 10.*zoomfac |
| 2320 |
if (zoomfac > 1000000.) then |
| 2321 |
zoomfac = 1.0 |
| 2322 |
endif |
| 2323 |
print*,' LIMITS/TIMESTEPPING CHANGES NOW x ',zoomfac |
| 2324 |
! |
| 2325 |
!--unknown |
| 2326 |
! |
| 2327 |
case default |
| 2328 |
print*,' x, y = ',xpti,ypti,'; unknown option "',trim(char),'" ',iachar(char) |
| 2329 |
end select |
| 2330 |
|
| 2331 |
! |
| 2332 |
!--save cursor position relative to the viewport |
| 2333 |
! |
| 2334 |
call get_vptxy(xpt,ypt,xcursor,ycursor) |
| 2335 |
call reset_panel |
| 2336 |
|
| 2337 |
! |
| 2338 |
!--do not let timestep go outside of bounds |
| 2339 |
! if we are at the first/last step, just print message and do nothing |
| 2340 |
! if iadvance trips over the bounds, jump to last/first step |
| 2341 |
! |
| 2342 |
if (iadvance /= -666 .and. iexit) then |
| 2343 |
if (istep + iadvance > ilaststep .and. iframe==nframes) then |
| 2344 |
print "(1x,a)",'reached last timestep' |
| 2345 |
if (istepin /= ilaststep) then |
| 2346 |
istep = ilaststep - istepsonpage*iadvance |
| 2347 |
else |
| 2348 |
istep = istepin |
| 2349 |
iexit = .false. |
| 2350 |
endif |
| 2351 |
elseif (istep + iadvance < 1 .and. ifirstframeonpage==1) then |
| 2352 |
print "(1x,a)",'reached first timestep: can''t go back' |
| 2353 |
if (ifirststeponpage /= 1) then |
| 2354 |
istep = 1 - iadvance |
| 2355 |
else |
| 2356 |
istep = istepin |
| 2357 |
iexit = .false. |
| 2358 |
endif |
| 2359 |
endif |
| 2360 |
endif |
| 2361 |
enddo interactive_loop |
| 2362 |
return |
| 2363 |
|
| 2364 |
contains |
| 2365 |
|
| 2366 |
!-------- |
| 2367 |
! utility to return which panel we are in given a point on the viewport |
| 2368 |
! and the viewport limits for each panel. |
| 2369 |
!-------- |
| 2370 |
integer function getpanel(vptx,vpty) |
| 2371 |
real, intent(in) :: vptx,vpty |
| 2372 |
real :: vptxmini,vptxmaxi,vptymini,vptymaxi |
| 2373 |
integer :: i,icol |
| 2374 |
|
| 2375 |
getpanel = 0 |
| 2376 |
! |
| 2377 |
! first try the basic procedure of checking if the |
| 2378 |
! cursor falls within the viewport of a particular panel |
| 2379 |
! |
| 2380 |
do i=1,size(vptxmin) |
| 2381 |
if (vptx > vptxmin(i) .and. vptx < vptxmax(i) .and. & |
| 2382 |
vpty > vptymin(i) .and. vpty < vptymax(i)) getpanel = i |
| 2383 |
enddo |
| 2384 |
! |
| 2385 |
! if this fails, use more generous limits around the margins |
| 2386 |
! |
| 2387 |
icol = 0 |
| 2388 |
if (getpanel==0) then |
| 2389 |
do i=1,size(vptxmin) |
| 2390 |
icol = icol + 1 |
| 2391 |
if (icol > nacross) icol = 1 |
| 2392 |
if (icol > 1 .and. i > 1) then |
| 2393 |
! if column>1 assign panel by being to the right of previous panel |
| 2394 |
vptxmini = vptxmax(i-1)+barwmulti(i-1) |
| 2395 |
else |
| 2396 |
vptxmini = -0.1 ! allow for some error |
| 2397 |
endif |
| 2398 |
!--if last column extend xmax to right of page |
| 2399 |
if (icol==nacross) then |
| 2400 |
vptxmaxi = 1.1 |
| 2401 |
elseif (verticalbar) then ! otherwise use max of current panel + space containing the colour bar |
| 2402 |
vptxmaxi = vptxmax(i) + barwmulti(i) |
| 2403 |
else |
| 2404 |
vptxmaxi = vptxmax(i) |
| 2405 |
endif |
| 2406 |
|
| 2407 |
!--if first row extend ymax to top of page |
| 2408 |
if (i <= nacross) then |
| 2409 |
vptymaxi = 1.1 |
| 2410 |
else |
| 2411 |
vptymaxi = vptymax(i) |
| 2412 |
endif |
| 2413 |
!--if last row then allow ymin to extend to bottom of page |
| 2414 |
if (i > (size(vptxmin)-nacross)) then |
| 2415 |
vptymini = -0.1 |
| 2416 |
! if not last row assign panel by being above row below |
| 2417 |
elseif (i+nacross <= size(vptxmin)) then |
| 2418 |
vptymini = vptymax(i+nacross) |
| 2419 |
elseif (.not.verticalbar) then |
| 2420 |
vptymini = vptymin(i) - barwmulti(i) |
| 2421 |
else |
| 2422 |
vptymini = vptymin(i) |
| 2423 |
endif |
| 2424 |
if (vptx > vptxmini .and. vptx < vptxmaxi .and. & |
| 2425 |
vpty > vptymini .and. vpty < vptymaxi) then |
| 2426 |
!print*,'matching panel ',i,vptx,vpty,vptxmini,vptxmaxi,vptymini,vptymaxi |
| 2427 |
!if (getpanel /= 0) print*,'Warning: multiple matching panels found ',getpanel,i,vptx,vpty |
| 2428 |
getpanel = i |
| 2429 |
endif |
| 2430 |
enddo |
| 2431 |
endif |
| 2432 |
! |
| 2433 |
! if we still fail, just take the last panel |
| 2434 |
! |
| 2435 |
if (getpanel <= 0 .or. getpanel > size(vptxmin)) then |
| 2436 |
!print*,' vptx,y = ',vptx,vpty,vptxmin(:),vptxmax(:) |
| 2437 |
!print*,'Error determining panel: assuming last ' |
| 2438 |
getpanel = size(vptxmin) |
| 2439 |
endif |
| 2440 |
|
| 2441 |
end function getpanel |
| 2442 |
|
| 2443 |
!-------- |
| 2444 |
! utility to return x,y coordinates in a given panel given viewport coords |
| 2445 |
!-------- |
| 2446 |
|
| 2447 |
subroutine getxy(vptx,vpty,x,y,ipanel) |
| 2448 |
real, intent(in) :: vptx,vpty |
| 2449 |
real, intent(out) :: x,y |
| 2450 |
integer, intent(in) :: ipanel |
| 2451 |
|
| 2452 |
if (ipanel > 0) then |
| 2453 |
x = xmin(iplotxarr(ipanel)) + (vptx-vptxmin(ipanel))/(vptxmax(ipanel)-vptxmin(ipanel)) & |
| 2454 |
*(xmax(iplotxarr(ipanel))-xmin(iplotxarr(ipanel))) |
| 2455 |
y = xmin(iplotyarr(ipanel)) + (vpty-vptymin(ipanel))/(vptymax(ipanel)-vptymin(ipanel)) & |
| 2456 |
*(xmax(iplotyarr(ipanel))-xmin(iplotyarr(ipanel))) |
| 2457 |
else |
| 2458 |
x = 0. |
| 2459 |
y = 0. |
| 2460 |
endif |
| 2461 |
|
| 2462 |
return |
| 2463 |
end subroutine getxy |
| 2464 |
|
| 2465 |
!--- |
| 2466 |
! utility which translates between world co-ordinates (x,y) |
| 2467 |
! and viewport co-ordinates (relative to the whole viewport) |
| 2468 |
!--- |
| 2469 |
!subroutine get_vptxy(x,y,vptx,vpty,ipanel) |
| 2470 |
! implicit none |
| 2471 |
! real, intent(in) :: x,y |
| 2472 |
! real, intent(out) :: vptx,vpty |
| 2473 |
! integer, intent(in) :: ipanel |
| 2474 |
! |
| 2475 |
! if (ipanel > 0) then |
| 2476 |
! vptx = vptxmin(ipanel) + (x-xmin(iplotxarr(ipanel)))/& |
| 2477 |
! (xmax(iplotxarr(ipanel))-xmin(iplotxarr(ipanel)))*(vptxmax(ipanel)-vptxmini(ipanel)) |
| 2478 |
! vpty = vptymin(ipanel) + (y-xmin(iplotyarr(ipanel)))/&(xmax(iplotyarr(ipanel))-xmin(iplotyarr(ipanel)))*(vptymax(ipanel)-vptymini(ipanel)) |
| 2479 |
! else |
| 2480 |
! vptx = 0.5 |
| 2481 |
! vpty = 0.5 |
| 2482 |
! endif |
| 2483 |
! |
| 2484 |
!end subroutine get_vptxy |
| 2485 |
|
| 2486 |
|
| 2487 |
!-------- |
| 2488 |
! utility to reset the drawing surface so we can draw in a panel |
| 2489 |
!-------- |
| 2490 |
|
| 2491 |
subroutine set_panel(ipanel) |
| 2492 |
use plotlib, only:plot_svp,plot_swin |
| 2493 |
integer, intent(in) :: ipanel |
| 2494 |
|
| 2495 |
if (ipanel > 0) then |
| 2496 |
call plot_swin(xmin(iplotxarr(ipanel)),xmax(iplotxarr(ipanel)),xmin(iplotyarr(ipanel)),xmax(iplotyarr(ipanel))) |
| 2497 |
!--really should save viewport setting here, but doesn't matter |
| 2498 |
! so long as interactive mode is the last thing called |
| 2499 |
call plot_svp(vptxmin(ipanel),vptxmax(ipanel),vptymin(ipanel),vptymax(ipanel)) |
| 2500 |
endif |
| 2501 |
|
| 2502 |
return |
| 2503 |
end subroutine set_panel |
| 2504 |
|
| 2505 |
subroutine reset_panel |
| 2506 |
use plotlib, only:plot_swin |
| 2507 |
|
| 2508 |
call plot_swin(xmini,xmaxi,ymini,ymaxi) |
| 2509 |
|
| 2510 |
end subroutine reset_panel |
| 2511 |
|
| 2512 |
end subroutine interactive_multi |
| 2513 |
|
| 2514 |
!-------------------------------------------------------------------- |
| 2515 |
! utilities to determine whether a point is in or out of a selection |
| 2516 |
!-------------------------------------------------------------------- |
| 2517 |
logical function inslice(x,xmin,xmax) |
| 2518 |
real, intent(in) :: x,xmin,xmax |
| 2519 |
|
| 2520 |
inslice = (x >= xmin .and. x <= xmax) |
| 2521 |
|
| 2522 |
end function inslice |
| 2523 |
|
| 2524 |
logical function inrectangle(x,y,xmin,xmax,ymin,ymax) |
| 2525 |
real, intent(in) :: x,y,xmin,xmax,ymin,ymax |
| 2526 |
|
| 2527 |
inrectangle = (x >= xmin .and. x <= xmax .and. y >= ymin .and. y <= ymax) |
| 2528 |
|
| 2529 |
end function inrectangle |
| 2530 |
|
| 2531 |
logical function incircle(x,y,r2) |
| 2532 |
real, intent(in) :: x,y,r2 |
| 2533 |
|
| 2534 |
incircle = ((x*x + y*y) <= r2) |
| 2535 |
|
| 2536 |
end function incircle |
| 2537 |
|
| 2538 |
! |
| 2539 |
! Point in polygon |
| 2540 |
! See: http://en.wikipedia.org/wiki/Even-odd_rule |
| 2541 |
! |
| 2542 |
logical function inpoly(x,y,xpts,ypts,npts) |
| 2543 |
real, intent(in) :: x,y |
| 2544 |
real, dimension(:), intent(in) :: xpts,ypts |
| 2545 |
integer, intent(in) :: npts |
| 2546 |
integer :: i,j |
| 2547 |
|
| 2548 |
inpoly = .false. |
| 2549 |
j = npts |
| 2550 |
do i=1,npts |
| 2551 |
if (((ypts(i) > y) .neqv. (ypts(j) > y)) .and. & |
| 2552 |
(x < (xpts(j) - xpts(i))*(y-ypts(i))/(ypts(j) - ypts(i)) + xpts(i))) then |
| 2553 |
inpoly = .not. inpoly |
| 2554 |
endif |
| 2555 |
j = i |
| 2556 |
enddo |
| 2557 |
|
| 2558 |
end function inpoly |
| 2559 |
|
| 2560 |
!------------------------------------------------------------ |
| 2561 |
! utility which adapts plot limits based only on the |
| 2562 |
! particles being plotted |
| 2563 |
!------------------------------------------------------------ |
| 2564 |
subroutine adapt_limits_interactive(labeli,np,xarr,xmin,xmax,icolourpart,iamtype,iusetype) |
| 2565 |
use params, only:int1 |
| 2566 |
use limits, only:assert_sensible_limits |
| 2567 |
character(len=*), intent(in) :: labeli |
| 2568 |
integer, intent(in) :: np |
| 2569 |
real, dimension(np), intent(in) :: xarr |
| 2570 |
real, intent(out) :: xmin,xmax |
| 2571 |
integer(kind=int1), dimension(:) , intent(in) :: iamtype |
| 2572 |
integer, dimension(np), intent(in) :: icolourpart |
| 2573 |
logical, dimension(:), intent(in) :: iusetype |
| 2574 |
integer :: itype,i |
| 2575 |
logical :: mixedtypes |
| 2576 |
|
| 2577 |
xmin = huge(xmin) |
| 2578 |
xmax = -huge(xmax) |
| 2579 |
mixedtypes = size(iamtype) >= np |
| 2580 |
|
| 2581 |
if (mixedtypes) then |
| 2582 |
do i=1,np |
| 2583 |
itype = int(iamtype(i)) |
| 2584 |
if (itype > 0 .and. itype <= np) then |
| 2585 |
if (iusetype(itype) .and. icolourpart(i) > 0) then |
| 2586 |
xmin = min(xmin,xarr(i)) |
| 2587 |
xmax = max(xmax,xarr(i)) |
| 2588 |
endif |
| 2589 |
endif |
| 2590 |
enddo |
| 2591 |
else |
| 2592 |
xmin = minval(xarr,mask=(icolourpart >= 0)) |
| 2593 |
xmax = maxval(xarr,mask=(icolourpart >= 0)) |
| 2594 |
endif |
| 2595 |
call assert_sensible_limits(xmin,xmax) |
| 2596 |
|
| 2597 |
!print "(1x,a)",' resetting '//trim(labeli)//' limits' |
| 2598 |
|
| 2599 |
end subroutine adapt_limits_interactive |
| 2600 |
|
| 2601 |
!------------------------------------------------------------ |
| 2602 |
! utility which translates between world co-ordinates (x,y) |
| 2603 |
! and viewport co-ordinates (relative to the whole viewport) |
| 2604 |
!------------------------------------------------------------ |
| 2605 |
subroutine get_vptxy(x,y,vptx,vpty) |
| 2606 |
use plotlib, only:plot_qvp,plot_qwin |
| 2607 |
real, intent(in) :: x,y |
| 2608 |
real, intent(out) :: vptx,vpty |
| 2609 |
real :: xmini,xmaxi,ymini,ymaxi |
| 2610 |
real :: vptxmini,vptxmaxi,vptymini,vptymaxi |
| 2611 |
|
| 2612 |
call plot_qvp(0,vptxmini,vptxmaxi,vptymini,vptymaxi) |
| 2613 |
call plot_qwin(xmini,xmaxi,ymini,ymaxi) |
| 2614 |
vptx = vptxmini + (x-xmini)/(xmaxi-xmini)*(vptxmaxi-vptxmini) |
| 2615 |
vpty = vptymini + (y-ymini)/(ymaxi-ymini)*(vptymaxi-vptymini) |
| 2616 |
|
| 2617 |
end subroutine get_vptxy |
| 2618 |
|
| 2619 |
!------------------------------------------------------------ |
| 2620 |
! utility to return x,y coordinates given viewport coords |
| 2621 |
! (only works for single-panelled plots) |
| 2622 |
!------------------------------------------------------------ |
| 2623 |
subroutine get_posxy(vptx,vpty,x,y,xmini,xmaxi,ymini,ymaxi) |
| 2624 |
use plotlib, only:plot_qvp |
| 2625 |
real, intent(in) :: vptx,vpty |
| 2626 |
real, intent(out) :: x,y |
| 2627 |
real, intent(in) :: xmini,xmaxi,ymini,ymaxi |
| 2628 |
real :: vptxmini,vptxmaxi,vptymini,vptymaxi |
| 2629 |
|
| 2630 |
call plot_qvp(0,vptxmini,vptxmaxi,vptymini,vptymaxi) |
| 2631 |
x = xmini + (vptx-vptxmini)/(vptxmaxi-vptxmini)*(xmaxi-xmini) |
| 2632 |
y = ymini + (vpty-vptymini)/(vptymaxi-vptymini)*(ymaxi-ymini) |
| 2633 |
|
| 2634 |
return |
| 2635 |
end subroutine get_posxy |
| 2636 |
|
| 2637 |
!----------------------------------------------------------- |
| 2638 |
! These subroutines interface to the actual plot settings |
| 2639 |
!----------------------------------------------------------- |
| 2640 |
|
| 2641 |
! |
| 2642 |
!--plot a label showing the particle ID on the plot |
| 2643 |
! |
| 2644 |
subroutine plot_number(i,xi,yi) |
| 2645 |
use plotlib, only:plot_numb,plot_qch,plot_sch,plot_text |
| 2646 |
integer, intent(in) :: i |
| 2647 |
real, intent(in) :: xi,yi |
| 2648 |
integer :: nc |
| 2649 |
real :: charheight |
| 2650 |
character(len=20) :: string |
| 2651 |
|
| 2652 |
!--convert number to text string |
| 2653 |
call plot_numb(i,0,1,string,nc) |
| 2654 |
!--query and store character height |
| 2655 |
call plot_qch(charheight) |
| 2656 |
!--change character height |
| 2657 |
call plot_sch(2.0) |
| 2658 |
!--plot text string |
| 2659 |
call plot_text(xi,yi,string(1:nc)) |
| 2660 |
!--reset character height |
| 2661 |
call plot_sch(charheight) |
| 2662 |
|
| 2663 |
return |
| 2664 |
end subroutine plot_number |
| 2665 |
|
| 2666 |
subroutine deleteaxes() |
| 2667 |
use settings_page, only:iaxis,iPlotLegend,& !iPlotStepLegend, & |
| 2668 |
iPlotTitles,iPlotScale |
| 2669 |
use settings_vecplot, only:iVecplotLegend |
| 2670 |
|
| 2671 |
if (iaxis==-2) then |
| 2672 |
! |
| 2673 |
!-- would be better to do this properly by |
| 2674 |
! determining whether or not the cursor is over |
| 2675 |
! the legend, shape, title or whatever annotation the user |
| 2676 |
! wishes to be deleted. Instead at the moment we just |
| 2677 |
! delete the legends once the axes are already gone, and |
| 2678 |
! then in a somewhat arbitrary order. |
| 2679 |
! |
| 2680 |
iVecplotLegend = .false. |
| 2681 |
if (iPlotLegend) then |
| 2682 |
iPlotLegend = .false. |
| 2683 |
elseif (iPlotTitles) then |
| 2684 |
iPlotTitles = .false. |
| 2685 |
elseif (iPlotScale) then |
| 2686 |
iPlotScale = .false. |
| 2687 |
endif |
| 2688 |
elseif (iaxis <= 2 .and. iaxis > -2) then |
| 2689 |
iaxis = iaxis - 1 |
| 2690 |
elseif (iaxis > 2) then |
| 2691 |
iaxis = -1 |
| 2692 |
elseif (iaxis < -2) then |
| 2693 |
iaxis = -2 |
| 2694 |
endif |
| 2695 |
|
| 2696 |
end subroutine deleteaxes |
| 2697 |
|
| 2698 |
! |
| 2699 |
!--delete specific legends |
| 2700 |
! |
| 2701 |
subroutine delete_legend(id) |
| 2702 |
use legends, only:ilegend,ilegend_vec,ilegend_markers,ilegend_scale |
| 2703 |
use settings_page, only:iPlotLegend,iPlotStepLegend,iPlotScale |
| 2704 |
use settings_vecplot, only:iVecplotLegend |
| 2705 |
integer, intent(in) :: id |
| 2706 |
|
| 2707 |
select case(id) |
| 2708 |
case(ilegend_scale) |
| 2709 |
if (iPlotScale) print*,'> deleting scale bar' |
| 2710 |
iPlotScale = .false. |
| 2711 |
case(ilegend_markers) |
| 2712 |
if (iPlotStepLegend) print*,'> deleting marker legend' |
| 2713 |
iPlotStepLegend = .false. |
| 2714 |
case(ilegend_vec) |
| 2715 |
if (iVecplotLegend) print*,'> deleting vector legend' |
| 2716 |
iVecplotLegend = .false. |
| 2717 |
case(ilegend) |
| 2718 |
if (iPlotLegend) print*,'> deleting legend' |
| 2719 |
iPlotLegend = .false. |
| 2720 |
end select |
| 2721 |
|
| 2722 |
end subroutine delete_legend |
| 2723 |
|
| 2724 |
! |
| 2725 |
!--check if legend is actually being plotted |
| 2726 |
! |
| 2727 |
logical function legend_is_plotted(id) |
| 2728 |
use legends, only:ilegend,ilegend_vec,ilegend_markers,ilegend_scale |
| 2729 |
use settings_page, only:iPlotLegend,iPlotStepLegend,iPlotScale |
| 2730 |
use settings_vecplot, only:iVecplotLegend |
| 2731 |
integer, intent(in) :: id |
| 2732 |
|
| 2733 |
legend_is_plotted = .false. |
| 2734 |
select case(id) |
| 2735 |
case(ilegend_scale) |
| 2736 |
legend_is_plotted = iPlotScale |
| 2737 |
case(ilegend_markers) |
| 2738 |
legend_is_plotted = iPlotStepLegend |
| 2739 |
case(ilegend_vec) |
| 2740 |
legend_is_plotted = iVecplotLegend |
| 2741 |
case(ilegend) |
| 2742 |
legend_is_plotted = iPlotLegend |
| 2743 |
end select |
| 2744 |
|
| 2745 |
end function legend_is_plotted |
| 2746 |
! |
| 2747 |
!--move the legend to the current position |
| 2748 |
! |
| 2749 |
subroutine mvlegend(xi,yi,xmin,xmax,ymax,ipanel) |
| 2750 |
use settings_page, only:hposlegend,vposlegend,fjustlegend,iPlotLegend,iPlotLegendOnlyOnPanel |
| 2751 |
use plotlib, only:plot_qcs |
| 2752 |
real, intent(in) :: xi,yi,xmin,xmax,ymax |
| 2753 |
integer, intent(in), optional :: ipanel |
| 2754 |
real :: xch,ych |
| 2755 |
|
| 2756 |
iPlotLegend = .true. |
| 2757 |
hposlegend = (xi - xmin)/(xmax-xmin) |
| 2758 |
!--query character height in world coordinates |
| 2759 |
call plot_qcs(4,xch,ych) |
| 2760 |
vposlegend = (ymax - yi)/ych |
| 2761 |
! !--automatically change justification |
| 2762 |
! if (hposlegend < 0.25) then |
| 2763 |
fjustlegend = 0.0 |
| 2764 |
! elseif (hposlegend > 0.75) then |
| 2765 |
! fjustlegend = 1.0 |
| 2766 |
! else |
| 2767 |
! fjustlegend = 0.5 |
| 2768 |
! endif |
| 2769 |
if (present(ipanel)) then |
| 2770 |
if (ipanel > 0 .and. iPlotLegendOnlyOnPanel > 0) iPlotLegendOnlyOnPanel = ipanel |
| 2771 |
endif |
| 2772 |
print*,'hpos = ',hposlegend,' vpos = ',vposlegend,' just = ',fjustlegend |
| 2773 |
|
| 2774 |
end subroutine mvlegend |
| 2775 |
! |
| 2776 |
!--move the vector legend to the current position |
| 2777 |
! |
| 2778 |
subroutine mvlegendvec(xi,yi,xmin,xmax,ymax) |
| 2779 |
use settings_vecplot, only:hposlegendvec,vposlegendvec,iVecplotLegend |
| 2780 |
use plotlib, only:plot_qcs |
| 2781 |
real, intent(in) :: xi,yi,xmin,xmax,ymax |
| 2782 |
real :: xch,ych |
| 2783 |
|
| 2784 |
iVecplotLegend = .true. |
| 2785 |
hposlegendvec = (xi - xmin)/(xmax-xmin) |
| 2786 |
!--query character height in world coordinates |
| 2787 |
call plot_qcs(4,xch,ych) |
| 2788 |
vposlegendvec = (ymax - yi)/ych |
| 2789 |
print*,'hpos = ',hposlegendvec,' vpos = ',vposlegendvec |
| 2790 |
|
| 2791 |
end subroutine mvlegendvec |
| 2792 |
! |
| 2793 |
!--move the title to the current position |
| 2794 |
! |
| 2795 |
subroutine mvtitle(xi,yi,xmin,xmax,ymax) |
| 2796 |
use settings_page, only:hpostitle,vpostitle,fjusttitle,iPlotTitles |
| 2797 |
use plotlib, only:plot_qcs |
| 2798 |
real, intent(in) :: xi,yi,xmin,xmax,ymax |
| 2799 |
real :: xch,ych |
| 2800 |
|
| 2801 |
iPlotTitles = .true. |
| 2802 |
hpostitle = (xi - xmin)/(xmax-xmin) |
| 2803 |
!--query character height in world coordinates |
| 2804 |
call plot_qcs(4,xch,ych) |
| 2805 |
vpostitle = (yi - ymax)/ych |
| 2806 |
|
| 2807 |
!--automatically change justification |
| 2808 |
if (hpostitle < 0.25) then |
| 2809 |
fjusttitle = 0.0 |
| 2810 |
elseif (hpostitle > 0.75) then |
| 2811 |
fjusttitle = 1.0 |
| 2812 |
else |
| 2813 |
fjusttitle = 0.5 |
| 2814 |
endif |
| 2815 |
print*,'hpos = ',hpostitle,' vpos = ',vpostitle,' just = ',fjusttitle |
| 2816 |
|
| 2817 |
return |
| 2818 |
end subroutine mvtitle |
| 2819 |
|
| 2820 |
! |
| 2821 |
!--saves current plot limits |
| 2822 |
! |
| 2823 |
subroutine save_limits(iplot,xmin,xmax,setlim2) |
| 2824 |
use labels, only:irhodust_start,irhodust_end |
| 2825 |
integer, intent(in) :: iplot |
| 2826 |
real, intent(in) :: xmin,xmax |
| 2827 |
logical, intent(in), optional :: setlim2 |
| 2828 |
real :: xmintemp,xmaxtemp |
| 2829 |
integer :: i |
| 2830 |
|
| 2831 |
if (iplot > 0 .and. iplot >= irhodust_start .and. iplot <= irhodust_end) then |
| 2832 |
! |
| 2833 |
!--if we save the limits for one dust density, apply to whole grid |
| 2834 |
! |
| 2835 |
do i=irhodust_start,irhodust_end |
| 2836 |
xmintemp = xmin |
| 2837 |
xmaxtemp = xmax |
| 2838 |
if (present(setlim2)) then |
| 2839 |
call save_limits_i(i,xmintemp,xmaxtemp,setlim2) |
| 2840 |
else |
| 2841 |
call save_limits_i(i,xmintemp,xmaxtemp) |
| 2842 |
endif |
| 2843 |
enddo |
| 2844 |
print*,'> applying saved limits to all dust species <' |
| 2845 |
else |
| 2846 |
! |
| 2847 |
!--otherwise just pass options through to save_limits_i |
| 2848 |
! |
| 2849 |
if (present(setlim2)) then |
| 2850 |
call save_limits_i(iplot,xmin,xmax,setlim2) |
| 2851 |
else |
| 2852 |
call save_limits_i(iplot,xmin,xmax) |
| 2853 |
endif |
| 2854 |
endif |
| 2855 |
|
| 2856 |
end subroutine save_limits |
| 2857 |
|
| 2858 |
! |
| 2859 |
!--save plot limits for one column |
| 2860 |
! |
| 2861 |
subroutine save_limits_i(iplot,xmin,xmax,setlim2) |
| 2862 |
use limits, only:lim,lim2 |
| 2863 |
use labels, only:is_coord |
| 2864 |
use multiplot, only:itrans |
| 2865 |
use settings_data, only:ndim |
| 2866 |
use settings_limits, only:iadapt,iadaptcoords |
| 2867 |
use transforms, only:transform_limits_inverse |
| 2868 |
integer, intent(in) :: iplot |
| 2869 |
real, intent(in) :: xmin,xmax |
| 2870 |
logical, intent(in), optional :: setlim2 |
| 2871 |
logical :: uselim2 |
| 2872 |
real :: xmintemp,xmaxtemp |
| 2873 |
|
| 2874 |
uselim2 = .false. |
| 2875 |
if (present(setlim2)) uselim2 = setlim2 |
| 2876 |
|
| 2877 |
if (itrans(iplot) /= 0) then |
| 2878 |
xmintemp = xmin |
| 2879 |
xmaxtemp = xmax |
| 2880 |
call transform_limits_inverse(xmintemp,xmaxtemp,itrans(iplot)) |
| 2881 |
if (uselim2) then |
| 2882 |
lim2(iplot,1) = xmintemp |
| 2883 |
lim2(iplot,2) = xmaxtemp |
| 2884 |
else |
| 2885 |
lim(iplot,1) = xmintemp |
| 2886 |
lim(iplot,2) = xmaxtemp |
| 2887 |
endif |
| 2888 |
else |
| 2889 |
if (uselim2) then |
| 2890 |
lim2(iplot,1) = xmin |
| 2891 |
lim2(iplot,2) = xmax |
| 2892 |
else |
| 2893 |
lim(iplot,1) = xmin |
| 2894 |
lim(iplot,2) = xmax |
| 2895 |
endif |
| 2896 |
endif |
| 2897 |
! |
| 2898 |
!--change appropriate plot limits to fixed (not adaptive) |
| 2899 |
! |
| 2900 |
if (is_coord(iplot,ndim)) then |
| 2901 |
iadaptcoords = .false. |
| 2902 |
else |
| 2903 |
iadapt = .false. |
| 2904 |
endif |
| 2905 |
|
| 2906 |
return |
| 2907 |
end subroutine save_limits_i |
| 2908 |
|
| 2909 |
! |
| 2910 |
!--implements parameter range restriction |
| 2911 |
! |
| 2912 |
subroutine restrict_range(iplot,xmin,xmax) |
| 2913 |
use limits, only:range |
| 2914 |
use multiplot, only:itrans |
| 2915 |
use transforms, only:transform_limits_inverse |
| 2916 |
integer, intent(in) :: iplot |
| 2917 |
real, intent(in) :: xmin,xmax |
| 2918 |
real :: xmintemp,xmaxtemp |
| 2919 |
|
| 2920 |
if (itrans(iplot) /= 0) then |
| 2921 |
xmintemp = xmin |
| 2922 |
xmaxtemp = xmax |
| 2923 |
call transform_limits_inverse(xmintemp,xmaxtemp,itrans(iplot)) |
| 2924 |
range(iplot,1) = xmintemp |
| 2925 |
range(iplot,2) = xmaxtemp |
| 2926 |
else |
| 2927 |
range(iplot,1) = xmin |
| 2928 |
range(iplot,2) = xmax |
| 2929 |
endif |
| 2930 |
|
| 2931 |
return |
| 2932 |
end subroutine restrict_range |
| 2933 |
|
| 2934 |
! |
| 2935 |
!--interface to routine which removes all parameter range restrictions |
| 2936 |
! |
| 2937 |
subroutine reset_ranges() |
| 2938 |
use limits, only:reset_all_ranges |
| 2939 |
|
| 2940 |
call reset_all_ranges() |
| 2941 |
|
| 2942 |
return |
| 2943 |
end subroutine reset_ranges |
| 2944 |
|
| 2945 |
! |
| 2946 |
!--interface to routine which resets second set of limits |
| 2947 |
! |
| 2948 |
subroutine reset_limits2(icol) |
| 2949 |
use limits, only:reset_lim2 |
| 2950 |
integer, intent(in) :: icol |
| 2951 |
|
| 2952 |
call reset_lim2(icol) |
| 2953 |
|
| 2954 |
return |
| 2955 |
end subroutine reset_limits2 |
| 2956 |
|
| 2957 |
! |
| 2958 |
!--saves current plot limits for particle tracking |
| 2959 |
! |
| 2960 |
subroutine save_limits_track(iplot,xmin,xmax,xi) |
| 2961 |
use multiplot, only:itrans |
| 2962 |
use settings_data, only:ndim |
| 2963 |
use settings_limits, only:xminoffset_track,xmaxoffset_track |
| 2964 |
use transforms, only:transform_limits_inverse |
| 2965 |
integer, intent(in) :: iplot |
| 2966 |
real, intent(in) :: xmin,xmax,xi |
| 2967 |
real :: xmintemp,xmaxtemp |
| 2968 |
|
| 2969 |
if (iplot > ndim) then |
| 2970 |
print*,'ERROR in save_limits_track: iplot>ndim' |
| 2971 |
return |
| 2972 |
elseif (itrans(iplot) /= 0) then |
| 2973 |
xmintemp = xmin |
| 2974 |
xmaxtemp = xmax |
| 2975 |
call transform_limits_inverse(xmintemp,xmaxtemp,itrans(iplot)) |
| 2976 |
xminoffset_track(iplot) = xi - xmintemp |
| 2977 |
xmaxoffset_track(iplot) = xmaxtemp - xi |
| 2978 |
else |
| 2979 |
xminoffset_track(iplot) = abs(xi - xmin) |
| 2980 |
xmaxoffset_track(iplot) = abs(xmax - xi) |
| 2981 |
endif |
| 2982 |
|
| 2983 |
end subroutine save_limits_track |
| 2984 |
! |
| 2985 |
!--recalculates radius |
| 2986 |
! |
| 2987 |
subroutine save_itrackpart_recalcradius(itrackpart) |
| 2988 |
use filenames, only:nsteps,nstepsinfile,ifileopen |
| 2989 |
use settings_data, only:ncalc,DataIsBuffered,iCalcQuantities,track_string |
| 2990 |
use calcquantities, only:calc_quantities,calc_quantities_use_x0 |
| 2991 |
use part_utils, only:is_trackstring |
| 2992 |
integer, intent(in) :: itrackpart |
| 2993 |
|
| 2994 |
if (is_trackstring(track_string)) then |
| 2995 |
return ! do not overwrite strings like "maxdens" |
| 2996 |
else |
| 2997 |
write(track_string,"(i12)") itrackpart |
| 2998 |
endif |
| 2999 |
if (iCalcQuantities .and. itrackpart > 0) then |
| 3000 |
if (ncalc > 0 .and. calc_quantities_use_x0()) then |
| 3001 |
print "(a)",' Recalculating radius relative to tracked particle' |
| 3002 |
if (DataIsBuffered) then |
| 3003 |
call calc_quantities(1,nsteps) |
| 3004 |
else |
| 3005 |
call calc_quantities(1,nstepsinfile(ifileopen)) |
| 3006 |
endif |
| 3007 |
endif |
| 3008 |
endif |
| 3009 |
|
| 3010 |
end subroutine save_itrackpart_recalcradius |
| 3011 |
! |
| 3012 |
!--toggles log/unlog |
| 3013 |
! note this only changes a pure log transform: will not change combinations |
| 3014 |
! |
| 3015 |
subroutine change_itrans(iplot,xmin,xmax) |
| 3016 |
use multiplot, only:itrans |
| 3017 |
use settings_data, only:numplot |
| 3018 |
use transforms, only:transform_limits,transform_limits_inverse |
| 3019 |
use labels, only:irhodust_start,irhodust_end |
| 3020 |
integer, intent(in) :: iplot |
| 3021 |
real, intent(inout) :: xmin, xmax |
| 3022 |
|
| 3023 |
if (iplot <= numplot) then |
| 3024 |
if (itrans(iplot)==1) then |
| 3025 |
itrans(iplot) = 0 |
| 3026 |
!!--untransform the plot limits |
| 3027 |
call transform_limits_inverse(xmin,xmax,1) |
| 3028 |
else |
| 3029 |
itrans(iplot) = 1 |
| 3030 |
!!--transform the plot limits |
| 3031 |
call transform_limits(xmin,xmax,itrans(iplot)) |
| 3032 |
xmin = max(xmax-4.,xmin) ! no more than 4 dex by default |
| 3033 |
endif |
| 3034 |
endif |
| 3035 |
if (iplot > 0 .and. irhodust_start > 0 .and. iplot >= irhodust_start & |
| 3036 |
.and. iplot <= irhodust_end .and. irhodust_start /= irhodust_end) then |
| 3037 |
print*,'>> applying transform to all dust densities <<' |
| 3038 |
irhodust_end = min(irhodust_end,size(itrans)) |
| 3039 |
itrans(irhodust_start:irhodust_end) = itrans(iplot) |
| 3040 |
endif |
| 3041 |
|
| 3042 |
end subroutine change_itrans |
| 3043 |
|
| 3044 |
subroutine change_itrans2(iplot,xmin,xmax,xmina,xmaxa) |
| 3045 |
use multiplot, only:itrans |
| 3046 |
use settings_data, only:numplot |
| 3047 |
use transforms, only:transform_limits,transform_limits_inverse |
| 3048 |
integer, intent(in) :: iplot |
| 3049 |
real, intent(inout) :: xmin, xmax, xmina, xmaxa |
| 3050 |
|
| 3051 |
if (iplot <= numplot) then |
| 3052 |
if (itrans(iplot)==1) then |
| 3053 |
itrans(iplot) = 0 |
| 3054 |
!!--untransform the plot limits |
| 3055 |
call transform_limits_inverse(xmin,xmax,1) |
| 3056 |
call transform_limits_inverse(xmina,xmaxa,1) |
| 3057 |
else |
| 3058 |
itrans(iplot) = 1 |
| 3059 |
!!--transform the plot limits |
| 3060 |
call transform_limits(xmin,xmax,itrans(iplot)) |
| 3061 |
call transform_limits(xmina,xmaxa,itrans(iplot)) |
| 3062 |
xmin = max(xmax-4.,xmin) ! no more than 4 dex by default |
| 3063 |
endif |
| 3064 |
endif |
| 3065 |
|
| 3066 |
end subroutine change_itrans2 |
| 3067 |
|
| 3068 |
! |
| 3069 |
!--saves rotation options |
| 3070 |
! |
| 3071 |
subroutine save_rotation(ndim,anglexi,angleyi,anglezi) |
| 3072 |
use settings_xsecrot, only:anglex,angley,anglez |
| 3073 |
integer, intent(in) :: ndim |
| 3074 |
real, intent(in) :: anglexi,angleyi,anglezi |
| 3075 |
|
| 3076 |
anglez = anglezi |
| 3077 |
if (ndim >= 3) then |
| 3078 |
anglex = anglexi |
| 3079 |
angley = angleyi |
| 3080 |
endif |
| 3081 |
|
| 3082 |
return |
| 3083 |
end subroutine save_rotation |
| 3084 |
|
| 3085 |
! |
| 3086 |
!--saves cross section position |
| 3087 |
! |
| 3088 |
subroutine save_xsecpos(xsecpos,xsec) |
| 3089 |
use settings_xsecrot, only:xsecpos_nomulti,xsec_nomulti |
| 3090 |
real, intent(in) :: xsecpos |
| 3091 |
logical, intent(in) :: xsec |
| 3092 |
|
| 3093 |
xsecpos_nomulti = xsecpos |
| 3094 |
xsec_nomulti = xsec |
| 3095 |
|
| 3096 |
return |
| 3097 |
end subroutine save_xsecpos |
| 3098 |
|
| 3099 |
! |
| 3100 |
!--saves 3D perspective |
| 3101 |
! |
| 3102 |
subroutine save_perspective(zpos,dz) |
| 3103 |
use settings_xsecrot, only:zobserver,dzscreenfromobserver |
| 3104 |
real, intent(in) :: zpos,dz |
| 3105 |
|
| 3106 |
zobserver = zpos |
| 3107 |
dzscreenfromobserver = dz |
| 3108 |
|
| 3109 |
return |
| 3110 |
end subroutine save_perspective |
| 3111 |
! |
| 3112 |
!--saves 3D opacity |
| 3113 |
! |
| 3114 |
subroutine save_opacity(rkappai) |
| 3115 |
use settings_xsecrot, only:taupartdepth |
| 3116 |
real, intent(in) :: rkappai |
| 3117 |
|
| 3118 |
taupartdepth = rkappai |
| 3119 |
|
| 3120 |
return |
| 3121 |
end subroutine save_opacity |
| 3122 |
! |
| 3123 |
!--save the current paper size |
| 3124 |
! |
| 3125 |
subroutine save_windowsize() |
| 3126 |
use settings_page, only:ipapersize,ipapersizeunits,papersizex,aspectratio |
| 3127 |
use plotlib, only:plot_qvsz |
| 3128 |
real :: x1,x2,y1,y2,papersizey |
| 3129 |
|
| 3130 |
call plot_qvsz(0,x1,x2,y1,y2) |
| 3131 |
|
| 3132 |
if (abs(x2-x1 - 800.) > 0. .and. abs(y2-y1 - 600.) > 0.) then |
| 3133 |
!print*,' saving paper size = ',x2-x1,' x ',y2-y1 |
| 3134 |
ipapersize = 24 ! custom |
| 3135 |
ipapersizeunits = 0 |
| 3136 |
papersizex = x2-x1 |
| 3137 |
papersizey = y2-y1 |
| 3138 |
aspectratio = papersizey/papersizex |
| 3139 |
endif |
| 3140 |
|
| 3141 |
end subroutine save_windowsize |
| 3142 |
|
| 3143 |
! |
| 3144 |
!--saves circles of interaction |
| 3145 |
! |
| 3146 |
subroutine save_circles(ncircpartset,icircpartset) |
| 3147 |
use settings_part, only:ncircpart,icircpart |
| 3148 |
integer, intent(in) :: ncircpartset |
| 3149 |
integer, intent(in), dimension(:) :: icircpartset |
| 3150 |
integer :: imax |
| 3151 |
|
| 3152 |
imax = min(size(icircpartset),size(icircpart),ncircpartset) |
| 3153 |
ncircpart = imax |
| 3154 |
icircpart(1:imax) = icircpartset(1:imax) |
| 3155 |
print*,'saving ',imax,' circles of interaction only' |
| 3156 |
|
| 3157 |
end subroutine save_circles |
| 3158 |
! |
| 3159 |
!--change colour map |
| 3160 |
! |
| 3161 |
subroutine change_colourmap(imap,istep) |
| 3162 |
use colours, only:colour_set,ncolourschemes,icustom |
| 3163 |
integer, intent(inout) :: imap |
| 3164 |
integer, intent(in) :: istep |
| 3165 |
|
| 3166 |
imap = imap + istep |
| 3167 |
if (abs(imap) > ncolourschemes .and. abs(imap) /= icustom) imap = 1 |
| 3168 |
if (abs(imap) < 1) imap = ncolourschemes |
| 3169 |
call colour_set(imap) |
| 3170 |
|
| 3171 |
end subroutine change_colourmap |
| 3172 |
|
| 3173 |
! |
| 3174 |
!--set movie mode |
| 3175 |
! |
| 3176 |
subroutine set_movie_mode(live) |
| 3177 |
use settings_page, only:iaxis,papersizex,aspectratio,ipapersize,ipapersizeunits,iPageColours |
| 3178 |
use settings_limits, only:adjustlimitstodevice |
| 3179 |
use settings_render, only:iColourBarStyle |
| 3180 |
use pagecolours, only:set_pagecolours |
| 3181 |
use plotlib, only:plotlib_is_pgplot,plot_pap |
| 3182 |
use colourbar, only:set_floating_bar_style |
| 3183 |
use system_utils, only:get_copyright |
| 3184 |
use shapes, only:add_text |
| 3185 |
logical, intent(in) :: live |
| 3186 |
|
| 3187 |
iaxis = -2 |
| 3188 |
iPageColours = 2 |
| 3189 |
if (.not.plotlib_is_pgplot) then |
| 3190 |
ipapersize = 9 |
| 3191 |
ipapersizeunits = 0 |
| 3192 |
papersizex = 1280. |
| 3193 |
aspectratio = 0.5625 |
| 3194 |
if (live) call plot_pap(papersizex,aspectratio,ipapersizeunits) |
| 3195 |
iColourBarStyle = 8 |
| 3196 |
call set_floating_bar_style(iColourBarStyle,4) |
| 3197 |
if (live) call set_pagecolours(iPageColours) |
| 3198 |
adjustlimitstodevice = .true. |
| 3199 |
endif |
| 3200 |
call add_text(0.025,0.05,get_copyright()) |
| 3201 |
|
| 3202 |
end subroutine set_movie_mode |
| 3203 |
|
| 3204 |
! |
| 3205 |
!--unset movie mode |
| 3206 |
! |
| 3207 |
subroutine unset_movie_mode() |
| 3208 |
use settings_page, only:iaxis,papersizex,aspectratio,ipapersize,iPageColours |
| 3209 |
use settings_limits, only:adjustlimitstodevice |
| 3210 |
use settings_render, only:iColourBarStyle |
| 3211 |
use pagecolours, only:set_pagecolours |
| 3212 |
use plotlib, only:plotlib_is_pgplot,plot_pap |
| 3213 |
use system_utils, only:get_copyright |
| 3214 |
use shapes, only:delete_text |
| 3215 |
|
| 3216 |
iaxis = 0 |
| 3217 |
iPageColours = 1 |
| 3218 |
if (.not.plotlib_is_pgplot) then |
| 3219 |
ipapersize = 0 |
| 3220 |
papersizex = 800. |
| 3221 |
aspectratio = 600./800. |
| 3222 |
iColourBarStyle = 1 |
| 3223 |
call plot_pap(papersizex,aspectratio,0) |
| 3224 |
call set_pagecolours(iPageColours) |
| 3225 |
adjustlimitstodevice = .true. |
| 3226 |
endif |
| 3227 |
call delete_text(get_copyright()) |
| 3228 |
|
| 3229 |
end subroutine unset_movie_mode |
| 3230 |
|
| 3231 |
end module interactive_routines |