pgraph.src
来自「没有说明」· SRC 代码 · 共 534 行
SRC
534 行
/*
** pgraph.src - Publication Quality Graphics Support.
** (C) Copyright 1988-1998 by Aptech Systems, Inc.
** All Rights Reserved.
**
** This Software Product is PROPRIETARY SOURCE CODE OF APTECH
** SYSTEMS, INC. This File Header must accompany all files using
** any portion, in whole or in part, of this Source Code. In
** addition, the right to create such files is strictly limited by
** Section 2.A. of the GAUSS Applications License Agreement
** accompanying this Software Product.
**
** If you wish to distribute any portion of the proprietary Source
** Code, in whole or in part, you must first obtain written
** permission from Aptech Systems.
**
** Format Purpose Line
** ========================================================================
** ASCLABEL(xl,yl); ASCII labels for major ticks 38
** FONTS(str); Set fonts used in plot 70
** GRAPHSET; Reset graphics 107
** TITLE(str); Set title for graph 207
** VIEW(x,y,z); Set observer position 232
** VIEWXYZ(x,y,z); Set observer position 266
** VOLUME(x,y,z); Set size of 3D workbox 297
** XLABEL(str); Set X axis label 324
** YLABEL(str); Set Y axis label 344
** ZLABEL(str); Set Z axis label 364
** MARGIN(l,r,t,b) Set Graph Window Margin 384
** AXMARGIN(l,r,t,b) Set Axes Margin 401
** GRAPHPRT(str); Select print and file conversion opts 424
** RERUN; Execute graphics display/print utility 468
*/
#include pgraph.ext
/*
**> asclabel
**
** Purpose: To set up character labels for the X and Y axes.
**
** Format: asclabel(xl,yl);
**
** Input: xl character vector, labels for the tic marks on the X
** axis.
**
** yl character vector, labels for the tic marks on the Y
** axis.
**
** Remarks: If xl or yl = 0 character labels will not be used for
** that axis.
**
** Globals: _pascx, _pascy
*/
proc 0 = asclabel(xl,yl);
if type(xl) == 13;
_pascx = stof(xl);
else;
_pascx = xl;
endif;
if type(yl) == 13;
_pascy = stof(yl);
else;
_pascy = yl;
endif;
endp;
/*
**> fonts
**
** Purpose: To select fonts to be used in the plot.
**
** Format: fonts(str);
**
** Input: str string or character vector containing the names
** of up to 4 fonts to be used in the plot.
**
** simplex standard sans serif font
** simgrma simplex greek, math
** microb bold and boxy
** complex standard font with serif
**
** The first font specified will be used for the
** axes numbers.
**
** If str is null or fonts is not called,
** simplex will be used by default.
*/
proc 0 = fonts(str);
if type(str) == 13;
str = stof(str);
endif;
if str $== 0;
str[1] = "simplex";
endif;
str = str[0];
if rows(str) > 4;
errorlog "Too many fonts";
end;
endif;
_pfonts = str;
endp;
/*
**> graphset
**
** Purpose: Reset graphics globals to default values.
**
** Format: graphset;
**
** Remarks: This procedure is used to reset the defaults between graphs.
** It can be modified if you want different default values.
**
** The globals are declared in pgraph.dec.
*/
proc 0 = graphset;
_parrow = 0;
_parrow3 = 0;
_pascx = 0;
_pascy = 0;
_paxes = 1;
_paxht = 0;
_pbarwid = .5;
_pbartyp = { 6 7 };
_pbox = 0;
_pbox3d = 0;
_pboxctl = { .25, 10, 1 };
_pboxlim = 0;
_pcrop = { 1 1 1 1 1 };
_pcolor = 0;
_pmcolor = 15;
_pcross = 0;
_pcwin = 0;
_pncwin = 0;
_pcsel = { 10 11 12 13 14 9 15 };
_perrbar = 0;
_pfonts = { "simplex" };
_pframe = 1 | 1;
_pgrid = 0;
_plctrl = 0;
_plegctl = 0;
_plegstr = "";
_plev = 0;
_pline = 0;
_pline3d = 0;
_pmargin = { 0,0,0,0 };
_paxmarx = 0;
_pagesiz = 0;
_pageshf = 0;
_pcvfile = "";
_plotsiz = 0;
_plotshf = 0;
_plsel = { 6 1 2 3 4 5 };
_pltype = 0;
_plwidth = 0;
_pmsgctl = 0;
_pmsgstr = "";
_pnotify = 1;
_pnum = 1;
_pnumht = 0;
_protate = 0;
_prtfile = "";
_pssel = { 1 2 3 4 5 6 7 8 9 10 11 12 13 14 };
_pstype = 0;
_psym = 0;
_psym3d = 0;
_psymsiz = 3.5;
_psurf = { 0, 7 };
_pzpmax = 3;
_pticout = 0;
_ptitlht = 0;
_pworld = 0;
_pxpmax = 12;
_pxscale = 0;
_pypmax = 12;
_pyscale = 0;
_pzscale = 0;
_pzoom = { 0 5 5 };
_pcmdlin = "";
_ptek = "graphic.tkf";
_ptitle = "";
_pvolume = 0;
_pview = { 1, -4, -3, 3 };
_pxfmt = "";
_pxlabel = "";
_pyfmt = "";
_pylabel = "";
_pzfmt = "";
_pzlabel = "";
_pxsci = 4;
_pysci = 4;
_pzsci = 4;
_pzclr = 13;
/*
Reset pscreen only when windows are NOT used. _pscreen controls
whether or not pqgrun.exe is called at the end of the graph .arc file.
*/
if _pwindmx == 0;
_pscreen = 1;
endif;
endp;
/*
**> title
**
** Purpose: To set a title for the graph.
**
** Format: title(str);
**
** Input: str string, the title to display above the graph.
**
** Remarks: This may contain up to 3 lines of title separated by line
** feed characters. On multiple line titles, the character
** size will be reduced automatically. This string may contain
** up to 180 characters total.
**
** See Also: xlabel, ylabel
*/
proc 0 = title(str);
if strlen(str) >= 180;
errorlog "Title string too long. 180 characters allowed.";
end;
endif;
_ptitle = str;
endp;
/*
**> view
**
** Purpose: To set the position of the observer for 3D plots.
**
** Format: view(x,y,z);
**
** Input: x scalar, the X position in workbox units.
**
** y scalar, the Y position in workbox units.
**
** z scalar, the Z position in workbox units.
**
** Remarks: The size of the workbox is set with "volume". The
** viewer MUST be outside of the workbox. The
** closer the position of the observer, the more
** perspective distortion there will be. If x = y
** = z, the projection will be isometric.
**
** If "view" is not called, a default position will
** be calculated.
**
** Use "viewxyz" to locate the observer in plot
** coordinates.
**
** Globals _pview
**
** See Also volume, viewxyz
*/
proc (0) = view(x,y,z);
_pview = 1|x|y|z;
endp;
/*
**> viewxyz
**
** Purpose: To set the position of the observer in plot coordinates
** for 3D plots.
**
** Format: viewxyz(x,y,z);
**
** Input: x scalar, the X position in plot coordinates.
**
** y scalar, the Y position in plot coordinates.
**
** z scalar, the Z position in plot coordinates.
**
** Remarks: The viewer MUST be outside of the workbox. The closer the
** observer, the more perspective distortion there will be.
**
** If "viewxyz" is not called, a default position will
** be calculated.
**
** Use "view" to locate the observer in workbox units.
**
** Globals: _pview
**
** See Also: volume, view
*/
proc (0) = viewxyz(x,y,z);
_pview = 2|x|y|z;
endp;
/*
**> volume
**
** Purpose: To set the length, width, and height ratios of
** the 3D workbox.
**
** Format: volume(x,y,z);
**
** Input: x scalar, the X length of the 3D workbox.
**
** y scalar, the Y length of the 3D workbox.
**
** z scalar, the Z length of the 3D workbox.
**
** Remarks: The ratio between these values is what is important.
** If "volume" is not called, a default workbox will
** be calculated.
**
** Globals: _pvolume
**
** See Also: view
*/
proc (0) = volume(x,y,z);
_pvolume = x|y|z;
endp;
/*
**> xlabel
**
** Purpose: To set a label for the X axis.
**
** Format: xlabel(str);
**
** Input: str string, the label for the X axis.
**
** See Also: title, ylabel
*/
proc 0 = xlabel(str);
if strlen(str) >= 80;
errorlog "String too long";
end;
endif;
_pxlabel = str;
endp;
/*
**> ylabel
**
** Purpose: To set a label for the Y axis.
**
** Format: ylabel(str);
**
** Input: str string, the label for the Y axis.
**
** See Also: title, xlabel
*/
proc 0 = ylabel(str);
if strlen(str) >= 80;
errorlog "String too long";
end;
endif;
_pylabel = str;
endp;
/*
**> zlabel
**
** Purpose: To set a label for the Z axis.
**
** Format: zlabel(str);
**
** Input: str string, the label for the Z axis.
**
** See Also: title, xlabel
*/
proc 0 = zlabel(str);
if strlen(str) >= 80;
errorlog "String too long";
end;
endif;
_pzlabel = str;
endp;
/*
**> margin
**
** Purpose: To set the margins for the graph window.
**
** Format: margin(l,r,t,b);
**
** Input: l scalar, the left margin in inches.
** r scalar, the right margin in inches.
** t scalar, the top margin in inches.
** b scalar, the bottom margin in inches.
*/
proc 0 = margin(l,r,t,b);
_pmargin = l | r | t | b;
endp;
/*
**> axmargin
**
** Purpose: To set the absolute position of the axes.
**
** Format: axmargin(l,r,t,b);
**
** Input: l scalar, the left margin in inches.
** r scalar, the right margin in inches.
** t scalar, the top margin in inches.
** b scalar, the bottom margin in inches.
**
** The user is responsible for allowing enough space in margin
** for text.
**
*/
proc 0 = axmargin(l,r,t,b);
_plotsiz = (9-l-r) ~ (6.855-t-b);
_plotshf = l ~ b;
_paxmarx = 1;
endp;
/*
**> graphprt
**
** Purpose: To select hardcopy or pause options.
**
** Format: graphprt(str);
**
** Input: str string, hardcopy or pause option control string.
**
** "" (null) Wait for interactive input (default)
** -P send graph to printer when graphics funtion is called
** -PO=c set print orientation:
** L landscape.
** P portrait.
** -PS=c set print page size:
** Q quarter page
** H half page
** F full page
** -PM=<l,r,t,b> set conversion file margins in inches.
** -PR=n set print resolution:
** 1 low
** 2 medium
** 3 high
** -C=n convert to another file format:
** 1 Encapsulated PostScript file
** 2 Lotus .PIC file
** 3 HP-GL Plotter file
** 4 PCX bitmap format
** -CO=<n> set conversion file orientation:
** L landscape
** P portrait
** -CS=c set conversion file page size:
** Q quarter page
** H half page
** F full page
** -CM=<l,r,t,b> set conversion file margins in inches.
** -W=n display graph, wait "n" seconds, then continue.
**
*/
proc 0 = graphprt(str);
_pcmdlin = " " $+ str;
endp;
/*
**> rerun
**
** Purpose: Executes the PQGRUN.EXE print/conversion utility.
**
** Format: rerun;
**
** Input: Uses the following PQG globals for control options:
**
** _ptek, _pcmdlin, _pzoom, _pcvfile, _prtfile
**
** Output: Produces a graph to the screen/printer/file.
*/
proc 0 = rerun();
#ifUNIX
call WinRefresh(WinGetActive);
#else
#ifDLLCALL
showpqg(_ptek,_pcmdlin);
#else
local tkfstr,zf,status,runpath;
if _ptek $== "notek";
retp;
endif;
tkfstr = _ptek $+ _pcmdlin;
if _pzoom[1] > 0;
if _pzoom[2] < 0 or _pzoom[3] > 100;
errorlog "Error _pzoom value out of range.";
end;
endif;
zf = "%*.*lf";
tkfstr = tkfstr $+ " -z=" $+ ftos(_pzoom[1],zf,6,2);
tkfstr = tkfstr $+ ftos(_pzoom[2],zf,7,2) $+ ftos(_pzoom[3],zf,7,2);
endif;
if not _psilent;
tkfstr = tkfstr $+ " -beep";
endif;
runpath = sysstate(2,0);
runpath = runpath $+ "pqgrun.exe"; /* GAUSS exe path */
status = exec( runpath, tkfstr );
if status == -1;
errorlog "Can't find PQGRUN.EXE, check DOS PATH.";
end;
elseif status == -3;
errorlog "Insufficient memory to execute PQGRUN.EXE.";
end;
endif;
#endif
#endif
endp;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?