# SoExtSelection.h

    00001 #ifndef COIN_SOEXTSELECTION_H
    00002 #define COIN_SOEXTSELECTION_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/nodes/SoSubNode.h>
    00028 #include <Inventor/nodes/SoSelection.h>
    00029 #include <Inventor/fields/SoSFEnum.h>
    00030 #include <stddef.h> // NULL
    00031
    00032 class SbColor;
    00033 class SoPrimitiveVertex;
    00034
    00035 // This shouldn't strictly be necessary, but the OSF1/cxx compiler
    00036 // complains if this is left out, while using the "friend class
    00037 // SoExtSelectionP" statement in the class definition.
    00038 class SoExtSelectionP;
    00039
    00040
    00041 typedef SbBool SoExtSelectionTriangleCB(void * userdata,
    00042                                         SoCallbackAction * action,
    00043                                         const SoPrimitiveVertex * v1,
    00044                                         const SoPrimitiveVertex * v2,
    00045                                         const SoPrimitiveVertex * v3);
    00046
    00047 typedef SbBool SoExtSelectionLineSegmentCB(void * userdata,
    00048                                            SoCallbackAction * action,
    00049                                            const SoPrimitiveVertex * v1,
    00050                                            const SoPrimitiveVertex * v2);
    00051
    00052 typedef SbBool SoExtSelectionPointCB(void * userdata,
    00053                                      SoCallbackAction * action,
    00054                                      const SoPrimitiveVertex * v1);
    00055
    00056 typedef SoPath * SoLassoSelectionFilterCB(void * userdata, const SoPath * path);
    00057
    00058
    00059 class COIN_DLL_API SoExtSelection : public SoSelection {
    00060   typedef SoSelection inherited;
    00061
    00062   SO_NODE_HEADER(SoExtSelection);
    00063
    00064 public:
    00065   static void initClass(void);
    00066   SoExtSelection(void);
    00067
    00068   enum LassoType {
    00069     NOLASSO, LASSO, RECTANGLE
    00070   };
    00071
    00072   enum LassoPolicy {
    00073     FULL_BBOX, PART_BBOX, FULL, PART
    00074   };
    00075
    00076   enum LassoMode {
    00077     ALL_SHAPES,
    00078     VISIBLE_SHAPES
    00079   };
    00080
    00081   SoSFEnum lassoType;
    00082   SoSFEnum lassoPolicy;
    00083   SoSFEnum lassoMode;
    00084
    00085   void useOverlay(SbBool overlay = TRUE);
    00086   SbBool isUsingOverlay(void);
    00087   SoSeparator * getOverlaySceneGraph(void);
    00088   void setOverlayLassoColorIndex(const int index);
    00089   int getOverlayLassoColorIndex(void);
    00090   void setLassoColor(const SbColor & color);
    00091   const SbColor & getLassoColor(void);
    00092   void setLassoWidth(const float width);
    00093   float getLassoWidth(void);
    00094   void setOverlayLassoPattern(const unsigned short pattern);
    00095   unsigned short getOverlayLassoPattern(void);
    00096   void animateOverlayLasso(const SbBool animate = TRUE);
    00097   SbBool isOverlayLassoAnimated(void);
    00098
    00099   virtual void handleEvent(SoHandleEventAction * action);
    00100   virtual void GLRenderBelowPath(SoGLRenderAction * action);
    00101
    00102   void setLassoFilterCallback(SoLassoSelectionFilterCB * f, void * userdata = NULL,
    00103                               const SbBool callonlyifselectable = TRUE);
    00104
    00105   void setTriangleFilterCallback(SoExtSelectionTriangleCB * func,
    00106                                  void * userdata = NULL);
    00107   void setLineSegmentFilterCallback(SoExtSelectionLineSegmentCB * func,
    00108                                     void * userdata = NULL);
    00109   void setPointFilterCallback(SoExtSelectionPointCB * func,
    00110                               void * userdata = NULL);
    00111   SbBool wasShiftDown(void) const;
    00112
    00113 protected:
    00114   virtual ~SoExtSelection();
    00115
    00116 private:
    00117   void draw(SoGLRenderAction * action);
    00118
    00119   friend class SoExtSelectionP;
    00120   class SoExtSelectionP * pimpl;
    00121 };
    00122
    00123 #endif // !COIN_SOEXTSELECTION_H