Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Current »

Name

psc — PostScript plotting

Syntax

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

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 Language Reference Manual (third edition).

Arguments

lwf line_width_factor

Set the line_width_factor of a postscript pen.

slwf line_width_factor

Set line_width_factor for shift lines in contouring.

open file_name

Open the file_name for writing postscript output.

close

Close the current output file for writing postscript output.

scp scale_in_meters_x scale_in_meters_y rel_portion_of_horizontal_margin_left rel_portion_of_vertical_margin_bottom

Scale plot, using the scale parameters for plot in x and y direction and the relative portion of the margins.

fontsize fontsize [cm]

Set the fontsize in user coordinates or in cm.

vie x_lower_left y_lower_left x_upper_right y_upper_right [cm]

Set viewport area, either in relative coordinates or in cm.

align [top | bottom | left | right | center]

Set graphics alignment.

status

Will write out the status of postscript in the message window.

prot [reset] | x_position y_position rotation_angle [cm]

Set rotation of plot in user or cm coordinates.

col red blu gre

Display the postscript line in rgb values red blu gre. Observe that the standard col command will also affect postscript when active.

font font_number

Will set the font with the given font_number.

fill

Will issue the postscript fill command in the output file.

stroke

Will issue the postscript stroke command in the output file.

rec x_lower_left y_lower_left x_upper_right y_upper_right

Will draw a rectangle according to the parameter input.

expand hor | ver | inside | outside | cover

Will expand the plot inside the viewport according to the argument. 

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.

txt text

Display text in the plot using the active font and font size.

curtxt curve_text [size size] [rot rot_angle] [use] [bsp] [palign align_x align_y]

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.

axes n | e | w | s [incrx | incry | factorx | factory | offsetx | offsety]

Display axes for side: north | east | west | south. Specify increment, factor and offset.

talign x_position y_position

Set graphics alignment of text.

ticml tic_mark_length

Specify tic mark length for axes of size tic_mark_length.

pos x_position y_position cm

Set current position. Possibly translate from user to cm.

line x_start y_start x_stop y_stop

Will draw a line from start to stop.

chf crosshair_factor

Factor of the small cross lines in geographical grid.

utmgrid delta_x delta_y cross_size

Plotting of utmgrid or current projection.

moveto x_start y_start

Will move the pen to the start position.

lineto x_stop y_stop

Will draw the pen to the stop position.

win x_lower_left y_lower_left x_upper_right y_upper_right [aoi]

Set plot window area in world coordinates. aoi means set this as area of interest.

devcm2user

Will return to a Tcl variable the factor between cm and user coordinates.

user2devcm

Will return to a Tcl variable the factor between user and cm coordinates.

arc x_center y_center radius start_angle stop_angle

Will draw an arc according to the parameters specified.

ssc

Will set the area of interest to match the bounding box of active data.

bmp | jpeg | jpg file_name | use [noref]

Display a bit map of specified format from a file_name or use the active dataset when it is a bit map image. 

psc bmp use will assume that the bit map (image) in active is georeferenced unless the noref arument is added

When Postscript plotting is active one can also display the active bit map (image) by dis [noref] or ima [noref]. In that case the image will also appear on the screen.

Just displaying the bit map from a file will assume it is not georeferenced. If it is, read it in as an active dataset first.

cross x_center y_center size

Will draw a cross at x_center y_center with the total size in x and y directions.

newline

Issue a new text line equivalent to 1.2 times the fontsize.

clip x_lower_left y_lower_left x_upper_right y_upper_right

Clip out an area of the plot in user coordinates.

linestype line_style

Will set the line style, use 0,1 or 2. Ref. PostScript Language Reference Manual (third edition) p.673-674, setlinecap.

linewidth line_width

Will set the line with size. To be used in pattern specifications.

outline on | off

Will set outline of text on | off.

overprint on | off

Will set overprint of graphics on | off.

dash dash1 space1 dash2 space2 etc...

Will set line plotting in dash mode according to the dash pattern. Ref. PostScript Language Reference Manual (third edition) p.666.

pattern open x_size y_size

Open a pattern of size x_size y_size
The postscript commands making up the pattern should be coded hereafter.

pattern close name [rotation]

Close the active pattern and name it name. Optionally use a rotation.

pattern name

Use pattern with name of pattern name.

Examples

Ex.1: Producing a postscript plot

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

The above example produces this image.


Simple postscript plot to demonstrate principles

Ex.2: Applying pattern in a postscript plot

psc format a4

psc open "C:/Users/Olav/test.ps"
psc on

rea block.pol
ssc
psc ssc

################## Make pattern
# norwegian flag
psc com 100 100 scale
psc pattern open 30 24
psc col 1 1 1
psc rec 0.1 0.1 22.1 16.1
psc fill
psc col 0.9372 0.1686 0.1765
psc rec 0.1 0.1 6.1 6.1
psc fill
psc rec 0.1 10 6.1 16.1
psc fill
psc rec 10 0.1 22.1 6.1
psc fill
psc rec 10 10 22.1 16.1
psc fill
psc col 0 0.1568 0.4078
psc rec 0.1 7.1 22.1 9.1
psc fill
psc rec 7.1 0.1 9.1 16.1
psc fill
psc pattern close Norway
psc com 0.01 0.01 scale
################## End pattern

# Save in workspace block
mhi block

psc pattern Norway ; # apply pattern
dis fill ; # display with fill option
psc pattern stop

mlo block
col 0 0 0
pol

psc close

The above example produces this image.


Demonstration of pattern

See also

pol - Polygon type display, map - Map display, sma - Spline map

  • No labels