LCOV - code coverage report
Current view: top level - include/svx - viewpt3d.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 8 100.0 %
Date: 2015-06-13 12:38:46 Functions: 9 9 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : // predefines
      30             : namespace basegfx { class B3DRange; } // end of namespace basegfx
      31             : 
      32             : /*************************************************************************
      33             : |*
      34             : |* enums for projection and aspect ratio
      35             : |*
      36             : \************************************************************************/
      37             : 
      38             : enum ProjectionType { PR_PARALLEL, PR_PERSPECTIVE };
      39             : enum AspectMapType  { AS_NO_MAPPING, AS_HOLD_SIZE, AS_HOLD_X, AS_HOLD_Y };
      40             : 
      41             : 
      42             : /*************************************************************************
      43             : |*
      44             : |* 3D-Viewport nach PHIGS
      45             : |*
      46             : \************************************************************************/
      47             : 
      48       14155 : class SVX_DLLPUBLIC Viewport3D
      49             : {
      50             :  protected:
      51             :     basegfx::B3DHomMatrix       aViewTf;        // the real transformations matrix
      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-coordinates)
      56             :                                     // up to now only the z-coordinate is considered
      57             :     double          fVPD;           // View Plane Distance
      58             :     double          fNearClipDist;  // distance of the near Clipping level
      59             :     double          fFarClipDist;   // distance of the far Clipping level
      60             : 
      61             :     ProjectionType  eProjection;    // kind of the projection
      62             :     AspectMapType   eAspectMapping; // flag for the acclimatization of the aspect ratio
      63             :                                     // for display on the device
      64             :     Rectangle aDeviceRect;          // position and size of the output area
      65             : 
      66             :     struct
      67             :     {
      68             :         double X, Y, W, H;          // position and size of the view window
      69             :     } aViewWin;                     // in view coordinates
      70             : 
      71             :     basegfx::B3DPoint       aViewPoint;     //observers position in world coordinates;
      72             :                                     // is calculated by the transformation
      73             :     bool            bTfValid;       // flag, if transformation is valid
      74             : 
      75             :     double fWRatio;                 // device/view aspect ratio
      76             :     double fHRatio;
      77             : 
      78             :     void MakeTransform();
      79             : 
      80             :  public:
      81             :     Viewport3D();
      82             : 
      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);
      88             : 
      89        1366 :     const basegfx::B3DPoint&    GetVRP() const  { return aVRP; }
      90             :     const basegfx::B3DVector&   GetVPN() const  { return aVPN; }
      91        1366 :     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; }
      96             : 
      97        1311 :     void SetProjection(ProjectionType ePrj)
      98        1311 :         { eProjection = ePrj; bTfValid = false; }
      99        5851 :     ProjectionType GetProjection() const { return eProjection; }
     100             : 
     101             :     void SetAspectMapping(AspectMapType eAsp)
     102             :         { eAspectMapping = eAsp; bTfValid = false; }
     103        1366 :     AspectMapType GetAspectMapping() { return eAspectMapping; }
     104             : 
     105             :     void SetViewWindow(double fX, double fY, double fW, double fH);
     106             : 
     107             :     void SetDeviceWindow(const Rectangle& rRect);
     108        2702 :     const Rectangle& GetDeviceWindow() const { return aDeviceRect; }
     109             : 
     110             :     // returns observers position in world coordinates
     111             :     const basegfx::B3DPoint&    GetViewPoint();
     112             : };
     113             : 
     114             : #endif // INCLUDED_SVX_VIEWPT3D_HXX
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11