LibreOffice Module svx (master)  1
viewpt3d.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SVX_VIEWPT3D_HXX
21 #define INCLUDED_SVX_VIEWPT3D_HXX
22 
23 #include <svx/svxdllapi.h>
27 #include <tools/gen.hxx>
28 
29 // predefines
30 namespace basegfx { class B3DRange; } // end of namespace basegfx
31 
32 /*************************************************************************
33 |*
34 |* enums for projection
35 |*
36 \************************************************************************/
37 
39 
40 
41 /*************************************************************************
42 |*
43 |* 3D viewport according to PHIGS
44 |*
45 \************************************************************************/
46 
48 {
49  protected:
50  basegfx::B3DHomMatrix aViewTf; // the real transformations matrix
51  basegfx::B3DPoint aVRP; // View Reference Point
52  basegfx::B3DVector aVPN; // View Plane Normal
53  basegfx::B3DVector aVUV; // View Up Vector
54  basegfx::B3DPoint aPRP; // Projection Reference Point(View-coordinates)
55  // up to now only the z-coordinate is considered
56 
57  ProjectionType eProjection; // kind of the projection
58  tools::Rectangle aDeviceRect; // position and size of the output area
59 
60  struct
61  {
62  double X, Y, W, H; // position and size of the view window
63  } aViewWin; // in view coordinates
64 
65  basegfx::B3DPoint aViewPoint; //observers position in world coordinates;
66  // is calculated by the transformation
67  bool bTfValid; // flag, if transformation is valid
68 
69  public:
70  Viewport3D();
71 
72  void SetVRP(const basegfx::B3DPoint& rNewVRP);
73  void SetVPN(const basegfx::B3DVector& rNewVPN);
74  void SetVUV(const basegfx::B3DVector& rNewVUV);
75  void SetPRP(const basegfx::B3DPoint& rNewPRP);
76 
77  const basegfx::B3DPoint& GetVRP() const { return aVRP; }
78  const basegfx::B3DVector& GetVUV() const { return aVUV; }
79 
81  { eProjection = ePrj; bTfValid = false; }
82  ProjectionType GetProjection() const { return eProjection; }
83 
84  void SetViewWindow(double fX, double fY, double fW, double fH);
85 
86  void SetDeviceWindow(const tools::Rectangle& rRect);
87  const tools::Rectangle& GetDeviceWindow() const { return aDeviceRect; }
88 
89  // returns observers position in world coordinates
90  const basegfx::B3DPoint& GetViewPoint();
91 };
92 
93 #endif // INCLUDED_SVX_VIEWPT3D_HXX
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const tools::Rectangle & GetDeviceWindow() const
Definition: viewpt3d.hxx:87
ProjectionType GetProjection() const
Definition: viewpt3d.hxx:82
ProjectionType
Definition: viewpt3d.hxx:38
double Y
Definition: viewpt3d.hxx:62
#define X
tools::Rectangle aDeviceRect
Definition: viewpt3d.hxx:58
bool bTfValid
Definition: viewpt3d.hxx:67
basegfx::B3DVector aVPN
Definition: viewpt3d.hxx:52
ProjectionType eProjection
Definition: viewpt3d.hxx:57
basegfx::B3DHomMatrix aViewTf
Definition: viewpt3d.hxx:50
const basegfx::B3DPoint & GetVRP() const
Definition: viewpt3d.hxx:77
void SetProjection(ProjectionType ePrj)
Definition: viewpt3d.hxx:80
basegfx::B3DPoint aPRP
Definition: viewpt3d.hxx:54
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
basegfx::B3DPoint aViewPoint
Definition: viewpt3d.hxx:65
basegfx::B3DVector aVUV
Definition: viewpt3d.hxx:53
basegfx::B3DPoint aVRP
Definition: viewpt3d.hxx:51
const basegfx::B3DVector & GetVUV() const
Definition: viewpt3d.hxx:78