4.1.2. Using SoVectorizeAction

These actions are all derived from the SoVectorizeAction SoVectorizeAction SoVectorizeAction class. As with the SoWriteAction SoWriteAction SoWriteAction within Open Inventor that outputs the scene graph by writing to an SoOutput SoOutput SoOutput object, this class uses an SoVectorOutput SoVectorOutput SoVectorOutput object. This allows you to connect a file to the action using the getOutput() method and to output PostScript, HPGL, CGM, or GDI (only with Microsoft Windows) code to the file using the apply() method. This method specifies the part of the scene graph to which the action should be applied. This may be a node, a path, or a list of paths.

The four classes derived from SoVectorizeAction SoVectorizeAction SoVectorizeAction are:

  • SoVectorizeAction SoVectorizeAction SoVectorizeAction

    • SoVectorizePSAction

      Output PostScript format

    • SoVectorizeHPGLAction

      Output HPGL II format

    • SoVectorizeCGMAction

      Output CGM clear text or binary encoding. You can select which encoding you want by applying the setVersion method to the action.

    • SoVectorizeGDIAction

      Output GDI formats (available only with Microsoft Windows). Several types of output are available: Enhanced Metafiles files (EMF), directly to the printer, in a Device Context (DC).

Figure 4.1. VectorizeAction classes

The four classes derived from SoVectorOutput SoVectorOutput SoVectorOutput are:

Figure 4.2. Vector output classes

These actions allow you to configure the printer or plotter or CGM parameters using the methods listed below. (Please see the reference manual for a full description of these methods and their parameters. Not all of the following parameters apply to all output formats.)

  • setDrawingDimensions

    To specify the size of the output. These dimensions are defined using current units.

  • setStartPosition

    To specify the origin of the drawing.

  • setOrientation

    To specify the orientation of the drawing (portrait or landscape).

  • setBackgroundColor

    To specify the background color of the drawing.

  • setNominalWidth

    To specify the nominal width of lines. The line width scale factor will be applied to the nominal line width to compute the actual line width.

  • setColorTranslationMethod

    To specify how to convert black and white colors. Colors can be used as is or reversed.

  • setLineEndStyle

  • setLineJoinsStyle

  • setMiterLimit

    These three methods specify how the ends of wide lines are drawn and how multiple wide lines are joined. Refer to the reference manual for a complete description of the appearance of output depending on the parameters of these three methods.

  • setPenDescription

    To specify number of pens, their colors, and their widths.

  • setColorPriority

    To specify how HardCopy should match a required color to the actual colors given by the setPenDescription method. HardCopy can choose the pen with the closest matching color, the closest matching width, or a combination of both depending on the priority parameter.

  • enableLighting

    To take into account lighting.

  • beginPage

  • endPage

    To realize multiple plots per page.

  • setPixelImageSize

    To specify the association between the pixel image and pixel printer size.

  • setHLHSRMode

    To specify Hidden Line and Hidden Surface Removal mode (HLHSR). By default, no HLHSR is done. (The output will look as if you had rendered the scene graph in a viewer with the depth buffer comparison test turned off.) Generally, HLHSR_RASTER mode gives the best combination of performance and image quality.

  • setShadeModel

    To specify the shading model to use. With the default model (FLAT), each polygon is filled with a unique color which is the average of the colors associated with each vertex of the original polygon. With the smooth model (SMOOTH), each polygon is filled with shaded colors which are interpolations of the colors associated with each vertex of the original polygon.

    Smooth shading is only supported with PostScript Level 3 format.

HardCopy has the following limitations:

You must include a camera in your scene graph to generate correct output. Although the Open Inventor viewers add a camera to your scene graph if none exists, this camera is not part of your scene graph and the default view will be used. You can get the viewer’s scene graph, including the camera, as follows:

SoNode pVwrRoot = pViewer->getSceneManager()->getSceneGraph();