OpenFrames
FrameTracker.hpp
Go to the documentation of this file.
1 /***********************************
2  Copyright 2018 Ravishankar Mathur
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 ***********************************/
16 
21 #ifndef _OF_FRAMETRACKER_
22 #define _OF_FRAMETRACKER_
23 
24 #include <OpenFrames/Export.h>
25 
26 #include <osg/ref_ptr>
27 #include <osg/Referenced>
28 
29 namespace OpenFrames
30 {
31  class ReferenceFrame;
32 
41  class OF_EXPORT FrameTracker : public osg::Referenced
42  {
43  public:
44  FrameTracker();
45  FrameTracker( ReferenceFrame* frame );
46 
47  // Called when a frame is added to or removed from a tracked frame
48  virtual void childAdded(ReferenceFrame* child, ReferenceFrame* parent) = 0;
49  virtual void childRemoved(ReferenceFrame* child, ReferenceFrame* parent) = 0;
50 
51  // Set which frame to track
52  virtual void setRoot( ReferenceFrame* frame );
53  inline ReferenceFrame* getRoot() {return _root.get();}
54 
55  protected:
56  virtual ~FrameTracker();
57 
58  osg::ref_ptr<ReferenceFrame> _root;
59  };
60 
61 } // !namespace OpenFrames
62 
63 #endif // !define _OF_FRAMETRACKER_
This class tracks children of a reference frame.
Definition: FrameTracker.hpp:41
Definition: CoordinateAxes.hpp:29
Definition: ReferenceFrame.hpp:54