Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _VIEWPT3D_HXX
30 : : #define _VIEWPT3D_HXX
31 : :
32 : : #include "svx/svxdllapi.h"
33 : : #include <basegfx/matrix/b3dhommatrix.hxx>
34 : : #include <basegfx/point/b3dpoint.hxx>
35 : : #include <basegfx/vector/b3dvector.hxx>
36 : : #include <tools/gen.hxx>
37 : :
38 : : // predefines
39 : : namespace basegfx { class B3DRange; } // end of namespace basegfx
40 : :
41 : : /*************************************************************************
42 : : |*
43 : : |* enums fuer Projektion und Seitenverhaeltnis
44 : : |*
45 : : \************************************************************************/
46 : :
47 : : enum ProjectionType { PR_PARALLEL, PR_PERSPECTIVE };
48 : : enum AspectMapType { AS_NO_MAPPING, AS_HOLD_SIZE, AS_HOLD_X, AS_HOLD_Y };
49 : :
50 : :
51 : : /*************************************************************************
52 : : |*
53 : : |* 3D-Viewport nach PHIGS
54 : : |*
55 : : \************************************************************************/
56 : :
57 : 0 : class SVX_DLLPUBLIC Viewport3D
58 : : {
59 : : protected:
60 : : basegfx::B3DHomMatrix aViewTf; // die eigentliche Transformationsmatrix
61 : : basegfx::B3DPoint aVRP; // View Reference Point
62 : : basegfx::B3DVector aVPN; // View Plane Normal
63 : : basegfx::B3DVector aVUV; // View Up Vector
64 : : basegfx::B3DPoint aPRP; // Projection Reference Point(View-Koordinaten)
65 : : // bisher wird nur die Z-Koordinate beachtet
66 : : double fVPD; // View Plane Distance
67 : : double fNearClipDist; // Abstand der vorderen Clippingebene
68 : : double fFarClipDist; // Abstand der hinteren Clippingebene
69 : :
70 : : ProjectionType eProjection; // Art der Projektion
71 : : AspectMapType eAspectMapping; // Flag fuer Seitenverhaeltnis-Anpassung
72 : : // bei Ausgabe auf das Geraet
73 : : Rectangle aDeviceRect; // Position und Groesse des Ausgabebereichs
74 : :
75 : : struct
76 : : {
77 : : double X, Y, W, H; // Position und Groesse des View-Windows
78 : : } aViewWin; // in View-Koordinaten
79 : :
80 : : basegfx::B3DPoint aViewPoint; // Beobachterstandpunkt in Weltkoordinaten;
81 : : // wird mit der Transformation berechnet
82 : : sal_Bool bTfValid; // Flag, ob Transformation gueltig ist
83 : :
84 : : double fWRatio; // Device/View-Seitenverhaeltnisse
85 : : double fHRatio;
86 : :
87 : : void MakeTransform(void);
88 : :
89 : : public:
90 : : Viewport3D();
91 : :
92 : : void SetVRP(const basegfx::B3DPoint& rNewVRP);
93 : : void SetVPN(const basegfx::B3DVector& rNewVPN);
94 : : void SetVUV(const basegfx::B3DVector& rNewVUV);
95 : : void SetPRP(const basegfx::B3DPoint& rNewPRP);
96 : : void SetVPD(double fNewVPD);
97 : :
98 : : const basegfx::B3DPoint& GetVRP() const { return aVRP; }
99 : : const basegfx::B3DVector& GetVPN() const { return aVPN; }
100 : : const basegfx::B3DVector& GetVUV() const { return aVUV; }
101 : : const basegfx::B3DPoint& GetPRP() const { return aPRP; }
102 : : double GetVPD() const { return fVPD; }
103 : : double GetNearClipDist() const { return fNearClipDist; }
104 : : double GetFarClipDist() const { return fFarClipDist; }
105 : :
106 : : void SetProjection(ProjectionType ePrj)
107 : : { eProjection = ePrj; bTfValid = sal_False; }
108 : : ProjectionType GetProjection() const { return(eProjection); }
109 : :
110 : : void SetAspectMapping(AspectMapType eAsp)
111 : : { eAspectMapping = eAsp; bTfValid = sal_False; }
112 : : AspectMapType GetAspectMapping() { return eAspectMapping; }
113 : :
114 : : void SetViewWindow(double fX, double fY, double fW, double fH);
115 : :
116 : : void SetDeviceWindow(const Rectangle& rRect);
117 : : const Rectangle& GetDeviceWindow() const { return aDeviceRect; }
118 : :
119 : : // Beobachterstandpunkt in Weltkoordinaten zurueckgeben
120 : : const basegfx::B3DPoint& GetViewPoint();
121 : : };
122 : :
123 : : #endif // _VIEWPT3D_HXX
124 : :
125 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|