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