1*464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*464702f4SAndrew Rist  * distributed with this work for additional information
6*464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9*464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*464702f4SAndrew Rist  *
11*464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*464702f4SAndrew Rist  *
13*464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*464702f4SAndrew Rist  * software distributed under the License is distributed on an
15*464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*464702f4SAndrew Rist  * specific language governing permissions and limitations
18*464702f4SAndrew Rist  * under the License.
19*464702f4SAndrew Rist  *
20*464702f4SAndrew Rist  *************************************************************/
21*464702f4SAndrew Rist 
22*464702f4SAndrew 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 	{
49cdf0e10cSrcweir 		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 
212cdf0e10cSrcweir 		void SdrLathePrimitive3D::impCreateSlices()
213cdf0e10cSrcweir 		{
214cdf0e10cSrcweir 			// prepare the polygon. No double points, correct orientations and a correct
215cdf0e10cSrcweir 			// outmost polygon are needed
216cdf0e10cSrcweir 			maCorrectedPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon());
217cdf0e10cSrcweir 			maCorrectedPolyPolygon.removeDoublePoints();
218cdf0e10cSrcweir 			maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);
219cdf0e10cSrcweir 			maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 			// check edge count of first sub-polygon. If different, reSegment polyPolygon. This ensures
222cdf0e10cSrcweir 			// that for polyPolygons, the subPolys 1..n only get reSegmented when polygon 0L is different
223cdf0e10cSrcweir 			// at all (and not always)
224cdf0e10cSrcweir 			const basegfx::B2DPolygon aSubCandidate(maCorrectedPolyPolygon.getB2DPolygon(0));
225cdf0e10cSrcweir 			const sal_uInt32 nSubEdgeCount(aSubCandidate.isClosed() ? aSubCandidate.count() : (aSubCandidate.count() ? aSubCandidate.count() - 1L : 0L));
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 			if(nSubEdgeCount != getVerticalSegments())
228cdf0e10cSrcweir 			{
229cdf0e10cSrcweir 				maCorrectedPolyPolygon = basegfx::tools::reSegmentPolyPolygon(maCorrectedPolyPolygon, getVerticalSegments());
230cdf0e10cSrcweir 			}
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 			// prepare slices as geometry
233cdf0e10cSrcweir 			createLatheSlices(maSlices, maCorrectedPolyPolygon, getBackScale(), getDiagonal(), getRotation(), getHorizontalSegments(), getCharacterMode(), getCloseFront(), getCloseBack());
234cdf0e10cSrcweir 		}
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 		const Slice3DVector& SdrLathePrimitive3D::getSlices() const
237cdf0e10cSrcweir 		{
238cdf0e10cSrcweir 			// This can be made dependent of  getSdrLFSAttribute().getFill() and getSdrLFSAttribute().getLine()
239cdf0e10cSrcweir 			// again when no longer geometry is needed for non-visible 3D objects as it is now for chart
240cdf0e10cSrcweir 			if(getPolyPolygon().count() && !maSlices.size())
241cdf0e10cSrcweir 			{
242cdf0e10cSrcweir 			    ::osl::Mutex m_mutex;
243cdf0e10cSrcweir 				const_cast< SdrLathePrimitive3D& >(*this).impCreateSlices();
244cdf0e10cSrcweir 			}
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 			return maSlices;
247cdf0e10cSrcweir 		}
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		SdrLathePrimitive3D::SdrLathePrimitive3D(
250cdf0e10cSrcweir 			const basegfx::B3DHomMatrix& rTransform,
251cdf0e10cSrcweir 			const basegfx::B2DVector& rTextureSize,
252cdf0e10cSrcweir 			const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
253cdf0e10cSrcweir 			const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
254cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPolyPolygon,
255cdf0e10cSrcweir 			sal_uInt32 nHorizontalSegments,
256cdf0e10cSrcweir 			sal_uInt32 nVerticalSegments,
257cdf0e10cSrcweir 			double fDiagonal,
258cdf0e10cSrcweir 			double fBackScale,
259cdf0e10cSrcweir 			double fRotation,
260cdf0e10cSrcweir 			bool bSmoothNormals,
261cdf0e10cSrcweir 			bool bSmoothHorizontalNormals,
262cdf0e10cSrcweir 			bool bSmoothLids,
263cdf0e10cSrcweir 			bool bCharacterMode,
264cdf0e10cSrcweir 			bool bCloseFront,
265cdf0e10cSrcweir 			bool bCloseBack)
266cdf0e10cSrcweir 		:	SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
267cdf0e10cSrcweir             maCorrectedPolyPolygon(),
268cdf0e10cSrcweir             maSlices(),
269cdf0e10cSrcweir 			maPolyPolygon(rPolyPolygon),
270cdf0e10cSrcweir 			mnHorizontalSegments(nHorizontalSegments),
271cdf0e10cSrcweir 			mnVerticalSegments(nVerticalSegments),
272cdf0e10cSrcweir 			mfDiagonal(fDiagonal),
273cdf0e10cSrcweir 			mfBackScale(fBackScale),
274cdf0e10cSrcweir 			mfRotation(fRotation),
275cdf0e10cSrcweir             mpLastRLGViewInformation(0),
276cdf0e10cSrcweir 			mbSmoothNormals(bSmoothNormals),
277cdf0e10cSrcweir 			mbSmoothHorizontalNormals(bSmoothHorizontalNormals),
278cdf0e10cSrcweir 			mbSmoothLids(bSmoothLids),
279cdf0e10cSrcweir 			mbCharacterMode(bCharacterMode),
280cdf0e10cSrcweir 			mbCloseFront(bCloseFront),
281cdf0e10cSrcweir 			mbCloseBack(bCloseBack)
282cdf0e10cSrcweir 		{
283cdf0e10cSrcweir 			// make sure Rotation is positive
284cdf0e10cSrcweir 			if(basegfx::fTools::lessOrEqual(getRotation(), 0.0))
285cdf0e10cSrcweir 			{
286cdf0e10cSrcweir 				mfRotation = 0.0;
287cdf0e10cSrcweir 			}
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 			// make sure the percentage value getDiagonal() is between 0.0 and 1.0
290cdf0e10cSrcweir 			if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
291cdf0e10cSrcweir 			{
292cdf0e10cSrcweir 				mfDiagonal = 0.0;
293cdf0e10cSrcweir 			}
294cdf0e10cSrcweir 			else if(basegfx::fTools::moreOrEqual(getDiagonal(), 1.0))
295cdf0e10cSrcweir 			{
296cdf0e10cSrcweir 				mfDiagonal = 1.0;
297cdf0e10cSrcweir 			}
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 			// no close front/back when polygon is not closed
300cdf0e10cSrcweir 			if(getPolyPolygon().count() && !getPolyPolygon().getB2DPolygon(0L).isClosed())
301cdf0e10cSrcweir 			{
302cdf0e10cSrcweir 				mbCloseFront = mbCloseBack = false;
303cdf0e10cSrcweir 			}
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 			// no edge rounding when not closing
306cdf0e10cSrcweir 			if(!getCloseFront() && !getCloseBack())
307cdf0e10cSrcweir 			{
308cdf0e10cSrcweir 				mfDiagonal = 0.0;
309cdf0e10cSrcweir 			}
310cdf0e10cSrcweir 		}
311cdf0e10cSrcweir 
312cdf0e10cSrcweir         SdrLathePrimitive3D::~SdrLathePrimitive3D()
313cdf0e10cSrcweir         {
314cdf0e10cSrcweir             if(mpLastRLGViewInformation)
315cdf0e10cSrcweir             {
316cdf0e10cSrcweir                 delete mpLastRLGViewInformation;
317cdf0e10cSrcweir             }
318cdf0e10cSrcweir         }
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 		bool SdrLathePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
321cdf0e10cSrcweir 		{
322cdf0e10cSrcweir 			if(SdrPrimitive3D::operator==(rPrimitive))
323cdf0e10cSrcweir 			{
324cdf0e10cSrcweir 				const SdrLathePrimitive3D& rCompare = static_cast< const SdrLathePrimitive3D& >(rPrimitive);
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 				return (getPolyPolygon() == rCompare.getPolyPolygon()
327cdf0e10cSrcweir 					&& getHorizontalSegments() == rCompare.getHorizontalSegments()
328cdf0e10cSrcweir 					&& getVerticalSegments() == rCompare.getVerticalSegments()
329cdf0e10cSrcweir 					&& getDiagonal() == rCompare.getDiagonal()
330cdf0e10cSrcweir 					&& getBackScale() == rCompare.getBackScale()
331cdf0e10cSrcweir 					&& getRotation() == rCompare.getRotation()
332cdf0e10cSrcweir 					&& getSmoothNormals() == rCompare.getSmoothNormals()
333cdf0e10cSrcweir 					&& getSmoothHorizontalNormals() == rCompare.getSmoothHorizontalNormals()
334cdf0e10cSrcweir 					&& getSmoothLids() == rCompare.getSmoothLids()
335cdf0e10cSrcweir 					&& getCharacterMode() == rCompare.getCharacterMode()
336cdf0e10cSrcweir 					&& getCloseFront() == rCompare.getCloseFront()
337cdf0e10cSrcweir 					&& getCloseBack() == rCompare.getCloseBack());
338cdf0e10cSrcweir 			}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 			return false;
341cdf0e10cSrcweir 		}
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 		basegfx::B3DRange SdrLathePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const
344cdf0e10cSrcweir 		{
345cdf0e10cSrcweir 			// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2
346cdf0e10cSrcweir 			// The parent implementation which uses the ranges of the decomposition would be more
347cdf0e10cSrcweir 			// corrcet, but for historical reasons it is necessary to do the old method: To get
348cdf0e10cSrcweir 			// the range of the non-transformed geometry and transform it then. This leads to different
349cdf0e10cSrcweir 			// ranges where the new method is more correct, but the need to keep the old behaviour
350cdf0e10cSrcweir 			// has priority here.
351cdf0e10cSrcweir 			return get3DRangeFromSlices(getSlices());
352cdf0e10cSrcweir 		}
353cdf0e10cSrcweir 
354cdf0e10cSrcweir         Primitive3DSequence SdrLathePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
355cdf0e10cSrcweir         {
356cdf0e10cSrcweir             if(getSdr3DObjectAttribute().getReducedLineGeometry())
357cdf0e10cSrcweir             {
358cdf0e10cSrcweir                 if(!mpLastRLGViewInformation ||
359cdf0e10cSrcweir                     (getBuffered3DDecomposition().hasElements()
360cdf0e10cSrcweir                         && *mpLastRLGViewInformation != rViewInformation))
361cdf0e10cSrcweir                 {
362cdf0e10cSrcweir 					// conditions of last local decomposition with reduced lines have changed. Remember
363cdf0e10cSrcweir                     // new one and clear current decompositiopn
364cdf0e10cSrcweir     			    ::osl::Mutex m_mutex;
365cdf0e10cSrcweir 					SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this);
366cdf0e10cSrcweir                     pThat->setBuffered3DDecomposition(Primitive3DSequence());
367cdf0e10cSrcweir     				delete pThat->mpLastRLGViewInformation;
368cdf0e10cSrcweir                     pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation);
369cdf0e10cSrcweir                 }
370cdf0e10cSrcweir             }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir             // no test for buffering needed, call parent
373cdf0e10cSrcweir             return SdrPrimitive3D::get3DDecomposition(rViewInformation);
374cdf0e10cSrcweir         }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir         // provide unique ID
377cdf0e10cSrcweir 		ImplPrimitrive3DIDBlock(SdrLathePrimitive3D, PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D)
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	} // end of namespace primitive3d
380cdf0e10cSrcweir } // end of namespace drawinglayer
381cdf0e10cSrcweir 
382cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
383cdf0e10cSrcweir // eof
384