Workstation class

A Workstation object manages an instance of an output device.


Synopsis

Header file:		ncarg/hlu/Workstation.h
Class name:		workstationClass
Class pointer:		<Not referenceable>
Fortran class function:	<Not referenceable>
Superclass:		Base
Composite classes:	<None>

Class-defined types

Type name:		NhlTColorIndex
Definition:		typedef int NhlColorIndex;
				Valid Range is -1 to 255
				-1:	NhlTRANSPARENT
				 0:	NhlBACKGROUND
				 1:	NhlFOREGROUND

Type name:		NhlTColorMap
Definition:		A name of a pre-defined colormap, or an array
                        of a combination of RGB values, named colors,
                        and other color specification formats.

Type name:		NhlTColorIndexGenArray
Definition:		An array of NhlTColorIndex elements.

Type name:		NhlTColorDefinitionGenArray
Definition:             A one-dimensional array defining an RGB triplet,
                        or a string containing a color name from
                        $NCARG_ROOT/lib/ncarg/database/rgb.txt.

Type name:		NhlTDashIndex
Definition:		typedef int NhlDashIndex;
				Valid Range is 0 to NhlNwkDashTableLength
				 0:	NhlSOLIDLINE

Type name:		NhlTDashIndexGenArray
Definition:		An array of NhlTDashIndex elements.

Type name:		NhlTFillIndex
Definition:		typedef int NhlFillIndex;
				Valid Range is -1 to NhlNwkFillTableLength
				-1:	NhlHOLLOWFILL
				 0:	NhlSOLIDFILL

Type name:		NhlTFillIndexGenArray
Definition:		An array of NhlTFillIndex elements.

Type name:		NhlTMarkerIndex
Definition:		typedef int NhlMarkerIndex;
				Valid Range is 0 to NhlNwkMarkerTableLength
				 0:	"default"
				 1:	"dot"
				 2:	"+"
				 2:	"plus"
				 3:	"*"
				 3:	"asterisk"
				 4:	"hollow_circle"
				 5:	"cross"
				 5:	"x"
				 6:	"hollow_square"
				 7:	"up_triangle"
				 8:	"down_triangle"
				 9:	"diamond"
				10:	"left_triangle_filled"
				11:	"right_triangle_filled"
				12:	"star_5point"
				13:	"star_6point"
				14:	"circle_w_dot"
				15:	"circle_w_cross"
				16:	"circle_filled"

Type name:		NhlTMarkerIndexGenArray
Definition:		An array of NhlTMarkerIndex elements.

Type name:		NhlTMarkLineMode
Definition:
typedef enum _NhlMarkLineMode {
	NhlLINES	= 0,	/* "Lines"	*/
	NhlMARKERS	= 1,	/* "Markers"	*/
	NhlMARKLINES	= 2	/* "MarkLines"	*/
} NhlMarkLineMode;

Type name:		NhlTMarkLineModeGenArray
Definition:		An array of NhlTMarkLineMode elements.

Resources

Local resources

+---------------------------------------------------------------+
|			Workstation Resource Set		|
|---------------------------------------------------------------|
| NAME				TYPE			ACCESS	|
|	CLASS				DEFAULT			|
|===============================================================|
| wkColorMap			NhlTColorMap	RCSG	        |
|	WkColorMap			<Dynamic>		|
|---------------------------------------------------------------|
| wkColorMapLen			NhlTInteger		G	|
|	WkColorMapLen			<Dynamic>		|
|---------------------------------------------------------------|
| wkBackgroundColor     NhlTColorDefinitionGenArray     RCSG    |
|	WkBackgroundColor		(/0.0,0.0,0.0/)		|
|---------------------------------------------------------------|
| wkForegroundColor     NhlTColorDefinitionGenArray     RCSG    |
|	WkForegroundColor		<Dynamic>		|
|---------------------------------------------------------------|
| wkDashTableLength		NhlTInteger		G	|
|	WkDashTableLength		<Dynamic>		|
|---------------------------------------------------------------|
| wkFillTableLength		NhlTInteger		G	|
|	WkFillTableLength		<Dynamic>		|
|---------------------------------------------------------------|
| wkMarkerTableLength		NhlTInteger		G	|
|	WkMarkerTableLength		<Dynamic>		|
|---------------------------------------------------------------|
| wkGksWorkId			NhlTInteger		G	|
|	WkGksWorkId			<Dynamic>		|
|---------------------------------------------------------------|
| wkDefGraphicStyleId		NhlTInteger		G	|
|	WkDefGraphicStyleId		<Dynamic>		|
+---------------------------------------------------------------+

