2006-05-12 10:54:47 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
*
|
|
|
|
* $RCSfile: sdrlatheprimitive3d.cxx,v $
|
|
|
|
*
|
2008-06-24 14:31:09 +00:00
|
|
|
* $Revision: 1.15 $
|
2006-05-12 10:54:47 +00:00
|
|
|
*
|
2008-06-24 14:31:09 +00:00
|
|
|
* last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $
|
2006-05-12 10:54:47 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2008-03-05 08:18:45 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_drawinglayer.hxx"
|
|
|
|
|
2006-05-12 10:54:47 +00:00
|
|
|
#include <drawinglayer/primitive3d/sdrlatheprimitive3d.hxx>
|
2006-10-19 09:40:02 +00:00
|
|
|
#include <basegfx/matrix/b2dhommatrix.hxx>
|
2006-05-12 10:54:47 +00:00
|
|
|
#include <basegfx/polygon/b2dpolygontools.hxx>
|
|
|
|
#include <basegfx/polygon/b3dpolypolygontools.hxx>
|
2006-10-19 09:40:02 +00:00
|
|
|
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
|
|
|
|
#include <basegfx/tools/canvastools.hxx>
|
2007-03-06 11:36:13 +00:00
|
|
|
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
|
2008-06-24 14:31:09 +00:00
|
|
|
#include <drawinglayer/geometry/viewinformation3d.hxx>
|
2007-03-06 11:36:13 +00:00
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
using namespace com::sun::star;
|
|
|
|
|
2006-05-12 10:54:47 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
namespace drawinglayer
|
|
|
|
{
|
2006-08-09 15:51:16 +00:00
|
|
|
namespace primitive3d
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
2008-06-24 14:31:09 +00:00
|
|
|
Primitive3DSequence SdrLathePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
2006-10-19 09:40:02 +00:00
|
|
|
Primitive3DSequence aRetval;
|
|
|
|
|
2006-05-19 08:34:56 +00:00
|
|
|
// get slices
|
2006-10-19 09:40:02 +00:00
|
|
|
const Slice3DVector& rSliceVector = getSlices();
|
2006-05-12 10:54:47 +00:00
|
|
|
|
2006-05-19 08:34:56 +00:00
|
|
|
if(rSliceVector.size())
|
|
|
|
{
|
2006-10-19 09:40:02 +00:00
|
|
|
const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0));
|
|
|
|
const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI));
|
2006-05-12 10:54:47 +00:00
|
|
|
|
|
|
|
// add fill
|
|
|
|
if(getSdrLFSAttribute().getFill())
|
|
|
|
{
|
|
|
|
sal_uInt32 a;
|
2006-08-09 15:51:16 +00:00
|
|
|
basegfx::B3DRange aRange;
|
2006-05-12 10:54:47 +00:00
|
|
|
|
|
|
|
// decide what to create
|
|
|
|
const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind());
|
|
|
|
const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX());
|
|
|
|
const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY());
|
2006-08-09 15:51:16 +00:00
|
|
|
basegfx::B2DHomMatrix aTexTransform;
|
2006-05-12 10:54:47 +00:00
|
|
|
|
|
|
|
if(bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)
|
|
|
|
{
|
|
|
|
aTexTransform.set(0, 0, 0.0);
|
|
|
|
aTexTransform.set(0, 1, 1.0);
|
|
|
|
aTexTransform.set(1, 0, 1.0);
|
|
|
|
aTexTransform.set(1, 1, 0.0);
|
|
|
|
|
|
|
|
aTexTransform.translate(0.0, -0.5);
|
|
|
|
aTexTransform.scale(1.0, -1.0);
|
|
|
|
aTexTransform.translate(0.0, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
// create geometry
|
2006-08-09 15:51:16 +00:00
|
|
|
::std::vector< basegfx::B3DPolyPolygon > aFill;
|
2006-05-19 08:34:56 +00:00
|
|
|
extractPlanesFromSlice(aFill, rSliceVector,
|
2006-10-19 09:40:02 +00:00
|
|
|
bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), bClosedRotation,
|
2006-05-12 10:54:47 +00:00
|
|
|
0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
|
|
|
|
|
|
|
|
// get full range
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
2006-08-09 15:51:16 +00:00
|
|
|
aRange.expand(basegfx::tools::getRange(aFill[a]));
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// normal creation
|
|
|
|
{
|
|
|
|
if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
|
|
|
|
{
|
|
|
|
// create sphere normals
|
2006-08-09 15:51:16 +00:00
|
|
|
const basegfx::B3DPoint aCenter(aRange.getCenter());
|
2006-05-12 10:54:47 +00:00
|
|
|
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
2006-08-09 15:51:16 +00:00
|
|
|
aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter);
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind())
|
|
|
|
{
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
|
|
|
aFill[a].clearNormals();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(getSdr3DObjectAttribute().getNormalsInvert())
|
|
|
|
{
|
|
|
|
// invert normals
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
2006-08-09 15:51:16 +00:00
|
|
|
aFill[a] = basegfx::tools::invertNormals(aFill[a]);
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// texture coordinates
|
|
|
|
{
|
|
|
|
// handle texture coordinates X
|
|
|
|
const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX());
|
|
|
|
const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX()));
|
|
|
|
|
|
|
|
// handle texture coordinates Y
|
|
|
|
const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY());
|
|
|
|
const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY()));
|
|
|
|
|
|
|
|
if(bParallelX || bParallelY)
|
|
|
|
{
|
|
|
|
// apply parallel texture coordinates in X and/or Y
|
|
|
|
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
2006-08-09 15:51:16 +00:00
|
|
|
aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY);
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(bSphereX || bSphereY)
|
|
|
|
{
|
|
|
|
// apply spherical texture coordinates in X and/or Y
|
2006-08-09 15:51:16 +00:00
|
|
|
const basegfx::B3DPoint aCenter(aRange.getCenter());
|
2006-05-12 10:54:47 +00:00
|
|
|
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
2006-08-09 15:51:16 +00:00
|
|
|
aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY);
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// transform texture coordinates to texture size
|
2006-08-09 15:51:16 +00:00
|
|
|
basegfx::B2DHomMatrix aTexMatrix;
|
2006-10-19 09:40:02 +00:00
|
|
|
aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
|
2006-05-12 10:54:47 +00:00
|
|
|
|
|
|
|
for(a = 0L; a < aFill.size(); a++)
|
|
|
|
{
|
|
|
|
aFill[a].transformTextureCoordiantes(aTexMatrix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// create single PolyPolygonFill primitives
|
2006-10-19 09:40:02 +00:00
|
|
|
aRetval = create3DPolyPolygonFillPrimitives(
|
|
|
|
aFill, getTransform(), getTextureSize(),
|
2006-05-12 10:54:47 +00:00
|
|
|
getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
|
|
|
|
getSdrLFSAttribute().getFillFloatTransGradient());
|
|
|
|
}
|
|
|
|
|
|
|
|
// add line
|
|
|
|
if(getSdrLFSAttribute().getLine())
|
|
|
|
{
|
2008-06-24 14:31:09 +00:00
|
|
|
if(getSdr3DObjectAttribute().getReducedLineGeometry())
|
|
|
|
{
|
|
|
|
// create geometric outlines with reduced line geometry for chart
|
|
|
|
const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, bClosedRotation));
|
|
|
|
const sal_uInt32 nCount(aHorLine.count());
|
|
|
|
basegfx::B3DPolyPolygon aNewLineGeometry;
|
|
|
|
|
|
|
|
for(sal_uInt32 a(1); a < nCount; a++)
|
|
|
|
{
|
|
|
|
// for each loop pair create the connection edges
|
|
|
|
createReducedOutlines(
|
|
|
|
rViewInformation,
|
|
|
|
getTransform(),
|
|
|
|
aHorLine.getB3DPolygon(a - 1),
|
|
|
|
aHorLine.getB3DPolygon(a),
|
|
|
|
aNewLineGeometry);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(sal_uInt32 b(0); b < nCount; b++)
|
|
|
|
{
|
|
|
|
// filter hor lines for empty loops (those who have their defining point on the Y-Axis)
|
|
|
|
basegfx::B3DPolygon aCandidate(aHorLine.getB3DPolygon(b));
|
|
|
|
aCandidate.removeDoublePoints();
|
|
|
|
|
|
|
|
if(aCandidate.count())
|
|
|
|
{
|
|
|
|
aNewLineGeometry.append(aCandidate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(aNewLineGeometry.count())
|
|
|
|
{
|
|
|
|
const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine()));
|
|
|
|
appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// extract line geometry from slices
|
|
|
|
const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, bClosedRotation));
|
|
|
|
const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector));
|
|
|
|
|
|
|
|
// add horizontal lines
|
|
|
|
const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine()));
|
|
|
|
appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines);
|
|
|
|
|
|
|
|
// add vertical lines
|
|
|
|
const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine()));
|
|
|
|
appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines);
|
|
|
|
}
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// add shadow
|
2006-10-19 09:40:02 +00:00
|
|
|
if(getSdrLFSAttribute().getShadow() && aRetval.hasElements())
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
2006-10-19 09:40:02 +00:00
|
|
|
const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
|
|
|
|
appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
}
|
2006-10-19 09:40:02 +00:00
|
|
|
|
2008-05-27 13:11:34 +00:00
|
|
|
return aRetval;
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
void SdrLathePrimitive3D::impCreateSlices()
|
2006-05-19 08:34:56 +00:00
|
|
|
{
|
2008-05-27 13:11:34 +00:00
|
|
|
// prepare the polygon. No double points, correct orientations and a correct
|
|
|
|
// outmost polygon are needed
|
2008-06-24 14:31:09 +00:00
|
|
|
maCorrectedPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon());
|
|
|
|
maCorrectedPolyPolygon.removeDoublePoints();
|
|
|
|
maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);
|
|
|
|
maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon);
|
2006-05-19 08:34:56 +00:00
|
|
|
|
|
|
|
// check edge count of first sub-polygon. If different, reSegment polyPolygon. This ensures
|
|
|
|
// that for polyPolygons, the subPolys 1..n only get reSegmented when polygon 0L is different
|
|
|
|
// at all (and not always)
|
2008-06-24 14:31:09 +00:00
|
|
|
const basegfx::B2DPolygon aSubCandidate(maCorrectedPolyPolygon.getB2DPolygon(0));
|
2006-05-19 08:34:56 +00:00
|
|
|
const sal_uInt32 nSubEdgeCount(aSubCandidate.isClosed() ? aSubCandidate.count() : (aSubCandidate.count() ? aSubCandidate.count() - 1L : 0L));
|
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
if(nSubEdgeCount != getVerticalSegments())
|
2006-05-19 08:34:56 +00:00
|
|
|
{
|
2008-06-24 14:31:09 +00:00
|
|
|
maCorrectedPolyPolygon = basegfx::tools::reSegmentPolyPolygon(maCorrectedPolyPolygon, getVerticalSegments());
|
2006-05-19 08:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare slices as geometry
|
2008-06-24 14:31:09 +00:00
|
|
|
createLatheSlices(maSlices, maCorrectedPolyPolygon, getBackScale(), getDiagonal(), getRotation(), getHorizontalSegments(), getCharacterMode(), getCloseFront(), getCloseBack());
|
2006-05-19 08:34:56 +00:00
|
|
|
}
|
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
const Slice3DVector& SdrLathePrimitive3D::getSlices() const
|
2006-05-19 08:34:56 +00:00
|
|
|
{
|
2008-05-14 08:22:09 +00:00
|
|
|
// This can be made dependent of getSdrLFSAttribute().getFill() and getSdrLFSAttribute().getLine()
|
|
|
|
// again when no longer geometry is needed for non-visible 3D objects as it is now for chart
|
|
|
|
if(getPolyPolygon().count() && !maSlices.size())
|
2006-05-19 08:34:56 +00:00
|
|
|
{
|
|
|
|
::osl::Mutex m_mutex;
|
2006-10-19 09:40:02 +00:00
|
|
|
const_cast< SdrLathePrimitive3D& >(*this).impCreateSlices();
|
2006-05-19 08:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return maSlices;
|
|
|
|
}
|
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
SdrLathePrimitive3D::SdrLathePrimitive3D(
|
2006-08-09 15:51:16 +00:00
|
|
|
const basegfx::B3DHomMatrix& rTransform,
|
|
|
|
const basegfx::B2DVector& rTextureSize,
|
2006-10-19 09:40:02 +00:00
|
|
|
const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
|
|
|
|
const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
|
2006-08-09 15:51:16 +00:00
|
|
|
const basegfx::B2DPolyPolygon& rPolyPolygon,
|
2006-05-12 10:54:47 +00:00
|
|
|
sal_uInt32 nHorizontalSegments,
|
|
|
|
sal_uInt32 nVerticalSegments,
|
|
|
|
double fDiagonal,
|
|
|
|
double fBackScale,
|
|
|
|
double fRotation,
|
|
|
|
bool bSmoothNormals,
|
|
|
|
bool bSmoothHorizontalNormals,
|
|
|
|
bool bSmoothLids,
|
|
|
|
bool bCharacterMode,
|
|
|
|
bool bCloseFront,
|
|
|
|
bool bCloseBack)
|
2006-10-19 09:40:02 +00:00
|
|
|
: SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
|
2008-06-24 14:31:09 +00:00
|
|
|
maCorrectedPolyPolygon(),
|
|
|
|
maSlices(),
|
2006-05-12 10:54:47 +00:00
|
|
|
maPolyPolygon(rPolyPolygon),
|
|
|
|
mnHorizontalSegments(nHorizontalSegments),
|
|
|
|
mnVerticalSegments(nVerticalSegments),
|
|
|
|
mfDiagonal(fDiagonal),
|
|
|
|
mfBackScale(fBackScale),
|
|
|
|
mfRotation(fRotation),
|
2008-06-24 14:31:09 +00:00
|
|
|
mpLastRLGViewInformation(0),
|
2006-05-12 10:54:47 +00:00
|
|
|
mbSmoothNormals(bSmoothNormals),
|
|
|
|
mbSmoothHorizontalNormals(bSmoothHorizontalNormals),
|
|
|
|
mbSmoothLids(bSmoothLids),
|
|
|
|
mbCharacterMode(bCharacterMode),
|
|
|
|
mbCloseFront(bCloseFront),
|
|
|
|
mbCloseBack(bCloseBack)
|
|
|
|
{
|
|
|
|
// make sure Rotation is positive
|
2006-10-19 09:40:02 +00:00
|
|
|
if(basegfx::fTools::lessOrEqual(getRotation(), 0.0))
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
|
|
|
mfRotation = 0.0;
|
|
|
|
}
|
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
// make sure the percentage value getDiagonal() is between 0.0 and 1.0
|
|
|
|
if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
|
|
|
mfDiagonal = 0.0;
|
|
|
|
}
|
2006-10-19 09:40:02 +00:00
|
|
|
else if(basegfx::fTools::moreOrEqual(getDiagonal(), 1.0))
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
|
|
|
mfDiagonal = 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// no close front/back when polygon is not closed
|
2006-10-19 09:40:02 +00:00
|
|
|
if(getPolyPolygon().count() && !getPolyPolygon().getB2DPolygon(0L).isClosed())
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
|
|
|
mbCloseFront = mbCloseBack = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// no edge rounding when not closing
|
2006-10-19 09:40:02 +00:00
|
|
|
if(!getCloseFront() && !getCloseBack())
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
|
|
|
mfDiagonal = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-24 14:31:09 +00:00
|
|
|
SdrLathePrimitive3D::~SdrLathePrimitive3D()
|
|
|
|
{
|
|
|
|
if(mpLastRLGViewInformation)
|
|
|
|
{
|
|
|
|
delete mpLastRLGViewInformation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-19 09:40:02 +00:00
|
|
|
bool SdrLathePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
2006-10-19 09:40:02 +00:00
|
|
|
if(SdrPrimitive3D::operator==(rPrimitive))
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
2006-10-19 09:40:02 +00:00
|
|
|
const SdrLathePrimitive3D& rCompare = static_cast< const SdrLathePrimitive3D& >(rPrimitive);
|
|
|
|
|
|
|
|
return (getPolyPolygon() == rCompare.getPolyPolygon()
|
|
|
|
&& getHorizontalSegments() == rCompare.getHorizontalSegments()
|
|
|
|
&& getVerticalSegments() == rCompare.getVerticalSegments()
|
|
|
|
&& getDiagonal() == rCompare.getDiagonal()
|
|
|
|
&& getBackScale() == rCompare.getBackScale()
|
|
|
|
&& getRotation() == rCompare.getRotation()
|
|
|
|
&& getSmoothNormals() == rCompare.getSmoothNormals()
|
|
|
|
&& getSmoothHorizontalNormals() == rCompare.getSmoothHorizontalNormals()
|
|
|
|
&& getSmoothLids() == rCompare.getSmoothLids()
|
|
|
|
&& getCharacterMode() == rCompare.getCharacterMode()
|
|
|
|
&& getCloseFront() == rCompare.getCloseFront()
|
|
|
|
&& getCloseBack() == rCompare.getCloseBack());
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-06-10 08:29:56 +00:00
|
|
|
basegfx::B3DRange SdrLathePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const
|
2006-05-12 10:54:47 +00:00
|
|
|
{
|
2006-05-19 08:34:56 +00:00
|
|
|
// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2
|
2006-06-02 12:58:03 +00:00
|
|
|
// The parent implementation which uses the ranges of the decomposition would be more
|
2006-05-19 08:34:56 +00:00
|
|
|
// corrcet, but for historical reasons it is necessary to do the old method: To get
|
|
|
|
// the range of the non-transformed geometry and transform it then. This leads to different
|
|
|
|
// ranges where the new method is more correct, but the need to keep the old behaviour
|
|
|
|
// has priority here.
|
2006-08-09 15:51:16 +00:00
|
|
|
return get3DRangeFromSlices(getSlices());
|
2006-05-12 10:54:47 +00:00
|
|
|
}
|
2006-10-19 09:40:02 +00:00
|
|
|
|
2008-06-24 14:31:09 +00:00
|
|
|
Primitive3DSequence SdrLathePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
|
|
|
|
{
|
|
|
|
if(getSdr3DObjectAttribute().getReducedLineGeometry())
|
|
|
|
{
|
|
|
|
if(!mpLastRLGViewInformation ||
|
|
|
|
(getLocalDecomposition().hasElements()
|
|
|
|
&& *mpLastRLGViewInformation != rViewInformation))
|
|
|
|
{
|
|
|
|
// conditions of last local decomposition with reduced lines have changed. Remember
|
|
|
|
// new one and clear current decompositiopn
|
|
|
|
::osl::Mutex m_mutex;
|
|
|
|
SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this);
|
|
|
|
pThat->setLocalDecomposition(Primitive3DSequence());
|
|
|
|
delete pThat->mpLastRLGViewInformation;
|
|
|
|
pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// no test for buffering needed, call parent
|
|
|
|
return SdrPrimitive3D::get3DDecomposition(rViewInformation);
|
|
|
|
}
|
|
|
|
|
2006-11-07 14:49:11 +00:00
|
|
|
// provide unique ID
|
2007-03-06 11:36:13 +00:00
|
|
|
ImplPrimitrive3DIDBlock(SdrLathePrimitive3D, PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D)
|
2006-11-07 14:49:11 +00:00
|
|
|
|
2006-08-09 15:51:16 +00:00
|
|
|
} // end of namespace primitive3d
|
2006-05-12 10:54:47 +00:00
|
|
|
} // end of namespace drawinglayer
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// eof
|