LibreOffice Module svx (master) 1
viewcontactofe3dextrude.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
20
22#include <extrud3d.hxx>
27
28
29namespace sdr::contact
30{
32 : ViewContactOfE3d(rExtrude)
33 {
34 }
35
37 {
38 }
39
41 {
43 const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet();
46
47 // get extrude geometry
48 basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
49
50 // get 3D Object Attributes
52
53 // calculate texture size; use size of top/bottom cap to get a perfect mapping
54 // for the caps. The in-between geometry will get a stretched size with a
55 // relative factor size of caps to extrude depth
56 const basegfx::B2DRange aRange(basegfx::utils::getRange(aPolyPolygon));
57 const basegfx::B2DVector aTextureSize(aRange.getWidth(), aRange.getHeight());
58
59 // get more data
60 const double fDepth(static_cast<double>(GetE3dExtrudeObj().GetExtrudeDepth()));
61 const double fDiagonal(static_cast<double>(GetE3dExtrudeObj().GetPercentDiagonal()) / 100.0);
62 const double fBackScale(static_cast<double>(GetE3dExtrudeObj().GetPercentBackScale()) / 100.0);
63 const bool bSmoothNormals(GetE3dExtrudeObj().GetSmoothNormals()); // Plane itself
64 const bool bSmoothLids(GetE3dExtrudeObj().GetSmoothLids()); // Front/back
65 const bool bCharacterMode(GetE3dExtrudeObj().GetCharacterMode());
66 const bool bCloseFront(GetE3dExtrudeObj().GetCloseFront());
67 const bool bCloseBack(GetE3dExtrudeObj().GetCloseBack());
68
69 // create primitive and add
70 const basegfx::B3DHomMatrix aWorldTransform;
73 aWorldTransform, aTextureSize, aAttribute, aSdr3DObjectAttribute,
74 std::move(aPolyPolygon), fDepth, fDiagonal, fBackScale, bSmoothNormals, bSmoothLids,
75 bCharacterMode, bCloseFront, bCloseBack));
76 xRetval = { xReference };
77
78 return xRetval;
79 }
80
81} // end of namespace
82
83/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TYPE getWidth() const
TYPE getHeight() const
const E3dExtrudeObj & GetE3dExtrudeObj() const
virtual drawinglayer::primitive3d::Primitive3DContainer createViewIndependentPrimitive3DContainer() const override
B2DRange getRange(const B2DPolygon &rCandidate)
attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet &rSet, bool bSuppressFill)
attribute::Sdr3DObjectAttribute createNewSdr3DObjectAttribute(const SfxItemSet &rSet)
css::uno::Reference< css::graphic::XPrimitive3D > Primitive3DReference