office-gobmx/drawinglayer/source/primitive3d/sdrprimitive3d.cxx

134 lines
4.8 KiB
C++
Raw Normal View History

2006-05-12 05:54:47 -05:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: sdrprimitive3d.cxx,v $
*
2008-06-24 09:31:09 -05:00
* $Revision: 1.10 $
2006-05-12 05:54:47 -05:00
*
2008-06-24 09:31:09 -05:00
* last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $
2006-05-12 05:54:47 -05:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_drawinglayer.hxx"
2006-05-12 05:54:47 -05:00
#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
2006-08-09 10:51:16 -05:00
#include <drawinglayer/attribute/sdrattribute.hxx>
2006-05-19 03:34:56 -05:00
#include <basegfx/polygon/b3dpolypolygontools.hxx>
2008-05-14 03:22:09 -05:00
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
2006-05-12 05:54:47 -05:00
//////////////////////////////////////////////////////////////////////////////
2006-10-19 04:40:02 -05:00
using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
2006-05-12 05:54:47 -05:00
namespace drawinglayer
{
2006-08-09 10:51:16 -05:00
namespace primitive3d
2006-05-12 05:54:47 -05:00
{
2006-10-19 04:40:02 -05:00
basegfx::B3DRange SdrPrimitive3D::getStandard3DRange() const
2006-05-12 05:54:47 -05:00
{
2006-08-09 10:51:16 -05:00
basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
2006-05-12 05:54:47 -05:00
aUnitRange.transform(getTransform());
2006-10-19 04:40:02 -05:00
if(getSdrLFSAttribute().getLine())
2006-05-12 05:54:47 -05:00
{
2006-10-19 04:40:02 -05:00
const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine();
2006-05-12 05:54:47 -05:00
2006-08-09 10:51:16 -05:00
if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth()))
2006-05-12 05:54:47 -05:00
{
// expand by hald LineWidth as tube radius
aUnitRange.grow(rLine.getWidth() / 2.0);
}
}
return aUnitRange;
}
2006-10-19 04:40:02 -05:00
basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const
2006-05-19 03:34:56 -05:00
{
2006-08-09 10:51:16 -05:00
basegfx::B3DRange aRetval;
2006-05-19 03:34:56 -05:00
if(rSlices.size())
{
for(sal_uInt32 a(0L); a < rSlices.size(); a++)
{
2006-08-09 10:51:16 -05:00
aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon()));
2006-05-19 03:34:56 -05:00
}
aRetval.transform(getTransform());
2006-10-19 04:40:02 -05:00
if(getSdrLFSAttribute().getLine())
2006-05-19 03:34:56 -05:00
{
2006-10-19 04:40:02 -05:00
const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine();
2006-05-19 03:34:56 -05:00
2006-08-09 10:51:16 -05:00
if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth()))
2006-05-19 03:34:56 -05:00
{
2008-05-14 03:22:09 -05:00
// expand by half LineWidth as tube radius
2006-05-19 03:34:56 -05:00
aRetval.grow(rLine.getWidth() / 2.0);
}
}
}
return aRetval;
}
2006-10-19 04:40:02 -05:00
SdrPrimitive3D::SdrPrimitive3D(
2006-08-09 10:51:16 -05:00
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
2006-10-19 04:40:02 -05:00
const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
: BasePrimitive3D(),
2006-08-09 10:51:16 -05:00
maTransform(rTransform),
2006-05-12 05:54:47 -05:00
maTextureSize(rTextureSize),
maSdrLFSAttribute(rSdrLFSAttribute),
maSdr3DObjectAttribute(rSdr3DObjectAttribute)
{
}
2006-10-19 04:40:02 -05:00
bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
2006-05-12 05:54:47 -05:00
{
2006-10-19 04:40:02 -05:00
if(BasePrimitive3D::operator==(rPrimitive))
2006-05-12 05:54:47 -05:00
{
2006-10-19 04:40:02 -05:00
const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
2006-05-12 05:54:47 -05:00
2006-10-19 04:40:02 -05:00
return (getTransform() == rCompare.getTransform()
&& getTextureSize() == rCompare.getTextureSize()
&& getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
&& getSdr3DObjectAttribute() == rCompare.getSdr3DObjectAttribute());
2006-05-12 05:54:47 -05:00
}
return false;
}
2008-05-14 03:22:09 -05:00
2006-08-09 10:51:16 -05:00
} // end of namespace primitive3d
2006-05-12 05:54:47 -05:00
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
// eof