VR-Forces 4.1.1 Class Documentation
ssAnyIntersectionsFunctor.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2005 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: ssAnyIntersectionsFunctor.h,v $ $Revision: 1.4 $ $State: Exp $
7 *********************************************************************/
8 #ifndef ssAnyIntersectionFunctor_H_
9 #define ssAnyIntersectionFunctor_H_
10 
11 #include <vlutil/vlConfig.h>
13 #include "geometry/ssFunctor.h"
14 
15 #include "geometry/chrdIntRec.h"
16 #include "gdb/gdbNode.h"
17 #include <assert.h>
18 
19 //
20 // A functor intended for use with the spatial subdivision set of classes. It's
21 // primary usage is to intersect the first parameter into the second.
22 //
23 // Expected usage:
24 // When passed to the intersection objects intersection functions, this functor
25 // intersects the first item into the second one. Used primarily for intersecting the
26 // different spatial sorted elements into their appropriate spatial subdivisions.
27 // For an example, see the gdbNode intersecter class.
28 //
29 template <typename TypeToIntersect, typename Container>
30 class DtSsAnyIntersectionFunctor : public DtSsFunctor<TypeToIntersect, Container>
31 {
32 public:
33  // Constructor
35 
36  // Destructor
38 
39 private:
40  // not implemented
43 
44 public:
45  // Function operator - when applied intersects the first element with the
46  // second element.
47  // @param itemToIntersect The item to intersect into the second parameter.
48  // @param container The container of elements into which to intersect the first
49  // parameter.
50  //
51  // @returns Always returns false as it is never done processing - it can
52  // always continue intersecting elements.
53  virtual bool operator()(TypeToIntersect& itemToIntersect, Container& container);
54 
56 
57  virtual void setIntersectionRecord(DtChordIntersectionRecord* newIntersectionRecord);
58 
60 
61  virtual void setIntersectionRecordType(
62  DtGdbNode::DtIntersectRecordType& newIntersectionRecordType);
63 
64 
65 private:
66 
69 };
70 
71 
72 //------------------------------------------------------
73 // INLINE METHODS
74 //------------------------------------------------------
75 template <typename TypeToIntersect, typename Container>
77 : DtSsFunctor<TypeToIntersect, Container>()
78 , myIntersectionRecord(0)
79 , myIntersectionRecordType(DtGdbNode::IRT_IPOINT)
80 {
81 }
82 
83 
84 template <typename TypeToIntersect, typename Container>
86 {
87 }
88 
89 template <typename TypeToIntersect, typename Container>
91  (TypeToIntersect& itemToIntersect, Container& containerToIntersect)
92 {
93  bool retVal = false;
94 
95  assert(myIntersectionRecord != 0);
96 
97  typename Container::iterator iter = containerToIntersect.begin();
98  typename Container::iterator endIter = containerToIntersect.end();
99  for (; iter != endIter, !retVal; ++iter)
100  {
101  if ((*iter)->intersect(itemToIntersect, *myIntersectionRecord, myIntersectionRecordType))
102  {
103  assert(myIntersectionRecord->intersectionFound());
104  retVal = true;
105  }
106  }
107 
108  return retVal;
109 }
110 
111 
112 template <typename TypeToIntersect, typename Container>
115 {
116  return myIntersectionRecord;
117 }
118 
119 
120 template <typename TypeToIntersect, typename Container>
123 {
124  assert(newIntersectionRecord != 0);
125  myIntersectionRecord = newIntersectionRecord;
126 }
127 
128 
129 template <typename TypeToIntersect, typename Container>
132 {
133  return myIntersectionRecordType;
134 }
135 
136 template <typename TypeToIntersect, typename Container>
139 {
140  myIntersectionRecordType = newIntersectionRecordType;
141 }
142 
143 #endif
144 
145 

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)