xref: /AOO41X/main/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <drawinglayer/primitive3d/sdrlatheprimitive3d.hxx>
32*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
33*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
34*cdf0e10cSrcweir #include <basegfx/polygon/b3dpolypolygontools.hxx>
35*cdf0e10cSrcweir #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
36*cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
37*cdf0e10cSrcweir #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
38*cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation3d.hxx>
39*cdf0e10cSrcweir #include <drawinglayer/attribute/sdrfillattribute.hxx>
40*cdf0e10cSrcweir #include <drawinglayer/attribute/sdrlineattribute.hxx>
41*cdf0e10cSrcweir #include <drawinglayer/attribute/sdrshadowattribute.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir using namespace com::sun::star;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace drawinglayer
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir 	namespace primitive3d
52*cdf0e10cSrcweir 	{
53*cdf0e10cSrcweir 		Primitive3DSequence SdrLathePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
54*cdf0e10cSrcweir 		{
55*cdf0e10cSrcweir 			Primitive3DSequence aRetval;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 			// get slices
58*cdf0e10cSrcweir 			const Slice3DVector& rSliceVector = getSlices();
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 			if(rSliceVector.size())
61*cdf0e10cSrcweir 			{
62*cdf0e10cSrcweir 				const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0));
63*cdf0e10cSrcweir 				const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI));
64*cdf0e10cSrcweir 				sal_uInt32 a;
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 				// decide what to create
67*cdf0e10cSrcweir 				const ::com::sun::star::drawing::NormalsKind eNormalsKind(getSdr3DObjectAttribute().getNormalsKind());
68*cdf0e10cSrcweir 				const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == eNormalsKind);
69*cdf0e10cSrcweir 				const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
70*cdf0e10cSrcweir 				const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
71*cdf0e10cSrcweir 				basegfx::B2DHomMatrix aTexTransform;
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 				if(!getSdrLFSAttribute().getFill().isDefault()
74*cdf0e10cSrcweir                     && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY))
75*cdf0e10cSrcweir 				{
76*cdf0e10cSrcweir 					aTexTransform.set(0, 0, 0.0);
77*cdf0e10cSrcweir 					aTexTransform.set(0, 1, 1.0);
78*cdf0e10cSrcweir 					aTexTransform.set(1, 0, 1.0);
79*cdf0e10cSrcweir 					aTexTransform.set(1, 1, 0.0);
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 					aTexTransform.translate(0.0, -0.5);
82*cdf0e10cSrcweir 					aTexTransform.scale(1.0, -1.0);
83*cdf0e10cSrcweir 					aTexTransform.translate(0.0, 0.5);
84*cdf0e10cSrcweir 				}
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 				// create geometry
87*cdf0e10cSrcweir 				::std::vector< basegfx::B3DPolyPolygon > aFill;
88*cdf0e10cSrcweir 				extractPlanesFromSlice(aFill, rSliceVector,
89*cdf0e10cSrcweir 					bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), bClosedRotation,
90*cdf0e10cSrcweir 					0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 				// get full range
93*cdf0e10cSrcweir 				const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill));
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 				// normal creation
96*cdf0e10cSrcweir 				if(!getSdrLFSAttribute().getFill().isDefault())
97*cdf0e10cSrcweir 				{
98*cdf0e10cSrcweir 					if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind)
99*cdf0e10cSrcweir 					{
100*cdf0e10cSrcweir 						applyNormalsKindSphereTo3DGeometry(aFill, aRange);
101*cdf0e10cSrcweir 					}
102*cdf0e10cSrcweir 					else if(::com::sun::star::drawing::NormalsKind_FLAT == eNormalsKind)
103*cdf0e10cSrcweir 					{
104*cdf0e10cSrcweir 						applyNormalsKindFlatTo3DGeometry(aFill);
105*cdf0e10cSrcweir 					}
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 					if(getSdr3DObjectAttribute().getNormalsInvert())
108*cdf0e10cSrcweir 					{
109*cdf0e10cSrcweir 						applyNormalsInvertTo3DGeometry(aFill);
110*cdf0e10cSrcweir 					}
111*cdf0e10cSrcweir 				}
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 				// texture coordinates
114*cdf0e10cSrcweir 				if(!getSdrLFSAttribute().getFill().isDefault())
115*cdf0e10cSrcweir 				{
116*cdf0e10cSrcweir 					applyTextureTo3DGeometry(
117*cdf0e10cSrcweir 						getSdr3DObjectAttribute().getTextureProjectionX(),
118*cdf0e10cSrcweir 						getSdr3DObjectAttribute().getTextureProjectionY(),
119*cdf0e10cSrcweir 						aFill,
120*cdf0e10cSrcweir 						aRange,
121*cdf0e10cSrcweir 						getTextureSize());
122*cdf0e10cSrcweir 				}
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 				if(!getSdrLFSAttribute().getFill().isDefault())
125*cdf0e10cSrcweir 				{
126*cdf0e10cSrcweir 					// add fill
127*cdf0e10cSrcweir 					aRetval = create3DPolyPolygonFillPrimitives(
128*cdf0e10cSrcweir 						aFill,
129*cdf0e10cSrcweir 						getTransform(),
130*cdf0e10cSrcweir 						getTextureSize(),
131*cdf0e10cSrcweir 						getSdr3DObjectAttribute(),
132*cdf0e10cSrcweir 						getSdrLFSAttribute().getFill(),
133*cdf0e10cSrcweir 						getSdrLFSAttribute().getFillFloatTransGradient());
134*cdf0e10cSrcweir 				}
135*cdf0e10cSrcweir 				else
136*cdf0e10cSrcweir 				{
137*cdf0e10cSrcweir 					// create simplified 3d hit test geometry
138*cdf0e10cSrcweir                     aRetval = createHiddenGeometryPrimitives3D(
139*cdf0e10cSrcweir 				        aFill,
140*cdf0e10cSrcweir 				        getTransform(),
141*cdf0e10cSrcweir 				        getTextureSize(),
142*cdf0e10cSrcweir 				        getSdr3DObjectAttribute());
143*cdf0e10cSrcweir 				}
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 				// add line
146*cdf0e10cSrcweir 				if(!getSdrLFSAttribute().getLine().isDefault())
147*cdf0e10cSrcweir 				{
148*cdf0e10cSrcweir                     if(getSdr3DObjectAttribute().getReducedLineGeometry())
149*cdf0e10cSrcweir                     {
150*cdf0e10cSrcweir 						// create geometric outlines with reduced line geometry for chart
151*cdf0e10cSrcweir 						const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, bClosedRotation));
152*cdf0e10cSrcweir 						const sal_uInt32 nCount(aHorLine.count());
153*cdf0e10cSrcweir 						basegfx::B3DPolyPolygon aNewLineGeometry;
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 						for(a = 1; a < nCount; a++)
156*cdf0e10cSrcweir 						{
157*cdf0e10cSrcweir 							// for each loop pair create the connection edges
158*cdf0e10cSrcweir 							createReducedOutlines(
159*cdf0e10cSrcweir 								rViewInformation,
160*cdf0e10cSrcweir 								getTransform(),
161*cdf0e10cSrcweir 								aHorLine.getB3DPolygon(a - 1),
162*cdf0e10cSrcweir 								aHorLine.getB3DPolygon(a),
163*cdf0e10cSrcweir 								aNewLineGeometry);
164*cdf0e10cSrcweir 						}
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 						for(a = 0; a < nCount; a++)
167*cdf0e10cSrcweir 						{
168*cdf0e10cSrcweir 							// filter hor lines for empty loops (those who have their defining point on the Y-Axis)
169*cdf0e10cSrcweir 							basegfx::B3DPolygon aCandidate(aHorLine.getB3DPolygon(a));
170*cdf0e10cSrcweir 							aCandidate.removeDoublePoints();
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 							if(aCandidate.count())
173*cdf0e10cSrcweir 							{
174*cdf0e10cSrcweir 								aNewLineGeometry.append(aCandidate);
175*cdf0e10cSrcweir 							}
176*cdf0e10cSrcweir 						}
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 						if(aNewLineGeometry.count())
179*cdf0e10cSrcweir 						{
180*cdf0e10cSrcweir 							const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(
181*cdf0e10cSrcweir                                 aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine()));
182*cdf0e10cSrcweir 							appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
183*cdf0e10cSrcweir 						}
184*cdf0e10cSrcweir 					}
185*cdf0e10cSrcweir 					else
186*cdf0e10cSrcweir 					{
187*cdf0e10cSrcweir 						// extract line geometry from slices
188*cdf0e10cSrcweir 						const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, bClosedRotation));
189*cdf0e10cSrcweir 						const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector));
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir 						// add horizontal lines
192*cdf0e10cSrcweir 						const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(
193*cdf0e10cSrcweir                             aHorLine, getTransform(), getSdrLFSAttribute().getLine()));
194*cdf0e10cSrcweir 						appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines);
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 						// add vertical lines
197*cdf0e10cSrcweir 						const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(
198*cdf0e10cSrcweir                             aVerLine, getTransform(), getSdrLFSAttribute().getLine()));
199*cdf0e10cSrcweir 						appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines);
200*cdf0e10cSrcweir 					}
201*cdf0e10cSrcweir 				}
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 				// add shadow
204*cdf0e10cSrcweir 				if(!getSdrLFSAttribute().getShadow().isDefault()
205*cdf0e10cSrcweir                     && aRetval.hasElements())
206*cdf0e10cSrcweir 				{
207*cdf0e10cSrcweir 					const Primitive3DSequence aShadow(createShadowPrimitive3D(
208*cdf0e10cSrcweir                         aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
209*cdf0e10cSrcweir 					appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
210*cdf0e10cSrcweir 				}
211*cdf0e10cSrcweir 			}
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 			return aRetval;
214*cdf0e10cSrcweir 		}
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 		void SdrLathePrimitive3D::impCreateSlices()
217*cdf0e10cSrcweir 		{
218*cdf0e10cSrcweir 			// prepare the polygon. No double points, correct orientations and a correct
219*cdf0e10cSrcweir 			// outmost polygon are needed
220*cdf0e10cSrcweir 			maCorrectedPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon());
221*cdf0e10cSrcweir 			maCorrectedPolyPolygon.removeDoublePoints();
222*cdf0e10cSrcweir 			maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);
223*cdf0e10cSrcweir 			maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon);
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 			// check edge count of first sub-polygon. If different, reSegment polyPolygon. This ensures
226*cdf0e10cSrcweir 			// that for polyPolygons, the subPolys 1..n only get reSegmented when polygon 0L is different
227*cdf0e10cSrcweir 			// at all (and not always)
228*cdf0e10cSrcweir 			const basegfx::B2DPolygon aSubCandidate(maCorrectedPolyPolygon.getB2DPolygon(0));
229*cdf0e10cSrcweir 			const sal_uInt32 nSubEdgeCount(aSubCandidate.isClosed() ? aSubCandidate.count() : (aSubCandidate.count() ? aSubCandidate.count() - 1L : 0L));
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 			if(nSubEdgeCount != getVerticalSegments())
232*cdf0e10cSrcweir 			{
233*cdf0e10cSrcweir 				maCorrectedPolyPolygon = basegfx::tools::reSegmentPolyPolygon(maCorrectedPolyPolygon, getVerticalSegments());
234*cdf0e10cSrcweir 			}
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 			// prepare slices as geometry
237*cdf0e10cSrcweir 			createLatheSlices(maSlices, maCorrectedPolyPolygon, getBackScale(), getDiagonal(), getRotation(), getHorizontalSegments(), getCharacterMode(), getCloseFront(), getCloseBack());
238*cdf0e10cSrcweir 		}
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 		const Slice3DVector& SdrLathePrimitive3D::getSlices() const
241*cdf0e10cSrcweir 		{
242*cdf0e10cSrcweir 			// This can be made dependent of  getSdrLFSAttribute().getFill() and getSdrLFSAttribute().getLine()
243*cdf0e10cSrcweir 			// again when no longer geometry is needed for non-visible 3D objects as it is now for chart
244*cdf0e10cSrcweir 			if(getPolyPolygon().count() && !maSlices.size())
245*cdf0e10cSrcweir 			{
246*cdf0e10cSrcweir 			    ::osl::Mutex m_mutex;
247*cdf0e10cSrcweir 				const_cast< SdrLathePrimitive3D& >(*this).impCreateSlices();
248*cdf0e10cSrcweir 			}
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 			return maSlices;
251*cdf0e10cSrcweir 		}
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 		SdrLathePrimitive3D::SdrLathePrimitive3D(
254*cdf0e10cSrcweir 			const basegfx::B3DHomMatrix& rTransform,
255*cdf0e10cSrcweir 			const basegfx::B2DVector& rTextureSize,
256*cdf0e10cSrcweir 			const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
257*cdf0e10cSrcweir 			const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
258*cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
259*cdf0e10cSrcweir 			sal_uInt32 nHorizontalSegments,
260*cdf0e10cSrcweir 			sal_uInt32 nVerticalSegments,
261*cdf0e10cSrcweir 			double fDiagonal,
262*cdf0e10cSrcweir 			double fBackScale,
263*cdf0e10cSrcweir 			double fRotation,
264*cdf0e10cSrcweir 			bool bSmoothNormals,
265*cdf0e10cSrcweir 			bool bSmoothHorizontalNormals,
266*cdf0e10cSrcweir 			bool bSmoothLids,
267*cdf0e10cSrcweir 			bool bCharacterMode,
268*cdf0e10cSrcweir 			bool bCloseFront,
269*cdf0e10cSrcweir 			bool bCloseBack)
270*cdf0e10cSrcweir 		:	SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
271*cdf0e10cSrcweir             maCorrectedPolyPolygon(),
272*cdf0e10cSrcweir             maSlices(),
273*cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
274*cdf0e10cSrcweir 			mnHorizontalSegments(nHorizontalSegments),
275*cdf0e10cSrcweir 			mnVerticalSegments(nVerticalSegments),
276*cdf0e10cSrcweir 			mfDiagonal(fDiagonal),
277*cdf0e10cSrcweir 			mfBackScale(fBackScale),
278*cdf0e10cSrcweir 			mfRotation(fRotation),
279*cdf0e10cSrcweir             mpLastRLGViewInformation(0),
280*cdf0e10cSrcweir 			mbSmoothNormals(bSmoothNormals),
281*cdf0e10cSrcweir 			mbSmoothHorizontalNormals(bSmoothHorizontalNormals),
282*cdf0e10cSrcweir 			mbSmoothLids(bSmoothLids),
283*cdf0e10cSrcweir 			mbCharacterMode(bCharacterMode),
284*cdf0e10cSrcweir 			mbCloseFront(bCloseFront),
285*cdf0e10cSrcweir 			mbCloseBack(bCloseBack)
286*cdf0e10cSrcweir 		{
287*cdf0e10cSrcweir 			// make sure Rotation is positive
288*cdf0e10cSrcweir 			if(basegfx::fTools::lessOrEqual(getRotation(), 0.0))
289*cdf0e10cSrcweir 			{
290*cdf0e10cSrcweir 				mfRotation = 0.0;
291*cdf0e10cSrcweir 			}
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 			// make sure the percentage value getDiagonal() is between 0.0 and 1.0
294*cdf0e10cSrcweir 			if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
295*cdf0e10cSrcweir 			{
296*cdf0e10cSrcweir 				mfDiagonal = 0.0;
297*cdf0e10cSrcweir 			}
298*cdf0e10cSrcweir 			else if(basegfx::fTools::moreOrEqual(getDiagonal(), 1.0))
299*cdf0e10cSrcweir 			{
300*cdf0e10cSrcweir 				mfDiagonal = 1.0;
301*cdf0e10cSrcweir 			}
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 			// no close front/back when polygon is not closed
304*cdf0e10cSrcweir 			if(getPolyPolygon().count() && !getPolyPolygon().getB2DPolygon(0L).isClosed())
305*cdf0e10cSrcweir 			{
306*cdf0e10cSrcweir 				mbCloseFront = mbCloseBack = false;
307*cdf0e10cSrcweir 			}
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 			// no edge rounding when not closing
310*cdf0e10cSrcweir 			if(!getCloseFront() && !getCloseBack())
311*cdf0e10cSrcweir 			{
312*cdf0e10cSrcweir 				mfDiagonal = 0.0;
313*cdf0e10cSrcweir 			}
314*cdf0e10cSrcweir 		}
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir         SdrLathePrimitive3D::~SdrLathePrimitive3D()
317*cdf0e10cSrcweir         {
318*cdf0e10cSrcweir             if(mpLastRLGViewInformation)
319*cdf0e10cSrcweir             {
320*cdf0e10cSrcweir                 delete mpLastRLGViewInformation;
321*cdf0e10cSrcweir             }
322*cdf0e10cSrcweir         }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 		bool SdrLathePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
325*cdf0e10cSrcweir 		{
326*cdf0e10cSrcweir 			if(SdrPrimitive3D::operator==(rPrimitive))
327*cdf0e10cSrcweir 			{
328*cdf0e10cSrcweir 				const SdrLathePrimitive3D& rCompare = static_cast< const SdrLathePrimitive3D& >(rPrimitive);
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 				return (getPolyPolygon() == rCompare.getPolyPolygon()
331*cdf0e10cSrcweir 					&& getHorizontalSegments() == rCompare.getHorizontalSegments()
332*cdf0e10cSrcweir 					&& getVerticalSegments() == rCompare.getVerticalSegments()
333*cdf0e10cSrcweir 					&& getDiagonal() == rCompare.getDiagonal()
334*cdf0e10cSrcweir 					&& getBackScale() == rCompare.getBackScale()
335*cdf0e10cSrcweir 					&& getRotation() == rCompare.getRotation()
336*cdf0e10cSrcweir 					&& getSmoothNormals() == rCompare.getSmoothNormals()
337*cdf0e10cSrcweir 					&& getSmoothHorizontalNormals() == rCompare.getSmoothHorizontalNormals()
338*cdf0e10cSrcweir 					&& getSmoothLids() == rCompare.getSmoothLids()
339*cdf0e10cSrcweir 					&& getCharacterMode() == rCompare.getCharacterMode()
340*cdf0e10cSrcweir 					&& getCloseFront() == rCompare.getCloseFront()
341*cdf0e10cSrcweir 					&& getCloseBack() == rCompare.getCloseBack());
342*cdf0e10cSrcweir 			}
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 			return false;
345*cdf0e10cSrcweir 		}
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 		basegfx::B3DRange SdrLathePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const
348*cdf0e10cSrcweir 		{
349*cdf0e10cSrcweir 			// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2
350*cdf0e10cSrcweir 			// The parent implementation which uses the ranges of the decomposition would be more
351*cdf0e10cSrcweir 			// corrcet, but for historical reasons it is necessary to do the old method: To get
352*cdf0e10cSrcweir 			// the range of the non-transformed geometry and transform it then. This leads to different
353*cdf0e10cSrcweir 			// ranges where the new method is more correct, but the need to keep the old behaviour
354*cdf0e10cSrcweir 			// has priority here.
355*cdf0e10cSrcweir 			return get3DRangeFromSlices(getSlices());
356*cdf0e10cSrcweir 		}
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir         Primitive3DSequence SdrLathePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
359*cdf0e10cSrcweir         {
360*cdf0e10cSrcweir             if(getSdr3DObjectAttribute().getReducedLineGeometry())
361*cdf0e10cSrcweir             {
362*cdf0e10cSrcweir                 if(!mpLastRLGViewInformation ||
363*cdf0e10cSrcweir                     (getBuffered3DDecomposition().hasElements()
364*cdf0e10cSrcweir                         && *mpLastRLGViewInformation != rViewInformation))
365*cdf0e10cSrcweir                 {
366*cdf0e10cSrcweir 					// conditions of last local decomposition with reduced lines have changed. Remember
367*cdf0e10cSrcweir                     // new one and clear current decompositiopn
368*cdf0e10cSrcweir     			    ::osl::Mutex m_mutex;
369*cdf0e10cSrcweir 					SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this);
370*cdf0e10cSrcweir                     pThat->setBuffered3DDecomposition(Primitive3DSequence());
371*cdf0e10cSrcweir     				delete pThat->mpLastRLGViewInformation;
372*cdf0e10cSrcweir                     pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation);
373*cdf0e10cSrcweir                 }
374*cdf0e10cSrcweir             }
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir             // no test for buffering needed, call parent
377*cdf0e10cSrcweir             return SdrPrimitive3D::get3DDecomposition(rViewInformation);
378*cdf0e10cSrcweir         }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir         // provide unique ID
381*cdf0e10cSrcweir 		ImplPrimitrive3DIDBlock(SdrLathePrimitive3D, PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D)
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 	} // end of namespace primitive3d
384*cdf0e10cSrcweir } // end of namespace drawinglayer
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
387*cdf0e10cSrcweir // eof
388