OpenCOVER
coIntersection.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8#ifndef CO_INTERSECTION_H
9#define CO_INTERSECTION_H
10
25#include <osg/Matrix>
26#include <osgUtil/LineSegmentIntersector>
27
28namespace osgUtil {
29class IntersectionVisitor;
30}
31
32namespace opencover
33{
34
35class coIntersector;
36
37class COVEREXPORT IntersectionHandler: public osg::Referenced
38{
39public:
41
42 virtual bool canHandleDrawable(osg::Drawable *drawable) const = 0;
43 virtual void intersect(osgUtil::IntersectionVisitor &iv, coIntersector &is, osg::Drawable *drawable) = 0;
44};
45
46class COVEREXPORT coIntersector: public osgUtil::LineSegmentIntersector
47{
48public:
49 coIntersector(const osg::Vec3& start, const osg::Vec3& end);
50
51 virtual Intersector* clone(osgUtil::IntersectionVisitor& iv) override;
52 virtual void intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable) override;
53
54 void addHandler(osg::ref_ptr<IntersectionHandler> handler);
55
56 bool intersectAndClip(osg::Vec3d &s, osg::Vec3d &e, const osg::BoundingBox &bb);
57
58protected:
59 std::vector<osg::ref_ptr<IntersectionHandler>> _handlers;
60};
61
62class COVEREXPORT coIntersection : public virtual vrui::vruiIntersection
63{
64 static coIntersection *intersector;
66public:
68 virtual ~coIntersection();
69
70 coIntersector *newIntersector(const osg::Vec3 &start, const osg::Vec3 &end);
71
72 void addHandler(osg::ref_ptr<IntersectionHandler> handler);
73
74 virtual const char *getClassName() const;
75 virtual const char *getActionName() const;
76
77 void isectAllNodes(bool isectAll);
78 void forceIsectAllNodes(bool isectAll);
80
81 static bool isVerboseIntersection();
82
83protected:
84 virtual void intersect(); // do the intersection
85 // do the intersection
86 void intersect(const osg::Matrix &mat, bool mouseHit);
87
90
91 static int myFrameIndex;
92 static int myFrame;
93
94private:
95 std::vector<std::vector<float> > elapsedTimes;
96 std::vector<osg::ref_ptr<IntersectionHandler>> handlers;
97};
98}
99#endif
Definition: ARToolKit.h:33
Definition: coIntersection.h:28
Definition: coIntersection.h:38
virtual ~IntersectionHandler()
Definition: coIntersection.h:40
virtual bool canHandleDrawable(osg::Drawable *drawable) const =0
virtual void intersect(osgUtil::IntersectionVisitor &iv, coIntersector &is, osg::Drawable *drawable)=0
Definition: coIntersection.h:47
void addHandler(osg::ref_ptr< IntersectionHandler > handler)
virtual Intersector * clone(osgUtil::IntersectionVisitor &iv) override
bool intersectAndClip(osg::Vec3d &s, osg::Vec3d &e, const osg::BoundingBox &bb)
std::vector< osg::ref_ptr< IntersectionHandler > > _handlers
Definition: coIntersection.h:59
coIntersector(const osg::Vec3 &start, const osg::Vec3 &end)
virtual void intersect(osgUtil::IntersectionVisitor &iv, osg::Drawable *drawable) override
Definition: coIntersection.h:63
void forceIsectAllNodes(bool isectAll)
static int myFrame
Definition: coIntersection.h:92
int numIsectAllNodes
Definition: coIntersection.h:79
void isectAllNodes(bool isectAll)
static bool isVerboseIntersection()
void intersect(const osg::Matrix &mat, bool mouseHit)
void addHandler(osg::ref_ptr< IntersectionHandler > handler)
virtual const char * getActionName() const
get the associated action name
float intersectionDist
value of the PointerAppearance.Intersection config var
Definition: coIntersection.h:89
static int myFrameIndex
Definition: coIntersection.h:91
virtual const char * getClassName() const
get the Element's classname
virtual void intersect()
static coIntersection * instance()
coIntersector * newIntersector(const osg::Vec3 &start, const osg::Vec3 &end)
Definition: vruiIntersection.h:24