Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoGetPrimitiveCountAction.h
1#ifndef COIN_SOGETPRIMITIVECOUNTACTION_H
2#define COIN_SOGETPRIMITIVECOUNTACTION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/actions/SoAction.h>
37#include <Inventor/actions/SoSubAction.h>
38#include <Inventor/tools/SbLazyPimplPtr.h>
39#include <Inventor/elements/SoDecimationTypeElement.h>
40
41class SoGetPrimitiveCountActionP;
43
44class COIN_DLL_API SoGetPrimitiveCountAction : public SoAction {
45 typedef SoAction inherited;
46
47 SO_ACTION_HEADER(SoGetPrimitiveCountAction);
48
49public:
50 static void initClass(void);
51
54
55 virtual ~SoGetPrimitiveCountAction(void);
56
57 int getTriangleCount(void) const;
58 int getLineCount(void) const;
59 int getPointCount(void) const;
60 int getTextCount(void) const;
61 int getImageCount(void) const;
62 SbBool containsNoPrimitives(void);
63 SbBool containsNonTriangleShapes(void);
64
65 SbBool is3DTextCountedAsTriangles(void);
66 void setCount3DTextAsTriangles(const SbBool flag);
67
68 SbBool canApproximateCount(void);
69 void setCanApproximate(const SbBool flag);
70
71 void setDecimationValue(SoDecimationTypeElement::Type type,
72 float percentage = 1.0);
73 SoDecimationTypeElement::Type getDecimationType(void);
74 float getDecimationPercentage(void);
75
76 void addNumTriangles(const int num);
77 void addNumLines(const int num);
78 void addNumPoints(const int num);
79 void addNumText(const int num);
80 void addNumImage(const int num);
81 void incNumTriangles(void);
82 void incNumLines(void);
83 void incNumPoints(void);
84 void incNumText(void);
85 void incNumImage(void);
86
87protected:
88 virtual void beginTraversal(SoNode * node);
89
90private:
91 int numtris;
92 int numlines;
93 int numpoints;
94 int numtexts;
95 int numimages;
96
97 SbBool textastris;
98 SbBool approx;
99 SbBool nonvertexastris;
100 SoDecimationTypeElement::Type decimationtype;
101 float decimationpercentage;
102
103private:
104 void commonConstructor(const SbViewportRegion & vp);
106
107 // NOT IMPLEMENTED:
109 SoGetPrimitiveCountAction & operator = (const SoGetPrimitiveCountAction & rhs);
110}; // SoGetPrimitiveCountAction
111
112#endif // !COIN_SOGETPRIMITIVECOUNTACTION_H
Definition SbLazyPimplPtr.h:56
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:77
static void initClass(void)
Definition SoAction.cpp:370
virtual void beginTraversal(SoNode *node)
Definition SoAction.cpp:1269
Type
Definition SoDecimationTypeElement.h:48
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:44
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56