LCOV - code coverage report
Current view: top level - libreoffice/basegfx/inc/basegfx/range - b3drange.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-12-17 Functions: 0 16 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             : #ifndef _BGFX_RANGE_B3DRANGE_HXX
      21             : #define _BGFX_RANGE_B3DRANGE_HXX
      22             : 
      23             : #include <basegfx/vector/b3dvector.hxx>
      24             : #include <basegfx/point/b3dpoint.hxx>
      25             : #include <basegfx/tuple/b3dtuple.hxx>
      26             : #include <basegfx/range/basicrange.hxx>
      27             : #include <basegfx/basegfxdllapi.h>
      28             : 
      29             : namespace basegfx
      30             : {
      31             :     // predeclarations
      32             :     class B3IRange;
      33             :     class B3DHomMatrix;
      34             : 
      35             :     class B3DRange
      36             :     {
      37             :         typedef ::basegfx::BasicRange< double, DoubleTraits >   MyBasicRange;
      38             : 
      39             :         MyBasicRange            maRangeX;
      40             :         MyBasicRange            maRangeY;
      41             :         MyBasicRange            maRangeZ;
      42             : 
      43             :     public:
      44           0 :         B3DRange() {}
      45             : 
      46             :         explicit B3DRange(const B3DTuple& rTuple)
      47             :         :   maRangeX(rTuple.getX()),
      48             :             maRangeY(rTuple.getY()),
      49             :             maRangeZ(rTuple.getZ())
      50             :         {
      51             :         }
      52             : 
      53           0 :         B3DRange(double x1,
      54             :                  double y1,
      55             :                  double z1,
      56             :                  double x2,
      57             :                  double y2,
      58             :                  double z2)
      59             :         :   maRangeX(x1),
      60             :             maRangeY(y1),
      61           0 :             maRangeZ(z1)
      62             :         {
      63           0 :             maRangeX.expand(x2);
      64           0 :             maRangeY.expand(y2);
      65           0 :             maRangeZ.expand(z2);
      66           0 :         }
      67             : 
      68             :         B3DRange(const B3DTuple& rTuple1,
      69             :                  const B3DTuple& rTuple2)
      70             :         :   maRangeX(rTuple1.getX()),
      71             :             maRangeY(rTuple1.getY()),
      72             :             maRangeZ(rTuple1.getZ())
      73             :         {
      74             :             expand(rTuple2);
      75             :         }
      76             : 
      77           0 :         bool isEmpty() const
      78             :         {
      79             :             return (
      80           0 :                 maRangeX.isEmpty()
      81           0 :                 || maRangeY.isEmpty()
      82           0 :                 || maRangeZ.isEmpty()
      83           0 :                 );
      84             :         }
      85             : 
      86           0 :         void reset()
      87             :         {
      88           0 :             maRangeX.reset();
      89           0 :             maRangeY.reset();
      90           0 :             maRangeZ.reset();
      91           0 :         }
      92             : 
      93             :         bool operator==( const B3DRange& rRange ) const
      94             :         {
      95             :             return (maRangeX == rRange.maRangeX
      96             :                 && maRangeY == rRange.maRangeY
      97             :                 && maRangeZ == rRange.maRangeZ);
      98             :         }
      99             : 
     100             :         bool operator!=( const B3DRange& rRange ) const
     101             :         {
     102             :             return (maRangeX != rRange.maRangeX
     103             :                 || maRangeY != rRange.maRangeY
     104             :                 || maRangeZ != rRange.maRangeZ);
     105             :         }
     106             : 
     107             :         bool equal(const B3DRange& rRange) const
     108             :         {
     109             :             return (maRangeX.equal(rRange.maRangeX)
     110             :                     && maRangeY.equal(rRange.maRangeY)
     111             :                     && maRangeZ.equal(rRange.maRangeZ));
     112             :         }
     113             : 
     114           0 :         double getMinX() const
     115             :         {
     116           0 :             return maRangeX.getMinimum();
     117             :         }
     118             : 
     119           0 :         double getMinY() const
     120             :         {
     121           0 :             return maRangeY.getMinimum();
     122             :         }
     123             : 
     124           0 :         double getMinZ() const
     125             :         {
     126           0 :             return maRangeZ.getMinimum();
     127             :         }
     128             : 
     129           0 :         double getMaxX() const
     130             :         {
     131           0 :             return maRangeX.getMaximum();
     132             :         }
     133             : 
     134           0 :         double getMaxY() const
     135             :         {
     136           0 :             return maRangeY.getMaximum();
     137             :         }
     138             : 
     139           0 :         double getMaxZ() const
     140             :         {
     141           0 :             return maRangeZ.getMaximum();
     142             :         }
     143             : 
     144           0 :         double getWidth() const
     145             :         {
     146           0 :             return maRangeX.getRange();
     147             :         }
     148             : 
     149           0 :         double getHeight() const
     150             :         {
     151           0 :             return maRangeY.getRange();
     152             :         }
     153             : 
     154           0 :         double getDepth() const
     155             :         {
     156           0 :             return maRangeZ.getRange();
     157             :         }
     158             : 
     159             :         B3DPoint getMinimum() const
     160             :         {
     161             :             return B3DPoint(
     162             :                 maRangeX.getMinimum(),
     163             :                 maRangeY.getMinimum(),
     164             :                 maRangeZ.getMinimum()
     165             :                 );
     166             :         }
     167             : 
     168             :         B3DPoint getMaximum() const
     169             :         {
     170             :             return B3DPoint(
     171             :                 maRangeX.getMaximum(),
     172             :                 maRangeY.getMaximum(),
     173             :                 maRangeZ.getMaximum()
     174             :                 );
     175             :         }
     176             : 
     177             :         B3DVector getRange() const
     178             :         {
     179             :             return B3DVector(
     180             :                 maRangeX.getRange(),
     181             :                 maRangeY.getRange(),
     182             :                 maRangeZ.getRange()
     183             :                 );
     184             :         }
     185             : 
     186           0 :         B3DPoint getCenter() const
     187             :         {
     188             :             return B3DPoint(
     189             :                 maRangeX.getCenter(),
     190             :                 maRangeY.getCenter(),
     191             :                 maRangeZ.getCenter()
     192           0 :                 );
     193             :         }
     194             : 
     195             :         double getCenterX() const
     196             :         {
     197             :             return maRangeX.getCenter();
     198             :         }
     199             : 
     200             :         double getCenterY() const
     201             :         {
     202             :             return maRangeY.getCenter();
     203             :         }
     204             : 
     205             :         double getCenterZ() const
     206             :         {
     207             :             return maRangeZ.getCenter();
     208             :         }
     209             : 
     210             :         bool isInside(const B3DTuple& rTuple) const
     211             :         {
     212             :             return (
     213             :                 maRangeX.isInside(rTuple.getX())
     214             :                 && maRangeY.isInside(rTuple.getY())
     215             :                 && maRangeZ.isInside(rTuple.getZ())
     216             :                 );
     217             :         }
     218             : 
     219             :         bool isInside(const B3DRange& rRange) const
     220             :         {
     221             :             return (
     222             :                 maRangeX.isInside(rRange.maRangeX)
     223             :                 && maRangeY.isInside(rRange.maRangeY)
     224             :                 && maRangeZ.isInside(rRange.maRangeZ)
     225             :                 );
     226             :         }
     227             : 
     228             :         bool overlaps(const B3DRange& rRange) const
     229             :         {
     230             :             return (
     231             :                 maRangeX.overlaps(rRange.maRangeX)
     232             :                 && maRangeY.overlaps(rRange.maRangeY)
     233             :                 && maRangeZ.overlaps(rRange.maRangeZ)
     234             :                 );
     235             :         }
     236             : 
     237           0 :         void expand(const B3DTuple& rTuple)
     238             :         {
     239           0 :             maRangeX.expand(rTuple.getX());
     240           0 :             maRangeY.expand(rTuple.getY());
     241           0 :             maRangeZ.expand(rTuple.getZ());
     242           0 :         }
     243             : 
     244           0 :         void expand(const B3DRange& rRange)
     245             :         {
     246           0 :             maRangeX.expand(rRange.maRangeX);
     247           0 :             maRangeY.expand(rRange.maRangeY);
     248           0 :             maRangeZ.expand(rRange.maRangeZ);
     249           0 :         }
     250             : 
     251             :         void intersect(const B3DRange& rRange)
     252             :         {
     253             :             maRangeX.intersect(rRange.maRangeX);
     254             :             maRangeY.intersect(rRange.maRangeY);
     255             :             maRangeZ.intersect(rRange.maRangeZ);
     256             :         }
     257             : 
     258             :         void grow(double fValue)
     259             :         {
     260             :             maRangeX.grow(fValue);
     261             :             maRangeY.grow(fValue);
     262             :             maRangeZ.grow(fValue);
     263             :         }
     264             : 
     265             :          BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix& rMatrix);
     266             :     };
     267             : 
     268             : } // end of namespace basegfx
     269             : 
     270             : 
     271             : #endif /* _BGFX_RANGE_B3DRANGE_HXX */
     272             : 
     273             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10