![]() |
http://www.sim.no http://www.coin3d.org |
Apply this action to a scene if you need to know the number of primitives present in a scenegraph, or parts of a scenegraph. More...
#include <Inventor/actions/SoGetPrimitiveCountAction.h>
Public Member Functions | |
virtual SoType | getTypeId (void) const |
SoGetPrimitiveCountAction (void) | |
virtual | ~SoGetPrimitiveCountAction () |
int | getTriangleCount (void) const |
int | getLineCount (void) const |
int | getPointCount (void) const |
int | getTextCount (void) const |
int | getImageCount (void) const |
SbBool | containsNoPrimitives (void) |
SbBool | containsNonTriangleShapes (void) |
SbBool | is3DTextCountedAsTriangles (void) |
void | setCount3DTextAsTriangles (const SbBool flag) |
SbBool | canApproximateCount (void) |
void | setCanApproximate (const SbBool flag) |
void | setDecimationValue (SoDecimationTypeElement::Type type, float percentage=1.0) |
SoDecimationTypeElement::Type | getDecimationType (void) |
float | getDecimationPercentage (void) |
void | addNumTriangles (const int num) |
void | addNumLines (const int num) |
void | addNumPoints (const int num) |
void | addNumText (const int num) |
void | addNumImage (const int num) |
void | incNumTriangles (void) |
void | incNumLines (void) |
void | incNumPoints (void) |
void | incNumText (void) |
void | incNumImage (void) |
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 |
virtual void | beginTraversal (SoNode *node) |
Static Protected Member Functions | |
static SoEnabledElementsList * | getClassEnabledElements (void) |
static SoActionMethodList * | getClassActionMethods (void) |
Apply this action to a scene if you need to know the number of primitives present in a scenegraph, or parts of a scenegraph.
One common mistake to make when using this action is to think that it traverses just the parts currently in view, like SoGLRenderAction does. (SoGLRenderAction culls away the scenegraph parts outside the camera view volume and does not traverse those.) Like most other action classes, SoGetPrimitiveCountAction actually traverses the complete scenegraph, not just the parts currently in view.
TGS Inventor 2.5
SoGetPrimitiveCountAction::SoGetPrimitiveCountAction | ( | void | ) |
Constructor.
SoGetPrimitiveCountAction::~SoGetPrimitiveCountAction | ( | ) | [virtual] |
The destructor.
SoType SoGetPrimitiveCountAction::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.
Implements SoAction.
SoType SoGetPrimitiveCountAction::getClassTypeId | ( | void | ) | [static] |
Returns the run-time type object associated with instances of this class.
Reimplemented from SoAction.
Referenced by SoShape::invokeLineSegmentCallbacks(), SoShape::invokePointCallbacks(), and SoShape::invokeTriangleCallbacks().
void SoGetPrimitiveCountAction::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.
void SoGetPrimitiveCountAction::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.
const SoEnabledElementsList & SoGetPrimitiveCountAction::getEnabledElements | ( | void | ) | const [protected, virtual] |
Returns a list of the elements used by action instances of this class upon traversal operations.
Reimplemented from SoAction.
SoEnabledElementsList * SoGetPrimitiveCountAction::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 SoAction.
SoActionMethodList * SoGetPrimitiveCountAction::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 SoAction.
void SoGetPrimitiveCountAction::initClass | ( | void | ) | [static] |
Initializes the run-time type system for this class, and sets up the enabled elements and action method list.
Reimplemented from SoAction.
int SoGetPrimitiveCountAction::getTriangleCount | ( | void | ) | const |
Returns number of triangles in graph.
Referenced by SoIntersectionDetectionAction::apply().
int SoGetPrimitiveCountAction::getLineCount | ( | void | ) | const |
Returns number of lines in graph.
int SoGetPrimitiveCountAction::getPointCount | ( | void | ) | const |
Returns number of points in graph.
Note that by "point", it is meant an actual point primitive (for rendering), such as in the SoPointSet shape node, not a polygon vertice. For counting the total number of polygon vertices in a scene (sub) graph, use instead the SoCallbackAction with the appropriate callback.
int SoGetPrimitiveCountAction::getTextCount | ( | void | ) | const |
Returns number of texts in the graph.
int SoGetPrimitiveCountAction::getImageCount | ( | void | ) | const |
Returns the number of images in the graph.
SbBool SoGetPrimitiveCountAction::containsNoPrimitives | ( | void | ) |
Returns whether there are any primitives in graph or not.
SbBool SoGetPrimitiveCountAction::containsNonTriangleShapes | ( | void | ) |
Returns whether there are non-triangular primitives in graph.
SbBool SoGetPrimitiveCountAction::is3DTextCountedAsTriangles | ( | void | ) |
Returns whether SoText3 nodes is counted as triangles or text.
Referenced by SoVRMLText::getPrimitiveCount(), SoText3::getPrimitiveCount(), and SoAsciiText::getPrimitiveCount().
void SoGetPrimitiveCountAction::setCount3DTextAsTriangles | ( | const SbBool | flag | ) |
Sets whether SoText3 nodes are counted as the triangles of the fonts in the text strings or the text itself. The default is to count as triangles.
SbBool SoGetPrimitiveCountAction::canApproximateCount | ( | void | ) |
Returns whether shapes can use an approximate value when counting primitives. This is faster than doing an accurate count. The default is to not approximate.
Referenced by SoTriangleStripSet::getPrimitiveCount(), SoLineSet::getPrimitiveCount(), SoIndexedTriangleStripSet::getPrimitiveCount(), SoIndexedLineSet::getPrimitiveCount(), SoIndexedFaceSet::getPrimitiveCount(), SoFaceSet::getPrimitiveCount(), SoVRMLIndexedLineSet::getPrimitiveCount(), and SoVRMLIndexedFaceSet::getPrimitiveCount().
void SoGetPrimitiveCountAction::setCanApproximate | ( | const SbBool | flag | ) |
Sets whether shapes can do an approximate count.
void SoGetPrimitiveCountAction::setDecimationValue | ( | SoDecimationTypeElement::Type | type, | |
float | percentage = 1.0 | |||
) |
Set up the decimation parameters for the traversal.
On-the-fly decimation is supported in Coin yet, so this call will not have any effect until this feature has been implemented.
SoDecimationTypeElement::Type SoGetPrimitiveCountAction::getDecimationType | ( | void | ) |
Returns decimation type used during the traversal count.
float SoGetPrimitiveCountAction::getDecimationPercentage | ( | void | ) |
Returns decimation percentage used during the traversal count.
void SoGetPrimitiveCountAction::addNumTriangles | ( | const int | num | ) |
Adds num triangles to total count. Used by node instances in the scene graph during traversal.
Referenced by SoVRMLText::getPrimitiveCount(), SoVRMLSphere::getPrimitiveCount(), SoTriangleStripSet::getPrimitiveCount(), SoSphere::getPrimitiveCount(), SoQuadMesh::getPrimitiveCount(), SoIndexedTriangleStripSet::getPrimitiveCount(), SoIndexedFaceSet::getPrimitiveCount(), SoFaceSet::getPrimitiveCount(), SoCylinder::getPrimitiveCount(), SoCube::getPrimitiveCount(), SoCone::getPrimitiveCount(), SoAsciiText::getPrimitiveCount(), SoVRMLIndexedFaceSet::getPrimitiveCount(), SoVRMLExtrusion::getPrimitiveCount(), SoVRMLElevationGrid::getPrimitiveCount(), SoVRMLCylinder::getPrimitiveCount(), SoVRMLCone::getPrimitiveCount(), and SoVRMLBox::getPrimitiveCount().
void SoGetPrimitiveCountAction::addNumLines | ( | const int | num | ) |
Adds num lines to total count. Used by node instances in the scene graph during traversal.
Referenced by SoLineSet::getPrimitiveCount(), SoIndexedLineSet::getPrimitiveCount(), and SoVRMLIndexedLineSet::getPrimitiveCount().
void SoGetPrimitiveCountAction::addNumPoints | ( | const int | num | ) |
Adds num points to total count. Used by node instances in the scene graph during traversal.
Referenced by SoVRMLVertexPoint::getPrimitiveCount(), and SoPointSet::getPrimitiveCount().
void SoGetPrimitiveCountAction::addNumText | ( | const int | num | ) |
Adds num texts to total count. Used by node instances in the scene graph during traversal.
Referenced by SoVRMLText::getPrimitiveCount(), SoText3::getPrimitiveCount(), SoText2::getPrimitiveCount(), and SoAsciiText::getPrimitiveCount().
void SoGetPrimitiveCountAction::addNumImage | ( | const int | num | ) |
Adds num texture image maps to total count. Used by node instances in the scene graph during traversal.
Referenced by SoMarkerSet::getPrimitiveCount().
void SoGetPrimitiveCountAction::incNumTriangles | ( | void | ) |
Adds a single triangle to the total count. Used by node instances in the scene graph during traversal.
Referenced by SoShape::invokeTriangleCallbacks().
void SoGetPrimitiveCountAction::incNumLines | ( | void | ) |
Adds a single line to the total count. Used by node instances in the scene graph during traversal.
Referenced by SoShape::invokeLineSegmentCallbacks().
void SoGetPrimitiveCountAction::incNumPoints | ( | void | ) |
Adds a single point to the total count. Used by node instances in the scene graph during traversal.
Referenced by SoShape::invokePointCallbacks().
void SoGetPrimitiveCountAction::incNumText | ( | void | ) |
Adds a single text to the total count. Used by node instances in the scene graph during traversal.
void SoGetPrimitiveCountAction::incNumImage | ( | void | ) |
Adds a single texture image map to the total count. Used by node instances in the scene graph during traversal.
Referenced by SoImage::getPrimitiveCount().
void SoGetPrimitiveCountAction::beginTraversal | ( | SoNode * | node | ) | [protected, virtual] |
This virtual method is called from SoAction::apply(), and is the entry point for the actual scenegraph traversal.
It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction.
Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scenegraph traversal.
Reimplemented from SoAction.
References SoAction::traverse().
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 23 16:33:49 2009 for Coin by Doxygen. 1.5.8