Coin: SoGetPrimitiveCountAction Class Reference

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoGetPrimitiveCountAction Class Reference
Action Classes

The SoGetPrimitiveCountAction class counts the primitives in a scene. More...

`#include <Inventor/actions/SoGetPrimitiveCountAction.h>`

Inheritance diagram for SoGetPrimitiveCountAction:

## Public Member Functions
virtual SoType | getTypeId (void) const
| SoGetPrimitiveCountAction (void)
| SoGetPrimitiveCountAction (const SbViewportRegion &vp)
virtual | ~SoGetPrimitiveCountAction (void)
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)
Public Member Functions inherited from SoAction
virtual | ~SoAction (void)
virtual SbBool | isOfType (SoType type) const
virtual void | apply (SoNode *root)
virtual void | apply (SoPath *path)
virtual void | apply (const SoPathList &pathlist, SbBool obeysrules=FALSE)
void | apply (SoAction *beingApplied)
virtual void | invalidateState (void)
AppliedCode | getWhatAppliedTo (void) const
SoNode * | getNodeAppliedTo (void) const
SoPath * | getPathAppliedTo (void) const
const SoPathList * | getPathListAppliedTo (void) const
const SoPathList * | getOriginalPathListAppliedTo (void) const
SbBool | isLastPathListAppliedTo (void) const
PathCode | getPathCode (int &numindices, const int *&indices)
void | traverse (SoNode *const node)
SbBool | hasTerminated (void) const
const SoPath * | getCurPath (void)
SoState * | getState (void) const
PathCode | getCurPathCode (void) const
virtual SoNode * | getCurPathTail (void)
void | usePathCode (int &numindices, const int *&indices)
void | pushCurPath (const int childindex, SoNode *node=NULL)
void | popCurPath (const PathCode prevpathcode)
void | pushCurPath (void)
void | popPushCurPath (const int childindex, SoNode *node=NULL)
void | popCurPath (void)
void | switchToPathTraversal (SoPath *path)
void | switchToNodeTraversal (SoNode *node)

## 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)
Static Public Member Functions inherited from SoAction
static void | initClass (void)
static void | initClasses (void)
static SoType | getClassTypeId (void)
static void | nullAction (SoAction *action, SoNode *node)

## Protected Member Functions
virtual const SoEnabledElementsList & | getEnabledElements (void) const
virtual void | beginTraversal (SoNode *node)
Protected Member Functions inherited from SoAction
| SoAction (void)
virtual void | endTraversal (SoNode *node)
void | setTerminated (const SbBool flag)
virtual SbBool | shouldCompactPathList (void) const

## Static Protected Member Functions
static SoEnabledElementsList * | getClassEnabledElements (void)
static SoActionMethodList * | getClassActionMethods (void)
Static Protected Member Functions inherited from SoAction
static SoEnabledElementsList * | getClassEnabledElements (void)
static SoActionMethodList * | getClassActionMethods (void)

## Additional Inherited Members
Public Types inherited from SoAction
enum | AppliedCode { NODE = 0 , PATH = 1 , PATH_LIST = 2 }
enum | PathCode { NO_PATH = 0 , IN_PATH = 1 , BELOW_PATH = 2 , OFF_PATH = 3 }
Protected Attributes inherited from SoAction
SoState * | state
SoActionMethodList * | traversalMethods

## Detailed Description

The SoGetPrimitiveCountAction class counts the primitives in a scene.

Apply this action to a scene if you need to know the number of primitives present in a scene graph, or parts of a scene graph.

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 scene graph parts outside the camera view volume and does not traverse those.) Like most other action classes, SoGetPrimitiveCountAction actually traverses the complete scene graph, not just the parts currently in view.

Since
  Coin 1.0
  TGS Inventor 2.5

## Constructor & Destructor Documentation

## ◆ SoGetPrimitiveCountAction() [1/2]

SoGetPrimitiveCountAction::SoGetPrimitiveCountAction | ( | void |  | ) |

Constructor.

## ◆ SoGetPrimitiveCountAction() [2/2]

SoGetPrimitiveCountAction::SoGetPrimitiveCountAction | ( | const SbViewportRegion & | vp | ) |

Constructor. Supply the current viewport region to make SCREEN_SPACE counting correct.

## ◆ ~SoGetPrimitiveCountAction()

SoGetPrimitiveCountAction::~SoGetPrimitiveCountAction | ( | void |  | ) |
| virtual

The destructor.

## Member Function Documentation

## ◆ getTypeId()

SoType SoGetPrimitiveCountAction::getTypeId | ( | void |  | ) | const
| virtual

Returns the type identification of an object derived from a class inheriting SoAction. This is used for runtime type checking and "downward" casting.

Implements SoAction.

## ◆ getClassTypeId()

SoType SoGetPrimitiveCountAction::getClassTypeId | ( | void |  | ) |
| static

This static method returns the SoType object associated with objects of this class.

## ◆ addMethod()

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.

## ◆ enableElement()

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.

## ◆ getEnabledElements()

const SoEnabledElementsList & SoGetPrimitiveCountAction::getEnabledElements | ( | void |  | ) | const
| protectedvirtual

Returns list of enabled elements.