Composite resources

The Workstation object class has no composite class objects.

Superclass resources

The superclasses of the Workstation object class do not define any resources.

Description

In the context of the HLU library, the Workstation object class represents the interface to a generalized output device. It is not designed to be instantiated directly. Instead there exist object classes derived from the Workstation object that are specialized for particular types of output. You must always create an object belonging to the Workstation class for any program using the HLU library. All drawable objects must be created with a Workstation parent. Currently there are three object classes subclassed from the Workstation class: XWorkstation for drawing into a window of a workstation running the X Window System, PSWorkstation for creating a PostScript file, and NcgmWorkstation for creating an NCAR Computer Graphics Metafile.

The Workstation object provides access to a color map and tables of line dash patterns, area fill patterns, and markers. There is a default colormap that is shared by all subclasses of Workstation objects, but it is also possible to create an individual colormap for any instance of a Workstation object. The dash pattern, fill pattern, and marker tables are shared by all Workstation objects and are currently read-only. Eventually, however, there will be methods for creating individual user-defined versions of each of these tables.

The Workstation colormap may contain up to 256 different colors, including the background color. You specify the color of features to be drawn using an HLU color index in the range 0 through 255. An allocated color index is one for which an RGB triple defining a color has been specified. Color index 0 specifies the background color and color index 1 specifies the foreground color. The Workstation colormap is defined to repeat itself. So, if you specify a color index that is greater than any of the currently defined indexes, the index will be mapped into the correct range. If you specify a currently unallocated color index for a feature, the Workstation object will use the foreground color. (This refers to color indexes that are unallocated, but are less than another currently defined index. In other words, the holes in the colormap are filled with the foreground color.) You may allocate a complete colormap using the wkColorMap resource; there are also support functions for allocating and freeing individual colors.

All Workstation class objects share the ability to update and clear the Workstation drawing area. The UpdateWorkstation and ClearWorkstation functions perform different tasks depending on the class of Workstation object for which they are invoked. For the NcgmWorkstation, the clear and update functions write special CGM commands into the CGM file that end the current frame and start a new one. For the XWorkstation, the update function causes all pending draw commands to be drawn, and the clear function clears the entire window. There is also a convenience function, Frame, that calls both the update and clear functions. This function operates much like the Frame call in the low level NCAR graphics libraries.


Support functions

The Workstation object defines the following support functions:
UpdateWorkstation
The UpdateWorkstation function updates the drawing area of an instance of a Workstation object.
ClearWorkstation
The ClearWorkstation function clears the drawing area of an instance of a Workstation object.
Frame
The Frame function first updates and then clears the drawing area of an instance of a Workstation object.
NewColor
The NewColor function adds a color specified as an RGB triple to the colormap of a Workstation instance and returns its HLU color index.
SetColor
The SetColor function sets the RGB color values for a specified HLU color index.
FreeColor
The FreeColor function removes a color, specified by its HLU index, from the Workstation color map.
IsAllocatedColor
The boolean function IsAllocatedColor returns True if a color has been assigned to a particular HLU color index, and False otherwise.
NhlIsWorkstation
This function just determines if a given object id identifies a Workstation class object.

Status


See also


Copyright

Copyright 1987-1999 University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.

NCAR Graphics is a registered trademark of the University Corporation for Atmospheric Research.

Reference Manual Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.21 $ $Date: 1999/03/11 20:13:06 $