![]() |
http://www.sim.no http://www.coin3d.org |
SoVectorizeAction will traverse the scene graph and convert all supported geometry into vectorized data. Subclasses can then use this data to produce vector files of different formats. More...
#include <HardCopy/SoVectorizeAction.h>
Public Types | |
enum | DimensionUnit { INCH, MM, METER } |
enum | Orientation { PORTRAIT, LANDSCAPE } |
enum | PageSize { A0 = 0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 } |
enum | PointStyle { CIRCLE, SQUARE } |
enum | ColorTranslationMethod { REVERSE_ONLY_BLACK_AND_WHITE, AS_IS, REVERSE } |
enum | JoinLineStyle { NO_JOIN, MITERED_JOIN, MITERED_BEVELED_JOIN, BEVELED_JOIN, TRIANGULAR_JOIN, ROUNDED_JOIN } |
enum | EndLineStyle { BUTT_END, SQUARE_END, TRIANGULAR_END, ROUND_END } |
enum | HLHSRMode { NO_HLHSR, HLHSR_SIMPLE_PAINTER, HLHSR_PAINTER, HLHSR_PAINTER_SURFACE_REMOVAL, HIDDEN_LINES_REMOVAL } |
Public Member Functions | |
virtual SoType | getTypeId (void) const |
SoVectorizeAction (void) | |
virtual | ~SoVectorizeAction () |
SoVectorOutput * | getOutput (void) const |
virtual void | apply (SoNode *node) |
virtual void | apply (SoPath *path) |
virtual void | apply (const SoPathList &pathlist, SbBool obeysrules=0) |
void | beginStandardPage (const PageSize &pagesize, const float border=10.0f) |
virtual void | beginPage (const SbVec2f &startpagepos, const SbVec2f &pagesize, DimensionUnit u=MM) |
virtual void | endPage (void) |
virtual void | calibrate (const SbViewportRegion &vp) |
virtual void | beginViewport (const SbVec2f &startpos=SbVec2f(-1.0f, 1.0f), const SbVec2f &size=SbVec2f(-1.0f,-1.0f), DimensionUnit u=MM) |
virtual void | endViewport (void) |
virtual void | setOrientation (Orientation o) |
virtual Orientation | getOrientation (void) const |
virtual void | setBackgroundColor (SbBool bg, const SbColor &col=SbColor(0.0f, 0.0f, 0.0f)) |
virtual SbBool | getBackgroundColor (SbColor &col) const |
virtual void | setNominalWidth (float w, DimensionUnit u=MM) |
virtual float | getNominalWidth (DimensionUnit u=MM) const |
virtual void | setPixelImageSize (float w, DimensionUnit u=MM) |
virtual float | getPixelImageSize (DimensionUnit u=MM) const |
virtual void | setPointStyle (const PointStyle &style) |
virtual PointStyle | getPointStyle (void) const |
const SbVec2f & | getPageStartpos (void) const |
const SbVec2f & | getPageSize (void) const |
virtual void | setDrawingDimensions (const SbVec2f &d, DimensionUnit u=MM) |
virtual void | setDrawingDimensions (float w, float h, DimensionUnit u=MM) |
virtual SbVec2f | getDrawingDimensions (DimensionUnit u=MM) const |
virtual void | setStartPosition (const SbVec2f &p, DimensionUnit u=MM) |
virtual void | setStartPosition (float x, float y, DimensionUnit u=MM) |
virtual SbVec2f | getStartPosition (DimensionUnit u=MM) const |
virtual void | setColorTranslationMethod (ColorTranslationMethod method) |
virtual ColorTranslationMethod | getColorTranslationMethod (void) const |
virtual void | setLineEndStyle (EndLineStyle style) |
virtual EndLineStyle | getLineEndStyle (void) const |
virtual void | setLineJoinsStyle (JoinLineStyle style) |
virtual JoinLineStyle | getLineJoinsStyle (void) const |
virtual void | setHLHSRMode (HLHSRMode mode) |
HLHSRMode | getHLHSRMode (void) const |
virtual void | setBorder (float width) |
virtual void | setBorder (float width, SbColor color) |
virtual void | setMiterLimit (float limit) |
virtual float | getMiterLimit (void) const |
virtual void | setPenDescription (int num_pens, const SbColor *colors=0, const float *widths=0, DimensionUnit u=MM) |
virtual void | getPenDescription (SbColor *colors, float *widths, DimensionUnit u=MM) const |
virtual int | getPenNum (void) const |
virtual void | setColorPriority (SbBool priority) |
virtual SbBool | getColorPriority (void) const |
virtual void | enableLighting (SbBool flag) |
SbBool | isLightingEnabled (void) const |
Static Public Member Functions | |
static SoType | getClassTypeId (void) |
static void | addMethod (const SoType type, SoActionMethod method) |
static void | enableElement (const SoType type, const int stackindex) |
static void | initClass (void) |
Protected Member Functions | |
virtual const SoEnabledElementsList & | getEnabledElements (void) const |
void | setOutput (SoVectorOutput *output) |
virtual float | pixelsToUnits (const int pixels) |
virtual void | printHeader (void) const =0 |
virtual void | printFooter (void) const |
virtual void | printBackground (void) const |
virtual void | printItem (const SoVectorizeItem *item) const =0 |
virtual void | printViewport (void) const |
SbVec2f | getRotatedViewportStartpos (void) const |
SbVec2f | getRotatedViewportSize (void) const |
const SbBSPTree & | getBSPTree (void) const |
Static Protected Member Functions | |
static SoEnabledElementsList * | getClassEnabledElements (void) |
static SoActionMethodList * | getClassActionMethods (void) |
Friends | |
class | SoVectorizeActionP |
SoVectorizeAction will traverse the scene graph and convert all supported geometry into vectorized data. Subclasses can then use this data to produce vector files of different formats.
Currently supported geometry:
TGS provides HardCopy support as a separate extension for TGS Inventor.
The unit used by the scene graph.
The drawing orientation.
SoVectorizeAction::SoVectorizeAction | ( | void | ) |
Default constructor.
SoVectorizeAction::~SoVectorizeAction | ( | ) | [virtual] |
Destructor.
SoType SoVectorizeAction::getTypeId | ( | void | ) | const [virtual] |
Returns the type identification of an action derived from a class inheriting SoAction. This is used for run-time type checking and "downward" casting.
Usage example:
void bar(SoAction * action) { if (action->getTypeId() == SoGLRenderAction::getClassTypeId()) { // safe downward cast, know the type SoGLRenderAction * glrender = (SoGLRenderAction *)action; } return; // ignore if not renderaction }
For application programmers wanting to extend the library with new actions: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through Inventor/nodes/SoSubAction.h: SO_ACTION_SOURCE, SO_ACTION_INIT_CLASS and SO_ACTION_CONSTRUCTOR.
For more information on writing Coin extensions, see the SoAction class documentation.
Returns the actual type id of an object derived from a class inheriting SoAction. Needs to be overridden in all subclasses.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
SoType SoVectorizeAction::getClassTypeId | ( | void | ) | [static] |
Returns the run-time type object associated with instances of this class.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
void SoVectorizeAction::addMethod | ( | const SoType | type, | |
SoActionMethod | method | |||
) | [static] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
void SoVectorizeAction::enableElement | ( | const SoType | type, | |
const int | stackindex | |||
) | [static] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
const SoEnabledElementsList & SoVectorizeAction::getEnabledElements | ( | void | ) | const [protected, virtual] |
Returns a list of the elements used by action instances of this class upon traversal operations.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
SoEnabledElementsList * SoVectorizeAction::getClassEnabledElements | ( | void | ) | [static, protected] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
This method not available in the original OIV API, see SoSubAction.h for explanation.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
SoActionMethodList * SoVectorizeAction::getClassActionMethods | ( | void | ) | [static, protected] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
This method not available in the original OIV API, see SoSubAction.h for explanation.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
SoVectorOutput * SoVectorizeAction::getOutput | ( | void | ) | const |
Returns the SoVectorOutput class used by this action. The output is written to stdout by default, but you can change this by using SoVectorOutput::openFile().
Reimplemented in SoVectorizePSAction.
void SoVectorizeAction::initClass | ( | void | ) | [static] |
Initializes the run-time type system for this class, and sets up the enabled elements and action method list.
Reimplemented from SoCallbackAction.
Reimplemented in SoVectorizePSAction.
Referenced by SoHardCopy::init().
void SoVectorizeAction::apply | ( | SoNode * | root | ) | [virtual] |
Applies the action to the scene graph rooted at root.
Note that you should not apply an action to a node with a zero reference count. The behavior in that case is undefined.
Reimplemented from SoAction.
References SoAction::apply().
void SoVectorizeAction::apply | ( | SoPath * | path | ) | [virtual] |
Applies the action to the parts of the graph defined by path.
Note that an SoPath will also contain all nodes that may influence e.g. geometry nodes in the path. So for instance applying an SoGLRenderAction on an SoPath will render that path as expected in the view, where geometry will get its materials, textures, and other appearance settings correctly.
If the path ends in an SoGroup node, the action will also traverse the tail node's children.
Reimplemented from SoAction.
References SoAction::apply().
void SoVectorizeAction::apply | ( | const SoPathList & | pathlist, | |
SbBool | obeysrules = 0 | |||
) | [virtual] |
Applies action to the graphs defined by pathlist. If obeysrules is set to TRUE
, pathlist must obey the following four conditions (which is the case for path lists returned from search actions for non-group nodes and path lists returned from picking actions):
All paths must start at the same head node. All paths must be sorted in traversal order. The paths must be unique. No path can continue through the end point of another path.
Reimplemented from SoAction.
References SoAction::apply().
void SoVectorizeAction::beginPage | ( | const SbVec2f & | startpagepos, | |
const SbVec2f & | pagesize, | |||
DimensionUnit | u = MM | |||
) | [virtual] |
Begin writing a page. This will write file header information and print background (if enabled) and border.
References beginViewport(), getRotatedViewportSize(), printBackground(), printHeader(), and SoCallbackAction::setViewportRegion().
void SoVectorizeAction::endPage | ( | void | ) | [virtual] |
End page. This will write all remaining geometry, and write the file footer.
References endViewport(), and printFooter().
void SoVectorizeAction::calibrate | ( | const SbViewportRegion & | vp | ) | [virtual] |
Will calibrate pixel based attributes (font size, line width, points size, etc) so that it will match OpenGL rendering done in vp.
References getPageSize(), and SbViewportRegion::getViewportSizePixels().
void SoVectorizeAction::beginViewport | ( | const SbVec2f & | start = SbVec2f(-1.0f, 1.0f) , |
|
const SbVec2f & | size = SbVec2f(-1.0f, -1.0f) , |
|||
DimensionUnit | u = MM | |||
) | [virtual] |
Begin writing a viewport inside the current page.
References getRotatedViewportSize(), printViewport(), and SoCallbackAction::setViewportRegion().
Referenced by beginPage().
void SoVectorizeAction::endViewport | ( | void | ) | [virtual] |
End writing a viewport. This will flush all vector items.
Referenced by endPage().
void SoVectorizeAction::setOrientation | ( | Orientation | o | ) | [virtual] |
Sets the orientation to o.
SoVectorizeAction::Orientation SoVectorizeAction::getOrientation | ( | void | ) | const [virtual] |
Returns the current orientation.
Referenced by getRotatedViewportSize(), getRotatedViewportStartpos(), and SoVectorizePSAction::printHeader().
void SoVectorizeAction::setBackgroundColor | ( | SbBool | bg, | |
const SbColor & | col = SbColor(0.0f, 0.0f, 0.0f) | |||
) | [virtual] |
Sets the background color. If bg is FALSE, the background will not be cleared before rendering. If bg is TRUE, the background will be cleared to col before in beginPage().
SbBool SoVectorizeAction::getBackgroundColor | ( | SbColor & | col | ) | const [virtual] |
Returns if the background will be cleared or not. When this function returns TRUE, col will be set to the background color.
Referenced by SoVectorizePSAction::printBackground().
void SoVectorizeAction::setNominalWidth | ( | float | w, | |
DimensionUnit | u = MM | |||
) | [virtual] |
Sets how to convert pixel based attributes (line width and point size) to vector sizes. By default 1 pixel equals 0.35 mm.
void SoVectorizeAction::setPixelImageSize | ( | float | w, | |
DimensionUnit | u = MM | |||
) | [virtual] |
Sets how the images and 2D fonts are converted. By default 1 pixel equals 0.35 mm.
float SoVectorizeAction::getPixelImageSize | ( | DimensionUnit | u = MM |
) | const [virtual] |
void SoVectorizeAction::setPointStyle | ( | const PointStyle & | style | ) | [virtual] |
Sets the points rendering style. Default style is CIRCLE.
SoVectorizeAction::PointStyle SoVectorizeAction::getPointStyle | ( | void | ) | const [virtual] |
Returns the points rendering style.
const SbVec2f & SoVectorizeAction::getPageStartpos | ( | void | ) | const |
Returns the current page startpos.
Referenced by SoVectorizePSAction::printHeader().
const SbVec2f & SoVectorizeAction::getPageSize | ( | void | ) | const |
Returns the current page size.
Referenced by calibrate(), pixelsToUnits(), and SoVectorizePSAction::printHeader().
void SoVectorizeAction::setDrawingDimensions | ( | const SbVec2f & | d, | |
DimensionUnit | u = MM | |||
) | [virtual] |
Sets the drawing dimensions. You can use this and setStartPosition() instead of using beginViewport(). Provided for TGS OIV compatibility.
SbVec2f SoVectorizeAction::getDrawingDimensions | ( | DimensionUnit | u = MM |
) | const [virtual] |
Returns the current drawing dimensions.
void SoVectorizeAction::setStartPosition | ( | const SbVec2f & | p, | |
DimensionUnit | u = MM | |||
) | [virtual] |
Sets the drawing staring position. You can use this and setDrawingDimensions() instead of using beginViewport(). Provided for TGS OIV compatibility.
SbVec2f SoVectorizeAction::getStartPosition | ( | DimensionUnit | u = MM |
) | const [virtual] |
Returns the current drawing starting position.
void SoVectorizeAction::setColorTranslationMethod | ( | ColorTranslationMethod | method | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
SoVectorizeAction::ColorTranslationMethod SoVectorizeAction::getColorTranslationMethod | ( | void | ) | const [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setLineEndStyle | ( | EndLineStyle | style | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
SoVectorizeAction::EndLineStyle SoVectorizeAction::getLineEndStyle | ( | void | ) | const [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setLineJoinsStyle | ( | JoinLineStyle | style | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
SoVectorizeAction::JoinLineStyle SoVectorizeAction::getLineJoinsStyle | ( | void | ) | const [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setHLHSRMode | ( | HLHSRMode | mode | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
SoVectorizeAction::HLHSRMode SoVectorizeAction::getHLHSRMode | ( | void | ) | const |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setBorder | ( | float | width | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setBorder | ( | float | width, | |
SbColor | color | |||
) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setMiterLimit | ( | float | limit | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setPenDescription | ( | int | num_pens, | |
const SbColor * | colors = 0 , |
|||
const float * | widths = 0 , |
|||
DimensionUnit | u = MM | |||
) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::getPenDescription | ( | SbColor * | colors, | |
float * | widths, | |||
DimensionUnit | u = MM | |||
) | const [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
int SoVectorizeAction::getPenNum | ( | void | ) | const [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setColorPriority | ( | SbBool | priority | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
SbBool SoVectorizeAction::getColorPriority | ( | void | ) | const [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::enableLighting | ( | SbBool | flag | ) | [virtual] |
Not implemented yet. Provided for TGS OIV compatibility.
SbBool SoVectorizeAction::isLightingEnabled | ( | void | ) | const |
Not implemented yet. Provided for TGS OIV compatibility.
void SoVectorizeAction::setOutput | ( | SoVectorOutput * | output | ) | [protected] |
Should be used by subclasses to set the SoVectorOutput instance that should be used.
Referenced by SoVectorizePSAction::SoVectorizePSAction().
float SoVectorizeAction::pixelsToUnits | ( | const int | pixels | ) | [protected, virtual] |
Converts pixels to normalized units.
References getPageSize(), and getPixelImageSize().
void SoVectorizeAction::printHeader | ( | void | ) | const [protected, pure virtual] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Implemented in SoVectorizePSAction.
Referenced by beginPage().
void SoVectorizeAction::printFooter | ( | void | ) | const [protected, virtual] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Should be overridden by subclasses to print file footer data.
Reimplemented in SoVectorizePSAction.
Referenced by endPage().
void SoVectorizeAction::printBackground | ( | void | ) | const [protected, virtual] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Should be overridden by subclasses to print background data.
Reimplemented in SoVectorizePSAction.
Referenced by beginPage().
void SoVectorizeAction::printItem | ( | const SoVectorizeItem * | item | ) | const [protected, pure virtual] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Should be overridden by subclasses to print an item.
Implemented in SoVectorizePSAction.
void SoVectorizeAction::printViewport | ( | void | ) | const [protected, virtual] |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Should be overridden by subclasses to set up the current page viewport.
Reimplemented in SoVectorizePSAction.
Referenced by beginViewport().
SbVec2f SoVectorizeAction::getRotatedViewportStartpos | ( | void | ) | const [protected] |
Convenience method for subclasses. Will return the viewport startpos, taking the orientation into account
References getOrientation().
Referenced by SoVectorizePSAction::printBackground(), and SoVectorizePSAction::printViewport().
SbVec2f SoVectorizeAction::getRotatedViewportSize | ( | void | ) | const [protected] |
Convenience method for subclasses. Will return the viewport size, taking the orientation into account
References getOrientation().
Referenced by beginPage(), beginViewport(), SoVectorizePSAction::printBackground(), and SoVectorizePSAction::printViewport().
const SbBSPTree & SoVectorizeAction::getBSPTree | ( | void | ) | const [protected] |
Returns the bps tree used to store triangle and line vertices.
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 23 16:34:05 2009 for Coin by Doxygen. 1.5.8