Reimplemented from SoAction.

## ◆ getClassEnabledElements()

SoEnabledElementsList * SoGetPrimitiveCountAction::getClassEnabledElements | ( | void |  | ) |
| staticprotected

Returns list of enabled elements for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

## ◆ getClassActionMethods()

SoActionMethodList * SoGetPrimitiveCountAction::getClassActionMethods | ( | void |  | ) |
| staticprotected

Returns list of action methods for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

## ◆ initClass()

void SoGetPrimitiveCountAction::initClass | ( | void |  | ) |
| static

Initializes the runtime type system for this class, and sets up the enabled elements and action method list.

## ◆ getTriangleCount()

int SoGetPrimitiveCountAction::getTriangleCount | ( | void |  | ) | const

Returns number of triangles in graph.

## ◆ getLineCount()

int SoGetPrimitiveCountAction::getLineCount | ( | void |  | ) | const

Returns number of lines in graph.

## ◆ getPointCount()

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 vertex. For counting the total number of polygon vertices in a scene (sub) graph, use instead the SoCallbackAction with the appropriate callback.

## ◆ getTextCount()

int SoGetPrimitiveCountAction::getTextCount | ( | void |  | ) | const

Returns number of texts in the graph.

## ◆ getImageCount()

int SoGetPrimitiveCountAction::getImageCount | ( | void |  | ) | const

Returns the number of images in the graph.

## ◆ containsNoPrimitives()

SbBool SoGetPrimitiveCountAction::containsNoPrimitives | ( | void |  | ) |

Returns whether there are any primitives in graph or not.

## ◆ containsNonTriangleShapes()

SbBool SoGetPrimitiveCountAction::containsNonTriangleShapes | ( | void |  | ) |

Returns whether there are non-triangular primitives in graph.

## ◆ is3DTextCountedAsTriangles()

SbBool SoGetPrimitiveCountAction::is3DTextCountedAsTriangles | ( | void |  | ) |

Returns whether SoText3 nodes is counted as triangles or text.

See also
  is3DTextCountedAsTriangles()

## ◆ setCount3DTextAsTriangles()

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.

See also
  is3DTextCountedAsTriangles()

## ◆ canApproximateCount()

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.

See also
  setCanApproximate()

## ◆ setCanApproximate()

void SoGetPrimitiveCountAction::setCanApproximate | ( | const SbBool | flag | ) |

Sets whether shapes can do an approximate count.

See also
  canApproximateCount()

## ◆ setDecimationValue()

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.

## ◆ getDecimationType()

SoDecimationTypeElement::Type SoGetPrimitiveCountAction::getDecimationType | ( | void |  | ) |

Returns decimation type used during the traversal count.

## ◆ getDecimationPercentage()

float SoGetPrimitiveCountAction::getDecimationPercentage | ( | void |  | ) |

Returns decimation percentage used during the traversal count.

## ◆ addNumTriangles()

void SoGetPrimitiveCountAction::addNumTriangles | ( | const int | num | ) |

Adds num triangles to total count. Used by node instances in the scene graph during traversal.

## ◆ addNumLines()

void SoGetPrimitiveCountAction::addNumLines | ( | const int | num | ) |

Adds num lines to total count. Used by node instances in the scene graph during traversal.

## ◆ addNumPoints()

void SoGetPrimitiveCountAction::addNumPoints | ( | const int | num | ) |

Adds num points to total count. Used by node instances in the scene graph during traversal.

## ◆ addNumText()

void SoGetPrimitiveCountAction::addNumText | ( | const int | num | ) |

Adds num texts to total count. Used by node instances in the scene graph during traversal.

## ◆ addNumImage()

void SoGetPrimitiveCountAction::addNumImage | ( | const int | num | ) |

Adds num texture image maps to total count. Used by node instances in the scene graph during traversal.

## ◆ incNumTriangles()

void SoGetPrimitiveCountAction::incNumTriangles | ( | void |  | ) |

Adds a single triangle to the total count. Used by node instances in the scene graph during traversal.

## ◆ incNumLines()

void SoGetPrimitiveCountAction::incNumLines | ( | void |  | ) |

Adds a single line to the total count. Used by node instances in the scene graph during traversal.

## ◆ incNumPoints()

void SoGetPrimitiveCountAction::incNumPoints | ( | void |  | ) |

Adds a single point to the total count. Used by node instances in the scene graph during traversal.

## ◆ incNumText()

void SoGetPrimitiveCountAction::incNumText | ( | void |  | ) |

Adds a single text to the total count. Used by node instances in the scene graph during traversal.

## ◆ incNumImage()

void SoGetPrimitiveCountAction::incNumImage | ( | void |  | ) |

Adds a single texture image map to the total count. Used by node instances in the scene graph during traversal.

## ◆ beginTraversal()

void SoGetPrimitiveCountAction::beginTraversal | ( | SoNode * | node | ) |
| protectedvirtual

This virtual method is called from SoAction::apply(), and is the entry point for the actual scene graph 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 scene graph traversal.

Reimplemented from SoAction.

The documentation for this class was generated from the following files:

- SoGetPrimitiveCountAction.h
- SoGetPrimitiveCountAction.cpp