xref: /AOO41X/main/svx/inc/svx/camera3d.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CAMERA3D_HXX
25 #define _CAMERA3D_HXX
26 
27 #include <svx/viewpt3d.hxx>
28 #include "svx/svxdllapi.h"
29 
30 /*************************************************************************
31 |*
32 |* Kamera-Ableitung
33 |*
34 \************************************************************************/
35 
36 class SVX_DLLPUBLIC Camera3D : public Viewport3D
37 {
38  protected:
39     basegfx::B3DPoint   aResetPos;
40     basegfx::B3DPoint   aResetLookAt;
41     double      fResetFocalLength;
42     double      fResetBankAngle;
43 
44     basegfx::B3DPoint   aPosition;
45     basegfx::B3DPoint   aLookAt;
46     double      fFocalLength;
47     double      fBankAngle;
48 
49     FASTBOOL    bAutoAdjustProjection;
50 
51  public:
52     Camera3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
53              double fFocalLen = 35.0, double fBankAng = 0);
54     Camera3D();
55 
56     // Anfangswerte wieder herstellen
57     void Reset();
58 
59     void SetDefaults(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
60                      double fFocalLen = 35.0, double fBankAng = 0);
61 
62     void SetViewWindow(double fX, double fY, double fW, double fH);
63 
64     void SetPosition(const basegfx::B3DPoint& rNewPos);
GetPosition() const65     const basegfx::B3DPoint& GetPosition() const { return aPosition; }
66     void SetLookAt(const basegfx::B3DPoint& rNewLookAt);
GetLookAt() const67     const basegfx::B3DPoint& GetLookAt() const { return aLookAt; }
68     void SetPosAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DPoint& rNewLookAt);
69 
70     // Brennweite in mm
71     void    SetFocalLength(double fLen);
72     void    SetFocalLengthWithCorrect(double fLen);
GetFocalLength() const73     double  GetFocalLength() const { return fFocalLength; }
74 
75     // Neigung links/rechts
76     void    SetBankAngle(double fAngle);
GetBankAngle() const77     double  GetBankAngle() const { return fBankAngle; }
78 
79     // Um die Kameraposition drehen, LookAt wird dabei veraendert
80     void Rotate(double fHAngle, double fVAngle);
81 
82     // Um den Blickpunkt drehen, Position wird dabei veraendert
83     void RotateAroundLookAt(double fHAngle, double fVAngle);
84 
SetAutoAdjustProjection(FASTBOOL bAdjust=sal_True)85     void SetAutoAdjustProjection(FASTBOOL bAdjust = sal_True)
86         { bAutoAdjustProjection = bAdjust; }
IsAutoAdjustProjection() const87     FASTBOOL IsAutoAdjustProjection() const { return bAutoAdjustProjection; }
88 };
89 
90 #endif      // _CAMERA3D_HXX
91