CAMgraphicsProcess General Programming Considerations


Code Structure

To use CAMgraphicsProcess classes one must create both a CAMgraphicsProcess instance,and an instance of a class derived from CAMgraphicsDriver. The "high level" plotting routines in CAMgraphicsProcess call upon the "low level" routines provided by the device driver to create graphics output. One associates the device driver with a particular CAMgraphicsProcess by invoking the attachDriver(…) member function.

The general structure of a code using the CAMgraphicsProcess class and the CAMpostscriptDriver class has the form:

 

      CAMgraphicsProcss Gprocess;             // create instance
      CAMpostScriptDriver Pdriver("graph.ps");// Postscript driver
                                              // with output to graph.ps
       
      GProcess.attachDriver(Pdriver);
                                       
  ... style/format commands for first picture ...

  ... plotting commands for first picture ...

      Gprocess.frame();                       // close first picture

  ... style/format commands for second picture ...

 ...  plotting commands for second picture ...

      GProcess.frame();                     // close second picture

 

As the pseudo code illustrates, the plotting and style routines are sandwiched between graphic system control routines. The style routines are called before the plotting routines. The plotting routines are calls to the CAMgraphicsProcess plotting functions that accept C++ standard data types and arrays of standard data types.


Using Enumerated Constants

In many of the plotting routines, enumerated constants associated with the CAMgraphicsProcess class are used as input arguments. The enumerated constants are listed below the tables that contain the routines that require them. All of the enumerated constants have the form CAMgraphicsProcess::CONSTANT_NAME.

For example, to change the default line color to red, one uses the statement

CAMgraphicsProcess::setPlotLineColor(CAMgraphicsProcess::RED);

Alternately, one can pass the routines the integer equivalent of an enumerated constant. CAMgraphicsProcess::RED corresponds to a value of 9, so one could set the line color to red using the statement

CAMgraphicsProcess::setPlotLineColor(9);

 


 Additional Notes