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 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <basegfx/polygon/b3dpolypolygon.hxx>
35 : : #include <basegfx/polygon/b2dpolypolygontools.hxx>
36 : : #include <vector>
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : : // predefines
40 : :
41 : : namespace drawinglayer { namespace geometry {
42 : : class ViewInformation3D;
43 : : }}
44 : :
45 : : //////////////////////////////////////////////////////////////////////////////
46 : :
47 : : namespace drawinglayer
48 : : {
49 : : namespace primitive3d
50 : : {
51 : : /** SliceType3D definition */
52 : : enum SliceType3D
53 : : {
54 : : SLICETYPE3D_REGULAR, // normal geoemtry Slice3D
55 : : SLICETYPE3D_FRONTCAP, // front cap
56 : : SLICETYPE3D_BACKCAP // back cap
57 : : };
58 : :
59 : : /// class to hold one Slice3D
60 : 54018 : class DRAWINGLAYER_DLLPUBLIC Slice3D
61 : : {
62 : : protected:
63 : : basegfx::B3DPolyPolygon maPolyPolygon;
64 : : SliceType3D maSliceType;
65 : :
66 : : public:
67 : 12004 : Slice3D(
68 : : const basegfx::B2DPolyPolygon& rPolyPolygon,
69 : : const basegfx::B3DHomMatrix& aTransform,
70 : : SliceType3D aSliceType = SLICETYPE3D_REGULAR)
71 : : : maPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)),
72 : 12004 : maSliceType(aSliceType)
73 : : {
74 [ + - ]: 12004 : maPolyPolygon.transform(aTransform);
75 : 12004 : }
76 : :
77 : : explicit Slice3D(
78 : : const basegfx::B3DPolyPolygon& rPolyPolygon,
79 : : SliceType3D aSliceType = SLICETYPE3D_REGULAR)
80 : : : maPolyPolygon(rPolyPolygon),
81 : : maSliceType(aSliceType)
82 : : {
83 : : }
84 : :
85 : : // data access
86 : 13412 : const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
87 : 168 : SliceType3D getSliceType() const { return maSliceType; }
88 : : };
89 : :
90 : : /// typedef for a group of Slice3Ds
91 : : typedef ::std::vector< Slice3D > Slice3DVector;
92 : :
93 : : /// helpers for creation
94 : : void DRAWINGLAYER_DLLPUBLIC createLatheSlices(
95 : : Slice3DVector& rSliceVector,
96 : : const basegfx::B2DPolyPolygon& rSource,
97 : : double fBackScale,
98 : : double fDiagonal,
99 : : double fRotation,
100 : : sal_uInt32 nSteps,
101 : : bool bCharacterMode,
102 : : bool bCloseFront,
103 : : bool bCloseBack);
104 : :
105 : : void DRAWINGLAYER_DLLPUBLIC createExtrudeSlices(
106 : : Slice3DVector& rSliceVector,
107 : : const basegfx::B2DPolyPolygon& rSource,
108 : : double fBackScale,
109 : : double fDiagonal,
110 : : double fDepth,
111 : : bool bCharacterMode,
112 : : bool bCloseFront,
113 : : bool bCloseBack);
114 : :
115 : : /// helpers for geometry extraction
116 : : basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines);
117 : : basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector);
118 : :
119 : : void DRAWINGLAYER_DLLPUBLIC extractPlanesFromSlice(
120 : : ::std::vector< basegfx::B3DPolyPolygon >& rFill,
121 : : const Slice3DVector& rSliceVector,
122 : : bool bCreateNormals,
123 : : bool bSmoothHorizontalNormals,
124 : : bool bSmoothNormals,
125 : : bool bSmoothLids,
126 : : bool bClosed,
127 : : double fSmoothNormalsMix,
128 : : double fSmoothLidsMix,
129 : : bool bCreateTextureCoordinates,
130 : : const basegfx::B2DHomMatrix& rTexTransform);
131 : :
132 : : void DRAWINGLAYER_DLLPUBLIC createReducedOutlines(
133 : : const geometry::ViewInformation3D& rViewInformation,
134 : : const basegfx::B3DHomMatrix& rObjectTransform,
135 : : const basegfx::B3DPolygon& rLoopA,
136 : : const basegfx::B3DPolygon& rLoopB,
137 : : basegfx::B3DPolyPolygon& rTarget);
138 : :
139 : : } // end of namespace overlay
140 : : } // end of namespace drawinglayer
141 : :
142 : : //////////////////////////////////////////////////////////////////////////////
143 : :
144 : : #endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
145 : :
146 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|