diff options
Diffstat (limited to 'drawinglayer/source/primitive2d')
8 files changed, 153 insertions, 151 deletions
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 2a222a4e2e77..3b1fd70a6964 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: controlprimitive2d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -116,7 +116,7 @@ namespace drawinglayer // get absolute discrete size (no mirror or rotate here) aScale = basegfx::absolute(aScale); - basegfx::B2DVector aDiscreteSize(rViewInformation.getViewTransformation() * aScale); + basegfx::B2DVector aDiscreteSize(rViewInformation.getObjectToViewTransformation() * aScale); // calc screen zoom for text display basegfx::B2DVector aScreenZoom( @@ -177,7 +177,7 @@ namespace drawinglayer // to avoid scaling, use the Bitmap pixel size as primitive size const Size aBitmapSize(aContent.GetSizePixel()); basegfx::B2DVector aBitmapSizeLogic( - rViewInformation.getInverseViewTransformation() * + rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(aBitmapSize.getWidth() - 1, aBitmapSize.getHeight() - 1)); if(bScaleUsed) @@ -318,9 +318,9 @@ namespace drawinglayer Primitive2DSequence ControlPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // this primitive is view-dependent related to the scaling. If scaling has changed, - // destroy existing decomposition + // destroy existing decomposition. To detect change, use size of unit size in view coordinates ::osl::MutexGuard aGuard( m_aMutex ); - const basegfx::B2DVector aNewScaling(rViewInformation.getViewTransformation() * basegfx::B2DVector(1.0, 1.0)); + const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); if(getLocalDecomposition().hasElements()) { diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index 1493b221c3af..c4377bb16c62 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: embedded3dprimitive2d.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -45,6 +45,7 @@ #include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/geometry/viewinformation3d.hxx> +#include <drawinglayer/processor3d/shadow3dextractor.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -56,33 +57,62 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence Embedded3DPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + bool Embedded3DPrimitive2D::impGetShadow3D(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups - basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); - a3DRange.transform(getViewInformation3D().getObjectToView()); + osl::MutexGuard aGuard( m_aMutex ); - // create 2d range from projected 3d and transform with scene's object transformation - basegfx::B2DRange a2DRange; - a2DRange.expand(basegfx::B2DPoint(a3DRange.getMinX(), a3DRange.getMinY())); - a2DRange.expand(basegfx::B2DPoint(a3DRange.getMaxX(), a3DRange.getMaxY())); - a2DRange.transform(getObjectTransformation()); + // create on demand + if(!mbShadow3DChecked && getChildren3D().hasElements()) + { + // create shadow extraction processor + processor3d::Shadow3DExtractingProcessor aShadowProcessor( + getViewInformation3D(), + getObjectTransformation(), + getLightNormal(), + getShadowSlant(), + getScene3DRange()); + + // process local primitives + aShadowProcessor.process(getChildren3D()); + + // fetch result and set checked flag + const_cast< Embedded3DPrimitive2D* >(this)->maShadowPrimitives = aShadowProcessor.getPrimitive2DSequence(); + const_cast< Embedded3DPrimitive2D* >(this)->mbShadow3DChecked = true; + } + + // return if there are shadow primitives + return maShadowPrimitives.hasElements(); + } - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(a2DRange)); + Primitive2DSequence Embedded3DPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + // use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups + const basegfx::B2DRange aLocal2DRange(getB2DRange(rViewInformation)); + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aLocal2DRange)); const basegfx::BColor aYellow(1.0, 1.0, 0.0); const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aOutline, aYellow)); + return Primitive2DSequence(&xRef, 1L); } Embedded3DPrimitive2D::Embedded3DPrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const basegfx::B2DHomMatrix& rObjectTransformation, - const geometry::ViewInformation3D& rViewInformation3D) + const geometry::ViewInformation3D& rViewInformation3D, + const basegfx::B3DVector& rLightNormal, + double fShadowSlant, + const basegfx::B3DRange& rScene3DRange) : BasePrimitive2D(), mxChildren3D(rxChildren3D), maObjectTransformation(rObjectTransformation), - maViewInformation3D(rViewInformation3D) + maViewInformation3D(rViewInformation3D), + maLightNormal(rLightNormal), + mfShadowSlant(fShadowSlant), + maScene3DRange(rScene3DRange), + maShadowPrimitives(), + mbShadow3DChecked(false) { + maLightNormal.normalize(); } bool Embedded3DPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const @@ -93,13 +123,16 @@ namespace drawinglayer return (primitive3d::arePrimitive3DSequencesEqual(getChildren3D(), rCompare.getChildren3D()) && getObjectTransformation() == rCompare.getObjectTransformation() - && getViewInformation3D() == rCompare.getViewInformation3D()); + && getViewInformation3D() == rCompare.getViewInformation3D() + && getLightNormal() == rCompare.getLightNormal() + && getShadowSlant() == rCompare.getShadowSlant() + && getScene3DRange() == rCompare.getScene3DRange()); } return false; } - basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { // use the 3d transformation stack to create a projection of the 3D range basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); @@ -111,6 +144,18 @@ namespace drawinglayer aRetval.expand(basegfx::B2DPoint(a3DRange.getMaxX(), a3DRange.getMaxY())); aRetval.transform(getObjectTransformation()); + // cehck for 3D shadows and their 2D projections. If those exist, they need to be + // taken into account + if(impGetShadow3D(rViewInformation)) + { + const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + + if(!aShadow2DRange.isEmpty()) + { + aRetval.expand(aShadow2DRange); + } + } + return aRetval; } diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index 0360d1ad76f1..c122b123fa7b 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: gridprimitive2d.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -69,7 +69,7 @@ namespace drawinglayer aRST.shearX(fShearX); aRST.rotate(fRotate); aRST.translate(aTranslate.getX(), aTranslate.getY()); - aRST *= rViewInformation.getViewTransformation(); + aRST *= rViewInformation.getObjectToViewTransformation(); // get step widths double fStepX(getWidth()); @@ -87,9 +87,9 @@ namespace drawinglayer fStepY = fMinimalStep; } - // get relative distances in view - double fViewStepX((rViewInformation.getViewTransformation() * basegfx::B2DVector(fStepX, 0.0)).getLength()); - double fViewStepY((rViewInformation.getViewTransformation() * basegfx::B2DVector(0.0, fStepY)).getLength()); + // get relative distances in view coordinates + double fViewStepX((rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(fStepX, 0.0)).getLength()); + double fViewStepY((rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(0.0, fStepY)).getLength()); double fSmallStepX(1.0), fViewSmallStepX(1.0), fSmallStepY(1.0), fViewSmallStepY(1.0); sal_uInt32 nSmallStepsX(0L), nSmallStepsY(0L); @@ -166,7 +166,7 @@ namespace drawinglayer if(rViewInformation.getDiscreteViewport().overlaps(aDiscreteRangeCross)) { - const basegfx::B2DPoint aLogicPos(rViewInformation.getInverseViewTransformation() * aViewPos); + const basegfx::B2DPoint aLogicPos(rViewInformation.getInverseObjectToViewTransformation() * aViewPos); aPositionsCross.push_back(aLogicPos); } } @@ -181,7 +181,7 @@ namespace drawinglayer if(rViewInformation.getDiscreteViewport().isInside(aViewPos)) { - const basegfx::B2DPoint aLogicPos(rViewInformation.getInverseViewTransformation() * aViewPos); + const basegfx::B2DPoint aLogicPos(rViewInformation.getInverseObjectToViewTransformation() * aViewPos); aPositionsPoint.push_back(aLogicPos); } } @@ -197,7 +197,7 @@ namespace drawinglayer if(rViewInformation.getDiscreteViewport().isInside(aViewPos)) { - const basegfx::B2DPoint aLogicPos(rViewInformation.getInverseViewTransformation() * aViewPos); + const basegfx::B2DPoint aLogicPos(rViewInformation.getInverseObjectToViewTransformation() * aViewPos); aPositionsPoint.push_back(aLogicPos); } } @@ -247,7 +247,7 @@ namespace drawinglayer mnSubdivisionsX(nSubdivisionsX), mnSubdivisionsY(nSubdivisionsY), maBColor(rBColor), - maLastViewTransformation(), + maLastObjectToViewTransformation(), maLastViewport() { } @@ -289,7 +289,7 @@ namespace drawinglayer if(getLocalDecomposition().hasElements()) { - if(maLastViewport != rViewInformation.getViewport() || maLastViewTransformation != rViewInformation.getViewTransformation()) + if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete const_cast< GridPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence()); @@ -299,7 +299,7 @@ namespace drawinglayer if(!getLocalDecomposition().hasElements()) { // remember ViewRange and ViewTransformation - const_cast< GridPrimitive2D* >(this)->maLastViewTransformation = rViewInformation.getViewTransformation(); + const_cast< GridPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); const_cast< GridPrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport(); } diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index fc008212fc55..510d55d8337c 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: helplineprimitive2d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,8 +61,9 @@ namespace drawinglayer if(!rViewInformation.getViewport().isEmpty() && !getDirection().equalZero()) { // position to view coordinates, DashLen and DashLen in logic - const basegfx::B2DPoint aViewPosition(rViewInformation.getViewTransformation() * getPosition()); - const double fLogicDashLen((rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(getViewDashLength(), 0.0)).getLength()); + const basegfx::B2DPoint aViewPosition(rViewInformation.getObjectToViewTransformation() * getPosition()); + const double fLogicDashLen((rViewInformation.getInverseObjectToViewTransformation() * + basegfx::B2DVector(getViewDashLength(), 0.0)).getLength()); switch(getStyle()) { @@ -77,7 +78,7 @@ namespace drawinglayer basegfx::B2DPolygon aLineA; aLineA.append(aStartA); aLineA.append(aEndA); - aLineA.transform(rViewInformation.getInverseViewTransformation()); + aLineA.transform(rViewInformation.getInverseObjectToViewTransformation()); PolygonMarkerPrimitive2D* pNewA = new PolygonMarkerPrimitive2D(aLineA, getRGBColA(), getRGBColB(), fLogicDashLen); aTempPrimitiveTarget.push_back(pNewA); @@ -87,7 +88,7 @@ namespace drawinglayer basegfx::B2DPolygon aLineB; aLineB.append(aStartB); aLineB.append(aEndB); - aLineB.transform(rViewInformation.getInverseViewTransformation()); + aLineB.transform(rViewInformation.getInverseObjectToViewTransformation()); PolygonMarkerPrimitive2D* pNewB = new PolygonMarkerPrimitive2D(aLineB, getRGBColA(), getRGBColB(), fLogicDashLen); aTempPrimitiveTarget.push_back(pNewB); @@ -138,7 +139,7 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < aResult.count(); a++) { basegfx::B2DPolygon aPart(aResult.getB2DPolygon(a)); - aPart.transform(rViewInformation.getInverseViewTransformation()); + aPart.transform(rViewInformation.getInverseObjectToViewTransformation()); PolygonMarkerPrimitive2D* pNew = new PolygonMarkerPrimitive2D(aPart, getRGBColA(), getRGBColB(), fLogicDashLen); aTempPrimitiveTarget.push_back(pNew); } @@ -175,7 +176,7 @@ namespace drawinglayer maRGBColA(rRGBColA), maRGBColB(rRGBColB), mfViewDashLength(fViewDashLength), - maLastViewTransformation(), + maLastObjectToViewTransformation(), maLastViewport() { } @@ -203,7 +204,7 @@ namespace drawinglayer if(getLocalDecomposition().hasElements()) { - if(maLastViewport != rViewInformation.getViewport() || maLastViewTransformation != rViewInformation.getViewTransformation()) + if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete const_cast< HelplinePrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence()); @@ -213,7 +214,7 @@ namespace drawinglayer if(!getLocalDecomposition().hasElements()) { // remember ViewRange and ViewTransformation - const_cast< HelplinePrimitive2D* >(this)->maLastViewTransformation = rViewInformation.getViewTransformation(); + const_cast< HelplinePrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); const_cast< HelplinePrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport(); } diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index 866efb76417f..0e0531b44314 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: markerarrayprimitive2d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -80,7 +80,7 @@ namespace drawinglayer if(nMarkerCount) { // get the size of one dicscrete display unit in logic size - const basegfx::B2DVector aDist(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0)); + const basegfx::B2DVector aDist(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); Primitive2DSequence aTemplate; switch(getStyle()) @@ -220,7 +220,7 @@ namespace drawinglayer case MARKERSTYLE2D_CROSS : { // size is 3x3 centered, expand - const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(1.5, 1.5)); + const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.5, 1.5)); aRetval.expand(aRetval.getMinimum() - aDiscreteVector); aRetval.expand(aRetval.getMinimum() + aDiscreteVector); break; @@ -228,7 +228,7 @@ namespace drawinglayer case MARKERSTYLE2D_GLUEPOINT : { // size is 7x7 centered, expand - const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(3.5, 3.5)); + const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(3.5, 3.5)); aRetval.expand(aRetval.getMinimum() - aDiscreteVector); aRetval.expand(aRetval.getMinimum() + aDiscreteVector); break; diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index e1176c6029ac..7799b8e66d0e 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: mediaprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -77,7 +77,8 @@ namespace drawinglayer if(getDiscreteBorder()) { - const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector((double)getDiscreteBorder(), (double)getDiscreteBorder())); + const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseObjectToViewTransformation() * + basegfx::B2DVector((double)getDiscreteBorder(), (double)getDiscreteBorder())); const double fDiscreteSize(aDiscreteInLogic.getX() + aDiscreteInLogic.getY()); basegfx::B2DRange aSourceRange(0.0, 0.0, 1.0, 1.0); @@ -143,7 +144,8 @@ namespace drawinglayer if(getDiscreteBorder()) { - const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector((double)getDiscreteBorder(), (double)getDiscreteBorder())); + const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseObjectToViewTransformation() * + basegfx::B2DVector((double)getDiscreteBorder(), (double)getDiscreteBorder())); const double fDiscreteSize(aDiscreteInLogic.getX() + aDiscreteInLogic.getY()); aRetval.grow(-0.5 * fDiscreteSize); diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index be2caee3a831..796abb27c7df 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sceneprimitive2d.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -46,7 +46,6 @@ #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> #include <drawinglayer/processor3d/zbufferprocessor3d.hxx> #include <drawinglayer/processor3d/shadow3dextractor.hxx> -#include <drawinglayer/processor3d/label3dextractor.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <svtools/optionsdrawinglayer.hxx> @@ -63,6 +62,44 @@ namespace drawinglayer { namespace primitive2d { + bool ScenePrimitive2D::impGetShadow3D(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // create on demand + if(!mbShadow3DChecked && getChildren3D().hasElements()) + { + basegfx::B3DVector aLightNormal; + const double fShadowSlant(getSdrSceneAttribute().getShadowSlant()); + const basegfx::B3DRange aScene3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); + + if(maSdrLightingAttribute.getLightVector().size()) + { + // get light normal from first light and normalize + aLightNormal = maSdrLightingAttribute.getLightVector()[0].getDirection(); + aLightNormal.normalize(); + } + + // create shadow extraction processor + processor3d::Shadow3DExtractingProcessor aShadowProcessor( + getViewInformation3D(), + getObjectTransformation(), + aLightNormal, + fShadowSlant, + aScene3DRange); + + // process local primitives + aShadowProcessor.process(getChildren3D()); + + // fetch result and set checked flag + const_cast< ScenePrimitive2D* >(this)->maShadowPrimitives = aShadowProcessor.getPrimitive2DSequence(); + const_cast< ScenePrimitive2D* >(this)->mbShadow3DChecked = true; + } + + // return if there are shadow primitives + return maShadowPrimitives.hasElements(); + } + void ScenePrimitive2D::calculateDsicreteSizes( const geometry::ViewInformation2D& rViewInformation, basegfx::B2DRange& rDiscreteRange, @@ -71,7 +108,7 @@ namespace drawinglayer { // use unit range and transform to discrete coordinates rDiscreteRange = basegfx::B2DRange(0.0, 0.0, 1.0, 1.0); - rDiscreteRange.transform(rViewInformation.getViewTransformation() * getObjectTransformation()); + rDiscreteRange.transform(rViewInformation.getObjectToViewTransformation() * getObjectTransformation()); // force to discrete expanded bounds (it grows, so expanding works perfectly well) rDiscreteRange.expand(basegfx::B2DTuple(floor(rDiscreteRange.getMinX()), floor(rDiscreteRange.getMinY()))); @@ -167,7 +204,7 @@ namespace drawinglayer basegfx::B2DVector aLogicRenderSize( aDiscreteRange.getWidth() * fReduceFactor, aDiscreteRange.getHeight() * fReduceFactor); - aLogicRenderSize *= rViewInformation.getInverseViewTransformation(); + aLogicRenderSize *= rViewInformation.getInverseObjectToViewTransformation(); // determine the oversample value static bool bDoOversample(false); @@ -201,7 +238,7 @@ namespace drawinglayer aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY()); // transform back to world coordinates for usage in primitive creation - aNew2DTransform *= rViewInformation.getInverseViewTransformation(); + aNew2DTransform *= rViewInformation.getInverseObjectToViewTransformation(); // create bitmap primitive and add const Primitive2DReference xRef(new BitmapPrimitive2D(aNewBitmap, aNew2DTransform)); @@ -220,21 +257,6 @@ namespace drawinglayer } } - // create 2D labels from contained 3D label primitives. This creates the label primitives on demand and tells if - // there are some or not. Do this at end, the labels might still be visible even when the scene is not - if(impGetLabel3D(rViewInformation)) - { - // test visibility - const basegfx::B2DRange aLabel2DRange(getB2DRangeFromPrimitive2DSequence(maLabelPrimitives, rViewInformation)); - const basegfx::B2DRange aViewRange(rViewInformation.getViewport()); - - if(aViewRange.isEmpty() || aLabel2DRange.overlaps(aViewRange)) - { - // add extracted 2d labels (after 3d scene creations) - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, maLabelPrimitives); - } - } - return aRetval; } @@ -265,13 +287,6 @@ namespace drawinglayer appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, a2DExtractedPrimitives); } - // create 2D labels from contained 3D label primitives - if(impGetLabel3D(rViewInformation)) - { - // add extracted 2d labels (after 3d scene creations) - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, maLabelPrimitives); - } - return aRetval; } @@ -287,8 +302,8 @@ namespace drawinglayer maSdrLightingAttribute(rSdrLightingAttribute), maObjectTransformation(rObjectTransformation), maViewInformation3D(rViewInformation3D), + maShadowPrimitives(), mbShadow3DChecked(false), - mbLabel3DChecked(false), mfOldDiscreteSizeX(0.0), mfOldDiscreteSizeY(0.0), maOldUnitVisiblePart() @@ -315,14 +330,14 @@ namespace drawinglayer { // transform unit range to discrete coordinate range basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); - aRetval.transform(rViewInformation.getViewTransformation() * getObjectTransformation()); + aRetval.transform(rViewInformation.getObjectToViewTransformation() * getObjectTransformation()); // force to discrete expanded bounds (it grows, so expanding works perfectly well) aRetval.expand(basegfx::B2DTuple(floor(aRetval.getMinX()), floor(aRetval.getMinY()))); aRetval.expand(basegfx::B2DTuple(ceil(aRetval.getMaxX()), ceil(aRetval.getMaxY()))); // transform back from discrete (view) to world coordinates - aRetval.transform(rViewInformation.getInverseViewTransformation()); + aRetval.transform(rViewInformation.getInverseObjectToViewTransformation()); // expand by evtl. existing shadow primitives if(impGetShadow3D(rViewInformation)) @@ -335,17 +350,6 @@ namespace drawinglayer } } - // expand by evtl. existing label primitives - if(impGetLabel3D(rViewInformation)) - { - const basegfx::B2DRange aLabel2DRange(getB2DRangeFromPrimitive2DSequence(maLabelPrimitives, rViewInformation)); - - if(!aLabel2DRange.isEmpty()) - { - aRetval.expand(aLabel2DRange); - } - } - return aRetval; } @@ -400,57 +404,6 @@ namespace drawinglayer return BasePrimitive2D::get2DDecomposition(rViewInformation); } - bool ScenePrimitive2D::impGetShadow3D(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - osl::MutexGuard aGuard( m_aMutex ); - - // create on demand - if(!mbShadow3DChecked && getChildren3D().hasElements()) - { - // create shadow extraction processor - processor3d::Shadow3DExtractingProcessor aShadowProcessor( - getViewInformation3D(), - getObjectTransformation(), - getSdrLightingAttribute(), - getChildren3D(), - getSdrSceneAttribute().getShadowSlant()); - - // process local primitives - aShadowProcessor.process(getChildren3D()); - - // fetch result and set checked flag - const_cast< ScenePrimitive2D* >(this)->maShadowPrimitives = aShadowProcessor.getPrimitive2DSequence(); - const_cast< ScenePrimitive2D* >(this)->mbShadow3DChecked = true; - } - - // return if there are shadow primitives - return maShadowPrimitives.hasElements(); - } - - bool ScenePrimitive2D::impGetLabel3D(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - osl::MutexGuard aGuard( m_aMutex ); - - // create on demand - if(!mbLabel3DChecked && getChildren3D().hasElements()) - { - // create label extraction processor - processor3d::Label3DExtractingProcessor aLabelProcessor( - getViewInformation3D(), - getObjectTransformation()); - - // process local primitives - aLabelProcessor.process(getChildren3D()); - - // fetch result and set checked flag - const_cast< ScenePrimitive2D* >(this)->maLabelPrimitives = aLabelProcessor.getPrimitive2DSequence(); - const_cast< ScenePrimitive2D* >(this)->mbLabel3DChecked = true; - } - - // return if there are label primitives - return maLabelPrimitives.hasElements(); - } - // provide unique ID ImplPrimitrive2DIDBlock(ScenePrimitive2D, PRIMITIVE2D_ID_SCENEPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index 4939ae8589a6..c1963f4ba2a4 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: texteffectprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-24 15:31:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -56,7 +56,8 @@ namespace drawinglayer // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to // have good results on rotated objects, too - const basegfx::B2DVector aDistance(rViewInformation.getInverseViewTransformation() * basegfx::B2DVector(fDiscreteSize, fDiscreteSize)); + const basegfx::B2DVector aDistance(rViewInformation.getInverseObjectToViewTransformation() * + basegfx::B2DVector(fDiscreteSize, fDiscreteSize)); const basegfx::B2DVector aDiagonalDistance(aDistance * (1.0 / 1.44)); switch(getTextEffectStyle2D()) @@ -217,7 +218,7 @@ namespace drawinglayer if(getLocalDecomposition().hasElements()) { - if(maLastViewTransformation != rViewInformation.getViewTransformation()) + if(maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete const_cast< TextEffectPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence()); @@ -227,7 +228,7 @@ namespace drawinglayer if(!getLocalDecomposition().hasElements()) { // remember ViewRange and ViewTransformation - const_cast< TextEffectPrimitive2D* >(this)->maLastViewTransformation = rViewInformation.getViewTransformation(); + const_cast< TextEffectPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); } // use parent implementation |