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 #pragma once 21 22 #include <drawinglayer/primitive3d/polygonprimitive3d.hxx> 23 24 25 namespace drawinglayer::primitive3d 26 { 27 /** PolygonStrokePrimitive3D class 28 29 This 3D primitive extends a 3D hairline to a 3D tube which is 30 e.g. used for fat lines in 3D. It's decomposition will create all 31 3D objects needed for the line tubes and the edge roundings 32 in full 3D. 33 */ 34 class PolygonTubePrimitive3D final : public PolygonHairlinePrimitive3D 35 { 36 /// hold the last decomposition since it's expensive 37 Primitive3DContainer maLast3DDecomposition; 38 39 /// visualisation parameters 40 double mfRadius; 41 double mfDegreeStepWidth; 42 double mfMiterMinimumAngle; 43 basegfx::B2DLineJoin maLineJoin; 44 css::drawing::LineCap maLineCap; 45 46 /** access methods to maLast3DDecomposition. The usage of this methods may allow 47 later thread-safe stuff to be added if needed. Only to be used by getDecomposition() 48 implementations for buffering the last decomposition. 49 */ getLast3DDecomposition() const50 const Primitive3DContainer& getLast3DDecomposition() const { return maLast3DDecomposition; } 51 52 /// local decomposition. 53 Primitive3DContainer impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; 54 55 public: 56 /// constructor 57 PolygonTubePrimitive3D( 58 const basegfx::B3DPolygon& rPolygon, 59 const basegfx::BColor& rBColor, 60 double fRadius, 61 basegfx::B2DLineJoin aLineJoin, 62 css::drawing::LineCap aLineCap, 63 double fDegreeStepWidth = basegfx::deg2rad(10.0), 64 double fMiterMinimumAngle = basegfx::deg2rad(15.0)); 65 66 /// data read access getRadius() const67 double getRadius() const { return mfRadius; } getDegreeStepWidth() const68 double getDegreeStepWidth() const { return mfDegreeStepWidth; } getMiterMinimumAngle() const69 double getMiterMinimumAngle() const { return mfMiterMinimumAngle; } getLineJoin() const70 basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; } getLineCap() const71 css::drawing::LineCap getLineCap() const { return maLineCap; } 72 73 /// compare operator 74 virtual bool operator==(const BasePrimitive3D& rPrimitive) const override; 75 76 /** local decomposition. Use own buffering since we are not derived from 77 BufferedDecompositionPrimitive3D 78 */ 79 virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override; 80 81 /// provide unique ID 82 DeclPrimitive3DIDBlock() 83 }; 84 85 } // end of namespace drawinglayer::primitive3d 86 87 88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 89