Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
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
72 float percentage = 1.0);
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
static void initClass(void)
Definition SoAction.cpp:370
SoAction(void)
Definition SoAction.cpp:337
virtual void beginTraversal(SoNode *node)
Definition SoAction.cpp:1269
Type
Definition SoDecimationTypeElement.h:48
SbBool canApproximateCount(void)
Definition SoGetPrimitiveCountAction.cpp:230
void setCanApproximate(const SbBool flag)
Definition SoGetPrimitiveCountAction.cpp:240
void incNumImage(void)
Definition SoGetPrimitiveCountAction.cpp:372
SbBool containsNonTriangleShapes(void)
Definition SoGetPrimitiveCountAction.cpp:189
void incNumLines(void)
Definition SoGetPrimitiveCountAction.cpp:342
void incNumText(void)
Definition SoGetPrimitiveCountAction.cpp:362
void addNumImage(const int num)
Definition SoGetPrimitiveCountAction.cpp:322
void setDecimationValue(SoDecimationTypeElement::Type type, float percentage=1.0)
Definition SoGetPrimitiveCountAction.cpp:252
int getPointCount(void) const
Definition SoGetPrimitiveCountAction.cpp:148
void incNumTriangles(void)
Definition SoGetPrimitiveCountAction.cpp:332
int getImageCount(void) const
Definition SoGetPrimitiveCountAction.cpp:166
void setCount3DTextAsTriangles(const SbBool flag)
Definition SoGetPrimitiveCountAction.cpp:206
void addNumTriangles(const int num)
Definition SoGetPrimitiveCountAction.cpp:282
int getLineCount(void) const
Definition SoGetPrimitiveCountAction.cpp:133
int getTextCount(void) const
Definition SoGetPrimitiveCountAction.cpp:157
SbBool is3DTextCountedAsTriangles(void)
Definition SoGetPrimitiveCountAction.cpp:217
SbBool containsNoPrimitives(void)
Definition SoGetPrimitiveCountAction.cpp:175
int getTriangleCount(void) const
Definition SoGetPrimitiveCountAction.cpp:124
SoDecimationTypeElement::Type getDecimationType(void)
Definition SoGetPrimitiveCountAction.cpp:263
SoGetPrimitiveCountAction(void)
Definition SoGetPrimitiveCountAction.cpp:89
void addNumText(const int num)
Definition SoGetPrimitiveCountAction.cpp:312
void addNumPoints(const int num)
Definition SoGetPrimitiveCountAction.cpp:302
float getDecimationPercentage(void)
Definition SoGetPrimitiveCountAction.cpp:272
void addNumLines(const int num)
Definition SoGetPrimitiveCountAction.cpp:292
void incNumPoints(void)
Definition SoGetPrimitiveCountAction.cpp:352
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56