Coin Logo http://www.sim.no
http://www.coin3d.org

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-2007 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 http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
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 #ifndef COIN_INTERNAL
00033 #include <Inventor/actions/SoCallbackAction.h>
00034 #endif // !COIN_INTERNAL
00035 
00036 class SbColor;
00037 class SbVec3f;
00038 class SbVec2f;
00039 class SbVec2s;
00040 class SbViewportRegion;
00041 class SoPrimitiveVertex;
00042 
00043 // This shouldn't strictly be necessary, but the OSF1/cxx compiler
00044 // complains if this is left out, while using the "friend class
00045 // SoExtSelectionP" statement in the class definition.
00046 class SoExtSelectionP;
00047 
00048 
00049 typedef SbBool SoExtSelectionTriangleCB(void * userdata,
00050                                         SoCallbackAction * action,
00051                                         const SoPrimitiveVertex * v1,
00052                                         const SoPrimitiveVertex * v2,
00053                                         const SoPrimitiveVertex * v3);
00054 
00055 typedef SbBool SoExtSelectionLineSegmentCB(void * userdata,
00056                                            SoCallbackAction * action,
00057                                            const SoPrimitiveVertex * v1,
00058                                            const SoPrimitiveVertex * v2);
00059 
00060 typedef SbBool SoExtSelectionPointCB(void * userdata,
00061                                      SoCallbackAction * action,
00062                                      const SoPrimitiveVertex * v1);
00063 
00064 typedef SoPath * SoLassoSelectionFilterCB(void * userdata, const SoPath * path);
00065 
00066 
00067 class COIN_DLL_API SoExtSelection : public SoSelection {
00068   typedef SoSelection inherited;
00069 
00070   SO_NODE_HEADER(SoExtSelection);
00071 
00072 public:
00073   static void initClass(void);
00074   SoExtSelection(void);
00075 
00076   enum LassoType {
00077     NOLASSO, LASSO, RECTANGLE
00078   };
00079 
00080   enum LassoPolicy {
00081     FULL_BBOX, PART_BBOX, FULL, PART
00082   };
00083 
00084   enum LassoMode {
00085     ALL_SHAPES,
00086     VISIBLE_SHAPES
00087   };
00088 
00089   SoSFEnum lassoType;
00090   SoSFEnum lassoPolicy;
00091   SoSFEnum lassoMode;
00092 
00093   void useOverlay(SbBool overlay = TRUE);
00094   SbBool isUsingOverlay(void);
00095   SoSeparator * getOverlaySceneGraph(void);
00096   void setOverlayLassoColorIndex(const int index);
00097   int getOverlayLassoColorIndex(void);
00098   void setLassoColor(const SbColor & color);
00099   const SbColor & getLassoColor(void);
00100   void setLassoWidth(const float width);
00101   float getLassoWidth(void);
00102   void setOverlayLassoPattern(const unsigned short pattern);
00103   unsigned short getOverlayLassoPattern(void);
00104   void animateOverlayLasso(const SbBool animate = TRUE);
00105   SbBool isOverlayLassoAnimated(void);
00106 
00107   virtual void handleEvent(SoHandleEventAction * action);
00108   virtual void GLRenderBelowPath(SoGLRenderAction * action);
00109 
00110   void select(SoNode * root, int numcoords, SbVec2f * lasso, 
00111               const SbViewportRegion & vp, SbBool shiftpolicy);
00112   void select(SoNode * root, int numcoords, SbVec3f * lasso,
00113               const SbViewportRegion & vp, SbBool shiftkeypolicy);
00114   const SbVec2s * getLassoCoordsDC(int & numCoords);
00115   const SbVec3f * getLassoCoordsWC(int & numCoords);
00116   const SoPathList & getSelectionPathList() const;
00117 
00118   void setLassoFilterCallback(SoLassoSelectionFilterCB * f, void * userdata = NULL,
00119                               const SbBool callonlyifselectable = TRUE);
00120 
00121   void setTriangleFilterCallback(SoExtSelectionTriangleCB * func,
00122                                  void * userdata = NULL);
00123   void setLineSegmentFilterCallback(SoExtSelectionLineSegmentCB * func,
00124                                     void * userdata = NULL);
00125   void setPointFilterCallback(SoExtSelectionPointCB * func,
00126                               void * userdata = NULL);
00127   SbBool wasShiftDown(void) const;
00128 
00129 protected:
00130   virtual ~SoExtSelection();
00131 
00132 private:
00133   void draw(SoGLRenderAction * action);
00134 
00135   friend class SoExtSelectionP;
00136   class SoExtSelectionP * pimpl;
00137 };
00138 
00139 #endif // !COIN_SOEXTSELECTION_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 28 2011 10:11:54 for Coin by Doxygen. 1.7.3