1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
28 //////////////////////////////////////////////////////////////////////////////
30 namespace drawinglayer
34 /** SdrLathePrimitive3D class
36 This 3D primitive expands the SdrPrimitive3D to a 3D rotation definition.
37 The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
38 and gets rotated around the Y-Axis.
40 Various possibilities e.g. for creating diagonals (edge roudings in 3D)
41 and similar are given.
43 The decomposition will create all necessary 3D planes for visualisation.
45 class DRAWINGLAYER_DLLPUBLIC SdrLathePrimitive3D
: public SdrPrimitive3D
48 /// geometry helper for slices
49 basegfx::B2DPolyPolygon maCorrectedPolyPolygon
;
50 Slice3DVector maSlices
;
52 /// primitive geometry data
53 basegfx::B2DPolyPolygon maPolyPolygon
;
54 sal_uInt32 mnHorizontalSegments
;
55 sal_uInt32 mnVerticalSegments
;
60 /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
61 geometry::ViewInformation3D
* mpLastRLGViewInformation
;
64 unsigned mbSmoothNormals
: 1; // Plane self
65 unsigned mbSmoothHorizontalNormals
: 1; // always
66 unsigned mbSmoothLids
: 1; // Front/back
67 unsigned mbCharacterMode
: 1;
68 unsigned mbCloseFront
: 1;
69 unsigned mbCloseBack
: 1;
72 void impCreateSlices();
74 /// get (evtl. create) slices
75 const Slice3DVector
& getSlices() const;
79 void impCreateOutlines(
80 const geometry::ViewInformation3D
& rViewInformation
,
81 const basegfx::B3DPolygon
& rLoopA
,
82 const basegfx::B3DPolygon
& rLoopB
,
83 basegfx::B3DPolyPolygon
& rTarget
) const;
86 const basegfx::B2DPolygon
& rPoly
,
87 const basegfx::B2DPoint
& rStart
,
88 const basegfx::B2DPoint
& rEnd
) const;
90 /// local decomposition.
91 virtual Primitive3DSequence
create3DDecomposition(const geometry::ViewInformation3D
& rViewInformation
) const;
96 const basegfx::B3DHomMatrix
& rTransform
,
97 const basegfx::B2DVector
& rTextureSize
,
98 const attribute::SdrLineFillShadowAttribute3D
& rSdrLFSAttribute
,
99 const attribute::Sdr3DObjectAttribute
& rSdr3DObjectAttribute
,
100 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
101 sal_uInt32 nHorizontalSegments
,
102 sal_uInt32 nVerticalSegments
,
107 bool bSmoothHorizontalNormals
,
112 virtual ~SdrLathePrimitive3D();
115 const basegfx::B2DPolyPolygon
& getPolyPolygon() const { return maPolyPolygon
; }
116 sal_uInt32
getHorizontalSegments() const { return mnHorizontalSegments
; }
117 sal_uInt32
getVerticalSegments() const { return mnVerticalSegments
; }
118 double getDiagonal() const { return mfDiagonal
; }
119 double getBackScale() const { return mfBackScale
; }
120 double getRotation() const { return mfRotation
; }
121 bool getSmoothNormals() const { return mbSmoothNormals
; }
122 bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals
; }
123 bool getSmoothLids() const { return mbSmoothLids
; }
124 bool getCharacterMode() const { return mbCharacterMode
; }
125 bool getCloseFront() const { return mbCloseFront
; }
126 bool getCloseBack() const { return mbCloseBack
; }
129 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const;
132 virtual basegfx::B3DRange
getB3DRange(const geometry::ViewInformation3D
& rViewInformation
) const;
134 /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
135 virtual Primitive3DSequence
get3DDecomposition(const geometry::ViewInformation3D
& rViewInformation
) const;
137 /// provide unique ID
138 DeclPrimitive3DIDBlock()
140 } // end of namespace primitive3d
141 } // end of namespace drawinglayer
143 //////////////////////////////////////////////////////////////////////////////
145 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */