AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CameraViewSet.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXQT_CAMERAVIEWSET_H
18 #define AGXQT_CAMERAVIEWSET_H
19 
20 #include <agxQt/export.h>
21 #include <agx/Referenced.h>
22 #include <agx/List.h>
23 #include <agx/Vec3.h>
24 #include <agx/Vector.h>
25 
26 #define DEFAULT_CAMERADESCRIPTION_FOV 30.0
27 
28 // Forward declaration
29 namespace osg
30 {
31  class Camera;
32 }
33 
34 namespace osgViewer
35 {
36  class Viewer;
37 }
38 
39 namespace agxCFG
40 {
41  class ConfigScript;
42 }
43 
44 namespace agxQt
45 {
46 
47  class CameraDescription;
48  class CameraDescriptionSet;
51 
60  {
62 
63  public:
66 
68  void addCamera(CameraDescription * camera);
69  void removeCamera(CameraDescription * camera);
70 
72  agx::UInt getActiveCameraIndex();
73 
75  agx::UInt nextCameraDescription();
76 
78  agx::UInt previousCameraDescription();
79 
81  CameraDescription* getCameraDescription(const agx::UInt& index);
82 
84  CameraDescription* getActiveCameraDescription();
85 
87  CameraDescription* getCameraDescriptionFromName(const agx::String& name);
88 
90  void setActiveCameraViewIndex(agx::UInt index);
91 
93  bool containsCameraDescription(const CameraDescription* camera);
94 
96  agx::UInt getNumberOfCameraDescriptions();
97 
99  bool setActiveViewFromName(const agx::String& name);
100 
102  bool removeCameraViewFromName(const agx::String& name);
103 
105  bool renameCameraDescription(const agx::String& oldname, const agx::String& newName);
106 
108  agx::Vector<agx::String> getCameraViewNames();
109 
111  agx::String toString();
112 
113  protected:
114  bool getIndexFromCamera(CameraDescription * camera, agx::UInt& index);
115 
117  virtual ~CameraDescriptionSet();
118 
119 
121  // Variables
123  protected:
126  };
127 
132  {
133  public:
136 
138  void setInformation(const agx::Vec3 &eye, const agx::Vec3& center, const agx::Vec3& up, agx::Real fov);
139 
141  void setName(const agx::String& name);
142  const agx::String& getName() const;
143 
145  bool isValid() const;
146 
148  const agx::Vec3& getCenter() const;
149 
151  const agx::Vec3& getUp() const;
152 
154  const agx::Vec3& getEye() const;
155 
157  const agx::Real getFov() const;
158 
160  const agx::String toString() const;
161 
162  protected:
163 
165  virtual ~CameraDescription();
166 
168  // Variables
170  protected:
175 
178  };
179 
180  /* Implementation */
182 
184 
186 
188 
190 
192 
197  {
198  public:
201 
203  void storeCurrentView(osgViewer::Viewer *viewer);
204 
206  void setActiveView(osgViewer::Viewer * viewer);
207 
209  void setNextView(osgViewer::Viewer * viewer);
210 
212  void setPreviousView(osgViewer::Viewer * viewer);
213 
215  bool setActiveViewFromName(const agx::String& name);
216 
218  bool removeCameraViewFromName(const agx::String& name);
219 
221  agx::String getActiveCameraViewName() const;
222 
224  agx::Vector<agx::String> getCameraViewNames();
225 
227  bool storeViewsetAsCFGFile(const agx::String& filename);
228 
230  bool restoreViewsetFromCFGFile(const agx::String& filename);
231 
233  CameraDescriptionSet* getCameraDescriptionSet();
234 
236  static CameraDescription* getCameraDescriptionFromOsgViewer(osgViewer::Viewer * viewer);
237 
238  protected:
239  void setViewOnOSGViewer(CameraDescription* c, osgViewer::Viewer* viewer);
240 
242  bool parseCameraState(agxCFG::ConfigScript * cfg, CameraDescription *c);
243 
245  bool storeCameraState(agxCFG::ConfigScript * cfg, CameraDescription *c);
246 
248  virtual ~OsgCameraViewManager();
249 
250 
252  // Variables
254  protected:
256  };
257 
259 
260  /*Implementation*/
262 
263 }
264 
265 #endif
#define AGXQT_EXPORT
CameraDescriptionSetRef m_cameraSet
const agx::Vec3 & getEye() const
Get Eye vector.
void setName(const agx::String &name)
Set name of the camera description.
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
const agx::Vec3 & getCenter() const
Get center.
#define AGX_FORCE_INLINE
Definition: Object.h:62
CameraDescriptionList m_cameraDescriptionContainer
Base class providing referencing counted objects.
Definition: Referenced.h:113
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
const agx::Real getFov() const
Get Field of view.
uint32_t UInt
Definition: Integer.h:34
CameraDescriptionSet * getCameraDescriptionSet()
Returns the internal structure of the camera view set.
Manager class that acts as a wrapper container for the CameravViewset class for OSG based view system...
const agx::String & getName() const
T * get() const
Definition: ref_ptr.h:256
Class that describes an abstract camera and it&#39;s properties.
const agx::Vec3 & getUp() const
Get up vector.
agx::String m_name
Name of the camera description.
double Real
Definition: Real.h:42
CameraViewSet is a class that handles and manages a set of cameras that the user should be able to sw...
Definition: CameraViewSet.h:59