LCOV - code coverage report
Current view: top level - libreoffice/drawinglayer/source/geometry - viewinformation3d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 238 0.0 %
Date: 2012-12-27 Functions: 0 41 0.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             : #include <drawinglayer/geometry/viewinformation3d.hxx>
      21             : #include <basegfx/range/b3drange.hxx>
      22             : #include <basegfx/matrix/b3dhommatrix.hxx>
      23             : #include <com/sun/star/geometry/AffineMatrix3D.hpp>
      24             : #include <com/sun/star/geometry/RealRectangle3D.hpp>
      25             : #include <basegfx/tools/canvastools.hxx>
      26             : 
      27             : //////////////////////////////////////////////////////////////////////////////
      28             : 
      29             : using namespace com::sun::star;
      30             : 
      31             : //////////////////////////////////////////////////////////////////////////////
      32             : 
      33             : namespace drawinglayer
      34             : {
      35             :     namespace geometry
      36             :     {
      37             :         /** Implementation class for ViewInformation3D
      38             :         */
      39           0 :         class ImpViewInformation3D
      40             :         {
      41             :         private:
      42             :             // ViewInformation3D implementation can change refcount, so we have only
      43             :             // two memory regions for pairs of ViewInformation3D/ImpViewInformation3D
      44             :             friend class ::drawinglayer::geometry::ViewInformation3D;
      45             : 
      46             :             // the refcounter. 0 means exclusively used
      47             :             sal_uInt32                                  mnRefCount;
      48             : 
      49             :             // the 3D transformations
      50             :             // Object to World. This may change and being adapted when entering 3D transformation
      51             :             // groups
      52             :             basegfx::B3DHomMatrix                       maObjectTransformation;
      53             : 
      54             :             // World to Camera. This includes VRP, VPN and VUV camera coordinate system
      55             :             basegfx::B3DHomMatrix                       maOrientation;
      56             : 
      57             :             // Camera to Device with X,Y and Z [-1.0 .. 1.0]. This is the
      58             :             // 3D to 2D projection which may be parallell or perspective. When it is perspective,
      59             :             // the last line of the homogen matrix will NOT be unused
      60             :             basegfx::B3DHomMatrix                       maProjection;
      61             : 
      62             :             // Device to View with X,Y and Z [0.0 .. 1.0]. This converts from -1 to 1 coordinates
      63             :             // in camera coordinate system to 0 to 1 in unit 2D coordinates. This way it stays
      64             :             // view-independent. To get discrete coordinates, the 2D transformation of a scene
      65             :             // as 2D object needs to be involved
      66             :             basegfx::B3DHomMatrix                       maDeviceToView;
      67             : 
      68             :             // Object to View is the linear combination of all four transformations. It's
      69             :             // buffered to avoid too much matrix multiplying and created on demand
      70             :             basegfx::B3DHomMatrix                       maObjectToView;
      71             : 
      72             :             // the point in time
      73             :             double                                      mfViewTime;
      74             : 
      75             :             // the complete PropertyValue representation (if already created)
      76             :             uno::Sequence< beans::PropertyValue >       mxViewInformation;
      77             : 
      78             :             // the extra PropertyValues; does not contain the transformations
      79             :             uno::Sequence< beans::PropertyValue >       mxExtendedInformation;
      80             : 
      81             :             // the local UNO API strings
      82           0 :             const ::rtl::OUString& getNamePropertyObjectTransformation()
      83             :             {
      84           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("ObjectTransformation"));
      85           0 :                 return s_sNameProperty;
      86             :             }
      87             : 
      88           0 :             const ::rtl::OUString& getNamePropertyOrientation()
      89             :             {
      90           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Orientation"));
      91           0 :                 return s_sNameProperty;
      92             :             }
      93             : 
      94           0 :             const ::rtl::OUString& getNamePropertyProjection()
      95             :             {
      96           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection"));
      97           0 :                 return s_sNameProperty;
      98             :             }
      99             : 
     100           0 :             const ::rtl::OUString& getNamePropertyProjection_30()
     101             :             {
     102           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection30"));
     103           0 :                 return s_sNameProperty;
     104             :             }
     105             : 
     106           0 :             const ::rtl::OUString& getNamePropertyProjection_31()
     107             :             {
     108           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection31"));
     109           0 :                 return s_sNameProperty;
     110             :             }
     111             : 
     112           0 :             const ::rtl::OUString& getNamePropertyProjection_32()
     113             :             {
     114           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection32"));
     115           0 :                 return s_sNameProperty;
     116             :             }
     117             : 
     118           0 :             const ::rtl::OUString& getNamePropertyProjection_33()
     119             :             {
     120           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection33"));
     121           0 :                 return s_sNameProperty;
     122             :             }
     123             : 
     124           0 :             const ::rtl::OUString& getNamePropertyDeviceToView()
     125             :             {
     126           0 :                 static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("DeviceToView"));
     127           0 :                 return s_sNameProperty;
     128             :             }
     129             : 
     130           0 :             const ::rtl::OUString& getNamePropertyTime()
     131             :             {
     132           0 :                 static ::rtl::OUString s_sNamePropertyTime(RTL_CONSTASCII_USTRINGPARAM("Time"));
     133           0 :                 return s_sNamePropertyTime;
     134             :             }
     135             : 
     136             :             // a central PropertyValue parsing method to allow transportatin of
     137             :             // all ViewParameters using UNO API
     138           0 :             void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters)
     139             :             {
     140           0 :                 if(rViewParameters.hasElements())
     141             :                 {
     142           0 :                     const sal_Int32 nCount(rViewParameters.getLength());
     143           0 :                     sal_Int32 nExtendedInsert(0);
     144             : 
     145             :                     // prepare extended information for filtering. Maximum size is nCount
     146           0 :                     mxExtendedInformation.realloc(nCount);
     147             : 
     148           0 :                     for(sal_Int32 a(0); a < nCount; a++)
     149             :                     {
     150           0 :                         const beans::PropertyValue& rProp = rViewParameters[a];
     151             : 
     152           0 :                         if(rProp.Name == getNamePropertyObjectTransformation())
     153             :                         {
     154           0 :                             com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     155           0 :                             rProp.Value >>= aAffineMatrix3D;
     156           0 :                             maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
     157             :                         }
     158           0 :                         else if(rProp.Name == getNamePropertyOrientation())
     159             :                         {
     160           0 :                             com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     161           0 :                             rProp.Value >>= aAffineMatrix3D;
     162           0 :                             maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
     163             :                         }
     164           0 :                         else if(rProp.Name == getNamePropertyProjection())
     165             :                         {
     166             :                             // projection may be defined using a frustum in which case the last line of
     167             :                             // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that,
     168             :                             // these four values need to be treated extra
     169           0 :                             const double f_30(maProjection.get(3, 0));
     170           0 :                             const double f_31(maProjection.get(3, 1));
     171           0 :                             const double f_32(maProjection.get(3, 2));
     172           0 :                             const double f_33(maProjection.get(3, 3));
     173             : 
     174           0 :                             com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     175           0 :                             rProp.Value >>= aAffineMatrix3D;
     176           0 :                             maProjection = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
     177             : 
     178           0 :                             maProjection.set(3, 0, f_30);
     179           0 :                             maProjection.set(3, 1, f_31);
     180           0 :                             maProjection.set(3, 2, f_32);
     181           0 :                             maProjection.set(3, 3, f_33);
     182             :                         }
     183           0 :                         else if(rProp.Name == getNamePropertyProjection_30())
     184             :                         {
     185           0 :                             double f_30(0.0);
     186           0 :                             rProp.Value >>= f_30;
     187           0 :                             maProjection.set(3, 0, f_30);
     188             :                         }
     189           0 :                         else if(rProp.Name == getNamePropertyProjection_31())
     190             :                         {
     191           0 :                             double f_31(0.0);
     192           0 :                             rProp.Value >>= f_31;
     193           0 :                             maProjection.set(3, 1, f_31);
     194             :                         }
     195           0 :                         else if(rProp.Name == getNamePropertyProjection_32())
     196             :                         {
     197           0 :                             double f_32(0.0);
     198           0 :                             rProp.Value >>= f_32;
     199           0 :                             maProjection.set(3, 2, f_32);
     200             :                         }
     201           0 :                         else if(rProp.Name == getNamePropertyProjection_33())
     202             :                         {
     203           0 :                             double f_33(1.0);
     204           0 :                             rProp.Value >>= f_33;
     205           0 :                             maProjection.set(3, 3, f_33);
     206             :                         }
     207           0 :                         else if(rProp.Name == getNamePropertyDeviceToView())
     208             :                         {
     209           0 :                             com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     210           0 :                             rProp.Value >>= aAffineMatrix3D;
     211           0 :                             maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
     212             :                         }
     213           0 :                         else if(rProp.Name == getNamePropertyTime())
     214             :                         {
     215           0 :                             rProp.Value >>= mfViewTime;
     216             :                         }
     217             :                         else
     218             :                         {
     219             :                             // extra information; add to filtered information
     220           0 :                             mxExtendedInformation[nExtendedInsert++] = rProp;
     221             :                         }
     222             :                     }
     223             : 
     224             :                     // extra information size is now known; realloc to final size
     225           0 :                     mxExtendedInformation.realloc(nExtendedInsert);
     226             :                 }
     227           0 :             }
     228             : 
     229             :             // central method to create a Sequence of PropertyValues containing he complete
     230             :             // data set
     231           0 :             void impFillViewInformationFromContent()
     232             :             {
     233           0 :                 uno::Sequence< beans::PropertyValue > xRetval;
     234           0 :                 const bool bObjectTransformationUsed(!maObjectTransformation.isIdentity());
     235           0 :                 const bool bOrientationUsed(!maOrientation.isIdentity());
     236           0 :                 const bool bProjectionUsed(!maProjection.isIdentity());
     237           0 :                 const bool bDeviceToViewUsed(!maDeviceToView.isIdentity());
     238           0 :                 const bool bTimeUsed(0.0 < mfViewTime);
     239           0 :                 const bool bExtraInformation(mxExtendedInformation.hasElements());
     240             : 
     241             :                 // projection may be defined using a frustum in which case the last line of
     242             :                 // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that,
     243             :                 // these four values need to be treated extra
     244           0 :                 const bool bProjectionUsed_30(bProjectionUsed && !basegfx::fTools::equalZero(maProjection.get(3, 0)));
     245           0 :                 const bool bProjectionUsed_31(bProjectionUsed && !basegfx::fTools::equalZero(maProjection.get(3, 1)));
     246           0 :                 const bool bProjectionUsed_32(bProjectionUsed && !basegfx::fTools::equalZero(maProjection.get(3, 2)));
     247           0 :                 const bool bProjectionUsed_33(bProjectionUsed && !basegfx::fTools::equal(maProjection.get(3, 3), 1.0));
     248             : 
     249           0 :                 sal_uInt32 nIndex(0);
     250             :                 const sal_uInt32 nCount(
     251             :                     (bObjectTransformationUsed ? 1 : 0) +
     252             :                     (bOrientationUsed ? 1 : 0) +
     253             :                     (bProjectionUsed ? 1 : 0) +
     254             :                     (bProjectionUsed_30 ? 1 : 0) +
     255             :                     (bProjectionUsed_31 ? 1 : 0) +
     256             :                     (bProjectionUsed_32 ? 1 : 0) +
     257             :                     (bProjectionUsed_33 ? 1 : 0) +
     258             :                     (bDeviceToViewUsed ? 1 : 0) +
     259             :                     (bTimeUsed ? 1 : 0) +
     260           0 :                     (bExtraInformation ? mxExtendedInformation.getLength() : 0));
     261             : 
     262           0 :                 mxViewInformation.realloc(nCount);
     263             : 
     264           0 :                 if(bObjectTransformationUsed)
     265             :                 {
     266           0 :                     com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     267           0 :                     basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maObjectTransformation);
     268           0 :                     mxViewInformation[nIndex].Name = getNamePropertyObjectTransformation();
     269           0 :                     mxViewInformation[nIndex].Value <<= aAffineMatrix3D;
     270           0 :                     nIndex++;
     271             :                 }
     272             : 
     273           0 :                 if(bOrientationUsed)
     274             :                 {
     275           0 :                     com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     276           0 :                     basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maOrientation);
     277           0 :                     mxViewInformation[nIndex].Name = getNamePropertyOrientation();
     278           0 :                     mxViewInformation[nIndex].Value <<= aAffineMatrix3D;
     279           0 :                     nIndex++;
     280             :                 }
     281             : 
     282           0 :                 if(bProjectionUsed)
     283             :                 {
     284           0 :                     com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     285           0 :                     basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maProjection);
     286           0 :                     mxViewInformation[nIndex].Name = getNamePropertyProjection();
     287           0 :                     mxViewInformation[nIndex].Value <<= aAffineMatrix3D;
     288           0 :                     nIndex++;
     289             :                 }
     290             : 
     291           0 :                 if(bProjectionUsed_30)
     292             :                 {
     293           0 :                     mxViewInformation[nIndex].Name = getNamePropertyProjection_30();
     294           0 :                     mxViewInformation[nIndex].Value <<= maProjection.get(3, 0);
     295           0 :                     nIndex++;
     296             :                 }
     297             : 
     298           0 :                 if(bProjectionUsed_31)
     299             :                 {
     300           0 :                     mxViewInformation[nIndex].Name = getNamePropertyProjection_31();
     301           0 :                     mxViewInformation[nIndex].Value <<= maProjection.get(3, 1);
     302           0 :                     nIndex++;
     303             :                 }
     304             : 
     305           0 :                 if(bProjectionUsed_32)
     306             :                 {
     307           0 :                     mxViewInformation[nIndex].Name = getNamePropertyProjection_32();
     308           0 :                     mxViewInformation[nIndex].Value <<= maProjection.get(3, 2);
     309           0 :                     nIndex++;
     310             :                 }
     311             : 
     312           0 :                 if(bProjectionUsed_33)
     313             :                 {
     314           0 :                     mxViewInformation[nIndex].Name = getNamePropertyProjection_33();
     315           0 :                     mxViewInformation[nIndex].Value <<= maProjection.get(3, 3);
     316           0 :                     nIndex++;
     317             :                 }
     318             : 
     319           0 :                 if(bDeviceToViewUsed)
     320             :                 {
     321           0 :                     com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
     322           0 :                     basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maDeviceToView);
     323           0 :                     mxViewInformation[nIndex].Name = getNamePropertyDeviceToView();
     324           0 :                     mxViewInformation[nIndex].Value <<= aAffineMatrix3D;
     325           0 :                     nIndex++;
     326             :                 }
     327             : 
     328           0 :                 if(bTimeUsed)
     329             :                 {
     330           0 :                     mxViewInformation[nIndex].Name = getNamePropertyTime();
     331           0 :                     mxViewInformation[nIndex].Value <<= mfViewTime;
     332           0 :                     nIndex++;
     333             :                 }
     334             : 
     335           0 :                 if(bExtraInformation)
     336             :                 {
     337           0 :                     const sal_Int32 nExtra(mxExtendedInformation.getLength());
     338             : 
     339           0 :                     for(sal_Int32 a(0); a < nExtra; a++)
     340             :                     {
     341           0 :                         mxViewInformation[nIndex++] = mxExtendedInformation[a];
     342             :                     }
     343           0 :                 }
     344           0 :             }
     345             : 
     346             :         public:
     347           0 :             ImpViewInformation3D(
     348             :                 const basegfx::B3DHomMatrix& rObjectTransformation,
     349             :                 const basegfx::B3DHomMatrix& rOrientation,
     350             :                 const basegfx::B3DHomMatrix& rProjection,
     351             :                 const basegfx::B3DHomMatrix& rDeviceToView,
     352             :                 double fViewTime,
     353             :                 const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
     354             :             :   mnRefCount(0),
     355             :                 maObjectTransformation(rObjectTransformation),
     356             :                 maOrientation(rOrientation),
     357             :                 maProjection(rProjection),
     358             :                 maDeviceToView(rDeviceToView),
     359             :                 mfViewTime(fViewTime),
     360             :                 mxViewInformation(),
     361           0 :                 mxExtendedInformation()
     362             :             {
     363           0 :                 impInterpretPropertyValues(rExtendedParameters);
     364           0 :             }
     365             : 
     366           0 :             explicit ImpViewInformation3D(const uno::Sequence< beans::PropertyValue >& rViewParameters)
     367             :             :   mnRefCount(0),
     368             :                 maObjectTransformation(),
     369             :                 maOrientation(),
     370             :                 maProjection(),
     371             :                 maDeviceToView(),
     372             :                 mfViewTime(),
     373             :                 mxViewInformation(rViewParameters),
     374           0 :                 mxExtendedInformation()
     375             :             {
     376           0 :                 impInterpretPropertyValues(rViewParameters);
     377           0 :             }
     378             : 
     379           0 :             ImpViewInformation3D()
     380             :             :   mnRefCount(0),
     381             :                 maObjectTransformation(),
     382             :                 maOrientation(),
     383             :                 maProjection(),
     384             :                 maDeviceToView(),
     385             :                 mfViewTime(),
     386             :                 mxViewInformation(),
     387           0 :                 mxExtendedInformation()
     388             :             {
     389           0 :             }
     390             : 
     391           0 :             const basegfx::B3DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
     392           0 :             const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; }
     393           0 :             const basegfx::B3DHomMatrix& getProjection() const { return maProjection; }
     394           0 :             const basegfx::B3DHomMatrix& getDeviceToView() const { return maDeviceToView; }
     395           0 :             double getViewTime() const { return mfViewTime; }
     396             : 
     397           0 :             const basegfx::B3DHomMatrix& getObjectToView() const
     398             :             {
     399             :                 // on demand WorldToView creation
     400           0 :                 ::osl::Mutex m_mutex;
     401             : 
     402           0 :                 if(maObjectToView.isIdentity())
     403             :                 {
     404           0 :                     const_cast< ImpViewInformation3D* >(this)->maObjectToView = maDeviceToView * maProjection * maOrientation * maObjectTransformation;
     405             :                 }
     406             : 
     407           0 :                 return maObjectToView;
     408             :             }
     409             : 
     410           0 :             const uno::Sequence< beans::PropertyValue >& getViewInformationSequence() const
     411             :             {
     412           0 :                 ::osl::Mutex m_mutex;
     413             : 
     414           0 :                 if(!mxViewInformation.hasElements())
     415             :                 {
     416           0 :                     const_cast< ImpViewInformation3D* >(this)->impFillViewInformationFromContent();
     417             :                 }
     418             : 
     419           0 :                 return mxViewInformation;
     420             :             }
     421             : 
     422           0 :             const uno::Sequence< beans::PropertyValue >& getExtendedInformationSequence() const
     423             :             {
     424           0 :                 return mxExtendedInformation;
     425             :             }
     426             : 
     427           0 :             bool operator==(const ImpViewInformation3D& rCandidate) const
     428             :             {
     429           0 :                 return (maObjectTransformation == rCandidate.maObjectTransformation
     430           0 :                     && maOrientation == rCandidate.maOrientation
     431           0 :                     && maProjection == rCandidate.maProjection
     432           0 :                     && maDeviceToView == rCandidate.maDeviceToView
     433             :                     && mfViewTime == rCandidate.mfViewTime
     434           0 :                     && mxExtendedInformation == rCandidate.mxExtendedInformation);
     435             :             }
     436             : 
     437           0 :             static ImpViewInformation3D* get_global_default()
     438             :             {
     439             :                 static ImpViewInformation3D* pDefault = 0;
     440             : 
     441           0 :                 if(!pDefault)
     442             :                 {
     443           0 :                     pDefault = new ImpViewInformation3D();
     444             : 
     445             :                     // never delete; start with RefCount 1, not 0
     446           0 :                     pDefault->mnRefCount++;
     447             :                 }
     448             : 
     449           0 :                 return pDefault;
     450             :             }
     451             :         };
     452             :     } // end of anonymous namespace
     453             : } // end of namespace drawinglayer
     454             : 
     455             : //////////////////////////////////////////////////////////////////////////////
     456             : 
     457             : namespace drawinglayer
     458             : {
     459             :     namespace geometry
     460             :     {
     461           0 :         ViewInformation3D::ViewInformation3D(
     462             :             const basegfx::B3DHomMatrix& rObjectObjectTransformation,
     463             :             const basegfx::B3DHomMatrix& rOrientation,
     464             :             const basegfx::B3DHomMatrix& rProjection,
     465             :             const basegfx::B3DHomMatrix& rDeviceToView,
     466             :             double fViewTime,
     467             :             const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
     468             :         :   mpViewInformation3D(new ImpViewInformation3D(
     469             :                 rObjectObjectTransformation, rOrientation, rProjection,
     470           0 :                 rDeviceToView, fViewTime, rExtendedParameters))
     471             :         {
     472           0 :         }
     473             : 
     474           0 :         ViewInformation3D::ViewInformation3D(const uno::Sequence< beans::PropertyValue >& rViewParameters)
     475           0 :         :   mpViewInformation3D(new ImpViewInformation3D(rViewParameters))
     476             :         {
     477           0 :         }
     478             : 
     479           0 :         ViewInformation3D::ViewInformation3D()
     480           0 :         :   mpViewInformation3D(ImpViewInformation3D::get_global_default())
     481             :         {
     482           0 :             mpViewInformation3D->mnRefCount++;
     483           0 :         }
     484             : 
     485           0 :         ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate)
     486           0 :         :   mpViewInformation3D(rCandidate.mpViewInformation3D)
     487             :         {
     488           0 :             ::osl::Mutex m_mutex;
     489           0 :             mpViewInformation3D->mnRefCount++;
     490           0 :         }
     491             : 
     492           0 :         ViewInformation3D::~ViewInformation3D()
     493             :         {
     494           0 :             ::osl::Mutex m_mutex;
     495             : 
     496           0 :             if(mpViewInformation3D->mnRefCount)
     497             :             {
     498           0 :                 mpViewInformation3D->mnRefCount--;
     499             :             }
     500             :             else
     501             :             {
     502           0 :                 delete mpViewInformation3D;
     503           0 :             }
     504           0 :         }
     505             : 
     506           0 :         bool ViewInformation3D::isDefault() const
     507             :         {
     508           0 :             return mpViewInformation3D == ImpViewInformation3D::get_global_default();
     509             :         }
     510             : 
     511           0 :         ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate)
     512             :         {
     513           0 :             ::osl::Mutex m_mutex;
     514             : 
     515           0 :             if(mpViewInformation3D->mnRefCount)
     516             :             {
     517           0 :                 mpViewInformation3D->mnRefCount--;
     518             :             }
     519             :             else
     520             :             {
     521           0 :                 delete mpViewInformation3D;
     522             :             }
     523             : 
     524           0 :             mpViewInformation3D = rCandidate.mpViewInformation3D;
     525           0 :             mpViewInformation3D->mnRefCount++;
     526             : 
     527           0 :             return *this;
     528             :         }
     529             : 
     530           0 :         bool ViewInformation3D::operator==(const ViewInformation3D& rCandidate) const
     531             :         {
     532           0 :             if(rCandidate.mpViewInformation3D == mpViewInformation3D)
     533             :             {
     534           0 :                 return true;
     535             :             }
     536             : 
     537           0 :             if(rCandidate.isDefault() != isDefault())
     538             :             {
     539           0 :                 return false;
     540             :             }
     541             : 
     542           0 :             return (*rCandidate.mpViewInformation3D == *mpViewInformation3D);
     543             :         }
     544             : 
     545           0 :         const basegfx::B3DHomMatrix& ViewInformation3D::getObjectTransformation() const
     546             :         {
     547           0 :             return mpViewInformation3D->getObjectTransformation();
     548             :         }
     549             : 
     550           0 :         const basegfx::B3DHomMatrix& ViewInformation3D::getOrientation() const
     551             :         {
     552           0 :             return mpViewInformation3D->getOrientation();
     553             :         }
     554             : 
     555           0 :         const basegfx::B3DHomMatrix& ViewInformation3D::getProjection() const
     556             :         {
     557           0 :             return mpViewInformation3D->getProjection();
     558             :         }
     559             : 
     560           0 :         const basegfx::B3DHomMatrix& ViewInformation3D::getDeviceToView() const
     561             :         {
     562           0 :             return mpViewInformation3D->getDeviceToView();
     563             :         }
     564             : 
     565           0 :         const basegfx::B3DHomMatrix& ViewInformation3D::getObjectToView() const
     566             :         {
     567           0 :             return mpViewInformation3D->getObjectToView();
     568             :         }
     569             : 
     570           0 :         double ViewInformation3D::getViewTime() const
     571             :         {
     572           0 :             return mpViewInformation3D->getViewTime();
     573             :         }
     574             : 
     575           0 :         const uno::Sequence< beans::PropertyValue >& ViewInformation3D::getViewInformationSequence() const
     576             :         {
     577           0 :             return mpViewInformation3D->getViewInformationSequence();
     578             :         }
     579             : 
     580           0 :         const uno::Sequence< beans::PropertyValue >& ViewInformation3D::getExtendedInformationSequence() const
     581             :         {
     582           0 :             return mpViewInformation3D->getExtendedInformationSequence();
     583             :         }
     584             :     } // end of namespace geometry
     585             : } // end of namespace drawinglayer
     586             : 
     587             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10