LibreOffice Module drawinglayer (master) 1
sdrprimitive3d.cxx
Go to the documentation of this file.
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
23#include <utility>
24
25
26using namespace com::sun::star;
27
28
30{
32 {
33 basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
34 aUnitRange.transform(getTransform());
35
36 if(!getSdrLFSAttribute().getLine().isDefault())
37 {
39
40 if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
41 {
42 // expand by held LineWidth as tube radius
43 aUnitRange.grow(rLine.getWidth() / 2.0);
44 }
45 }
46
47 return aUnitRange;
48 }
49
51 {
52 basegfx::B3DRange aRetval;
53
54 if(!rSlices.empty())
55 {
56 for(const auto & rSlice : rSlices)
57 {
58 aRetval.expand(basegfx::utils::getRange(rSlice.getB3DPolyPolygon()));
59 }
60
61 aRetval.transform(getTransform());
62
63 if(!getSdrLFSAttribute().getLine().isDefault())
64 {
66
67 if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
68 {
69 // expand by half LineWidth as tube radius
70 aRetval.grow(rLine.getWidth() / 2.0);
71 }
72 }
73 }
74
75 return aRetval;
76 }
77
79 basegfx::B3DHomMatrix aTransform,
80 const basegfx::B2DVector& rTextureSize,
82 const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
83 : maTransform(std::move(aTransform)),
84 maTextureSize(rTextureSize),
85 maSdrLFSAttribute(std::move(aSdrLFSAttribute)),
86 maSdr3DObjectAttribute(rSdr3DObjectAttribute)
87 {
88 }
89
90 bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
91 {
92 if(BufferedDecompositionPrimitive3D::operator==(rPrimitive))
93 {
94 const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
95
96 return (getTransform() == rCompare.getTransform()
97 && getTextureSize() == rCompare.getTextureSize()
98 && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
100 }
101
102 return false;
103 }
104
105} // end of namespace
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix &rMatrix)
void grow(double fValue)
void expand(const B3DTuple &rTuple)
const basegfx::B3DHomMatrix & getTransform() const
data read access
basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector &rSlices) const
implementation for primitive3D which will use given Slice3Ds and expand by evtl.
virtual bool operator==(const BasePrimitive3D &rPrimitive) const override
compare operator
const basegfx::B2DVector & getTextureSize() const
const attribute::Sdr3DObjectAttribute & getSdr3DObjectAttribute() const
SdrPrimitive3D(basegfx::B3DHomMatrix aTransform, const basegfx::B2DVector &rTextureSize, attribute::SdrLineFillShadowAttribute3D aSdrLFSAttribute, const attribute::Sdr3DObjectAttribute &rSdr3DObjectAttribute)
constructor
basegfx::B3DRange getStandard3DRange() const
Standard implementation for primitive3D which will use maTransform as range and expand by evtl.
const attribute::SdrLineFillShadowAttribute3D & getSdrLFSAttribute() const
basegfx::B2DHomMatrix maTransform
the geometric definition
bool equalZero(const T &rfVal)
B2DRange getRange(const B2DPolygon &rCandidate)
SdrPrimitive3D class.
::std::vector< Slice3D > Slice3DVector
typedef for a group of Slice3Ds