1 #ifndef COIN_SOCAMERAUTILS_H
2 #define COIN_SOCAMERAUTILS_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/SbBasic.h>
37 
38 class SoCamera;
39 class SbVec3f;
40 
41 class SoCameraManager {
42 public:
43   static SoCameraManager * createFor(SoCamera * camera);
44 
45   virtual ~SoCameraManager(void);
46 
47   virtual void setZoomLimits(float minzoomvalue = 0.0f, float maxzoomvalue = 0.0f);
48   virtual SbBool getZoomLimits(float & minzoomvalue, float & maxzoomvalue) const;
49 
50   virtual void setZoomValue(float zoomvalue, SbBool limit = FALSE) = 0;
51   virtual void adjustZoomValue(float diffvalue, SbBool limit = TRUE) = 0; // diffvalue=0.0 is identity
52   virtual void adjustZoom(float factor, SbBool limit = TRUE) = 0; // factor=1.0 is identity
53 
54   virtual float getZoomValue(void) const;
55 
56   virtual void setZoomByDollyLimits(float mindollydistance = 0.0f, float maxdollydistance = 0.0f, float unitydistance = 0.0f);
57   virtual SbBool getZoomByDollyLimits(float & mindollydistance, float & maxdollydistance, float & unitydistance) const;
58 
59   virtual void setZoomValueByDolly(float zoomvalue, SbBool limit = FALSE) = 0;
60   virtual void adjustZoomByDollyDistance(float distance, SbBool limit = TRUE) = 0; // distance=0.0 is identity
61   virtual void adjustZoomByDolly(float factor, SbBool limit = TRUE) = 0; // factor=1.0 is identity
62 
63   virtual float getZoomByDollyValue(void) const;
64 
getCamera(void)65   SoCamera * getCamera(void) const { return this->camera; }
66   SbVec3f getFocalPoint(void) const;
67 
68   virtual void copyLimits(const SoCameraManager * other);
69 
70 protected:
71   SoCameraManager(SoCamera * camera);
72 
73   SbBool havezoomlimits;
74   float minzoom, maxzoom;
75   SbBool havezoombydollylimits;
76   float mindollydistance, maxdollydistance, unitydistance;
77 
78 private:
79   SoCamera * camera;
80 
81 }; // SoCameraManager
82 
83 #endif // !COIN_SOCAMERAUTILS_H
84