Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:psc}
h2. Name

*psc* — PostScript plotting

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}

*psc lwf | slwf | on | off | open | close | scp | fontsize | vie | align | status | prot | col | font | fill | rec | stroke | expand | talign | txt | axes | curtxt | pos | line | chf | utmgrid | moveto | lineto | win | devcm2user | arc | ssc | bmp | jpeg | cross | newline | clip | linestyle | linewidth | outline | dash | overprint | ticml | pattern* 

{panel}

h2. Description

PostScript plotting, settings and commands. 

The plotting system in Geocap called dplot is applying these commands to plot maps with a high carthographic standard. 

PostScript is a state system which means that a specific setting is valid until a new setting is applied.

Note that it is possible to use *psc com* to write native PostScript commands. Check the [PostScript Reference Manual (third edition)|http://www.adobe.com/products/postscript/pdfs/PLRM.pdf].
 

h2. Arguments
*lwf* _line\_width\_factor_ 
{indent}Set the _line\_width\_factor_ of a postscript pen.{indent} 
*slwf* _line\_width\_factor_ 
{indent}Set _line\_width\_factor_ for shift lines in contouring.{indent} 
*open* _file\_name_ 
{indent}Open the _file\_name_ for writing postscript output.{indent} 
*close* 
{indent}Close the current output file for writing postscript output.{indent} 
*scp* _scale\_in\_meters\_x_ _scale\_in\_meters\_y_ _rel\_portion\_of\_horizontal\_margin\_left_ _rel\_portion\_of\_vertical\_margin\_bottom_ 
{indent}Scale plot, using the scale parameters for plot in x and y direction and the relative portion of the margins.{indent} 
*fontsize* _fontsize_ \[*cm*] 
{indent}Set the fontsize in user coordinates or in cm.{indent} 
*vie* _x\_lower\_left_ _y\_lower\_left_ _x\_upper\_right_ _y\_upper\_right_ \[*cm*] 
{indent}Set viewport area, either in relative coordinates or in cm.{indent} 
*align* \[*top | bottom | left | right | center*] 
{indent}Set graphics alignment.{indent} 
*status* 
{indent}Will write out the status of postscript in the message window.{indent} 
*prot* \[*reset*] | _x\_position_ _y\_position_ _rotation\_angle_ \[*cm*] 
{indent}Set rotation of plot in user or cm coordinates.{indent} 
*col* _red blu gre_ 
{indent}Display the postscript line in rgb values _red blu gre_. Observe that the standard col command will also affect postscript when active.{indent} 
*font* _font\_number_ 
{indent}Will set the font with the given _font\_number_.{indent} 
*fill* 
{indent}Will issue the postscript *fill* command in the output file.{indent} 
*stroke* 
{indent}Will issue the postscript *stroke* command in the output file.{indent} 
*rec* _x\_lower\_left_ _y\_lower\_left_ _x\_upper\_right_ _y\_upper\_right_ 
{indent}Will draw a rectangle according to the parameter input.{indent} 
*expand hor | ver | inside | outside | cover* 
{indent}Will expand the plot inside the viewport according to the argument.{indent}
 
{indent}
{info:title=Scale to match width of window/viewport} 
hor: scale_y = scale_x. 
ver: scale_x = scale_y. 
inside: shortest of scale_x or scale_y. 
outside: longest of scale_x or scale_y. 
cover: scale to viewport exactly. 
{info}
{indent}

*txt* _text_ 
{indent}Display text in the plot using the active font and font size.{indent} 
*curtxt* _curve\_text_ \[*size* _size_] \[*rot* _rot\_angle_] \[*use*] \[*bsp*] \[*palign* _align\_x_ _align\_y_] 
{indent}Display _curve\_text_ by following the curve in active data using the active font and font size. 
*use*: use the curve as it is. *bsp*: b-spline the curve. *palign*: position aligning the text according to _align\_x_ _align\_y_. 
If these parameters are set to 0 the text will be placed on the line.{indent} 

*axes n | e | w | s* \[_incrx | incry | factorx | factory | offsetx | offsety_] 
{indent}Display axes for side: north | east | west | south. Specify increment, factor and offset.{indent} 
*talign* _x\_position_ _y\_position_ 
{indent}Set graphics alignment of text.{indent} 
*ticml* _tic\_mark\_length_ 
{indent}Specify tic mark length for axes of size _tic\_mark\_length_.{indent} 
*pos* _x\_position_ _y\_position_ *cm* 
{indent}Set current position. Possibly translate from user to cm.{indent} 
*line* _x\_start_ _y\_start_ _x\_stop_ _y\_stop_ 
{indent}Will draw a line from start to stop.{indent} 
*chf* _crosshair\_factor_ 
{indent}Factor of the small cross lines in geographical grid.{indent} 
*utmgrid* _delta\_x_ _delta\_y_ _cross\_size_ 
{indent}Plotting of utmgrid or current projection.{indent} 
*moveto* _x\_start_ _y\_start_ 
{indent}Will move the pen to the start position.{indent} 
*lineto* _x\_stop_ _y\_stop_ 
{indent}Will draw the pen to the stop position.{indent} 
*win* _x\_lower\_left_ _y\_lower\_left_ _x\_upper\_right_ _y\_upper\_right_ \[*aoi*] 
{indent}Set plot window area in world coordinates. *aoi* means set this as area of interest.{indent} 
*devcm2user* 
{indent}Will return to a Tcl variable the factor between cm and user coordinates.{indent} 
*user2devcm* 
{indent}Will return to a Tcl variable the factor between user and cm coordinates.{indent} 
*arc* _x\_center_ _y\_center_ _radius_ _start\_angle_ _stop\_angle_ 
{indent}Will draw an arc according to the parameters specified.{indent} 
*ssc* 
{indent}Will set the area of interest to match the bounding box of active data.{indent} 
*bmp | jpeg | jpg* _file\_name_ | *use* 
{indent}Display a bit map of specified format from a _file\_name_ or use the current graphics on the screen.{indent} 
*cross* _x\_center_ _y\_center_ _size_ 
{indent}Will draw a cross at _x\_center y\_center_ with the total size in x and y directions.{indent} 
*newline* 
{indent}Issue a new text line equivalent to 1.2 times the fontsize.{indent} 
*clip* _x\_lower\_left y\_lower\_left x\_upper\_right y\_upper\_right_ 
{indent}Clip out an area of the plot in user coordinates.{indent} 
*linestype* _line\_style_ 
{indent}Will set the line style, use 0,1 or 2. Ref. psc manual[PostScript Reference Manual (third edition) s|http://www.adobe.com/products/postscript/pdfs/PLRM.pdf] p.673-674.{indent}????  
*linewidth* _line\_width_ 
{indent}Will set the line with size. To be used in pattern specifications.{indent} 
*outline on | off* 
{indent}Will set outline of text on | off.{indent} 
*overprint on | off* 
{indent}Will set overprint of graphics on | off.{indent} 
*dash* _dash1 space1 dash2 space2_ etc... 
{indent}Will set line plotting in dash mode according to the dash pattern. Ref. psc manual[PostScript Reference Manual (third edition) s|http://www.adobe.com/products/postscript/pdfs/PLRM.pdf] p.666.{indent} 
*pattern open* _x\_size y\_size_ 
{indent}Open a pattern of size _x\_size y\_size_. 
The postscript commands making up the pattern should be coded hereafter.{indent} 

*pattern close* _name_ \[_rotation_] 
{indent}Close the active pattern and name it _name_. 
Optionally use a rotation.{indent}

*pattern* _name_ 
{indent}Use pattern with name of pattern _name_.{indent} 

h2. Examples

h3. Ex.1: Producing a postscript plot

{noformat:|borderWidth=1|bgColor=#eeeeee}
        psc format a4                               ;# specify format
        win demo                                    ;# demo window: 450000 460000 6450000 6460000 1000 4000
        psc open c:/users/olav/psfile.ps            ;# open output file
        psc on                                      ;# set postscript on
        psc vie 0.1 0.1 0.9 0.9                     ;# specify viewport in viewport coordinates
        mak ran 11                                  ;# make 11 random points
        grp 99 99                                   ;# grid surface 99 x 99 elements
        sma i 250 can                               ;# spline map and annotate contours
        psc off                                     ;# turn off postscript
        sma i 250 sav                               ;# spline map and sav contours
        psc on                                      ;# turn on postscript
        mak glc                                     ;# get largest cell
        col red                                     ;# set red color
        pol                                         ;# draw the line
        psc fontsize 1.5 cm                         ;# set font size
        psc col .3 .2 .6                            ;# set color
        psc curtxt "Largest contour" palign 0 0     ;# plot text to follow curve with no alignment
        psc pos 450200 6461000                      ;# specify position
        psc fontsize 2.8 cm                         ;# set font size
        psc col .5 .9 .9                            ;# set color
        psc txt "This is a text"                    ;# plot text
        psc outline on                              ;# activate outline
        psc lwf 2                                   ;# set line width factor
        psc col 0 0 0                               ;# color black
        psc txt "This is a text"                    ;# plot outline around text
        psc outline off                             ;# outline feature off
        psc lwf 1                                   ;# reset line width factor
        col gre                                     ;# set green color
        dra dwa                                     ;# dra data window area
        psc fontsize 0.5 cm                         ;# set font size
        psc ticml 0.15                              ;# set tic mark length (in cm)
        psc axes ns incrx 2000 incry 2000           ;# draw axes in north and south
        psc axes ew incrx 2000 incry 2000           ;# draw axes in east and west
        psc close                                   ;# close postscript
{noformat}

The above example produces this image.

!att:_img_ref^psc.png!
_Simple postscript plot to demonstrate principles._

h2. See also

[pol], [map], [sma]