Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/viewpt3d.hxx
Line
Count
Source
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>
24
#include <basegfx/matrix/b3dhommatrix.hxx>
25
#include <basegfx/point/b3dpoint.hxx>
26
#include <basegfx/vector/b3dvector.hxx>
27
#include <tools/gen.hxx>
28
29
/*************************************************************************
30
|*
31
|* enums for projection
32
|*
33
\************************************************************************/
34
35
enum class ProjectionType { Parallel, Perspective };
36
37
38
/*************************************************************************
39
|*
40
|* 3D viewport according to PHIGS
41
|*
42
\************************************************************************/
43
44
class SVXCORE_DLLPUBLIC Viewport3D
45
{
46
 protected:
47
    basegfx::B3DHomMatrix       m_aViewTf;        // the real transformations matrix
48
    basegfx::B3DPoint           m_aVRP;           // View Reference Point
49
    basegfx::B3DVector          m_aVPN;           // View Plane Normal
50
    basegfx::B3DVector          m_aVUV;           // View Up Vector
51
    basegfx::B3DPoint           m_aPRP;           // Projection Reference Point(View-coordinates)
52
                                                // up to now only the z-coordinate is considered
53
54
    ProjectionType  m_eProjection;    // kind of the projection
55
    tools::Rectangle m_aDeviceRect;          // position and size of the output area
56
57
    struct
58
    {
59
        double X, Y, W, H;          // position and size of the view window
60
    } m_aViewWin;                     // in view coordinates
61
62
    basegfx::B3DPoint       m_aViewPoint;     //observers position in world coordinates;
63
                                    // is calculated by the transformation
64
    bool            m_bTfValid;       // flag, if transformation is valid
65
66
 public:
67
    Viewport3D();
68
69
    void SetVRP(const basegfx::B3DPoint& rNewVRP);
70
    void SetVPN(const basegfx::B3DVector& rNewVPN);
71
    void SetVUV(const basegfx::B3DVector& rNewVUV);
72
    void SetPRP(const basegfx::B3DPoint& rNewPRP);
73
74
6.91k
    const basegfx::B3DPoint&    GetVRP() const  { return m_aVRP; }
75
6.91k
    const basegfx::B3DVector&   GetVUV() const  { return m_aVUV; }
76
77
    void SetProjection(ProjectionType ePrj)
78
6.91k
        { m_eProjection = ePrj; m_bTfValid = false; }
79
13.8k
    ProjectionType GetProjection() const { return m_eProjection; }
80
81
    void SetViewWindow(double fX, double fY, double fW, double fH);
82
83
    void SetDeviceWindow(const tools::Rectangle& rRect);
84
10.3k
    const tools::Rectangle& GetDeviceWindow() const { return m_aDeviceRect; }
85
86
    // returns observers position in world coordinates
87
    const basegfx::B3DPoint&    GetViewPoint();
88
};
89
90
#endif // INCLUDED_SVX_VIEWPT3D_HXX
91
92
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */