1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
30 #include <basegfx/polygon/b3dpolypolygontools.hxx>
31 #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
32 #include <drawinglayer/attribute/sdrlineattribute.hxx>
34 //////////////////////////////////////////////////////////////////////////////
36 using namespace com::sun::star
;
38 //////////////////////////////////////////////////////////////////////////////
40 namespace drawinglayer
44 basegfx::B3DRange
SdrPrimitive3D::getStandard3DRange() const
46 basegfx::B3DRange
aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
47 aUnitRange
.transform(getTransform());
49 if(!getSdrLFSAttribute().getLine().isDefault())
51 const attribute::SdrLineAttribute
& rLine
= getSdrLFSAttribute().getLine();
53 if(!rLine
.isDefault() && !basegfx::fTools::equalZero(rLine
.getWidth()))
55 // expand by hald LineWidth as tube radius
56 aUnitRange
.grow(rLine
.getWidth() / 2.0);
63 basegfx::B3DRange
SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector
& rSlices
) const
65 basegfx::B3DRange aRetval
;
69 for(sal_uInt32
a(0L); a
< rSlices
.size(); a
++)
71 aRetval
.expand(basegfx::tools::getRange(rSlices
[a
].getB3DPolyPolygon()));
74 aRetval
.transform(getTransform());
76 if(!getSdrLFSAttribute().getLine().isDefault())
78 const attribute::SdrLineAttribute
& rLine
= getSdrLFSAttribute().getLine();
80 if(!rLine
.isDefault() && !basegfx::fTools::equalZero(rLine
.getWidth()))
82 // expand by half LineWidth as tube radius
83 aRetval
.grow(rLine
.getWidth() / 2.0);
91 SdrPrimitive3D::SdrPrimitive3D(
92 const basegfx::B3DHomMatrix
& rTransform
,
93 const basegfx::B2DVector
& rTextureSize
,
94 const attribute::SdrLineFillShadowAttribute3D
& rSdrLFSAttribute
,
95 const attribute::Sdr3DObjectAttribute
& rSdr3DObjectAttribute
)
96 : BufferedDecompositionPrimitive3D(),
97 maTransform(rTransform
),
98 maTextureSize(rTextureSize
),
99 maSdrLFSAttribute(rSdrLFSAttribute
),
100 maSdr3DObjectAttribute(rSdr3DObjectAttribute
)
104 bool SdrPrimitive3D::operator==(const BasePrimitive3D
& rPrimitive
) const
106 if(BufferedDecompositionPrimitive3D::operator==(rPrimitive
))
108 const SdrPrimitive3D
& rCompare
= static_cast< const SdrPrimitive3D
& >(rPrimitive
);
110 return (getTransform() == rCompare
.getTransform()
111 && getTextureSize() == rCompare
.getTextureSize()
112 && getSdrLFSAttribute() == rCompare
.getSdrLFSAttribute()
113 && getSdr3DObjectAttribute() == rCompare
.getSdr3DObjectAttribute());
119 } // end of namespace primitive3d
120 } // end of namespace drawinglayer
122 //////////////////////////////////////////////////////////////////////////////
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */