Coin: SoGetPrimitiveCountAction.h Source File

| 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;
42class SbViewportRegion;
43
44 class COIN_DLL_API SoGetPrimitiveCountAction : public SoAction {
45 typedef SoAction inherited;
46
47 SO_ACTION_HEADER(SoGetPrimitiveCountAction);
48
49public:
50 static void initClass(void);
51
52 SoGetPrimitiveCountAction(void);
53 SoGetPrimitiveCountAction(const SbViewportRegion & vp);
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);
105 SbLazyPimplPtr<SoGetPrimitiveCountActionP> pimpl;
106
107 // NOT IMPLEMENTED:
108 SoGetPrimitiveCountAction(const SoGetPrimitiveCountAction & rhs);
109 SoGetPrimitiveCountAction & operator = (const SoGetPrimitiveCountAction & rhs);
110}; // SoGetPrimitiveCountAction
111
112#endif // !COIN_SOGETPRIMITIVECOUNTACTION_H
SbLazyPimplPtr
Definition SbLazyPimplPtr.h:56
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
SoAction::initClass
static void initClass(void)
Definition SoAction.cpp:370
SoAction::SoAction
SoAction(void)
Definition SoAction.cpp:337
SoAction::beginTraversal
virtual void beginTraversal(SoNode *node)
Definition SoAction.cpp:1269
SoDecimationTypeElement::Type
Type
Definition SoDecimationTypeElement.h:48
SoGetPrimitiveCountAction::canApproximateCount
SbBool canApproximateCount(void)
Definition SoGetPrimitiveCountAction.cpp:230
SoGetPrimitiveCountAction::setCanApproximate
void setCanApproximate(const SbBool flag)
Definition SoGetPrimitiveCountAction.cpp:240
SoGetPrimitiveCountAction::incNumImage
void incNumImage(void)
Definition SoGetPrimitiveCountAction.cpp:372
SoGetPrimitiveCountAction::containsNonTriangleShapes
SbBool containsNonTriangleShapes(void)
Definition SoGetPrimitiveCountAction.cpp:189
SoGetPrimitiveCountAction::incNumLines
void incNumLines(void)
Definition SoGetPrimitiveCountAction.cpp:342
SoGetPrimitiveCountAction::incNumText
void incNumText(void)
Definition SoGetPrimitiveCountAction.cpp:362
SoGetPrimitiveCountAction::addNumImage
void addNumImage(const int num)
Definition SoGetPrimitiveCountAction.cpp:322
SoGetPrimitiveCountAction::setDecimationValue
void setDecimationValue(SoDecimationTypeElement::Type type, float percentage=1.0)
Definition SoGetPrimitiveCountAction.cpp:252
SoGetPrimitiveCountAction::getPointCount
int getPointCount(void) const
Definition SoGetPrimitiveCountAction.cpp:148
SoGetPrimitiveCountAction::incNumTriangles
void incNumTriangles(void)
Definition SoGetPrimitiveCountAction.cpp:332
SoGetPrimitiveCountAction::getImageCount
int getImageCount(void) const
Definition SoGetPrimitiveCountAction.cpp:166
SoGetPrimitiveCountAction::setCount3DTextAsTriangles
void setCount3DTextAsTriangles(const SbBool flag)
Definition SoGetPrimitiveCountAction.cpp:206
SoGetPrimitiveCountAction::addNumTriangles
void addNumTriangles(const int num)
Definition SoGetPrimitiveCountAction.cpp:282
SoGetPrimitiveCountAction::getLineCount
int getLineCount(void) const
Definition SoGetPrimitiveCountAction.cpp:133
SoGetPrimitiveCountAction::getTextCount
int getTextCount(void) const
Definition SoGetPrimitiveCountAction.cpp:157
SoGetPrimitiveCountAction::is3DTextCountedAsTriangles
SbBool is3DTextCountedAsTriangles(void)
Definition SoGetPrimitiveCountAction.cpp:217
SoGetPrimitiveCountAction::containsNoPrimitives
SbBool containsNoPrimitives(void)
Definition SoGetPrimitiveCountAction.cpp:175
SoGetPrimitiveCountAction::getTriangleCount
int getTriangleCount(void) const
Definition SoGetPrimitiveCountAction.cpp:124
SoGetPrimitiveCountAction::getDecimationType
SoDecimationTypeElement::Type getDecimationType(void)
Definition SoGetPrimitiveCountAction.cpp:263
SoGetPrimitiveCountAction::SoGetPrimitiveCountAction
SoGetPrimitiveCountAction(void)
Definition SoGetPrimitiveCountAction.cpp:89
SoGetPrimitiveCountAction::addNumText
void addNumText(const int num)
Definition SoGetPrimitiveCountAction.cpp:312
SoGetPrimitiveCountAction::addNumPoints
void addNumPoints(const int num)
Definition SoGetPrimitiveCountAction.cpp:302
SoGetPrimitiveCountAction::getDecimationPercentage
float getDecimationPercentage(void)
Definition SoGetPrimitiveCountAction.cpp:272
SoGetPrimitiveCountAction::addNumLines
void addNumLines(const int num)
Definition SoGetPrimitiveCountAction.cpp:292
SoGetPrimitiveCountAction::incNumPoints
void incNumPoints(void)
Definition SoGetPrimitiveCountAction.cpp:352
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56