summaryrefslogtreecommitdiff
path: root/drawinglayer/source/primitive3d
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/primitive3d')
-rw-r--r--drawinglayer/source/primitive3d/baseprimitive3d.cxx266
-rw-r--r--drawinglayer/source/primitive3d/groupprimitive3d.cxx86
-rw-r--r--drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx404
-rw-r--r--drawinglayer/source/primitive3d/makefile.mk31
-rw-r--r--drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx31
-rw-r--r--drawinglayer/source/primitive3d/polygonprimitive3d.cxx101
-rw-r--r--drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx173
-rw-r--r--drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx44
-rw-r--r--drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx79
-rw-r--r--drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx157
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx122
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx134
-rw-r--r--drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx141
-rw-r--r--drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx125
-rw-r--r--drawinglayer/source/primitive3d/sdrprimitive3d.cxx50
-rw-r--r--drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx85
-rw-r--r--drawinglayer/source/primitive3d/shadowprimitive3d.cxx44
-rw-r--r--drawinglayer/source/primitive3d/textureprimitive3d.cxx152
-rw-r--r--drawinglayer/source/primitive3d/transformprimitive3d.cxx45
19 files changed, 1426 insertions, 844 deletions
diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
new file mode 100644
index 000000000000..10525a13d0d7
--- /dev/null
+++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: baseprimitive3d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:32 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#endif
+
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ Primitive3DSequence BasePrimitive3D::createLocalDecomposition(double /*fTime*/) const
+ {
+ // default returns an empty sequence
+ return Primitive3DSequence();
+ }
+
+ BasePrimitive3D::BasePrimitive3D()
+ : BasePrimitive3DImplBase(m_aMutex),
+ maLocalDecomposition()
+ {
+ }
+
+ bool BasePrimitive3D::operator==( const BasePrimitive3D& rPrimitive ) const
+ {
+ return (getPrimitiveID() == rPrimitive.getPrimitiveID());
+ }
+
+ basegfx::B3DRange BasePrimitive3D::getB3DRange(double fTime) const
+ {
+ return getB3DRangeFromPrimitive3DSequence(get3DDecomposition(fTime), fTime);
+ }
+
+
+ Primitive3DSequence BasePrimitive3D::get3DDecomposition(double fTime) const
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if(!getLocalDecomposition().hasElements())
+ {
+ const Primitive3DSequence aNewSequence(createLocalDecomposition(fTime));
+ const_cast< BasePrimitive3D* >(this)->setLocalDecomposition(aNewSequence);
+ }
+
+ return getLocalDecomposition();
+ }
+
+ Primitive3DSequence SAL_CALL BasePrimitive3D::getDecomposition( const graphic::Primitive3DParameters& aPrimitive2DParameters ) throw ( uno::RuntimeException )
+ {
+ return get3DDecomposition(aPrimitive2DParameters.Time);
+ }
+
+ geometry::RealRectangle3D SAL_CALL BasePrimitive3D::getRange( const graphic::Primitive3DParameters& aPrimitive2DParameters ) throw ( uno::RuntimeException )
+ {
+ return basegfx::unotools::rectangle3DFromB3DRectangle(getB3DRange(aPrimitive2DParameters.Time));
+ }
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ // get range3D from a given Primitive3DReference
+ basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, double fTime)
+ {
+ basegfx::B3DRange aRetval;
+
+ if(rCandidate.is())
+ {
+ // try to get C++ implementation base
+ const BasePrimitive3D* pCandidate(dynamic_cast< BasePrimitive3D* >(rCandidate.get()));
+
+ if(pCandidate)
+ {
+ // use it if possible
+ aRetval.expand(pCandidate->getB3DRange(fTime));
+ }
+ else
+ {
+ // use UNO API call instead
+ graphic::Primitive3DParameters aPrimitive3DParameters;
+ aPrimitive3DParameters.Time = fTime;
+ aRetval.expand(basegfx::unotools::b3DRectangleFromRealRectangle3D(rCandidate->getRange(aPrimitive3DParameters)));
+ }
+ }
+
+ return aRetval;
+ }
+
+ // get range3D from a given Primitive3DSequence
+ basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, double fTime)
+ {
+ basegfx::B3DRange aRetval;
+
+ if(rCandidate.hasElements())
+ {
+ const sal_Int32 nCount(rCandidate.getLength());
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ aRetval.expand(getB3DRangeFromPrimitive3DReference(rCandidate[a], fTime));
+ }
+ }
+
+ return aRetval;
+ }
+
+ bool arePrimitive3DReferencesEqual(const Primitive3DReference& rxA, const Primitive3DReference& rxB)
+ {
+ const sal_Bool bAIs(rxA.is());
+
+ if(bAIs != rxB.is())
+ {
+ return false;
+ }
+
+ if(!bAIs)
+ {
+ return true;
+ }
+
+ const BasePrimitive3D* pA(dynamic_cast< const BasePrimitive3D* >(rxA.get()));
+ const BasePrimitive3D* pB(dynamic_cast< const BasePrimitive3D* >(rxB.get()));
+ const bool bAEqualZero(pA == 0L);
+
+ if(bAEqualZero != (pB == 0L))
+ {
+ return false;
+ }
+
+ if(bAEqualZero)
+ {
+ return false;
+ }
+
+ return (pA->operator==(*pB));
+ }
+
+ bool arePrimitive3DSequencesEqual(const Primitive3DSequence& rA, const Primitive3DSequence& rB)
+ {
+ const sal_Bool bAHasElements(rA.hasElements());
+
+ if(bAHasElements != rB.hasElements())
+ {
+ return false;
+ }
+
+ if(!bAHasElements)
+ {
+ return true;
+ }
+
+ const sal_Int32 nCount(rA.getLength());
+
+ if(nCount != rB.getLength())
+ {
+ return false;
+ }
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ if(!arePrimitive3DReferencesEqual(rA[a], rB[a]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // concatenate sequence
+ void appendPrimitive3DSequenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DSequence& rSource)
+ {
+ if(rSource.hasElements())
+ {
+ if(rDest.hasElements())
+ {
+ const sal_Int32 nSourceCount(rSource.getLength());
+ const sal_Int32 nDestCount(rDest.getLength());
+ const sal_Int32 nTargetCount(nSourceCount + nDestCount);
+ sal_Int32 nInsertPos(nDestCount);
+
+ rDest.realloc(nTargetCount);
+
+ for(sal_Int32 a(0L); a < nSourceCount; a++)
+ {
+ if(rSource[a].is())
+ {
+ rDest[nInsertPos++] = rSource[a];
+ }
+ }
+
+ if(nInsertPos != nTargetCount)
+ {
+ rDest.realloc(nInsertPos);
+ }
+ }
+ else
+ {
+ rDest = rSource;
+ }
+ }
+ }
+
+ // concatenate single Primitive3D
+ void appendPrimitive3DReferenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DReference& rSource)
+ {
+ if(rSource.is())
+ {
+ const sal_Int32 nDestCount(rDest.getLength());
+ rDest.realloc(nDestCount + 1L);
+ rDest[nDestCount] = rSource;
+ }
+ }
+
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive3d/groupprimitive3d.cxx b/drawinglayer/source/primitive3d/groupprimitive3d.cxx
new file mode 100644
index 000000000000..1b89299acf27
--- /dev/null
+++ b/drawinglayer/source/primitive3d/groupprimitive3d.cxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: groupprimitive3d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:32 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /// default: just return children, so all renderers not supporting group will use it's content
+ Primitive3DSequence GroupPrimitive3D::createLocalDecomposition(double /*fTime*/) const
+ {
+ return getChildren();
+ }
+
+ GroupPrimitive3D::GroupPrimitive3D( const Primitive3DSequence& rChildren )
+ : BasePrimitive3D(),
+ maChildren(rChildren)
+ {
+ }
+
+ /** The compare opertator uses the Sequence::==operator, so only checking if
+ the rererences are equal. All non-equal references are interpreted as
+ non-equal.
+ */
+ bool GroupPrimitive3D::operator==( const BasePrimitive3D& rPrimitive ) const
+ {
+ if(BasePrimitive3D::operator==(rPrimitive))
+ {
+ const GroupPrimitive3D& rCompare = static_cast< const GroupPrimitive3D& >(rPrimitive);
+
+ return (arePrimitive3DSequencesEqual(getChildren(), rCompare.getChildren()));
+ }
+
+ return false;
+ }
+
+ sal_uInt32 GroupPrimitive3D::getPrimitiveID() const
+ {
+ return Create3DPrimitiveID('3','G','r','o');
+ }
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index 1ab1baa2827d..9b7c47f62ed3 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: hatchtextureprimitive3d.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:14 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:32 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,11 +33,11 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#endif
@@ -57,6 +57,14 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#endif
+#ifndef _BGFX_RANGE_B2DRANGE_HXX
+#include <basegfx/range/b2drange.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+#include <drawinglayer/texture/texture.hxx>
+#endif
+
#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX
#include <basegfx/polygon/b2dpolygonclipper.hxx>
#endif
@@ -65,244 +73,268 @@
#include <basegfx/matrix/b3dhommatrix.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- void hatchTexturePrimitive3D::impCreateDecomposition(const primitiveVector3D& rSource, primitiveVector3D& rDest)
+ Primitive3DSequence HatchTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
- for(sal_uInt32 a(0L); a < rSource.size(); a++)
+ Primitive3DSequence aRetval;
+
+ if(getChildren().hasElements())
{
- // get reference
- const referencedPrimitive3D& rCandidate = rSource[a];
+ const Primitive3DSequence aSource(getChildren());
+ const sal_Int32 nSourceCount(aSource.getLength());
+ std::vector< Primitive3DReference > aDestination;
- // not all content is needed, remove transparencies and ModifiedColorPrimitives
- switch(rCandidate.getID())
+ for(sal_Int32 a(0L); a < nSourceCount; a++)
{
- case CreatePrimitiveID('P', 'O', 'M', '3'):
+ // get reference
+ const Primitive3DReference xReference(aSource[a]);
+
+ if(xReference.is())
{
- // polyPolygonMaterialPrimitive3D, check texturing and hatching
- const polyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const polyPolygonMaterialPrimitive3D& >(rCandidate.getBasePrimitive());
- const basegfx::B3DPolyPolygon aFillPolyPolygon(rPrimitive.getB3DPolyPolygon());
+ // try to cast to BasePrimitive2D implementation
+ const BasePrimitive3D* pBasePrimitive = dynamic_cast< const BasePrimitive3D* >(xReference.get());
- if(aFillPolyPolygon.areTextureCoordinatesUsed())
+ if(pBasePrimitive)
{
- const sal_uInt32 nPolyCount(aFillPolyPolygon.count());
- basegfx::B2DPolyPolygon aTexPolyPolygon;
- basegfx::B2DPoint a2N;
- basegfx::B2DVector a2X, a2Y;
- basegfx::B3DPoint a3N;
- basegfx::B3DVector a3X, a3Y;
- bool b2N(false), b2X(false), b2Y(false);
- sal_uInt32 a, b;
-
- for(a = 0L; a < nPolyCount; a++)
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ // not all content is needed, remove transparencies and ModifiedColorPrimitives
+ switch(pBasePrimitive->getPrimitiveID())
{
- const basegfx::B3DPolygon aPartPoly(aFillPolyPolygon.getB3DPolygon(a));
- const sal_uInt32 nPointCount(aPartPoly.count());
- basegfx::B2DPolygon aTexPolygon;
-
- for(b = 0L; b < nPointCount; b++)
+ case Create3DPrimitiveID('3','P','P','M') :
{
- const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(b));
+ // polyPolygonMaterialPrimitive3D, check texturing and hatching
+ const PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
+ const basegfx::B3DPolyPolygon aFillPolyPolygon(rPrimitive.getB3DPolyPolygon());
- if(!b2N)
+ if(maHatch.isFillBackground())
{
- a2N = a2Candidate;
- a3N = aPartPoly.getB3DPoint(b);
- b2N = true;
+ // add original primitive for background
+ aDestination.push_back(xReference);
}
- else if(!b2X && !a2N.equal(a2Candidate))
- {
- a2X = a2Candidate - a2N;
- a3X = aPartPoly.getB3DPoint(b) - a3N;
- b2X = true;
- }
- else if(!b2Y && !a2N.equal(a2Candidate) && !a2X.equal(a2Candidate))
- {
- a2Y = a2Candidate - a2N;
-
- const double fCross(a2X.cross(a2Y));
- if(!basegfx::fTools::equalZero(fCross))
+ if(aFillPolyPolygon.areTextureCoordinatesUsed())
+ {
+ const sal_uInt32 nPolyCount(aFillPolyPolygon.count());
+ basegfx::B2DPolyPolygon aTexPolyPolygon;
+ basegfx::B2DPoint a2N;
+ basegfx::B2DVector a2X, a2Y;
+ basegfx::B3DPoint a3N;
+ basegfx::B3DVector a3X, a3Y;
+ bool b2N(false), b2X(false), b2Y(false);
+ sal_uInt32 a, b;
+
+ for(a = 0L; a < nPolyCount; a++)
{
- a3Y = aPartPoly.getB3DPoint(b) - a3N;
- b2Y = true;
+ const basegfx::B3DPolygon aPartPoly(aFillPolyPolygon.getB3DPolygon(a));
+ const sal_uInt32 nPointCount(aPartPoly.count());
+ basegfx::B2DPolygon aTexPolygon;
+
+ for(b = 0L; b < nPointCount; b++)
+ {
+ const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(b));
+
+ if(!b2N)
+ {
+ a2N = a2Candidate;
+ a3N = aPartPoly.getB3DPoint(b);
+ b2N = true;
+ }
+ else if(!b2X && !a2N.equal(a2Candidate))
+ {
+ a2X = a2Candidate - a2N;
+ a3X = aPartPoly.getB3DPoint(b) - a3N;
+ b2X = true;
+ }
+ else if(!b2Y && !a2N.equal(a2Candidate) && !a2X.equal(a2Candidate))
+ {
+ a2Y = a2Candidate - a2N;
+
+ const double fCross(a2X.cross(a2Y));
+
+ if(!basegfx::fTools::equalZero(fCross))
+ {
+ a3Y = aPartPoly.getB3DPoint(b) - a3N;
+ b2Y = true;
+ }
+ }
+
+ aTexPolygon.append(a2Candidate);
+ }
+
+ aTexPolygon.setClosed(true);
+ aTexPolyPolygon.append(aTexPolygon);
}
- }
-
- aTexPolygon.append(a2Candidate);
- }
- aTexPolygon.setClosed(true);
- aTexPolyPolygon.append(aTexPolygon);
- }
-
- if(b2N && b2X && b2Y)
- {
- // found two linearly independent 2D vectors
- // get 2d range of texture coordinates
- const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon));
- const basegfx::BColor aHatchColor(maHatch.getColor());
- const double fAngle(-maHatch.getAngle());
- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
-
- // get hatch transformations
- switch(maHatch.getStyle())
- {
- case attribute::HATCHSTYLE_TRIPLE:
- {
- // rotated 45 degrees
- texture::geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle + F_PI4);
- aHatch.appendTransformations(aMatrices);
- }
- case attribute::HATCHSTYLE_DOUBLE:
- {
- // rotated 90 degrees
- texture::geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle + F_PI2);
- aHatch.appendTransformations(aMatrices);
- }
- case attribute::HATCHSTYLE_SINGLE:
- {
- // angle as given
- texture::geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle);
- aHatch.appendTransformations(aMatrices);
+ if(b2N && b2X && b2Y)
+ {
+ // found two linearly independent 2D vectors
+ // get 2d range of texture coordinates
+ const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon));
+ const basegfx::BColor aHatchColor(getHatch().getColor());
+ const double fAngle(-getHatch().getAngle());
+ ::std::vector< basegfx::B2DHomMatrix > aMatrices;
+
+ // get hatch transformations
+ switch(getHatch().getStyle())
+ {
+ case attribute::HATCHSTYLE_TRIPLE:
+ {
+ // rotated 45 degrees
+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle + F_PI4);
+ aHatch.appendTransformations(aMatrices);
+ }
+ case attribute::HATCHSTYLE_DOUBLE:
+ {
+ // rotated 90 degrees
+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle + F_PI2);
+ aHatch.appendTransformations(aMatrices);
+ }
+ case attribute::HATCHSTYLE_SINGLE:
+ {
+ // angle as given
+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle);
+ aHatch.appendTransformations(aMatrices);
+ }
+ }
+
+ // create geometry from unit line
+ basegfx::B2DPolyPolygon a2DHatchLines;
+ basegfx::B2DPolygon a2DUnitLine;
+ a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0));
+ a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0));
+
+ for(a = 0L; a < aMatrices.size(); a++)
+ {
+ const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
+ basegfx::B2DPolygon aNewLine(a2DUnitLine);
+ aNewLine.transform(rMatrix);
+ a2DHatchLines.append(aNewLine);
+ }
+
+ if(a2DHatchLines.count())
+ {
+ // clip against texture polygon
+ a2DHatchLines = basegfx::tools::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, false);
+ }
+
+ if(a2DHatchLines.count())
+ {
+ // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents
+ // a coordinate system transformation from unit coordinates to the new coordinate system
+ basegfx::B2DHomMatrix a2D;
+ a2D.set(0, 0, a2X.getX());
+ a2D.set(1, 0, a2X.getY());
+ a2D.set(0, 1, a2Y.getX());
+ a2D.set(1, 1, a2Y.getY());
+ a2D.set(0, 2, a2N.getX());
+ a2D.set(1, 2, a2N.getY());
+
+ // invert that transformation, so we have a back-transformation from texture coordinates
+ // to unit coordinates
+ a2D.invert();
+ a2DHatchLines.transform(a2D);
+
+ // expand back-transformated geometry tpo 3D
+ basegfx::B3DPolyPolygon a3DHatchLines(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0));
+
+ // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents
+ // a coordinate system transformation from unit coordinates to the object's 3d coordinate system
+ basegfx::B3DHomMatrix a3D;
+ a3D.set(0, 0, a3X.getX());
+ a3D.set(1, 0, a3X.getY());
+ a3D.set(2, 0, a3X.getZ());
+ a3D.set(0, 1, a3Y.getX());
+ a3D.set(1, 1, a3Y.getY());
+ a3D.set(2, 1, a3Y.getZ());
+ a3D.set(0, 3, a3N.getX());
+ a3D.set(1, 3, a3N.getY());
+ a3D.set(2, 3, a3N.getZ());
+
+ // transform hatch lines to 3D object coordinates
+ a3DHatchLines.transform(a3D);
+
+ // build primitives from this geometry
+ const sal_uInt32 nHatchLines(a3DHatchLines.count());
+
+ for(a = 0L; a < nHatchLines; a++)
+ {
+ const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(a), aHatchColor));
+ aDestination.push_back(xRef);
+ }
+ }
+ }
}
- }
-
- // create geometry from unit line
- basegfx::B2DPolyPolygon a2DHatchLines;
- basegfx::B2DPolygon a2DUnitLine;
- a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0));
- a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0));
- for(a = 0L; a < aMatrices.size(); a++)
- {
- const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
- basegfx::B2DPolygon aNewLine(a2DUnitLine);
- aNewLine.transform(rMatrix);
- a2DHatchLines.append(aNewLine);
+ break;
}
-
- if(a2DHatchLines.count())
+ default :
{
- // clip against texture polygon
- a2DHatchLines = basegfx::tools::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, false);
- }
-
- if(a2DHatchLines.count())
- {
- // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents
- // a coordinate system transformation from unit coordinates to the new coordinate system
- basegfx::B2DHomMatrix a2D;
- a2D.set(0, 0, a2X.getX());
- a2D.set(1, 0, a2X.getY());
- a2D.set(0, 1, a2Y.getX());
- a2D.set(1, 1, a2Y.getY());
- a2D.set(0, 2, a2N.getX());
- a2D.set(1, 2, a2N.getY());
-
- // invert that transformation, so we have a back-transformation from texture coordinates
- // to unit coordinates
- a2D.invert();
- a2DHatchLines.transform(a2D);
-
- // expand back-transformated geometry tpo 3D
- basegfx::B3DPolyPolygon a3DHatchLines(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0));
-
- // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents
- // a coordinate system transformation from unit coordinates to the object's 3d coordinate system
- basegfx::B3DHomMatrix a3D;
- a3D.set(0, 0, a3X.getX());
- a3D.set(1, 0, a3X.getY());
- a3D.set(2, 0, a3X.getZ());
- a3D.set(0, 1, a3Y.getX());
- a3D.set(1, 1, a3Y.getY());
- a3D.set(2, 1, a3Y.getZ());
- a3D.set(0, 3, a3N.getX());
- a3D.set(1, 3, a3N.getY());
- a3D.set(2, 3, a3N.getZ());
-
- // transform hatch lines to 3D object coordinates
- a3DHatchLines.transform(a3D);
-
- // build primitives from this geometry
- const sal_uInt32 nHatchLines(a3DHatchLines.count());
-
- for(a = 0L; a < nHatchLines; a++)
- {
- basePrimitive3D* pNew = new polygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(a), aHatchColor);
- rDest.push_back(referencedPrimitive3D(*pNew));
- }
+ // add reference to result
+ aDestination.push_back(xReference);
+ break;
}
}
}
-
- if(maHatch.isFillBackground())
+ else
{
- // add original primitive for background
- rDest.push_back(rCandidate);
+ // unknown implementation, add to result
+ aDestination.push_back(xReference);
}
-
- break;
}
+ }
- default:
- {
- // add to destination
- rDest.push_back(rCandidate);
- break;
- }
+ // prepare return value
+ const sal_uInt32 nDestSize(aDestination.size());
+ aRetval.realloc(nDestSize);
+
+ for(sal_uInt32 b(0L); b < nDestSize; b++)
+ {
+ aRetval[b] = aDestination[b];
}
}
- }
- void hatchTexturePrimitive3D::decompose(primitiveVector3D& rTarget)
- {
- if(maPrimitiveVector.size())
- {
- // create decomposition
- primitiveVector3D aNewPrimitiveVector;
- impCreateDecomposition(maPrimitiveVector, aNewPrimitiveVector);
- rTarget.insert(rTarget.end(), aNewPrimitiveVector.begin(), aNewPrimitiveVector.end());
- }
+ return aRetval;
}
- hatchTexturePrimitive3D::hatchTexturePrimitive3D(
- const attribute::fillHatchAttribute& rHatch,
- const primitiveVector3D& rPrimitiveVector,
+ HatchTexturePrimitive3D::HatchTexturePrimitive3D(
+ const attribute::FillHatchAttribute& rHatch,
+ const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate,
bool bFilter)
- : texturePrimitive3D(rPrimitiveVector, rTextureSize, bModulate, bFilter),
+ : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
maHatch(rHatch)
{
}
- hatchTexturePrimitive3D::~hatchTexturePrimitive3D()
- {
- }
-
- bool hatchTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool HatchTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(texturePrimitive3D::operator==(rPrimitive))
+ if(TexturePrimitive3D::operator==(rPrimitive))
{
- const hatchTexturePrimitive3D& rCompare = (hatchTexturePrimitive3D&)rPrimitive;
- return (maHatch == rCompare.maHatch);
+ const HatchTexturePrimitive3D& rCompare = (HatchTexturePrimitive3D&)rPrimitive;
+
+ return (getHatch() == rCompare.getHatch());
}
return false;
}
- PrimitiveID hatchTexturePrimitive3D::getID() const
+ sal_uInt32 HatchTexturePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('H', 'A', 'X', '3');
+ return Create3DPrimitiveID('3','H','T','e');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk
index dcb84b36d464..d30d1dd942f5 100644
--- a/drawinglayer/source/primitive3d/makefile.mk
+++ b/drawinglayer/source/primitive3d/makefile.mk
@@ -4,9 +4,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3 $
+# $Revision: 1.4 $
#
-# last change: $Author: aw $ $Date: 2006-08-09 16:51:14 $
+# last change: $Author: aw $ $Date: 2006-10-19 10:38:32 $
#
# The Contents of this file are made available subject to
# the terms of GNU Lesser General Public License Version 2.1.
@@ -36,6 +36,7 @@
PRJ=..$/..
PRJNAME=drawinglayer
TARGET=primitive3d
+ENABLE_EXCEPTIONS=TRUE
# --- Settings ----------------------------------
@@ -44,25 +45,25 @@ TARGET=primitive3d
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/primitive3d.obj \
- $(SLO)$/vectorprimitive3d.obj \
- $(SLO)$/shadowprimitive3d.obj \
- $(SLO)$/textureprimitive3d.obj \
+ $(SLO)$/baseprimitive3d.obj \
+ $(SLO)$/groupprimitive3d.obj \
$(SLO)$/hatchtextureprimitive3d.obj \
- $(SLO)$/polygontubeprimitive3d.obj \
- $(SLO)$/polygonprimitive3d.obj \
+ $(SLO)$/modifiedcolorprimitive3d.obj \
$(SLO)$/polypolygonprimitive3d.obj \
- $(SLO)$/transformprimitive3d.obj \
+ $(SLO)$/polygonprimitive3d.obj \
+ $(SLO)$/polygontubeprimitive3d.obj \
+ $(SLO)$/sdrcubeprimitive3d.obj \
$(SLO)$/sdrdecompositiontools3d.obj \
$(SLO)$/sdrextrudelathetools3d.obj \
- $(SLO)$/sdrprimitive3d.obj \
- $(SLO)$/sdrlabelprimitive3d.obj \
- $(SLO)$/sdrcubeprimitive3d.obj \
$(SLO)$/sdrextrudeprimitive3d.obj \
- $(SLO)$/sdrsphereprimitive3d.obj \
+ $(SLO)$/sdrlabelprimitive3d.obj \
$(SLO)$/sdrlatheprimitive3d.obj \
- $(SLO)$/sdrpolygonprimitive3d.obj \
- $(SLO)$/modifiedcolorprimitive3d.obj
+ $(SLO)$/sdrpolypolygonprimitive3d.obj \
+ $(SLO)$/sdrprimitive3d.obj \
+ $(SLO)$/sdrsphereprimitive3d.obj \
+ $(SLO)$/shadowprimitive3d.obj \
+ $(SLO)$/textureprimitive3d.obj \
+ $(SLO)$/transformprimitive3d.obj
# --- Targets ----------------------------------
diff --git a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
index 0d5d911919d3..e96d54b9e512 100644
--- a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: modifiedcolorprimitive3d.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:32 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,42 +33,43 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- modifiedColorPrimitive3D::modifiedColorPrimitive3D(
- const primitiveVector3D& rPrimitiveVector,
+ ModifiedColorPrimitive3D::ModifiedColorPrimitive3D(
+ const Primitive3DSequence& rChildren,
const basegfx::BColorModifier& rColorModifier)
- : vectorPrimitive3D(rPrimitiveVector),
+ : GroupPrimitive3D(rChildren),
maColorModifier(rColorModifier)
{
}
- modifiedColorPrimitive3D::~modifiedColorPrimitive3D()
+ bool ModifiedColorPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool modifiedColorPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(vectorPrimitive3D::operator==(rPrimitive))
+ if(GroupPrimitive3D::operator==(rPrimitive))
{
- const modifiedColorPrimitive3D& rCompare = (modifiedColorPrimitive3D&)rPrimitive;
+ const ModifiedColorPrimitive3D& rCompare = (ModifiedColorPrimitive3D&)rPrimitive;
+
return (maColorModifier == rCompare.maColorModifier);
}
return false;
}
- PrimitiveID modifiedColorPrimitive3D::getID() const
+ sal_uInt32 ModifiedColorPrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('M', 'C', 'L', '3');
+ return Create3DPrimitiveID('3','M','C','o');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
index 435ccca60716..753eecfac098 100644
--- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: polygonprimitive3d.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:32 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,7 +33,7 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#endif
@@ -41,52 +41,58 @@
#include <basegfx/polygon/b3dpolygontools.hxx>
#endif
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
+#endif
+
#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polygontubeprimitive3d.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- polygonHairlinePrimitive3D::polygonHairlinePrimitive3D(const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor)
- : basePrimitive3D(),
+ PolygonHairlinePrimitive3D::PolygonHairlinePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const basegfx::BColor& rBColor)
+ : BasePrimitive3D(),
maPolygon(rPolygon),
maBColor(rBColor)
{
}
- polygonHairlinePrimitive3D::~polygonHairlinePrimitive3D()
+ bool PolygonHairlinePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool polygonHairlinePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(getID() == rPrimitive.getID())
+ if(BasePrimitive3D::operator==(rPrimitive))
{
- const polygonHairlinePrimitive3D& rCompare = (polygonHairlinePrimitive3D&)rPrimitive;
+ const PolygonHairlinePrimitive3D& rCompare = (PolygonHairlinePrimitive3D&)rPrimitive;
- return (maPolygon == rCompare.maPolygon
- && maBColor == rCompare.maBColor);
+ return (getB3DPolygon() == rCompare.getB3DPolygon()
+ && getBColor() == rCompare.getBColor());
}
return false;
}
- PrimitiveID polygonHairlinePrimitive3D::getID() const
+ basegfx::B3DRange PolygonHairlinePrimitive3D::getB3DRange(double /*fTime*/) const
{
- return CreatePrimitiveID('P', 'O', 'H', '3');
+ return basegfx::tools::getRange(getB3DPolygon());
}
- basegfx::B3DRange polygonHairlinePrimitive3D::get3DRange() const
+ sal_uInt32 PolygonHairlinePrimitive3D::getPrimitiveID() const
{
- return basegfx::tools::getRange(maPolygon);
+ return Create3DPrimitiveID('3','P','H','a');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
@@ -97,34 +103,37 @@ namespace drawinglayer
{
namespace primitive3d
{
- void polygonStrokePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence PolygonStrokePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
- if(maPolygon.count())
+ Primitive3DSequence aRetval;
+
+ if(getB3DPolygon().count())
{
- basegfx::B3DPolyPolygon aHairLinePolyPolygon(maPolygon);
+ basegfx::B3DPolyPolygon aHairLinePolyPolygon(getB3DPolygon());
- if(0.0 != maStrokeAttribute.getFullDotDashLen())
+ if(0.0 != getStrokeAttribute().getFullDotDashLen())
{
// apply LineStyle
- aHairLinePolyPolygon = basegfx::tools::applyLineDashing(aHairLinePolyPolygon, maStrokeAttribute.getDotDashArray(), maStrokeAttribute.getFullDotDashLen());
+ aHairLinePolyPolygon = basegfx::tools::applyLineDashing(aHairLinePolyPolygon, getStrokeAttribute().getDotDashArray(), getStrokeAttribute().getFullDotDashLen());
// merge LineStyle polygons to bigger parts
aHairLinePolyPolygon = basegfx::tools::mergeDashedLines(aHairLinePolyPolygon);
}
- if(maStrokeAttribute.getWidth())
+ // prepare result
+ aRetval.realloc(aHairLinePolyPolygon.count());
+
+ if(getStrokeAttribute().getWidth())
{
// create fat line data
- const double fRadius(maStrokeAttribute.getWidth() / 2.0);
- const basegfx::tools::B2DLineJoin aLineJoin(maStrokeAttribute.getLineJoin());
+ const double fRadius(getStrokeAttribute().getWidth() / 2.0);
+ const basegfx::tools::B2DLineJoin aLineJoin(getStrokeAttribute().getLineJoin());
for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++)
{
// create tube primitives
- polygonTubePrimitive3D* pNew = new polygonTubePrimitive3D(aHairLinePolyPolygon.getB3DPolygon(a),
- maStrokeAttribute.getColor(),
- fRadius, aLineJoin);
- rTarget.push_back(referencedPrimitive3D(*pNew));
+ const Primitive3DReference xRef(new PolygonTubePrimitive3D(aHairLinePolyPolygon.getB3DPolygon(a), getStrokeAttribute().getColor(), fRadius, aLineJoin));
+ aRetval[a] = xRef;
}
}
else
@@ -133,42 +142,40 @@ namespace drawinglayer
for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++)
{
const basegfx::B3DPolygon aCandidate = aHairLinePolyPolygon.getB3DPolygon(a);
- basePrimitive3D* pNew = new polygonHairlinePrimitive3D(aCandidate, maStrokeAttribute.getColor());
- rTarget.push_back(referencedPrimitive3D(*pNew));
+ const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(aCandidate, getStrokeAttribute().getColor()));
+ aRetval[a] = xRef;
}
}
}
+
+ return aRetval;
}
- polygonStrokePrimitive3D::polygonStrokePrimitive3D(
+ PolygonStrokePrimitive3D::PolygonStrokePrimitive3D(
const basegfx::B3DPolygon& rPolygon,
- const attribute::strokeAttribute& rStrokeAttribute)
- : basePrimitive3D(),
+ const attribute::StrokeAttribute& rStrokeAttribute)
+ : BasePrimitive3D(),
maPolygon(rPolygon),
maStrokeAttribute(rStrokeAttribute)
{
}
- polygonStrokePrimitive3D::~polygonStrokePrimitive3D()
- {
- }
-
- bool polygonStrokePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool PolygonStrokePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(getID() == rPrimitive.getID())
+ if(BasePrimitive3D::operator==(rPrimitive))
{
- const polygonStrokePrimitive3D& rCompare = (polygonStrokePrimitive3D&)rPrimitive;
+ const PolygonStrokePrimitive3D& rCompare = (PolygonStrokePrimitive3D&)rPrimitive;
- return (maPolygon == rCompare.maPolygon
- && maStrokeAttribute == rCompare.maStrokeAttribute);
+ return (getB3DPolygon() == rCompare.getB3DPolygon()
+ && getStrokeAttribute() == rCompare.getStrokeAttribute());
}
return false;
}
- PrimitiveID polygonStrokePrimitive3D::getID() const
+ sal_uInt32 PolygonStrokePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('P', 'L', 'S', '3');
+ return Create3DPrimitiveID('3','P','S','t');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
index 7b18f2b4030a..3eaf0e695758 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: polygontubeprimitive3d.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2006-09-27 16:33:17 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,35 +33,31 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polygontubeprimitive3d.hxx>
#endif
-#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
-#include <basegfx/polygon/b3dpolypolygon.hxx>
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+#include <drawinglayer/attribute/materialattribute3d.hxx>
#endif
#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX
#include <basegfx/matrix/b3dhommatrix.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
-#include <drawinglayer/attribute/materialattribute3d.hxx>
+#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
+#include <basegfx/polygon/b3dpolypolygon.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#endif
-#ifndef _OSL_MUTEX_HXX_
-#include <osl/mutex.hxx>
-#endif
-
#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#endif
@@ -73,14 +69,14 @@ namespace drawinglayer
{
namespace // anonymous namespace
{
- const primitiveVector3D& getLineTubeSegments(
+ Primitive3DSequence getLineTubeSegments(
sal_uInt32 nSegments,
- const attribute::materialAttribute3D& rMaterial)
+ const attribute::MaterialAttribute3D& rMaterial)
{
// static data for buffered tube primitives
- static primitiveVector3D aLineTubeList;
+ static Primitive3DSequence aLineTubeList;
static sal_uInt32 nLineTubeSegments(0L);
- static attribute::materialAttribute3D aLineMaterial;
+ static attribute::MaterialAttribute3D aLineMaterial;
// may exclusively change static data, use mutex
::osl::Mutex m_mutex;
@@ -89,10 +85,10 @@ namespace drawinglayer
{
nLineTubeSegments = nSegments;
aLineMaterial = rMaterial;
- aLineTubeList.clear();
+ aLineTubeList = Primitive3DSequence();
}
- if(0L == aLineTubeList.size() && 0L != nLineTubeSegments)
+ if(!aLineTubeList.hasElements() && 0L != nLineTubeSegments)
{
const basegfx::B3DPoint aLeft(0.0, 0.0, 0.0);
const basegfx::B3DPoint aRight(1.0, 0.0, 0.0);
@@ -100,6 +96,7 @@ namespace drawinglayer
basegfx::B3DPoint aLastRight(1.0, 1.0, 0.0);
basegfx::B3DHomMatrix aRot;
aRot.rotate(F_2PI / (double)nLineTubeSegments, 0.0, 0.0);
+ aLineTubeList.realloc(nLineTubeSegments);
for(sal_uInt32 a(0L); a < nLineTubeSegments; a++)
{
@@ -122,8 +119,8 @@ namespace drawinglayer
aNewPolygon.setClosed(true);
const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
- basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false);
- aLineTubeList.push_back(referencedPrimitive3D(*pNew));
+ const Primitive3DReference xRef(new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false));
+ aLineTubeList[a] = xRef;
aLastLeft = aNextLeft;
aLastRight = aNextRight;
@@ -133,14 +130,14 @@ namespace drawinglayer
return aLineTubeList;
}
- const primitiveVector3D& getLineCapSegments(
+ Primitive3DSequence getLineCapSegments(
sal_uInt32 nSegments,
- const attribute::materialAttribute3D& rMaterial)
+ const attribute::MaterialAttribute3D& rMaterial)
{
// static data for buffered tube primitives
- static primitiveVector3D aLineCapList;
+ static Primitive3DSequence aLineCapList;
static sal_uInt32 nLineCapSegments(0L);
- static attribute::materialAttribute3D aLineMaterial;
+ static attribute::MaterialAttribute3D aLineMaterial;
// may exclusively change static data, use mutex
::osl::Mutex m_mutex;
@@ -149,15 +146,16 @@ namespace drawinglayer
{
nLineCapSegments = nSegments;
aLineMaterial = rMaterial;
- aLineCapList.clear();
+ aLineCapList = Primitive3DSequence();
}
- if(0L == aLineCapList.size() && 0L != nLineCapSegments)
+ if(!aLineCapList.hasElements() && 0L != nLineCapSegments)
{
const basegfx::B3DPoint aNull(0.0, 0.0, 0.0);
basegfx::B3DPoint aLast(0.0, 1.0, 0.0);
basegfx::B3DHomMatrix aRot;
aRot.rotate(F_2PI / (double)nLineCapSegments, 0.0, 0.0);
+ aLineCapList.realloc(nLineCapSegments);
for(sal_uInt32 a(0L); a < nLineCapSegments; a++)
{
@@ -176,8 +174,8 @@ namespace drawinglayer
aNewPolygon.setClosed(true);
const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
- basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false);
- aLineCapList.push_back(referencedPrimitive3D(*pNew));
+ const Primitive3DReference xRef(new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false));
+ aLineCapList[a] = xRef;
aLast = aNext;
}
@@ -186,10 +184,9 @@ namespace drawinglayer
return aLineCapList;
}
- void getLineJoinSegments(
- primitiveVector3D& rDest,
+ Primitive3DSequence getLineJoinSegments(
sal_uInt32 nSegments,
- const attribute::materialAttribute3D& rMaterial,
+ const attribute::MaterialAttribute3D& rMaterial,
double fAngle,
double /*fDegreeStepWidth*/,
double fMiterMinimumAngle,
@@ -197,6 +194,7 @@ namespace drawinglayer
{
// nSegments is for whole circle, adapt to half circle
const sal_uInt32 nVerSeg(nSegments >> 1L);
+ std::vector< BasePrimitive3D* > aResultVector;
if(nVerSeg)
{
@@ -214,8 +212,8 @@ namespace drawinglayer
{
const basegfx::B3DPolygon aPartPolygon(aSphere.getB3DPolygon(a));
const basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon);
- basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false);
- rDest.push_back(referencedPrimitive3D(*pNew));
+ BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false);
+ aResultVector.push_back(pNew);
}
}
else
@@ -363,8 +361,8 @@ namespace drawinglayer
if(aNewPolygon.count())
{
const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
- basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false);
- rDest.push_back(referencedPrimitive3D(*pNew));
+ BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false);
+ aResultVector.push_back(pNew);
}
if(bMiter && aMiterPolygon.count())
@@ -377,8 +375,8 @@ namespace drawinglayer
// create primitive
const basegfx::B3DPolyPolygon aMiterPolyPolygon(aMiterPolygon);
- basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false);
- rDest.push_back(referencedPrimitive3D(*pNew));
+ BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false);
+ aResultVector.push_back(pNew);
}
// prepare next step
@@ -395,6 +393,15 @@ namespace drawinglayer
}
}
}
+
+ Primitive3DSequence aRetval(aResultVector.size());
+
+ for(sal_uInt32 a(0L); a < aResultVector.size(); a++)
+ {
+ aRetval[a] = Primitive3DReference(aResultVector[a]);
+ }
+
+ return aRetval;
}
basegfx::B3DHomMatrix getRotationFromVector(const basegfx::B3DVector& rVector)
@@ -418,30 +425,35 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- void polygonTubePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence PolygonTubePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
- const sal_uInt32 nPointCount(maPolygon.count());
+ const sal_uInt32 nPointCount(getB3DPolygon().count());
+ std::vector< BasePrimitive3D* > aResultVector;
if(0L != nPointCount)
{
- if(basegfx::fTools::more(mfRadius, 0.0))
+ if(basegfx::fTools::more(getRadius(), 0.0))
{
- const attribute::materialAttribute3D aMaterial(maBColor);
+ const attribute::MaterialAttribute3D aMaterial(getBColor());
static sal_uInt32 nSegments(8L); // default for 3d line segments, for more quality just raise this value (in even steps)
- const bool bClosed(maPolygon.isClosed());
- const bool bNoLineJoin(basegfx::tools::B2DLINEJOIN_NONE == maLineJoin);
+ const bool bClosed(getB3DPolygon().isClosed());
+ const bool bNoLineJoin(basegfx::tools::B2DLINEJOIN_NONE == getLineJoin());
const sal_uInt32 nLoopCount(bClosed ? nPointCount : nPointCount - 1L);
- basegfx::B3DPoint aLast(maPolygon.getB3DPoint(nPointCount - 1L));
- basegfx::B3DPoint aCurr(maPolygon.getB3DPoint(0L));
+ basegfx::B3DPoint aLast(getB3DPolygon().getB3DPoint(nPointCount - 1L));
+ basegfx::B3DPoint aCurr(getB3DPolygon().getB3DPoint(0L));
for(sal_uInt32 a(0L); a < nLoopCount; a++)
{
// get next data
- const basegfx::B3DPoint aNext(maPolygon.getB3DPoint((a + 1L) % nPointCount));
+ const basegfx::B3DPoint aNext(getB3DPolygon().getB3DPoint((a + 1L) % nPointCount));
const basegfx::B3DVector aForw(aNext - aCurr);
const double fForwLen(aForw.getLength());
@@ -452,15 +464,15 @@ namespace drawinglayer
// create default transformation with scale and rotate
basegfx::B3DHomMatrix aVectorTrans;
- aVectorTrans.scale(fForwLen, mfRadius, mfRadius);
+ aVectorTrans.scale(fForwLen, getRadius(), getRadius());
aVectorTrans *= aRotVector;
aVectorTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ());
if(bNoLineJoin || (!bClosed && !a))
{
// line start edge, build transformed primitiveVector3D
- transformPrimitive3D* pNewTransformedA = new transformPrimitive3D(aVectorTrans, getLineCapSegments(nSegments, aMaterial));
- rTarget.push_back(referencedPrimitive3D(*pNewTransformedA));
+ TransformPrimitive3D* pNewTransformedA = new TransformPrimitive3D(aVectorTrans, getLineCapSegments(nSegments, aMaterial));
+ aResultVector.push_back(pNewTransformedA);
}
else
{
@@ -469,10 +481,9 @@ namespace drawinglayer
if(!basegfx::fTools::equalZero(fCross))
{
- // line connect non-parallel, aBack, aForw, use maLineJoin
- primitiveVector3D aNewList;
+ // line connect non-parallel, aBack, aForw, use getLineJoin()
const double fAngle(acos(aBack.scalar(aForw) / (fForwLen * aBack.getLength()))); // 0.0 .. F_PI2
- getLineJoinSegments(aNewList, nSegments, aMaterial, fAngle, mfDegreeStepWidth, mfMiterMinimumAngle, maLineJoin);
+ Primitive3DSequence aNewList(getLineJoinSegments(nSegments, aMaterial, fAngle, getDegreeStepWidth(), getMiterMinimumAngle(), getLineJoin()));
// calculate transformation. First, get angle in YZ between nForw projected on (1, 0, 0) and nBack
basegfx::B3DHomMatrix aInvRotVector(aRotVector);
@@ -486,18 +497,18 @@ namespace drawinglayer
aSphereTrans.rotate(0.0, F_PI2, 0.0);
aSphereTrans.rotate(F_PI - fRotInYZ, 0.0, 0.0);
aSphereTrans *= aRotVector;
- aSphereTrans.scale(mfRadius, mfRadius, mfRadius);
+ aSphereTrans.scale(getRadius(), getRadius(), getRadius());
aSphereTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ());
// line start edge, build transformed primitiveVector3D
- transformPrimitive3D* pNewTransformedB = new transformPrimitive3D(aSphereTrans, aNewList);
- rTarget.push_back(referencedPrimitive3D(*pNewTransformedB));
+ TransformPrimitive3D* pNewTransformedB = new TransformPrimitive3D(aSphereTrans, aNewList);
+ aResultVector.push_back(pNewTransformedB);
}
}
// create line segments, build transformed primitiveVector3D
- transformPrimitive3D* pNewTransformedC = new transformPrimitive3D(aVectorTrans, getLineTubeSegments(nSegments, aMaterial));
- rTarget.push_back(referencedPrimitive3D(*pNewTransformedC));
+ TransformPrimitive3D* pNewTransformedC = new TransformPrimitive3D(aVectorTrans, getLineTubeSegments(nSegments, aMaterial));
+ aResultVector.push_back(pNewTransformedC);
if(bNoLineJoin || (!bClosed && ((a + 1L) == nLoopCount)))
{
@@ -505,13 +516,13 @@ namespace drawinglayer
basegfx::B3DHomMatrix aBackTrans;
aBackTrans.rotate(0.0, F_PI, 0.0);
aBackTrans.translate(1.0, 0.0, 0.0);
- aBackTrans.scale(fForwLen, mfRadius, mfRadius);
+ aBackTrans.scale(fForwLen, getRadius(), getRadius());
aBackTrans *= aRotVector;
aBackTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ());
// line end edge, build transformed primitiveVector3D
- transformPrimitive3D* pNewTransformedD = new transformPrimitive3D(aBackTrans, getLineCapSegments(nSegments, aMaterial));
- rTarget.push_back(referencedPrimitive3D(*pNewTransformedD));
+ TransformPrimitive3D* pNewTransformedD = new TransformPrimitive3D(aBackTrans, getLineCapSegments(nSegments, aMaterial));
+ aResultVector.push_back(pNewTransformedD);
}
}
@@ -523,19 +534,29 @@ namespace drawinglayer
else
{
// create hairline
- polygonHairlinePrimitive3D* pNew = new polygonHairlinePrimitive3D(maPolygon, maBColor);
- rTarget.push_back(referencedPrimitive3D(*pNew));
+ PolygonHairlinePrimitive3D* pNew = new PolygonHairlinePrimitive3D(getB3DPolygon(), getBColor());
+ aResultVector.push_back(pNew);
}
}
+
+ // prepare return value
+ Primitive3DSequence aRetval(aResultVector.size());
+
+ for(sal_uInt32 a(0L); a < aResultVector.size(); a++)
+ {
+ aRetval[a] = Primitive3DReference(aResultVector[a]);
+ }
+
+ return aRetval;
}
- polygonTubePrimitive3D::polygonTubePrimitive3D(
+ PolygonTubePrimitive3D::PolygonTubePrimitive3D(
const basegfx::B3DPolygon& rPolygon,
const basegfx::BColor& rBColor,
double fRadius, basegfx::tools::B2DLineJoin aLineJoin,
double fDegreeStepWidth,
double fMiterMinimumAngle)
- : polygonHairlinePrimitive3D(rPolygon, rBColor),
+ : PolygonHairlinePrimitive3D(rPolygon, rBColor),
mfRadius(fRadius),
mfDegreeStepWidth(fDegreeStepWidth),
mfMiterMinimumAngle(fMiterMinimumAngle),
@@ -543,28 +564,24 @@ namespace drawinglayer
{
}
- polygonTubePrimitive3D::~polygonTubePrimitive3D()
- {
- }
-
- bool polygonTubePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool PolygonTubePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(polygonHairlinePrimitive3D::operator==(rPrimitive))
+ if(PolygonHairlinePrimitive3D::operator==(rPrimitive))
{
- const polygonTubePrimitive3D& rCompare = (polygonTubePrimitive3D&)rPrimitive;
+ const PolygonTubePrimitive3D& rCompare = (PolygonTubePrimitive3D&)rPrimitive;
- return (mfRadius == rCompare.mfRadius
- && mfDegreeStepWidth == rCompare.mfDegreeStepWidth
- && mfMiterMinimumAngle == rCompare.mfMiterMinimumAngle
- && maLineJoin == rCompare.maLineJoin);
+ return (getRadius() == rCompare.getRadius()
+ && getDegreeStepWidth() == rCompare.getDegreeStepWidth()
+ && getMiterMinimumAngle() == rCompare.getMiterMinimumAngle()
+ && getLineJoin() == rCompare.getLineJoin());
}
return false;
}
- PrimitiveID polygonTubePrimitive3D::getID() const
+ sal_uInt32 PolygonTubePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('T', 'U', 'B', '3');
+ return Create3DPrimitiveID('3','P','T','u');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx
index 6e838043762b..ff7aba0a8fbc 100644
--- a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: polypolygonprimitive3d.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,7 +33,7 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#endif
@@ -41,49 +41,53 @@
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive3d
{
- polyPolygonMaterialPrimitive3D::polyPolygonMaterialPrimitive3D(
+ PolyPolygonMaterialPrimitive3D::PolyPolygonMaterialPrimitive3D(
const basegfx::B3DPolyPolygon& rPolyPolygon,
- const attribute::materialAttribute3D& rMaterial,
+ const attribute::MaterialAttribute3D& rMaterial,
bool bDoubleSided)
- : basePrimitive3D(),
+ : BasePrimitive3D(),
maPolyPolygon(rPolyPolygon),
maMaterial(rMaterial),
mbDoubleSided(bDoubleSided)
{
}
- polyPolygonMaterialPrimitive3D::~polyPolygonMaterialPrimitive3D()
- {
- }
-
- bool polyPolygonMaterialPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool PolyPolygonMaterialPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(getID() == rPrimitive.getID())
+ if(BasePrimitive3D::operator==(rPrimitive))
{
- const polyPolygonMaterialPrimitive3D& rCompare = (polyPolygonMaterialPrimitive3D&)rPrimitive;
+ const PolyPolygonMaterialPrimitive3D& rCompare = (PolyPolygonMaterialPrimitive3D&)rPrimitive;
- return (maPolyPolygon == rCompare.maPolyPolygon
- && maMaterial == rCompare.maMaterial
- && mbDoubleSided == rCompare.mbDoubleSided);
+ return (getB3DPolyPolygon() == rCompare.getB3DPolyPolygon()
+ && getMaterial() == rCompare.getMaterial()
+ && getDoubleSided() == rCompare.getDoubleSided());
}
return false;
}
- PrimitiveID polyPolygonMaterialPrimitive3D::getID() const
+ basegfx::B3DRange PolyPolygonMaterialPrimitive3D::getB3DRange(double /*fTime*/) const
{
- return CreatePrimitiveID('P', 'O', 'M', '3');
+ return basegfx::tools::getRange(getB3DPolyPolygon());
}
- basegfx::B3DRange polyPolygonMaterialPrimitive3D::get3DRange() const
+ sal_uInt32 PolyPolygonMaterialPrimitive3D::getPrimitiveID() const
{
- return basegfx::tools::getRange(maPolyPolygon);
+ return Create3DPrimitiveID('3','P','P','M');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
index aa2a43198df4..7fe1b1fd896d 100644
--- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrcubeprimitive3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,37 +33,33 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/sdrcubeprimitive3d.hxx>
#endif
-#ifndef _BGFX_RANGE_B3DRANGE_HXX
-#include <basegfx/range/b3drange.hxx>
+#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
-#include <basegfx/polygon/b3dpolypolygon.hxx>
+#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
+#include <basegfx/polygon/b3dpolygon.hxx>
#endif
-#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#endif
-#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
-#include <basegfx/polygon/b3dpolygon.hxx>
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
#endif
-#ifndef _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b3dpolygontools.hxx>
-#endif
+//////////////////////////////////////////////////////////////////////////////
-#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#endif
+using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
@@ -71,9 +67,10 @@ namespace drawinglayer
{
namespace primitive3d
{
- void sdrCubePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence SdrCubePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
+ Primitive3DSequence aRetval;
// add fill
if(getSdrLFSAttribute().getFill())
@@ -157,7 +154,7 @@ namespace drawinglayer
// transform texture coordinates to texture size
basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY());
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
aFill.transformTextureCoordiantes(aTexMatrix);
}
@@ -170,8 +167,8 @@ namespace drawinglayer
}
// create single PolyPolygonFill primitives
- add3DPolyPolygonFillPrimitive(
- a3DPolyPolygonVector, maTransform, maTextureSize, rTarget,
+ aRetval = create3DPolyPolygonFillPrimitives(
+ a3DPolyPolygonVector, getTransform(), getTextureSize(),
getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
@@ -180,40 +177,35 @@ namespace drawinglayer
if(getSdrLFSAttribute().getLine())
{
basegfx::B3DPolyPolygon aLine(basegfx::tools::createCubePolyPolygonFromB3DRange(aUnitRange));
- add3DPolyPolygonLinePrimitive(aLine, maTransform, rTarget, *getSdrLFSAttribute().getLine());
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
}
// add shadow
- if(getSdrLFSAttribute().getShadow())
+ if(getSdrLFSAttribute().getShadow() && aRetval.hasElements())
{
- addShadowPrimitive3D(rTarget, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D());
+ const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
}
+
+ return aRetval;
}
- sdrCubePrimitive3D::sdrCubePrimitive3D(
+ SdrCubePrimitive3D::SdrCubePrimitive3D(
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
- const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute,
- const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute)
- : sdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute)
- {
- }
-
- sdrCubePrimitive3D::~sdrCubePrimitive3D()
+ const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
+ : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute)
{
}
- bool sdrCubePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool SdrCubePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- return sdrPrimitive3D::operator==(rPrimitive);
+ return SdrPrimitive3D::operator==(rPrimitive);
}
- PrimitiveID sdrCubePrimitive3D::getID() const
- {
- return CreatePrimitiveID('S', 'C', 'U', '3');
- }
-
- basegfx::B3DRange sdrCubePrimitive3D::get3DRange() const
+ basegfx::B3DRange SdrCubePrimitive3D::getB3DRange(double /*fTime*/) const
{
// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2.
// The parent implementation which uses the ranges of the decomposition would be more
@@ -223,6 +215,11 @@ namespace drawinglayer
// has priority here.
return getStandard3DRange();
}
+
+ sal_uInt32 SdrCubePrimitive3D::getPrimitiveID() const
+ {
+ return Create3DPrimitiveID('3','C','u','b');
+ }
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
index 0e9c053b15cf..1593e3d8d319 100644
--- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrdecompositiontools3d.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,7 +33,7 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#endif
@@ -41,35 +41,31 @@
#include <basegfx/polygon/b3dpolygon.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
#include <drawinglayer/attribute/strokeattribute.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
#include <drawinglayer/attribute/sdrattribute.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_PRIMITIVE3D_HXX
-#include <drawinglayer/primitive3d/primitive3d.hxx>
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE_SIMPLETRANSPARENCEPRIMITIVE_HXX
-#include <drawinglayer/primitive/simpletransparenceprimitive.hxx>
-#endif
-
#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
#include <basegfx/polygon/b3dpolypolygon.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE_HXX
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
#include <drawinglayer/attribute/sdrattribute.hxx>
#endif
@@ -77,15 +73,15 @@
#include <vcl/vclenum.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX
#include <drawinglayer/attribute/fillattribute.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
#endif
@@ -97,80 +93,81 @@
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/textureprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/shadowprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX
#include <drawinglayer/attribute/sdrattribute3d.hxx>
#endif
+#ifndef _BGFX_RANGE_B2DRANGE_HXX
+#include <basegfx/range/b2drange.hxx>
+#endif
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive3d
{
- void add3DPolyPolygonLinePrimitive(
+ Primitive3DSequence create3DPolyPolygonLinePrimitives(
const basegfx::B3DPolyPolygon& rUnitPolyPolygon,
const basegfx::B3DHomMatrix& rObjectTransform,
- primitiveVector3D& rTarget,
- const attribute::sdrLineAttribute& rLine)
+ const attribute::SdrLineAttribute& rLine)
{
// prepare fully scaled polyPolygon
basegfx::B3DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
aScaledPolyPolygon.transform(rObjectTransform);
// create stroke attribute
- const attribute::strokeAttribute aStrokeAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getDotDashArray(), rLine.getFullDotDashLen());
+ const attribute::StrokeAttribute aStrokeAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getDotDashArray(), rLine.getFullDotDashLen());
// create primitives
- primitiveVector3D aNewPrimitiveVector;
+ Primitive3DSequence aRetval(aScaledPolyPolygon.count());
for(sal_uInt32 a(0L); a < aScaledPolyPolygon.count(); a++)
{
- basePrimitive3D* pNewLinePrimitive = new polygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aStrokeAttribute);
- aNewPrimitiveVector.push_back(referencedPrimitive3D(*pNewLinePrimitive));
+ const Primitive3DReference xRef(new PolygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aStrokeAttribute));
+ aRetval[a] = xRef;
}
if(0.0 != rLine.getTransparence())
{
- // create simpleTransparencePrimitive, add created fill primitives
- basePrimitive3D* pNewSimpleTransparenceTexturePrimitive3D = new simpleTransparenceTexturePrimitive3D(rLine.getTransparence(), aNewPrimitiveVector);
- rTarget.push_back(referencedPrimitive3D(*pNewSimpleTransparenceTexturePrimitive3D));
- }
- else
- {
- // add to decomposition
- rTarget.insert(rTarget.end(), aNewPrimitiveVector.begin(), aNewPrimitiveVector.end());
+ // create UnifiedAlphaTexturePrimitive3D, add created primitives and exchange
+ const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rLine.getTransparence(), aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
}
+
+ return aRetval;
}
- void add3DPolyPolygonFillPrimitive(
+ Primitive3DSequence create3DPolyPolygonFillPrimitives(
const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector,
const basegfx::B3DHomMatrix& rObjectTransform,
const basegfx::B2DVector& rTextureSize,
- primitiveVector3D& rTarget,
- const attribute::sdr3DObjectAttribute& aSdr3DObjectAttribute,
- const attribute::sdrFillAttribute& rFill,
- const attribute::fillGradientAttribute* pFillGradient)
+ const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute,
+ const attribute::SdrFillAttribute& rFill,
+ const attribute::FillGradientAttribute* pFillGradient)
{
+ Primitive3DSequence aRetval;
+
if(r3DPolyPolygonVector.size())
{
// create list of simple fill primitives
- primitiveVector3D aNewPrimitiveVector;
+ aRetval.realloc(r3DPolyPolygonVector.size());
for(sal_uInt32 a(0L); a < r3DPolyPolygonVector.size(); a++)
{
@@ -183,11 +180,11 @@ namespace drawinglayer
aScaledPolyPolygon.transformNormals(rObjectTransform);
}
- basePrimitive3D* pNewFillPrimitive = new polyPolygonMaterialPrimitive3D(
+ const Primitive3DReference xRef(new PolyPolygonMaterialPrimitive3D(
aScaledPolyPolygon,
aSdr3DObjectAttribute.getMaterial(),
- aSdr3DObjectAttribute.getDoubleSided());
- aNewPrimitiveVector.push_back(referencedPrimitive3D(*pNewFillPrimitive));
+ aSdr3DObjectAttribute.getDoubleSided()));
+ aRetval[a] = xRef;
}
// look for and evtl. build texture sub-group primitive
@@ -195,79 +192,75 @@ namespace drawinglayer
{
bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode());
bool bFilter(aSdr3DObjectAttribute.getTextureFilter());
- basePrimitive3D* pNewTexturePrimitive3D = 0L;
+ BasePrimitive3D* pNewTexturePrimitive3D = 0L;
if(rFill.isGradient())
{
- // create gradientTexture3D with sublist, add to local aNewPrimitiveVector
- pNewTexturePrimitive3D = new gradientTexturePrimitive3D(*rFill.getGradient(), aNewPrimitiveVector, rTextureSize, bModulate, bFilter);
+ // create gradientTexture3D with sublist, add to local aRetval
+ pNewTexturePrimitive3D = new GradientTexturePrimitive3D(*rFill.getGradient(), aRetval, rTextureSize, bModulate, bFilter);
}
else if(rFill.isHatch())
{
- // create hatchTexture3D with sublist, add to local aNewPrimitiveVector
- pNewTexturePrimitive3D = new hatchTexturePrimitive3D(*rFill.getHatch(), aNewPrimitiveVector, rTextureSize, bModulate, bFilter);
+ // create hatchTexture3D with sublist, add to local aRetval
+ pNewTexturePrimitive3D = new HatchTexturePrimitive3D(*rFill.getHatch(), aRetval, rTextureSize, bModulate, bFilter);
}
else // if(rFill.isBitmap())
{
- // create bitmapTexture3D with sublist, add to local aNewPrimitiveVector
+ // create bitmapTexture3D with sublist, add to local aRetval
basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY());
- pNewTexturePrimitive3D = new bitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aNewPrimitiveVector, rTextureSize, bModulate, bFilter);
+ pNewTexturePrimitive3D = new BitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aRetval, rTextureSize, bModulate, bFilter);
}
- // exchange aNewPrimitiveVector content with texture group
- aNewPrimitiveVector.clear();
- aNewPrimitiveVector.push_back(referencedPrimitive3D(*pNewTexturePrimitive3D));
+ // exchange aRetval content with texture group
+ const Primitive3DReference xRef(pNewTexturePrimitive3D);
+ aRetval = Primitive3DSequence(&xRef, 1L);
if(::com::sun::star::drawing::TextureKind2_LUMINANCE == aSdr3DObjectAttribute.getTextureKind())
{
// use modified color primitive to force textures to gray
const basegfx::BColorModifier aBColorModifier(basegfx::BColor(), 0.0, basegfx::BCOLORMODIFYMODE_GRAY);
- basePrimitive3D* pModifiedColor = new modifiedColorPrimitive3D(aNewPrimitiveVector, aBColorModifier);
- aNewPrimitiveVector.clear();
- aNewPrimitiveVector.push_back(referencedPrimitive3D(*pModifiedColor));
+ const Primitive3DReference xRef2(new ModifiedColorPrimitive3D(aRetval, aBColorModifier));
+ aRetval = Primitive3DSequence(&xRef2, 1L);
}
}
if(0.0 != rFill.getTransparence())
{
- // create simpleTransparenceTexturePrimitive3D with sublist and append
- basePrimitive3D* pNewSimpleTransparenceTexturePrimitive3D = new simpleTransparenceTexturePrimitive3D(rFill.getTransparence(), aNewPrimitiveVector);
- rTarget.push_back(referencedPrimitive3D(*pNewSimpleTransparenceTexturePrimitive3D));
+ // create UnifiedAlphaTexturePrimitive3D with sublist and exchange
+ const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rFill.getTransparence(), aRetval));
+ aRetval = Primitive3DSequence(&xRef, 1L);
}
else if(pFillGradient)
{
- // create transparenceTexture3D with sublist and append
- basePrimitive3D* pNewTransparenceTexturePrimitive3D = new transparenceTexturePrimitive3D(*pFillGradient, aNewPrimitiveVector, rTextureSize);
- rTarget.push_back(referencedPrimitive3D(*pNewTransparenceTexturePrimitive3D));
- }
- else
- {
- // append list
- rTarget.insert(rTarget.end(), aNewPrimitiveVector.begin(), aNewPrimitiveVector.end());
+ // create AlphaTexturePrimitive3D with sublist and exchange
+ const Primitive3DReference xRef(new AlphaTexturePrimitive3D(*pFillGradient, aRetval, rTextureSize));
+ aRetval = Primitive3DSequence(&xRef, 1L);
}
}
+
+ return aRetval;
}
- void addShadowPrimitive3D(
- primitiveVector3D& rTarget,
- const attribute::sdrShadowAttribute& rShadow,
+ Primitive3DSequence createShadowPrimitive3D(
+ const Primitive3DSequence& rSource,
+ const attribute::SdrShadowAttribute& rShadow,
bool bShadow3D)
{
- // create Shadow primitives. Need to be added in front, should use already created primitives
- if(rTarget.size() && !basegfx::fTools::moreOrEqual(rShadow.getTransparence(), 1.0))
+ // create Shadow primitives. Uses already created primitives
+ if(rSource.hasElements() && !basegfx::fTools::moreOrEqual(rShadow.getTransparence(), 1.0))
{
// prepare new list for shadow geometry
- primitiveVector3D aNewList;
-
- // prepare shadow offset
- basegfx::B2DHomMatrix aShadowOffset;
+ basegfx::B2DHomMatrix aShadowOffset;
aShadowOffset.set(0, 2, rShadow.getOffset().getX());
aShadowOffset.set(1, 2, rShadow.getOffset().getY());
// create shadow primitive and add primitives
- shadowPrimitive3D* pNewShadow3D = new shadowPrimitive3D(aShadowOffset, rShadow.getColor(), rShadow.getTransparence(), bShadow3D, rTarget);
- rTarget.clear();
- rTarget.push_back(referencedPrimitive3D(*pNewShadow3D));
+ const Primitive3DReference xRef(new ShadowPrimitive3D(aShadowOffset, rShadow.getColor(), rShadow.getTransparence(), bShadow3D, rSource));
+ return Primitive3DSequence(&xRef, 1L);
+ }
+ else
+ {
+ return Primitive3DSequence();
}
}
} // end of namespace primitive3d
diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
index 98148757edf4..8474600605af 100644
--- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrextrudelathetools3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2006-09-27 16:33:18 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,7 +33,7 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx>
#endif
@@ -91,7 +91,9 @@ namespace
//////////////////////////////////////////////////////////////////////////////
// common helpers
- basegfx::B2DPolyPolygon impScalePolyPolygonOnCenter(const basegfx::B2DPolyPolygon& rSource, double fScale)
+ basegfx::B2DPolyPolygon impScalePolyPolygonOnCenter(
+ const basegfx::B2DPolyPolygon& rSource,
+ double fScale)
{
basegfx::B2DPolyPolygon aRetval(rSource);
@@ -110,7 +112,11 @@ namespace
return aRetval;
}
- void impGetOuterPolyPolygon(basegfx::B2DPolyPolygon& rPolygon, basegfx::B2DPolyPolygon& rOuterPolyPolygon, double fOffset, bool bCharacterMode)
+ void impGetOuterPolyPolygon(
+ basegfx::B2DPolyPolygon& rPolygon,
+ basegfx::B2DPolyPolygon& rOuterPolyPolygon,
+ double fOffset,
+ bool bCharacterMode)
{
rOuterPolyPolygon = rPolygon;
@@ -144,8 +150,14 @@ namespace
}
}
- void impAddInBetweenFill(basegfx::B3DPolyPolygon& rTarget, const basegfx::B3DPolyPolygon& rPolA, const basegfx::B3DPolyPolygon& rPolB,
- double fTexVerStart, double fTexVerStop, bool bCreateNormals, bool bCreateTextureCoordinates)
+ void impAddInBetweenFill(
+ basegfx::B3DPolyPolygon& rTarget,
+ const basegfx::B3DPolyPolygon& rPolA,
+ const basegfx::B3DPolyPolygon& rPolB,
+ double fTexVerStart,
+ double fTexVerStop,
+ bool bCreateNormals,
+ bool bCreateTextureCoordinates)
{
OSL_ENSURE(rPolA.count() == rPolB.count(), "impAddInBetweenFill: unequally sized polygons (!)");
const sal_uInt32 nPolygonCount(rPolA.count());
@@ -222,7 +234,9 @@ namespace
}
}
- void impSetNormal(basegfx::B3DPolyPolygon& rCandidate, const basegfx::B3DVector& rNormal)
+ void impSetNormal(
+ basegfx::B3DPolyPolygon& rCandidate,
+ const basegfx::B3DVector& rNormal)
{
for(sal_uInt32 a(0L); a < rCandidate.count(); a++)
{
@@ -237,7 +251,10 @@ namespace
}
}
- void impCreateInBetweenNormals(basegfx::B3DPolyPolygon& rPolA, basegfx::B3DPolyPolygon& rPolB, bool bSmoothHorizontalNormals)
+ void impCreateInBetweenNormals(
+ basegfx::B3DPolyPolygon& rPolA,
+ basegfx::B3DPolyPolygon& rPolB,
+ bool bSmoothHorizontalNormals)
{
OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)");
@@ -316,7 +333,10 @@ namespace
}
}
- void impMixNormals(basegfx::B3DPolyPolygon& rPolA, const basegfx::B3DPolyPolygon& rPolB, double fWeightA)
+ void impMixNormals(
+ basegfx::B3DPolyPolygon& rPolA,
+ const basegfx::B3DPolyPolygon& rPolB,
+ double fWeightA)
{
const double fWeightB(1.0 - fWeightA);
OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)");
@@ -340,7 +360,6 @@ namespace
rPolA.setB3DPolygon(a, aSubA);
}
}
-
} // end of anonymous namespace
//////////////////////////////////////////////////////////////////////////////
@@ -349,14 +368,21 @@ namespace drawinglayer
{
namespace primitive3d
{
- void createLatheSlices(sliceVector& rSliceVector, const basegfx::B2DPolyPolygon& rSource,
- double fBackScale, double fDiagonal, double fRotation, sal_uInt32 nSteps,
- bool bCharacterMode, bool bCloseFront, bool bCloseBack)
+ void createLatheSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fRotation,
+ sal_uInt32 nSteps,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack)
{
if(basegfx::fTools::equalZero(fRotation) || 0L == nSteps)
{
// no rotation or no steps, just one plane
- rSliceVector.push_back(slice(rSource, basegfx::B3DHomMatrix()));
+ rSliceVector.push_back(Slice3D(rSource, basegfx::B3DHomMatrix()));
}
else
{
@@ -398,7 +424,7 @@ namespace drawinglayer
impGetOuterPolyPolygon(aFront, aOuterFront, fOffsetLen, bCharacterMode);
basegfx::B3DHomMatrix aTransform;
aTransform.translate(0.0, 0.0, fOffsetLen);
- rSliceVector.push_back(slice(aOuterFront, aTransform, SLICETYPE_FRONTCAP));
+ rSliceVector.push_back(Slice3D(aOuterFront, aTransform, SLICETYPE3D_FRONTCAP));
}
if(bCloseBack)
@@ -413,7 +439,7 @@ namespace drawinglayer
// add start polygon (a = 0L)
if(!bClosedRotation)
{
- rSliceVector.push_back(slice(aFront, basegfx::B3DHomMatrix()));
+ rSliceVector.push_back(Slice3D(aFront, basegfx::B3DHomMatrix()));
}
// create segments (a + 1 .. nSteps)
@@ -425,24 +451,30 @@ namespace drawinglayer
basegfx::B2DPolyPolygon aNewPoly(bBackScale ? basegfx::tools::interpolate(aFront, aBack, fStep) : aFront);
basegfx::B3DHomMatrix aNewMat;
aNewMat.rotate(0.0, fRotation * fStep, 0.0);
- rSliceVector.push_back(slice(aNewPoly, aNewMat));
+ rSliceVector.push_back(Slice3D(aNewPoly, aNewMat));
}
if(bCloseBack)
{
- rSliceVector.push_back(slice(aOuterBack, aTransformBack, SLICETYPE_BACKCAP));
+ rSliceVector.push_back(Slice3D(aOuterBack, aTransformBack, SLICETYPE3D_BACKCAP));
}
}
}
- void createExtrudeSlices(sliceVector& rSliceVector, const basegfx::B2DPolyPolygon& rSource,
- double fBackScale, double fDiagonal, double fDepth,
- bool bCharacterMode, bool bCloseFront, bool bCloseBack)
+ void createExtrudeSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fDepth,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack)
{
if(basegfx::fTools::equalZero(fDepth))
{
// no depth, just one plane
- rSliceVector.push_back(slice(rSource, basegfx::B3DHomMatrix()));
+ rSliceVector.push_back(Slice3D(rSource, basegfx::B3DHomMatrix()));
}
else
{
@@ -474,7 +506,7 @@ namespace drawinglayer
impGetOuterPolyPolygon(aFront, aOuterFront, fOffset, bCharacterMode);
basegfx::B3DHomMatrix aTransformFront;
aTransformFront.translate(0.0, 0.0, fDepth);
- rSliceVector.push_back(slice(aOuterFront, aTransformFront, SLICETYPE_FRONTCAP));
+ rSliceVector.push_back(Slice3D(aOuterFront, aTransformFront, SLICETYPE3D_FRONTCAP));
}
if(bCloseBack)
@@ -489,26 +521,29 @@ namespace drawinglayer
basegfx::B3DHomMatrix aTransformA, aTransformB;
aTransformA.translate(0.0, 0.0, fZFront);
- rSliceVector.push_back(slice(aFront, aTransformA));
+ rSliceVector.push_back(Slice3D(aFront, aTransformA));
aTransformB.translate(0.0, 0.0, fZBack);
- rSliceVector.push_back(slice(aBack, aTransformB));
+ rSliceVector.push_back(Slice3D(aBack, aTransformB));
}
if(bCloseBack)
{
- rSliceVector.push_back(slice(aOuterBack, basegfx::B3DHomMatrix(), SLICETYPE_BACKCAP));
+ rSliceVector.push_back(Slice3D(aOuterBack, basegfx::B3DHomMatrix(), SLICETYPE3D_BACKCAP));
}
}
}
- void extractLinesFromSlice(basegfx::B3DPolyPolygon& rLine, const sliceVector& rSliceVector, bool bClosed)
+ void extractLinesFromSlice(
+ basegfx::B3DPolyPolygon& rLine,
+ const Slice3DVector& rSliceVector,
+ bool bClosed)
{
const sal_uInt32 nNumSlices(rSliceVector.size());
if(nNumSlices)
{
- // slices self
+ // Slice3Ds self
for(sal_uInt32 a(0L); a < nNumSlices; a++)
{
rLine.append(rSliceVector[a].getB3DPolyPolygon());
@@ -539,9 +574,18 @@ namespace drawinglayer
}
}
- void extractPlanesFromSlice(::std::vector< basegfx::B3DPolyPolygon >& rFill, const sliceVector& rSliceVector,
- bool bCreateNormals, bool bSmoothHorizontalNormals, bool bSmoothNormals, bool bSmoothLids, bool bClosed,
- double fSmoothNormalsMix, double fSmoothLidsMix, bool bCreateTextureCoordinates, const basegfx::B2DHomMatrix& rTexTransform)
+ void extractPlanesFromSlice(
+ ::std::vector< basegfx::B3DPolyPolygon >& rFill,
+ const Slice3DVector& rSliceVector,
+ bool bCreateNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothNormals,
+ bool bSmoothLids,
+ bool bClosed,
+ double fSmoothNormalsMix,
+ double fSmoothLidsMix,
+ bool bCreateTextureCoordinates,
+ const basegfx::B2DHomMatrix& rTexTransform)
{
const sal_uInt32 nNumSlices(rSliceVector.size());
@@ -596,9 +640,9 @@ namespace drawinglayer
for(a = 0L; a < nLoopCount; a++)
{
- const slice& rSliceA(rSliceVector[a]);
- const slice& rSliceB(rSliceVector[(a + 1L) % nNumSlices]);
- const bool bAcceptPair(SLICETYPE_REGULAR == rSliceA.getSliceType() && SLICETYPE_REGULAR == rSliceB.getSliceType());
+ const Slice3D& rSliceA(rSliceVector[a]);
+ const Slice3D& rSliceB(rSliceVector[(a + 1L) % nNumSlices]);
+ const bool bAcceptPair(SLICETYPE3D_REGULAR == rSliceA.getSliceType() && SLICETYPE3D_REGULAR == rSliceB.getSliceType());
basegfx::B3DPolyPolygon aPolA(rSliceA.getB3DPolyPolygon());
basegfx::B3DPolyPolygon aPolB(rSliceB.getB3DPolyPolygon());
@@ -611,11 +655,11 @@ namespace drawinglayer
{
const sal_uInt32 nIndPrev((a + nNumSlices - 1L) % nNumSlices);
- const slice& rSlicePrev(rSliceVector[nIndPrev]);
+ const Slice3D& rSlicePrev(rSliceVector[nIndPrev]);
basegfx::B3DPolyPolygon aPrev(rSlicePrev.getB3DPolyPolygon());
basegfx::B3DPolyPolygon aPolAA(rSliceA.getB3DPolyPolygon());
- if(SLICETYPE_FRONTCAP == rSlicePrev.getSliceType())
+ if(SLICETYPE3D_FRONTCAP == rSlicePrev.getSliceType())
{
basegfx::B3DPolyPolygon aFront(rSlicePrev.getB3DPolyPolygon());
const bool bHasSlant(aPolAA != aPrev);
@@ -701,11 +745,11 @@ namespace drawinglayer
{
const sal_uInt32 nIndNext((a + 2L) % nNumSlices);
- const slice& rSliceNext(rSliceVector[nIndNext]);
+ const Slice3D& rSliceNext(rSliceVector[nIndNext]);
basegfx::B3DPolyPolygon aNext(rSliceNext.getB3DPolyPolygon());
basegfx::B3DPolyPolygon aPolBB(rSliceB.getB3DPolyPolygon());
- if(SLICETYPE_BACKCAP == rSliceNext.getSliceType())
+ if(SLICETYPE3D_BACKCAP == rSliceNext.getSliceType())
{
basegfx::B3DPolyPolygon aBack(rSliceNext.getB3DPolyPolygon());
const bool bHasSlant(aPolBB != aNext);
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index 117274b3ca42..e5648f05f546 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrextrudeprimitive3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,37 +33,33 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
-#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx>
-#endif
-
-#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
-#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
-#include <basegfx/polygon/b3dpolypolygon.hxx>
+#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
+#include <basegfx/polygon/b2dpolygontools.hxx>
#endif
-#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
-#include <basegfx/matrix/b2dhommatrix.hxx>
+#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#endif
-#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
#endif
-#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#endif
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
@@ -71,10 +67,12 @@ namespace drawinglayer
{
namespace primitive3d
{
- void sdrExtrudePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence SdrExtrudePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
+ Primitive3DSequence aRetval;
+
// get slices
- const sliceVector& rSliceVector = getSlices();
+ const Slice3DVector& rSliceVector = getSlices();
if(rSliceVector.size())
{
@@ -114,7 +112,7 @@ namespace drawinglayer
// create geometry
::std::vector< basegfx::B3DPolyPolygon > aFill;
extractPlanesFromSlice(aFill, rSliceVector,
- bCreateNormals, mbSmoothHorizontalNormals, mbSmoothNormals, mbSmoothLids, false,
+ bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), false,
0.5, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
// get full range
@@ -186,7 +184,7 @@ namespace drawinglayer
// transform texture coordinates to texture size
basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY());
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
for(a = 0L; a < aFill.size(); a++)
{
@@ -195,8 +193,8 @@ namespace drawinglayer
}
// create single PolyPolygonFill primitives
- add3DPolyPolygonFillPrimitive(
- aFill, maTransform, maTextureSize, rTarget,
+ aRetval = create3DPolyPolygonFillPrimitives(
+ aFill, getTransform(), getTextureSize(),
getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
@@ -206,46 +204,49 @@ namespace drawinglayer
{
basegfx::B3DPolyPolygon aLine;
extractLinesFromSlice(aLine, rSliceVector, false);
- add3DPolyPolygonLinePrimitive(aLine, maTransform, rTarget, *maSdrLFSAttribute.getLine());
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
}
// add shadow
- if(getSdrLFSAttribute().getShadow())
+ if(getSdrLFSAttribute().getShadow() && aRetval.hasElements())
{
- addShadowPrimitive3D(rTarget, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D());
+ const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
}
}
+
+ return aRetval;
}
- void sdrExtrudePrimitive3D::impCreateSlices()
+ void SdrExtrudePrimitive3D::impCreateSlices()
{
- maCorrectedPolyPolygon = maPolyPolygon;
-
// prepare the polygon
+ maCorrectedPolyPolygon = getPolyPolygon();
maCorrectedPolyPolygon.removeDoublePoints();
maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);
maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon);
// prepare slices as geometry
- createExtrudeSlices(maSlices, maCorrectedPolyPolygon, mfBackScale, mfDiagonal, mfDepth, mbCharacterMode, mbCloseFront, mbCloseBack);
+ createExtrudeSlices(maSlices, maCorrectedPolyPolygon, getBackScale(), getDiagonal(), getDepth(), getCharacterMode(), getCloseFront(), getCloseBack());
}
- const sliceVector& sdrExtrudePrimitive3D::getSlices() const
+ const Slice3DVector& SdrExtrudePrimitive3D::getSlices() const
{
- if(maPolyPolygon.count() && !maSlices.size() && (getSdrLFSAttribute().getFill() || getSdrLFSAttribute().getLine()))
+ if(getPolyPolygon().count() && !maSlices.size() && (getSdrLFSAttribute().getFill() || getSdrLFSAttribute().getLine()))
{
::osl::Mutex m_mutex;
- const_cast< sdrExtrudePrimitive3D& >(*this).impCreateSlices();
+ const_cast< SdrExtrudePrimitive3D& >(*this).impCreateSlices();
}
return maSlices;
}
- sdrExtrudePrimitive3D::sdrExtrudePrimitive3D(
+ SdrExtrudePrimitive3D::SdrExtrudePrimitive3D(
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
- const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute,
- const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
const basegfx::B2DPolyPolygon& rPolyPolygon,
double fDepth,
double fDiagonal,
@@ -256,7 +257,7 @@ namespace drawinglayer
bool bCharacterMode,
bool bCloseFront,
bool bCloseBack)
- : sdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
+ : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
maPolyPolygon(rPolyPolygon),
mfDepth(fDepth),
mfDiagonal(fDiagonal),
@@ -269,64 +270,56 @@ namespace drawinglayer
mbCloseBack(bCloseBack)
{
// make sure depth is positive
- if(basegfx::fTools::lessOrEqual(mfDepth, 0.0))
+ if(basegfx::fTools::lessOrEqual(getDepth(), 0.0))
{
mfDepth = 0.0;
}
- // make sure the percentage value mfDiagonal is between 0.0 and 1.0
- if(basegfx::fTools::lessOrEqual(mfDiagonal, 0.0))
+ // make sure the percentage value getDiagonal() is between 0.0 and 1.0
+ if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
{
mfDiagonal = 0.0;
}
- else if(basegfx::fTools::moreOrEqual(mfDiagonal, 1.0))
+ else if(basegfx::fTools::moreOrEqual(getDiagonal(), 1.0))
{
mfDiagonal = 1.0;
}
// no close front/back when polygon is not closed
- if(maPolyPolygon.count() && !maPolyPolygon.getB2DPolygon(0L).isClosed())
+ if(getPolyPolygon().count() && !getPolyPolygon().getB2DPolygon(0L).isClosed())
{
mbCloseFront = mbCloseBack = false;
}
// no edge rounding when not closing
- if(!mbCloseFront && !mbCloseBack)
+ if(!getCloseFront() && !getCloseBack())
{
mfDiagonal = 0.0;
}
}
- sdrExtrudePrimitive3D::~sdrExtrudePrimitive3D()
- {
- }
-
- bool sdrExtrudePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool SdrExtrudePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(sdrPrimitive3D::operator==(rPrimitive))
+ if(SdrPrimitive3D::operator==(rPrimitive))
{
- const sdrExtrudePrimitive3D& rCompare = static_cast< const sdrExtrudePrimitive3D& >(rPrimitive);
- return (maPolyPolygon == rCompare.maPolyPolygon
- && mfDepth == rCompare.mfDepth
- && mfDiagonal == rCompare.mfDiagonal
- && mfBackScale == rCompare.mfBackScale
- && mbSmoothNormals == rCompare.mbSmoothNormals
- && mbSmoothHorizontalNormals == rCompare.mbSmoothHorizontalNormals
- && mbSmoothLids == rCompare.mbSmoothLids
- && mbCharacterMode == rCompare.mbCharacterMode
- && mbCloseFront == rCompare.mbCloseFront
- && mbCloseBack == rCompare.mbCloseBack);
+ const SdrExtrudePrimitive3D& rCompare = static_cast< const SdrExtrudePrimitive3D& >(rPrimitive);
+
+ return (getPolyPolygon() == rCompare.getPolyPolygon()
+ && getDepth() == rCompare.getDepth()
+ && getDiagonal() == rCompare.getDiagonal()
+ && getBackScale() == rCompare.getBackScale()
+ && getSmoothNormals() == rCompare.getSmoothNormals()
+ && getSmoothHorizontalNormals() == rCompare.getSmoothHorizontalNormals()
+ && getSmoothLids() == rCompare.getSmoothLids()
+ && getCharacterMode() == rCompare.getCharacterMode()
+ && getCloseFront() == rCompare.getCloseFront()
+ && getCloseBack() == rCompare.getCloseBack());
}
return false;
}
- PrimitiveID sdrExtrudePrimitive3D::getID() const
- {
- return CreatePrimitiveID('S', 'X', 'T', '3');
- }
-
- basegfx::B3DRange sdrExtrudePrimitive3D::get3DRange() const
+ basegfx::B3DRange SdrExtrudePrimitive3D::getB3DRange(double /*fTime*/) const
{
// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2
// The parent implementation which uses the ranges of the decomposition would be more
@@ -336,6 +329,11 @@ namespace drawinglayer
// has priority here.
return get3DRangeFromSlices(getSlices());
}
+
+ sal_uInt32 SdrExtrudePrimitive3D::getPrimitiveID() const
+ {
+ return Create3DPrimitiveID('3','E','x','t');
+ }
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index 5ef59dbeedec..86ecce156d15 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrlatheprimitive3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,20 +33,12 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/sdrlatheprimitive3d.hxx>
#endif
-#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#endif
-
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
-#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx>
-#endif
-
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
-#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
@@ -57,25 +49,35 @@
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
-#include <basegfx/matrix/b2dhommatrix.hxx>
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#endif
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive3d
{
- void sdrLathePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence SdrLathePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
+ Primitive3DSequence aRetval;
+
// get slices
- const sliceVector& rSliceVector = getSlices();
+ const Slice3DVector& rSliceVector = getSlices();
if(rSliceVector.size())
{
- const bool bBackScale(!basegfx::fTools::equal(mfBackScale, 1.0));
- const bool bClosedRotation(!bBackScale && mnHorizontalSegments && basegfx::fTools::equal(mfRotation, F_2PI));
+ const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0));
+ const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI));
// add fill
if(getSdrLFSAttribute().getFill())
@@ -104,7 +106,7 @@ namespace drawinglayer
// create geometry
::std::vector< basegfx::B3DPolyPolygon > aFill;
extractPlanesFromSlice(aFill, rSliceVector,
- bCreateNormals, mbSmoothHorizontalNormals, mbSmoothNormals, mbSmoothLids, bClosedRotation,
+ bCreateNormals, getSmoothHorizontalNormals(), getSmoothNormals(), getSmoothLids(), bClosedRotation,
0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform);
// get full range
@@ -176,7 +178,7 @@ namespace drawinglayer
// transform texture coordinates to texture size
basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY());
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
for(a = 0L; a < aFill.size(); a++)
{
@@ -185,8 +187,8 @@ namespace drawinglayer
}
// create single PolyPolygonFill primitives
- add3DPolyPolygonFillPrimitive(
- aFill, maTransform, maTextureSize, rTarget,
+ aRetval = create3DPolyPolygonFillPrimitives(
+ aFill, getTransform(), getTextureSize(),
getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
@@ -196,21 +198,25 @@ namespace drawinglayer
{
basegfx::B3DPolyPolygon aLine;
extractLinesFromSlice(aLine, rSliceVector, bClosedRotation);
- add3DPolyPolygonLinePrimitive(aLine, maTransform, rTarget, *maSdrLFSAttribute.getLine());
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
}
// add shadow
- if(getSdrLFSAttribute().getShadow())
+ if(getSdrLFSAttribute().getShadow() && aRetval.hasElements())
{
- addShadowPrimitive3D(rTarget, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D());
+ const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
}
}
+
+ return aRetval;
}
- void sdrLathePrimitive3D::impCreateSlices()
+ void SdrLathePrimitive3D::impCreateSlices()
{
// prepare the polygon
- basegfx::B2DPolyPolygon aCandidate(basegfx::tools::adaptiveSubdivideByDistance(maPolyPolygon));
+ basegfx::B2DPolyPolygon aCandidate(basegfx::tools::adaptiveSubdivideByDistance(getPolyPolygon()));
aCandidate.removeDoublePoints();
aCandidate = basegfx::tools::correctOrientations(aCandidate);
aCandidate = basegfx::tools::correctOutmostPolygon(aCandidate);
@@ -221,31 +227,31 @@ namespace drawinglayer
const basegfx::B2DPolygon aSubCandidate(aCandidate.getB2DPolygon(0L));
const sal_uInt32 nSubEdgeCount(aSubCandidate.isClosed() ? aSubCandidate.count() : (aSubCandidate.count() ? aSubCandidate.count() - 1L : 0L));
- if(nSubEdgeCount != mnVerticalSegments)
+ if(nSubEdgeCount != getVerticalSegments())
{
- aCandidate = basegfx::tools::reSegmentPolyPolygon(aCandidate, mnVerticalSegments);
+ aCandidate = basegfx::tools::reSegmentPolyPolygon(aCandidate, getVerticalSegments());
}
// prepare slices as geometry
- createLatheSlices(maSlices, aCandidate, mfBackScale, mfDiagonal, mfRotation, mnHorizontalSegments, mbCharacterMode, mbCloseFront, mbCloseBack);
+ createLatheSlices(maSlices, aCandidate, getBackScale(), getDiagonal(), getRotation(), getHorizontalSegments(), getCharacterMode(), getCloseFront(), getCloseBack());
}
- const sliceVector& sdrLathePrimitive3D::getSlices() const
+ const Slice3DVector& SdrLathePrimitive3D::getSlices() const
{
- if(maPolyPolygon.count() && !maSlices.size() && (getSdrLFSAttribute().getFill() || getSdrLFSAttribute().getLine()))
+ if(getPolyPolygon().count() && !maSlices.size() && (getSdrLFSAttribute().getFill() || getSdrLFSAttribute().getLine()))
{
::osl::Mutex m_mutex;
- const_cast< sdrLathePrimitive3D& >(*this).impCreateSlices();
+ const_cast< SdrLathePrimitive3D& >(*this).impCreateSlices();
}
return maSlices;
}
- sdrLathePrimitive3D::sdrLathePrimitive3D(
+ SdrLathePrimitive3D::SdrLathePrimitive3D(
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
- const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute,
- const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
const basegfx::B2DPolyPolygon& rPolyPolygon,
sal_uInt32 nHorizontalSegments,
sal_uInt32 nVerticalSegments,
@@ -258,7 +264,7 @@ namespace drawinglayer
bool bCharacterMode,
bool bCloseFront,
bool bCloseBack)
- : sdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
+ : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
maPolyPolygon(rPolyPolygon),
mnHorizontalSegments(nHorizontalSegments),
mnVerticalSegments(nVerticalSegments),
@@ -273,66 +279,58 @@ namespace drawinglayer
mbCloseBack(bCloseBack)
{
// make sure Rotation is positive
- if(basegfx::fTools::lessOrEqual(mfRotation, 0.0))
+ if(basegfx::fTools::lessOrEqual(getRotation(), 0.0))
{
mfRotation = 0.0;
}
- // make sure the percentage value mfDiagonal is between 0.0 and 1.0
- if(basegfx::fTools::lessOrEqual(mfDiagonal, 0.0))
+ // make sure the percentage value getDiagonal() is between 0.0 and 1.0
+ if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
{
mfDiagonal = 0.0;
}
- else if(basegfx::fTools::moreOrEqual(mfDiagonal, 1.0))
+ else if(basegfx::fTools::moreOrEqual(getDiagonal(), 1.0))
{
mfDiagonal = 1.0;
}
// no close front/back when polygon is not closed
- if(maPolyPolygon.count() && !maPolyPolygon.getB2DPolygon(0L).isClosed())
+ if(getPolyPolygon().count() && !getPolyPolygon().getB2DPolygon(0L).isClosed())
{
mbCloseFront = mbCloseBack = false;
}
// no edge rounding when not closing
- if(!mbCloseFront && !mbCloseBack)
+ if(!getCloseFront() && !getCloseBack())
{
mfDiagonal = 0.0;
}
}
- sdrLathePrimitive3D::~sdrLathePrimitive3D()
- {
- }
-
- bool sdrLathePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool SdrLathePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(sdrPrimitive3D::operator==(rPrimitive))
+ if(SdrPrimitive3D::operator==(rPrimitive))
{
- const sdrLathePrimitive3D& rCompare = static_cast< const sdrLathePrimitive3D& >(rPrimitive);
- return (maPolyPolygon == rCompare.maPolyPolygon
- && mnHorizontalSegments == rCompare.mnHorizontalSegments
- && mnVerticalSegments == rCompare.mnVerticalSegments
- && mfDiagonal == rCompare.mfDiagonal
- && mfBackScale == rCompare.mfBackScale
- && mfRotation == rCompare.mfRotation
- && mbSmoothNormals == rCompare.mbSmoothNormals
- && mbSmoothHorizontalNormals == rCompare.mbSmoothHorizontalNormals
- && mbSmoothLids == rCompare.mbSmoothLids
- && mbCharacterMode == rCompare.mbCharacterMode
- && mbCloseFront == rCompare.mbCloseFront
- && mbCloseBack == rCompare.mbCloseBack);
+ 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());
}
return false;
}
- PrimitiveID sdrLathePrimitive3D::getID() const
- {
- return CreatePrimitiveID('S', 'L', 'A', '3');
- }
-
- basegfx::B3DRange sdrLathePrimitive3D::get3DRange() const
+ basegfx::B3DRange SdrLathePrimitive3D::getB3DRange(double /*fTime*/) const
{
// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2
// The parent implementation which uses the ranges of the decomposition would be more
@@ -342,6 +340,11 @@ namespace drawinglayer
// has priority here.
return get3DRangeFromSlices(getSlices());
}
+
+ sal_uInt32 SdrLathePrimitive3D::getPrimitiveID() const
+ {
+ return Create3DPrimitiveID('3','L','a','t');
+ }
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
new file mode 100644
index 000000000000..c91be70dc08f
--- /dev/null
+++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrpolypolygonprimitive3d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:34 $
+ *
+ * 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
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+#include <drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx>
+#endif
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ Primitive3DSequence SdrPolyPolygonPrimitive3D::createLocalDecomposition(double /*fTime*/) const
+ {
+ Primitive3DSequence aRetval;
+
+ if(getPolyPolygon3D().count())
+ {
+ // add fill
+ if(getSdrLFSAttribute().getFill())
+ {
+ // create single PolyPolygonFill primitives
+ ::std::vector< basegfx::B3DPolyPolygon > aFill;
+ aFill.push_back(getPolyPolygon3D());
+
+ aRetval = create3DPolyPolygonFillPrimitives(
+ aFill, getTransform(), getTextureSize(),
+ getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
+ getSdrLFSAttribute().getFillFloatTransGradient());
+ }
+
+ // add line
+ if(getSdrLFSAttribute().getLine())
+ {
+ basegfx::B3DPolyPolygon aLine(getPolyPolygon3D());
+ aLine.clearNormals();
+ aLine.clearTextureCoordinates();
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
+ }
+
+ // add shadow
+ if(getSdrLFSAttribute().getShadow() && aRetval.hasElements())
+ {
+ const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
+ }
+ }
+
+ return aRetval;
+ }
+
+ SdrPolyPolygonPrimitive3D::SdrPolyPolygonPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon3D,
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
+ : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
+ maPolyPolygon3D(rPolyPolygon3D)
+ {
+ }
+
+ bool SdrPolyPolygonPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
+ {
+ if(SdrPrimitive3D::operator==(rPrimitive))
+ {
+ const SdrPolyPolygonPrimitive3D& rCompare = static_cast< const SdrPolyPolygonPrimitive3D& >(rPrimitive);
+
+ return (getPolyPolygon3D() == rCompare.getPolyPolygon3D());
+ }
+
+ return false;
+ }
+
+ sal_uInt32 SdrPolyPolygonPrimitive3D::getPrimitiveID() const
+ {
+ return Create3DPrimitiveID('3','P','P','o');
+ }
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
index bc7f5a7878bc..7e6b47f28f04 100644
--- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrprimitive3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:34 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,11 +33,11 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
#endif
-#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
#include <drawinglayer/attribute/sdrattribute.hxx>
#endif
@@ -47,18 +47,22 @@
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- basegfx::B3DRange sdrPrimitive3D::getStandard3DRange() const
+ basegfx::B3DRange SdrPrimitive3D::getStandard3DRange() const
{
basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
aUnitRange.transform(getTransform());
- if(maSdrLFSAttribute.getLine())
+ if(getSdrLFSAttribute().getLine())
{
- const attribute::sdrLineAttribute& rLine = *maSdrLFSAttribute.getLine();
+ const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine();
if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth()))
{
@@ -70,7 +74,7 @@ namespace drawinglayer
return aUnitRange;
}
- basegfx::B3DRange sdrPrimitive3D::get3DRangeFromSlices(const sliceVector& rSlices) const
+ basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const
{
basegfx::B3DRange aRetval;
@@ -83,9 +87,9 @@ namespace drawinglayer
aRetval.transform(getTransform());
- if(maSdrLFSAttribute.getLine())
+ if(getSdrLFSAttribute().getLine())
{
- const attribute::sdrLineAttribute& rLine = *maSdrLFSAttribute.getLine();
+ const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine();
if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth()))
{
@@ -98,12 +102,12 @@ namespace drawinglayer
return aRetval;
}
- sdrPrimitive3D::sdrPrimitive3D(
+ SdrPrimitive3D::SdrPrimitive3D(
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
- const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute,
- const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute)
- : basePrimitive3D(),
+ const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
+ : BasePrimitive3D(),
maTransform(rTransform),
maTextureSize(rTextureSize),
maSdrLFSAttribute(rSdrLFSAttribute),
@@ -111,20 +115,16 @@ namespace drawinglayer
{
}
- sdrPrimitive3D::~sdrPrimitive3D()
- {
- }
-
- bool sdrPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(getID() == rPrimitive.getID())
+ if(BasePrimitive3D::operator==(rPrimitive))
{
- const sdrPrimitive3D& rCompare = static_cast< const sdrPrimitive3D& >(rPrimitive);
+ const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
- return (maTransform == rCompare.maTransform
- && maTextureSize == rCompare.maTextureSize
- && maSdrLFSAttribute == rCompare.maSdrLFSAttribute
- && maSdr3DObjectAttribute == rCompare.maSdr3DObjectAttribute);
+ return (getTransform() == rCompare.getTransform()
+ && getTextureSize() == rCompare.getTextureSize()
+ && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
+ && getSdr3DObjectAttribute() == rCompare.getSdr3DObjectAttribute());
}
return false;
diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
index 7c299a1215ca..bb01dc7cbfbe 100644
--- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrsphereprimitive3d.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2006-09-27 16:33:18 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:34 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,38 +33,43 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/sdrsphereprimitive3d.hxx>
#endif
-#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
-#include <basegfx/polygon/b3dpolypolygon.hxx>
-#endif
-
#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#endif
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
-#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
#include <basegfx/polygon/b3dpolygon.hxx>
#endif
-#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
-#include <basegfx/matrix/b2dhommatrix.hxx>
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
+#endif
+
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- void sdrSpherePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence SdrSpherePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
+ Primitive3DSequence aRetval;
const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
// add fill
@@ -136,7 +141,7 @@ namespace drawinglayer
// transform texture coordinates to texture size
basegfx::B2DHomMatrix aTexMatrix;
- aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY());
+ aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY());
aFill.transformTextureCoordiantes(aTexMatrix);
}
@@ -149,60 +154,57 @@ namespace drawinglayer
}
// create single PolyPolygonFill primitives
- add3DPolyPolygonFillPrimitive(
- a3DPolyPolygonVector, maTransform, maTextureSize, rTarget,
+ aRetval = create3DPolyPolygonFillPrimitives(
+ a3DPolyPolygonVector, getTransform(), getTextureSize(),
getSdr3DObjectAttribute(), *getSdrLFSAttribute().getFill(),
getSdrLFSAttribute().getFillFloatTransGradient());
}
// add line
- if(maSdrLFSAttribute.getLine())
+ if(getSdrLFSAttribute().getLine())
{
basegfx::B3DPolyPolygon aSphere(basegfx::tools::createSpherePolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments()));
- add3DPolyPolygonLinePrimitive(aSphere, maTransform, rTarget, *maSdrLFSAttribute.getLine());
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aSphere, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
}
// add shadow
- if(getSdrLFSAttribute().getShadow())
+ if(getSdrLFSAttribute().getShadow() && aRetval.hasElements())
{
- addShadowPrimitive3D(rTarget, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D());
+ const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
}
+
+ return aRetval;
}
- sdrSpherePrimitive3D::sdrSpherePrimitive3D(
+ SdrSpherePrimitive3D::SdrSpherePrimitive3D(
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
- const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute,
- const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute,
- sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments)
- : sdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
+ const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments)
+ : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
mnHorizontalSegments(nHorizontalSegments),
mnVerticalSegments(nVerticalSegments)
{
}
- sdrSpherePrimitive3D::~sdrSpherePrimitive3D()
- {
- }
-
- bool sdrSpherePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool SdrSpherePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(sdrPrimitive3D::operator==(rPrimitive))
+ if(SdrPrimitive3D::operator==(rPrimitive))
{
- const sdrSpherePrimitive3D& rCompare = static_cast< const sdrSpherePrimitive3D& >(rPrimitive);
- return (mnHorizontalSegments == rCompare.mnHorizontalSegments
- && mnVerticalSegments == rCompare.mnVerticalSegments);
+ const SdrSpherePrimitive3D& rCompare = static_cast< const SdrSpherePrimitive3D& >(rPrimitive);
+
+ return (getHorizontalSegments() == rCompare.getHorizontalSegments()
+ && getVerticalSegments() == rCompare.getVerticalSegments());
}
return false;
}
- PrimitiveID sdrSpherePrimitive3D::getID() const
- {
- return CreatePrimitiveID('S', 'S', 'P', '3');
- }
-
- basegfx::B3DRange sdrSpherePrimitive3D::get3DRange() const
+ basegfx::B3DRange SdrSpherePrimitive3D::getB3DRange(double /*fTime*/) const
{
// use defaut from sdrPrimitive3D which uses transformation expanded by line width/2
// The parent implementation which uses the ranges of the decomposition would be more
@@ -212,6 +214,11 @@ namespace drawinglayer
// has priority here.
return getStandard3DRange();
}
+
+ sal_uInt32 SdrSpherePrimitive3D::getPrimitiveID() const
+ {
+ return Create3DPrimitiveID('3','S','p','h');
+ }
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx
index f806265eefc2..10ebb54f23a6 100644
--- a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: shadowprimitive3d.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:34 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,20 +33,27 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/shadowprimitive3d.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- shadowPrimitive3D::shadowPrimitive3D(
- const basegfx::B2DHomMatrix& rShadowTransform, const basegfx::BColor& rShadowColor,
- double fShadowTransparence, bool bShadow3D, const primitiveVector3D& rPrimitiveVector)
- : vectorPrimitive3D(rPrimitiveVector),
+ ShadowPrimitive3D::ShadowPrimitive3D(
+ const basegfx::B2DHomMatrix& rShadowTransform,
+ const basegfx::BColor& rShadowColor,
+ double fShadowTransparence,
+ bool bShadow3D,
+ const Primitive3DSequence& rChildren)
+ : GroupPrimitive3D(rChildren),
maShadowTransform(rShadowTransform),
maShadowColor(rShadowColor),
mfShadowTransparence(fShadowTransparence),
@@ -54,27 +61,24 @@ namespace drawinglayer
{
}
- shadowPrimitive3D::~shadowPrimitive3D()
+ bool ShadowPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool shadowPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(vectorPrimitive3D::operator==(rPrimitive))
+ if(GroupPrimitive3D::operator==(rPrimitive))
{
- const shadowPrimitive3D& rCompare = (shadowPrimitive3D&)rPrimitive;
- return (maShadowTransform == rCompare.maShadowTransform
- && maShadowColor == rCompare.maShadowColor
- && mfShadowTransparence == rCompare.mfShadowTransparence
- && mbShadow3D == rCompare.mbShadow3D);
+ const ShadowPrimitive3D& rCompare = (ShadowPrimitive3D&)rPrimitive;
+
+ return (getShadowTransform() == rCompare.getShadowTransform()
+ && getShadowColor() == rCompare.getShadowColor()
+ && getShadowTransparence() == rCompare.getShadowTransparence()
+ && getShadow3D() == rCompare.getShadow3D());
}
return false;
}
- PrimitiveID shadowPrimitive3D::getID() const
+ sal_uInt32 ShadowPrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('S', 'H', 'D', '3');
+ return Create3DPrimitiveID('3','S','h','a');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
index a220c5c76ae4..876765b948d9 100644
--- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: textureprimitive3d.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:34 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,37 +33,39 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/textureprimitive3d.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
namespace drawinglayer
{
namespace primitive3d
{
- texturePrimitive3D::texturePrimitive3D(
- const primitiveVector3D& rPrimitiveVector,
+ TexturePrimitive3D::TexturePrimitive3D(
+ const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate, bool bFilter)
- : vectorPrimitive3D(rPrimitiveVector),
+ : GroupPrimitive3D(rChildren),
maTextureSize(rTextureSize),
mbModulate(bModulate),
mbFilter(bFilter)
{
}
- texturePrimitive3D::~texturePrimitive3D()
- {
- }
-
- bool texturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool TexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- if(vectorPrimitive3D::operator==(rPrimitive))
+ if(GroupPrimitive3D::operator==(rPrimitive))
{
- const texturePrimitive3D& rCompare = (texturePrimitive3D&)rPrimitive;
- return (mbModulate == rCompare.mbModulate && mbFilter == rCompare.mbFilter);
+ const TexturePrimitive3D& rCompare = (TexturePrimitive3D&)rPrimitive;
+
+ return (getModulate() == rCompare.getModulate()
+ && getFilter() == rCompare.getFilter());
}
return false;
@@ -77,53 +79,51 @@ namespace drawinglayer
{
namespace primitive3d
{
- void simpleTransparenceTexturePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence UnifiedAlphaTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
- if(0.0 == mfTransparence)
+ if(0.0 == getTransparence())
{
- // no transparence used, so just add the content
- rTarget.insert(rTarget.end(), maPrimitiveVector.begin(), maPrimitiveVector.end());
+ // no transparence used, so just use content
+ return getChildren();
}
- else if(mfTransparence > 0.0 && mfTransparence < 1.0)
+ else if(getTransparence() > 0.0 && getTransparence() < 1.0)
{
- // create transparenceTexturePrimitive3D with fixed transparence as replacement
- const basegfx::BColor aGray(mfTransparence, mfTransparence, mfTransparence);
- const attribute::fillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1);
- basePrimitive3D* pNewTransparenceTexturePrimitive3D = new transparenceTexturePrimitive3D(aFillGradient, maPrimitiveVector, maTextureSize);
- rTarget.push_back(referencedPrimitive3D(*pNewTransparenceTexturePrimitive3D));
+ // create AlphaTexturePrimitive3D with fixed transparence as replacement
+ const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence());
+ const attribute::FillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1);
+ const Primitive3DReference xRef(new AlphaTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize()));
+ return Primitive3DSequence(&xRef, 1L);
}
else
{
// completely transparent or invalid definition, add nothing
+ return Primitive3DSequence();
}
}
- simpleTransparenceTexturePrimitive3D::simpleTransparenceTexturePrimitive3D(
+ UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D(
double fTransparence,
- const primitiveVector3D& rPrimitiveVector)
- : texturePrimitive3D(rPrimitiveVector, basegfx::B2DVector(), false, false),
+ const Primitive3DSequence& rChildren)
+ : TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false),
mfTransparence(fTransparence)
{
}
- simpleTransparenceTexturePrimitive3D::~simpleTransparenceTexturePrimitive3D()
+ bool UnifiedAlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool simpleTransparenceTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(texturePrimitive3D::operator==(rPrimitive))
+ if(TexturePrimitive3D::operator==(rPrimitive))
{
- const simpleTransparenceTexturePrimitive3D& rCompare = (simpleTransparenceTexturePrimitive3D&)rPrimitive;
- return (mfTransparence == rCompare.mfTransparence);
+ const UnifiedAlphaTexturePrimitive3D& rCompare = (UnifiedAlphaTexturePrimitive3D&)rPrimitive;
+
+ return (getTransparence() == rCompare.getTransparence());
}
return false;
}
- PrimitiveID simpleTransparenceTexturePrimitive3D::getID() const
+ sal_uInt32 UnifiedAlphaTexturePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('S', 'T', 'X', '3');
+ return Create3DPrimitiveID('3','U','A','T');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
@@ -134,40 +134,37 @@ namespace drawinglayer
{
namespace primitive3d
{
- void gradientTexturePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence GradientTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
- rTarget.insert(rTarget.end(), maPrimitiveVector.begin(), maPrimitiveVector.end());
+ return getChildren();
}
- gradientTexturePrimitive3D::gradientTexturePrimitive3D(
- const attribute::fillGradientAttribute& rGradient,
- const primitiveVector3D& rPrimitiveVector,
+ GradientTexturePrimitive3D::GradientTexturePrimitive3D(
+ const attribute::FillGradientAttribute& rGradient,
+ const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate,
bool bFilter)
- : texturePrimitive3D(rPrimitiveVector, rTextureSize, bModulate, bFilter),
+ : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
maGradient(rGradient)
{
}
- gradientTexturePrimitive3D::~gradientTexturePrimitive3D()
+ bool GradientTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool gradientTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(texturePrimitive3D::operator==(rPrimitive))
+ if(TexturePrimitive3D::operator==(rPrimitive))
{
- const gradientTexturePrimitive3D& rCompare = (gradientTexturePrimitive3D&)rPrimitive;
- return (maGradient == rCompare.maGradient);
+ const GradientTexturePrimitive3D& rCompare = (GradientTexturePrimitive3D&)rPrimitive;
+
+ return (getGradient() == rCompare.getGradient());
}
return false;
}
- PrimitiveID gradientTexturePrimitive3D::getID() const
+ sal_uInt32 GradientTexturePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('G', 'R', 'X', '3');
+ return Create3DPrimitiveID('3','G','T','e');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
@@ -178,39 +175,36 @@ namespace drawinglayer
{
namespace primitive3d
{
- void bitmapTexturePrimitive3D::decompose(primitiveVector3D& rTarget)
+ Primitive3DSequence BitmapTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const
{
- rTarget.insert(rTarget.end(), maPrimitiveVector.begin(), maPrimitiveVector.end());
+ return getChildren();
}
- bitmapTexturePrimitive3D::bitmapTexturePrimitive3D(
- const attribute::fillBitmapAttribute& rBitmap,
- const primitiveVector3D& rPrimitiveVector,
+ BitmapTexturePrimitive3D::BitmapTexturePrimitive3D(
+ const attribute::FillBitmapAttribute& rBitmap,
+ const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate, bool bFilter)
- : texturePrimitive3D(rPrimitiveVector, rTextureSize, bModulate, bFilter),
+ : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
maBitmap(rBitmap)
{
}
- bitmapTexturePrimitive3D::~bitmapTexturePrimitive3D()
+ bool BitmapTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool bitmapTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(texturePrimitive3D::operator==(rPrimitive))
+ if(TexturePrimitive3D::operator==(rPrimitive))
{
- const bitmapTexturePrimitive3D& rCompare = (bitmapTexturePrimitive3D&)rPrimitive;
- return (maBitmap == rCompare.maBitmap);
+ const BitmapTexturePrimitive3D& rCompare = (BitmapTexturePrimitive3D&)rPrimitive;
+
+ return (getBitmap() == rCompare.getBitmap());
}
return false;
}
- PrimitiveID bitmapTexturePrimitive3D::getID() const
+ sal_uInt32 BitmapTexturePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('B', 'M', 'X', '3');
+ return Create3DPrimitiveID('3','B','T','e');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
@@ -221,26 +215,22 @@ namespace drawinglayer
{
namespace primitive3d
{
- transparenceTexturePrimitive3D::transparenceTexturePrimitive3D(
- const attribute::fillGradientAttribute& rGradient,
- const primitiveVector3D& rPrimitiveVector,
+ AlphaTexturePrimitive3D::AlphaTexturePrimitive3D(
+ const attribute::FillGradientAttribute& rGradient,
+ const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize)
- : gradientTexturePrimitive3D(rGradient, rPrimitiveVector, rTextureSize, false, false)
- {
- }
-
- transparenceTexturePrimitive3D::~transparenceTexturePrimitive3D()
+ : GradientTexturePrimitive3D(rGradient, rChildren, rTextureSize, false, false)
{
}
- bool transparenceTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
+ bool AlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- return (gradientTexturePrimitive3D::operator==(rPrimitive));
+ return (GradientTexturePrimitive3D::operator==(rPrimitive));
}
- PrimitiveID transparenceTexturePrimitive3D::getID() const
+ sal_uInt32 AlphaTexturePrimitive3D::getPrimitiveID() const
{
- return CreatePrimitiveID('T', 'R', 'X', '3');
+ return Create3DPrimitiveID('3','A','T','e');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/transformprimitive3d.cxx b/drawinglayer/source/primitive3d/transformprimitive3d.cxx
index 22fafbcac2b2..80a2635b6061 100644
--- a/drawinglayer/source/primitive3d/transformprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/transformprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: transformprimitive3d.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $
+ * last change: $Author: aw $ $Date: 2006-10-19 10:38:34 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,47 +33,54 @@
*
************************************************************************/
-#ifndef _DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#endif
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#include <basegfx/tools/canvastools.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive3d
{
- transformPrimitive3D::transformPrimitive3D(const basegfx::B3DHomMatrix& rTransformation, const primitiveVector3D& rPrimitiveVector)
- : vectorPrimitive3D(rPrimitiveVector),
+ TransformPrimitive3D::TransformPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransformation,
+ const Primitive3DSequence& rChildren)
+ : GroupPrimitive3D(rChildren),
maTransformation(rTransformation)
{
}
- transformPrimitive3D::~transformPrimitive3D()
+ bool TransformPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
- }
-
- bool transformPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const
- {
- if(vectorPrimitive3D::operator==(rPrimitive))
+ if(GroupPrimitive3D::operator==(rPrimitive))
{
- const transformPrimitive3D& rCompare = static_cast< const transformPrimitive3D& >(rPrimitive);
- return (maTransformation == rCompare.maTransformation);
+ const TransformPrimitive3D& rCompare = static_cast< const TransformPrimitive3D& >(rPrimitive);
+
+ return (getTransformation() == rCompare.getTransformation());
}
return false;
}
- PrimitiveID transformPrimitive3D::getID() const
+ basegfx::B3DRange TransformPrimitive3D::getB3DRange(double fTime) const
{
- return CreatePrimitiveID('T', 'R', 'N', '3');
+ basegfx::B3DRange aRetval(getB3DRangeFromPrimitive3DSequence(getChildren(), fTime));
+ aRetval.transform(getTransformation());
+ return aRetval;
}
- basegfx::B3DRange transformPrimitive3D::get3DRange() const
+ sal_uInt32 TransformPrimitive3D::getPrimitiveID() const
{
- basegfx::B3DRange aRetval(get3DRangeFromVector(maPrimitiveVector));
- aRetval.transform(maTransformation);
- return aRetval;
+ return Create3DPrimitiveID('3','T','r','a');
}
} // end of namespace primitive3d
} // end of namespace drawinglayer