1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVX_VIEWPT3D_HXX
21 #define INCLUDED_SVX_VIEWPT3D_HXX
23 #include <svx/svxdllapi.h>
24 #include <basegfx/matrix/b3dhommatrix.hxx>
25 #include <basegfx/point/b3dpoint.hxx>
26 #include <basegfx/vector/b3dvector.hxx>
27 #include <tools/gen.hxx>
30 namespace basegfx
{ class B3DRange
; } // end of namespace basegfx
32 /*************************************************************************
34 |* enums fuer Projektion und Seitenverhaeltnis
36 \************************************************************************/
38 enum ProjectionType
{ PR_PARALLEL
, PR_PERSPECTIVE
};
39 enum AspectMapType
{ AS_NO_MAPPING
, AS_HOLD_SIZE
, AS_HOLD_X
, AS_HOLD_Y
};
42 /*************************************************************************
44 |* 3D-Viewport nach PHIGS
46 \************************************************************************/
48 class SVX_DLLPUBLIC Viewport3D
51 basegfx::B3DHomMatrix aViewTf
; // die eigentliche Transformationsmatrix
52 basegfx::B3DPoint aVRP
; // View Reference Point
53 basegfx::B3DVector aVPN
; // View Plane Normal
54 basegfx::B3DVector aVUV
; // View Up Vector
55 basegfx::B3DPoint aPRP
; // Projection Reference Point(View-Koordinaten)
56 // bisher wird nur die Z-Koordinate beachtet
57 double fVPD
; // View Plane Distance
58 double fNearClipDist
; // Abstand der vorderen Clippingebene
59 double fFarClipDist
; // Abstand der hinteren Clippingebene
61 ProjectionType eProjection
; // Art der Projektion
62 AspectMapType eAspectMapping
; // Flag fuer Seitenverhaeltnis-Anpassung
63 // bei Ausgabe auf das Geraet
64 Rectangle aDeviceRect
; // Position und Groesse des Ausgabebereichs
68 double X
, Y
, W
, H
; // Position und Groesse des View-Windows
69 } aViewWin
; // in View-Koordinaten
71 basegfx::B3DPoint aViewPoint
; // Beobachterstandpunkt in Weltkoordinaten;
72 // wird mit der Transformation berechnet
73 sal_Bool bTfValid
; // Flag, ob Transformation gueltig ist
75 double fWRatio
; // Device/View-Seitenverhaeltnisse
78 void MakeTransform(void);
83 void SetVRP(const basegfx::B3DPoint
& rNewVRP
);
84 void SetVPN(const basegfx::B3DVector
& rNewVPN
);
85 void SetVUV(const basegfx::B3DVector
& rNewVUV
);
86 void SetPRP(const basegfx::B3DPoint
& rNewPRP
);
87 void SetVPD(double fNewVPD
);
89 const basegfx::B3DPoint
& GetVRP() const { return aVRP
; }
90 const basegfx::B3DVector
& GetVPN() const { return aVPN
; }
91 const basegfx::B3DVector
& GetVUV() const { return aVUV
; }
92 const basegfx::B3DPoint
& GetPRP() const { return aPRP
; }
93 double GetVPD() const { return fVPD
; }
94 double GetNearClipDist() const { return fNearClipDist
; }
95 double GetFarClipDist() const { return fFarClipDist
; }
97 void SetProjection(ProjectionType ePrj
)
98 { eProjection
= ePrj
; bTfValid
= sal_False
; }
99 ProjectionType
GetProjection() const { return(eProjection
); }
101 void SetAspectMapping(AspectMapType eAsp
)
102 { eAspectMapping
= eAsp
; bTfValid
= sal_False
; }
103 AspectMapType
GetAspectMapping() { return eAspectMapping
; }
105 void SetViewWindow(double fX
, double fY
, double fW
, double fH
);
107 void SetDeviceWindow(const Rectangle
& rRect
);
108 const Rectangle
& GetDeviceWindow() const { return aDeviceRect
; }
110 // Beobachterstandpunkt in Weltkoordinaten zurueckgeben
111 const basegfx::B3DPoint
& GetViewPoint();
114 #endif // INCLUDED_SVX_VIEWPT3D_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */