Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
30 : : #include <basegfx/polygon/b3dpolypolygontools.hxx>
31 : : #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
32 : : #include <drawinglayer/attribute/sdrlineattribute.hxx>
33 : :
34 : : //////////////////////////////////////////////////////////////////////////////
35 : :
36 : : using namespace com::sun::star;
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : :
40 : : namespace drawinglayer
41 : : {
42 : : namespace primitive3d
43 : : {
44 : 0 : basegfx::B3DRange SdrPrimitive3D::getStandard3DRange() const
45 : : {
46 : 0 : basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
47 : 0 : aUnitRange.transform(getTransform());
48 : :
49 [ # # ]: 0 : if(!getSdrLFSAttribute().getLine().isDefault())
50 : : {
51 : 0 : const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine();
52 : :
53 [ # # ][ # # ]: 0 : if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
[ # # ][ # # ]
[ # # # # ]
[ # # ]
54 : : {
55 : : // expand by hald LineWidth as tube radius
56 : 0 : aUnitRange.grow(rLine.getWidth() / 2.0);
57 : : }
58 : : }
59 : :
60 : 0 : return aUnitRange;
61 : : }
62 : :
63 : 3281 : basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const
64 : : {
65 : 3281 : basegfx::B3DRange aRetval;
66 : :
67 [ + - ]: 3281 : if(!rSlices.empty())
68 : : {
69 [ + + ]: 16405 : for(sal_uInt32 a(0L); a < rSlices.size(); a++)
70 : : {
71 [ + - ]: 13124 : aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon()));
72 : : }
73 : :
74 : 3281 : aRetval.transform(getTransform());
75 : :
76 [ + + ]: 3281 : if(!getSdrLFSAttribute().getLine().isDefault())
77 : : {
78 : 3035 : const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine();
79 : :
80 [ + - ][ + - ]: 3035 : if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
[ - + ][ + - ]
[ - + # # ]
[ + - ]
81 : : {
82 : : // expand by half LineWidth as tube radius
83 : 0 : aRetval.grow(rLine.getWidth() / 2.0);
84 : : }
85 : : }
86 : : }
87 : :
88 : 3281 : return aRetval;
89 : : }
90 : :
91 : 13391 : 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 [ + - ][ + - ]: 13391 : maSdr3DObjectAttribute(rSdr3DObjectAttribute)
[ + - ]
101 : : {
102 : 13391 : }
103 : :
104 : 11452 : bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
105 : : {
106 [ + - ]: 11452 : if(BufferedDecompositionPrimitive3D::operator==(rPrimitive))
107 : : {
108 : 11452 : const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
109 : :
110 [ + - ]: 11452 : return (getTransform() == rCompare.getTransform()
111 : 11452 : && getTextureSize() == rCompare.getTextureSize()
112 [ + - ]: 10983 : && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
113 [ + - + + ]: 33887 : && getSdr3DObjectAttribute() == rCompare.getSdr3DObjectAttribute());
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + + ]
[ + - ][ + + ]
[ # # # # ]
114 : : }
115 : :
116 : 11452 : return false;
117 : : }
118 : :
119 : : } // end of namespace primitive3d
120 : : } // end of namespace drawinglayer
121 : :
122 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|