# SoGetPrimitiveCountAction.h

    00001 #ifndef COIN_SOGETPRIMITIVECOUNTACTION_H
    00002 #define COIN_SOGETPRIMITIVECOUNTACTION_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/actions/SoAction.h>
    00028 #include <Inventor/actions/SoSubAction.h>
    00029 #include <Inventor/elements/SoDecimationTypeElement.h>
    00030
    00031
    00032 class COIN_DLL_API SoGetPrimitiveCountAction : public SoAction {
    00033   typedef SoAction inherited;
    00034
    00035   SO_ACTION_HEADER(SoGetPrimitiveCountAction);
    00036
    00037 public:
    00038   SoGetPrimitiveCountAction(void);
    00039   virtual ~SoGetPrimitiveCountAction();
    00040
    00041   static void initClass(void);
    00042
    00043   int getTriangleCount(void) const;
    00044   int getLineCount(void) const;
    00045   int getPointCount(void) const;
    00046   int getTextCount(void) const;
    00047   int getImageCount(void) const;
    00048   SbBool containsNoPrimitives(void);
    00049   SbBool containsNonTriangleShapes(void);
    00050
    00051   SbBool is3DTextCountedAsTriangles(void);
    00052   void setCount3DTextAsTriangles(const SbBool flag);
    00053
    00054   SbBool canApproximateCount(void);
    00055   void setCanApproximate(const SbBool flag);
    00056
    00057   void setDecimationValue(SoDecimationTypeElement::Type type,
    00058                           float percentage = 1.0);
    00059   SoDecimationTypeElement::Type getDecimationType(void);
    00060   float getDecimationPercentage(void);
    00061
    00062   void addNumTriangles(const int num);
    00063   void addNumLines(const int num);
    00064   void addNumPoints(const int num);
    00065   void addNumText(const int num);
    00066   void addNumImage(const int num);
    00067   void incNumTriangles(void);
    00068   void incNumLines(void);
    00069   void incNumPoints(void);
    00070   void incNumText(void);
    00071   void incNumImage(void);
    00072
    00073 protected:
    00074   virtual void beginTraversal(SoNode * node);
    00075
    00076 private:
    00077   int numtris;
    00078   int numlines;
    00079   int numpoints;
    00080   int numtexts;
    00081   int numimages;
    00082
    00083   SbBool textastris;
    00084   SbBool approx;
    00085   SbBool nonvertexastris;
    00086   SoDecimationTypeElement::Type decimationtype;
    00087   float decimationpercentage;
    00088 };
    00089
    00090 #endif // !COIN_SOGETPRIMITIVECOUNTACTION_H