summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2008-06-24 14:31:09 +0000
committerArmin Weiss <aw@openoffice.org>2008-06-24 14:31:09 +0000
commit1e21f485d87bad15c424df116165c42fe0f9f08d (patch)
tree7a27a0143cc31857ee4ffbfed11b800686552c64 /drawinglayer
parentca734fe7777bd7f4211557c8c61d0bc5fe9bbf37 (diff)
#i39532# corrections
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx100
-rw-r--r--drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx104
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx43
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx9
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx9
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx17
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx9
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx23
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx23
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx11
-rw-r--r--drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx24
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx46
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx10
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx7
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx6
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx18
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx17
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx16
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx11
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx18
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx7
-rw-r--r--drawinglayer/prj/d.lst2
-rw-r--r--drawinglayer/source/geometry/viewinformation2d.cxx180
-rw-r--r--drawinglayer/source/geometry/viewinformation3d.cxx85
-rw-r--r--drawinglayer/source/primitive2d/controlprimitive2d.cxx12
-rw-r--r--drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx77
-rw-r--r--drawinglayer/source/primitive2d/gridprimitive2d.cxx24
-rw-r--r--drawinglayer/source/primitive2d/helplineprimitive2d.cxx21
-rw-r--r--drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx10
-rw-r--r--drawinglayer/source/primitive2d/mediaprimitive2d.cxx10
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx139
-rw-r--r--drawinglayer/source/primitive2d/texteffectprimitive2d.cxx11
-rw-r--r--drawinglayer/source/primitive3d/makefile.mk5
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx190
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx249
-rw-r--r--drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx110
-rw-r--r--drawinglayer/source/primitive3d/sdrprimitive3d.cxx4
-rw-r--r--drawinglayer/source/processor2d/baseprocessor2d.cxx52
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx55
-rw-r--r--drawinglayer/source/processor2d/contourextractor2d.cxx71
-rw-r--r--drawinglayer/source/processor2d/makefile.mk5
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx10
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx6
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx40
-rw-r--r--drawinglayer/source/processor3d/baseprocessor3d.cxx43
-rw-r--r--drawinglayer/source/processor3d/defaultprocessor3d.cxx96
-rw-r--r--drawinglayer/source/processor3d/geometry2dextractor.cxx231
-rw-r--r--drawinglayer/source/processor3d/makefile.mk5
-rw-r--r--drawinglayer/source/processor3d/shadow3dextractor.cxx396
-rw-r--r--drawinglayer/source/processor3d/zbufferprocessor3d.cxx40
50 files changed, 1595 insertions, 1112 deletions
diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
index cc0b74319e69..d38250e7bf47 100644
--- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
+++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: viewinformation2d.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:20 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -62,62 +62,110 @@ namespace drawinglayer
{
namespace geometry
{
+ /** ViewInformation2D class
+
+ This class holds all view-relevant information for a 2d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ ::com::sun::star::graphic::XPrimitive2D for C++ implementations working with those
+ */
class ViewInformation2D
{
private:
- // impl pointer
+ /// pointer to private implementation class
ImpViewInformation2D* mpViewInformation2D;
public:
- // constructor to easily build a ViewInformation2D when all view
- // information is available as basegfx implementation classes. The
- // ExtendedParameters allows adding extra parameters besides ViewTransformation,
- // Viewport, ViewTime and DrawPage and should not itself include one of these.
+ /** Constructor: Create a ViewInformation2D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rViewTransformation
+ The Transformation from World to View coordinates (normally logic coordinates
+ to discrete units, e.g. pixels).
+
+ @param rViewport
+ The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
+ everything is visible. The data is in World coordinates.
+
+ @param rxDrawPage
+ The currently displaqyed page. This information is needed e.g. due to existing PageNumber
+ fields which need to be interpreted.
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
ViewInformation2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
const basegfx::B2DHomMatrix& rViewTransformation,
const basegfx::B2DRange& rViewport,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
double fViewTime,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
- // constructor to create a ViewInformation2D based on API information only. The
- // ViewParameters can contain ViewTransformation, Viewport and ViewTime but also
- // other parameters which will be preserved in the ExtendedInformation. The three
- // named information will be extracted locally for faster access.
+ /** Constructor: Create a ViewInformation2D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is feeded completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
- // copy constructor
+ /// copy constructor
ViewInformation2D(const ViewInformation2D& rCandidate);
- // destructor
+ /// destructor
~ViewInformation2D();
- // assignment operator
+ /// assignment operator
ViewInformation2D& operator=(const ViewInformation2D& rCandidate);
- // compare operator
+ /// compare operators
bool operator==(const ViewInformation2D& rCandidate) const;
+ bool operator!=(const ViewInformation2D& rCandidate) const { return !operator==(rCandidate); }
- // data access
+ /// data access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const;
const basegfx::B2DHomMatrix& getViewTransformation() const;
const basegfx::B2DRange& getViewport() const;
double getViewTime() const;
-
- // get the DrawPage which is visualized. Tjhis is needed e.g. for the
- // view-dependent decomposition of PageNumber Fields in Texts
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getVisualizedPage() const;
- // data access with on-demand preparations
- const basegfx::B2DHomMatrix& getInverseViewTransformation() const;
+ /// On-demand prepared Object to View transformation and it's inerse for convenience
+ const basegfx::B2DHomMatrix& getObjectToViewTransformation() const;
+ const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const;
+
+ /// On-demand prepared Viewport in discrete units for convenience
const basegfx::B2DRange& getDiscreteViewport() const;
- // get the uno::Sequence< beans::PropertyValue > which contains all information. When
- // constructed using the API constructor, You will get back Your input. If not, the
- // needed sequence will be constructed including the extended informations.
+ /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
+
+ Use this call if You need to extract all contained ViewInformation. The ones
+ directly supported for convenience will be added to the ones only available
+ as PropertyValues. This set completely describes this ViewInformation2D and
+ can be used for complete information transport over UNO API.
+ */
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
- // get the uno::Sequence< beans::PropertyValue > which contains only extra information. This means
- // information different from ViewTransformation, Viewport, ViewTime and DrawPage.
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation2D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
};
} // end of namespace geometry
diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx
index 0a5dc8b2c39f..6a6cb5d767e5 100644
--- a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx
+++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: viewinformation3d.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:20 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -60,63 +60,113 @@ namespace drawinglayer
{
namespace geometry
{
+ /** ViewInformation3D class
+
+ This class holds all view-relevant information for a 3d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ ::com::sun::star::graphic::XPrimitive3D for C++ implementations working with those
+ */
class ViewInformation3D
{
private:
- // impl pointer
+ /// pointer to private implementation class
ImpViewInformation3D* mpViewInformation3D;
public:
- // constructor to easily build a ViewInformation3D when all view
- // information is available as basegfx implementation classes. The
- // ExtendedParameters allows adding extra parameters besides the simple ones
- // and should not itself include one of these.
+ /** Constructor: Create a ViewInformation3D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rOrientation
+ A part of the 3D ViewTransformation, the World to Camera coordinates transformation
+ which holds the camera coordinate system.
+
+ @param rProjection
+ A part of the 3D ViewTransformation, the Camera to Device transformation which
+ transforms coordinates to a [0.0 .. 1.0] device range in X,Y and Z. Z may be used
+ as source for for Z-Buffers. This transformation may be e.g. a parallell projection,
+ but also a perspective one and thus may use the last line of the matrix.
+
+ @param rDeviceToView
+ A part of the 3D ViewTransformation, the Device to View transformation which normally
+ translates and scales from [0.0 .. 1.0] range in X,Y and Z to discrete position and
+ size.
+
+ rOrientation, rProjection and rDeviceToView define the 3D transformation pipeline
+ and are normally used multiplied together to have a direct transformation from
+ World to View coordinates
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
ViewInformation3D(
- const basegfx::B3DHomMatrix& rTransformation,
+ const basegfx::B3DHomMatrix& rObjectTransformation,
const basegfx::B3DHomMatrix& rOrientation,
const basegfx::B3DHomMatrix& rProjection,
const basegfx::B3DHomMatrix& rDeviceToView,
double fViewTime,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
- // constructor to create a ViewInformation3D based on API information only. The
- // ViewParameters can contain ViewTransformation, Viewport and ViewTime but also
- // other parameters which will be preserved in the ExtendedInformation. The three
- // named information will be extracted locally for faster access.
+ /** Constructor: Create a ViewInformation3D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is feeded completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
- // copy constructor
+ /// copy constructor
ViewInformation3D(const ViewInformation3D& rCandidate);
- // destructor
+ /// destructor
~ViewInformation3D();
- // assignment operator
+ /// assignment operator
ViewInformation3D& operator=(const ViewInformation3D& rCandidate);
- // compare operator
+ /// compare operators
bool operator==(const ViewInformation3D& rCandidate) const;
+ bool operator!=(const ViewInformation3D& rCandidate) const { return !operator==(rCandidate); }
- // data access
- // the four transformations defining the 3D view pipeline complately
- const basegfx::B3DHomMatrix& getTransformation() const;
+ /// data access
+ const basegfx::B3DHomMatrix& getObjectTransformation() const;
const basegfx::B3DHomMatrix& getOrientation() const;
const basegfx::B3DHomMatrix& getProjection() const;
const basegfx::B3DHomMatrix& getDeviceToView() const;
+ double getViewTime() const;
- // for convenience, the linear combination of the above four transformations
+ /// for convenience, the linear combination of the above four transformations is offered
const basegfx::B3DHomMatrix& getObjectToView() const;
- // time at which the transformation is to be used. This may be used from animated objects
- double getViewTime() const;
+ /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
- // get the uno::Sequence< beans::PropertyValue > which contains all information. When
- // constructed using the API constructor, You will get back Your input. If not, the
- // needed sequence will be constructed including the extended informations.
+ Use this call if You need to extract all contained ViewInformation. The ones
+ directly supported for convenience will be added to the ones only available
+ as PropertyValues. This set completely describes this ViewInformation3D and
+ can be used for complete information transport over UNO API.
+ */
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
- // get the uno::Sequence< beans::PropertyValue > which contains only extra information. This means
- // information different from the four transformations.
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation3D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
};
} // end of namespace geometry
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
index b7ec9dfe219a..a6c4a3935d5b 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: embedded3dprimitive2d.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -51,9 +51,34 @@ namespace drawinglayer
class Embedded3DPrimitive2D : public BasePrimitive2D
{
private:
- primitive3d::Primitive3DSequence mxChildren3D;
- basegfx::B2DHomMatrix maObjectTransformation;
- geometry::ViewInformation3D maViewInformation3D;
+ // the sequence of 3d primitives
+ primitive3d::Primitive3DSequence mxChildren3D;
+
+ // the 2D scene object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ // the 3D transformations
+ geometry::ViewInformation3D maViewInformation3D;
+
+ // if the embedded 3D primitives contain shadow, these parameters are needed
+ // to extract the shadow wich is a sequence od 2D primitives and may expand
+ // the 2D range. Since every single 3D object in a scene may individually
+ // have shadow or not, these values need to be provided and prepared. The shadow
+ // distance itself (a 2D transformation) is part of the 3D shadow definition
+ basegfx::B3DVector maLightNormal;
+ double mfShadowSlant;
+ basegfx::B3DRange maScene3DRange;
+
+ // the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DSequence maShadowPrimitives;
+
+ // bitfield
+ // flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
+ // are created in maShadowPrimitives
+ unsigned mbShadow3DChecked : 1;
+
+ // private helpers
+ bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
protected:
// local decomposition.
@@ -63,12 +88,18 @@ namespace drawinglayer
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);
// get data
const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ const basegfx::B3DVector& getLightNormal() const { return maLightNormal; }
+ double getShadowSlant() const { return mfShadowSlant; }
+ const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx
index cd2258eba8c7..ff0356f07988 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: gridprimitive2d.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -59,8 +59,9 @@ namespace drawinglayer
sal_uInt32 mnSubdivisionsY;
basegfx::BColor maBColor;
- // the last used viewInformation, used from getDecomposition for buffering
- basegfx::B2DHomMatrix maLastViewTransformation;
+ // the last used object to view transformtion and the last Viewport,
+ // used from getDecomposition for decide buffering
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
basegfx::B2DRange maLastViewport;
protected:
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx
index e5b111cf9062..a5927d41b3a6 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: helplineprimitive2d.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -63,8 +63,9 @@ namespace drawinglayer
basegfx::BColor maRGBColB;
double mfViewDashLength;
- // the last used viewInformation, used from getDecomposition for buffering
- basegfx::B2DHomMatrix maLastViewTransformation;
+ // the last used object to view transformtion and the last Viewport,
+ // used from getDecomposition for decide buffering
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
basegfx::B2DRange maLastViewport;
protected:
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
index 59c498d312f7..7a559d864229 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sceneprimitive2d.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -60,27 +60,18 @@ namespace drawinglayer
// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
Primitive2DSequence maShadowPrimitives;
- // the primitiveSequence for on-demand created label primitives (see mbLabelChecked)
- Primitive2DSequence maLabelPrimitives;
-
// bitfield
-
// flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
// are created in maShadowPrimitives
unsigned mbShadow3DChecked : 1;
- // flag if given 3D geometry is already cheched for label definitions and 2d labels
- // are created in maLabelPrimitives
- unsigned mbLabel3DChecked : 1;
-
// the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition
double mfOldDiscreteSizeX;
double mfOldDiscreteSizeY;
basegfx::B2DRange maOldUnitVisiblePart;
- // protected helpers
+ // private helpers
bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
- bool impGetLabel3D(const geometry::ViewInformation2D& rViewInformation) const;
void calculateDsicreteSizes(
const geometry::ViewInformation2D& rViewInformation,
basegfx::B2DRange& rDiscreteRange,
@@ -93,7 +84,7 @@ namespace drawinglayer
public:
// public helpers
- // Geometry extractor. Shadow and labels will be added as in createLocalDecomposition, but
+ // Geometry extractor. Shadow will be added as in createLocalDecomposition, but
// the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This
// helper is useful for Contour extraction.
Primitive2DSequence getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const;
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx
index cc0797dd6963..128b1ea5a210 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: texteffectprimitive2d.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -62,8 +62,9 @@ namespace drawinglayer
double mfDirection;
TextEffectStyle2D meTextEffectStyle2D;
- // the last used viewTransformation, used from getDecomposition for buffering
- basegfx::B2DHomMatrix maLastViewTransformation;
+ // the last used object to view transformtion used from getDecomposition
+ // for decide buffering
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
protected:
// create local decomposition
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
index c46c75396262..c17ca34d733a 100644
--- a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: drawinglayer_primitivetypes3d.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2007-03-06 12:31:47 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -54,16 +54,15 @@
#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6)
#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7)
#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8)
-#define PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9)
-#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10)
-#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11)
-#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12)
-#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13)
-#define PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14)
-#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15)
-#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16)
-#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17)
-#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18)
+#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
index 2fb0f92ecf99..43ae13d4625f 100644
--- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrextrudelathetools3d.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -43,6 +43,10 @@
//////////////////////////////////////////////////////////////////////////////
// predefines
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
@@ -114,12 +118,8 @@ namespace drawinglayer
bool bCloseBack);
// helpers for geometry extraction
- void extractLinesFromSlice(
- basegfx::B3DPolyPolygon& rLine,
- const Slice3DVector& rSliceVector,
- bool bClosed,
- bool bAddHorizontal,
- bool bAddVertical);
+ basegfx::B3DPolyPolygon extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines);
+ basegfx::B3DPolyPolygon extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector);
void extractPlanesFromSlice(
::std::vector< basegfx::B3DPolyPolygon >& rFill,
@@ -134,6 +134,13 @@ namespace drawinglayer
bool bCreateTextureCoordinates,
const basegfx::B2DHomMatrix& rTexTransform);
+ void createReducedOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget);
+
} // end of namespace overlay
} // end of namespace drawinglayer
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
index d17f3493178d..a6d386bf194a 100644
--- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrextrudeprimitive3d.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -58,6 +58,9 @@ namespace drawinglayer
double mfDiagonal;
double mfBackScale;
+ // decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ geometry::ViewInformation3D* mpLastRLGViewInformation;
+
// bitfield
unsigned mbSmoothNormals : 1; // Plane self
unsigned mbSmoothHorizontalNormals : 1; // always
@@ -92,6 +95,7 @@ namespace drawinglayer
bool bCharacterMode,
bool bCloseFront,
bool bCloseBack);
+ virtual ~SdrExtrudePrimitive3D();
// data access
const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
@@ -111,6 +115,9 @@ namespace drawinglayer
// get range
virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+ // Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
// provide unique ID
DeclPrimitrive3DIDBlock()
};
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
index ec9ebe3fabe8..99d06e256431 100644
--- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrlatheprimitive3d.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -49,6 +49,7 @@ namespace drawinglayer
{
private:
// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
Slice3DVector maSlices;
// primitive data
@@ -59,6 +60,9 @@ namespace drawinglayer
double mfBackScale;
double mfRotation;
+ // decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ geometry::ViewInformation3D* mpLastRLGViewInformation;
+
// bitfield
unsigned mbSmoothNormals : 1; // Plane self
unsigned mbSmoothHorizontalNormals : 1; // always
@@ -74,6 +78,18 @@ namespace drawinglayer
const Slice3DVector& getSlices() const;
protected:
+ // local helpers
+ void impCreateOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget) const;
+
+ bool impHasCutWith(
+ const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd) const;
+
// local decomposition.
virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
@@ -95,6 +111,7 @@ namespace drawinglayer
bool bCharacterMode,
bool bCloseFront,
bool bCloseBack);
+ virtual ~SdrLathePrimitive3D();
// data access
const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
@@ -116,6 +133,9 @@ namespace drawinglayer
// get range
virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+ // Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
// provide unique ID
DeclPrimitrive3DIDBlock()
};
diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx
index 45cc54e9df23..fceae8dbeb31 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: baseprocessor2d.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -56,12 +56,17 @@ namespace drawinglayer
maViewInformation2D = rViewInformation2D;
}
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive2D-based.
+ // Default implementation does nothing
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
public:
BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation);
virtual ~BaseProcessor2D();
// the central processing method
- virtual void process(const primitive2d::Primitive2DSequence& rSource) = 0;
+ virtual void process(const primitive2d::Primitive2DSequence& rSource);
// data access
const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
@@ -71,41 +76,6 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
-namespace drawinglayer
-{
- namespace processor2d
- {
- class CollectingProcessor2D : public BaseProcessor2D
- {
- private:
- primitive2d::Primitive2DSequence maPrimitive2DSequence;
-
- public:
- CollectingProcessor2D(const geometry::ViewInformation2D& rViewInformation);
-
- // the central processing method
- virtual void process(const primitive2d::Primitive2DSequence& rSource);
-
- // helpers for adding to local sequence
- void appendPrimitive2DSequence(const primitive2d::Primitive2DSequence& rSource)
- {
- primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(maPrimitive2DSequence, rSource);
- }
-
- void appendPrimitive2DReference(const primitive2d::Primitive2DReference& rSource)
- {
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, rSource);
- }
-
- // data access and reset
- const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
- void reset() { maPrimitive2DSequence = primitive2d::Primitive2DSequence(); }
- };
- } // end of namespace processor2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
#endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
// eof
diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
index b023b1288b8d..8e14f3118c70 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: canvasprocessor.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -75,9 +75,6 @@ namespace drawinglayer
// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
- // the current transformation
- basegfx::B2DHomMatrix maCurrentTransformation;
-
// SvtOptionsDrawinglayer incarnation to react on diverse settings
const SvtOptionsDrawinglayer maDrawinglayerOpt;
@@ -98,9 +95,6 @@ namespace drawinglayer
const com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas >& rCanvas);
virtual ~canvasProcessor2D();
- // the central processing method
- virtual void process(const primitive2d::Primitive2DSequence& rSource);
-
// access to Drawinglayer configuration options
const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
};
diff --git a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
index 43ad95d0e9ef..dbe85fab07c5 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: contourextractor2d.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -49,7 +49,7 @@ namespace drawinglayer
class ContourExtractor2D : public BaseProcessor2D
{
private:
- basegfx::B2DHomMatrix maCurrentTransformation;
+ // the extracted contour
std::vector< basegfx::B2DPolyPolygon > maExtractedContour;
// tooling methods
@@ -59,7 +59,6 @@ namespace drawinglayer
ContourExtractor2D(const geometry::ViewInformation2D& rViewInformation);
virtual ~ContourExtractor2D();
- virtual void process(const primitive2d::Primitive2DSequence& rSource);
const std::vector< basegfx::B2DPolyPolygon >& getExtractedContour() const { return maExtractedContour; }
};
} // end of namespace processor2d
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
index 6361a7be7eec..f0d0ff881bc5 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclmetafileprocessor2d.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -106,7 +106,7 @@ namespace drawinglayer
// same for SvtGraphicStroke
sal_uInt32 mnSvtGraphicStrokeCount;
- // hold the last unified transparence value to have ot handy
+ // hold the last unified transparence value to have it handy
// on SvtGraphicStroke creation
double mfCurrentUnifiedTransparence;
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
index 0bf9233384e7..fb9bf24bdb2e 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclprocessor2d.hxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -81,7 +81,9 @@ namespace drawinglayer
// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
- // the current transformation
+ // the current transformation. Since VCL pixel renderer transforms to pixels
+ // and VCL MetaFile renderer to World (logic) coordinates, the local
+ // ViewInformation2D cannot directly be used, but needs to be kept up to date
basegfx::B2DHomMatrix maCurrentTransformation;
// SvtOptionsDrawinglayer incarnation to react on diverse settings
@@ -121,10 +123,6 @@ namespace drawinglayer
// FormControl support
basegfx::B2DPoint PositionAndSizeControl(const primitive2d::ControlPrimitive2D& rControlPrimitive2D);
- // as tooling, the process() implementation takes over API handling and calls this
- // virtual render method when the primitive implementation is BasePrimitive2D-based.
- virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) = 0;
-
public:
// constructor/destructor
VclProcessor2D(
@@ -132,12 +130,6 @@ namespace drawinglayer
OutputDevice& rOutDev);
virtual ~VclProcessor2D();
- // the central processing method
- // This VCL base implementation takes over the API handling and calls processBasePrimitive2D
- // directly when it's a BasePrinitive2D implementation. This is used as tooling from derived
- // implementations
- virtual void process(const primitive2d::Primitive2DSequence& rSource);
-
// access to Drawinglayer configuration options
const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
};
diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx
index 9528973415ab..effc509d9981 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: baseprocessor3d.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -56,12 +56,17 @@ namespace drawinglayer
maViewInformation3D = rViewInformation3D;
}
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ // Default implementation does nothing
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
public:
BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation);
virtual ~BaseProcessor3D();
// the central processing method
- virtual void process(const primitive3d::Primitive3DSequence& rSource) = 0;
+ virtual void process(const primitive3d::Primitive3DSequence& rSource);
// data access
const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
@@ -82,16 +87,12 @@ namespace drawinglayer
public:
CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation);
+ virtual ~CollectingProcessor3D();
// the central processing method
virtual void process(const primitive3d::Primitive3DSequence& rSource);
// helpers for adding to local sequence
- void appendPrimitive3DSequence(const primitive3d::Primitive3DSequence& rSource)
- {
- primitive3d::appendPrimitive3DSequenceToPrimitive3DSequence(maPrimitive3DSequence, rSource);
- }
-
void appendPrimitive3DReference(const primitive3d::Primitive3DReference& rSource)
{
primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(maPrimitive3DSequence, rSource);
diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
index cef93af14cd7..7f01f9328153 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: defaultprocessor3d.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -82,15 +82,9 @@ namespace drawinglayer
const attribute::SdrSceneAttribute& mrSdrSceneAttribute; // read-only scene infos (normal handling, etc...)
const attribute::SdrLightingAttribute& mrSdrLightingAttribute; // read-only light infos (lights, etc...)
- // renderer transformations and range. Need to be correctly set by the
- // derived implementations
- basegfx::B3DHomMatrix maWorldToEye; // world to eye coordinates
- basegfx::B3DHomMatrix maWorldToView; // mul maWorldToEye with maProjection and maDeviceToView
+ // renderer range. Need to be correctly set by the derived implementations
basegfx::B2DRange maRasterRange; // the (0, 0, W, H) range from mpBZPixelRaster
- // inverse from maWorldToView, filled on demand
- basegfx::B3DHomMatrix maInvWorldToView; // back from view to world coordinates
-
// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
@@ -131,10 +125,6 @@ namespace drawinglayer
const attribute::SdrLightingAttribute& rSdrLightingAttribute);
virtual ~DefaultProcessor3D();
- // the central processing method. It checks for known primitive implementation
- // and uses processBasePrimitive3D or forwards to API implementations
- virtual void process(const primitive3d::Primitive3DSequence& rSource);
-
// data read access
const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx
index a12e0792a42d..457ede952ccd 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: geometry2dextractor.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:22 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -60,14 +60,15 @@ namespace drawinglayer
// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
public:
Geometry2DExtractingProcessor(
const geometry::ViewInformation3D& rViewInformation,
const basegfx::B2DHomMatrix& rObjectTransformation);
- // the central processing method
- virtual void process(const primitive3d::Primitive3DSequence& rSource);
-
// data access
const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx
index 6aff5a46fbe3..abb92693a037 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: shadow3dextractor.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:22 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -44,7 +44,6 @@
#include <basegfx/polygon/b3dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b3dpolypolygon.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -89,16 +88,17 @@ namespace drawinglayer
basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource);
basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource);
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
public:
Shadow3DExtractingProcessor(
const geometry::ViewInformation3D& rViewInformation,
const basegfx::B2DHomMatrix& rObjectTransformation,
- const attribute::SdrLightingAttribute& rSdrLightingAttribute,
- const primitive3d::Primitive3DSequence& rPrimitiveVector,
- double fShadowSlant);
-
- // the central processing method
- virtual void process(const primitive3d::Primitive3DSequence& rSource);
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rContained3DRange);
// data access
const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
index dd0d0bc1b4eb..d2ef8bd7f249 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: zbufferprocessor3d.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:22 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -117,9 +117,6 @@ namespace drawinglayer
// get the result as bitmapEx
BitmapEx getBitmapEx() const;
-
- // data access
- const basegfx::B3DHomMatrix& getViewToEye() const { return maInvEyeToView; }
};
} // end of namespace processor3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index ba72b0e2711e..373bf575f916 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -58,7 +58,6 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d
..\inc\drawinglayer\primitive3d\sdrdecompositiontools3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrdecompositiontools3d.hxx
..\inc\drawinglayer\primitive3d\sdrextrudelathetools3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrextrudelathetools3d.hxx
..\inc\drawinglayer\primitive3d\sdrextrudeprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrextrudeprimitive3d.hxx
-..\inc\drawinglayer\primitive3d\sdrlabelprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrlabelprimitive3d.hxx
..\inc\drawinglayer\primitive3d\sdrlatheprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrlatheprimitive3d.hxx
..\inc\drawinglayer\primitive3d\sdrpolypolygonprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrpolypolygonprimitive3d.hxx
..\inc\drawinglayer\primitive3d\sdrprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\sdrprimitive3d.hxx
@@ -81,6 +80,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor2d
..\inc\drawinglayer\processor2d\vclmetafileprocessor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\vclmetafileprocessor2d.hxx
..\inc\drawinglayer\processor2d\canvasprocessor.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\canvasprocessor.hxx
..\inc\drawinglayer\processor2d\contourextractor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\contourextractor2d.hxx
+..\inc\drawinglayer\processor2d\linegeometryextractor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\linegeometryextractor2d.hxx
mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d
..\inc\drawinglayer\processor3d\baseprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\baseprocessor3d.hxx
diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx
index 87ec9c7163d5..52fdf12cf3bc 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: viewinformation2d.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:07 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -61,13 +61,20 @@ namespace drawinglayer
// two memory regions for pairs of ViewInformation2D/ImpViewInformation2D
friend class ::drawinglayer::geometry::ViewInformation2D;
- // the refcounter
+ // the refcounter. 0 means exclusively used
sal_uInt32 mnRefCount;
protected:
- // the view transformation and the on-demand inverse of it
+ // the object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ // the view transformation
basegfx::B2DHomMatrix maViewTransformation;
- basegfx::B2DHomMatrix maInverseViewTransformation;
+
+ // the ObjectToView and it's inverse, both on demand from ObjectTransformation
+ // and ViewTransformation
+ basegfx::B2DHomMatrix maObjectToViewTransformation;
+ basegfx::B2DHomMatrix maInverseObjectToViewTransformation;
// the visible range and the on-demand one in ViewCoordinates
basegfx::B2DRange maViewport;
@@ -87,33 +94,35 @@ namespace drawinglayer
// Viewport, VisualizedPage or ViewTime
uno::Sequence< beans::PropertyValue > mxExtendedInformation;
- // bitfield
- unsigned mbInverseValid : 1;
- unsigned mbDiscreteViewportValid : 1;
-
// the local UNO API strings
- const ::rtl::OUString& getNamePropertyTransformation()
+ const ::rtl::OUString& getNamePropertyObjectTransformation()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Transformation"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("ObjectTransformation"));
+ return s_sNameProperty;
+ }
+
+ const ::rtl::OUString& getNamePropertyViewTransformation()
+ {
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("ViewTransformation"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyViewport()
{
- static ::rtl::OUString s_sNamePropertyViewport(RTL_CONSTASCII_USTRINGPARAM("Viewport"));
- return s_sNamePropertyViewport;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Viewport"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyTime()
{
- static ::rtl::OUString s_sNamePropertyTime(RTL_CONSTASCII_USTRINGPARAM("Time"));
- return s_sNamePropertyTime;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Time"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyVisualizedPage()
{
- static ::rtl::OUString s_sNamePropertyXDrawPage(RTL_CONSTASCII_USTRINGPARAM("VisualizedPage"));
- return s_sNamePropertyXDrawPage;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("VisualizedPage"));
+ return s_sNameProperty;
}
void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters)
@@ -130,7 +139,13 @@ namespace drawinglayer
{
const beans::PropertyValue& rProp = rViewParameters[a];
- if(rProp.Name == getNamePropertyTransformation())
+ if(rProp.Name == getNamePropertyObjectTransformation())
+ {
+ com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D;
+ rProp.Value >>= aAffineMatrix2D;
+ basegfx::unotools::homMatrixFromAffineMatrix(maObjectTransformation, aAffineMatrix2D);
+ }
+ else if(rProp.Name == getNamePropertyViewTransformation())
{
com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D;
rProp.Value >>= aAffineMatrix2D;
@@ -165,6 +180,7 @@ namespace drawinglayer
void impFillViewInformationFromContent()
{
uno::Sequence< beans::PropertyValue > xRetval;
+ const bool bObjectTransformationUsed(!maObjectTransformation.isIdentity());
const bool bViewTransformationUsed(!maViewTransformation.isIdentity());
const bool bViewportUsed(!maViewport.isEmpty());
const bool bTimeUsed(0.0 < mfViewTime);
@@ -172,6 +188,7 @@ namespace drawinglayer
const bool bExtraInformation(mxExtendedInformation.hasElements());
sal_uInt32 nIndex(0);
const sal_uInt32 nCount(
+ (bObjectTransformationUsed ? 1 : 0) +
(bViewTransformationUsed ? 1 : 0) +
(bViewportUsed ? 1 : 0) +
(bTimeUsed ? 1 : 0) +
@@ -180,11 +197,20 @@ namespace drawinglayer
mxViewInformation.realloc(nCount);
+ if(bObjectTransformationUsed)
+ {
+ com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D;
+ basegfx::unotools::affineMatrixFromHomMatrix(aAffineMatrix2D, maObjectTransformation);
+ mxViewInformation[nIndex].Name = getNamePropertyObjectTransformation();
+ mxViewInformation[nIndex].Value <<= aAffineMatrix2D;
+ nIndex++;
+ }
+
if(bViewTransformationUsed)
{
com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D;
basegfx::unotools::affineMatrixFromHomMatrix(aAffineMatrix2D, maViewTransformation);
- mxViewInformation[nIndex].Name = getNamePropertyTransformation();
+ mxViewInformation[nIndex].Name = getNamePropertyViewTransformation();
mxViewInformation[nIndex].Value <<= aAffineMatrix2D;
nIndex++;
}
@@ -224,79 +250,105 @@ namespace drawinglayer
public:
ImpViewInformation2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
const basegfx::B2DHomMatrix& rViewTransformation,
const basegfx::B2DRange& rViewport,
const uno::Reference< drawing::XDrawPage >& rxDrawPage,
double fViewTime,
const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
: mnRefCount(0),
+ maObjectTransformation(rObjectTransformation),
maViewTransformation(rViewTransformation),
- maInverseViewTransformation(maViewTransformation),
+ maObjectToViewTransformation(),
+ maInverseObjectToViewTransformation(),
maViewport(rViewport),
maDiscreteViewport(),
mxVisualizedPage(rxDrawPage),
mfViewTime(fViewTime),
mxViewInformation(),
- mxExtendedInformation(),
- mbInverseValid(false),
- mbDiscreteViewportValid(false)
+ mxExtendedInformation()
{
impInterpretPropertyValues(rExtendedParameters);
}
ImpViewInformation2D(const uno::Sequence< beans::PropertyValue >& rViewParameters)
: mnRefCount(0),
+ maObjectTransformation(),
maViewTransformation(),
- maInverseViewTransformation(),
+ maObjectToViewTransformation(),
+ maInverseObjectToViewTransformation(),
maViewport(),
maDiscreteViewport(),
mxVisualizedPage(),
mfViewTime(),
mxViewInformation(rViewParameters),
- mxExtendedInformation(),
- mbInverseValid(false),
- mbDiscreteViewportValid(false)
+ mxExtendedInformation()
{
impInterpretPropertyValues(rViewParameters);
}
- const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const
+ {
+ return maObjectTransformation;
+ }
- const basegfx::B2DRange& getViewport() const { return maViewport; }
+ const basegfx::B2DHomMatrix& getViewTransformation() const
+ {
+ return maViewTransformation;
+ }
+
+ const basegfx::B2DRange& getViewport() const
+ {
+ return maViewport;
+ }
const basegfx::B2DRange& getDiscreteViewport() const
{
::osl::Mutex m_mutex;
- if(!mbDiscreteViewportValid)
+ if(maDiscreteViewport.isEmpty() && !maViewport.isEmpty())
{
- if(!maViewport.isEmpty())
- {
- basegfx::B2DRange aDiscreteViewport(maViewport);
- aDiscreteViewport.transform(getViewTransformation());
- const_cast< ImpViewInformation2D* >(this)->maDiscreteViewport = aDiscreteViewport;
- }
-
- const_cast< ImpViewInformation2D* >(this)->mbDiscreteViewportValid = true;
+ basegfx::B2DRange aDiscreteViewport(maViewport);
+ aDiscreteViewport.transform(getViewTransformation());
+ const_cast< ImpViewInformation2D* >(this)->maDiscreteViewport = aDiscreteViewport;
}
return maDiscreteViewport;
}
- const basegfx::B2DHomMatrix& getInverseViewTransformation() const
+ const basegfx::B2DHomMatrix& getObjectToViewTransformation() const
+ {
+ ::osl::Mutex m_mutex;
+
+ if(maObjectToViewTransformation.isIdentity() &&
+ (!maObjectTransformation.isIdentity() || !maViewTransformation.isIdentity()))
+ {
+ basegfx::B2DHomMatrix aObjectToView(maViewTransformation * maObjectTransformation);
+ const_cast< ImpViewInformation2D* >(this)->maObjectToViewTransformation = aObjectToView;
+ }
+
+ return maObjectToViewTransformation;
+ }
+
+ const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const
{
::osl::Mutex m_mutex;
- if(!mbInverseValid)
+ if(maInverseObjectToViewTransformation.isIdentity() &&
+ (!maObjectTransformation.isIdentity() || !maViewTransformation.isIdentity()))
{
- const_cast< ImpViewInformation2D* >(this)->maInverseViewTransformation.invert();
- const_cast< ImpViewInformation2D* >(this)->mbInverseValid = true;
+ basegfx::B2DHomMatrix aInverseObjectToView(maViewTransformation * maObjectTransformation);
+ aInverseObjectToView.invert();
+ const_cast< ImpViewInformation2D* >(this)->maInverseObjectToViewTransformation = aInverseObjectToView;
}
- return maInverseViewTransformation;
+ return maInverseObjectToViewTransformation;
}
- double getViewTime() const { return mfViewTime; }
+ double getViewTime() const
+ {
+ return mfViewTime;
+ }
const uno::Reference< drawing::XDrawPage >& getVisualizedPage() const
{
@@ -320,7 +372,8 @@ namespace drawinglayer
bool operator==(const ImpViewInformation2D& rCandidate) const
{
- return (maViewTransformation == rCandidate.maViewTransformation
+ return (maObjectTransformation == rCandidate.maObjectTransformation
+ && maViewTransformation == rCandidate.maViewTransformation
&& maViewport == rCandidate.maViewport
&& mxVisualizedPage == rCandidate.mxVisualizedPage
&& mfViewTime == rCandidate.mfViewTime
@@ -337,12 +390,19 @@ namespace drawinglayer
namespace geometry
{
ViewInformation2D::ViewInformation2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
const basegfx::B2DHomMatrix& rViewTransformation,
const basegfx::B2DRange& rViewport,
const uno::Reference< drawing::XDrawPage >& rxDrawPage,
double fViewTime,
const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
- : mpViewInformation2D(new ImpViewInformation2D(rViewTransformation, rViewport, rxDrawPage, fViewTime, rExtendedParameters))
+ : mpViewInformation2D(new ImpViewInformation2D(
+ rObjectTransformation,
+ rViewTransformation,
+ rViewport,
+ rxDrawPage,
+ fViewTime,
+ rExtendedParameters))
{
}
@@ -401,6 +461,11 @@ namespace drawinglayer
return (*rCandidate.mpViewInformation2D == *mpViewInformation2D);
}
+ const basegfx::B2DHomMatrix& ViewInformation2D::getObjectTransformation() const
+ {
+ return mpViewInformation2D->getObjectTransformation();
+ }
+
const basegfx::B2DHomMatrix& ViewInformation2D::getViewTransformation() const
{
return mpViewInformation2D->getViewTransformation();
@@ -411,24 +476,29 @@ namespace drawinglayer
return mpViewInformation2D->getViewport();
}
- const basegfx::B2DRange& ViewInformation2D::getDiscreteViewport() const
+ double ViewInformation2D::getViewTime() const
{
- return mpViewInformation2D->getDiscreteViewport();
+ return mpViewInformation2D->getViewTime();
}
- const basegfx::B2DHomMatrix& ViewInformation2D::getInverseViewTransformation() const
+ const uno::Reference< drawing::XDrawPage >& ViewInformation2D::getVisualizedPage() const
{
- return mpViewInformation2D->getInverseViewTransformation();
+ return mpViewInformation2D->getVisualizedPage();
}
- double ViewInformation2D::getViewTime() const
+ const basegfx::B2DHomMatrix& ViewInformation2D::getObjectToViewTransformation() const
{
- return mpViewInformation2D->getViewTime();
+ return mpViewInformation2D->getObjectToViewTransformation();
}
- const uno::Reference< drawing::XDrawPage >& ViewInformation2D::getVisualizedPage() const
+ const basegfx::B2DHomMatrix& ViewInformation2D::getInverseObjectToViewTransformation() const
{
- return mpViewInformation2D->getVisualizedPage();
+ return mpViewInformation2D->getInverseObjectToViewTransformation();
+ }
+
+ const basegfx::B2DRange& ViewInformation2D::getDiscreteViewport() const
+ {
+ return mpViewInformation2D->getDiscreteViewport();
}
const uno::Sequence< beans::PropertyValue >& ViewInformation2D::getViewInformationSequence() const
diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx
index 2f5546c75e4f..61ceddc8396a 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: viewinformation3d.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:07 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -53,6 +53,8 @@ namespace drawinglayer
{
namespace
{
+ /** Implementation class for ViewInformation3D
+ */
class ImpViewInformation3D
{
private:
@@ -60,13 +62,13 @@ namespace drawinglayer
// two memory regions for pairs of ViewInformation3D/ImpViewInformation3D
friend class ::drawinglayer::geometry::ViewInformation3D;
- // the refcounter
+ // the refcounter. 0 means exclusively used
sal_uInt32 mnRefCount;
// the 3D transformations
// Object to World. This may change and being adapted when entering 3D transformation
// groups
- basegfx::B3DHomMatrix maTransformation;
+ basegfx::B3DHomMatrix maObjectTransformation;
// World to Camera. This includes VRP, VPN and VUV camera coordinate system
basegfx::B3DHomMatrix maOrientation;
@@ -96,52 +98,52 @@ namespace drawinglayer
uno::Sequence< beans::PropertyValue > mxExtendedInformation;
// the local UNO API strings
- const ::rtl::OUString& getNamePropertyTransformation()
+ const ::rtl::OUString& getNamePropertyObjectTransformation()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Transformation"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("ObjectTransformation"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyOrientation()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Orientation"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Orientation"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyProjection()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyProjection_30()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection30"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection30"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyProjection_31()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection31"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection31"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyProjection_32()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection32"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection32"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyProjection_33()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection33"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("Projection33"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyDeviceToView()
{
- static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("DeviceToView"));
- return s_sNamePropertyTransformation;
+ static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("DeviceToView"));
+ return s_sNameProperty;
}
const ::rtl::OUString& getNamePropertyTime()
@@ -150,6 +152,8 @@ namespace drawinglayer
return s_sNamePropertyTime;
}
+ // a central PropertyValue parsing method to allow transportatin of
+ // all ViewParameters using UNO API
void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters)
{
if(rViewParameters.hasElements())
@@ -164,11 +168,11 @@ namespace drawinglayer
{
const beans::PropertyValue& rProp = rViewParameters[a];
- if(rProp.Name == getNamePropertyTransformation())
+ if(rProp.Name == getNamePropertyObjectTransformation())
{
com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D;
- maTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
+ maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
}
else if(rProp.Name == getNamePropertyOrientation())
{
@@ -241,10 +245,12 @@ namespace drawinglayer
}
}
+ // central method to create a Sequence of PropertyValues containing he complete
+ // data set
void impFillViewInformationFromContent()
{
uno::Sequence< beans::PropertyValue > xRetval;
- const bool bTransformationUsed(!maTransformation.isIdentity());
+ const bool bObjectTransformationUsed(!maObjectTransformation.isIdentity());
const bool bOrientationUsed(!maOrientation.isIdentity());
const bool bProjectionUsed(!maProjection.isIdentity());
const bool bDeviceToViewUsed(!maDeviceToView.isIdentity());
@@ -261,7 +267,7 @@ namespace drawinglayer
sal_uInt32 nIndex(0);
const sal_uInt32 nCount(
- (bTransformationUsed ? 1 : 0) +
+ (bObjectTransformationUsed ? 1 : 0) +
(bOrientationUsed ? 1 : 0) +
(bProjectionUsed ? 1 : 0) +
(bProjectionUsed_30 ? 1 : 0) +
@@ -274,11 +280,11 @@ namespace drawinglayer
mxViewInformation.realloc(nCount);
- if(bTransformationUsed)
+ if(bObjectTransformationUsed)
{
com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D;
- basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maTransformation);
- mxViewInformation[nIndex].Name = getNamePropertyTransformation();
+ basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maObjectTransformation);
+ mxViewInformation[nIndex].Name = getNamePropertyObjectTransformation();
mxViewInformation[nIndex].Value <<= aAffineMatrix3D;
nIndex++;
}
@@ -358,14 +364,14 @@ namespace drawinglayer
public:
ImpViewInformation3D(
- const basegfx::B3DHomMatrix& rTransformation,
+ const basegfx::B3DHomMatrix& rObjectTransformation,
const basegfx::B3DHomMatrix& rOrientation,
const basegfx::B3DHomMatrix& rProjection,
const basegfx::B3DHomMatrix& rDeviceToView,
double fViewTime,
const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
: mnRefCount(0),
- maTransformation(rTransformation),
+ maObjectTransformation(rObjectTransformation),
maOrientation(rOrientation),
maProjection(rProjection),
maDeviceToView(rDeviceToView),
@@ -378,7 +384,7 @@ namespace drawinglayer
ImpViewInformation3D(const uno::Sequence< beans::PropertyValue >& rViewParameters)
: mnRefCount(0),
- maTransformation(),
+ maObjectTransformation(),
maOrientation(),
maProjection(),
maDeviceToView(),
@@ -389,11 +395,10 @@ namespace drawinglayer
impInterpretPropertyValues(rViewParameters);
}
- const basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; }
+ const basegfx::B3DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; }
const basegfx::B3DHomMatrix& getProjection() const { return maProjection; }
const basegfx::B3DHomMatrix& getDeviceToView() const { return maDeviceToView; }
-
double getViewTime() const { return mfViewTime; }
const basegfx::B3DHomMatrix& getObjectToView() const
@@ -403,7 +408,7 @@ namespace drawinglayer
if(maObjectToView.isIdentity())
{
- const_cast< ImpViewInformation3D* >(this)->maObjectToView = maDeviceToView * maProjection * maOrientation * maTransformation;
+ const_cast< ImpViewInformation3D* >(this)->maObjectToView = maDeviceToView * maProjection * maOrientation * maObjectTransformation;
}
return maObjectToView;
@@ -411,6 +416,8 @@ namespace drawinglayer
const uno::Sequence< beans::PropertyValue >& getViewInformationSequence() const
{
+ ::osl::Mutex m_mutex;
+
if(!mxViewInformation.hasElements())
{
const_cast< ImpViewInformation3D* >(this)->impFillViewInformationFromContent();
@@ -426,7 +433,7 @@ namespace drawinglayer
bool operator==(const ImpViewInformation3D& rCandidate) const
{
- return (maTransformation == rCandidate.maTransformation
+ return (maObjectTransformation == rCandidate.maObjectTransformation
&& maOrientation == rCandidate.maOrientation
&& maProjection == rCandidate.maProjection
&& maDeviceToView == rCandidate.maDeviceToView
@@ -444,13 +451,13 @@ namespace drawinglayer
namespace geometry
{
ViewInformation3D::ViewInformation3D(
- const basegfx::B3DHomMatrix& rTransformation,
+ const basegfx::B3DHomMatrix& rObjectObjectTransformation,
const basegfx::B3DHomMatrix& rOrientation,
const basegfx::B3DHomMatrix& rProjection,
const basegfx::B3DHomMatrix& rDeviceToView,
double fViewTime,
const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
- : mpViewInformation3D(new ImpViewInformation3D(rTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters))
+ : mpViewInformation3D(new ImpViewInformation3D(rObjectObjectTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters))
{
}
@@ -509,9 +516,9 @@ namespace drawinglayer
return (*rCandidate.mpViewInformation3D == *mpViewInformation3D);
}
- const basegfx::B3DHomMatrix& ViewInformation3D::getTransformation() const
+ const basegfx::B3DHomMatrix& ViewInformation3D::getObjectTransformation() const
{
- return mpViewInformation3D->getTransformation();
+ return mpViewInformation3D->getObjectTransformation();
}
const basegfx::B3DHomMatrix& ViewInformation3D::getOrientation() const
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
diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk
index d30d1dd942f5..325155995acf 100644
--- a/drawinglayer/source/primitive3d/makefile.mk
+++ b/drawinglayer/source/primitive3d/makefile.mk
@@ -4,9 +4,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: aw $ $Date: 2006-10-19 10:38: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.
@@ -56,7 +56,6 @@ SLOFILES= \
$(SLO)$/sdrdecompositiontools3d.obj \
$(SLO)$/sdrextrudelathetools3d.obj \
$(SLO)$/sdrextrudeprimitive3d.obj \
- $(SLO)$/sdrlabelprimitive3d.obj \
$(SLO)$/sdrlatheprimitive3d.obj \
$(SLO)$/sdrpolypolygonprimitive3d.obj \
$(SLO)$/sdrprimitive3d.obj \
diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
index 93b0555055dc..973a82c8eca4 100644
--- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrextrudelathetools3d.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $
+ * 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.
@@ -48,6 +48,7 @@
#include <basegfx/range/b3drange.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
#include <numeric>
//////////////////////////////////////////////////////////////////////////////
@@ -327,6 +328,36 @@ namespace
rPolA.setB3DPolygon(a, aSubA);
}
}
+
+ bool impHasCutWith(const basegfx::B2DPolygon& rPoly, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd)
+ {
+ // polygon is closed, one of the points is a member
+ const sal_uInt32 nPointCount(rPoly.count());
+
+ if(nPointCount)
+ {
+ basegfx::B2DPoint aCurrent(rPoly.getB2DPoint(0));
+ const basegfx::B2DVector aVector(rEnd - rStart);
+
+ for(sal_uInt32 a(0); a < nPointCount; a++)
+ {
+ const sal_uInt32 nNextIndex((a + 1) % nPointCount);
+ const basegfx::B2DPoint aNext(rPoly.getB2DPoint(nNextIndex));
+ const basegfx::B2DVector aEdgeVector(aNext - aCurrent);
+
+ if(basegfx::tools::findCut(
+ rStart, aVector,
+ aCurrent, aEdgeVector))
+ {
+ return true;
+ }
+
+ aCurrent = aNext;
+ }
+ }
+
+ return false;
+ }
} // end of anonymous namespace
//////////////////////////////////////////////////////////////////////////////
@@ -501,52 +532,52 @@ namespace drawinglayer
}
}
- void extractLinesFromSlice(
- basegfx::B3DPolyPolygon& rLine,
- const Slice3DVector& rSliceVector,
- bool bClosed,
- bool bAddHorizontal,
- bool bAddVertical)
+ basegfx::B3DPolyPolygon extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines)
{
+ basegfx::B3DPolyPolygon aRetval;
const sal_uInt32 nNumSlices(rSliceVector.size());
if(nNumSlices)
{
- // Slice3Ds self
- if(bAddVertical)
- {
- for(sal_uInt32 a(0L); a < nNumSlices; a++)
- {
- rLine.append(rSliceVector[a].getB3DPolyPolygon());
- }
- }
+ const sal_uInt32 nSlideSubPolygonCount(rSliceVector[0].getB3DPolyPolygon().count());
- // horizontal
- if(bAddHorizontal)
- {
- const basegfx::B3DPolyPolygon& aFirstPolyPolygon(rSliceVector[0L].getB3DPolyPolygon());
- const sal_uInt32 nPolygonCount(aFirstPolyPolygon.count());
+ for(sal_uInt32 b(0); b < nSlideSubPolygonCount; b++)
+ {
+ const sal_uInt32 nSubPolygonPointCount(rSliceVector[0].getB3DPolyPolygon().getB3DPolygon(b).count());
- for(sal_uInt32 b(0L); b < nPolygonCount; b++)
+ for(sal_uInt32 c(0); c < nSubPolygonPointCount; c++)
{
- const basegfx::B3DPolygon& aFirstPolygon(aFirstPolyPolygon.getB3DPolygon(0L));
- const sal_uInt32 nPointCount(aFirstPolygon.count());
+ basegfx::B3DPolygon aNew;
- for(sal_uInt32 c(0L); c < nPointCount; c++)
+ for(sal_uInt32 d(0); d < nNumSlices; d++)
{
- basegfx::B3DPolygon aNew;
-
- for(sal_uInt32 d(0L); d < nNumSlices; d++)
- {
- aNew.append(rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).getB3DPoint(c));
- }
-
- aNew.setClosed(bClosed);
- rLine.append(aNew);
+ OSL_ENSURE(nSlideSubPolygonCount == rSliceVector[d].getB3DPolyPolygon().count(),
+ "Slice PolyPolygon with different Polygon count (!)");
+ OSL_ENSURE(nSubPolygonPointCount == rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).count(),
+ "Slice Polygon with different point count (!)");
+ aNew.append(rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).getB3DPoint(c));
}
+
+ aNew.setClosed(bCloseHorLines);
+ aRetval.append(aNew);
}
}
}
+
+ return aRetval;
+ }
+
+ basegfx::B3DPolyPolygon extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector)
+ {
+ basegfx::B3DPolyPolygon aRetval;
+ const sal_uInt32 nNumSlices(rSliceVector.size());
+
+ for(sal_uInt32 a(0L); a < nNumSlices; a++)
+ {
+ aRetval.append(rSliceVector[a].getB3DPolyPolygon());
+ }
+
+ return aRetval;
}
void extractPlanesFromSlice(
@@ -870,6 +901,97 @@ namespace drawinglayer
}
}
+ void createReducedOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget)
+ {
+ const sal_uInt32 nPointCount(rLoopA.count());
+
+ // with idetic polygons there are no outlines
+ if(rLoopA != rLoopB)
+ {
+ if(nPointCount && nPointCount == rLoopB.count())
+ {
+ const basegfx::B3DHomMatrix aObjectTransform(rViewInformation.getObjectToView() * rObjectTransform);
+ const basegfx::B2DPolygon a2DLoopA(basegfx::tools::createB2DPolygonFromB3DPolygon(rLoopA, aObjectTransform));
+ const basegfx::B2DPolygon a2DLoopB(basegfx::tools::createB2DPolygonFromB3DPolygon(rLoopB, aObjectTransform));
+ const basegfx::B2DPoint a2DCenterA(a2DLoopA.getB2DRange().getCenter());
+ const basegfx::B2DPoint a2DCenterB(a2DLoopB.getB2DRange().getCenter());
+
+ // without detectable Y-Axis there are no outlines
+ if(!a2DCenterA.equal(a2DCenterB))
+ {
+ // search for outmost left and right inter-loop-edges which do not cut the loops
+ const basegfx::B2DPoint aCommonCenter(basegfx::average(a2DCenterA, a2DCenterB));
+ const basegfx::B2DVector aAxisVector(a2DCenterA - a2DCenterB);
+ double fMaxLeft(0.0);
+ double fMaxRight(0.0);
+ sal_uInt32 nIndexLeft(0);
+ sal_uInt32 nIndexRight(0);
+
+ for(sal_uInt32 a(0); a < nPointCount; a++)
+ {
+ const basegfx::B2DPoint aStart(a2DLoopA.getB2DPoint(a));
+ const basegfx::B2DPoint aEnd(a2DLoopB.getB2DPoint(a));
+ const basegfx::B2DPoint aMiddle(basegfx::average(aStart, aEnd));
+
+ if(!basegfx::tools::isInside(a2DLoopA, aMiddle))
+ {
+ if(!basegfx::tools::isInside(a2DLoopB, aMiddle))
+ {
+ if(!impHasCutWith(a2DLoopA, aStart, aEnd))
+ {
+ if(!impHasCutWith(a2DLoopB, aStart, aEnd))
+ {
+ const basegfx::B2DVector aCandidateVector(aMiddle - aCommonCenter);
+ const double fCross(aCandidateVector.cross(aAxisVector));
+ const double fDistance(aCandidateVector.getLength());
+
+ if(fCross > 0.0)
+ {
+ if(fDistance > fMaxLeft)
+ {
+ fMaxLeft = fDistance;
+ nIndexLeft = a;
+ }
+ }
+ else if(fCross < 0.0)
+ {
+ if(fDistance > fMaxRight)
+ {
+ fMaxRight = fDistance;
+ nIndexRight = a;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(fMaxLeft != 0.0)
+ {
+ basegfx::B3DPolygon aToBeAdded;
+ aToBeAdded.append(rLoopA.getB3DPoint(nIndexLeft));
+ aToBeAdded.append(rLoopB.getB3DPoint(nIndexLeft));
+ rTarget.append(aToBeAdded);
+ }
+
+ if(fMaxRight != 0.0)
+ {
+ basegfx::B3DPolygon aToBeAdded;
+ aToBeAdded.append(rLoopA.getB3DPoint(nIndexRight));
+ aToBeAdded.append(rLoopB.getB3DPoint(nIndexRight));
+ rTarget.append(aToBeAdded);
+ }
+ }
+ }
+ }
+ }
+
} // end of namespace primitive3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index 2aef562d1e2c..838de828cb8b 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrextrudeprimitive3d.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * 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.
@@ -43,6 +43,7 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -54,7 +55,7 @@ namespace drawinglayer
{
namespace primitive3d
{
- Primitive3DSequence SdrExtrudePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
+ Primitive3DSequence SdrExtrudePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const
{
Primitive3DSequence aRetval;
@@ -189,12 +190,209 @@ namespace drawinglayer
// add line
if(getSdrLFSAttribute().getLine())
{
- basegfx::B3DPolyPolygon aLine;
- extractLinesFromSlice(aLine, rSliceVector, false,
- !getSdr3DObjectAttribute().getReducedLineGeometry(),
- true);
- const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine()));
- appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
+ if(getSdr3DObjectAttribute().getReducedLineGeometry())
+ {
+ // create geometric outlines with reduced line geometry for chart.
+ const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector));
+ const sal_uInt32 nCount(aVerLine.count());
+ basegfx::B3DPolyPolygon aReducedLoops;
+ basegfx::B3DPolyPolygon aNewLineGeometry;
+
+ // sort out doubles (front and back planes when no edge rounding is done). Since
+ // this is a line geometry merged from PolyPolygons, loop over all Polygons
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const sal_uInt32 nReducedCount(aReducedLoops.count());
+ const basegfx::B3DPolygon aCandidate(aVerLine.getB3DPolygon(a));
+ bool bAdd(true);
+
+ if(nReducedCount)
+ {
+ bool bAdd(true);
+
+ for(sal_uInt32 b(0); bAdd && b < nReducedCount; b++)
+ {
+ if(aCandidate == aReducedLoops.getB3DPolygon(b))
+ {
+ bAdd = false;
+ }
+ }
+ }
+
+ if(bAdd)
+ {
+ aReducedLoops.append(aCandidate);
+ }
+ }
+
+ // from here work with reduced loops and reduced count without changing them
+ const sal_uInt32 nReducedCount(aReducedLoops.count());
+
+ if(nReducedCount > 1)
+ {
+ for(sal_uInt32 b(1); b < nReducedCount; b++)
+ {
+ // get loop pair
+ const basegfx::B3DPolygon aCandA(aReducedLoops.getB3DPolygon(b - 1));
+ const basegfx::B3DPolygon aCandB(aReducedLoops.getB3DPolygon(b));
+
+ // for each loop pair create the connection edges
+ createReducedOutlines(
+ rViewInformation,
+ getTransform(),
+ aCandA,
+ aCandB,
+ aNewLineGeometry);
+ }
+ }
+
+ // add reduced loops themselves
+ aNewLineGeometry.append(aReducedLoops);
+
+ // to create vertical edges at non-C1/C2 steady loops, use maCorrectedPolyPolygon
+ // directly since the 3D Polygons do not suport this.
+ //
+ // Unfortunately there is no bezier polygon provided by the chart module; one reason is
+ // that the API for extrude wants a 3D polygon geometry (for historical reasons, i guess)
+ // and those have no beziers. Another reason is that he chart module uses self-created
+ // stuff to create the 2D geometry (in ShapeFactory::createPieSegment), but this geometry
+ // does not contain bezier infos, either. The only way which is possible for now is to 'detect'
+ // candidates for vertical edges of pie segments by looking for the angles in the polygon.
+ //
+ // This is all not very well designed ATM. Ideally, the ReducedLineGeometry is responsible
+ // for creating the outer geometry edges (createReducedOutlines), but for special edges
+ // like the vertical ones for pie center and both start/end, the incarnation with the
+ // knowledge about that it needs to create those and IS a pie segment -> in this case,
+ // the chart itself.
+ const sal_uInt32 nPolyCount(maCorrectedPolyPolygon.count());
+
+ for(sal_uInt32 c(0); c < nPolyCount; c++)
+ {
+ const basegfx::B2DPolygon aCandidate(maCorrectedPolyPolygon.getB2DPolygon(c));
+ const sal_uInt32 nPointCount(aCandidate.count());
+
+ if(nPointCount > 2)
+ {
+ sal_uInt32 nIndexA(nPointCount);
+ sal_uInt32 nIndexB(nPointCount);
+ sal_uInt32 nIndexC(nPointCount);
+
+ for(sal_uInt32 d(0); d < nPointCount; d++)
+ {
+ const sal_uInt32 nPrevInd((d + nPointCount - 1) % nPointCount);
+ const sal_uInt32 nNextInd((d + 1) % nPointCount);
+ const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(d));
+ const basegfx::B2DVector aPrev(aCandidate.getB2DPoint(nPrevInd) - aPoint);
+ const basegfx::B2DVector aNext(aCandidate.getB2DPoint(nNextInd) - aPoint);
+ const double fAngle(aPrev.angle(aNext));
+
+ // take each angle which deviates more than 10% from going straight as
+ // special edge. This will detect the two outer edges of pie segments,
+ // but not always the center one (think about a near 180 degree pie)
+ if(F_PI - fabs(fAngle) > F_PI * 0.1)
+ {
+ if(nPointCount == nIndexA)
+ {
+ nIndexA = d;
+ }
+ else if(nPointCount == nIndexB)
+ {
+ nIndexB = d;
+ }
+ else if(nPointCount == nIndexC)
+ {
+ nIndexC = d;
+ d = nPointCount;
+ }
+ }
+ }
+
+ const bool bIndexAUsed(nIndexA != nPointCount);
+ const bool bIndexBUsed(nIndexB != nPointCount);
+ bool bIndexCUsed(nIndexC != nPointCount);
+
+ if(bIndexCUsed)
+ {
+ // already three special edges found, so the center one was already detected
+ // and does not need to be searched
+ }
+ else if(bIndexAUsed && bIndexBUsed)
+ {
+ // outer edges detected (they are approx. 90 degrees), but center one not.
+ // Look with the knowledge that it's in-between the two found ones
+ if(((nIndexA + 2) % nPointCount) == nIndexB)
+ {
+ nIndexC = (nIndexA + 1) % nPointCount;
+ }
+ else if(((nIndexA + nPointCount - 2) % nPointCount) == nIndexB)
+ {
+ nIndexC = (nIndexA + nPointCount - 1) % nPointCount;
+ }
+
+ bIndexCUsed = (nIndexC != nPointCount);
+ }
+
+ if(bIndexAUsed)
+ {
+ const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(nIndexA));
+ const basegfx::B3DPoint aStart(aPoint.getX(), aPoint.getY(), 0.0);
+ const basegfx::B3DPoint aEnd(aPoint.getX(), aPoint.getY(), getDepth());
+ basegfx::B3DPolygon aToBeAdded;
+
+ aToBeAdded.append(aStart);
+ aToBeAdded.append(aEnd);
+ aNewLineGeometry.append(aToBeAdded);
+ }
+
+ if(bIndexBUsed)
+ {
+ const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(nIndexB));
+ const basegfx::B3DPoint aStart(aPoint.getX(), aPoint.getY(), 0.0);
+ const basegfx::B3DPoint aEnd(aPoint.getX(), aPoint.getY(), getDepth());
+ basegfx::B3DPolygon aToBeAdded;
+
+ aToBeAdded.append(aStart);
+ aToBeAdded.append(aEnd);
+ aNewLineGeometry.append(aToBeAdded);
+ }
+
+ if(bIndexCUsed)
+ {
+ const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(nIndexC));
+ const basegfx::B3DPoint aStart(aPoint.getX(), aPoint.getY(), 0.0);
+ const basegfx::B3DPoint aEnd(aPoint.getX(), aPoint.getY(), getDepth());
+ basegfx::B3DPolygon aToBeAdded;
+
+ aToBeAdded.append(aStart);
+ aToBeAdded.append(aEnd);
+ aNewLineGeometry.append(aToBeAdded);
+ }
+ }
+ }
+
+ // append loops themselves
+ aNewLineGeometry.append(aReducedLoops);
+
+ if(aNewLineGeometry.count())
+ {
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
+ }
+ }
+ else
+ {
+ // extract line geometry from slices
+ const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, false));
+ const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector));
+
+ // add horizontal lines
+ const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines);
+
+ // add vertical lines
+ const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines);
+ }
}
// add shadow
@@ -250,10 +448,13 @@ namespace drawinglayer
bool bCloseFront,
bool bCloseBack)
: SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
+ maCorrectedPolyPolygon(),
+ maSlices(),
maPolyPolygon(rPolyPolygon),
mfDepth(fDepth),
mfDiagonal(fDiagonal),
mfBackScale(fBackScale),
+ mpLastRLGViewInformation(0),
mbSmoothNormals(bSmoothNormals),
mbSmoothHorizontalNormals(bSmoothHorizontalNormals),
mbSmoothLids(bSmoothLids),
@@ -290,6 +491,14 @@ namespace drawinglayer
}
}
+ SdrExtrudePrimitive3D::~SdrExtrudePrimitive3D()
+ {
+ if(mpLastRLGViewInformation)
+ {
+ delete mpLastRLGViewInformation;
+ }
+ }
+
bool SdrExtrudePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
if(SdrPrimitive3D::operator==(rPrimitive))
@@ -322,6 +531,28 @@ namespace drawinglayer
return get3DRangeFromSlices(getSlices());
}
+ Primitive3DSequence SdrExtrudePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
+ {
+ if(getSdr3DObjectAttribute().getReducedLineGeometry())
+ {
+ if(!mpLastRLGViewInformation ||
+ (getLocalDecomposition().hasElements()
+ && *mpLastRLGViewInformation != rViewInformation))
+ {
+ // conditions of last local decomposition with reduced lines have changed. Remember
+ // new one and clear current decompositiopn
+ ::osl::Mutex m_mutex;
+ SdrExtrudePrimitive3D* pThat = const_cast< SdrExtrudePrimitive3D* >(this);
+ pThat->setLocalDecomposition(Primitive3DSequence());
+ delete pThat->mpLastRLGViewInformation;
+ pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation);
+ }
+ }
+
+ // no test for buffering needed, call parent
+ return SdrPrimitive3D::get3DDecomposition(rViewInformation);
+ }
+
// provide unique ID
ImplPrimitrive3DIDBlock(SdrExtrudePrimitive3D, PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D)
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index e0018cb78f63..b04c90e07336 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrlatheprimitive3d.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * 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.
@@ -43,6 +43,7 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -54,7 +55,7 @@ namespace drawinglayer
{
namespace primitive3d
{
- Primitive3DSequence SdrLathePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
+ Primitive3DSequence SdrLathePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const
{
Primitive3DSequence aRetval;
@@ -183,12 +184,56 @@ namespace drawinglayer
// add line
if(getSdrLFSAttribute().getLine())
{
- basegfx::B3DPolyPolygon aLine;
- extractLinesFromSlice(aLine, rSliceVector, bClosedRotation,
- true,
- !getSdr3DObjectAttribute().getReducedLineGeometry());
- const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine()));
- appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
+ if(getSdr3DObjectAttribute().getReducedLineGeometry())
+ {
+ // create geometric outlines with reduced line geometry for chart
+ const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, bClosedRotation));
+ const sal_uInt32 nCount(aHorLine.count());
+ basegfx::B3DPolyPolygon aNewLineGeometry;
+
+ for(sal_uInt32 a(1); a < nCount; a++)
+ {
+ // for each loop pair create the connection edges
+ createReducedOutlines(
+ rViewInformation,
+ getTransform(),
+ aHorLine.getB3DPolygon(a - 1),
+ aHorLine.getB3DPolygon(a),
+ aNewLineGeometry);
+ }
+
+ for(sal_uInt32 b(0); b < nCount; b++)
+ {
+ // filter hor lines for empty loops (those who have their defining point on the Y-Axis)
+ basegfx::B3DPolygon aCandidate(aHorLine.getB3DPolygon(b));
+ aCandidate.removeDoublePoints();
+
+ if(aCandidate.count())
+ {
+ aNewLineGeometry.append(aCandidate);
+ }
+ }
+
+ if(aNewLineGeometry.count())
+ {
+ const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
+ }
+ }
+ else
+ {
+ // extract line geometry from slices
+ const basegfx::B3DPolyPolygon aHorLine(extractHorizontalLinesFromSlice(rSliceVector, bClosedRotation));
+ const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector));
+
+ // add horizontal lines
+ const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines);
+
+ // add vertical lines
+ const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine()));
+ appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines);
+ }
}
// add shadow
@@ -206,24 +251,24 @@ namespace drawinglayer
{
// prepare the polygon. No double points, correct orientations and a correct
// outmost polygon are needed
- basegfx::B2DPolyPolygon aCandidate(basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon()));
- aCandidate.removeDoublePoints();
- aCandidate = basegfx::tools::correctOrientations(aCandidate);
- aCandidate = basegfx::tools::correctOutmostPolygon(aCandidate);
+ maCorrectedPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon());
+ maCorrectedPolyPolygon.removeDoublePoints();
+ maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);
+ maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon);
// check edge count of first sub-polygon. If different, reSegment polyPolygon. This ensures
// that for polyPolygons, the subPolys 1..n only get reSegmented when polygon 0L is different
// at all (and not always)
- const basegfx::B2DPolygon aSubCandidate(aCandidate.getB2DPolygon(0));
+ const basegfx::B2DPolygon aSubCandidate(maCorrectedPolyPolygon.getB2DPolygon(0));
const sal_uInt32 nSubEdgeCount(aSubCandidate.isClosed() ? aSubCandidate.count() : (aSubCandidate.count() ? aSubCandidate.count() - 1L : 0L));
if(nSubEdgeCount != getVerticalSegments())
{
- aCandidate = basegfx::tools::reSegmentPolyPolygon(aCandidate, getVerticalSegments());
+ maCorrectedPolyPolygon = basegfx::tools::reSegmentPolyPolygon(maCorrectedPolyPolygon, getVerticalSegments());
}
// prepare slices as geometry
- createLatheSlices(maSlices, aCandidate, getBackScale(), getDiagonal(), getRotation(), getHorizontalSegments(), getCharacterMode(), getCloseFront(), getCloseBack());
+ createLatheSlices(maSlices, maCorrectedPolyPolygon, getBackScale(), getDiagonal(), getRotation(), getHorizontalSegments(), getCharacterMode(), getCloseFront(), getCloseBack());
}
const Slice3DVector& SdrLathePrimitive3D::getSlices() const
@@ -257,12 +302,15 @@ namespace drawinglayer
bool bCloseFront,
bool bCloseBack)
: SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
+ maCorrectedPolyPolygon(),
+ maSlices(),
maPolyPolygon(rPolyPolygon),
mnHorizontalSegments(nHorizontalSegments),
mnVerticalSegments(nVerticalSegments),
mfDiagonal(fDiagonal),
mfBackScale(fBackScale),
mfRotation(fRotation),
+ mpLastRLGViewInformation(0),
mbSmoothNormals(bSmoothNormals),
mbSmoothHorizontalNormals(bSmoothHorizontalNormals),
mbSmoothLids(bSmoothLids),
@@ -299,6 +347,14 @@ namespace drawinglayer
}
}
+ SdrLathePrimitive3D::~SdrLathePrimitive3D()
+ {
+ if(mpLastRLGViewInformation)
+ {
+ delete mpLastRLGViewInformation;
+ }
+ }
+
bool SdrLathePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
{
if(SdrPrimitive3D::operator==(rPrimitive))
@@ -333,6 +389,28 @@ namespace drawinglayer
return get3DRangeFromSlices(getSlices());
}
+ Primitive3DSequence SdrLathePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
+ {
+ if(getSdr3DObjectAttribute().getReducedLineGeometry())
+ {
+ if(!mpLastRLGViewInformation ||
+ (getLocalDecomposition().hasElements()
+ && *mpLastRLGViewInformation != rViewInformation))
+ {
+ // conditions of last local decomposition with reduced lines have changed. Remember
+ // new one and clear current decompositiopn
+ ::osl::Mutex m_mutex;
+ SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this);
+ pThat->setLocalDecomposition(Primitive3DSequence());
+ delete pThat->mpLastRLGViewInformation;
+ pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation);
+ }
+ }
+
+ // no test for buffering needed, call parent
+ return SdrPrimitive3D::get3DDecomposition(rViewInformation);
+ }
+
// provide unique ID
ImplPrimitrive3DIDBlock(SdrLathePrimitive3D, PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D)
diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
index 3b2f56be0d6c..dc93d0c0f339 100644
--- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sdrprimitive3d.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * 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.
diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx b/drawinglayer/source/processor2d/baseprocessor2d.cxx
index 1605cefb8365..76f66b85c9fa 100644
--- a/drawinglayer/source/processor2d/baseprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: baseprocessor2d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $
+ * 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.
@@ -48,6 +48,10 @@ namespace drawinglayer
{
namespace processor2d
{
+ void BaseProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& /*rCandidate*/)
+ {
+ }
+
BaseProcessor2D::BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation)
: maViewInformation2D(rViewInformation)
{
@@ -56,25 +60,37 @@ namespace drawinglayer
BaseProcessor2D::~BaseProcessor2D()
{
}
- } // end of namespace processor2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-namespace drawinglayer
-{
- namespace processor2d
- {
- CollectingProcessor2D::CollectingProcessor2D(const geometry::ViewInformation2D& rViewInformation)
- : BaseProcessor2D(rViewInformation),
- maPrimitive2DSequence()
+ void BaseProcessor2D::process(const primitive2d::Primitive2DSequence& rSource)
{
- }
+ if(rSource.hasElements())
+ {
+ const sal_Int32 nCount(rSource.getLength());
- void CollectingProcessor2D::process(const primitive2d::Primitive2DSequence& rSource)
- {
- // accept everything
- primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(maPrimitive2DSequence, rSource);
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ // get reference
+ const primitive2d::Primitive2DReference xReference(rSource[a]);
+
+ if(xReference.is())
+ {
+ // try to cast to BasePrimitive2D implementation
+ const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get());
+
+ if(pBasePrimitive)
+ {
+ // it is a BasePrimitive2D implementation, use local processor
+ processBasePrimitive2D(*pBasePrimitive);
+ }
+ else
+ {
+ // unknown implementation, use UNO API call instead and process recursively
+ const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation2D().getViewInformationSequence());
+ process(xReference->getDecomposition(rViewParameters));
+ }
+ }
+ }
+ }
}
} // end of namespace processor2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx
index 00013375d94f..f49267283ec5 100644
--- a/drawinglayer/source/processor2d/canvasprocessor.cxx
+++ b/drawinglayer/source/processor2d/canvasprocessor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: canvasprocessor.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * 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.
@@ -1302,16 +1302,14 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D :
{
- // transform group.
+ // transform group. Remember current ViewInformation2D
const primitive2d::TransformPrimitive2D& rTransformCandidate = static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate);
- const basegfx::B2DHomMatrix aLastCurrentTransformation(maCurrentTransformation);
const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
- // create new transformations for CurrentTransformation
- // and for local ViewInformation2D
- maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation();
+ // create new local ViewInformation2D with new transformation
const geometry::ViewInformation2D aViewInformation2D(
- getViewInformation2D().getViewTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getViewTransformation(),
getViewInformation2D().getViewport(),
getViewInformation2D().getVisualizedPage(),
getViewInformation2D().getViewTime(),
@@ -1319,17 +1317,16 @@ namespace drawinglayer
updateViewInformation(aViewInformation2D);
// set at canvas
- canvas::tools::setViewStateTransform(maViewState, maCurrentTransformation);
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
// proccess content
process(rTransformCandidate.getChildren());
// restore transformations
- maCurrentTransformation = aLastCurrentTransformation;
updateViewInformation(aLastViewInformation2D);
// restore at canvas
- canvas::tools::setViewStateTransform(maViewState, maCurrentTransformation);
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
break;
}
@@ -1346,38 +1343,6 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
// process support
- void canvasProcessor2D::process(const primitive2d::Primitive2DSequence& rSource)
- {
- if(rSource.hasElements())
- {
- const sal_Int32 nCount(rSource.getLength());
-
- for(sal_Int32 a(0L); a < nCount; a++)
- {
- // get reference
- const primitive2d::Primitive2DReference xReference(rSource[a]);
-
- if(xReference.is())
- {
- // try to cast to BasePrimitive2D implementation
- const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get());
-
- if(pBasePrimitive)
- {
- // it is a BasePrimitive2D implementation, use local processor
- processBasePrimitive2D(*pBasePrimitive);
- }
- else
- {
- // unknown implementation, use UNO API call instead and process recursively
- const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation2D().getViewInformationSequence());
- process(xReference->getDecomposition(rViewParameters));
- }
- }
- }
- }
- }
-
canvasProcessor2D::canvasProcessor2D(
const geometry::ViewInformation2D& rViewInformation,
const uno::Reference< rendering::XCanvas >& rCanvas)
@@ -1386,7 +1351,6 @@ namespace drawinglayer
maViewState(),
maRenderState(),
maBColorModifierStack(),
- maCurrentTransformation(),
maDrawinglayerOpt(),
mnPolygonStrokePrimitive2D(0),
meLang(LANGUAGE_SYSTEM)
@@ -1395,8 +1359,7 @@ namespace drawinglayer
canvas::tools::initViewState(maViewState);
canvas::tools::initRenderState(maRenderState);
- maCurrentTransformation = getViewInformation2D().getViewTransformation();
- canvas::tools::setViewStateTransform(maViewState, maCurrentTransformation);
+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getObjectToViewTransformation());
if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals())
{
diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx
index cea25303a7cd..b7931aed5c27 100644
--- a/drawinglayer/source/processor2d/contourextractor2d.cxx
+++ b/drawinglayer/source/processor2d/contourextractor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: contourextractor2d.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * 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.
@@ -74,10 +74,10 @@ namespace drawinglayer
{
case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
{
- // extract hairline
+ // extract hairline in world coordinates
const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
- aLocalPolygon.transform(maCurrentTransformation);
+ aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
if(aLocalPolygon.isClosed())
{
@@ -91,18 +91,18 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
{
- // extract fill
+ // extract fill in world coordinates
const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
- aLocalPolyPolygon.transform(maCurrentTransformation);
+ aLocalPolyPolygon.transform(getViewInformation2D().getObjectTransformation());
maExtractedContour.push_back(aLocalPolyPolygon);
break;
}
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
{
- // extract BoundRect from bitmaps
+ // extract BoundRect from bitmaps in world coordinates
const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
- basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rBitmapCandidate.getTransform());
+ basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rBitmapCandidate.getTransform());
basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
aPolygon.transform(aLocalTransform);
maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon));
@@ -110,9 +110,9 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
{
- // extract BoundRect from MetaFiles
+ // extract BoundRect from MetaFiles in world coordinates
const primitive2d::MetafilePrimitive2D& rMetaCandidate(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
- basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rMetaCandidate.getTransform());
+ basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rMetaCandidate.getTransform());
basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
aPolygon.transform(aLocalTransform);
maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon));
@@ -127,24 +127,23 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
- // extract mask, ignore content
+ // extract mask in world coordinates, ignore content
const primitive2d::MaskPrimitive2D& rMaskCandidate(static_cast< const primitive2d::MaskPrimitive2D& >(rCandidate));
basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
- aMask.transform(maCurrentTransformation);
+ aMask.transform(getViewInformation2D().getObjectTransformation());
maExtractedContour.push_back(basegfx::B2DPolyPolygon(aMask));
break;
}
case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D :
{
- // remember current transformation and ViewInformation
+ // remember current ViewInformation2D
const primitive2d::TransformPrimitive2D& rTransformCandidate(static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate));
- const basegfx::B2DHomMatrix aLastCurrentTransformation(maCurrentTransformation);
const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
- // create new transformations for CurrentTransformation and for local ViewInformation2D
- maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation();
+ // create new local ViewInformation2D
const geometry::ViewInformation2D aViewInformation2D(
- getViewInformation2D().getViewTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getViewTransformation(),
getViewInformation2D().getViewport(),
getViewInformation2D().getVisualizedPage(),
getViewInformation2D().getViewTime(),
@@ -155,14 +154,13 @@ namespace drawinglayer
process(rTransformCandidate.getChildren());
// restore transformations
- maCurrentTransformation = aLastCurrentTransformation;
updateViewInformation(aLastViewInformation2D);
break;
}
case PRIMITIVE2D_ID_SCENEPRIMITIVE2D :
{
- // 2D Scene primitive containing 3D stuff; extract 2D contour
+ // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates
const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate));
const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D(getViewInformation2D()));
@@ -184,9 +182,9 @@ namespace drawinglayer
case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D :
case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D :
{
- // primitives who's BoundRect will be added
+ // primitives who's BoundRect will be added in world coordinates
basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
- aRange.transform(maCurrentTransformation);
+ aRange.transform(getViewInformation2D().getObjectTransformation());
maExtractedContour.push_back(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aRange)));
break;
}
@@ -199,37 +197,6 @@ namespace drawinglayer
}
}
- void ContourExtractor2D::process(const primitive2d::Primitive2DSequence& rSource)
- {
- if(rSource.hasElements())
- {
- const sal_Int32 nCount(rSource.getLength());
-
- for(sal_Int32 a(0L); a < nCount; a++)
- {
- // get reference
- const primitive2d::Primitive2DReference xReference(rSource[a]);
-
- if(xReference.is())
- {
- // try to cast to BasePrimitive2D implementation
- const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get());
-
- if(pBasePrimitive)
- {
- // it is a BasePrimitive2D implementation, use local processor
- processBasePrimitive2D(*pBasePrimitive);
- }
- else
- {
- // unknown implementation, use UNO API call instead and process recursively
- const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation2D().getViewInformationSequence());
- process(xReference->getDecomposition(rViewParameters));
- }
- }
- }
- }
- }
} // end of namespace processor2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor2d/makefile.mk b/drawinglayer/source/processor2d/makefile.mk
index a08c67d45523..1ca3aad2e494 100644
--- a/drawinglayer/source/processor2d/makefile.mk
+++ b/drawinglayer/source/processor2d/makefile.mk
@@ -4,9 +4,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.8 $
#
-# last change: $Author: aw $ $Date: 2008-03-05 08:20: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.
@@ -55,6 +55,7 @@ SLOFILES= \
$(SLO)$/vclpixelprocessor2d.obj \
$(SLO)$/vclmetafileprocessor2d.obj \
$(SLO)$/contourextractor2d.obj \
+ $(SLO)$/linegeometryextractor2d.obj \
$(SLO)$/canvasprocessor.obj
# --- Targets ----------------------------------
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 543890c604c0..897f6f66684f 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclmetafileprocessor2d.cxx,v $
*
- * $Revision: 1.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -397,8 +397,9 @@ namespace drawinglayer
mpPDFExtOutDevData(dynamic_cast< vcl::PDFExtOutDevData* >(rOutDev.GetExtOutDevData()))
{
OSL_ENSURE(rOutDev.GetConnectMetaFile(), "VclMetafileProcessor2D: Used on OutDev which has no MetaFile Target (!)");
- // draw to logic coordinates, do not initialize maCurrentTransformation to viewTransformation,
- // do not change MapMode of destination
+ // draw to logic coordinates, do not initialize maCurrentTransformation to viewTransformation
+ // but only to ObjectTransformation. Do not change MapMode of destination.
+ maCurrentTransformation = rViewInformation.getObjectTransformation();
}
VclMetafileProcessor2D::~VclMetafileProcessor2D()
@@ -1533,6 +1534,7 @@ namespace drawinglayer
// create view information and pixel renderer. Reuse known ViewInformation
// except new transformation and range
const geometry::ViewInformation2D aViewInfo(
+ getViewInformation2D().getObjectTransformation(),
aViewTransform,
aViewRange,
getViewInformation2D().getVisualizedPage(),
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index b5e8cb4b0481..fa7b13acced5 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclpixelprocessor2d.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -70,7 +70,7 @@ namespace drawinglayer
maOriginalMapMode(rOutDev.GetMapMode())
{
// prepare maCurrentTransformation matrix with viewTransformation to target directly to pixels
- maCurrentTransformation = rViewInformation.getViewTransformation();
+ maCurrentTransformation = rViewInformation.getObjectToViewTransformation();
// prepare output directly to pixels
mpOutputDevice->Push(PUSH_MAPMODE);
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 7df7a3276ab6..817159985f5a 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: vclprocessor2d.cxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -763,7 +763,8 @@ namespace drawinglayer
// and for local ViewInformation2D
maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation();
const geometry::ViewInformation2D aViewInformation2D(
- getViewInformation2D().getViewTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
+ getViewInformation2D().getViewTransformation(),
getViewInformation2D().getViewport(),
getViewInformation2D().getVisualizedPage(),
getViewInformation2D().getViewTime(),
@@ -786,6 +787,7 @@ namespace drawinglayer
// create new local ViewInformation2D
const geometry::ViewInformation2D aViewInformation2D(
+ getViewInformation2D().getObjectTransformation(),
getViewInformation2D().getViewTransformation(),
getViewInformation2D().getViewport(),
rPagePreviewCandidate.getXDrawPage(),
@@ -1162,38 +1164,6 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
// process support
- void VclProcessor2D::process(const primitive2d::Primitive2DSequence& rSource)
- {
- if(rSource.hasElements())
- {
- const sal_Int32 nCount(rSource.getLength());
-
- for(sal_Int32 a(0L); a < nCount; a++)
- {
- // get reference
- const primitive2d::Primitive2DReference xReference(rSource[a]);
-
- if(xReference.is())
- {
- // try to cast to BasePrimitive2D implementation
- const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get());
-
- if(pBasePrimitive)
- {
- // it is a BasePrimitive2D implementation, use local processor
- processBasePrimitive2D(*pBasePrimitive);
- }
- else
- {
- // unknown implementation, use UNO API call instead and process recursively
- const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation2D().getViewInformationSequence());
- process(xReference->getDecomposition(rViewParameters));
- }
- }
- }
- }
- }
-
VclProcessor2D::VclProcessor2D(
const geometry::ViewInformation2D& rViewInformation,
OutputDevice& rOutDev)
diff --git a/drawinglayer/source/processor3d/baseprocessor3d.cxx b/drawinglayer/source/processor3d/baseprocessor3d.cxx
index 9daa9a44bc55..7d630f2522be 100644
--- a/drawinglayer/source/processor3d/baseprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/baseprocessor3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: baseprocessor3d.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -48,6 +48,10 @@ namespace drawinglayer
{
namespace processor3d
{
+ void BaseProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& /*rCandidate*/)
+ {
+ }
+
BaseProcessor3D::BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation)
: maViewInformation3D(rViewInformation)
{
@@ -56,6 +60,37 @@ namespace drawinglayer
BaseProcessor3D::~BaseProcessor3D()
{
}
+
+ void BaseProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
+ {
+ if(rSource.hasElements())
+ {
+ const sal_Int32 nCount(rSource.getLength());
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ // get reference
+ const primitive3d::Primitive3DReference xReference(rSource[a]);
+
+ if(xReference.is())
+ {
+ // try to cast to BasePrimitive3D implementation
+ const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get());
+
+ if(pBasePrimitive)
+ {
+ processBasePrimitive3D(*pBasePrimitive);
+ }
+ else
+ {
+ // unknown implementation, use UNO API call instead and process recursively
+ const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence());
+ process(xReference->getDecomposition(rViewParameters));
+ }
+ }
+ }
+ }
+ }
} // end of namespace processor3d
} // end of namespace drawinglayer
@@ -71,6 +106,10 @@ namespace drawinglayer
{
}
+ CollectingProcessor3D::~CollectingProcessor3D()
+ {
+ }
+
void CollectingProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
{
// accept everything
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index 03d2a4b130b6..9631bd344e6f 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: defaultprocessor3d.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -188,15 +188,15 @@ namespace drawinglayer
const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
texture::GeoTexSvx* pOldTex = mpGeoTexSvx;
- // calculate logic pixel size in world coordinates. Create transformation view
- // to world by inverting WorldToView
- basegfx::B3DHomMatrix aInvWorldToView(maWorldToView);
- aInvWorldToView.invert();
+ // calculate logic pixel size in object coordinates. Create transformation view
+ // to object by inverting ObjectToView
+ basegfx::B3DHomMatrix aInvObjectToView(getViewInformation3D().getObjectToView());
+ aInvObjectToView.invert();
- // back-project discrete coordinates to world coordinates and extract
+ // back-project discrete coordinates to object coordinates and extract
// maximum distance
- const basegfx::B3DPoint aZero(aInvWorldToView * basegfx::B3DPoint(0.0, 0.0, 0.0));
- const basegfx::B3DPoint aOne(aInvWorldToView * basegfx::B3DPoint(1.0, 1.0, 1.0));
+ const basegfx::B3DPoint aZero(aInvObjectToView * basegfx::B3DPoint(0.0, 0.0, 0.0));
+ const basegfx::B3DPoint aOne(aInvObjectToView * basegfx::B3DPoint(1.0, 1.0, 1.0));
const basegfx::B3DVector aLogicPixel(aOne - aZero);
double fLogicPixelSizeWorld(::std::max(::std::max(fabs(aLogicPixel.getX()), fabs(aLogicPixel.getY())), fabs(aLogicPixel.getZ())));
@@ -293,7 +293,7 @@ namespace drawinglayer
aHairline.clearBColors();
// transform to device coordinates (-1.0 .. 1.0) and check for visibility
- aHairline.transform(maWorldToView);
+ aHairline.transform(getViewInformation3D().getObjectToView());
const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aHairline));
const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());
@@ -321,7 +321,7 @@ namespace drawinglayer
}
// transform to device coordinates (-1.0 .. 1.0) and check for visibility
- aFill.transform(maWorldToView);
+ aFill.transform(getViewInformation3D().getObjectToView());
const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aFill));
const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());
@@ -343,8 +343,9 @@ namespace drawinglayer
if(bPaintIt)
{
+ // prepare ObjectToEye in NormalTransform
::com::sun::star::drawing::ShadeMode aShadeMode(getSdrSceneAttribute().getShadeMode());
- basegfx::B3DHomMatrix aNormalTransform(maWorldToEye);
+ basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation());
if(getSdrSceneAttribute().getTwoSidedLighting())
{
@@ -452,20 +453,24 @@ namespace drawinglayer
void DefaultProcessor3D::impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate)
{
- // remember current transformations
- const basegfx::B3DHomMatrix aLastWorldToView(maWorldToView);
- const basegfx::B3DHomMatrix aLastWorldToEye(maWorldToEye);
-
- // create new transformations
- maWorldToView = maWorldToView * rTransformCandidate.getTransformation();
- maWorldToEye = maWorldToEye * rTransformCandidate.getTransformation();
-
- // let break down
+ // transform group. Remember current transformations
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rTransformCandidate.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down recursively
process(rTransformCandidate.getChildren());
// restore transformations
- maWorldToView = aLastWorldToView;
- maWorldToEye = aLastWorldToEye;
+ updateViewInformation(aLastViewInformation3D);
}
void DefaultProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive)
@@ -540,12 +545,6 @@ namespace drawinglayer
impRenderTransformPrimitive3D(static_cast< const primitive3d::TransformPrimitive3D& >(rBasePrimitive));
break;
}
- case PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D :
- {
- // SdrLabelPrimitive3D. Accept, but ignore. Is handled by the scenePrimitive decompose
- // method which creates 2d text objects at the 3d-projection-dependent positions.
- break;
- }
default:
{
// process recursively
@@ -555,37 +554,6 @@ namespace drawinglayer
}
}
- void DefaultProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
- {
- if(rSource.hasElements())
- {
- const sal_Int32 nCount(rSource.getLength());
-
- for(sal_Int32 a(0L); a < nCount; a++)
- {
- // get reference
- const primitive3d::Primitive3DReference xReference(rSource[a]);
-
- if(xReference.is())
- {
- // try to cast to BasePrimitive3D implementation
- const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get());
-
- if(pBasePrimitive)
- {
- processBasePrimitive3D(*pBasePrimitive);
- }
- else
- {
- // unknown implementation, use UNO API call instead and process recursively
- const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence());
- process(xReference->getDecomposition(rViewParameters));
- }
- }
- }
- }
- }
-
DefaultProcessor3D::DefaultProcessor3D(
const geometry::ViewInformation3D& rViewInformation,
const attribute::SdrSceneAttribute& rSdrSceneAttribute,
@@ -593,8 +561,6 @@ namespace drawinglayer
: BaseProcessor3D(rViewInformation),
mrSdrSceneAttribute(rSdrSceneAttribute),
mrSdrLightingAttribute(rSdrLightingAttribute),
- maWorldToEye(),
- maWorldToView(),
maRasterRange(),
maBColorModifierStack(),
mpGeoTexSvx(0),
@@ -603,8 +569,10 @@ namespace drawinglayer
mbFilter(false),
mbSimpleTextureActive(false)
{
- // a derivation has to set maWorldToEye, maWorldToView and maRasterRange. Those values are
- // used in the basic render methods
+ // a derivation has to set maRasterRange which is used in the basic render methods.
+ // Setting to default here ([0.0 .. 1.0] in X,Y) to avoid problems
+ maRasterRange.expand(basegfx::B2DTuple(0.0, 0.0));
+ maRasterRange.expand(basegfx::B2DTuple(1.0, 1.0));
}
DefaultProcessor3D::~DefaultProcessor3D()
diff --git a/drawinglayer/source/processor3d/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx
index da2d37672f04..8c19a4a2e3b8 100644
--- a/drawinglayer/source/processor3d/geometry2dextractor.cxx
+++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: geometry2dextractor.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -58,144 +58,119 @@ namespace drawinglayer
{
namespace processor3d
{
- Geometry2DExtractingProcessor::Geometry2DExtractingProcessor(
- const geometry::ViewInformation3D& rViewInformation,
- const basegfx::B2DHomMatrix& rObjectTransformation)
- : BaseProcessor3D(rViewInformation),
- maPrimitive2DSequence(),
- maObjectTransformation(rObjectTransformation),
- maBColorModifierStack()
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ void Geometry2DExtractingProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
{
- }
-
- void Geometry2DExtractingProcessor::process(const primitive3d::Primitive3DSequence& rSource)
- {
- if(rSource.hasElements())
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ switch(rCandidate.getPrimitiveID())
{
- const sal_Int32 nCount(rSource.getLength());
-
- for(sal_Int32 a(0L); a < nCount; a++)
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
{
- // get reference
- const primitive3d::Primitive3DReference xReference(rSource[a]);
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down recursively
+ process(rPrimitive.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation3D);
+ break;
+ }
+ case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D :
+ {
+ // ModifiedColorPrimitive3D; push, process and pop
+ const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate = static_cast< const primitive3d::ModifiedColorPrimitive3D& >(rCandidate);
+ const primitive3d::Primitive3DSequence& rSubSequence = rModifiedCandidate.getChildren();
- if(xReference.is())
+ if(rSubSequence.hasElements())
{
- // try to cast to BasePrimitive3D implementation
- const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get());
-
- if(pBasePrimitive)
- {
- // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
- switch(pBasePrimitive->getPrimitiveID())
- {
- case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
- {
- // transform group. Remember current transformations
- const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(*(xReference.get()));
- const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
-
- // create new transformation; add new object transform from right side
- const geometry::ViewInformation3D aNewViewInformation3D(
- aLastViewInformation3D.getTransformation() * rPrimitive.getTransformation(),
- aLastViewInformation3D.getOrientation(),
- aLastViewInformation3D.getProjection(),
- aLastViewInformation3D.getDeviceToView(),
- aLastViewInformation3D.getViewTime(),
- aLastViewInformation3D.getExtendedInformationSequence());
- updateViewInformation(aNewViewInformation3D);
-
- // let break down recursively
- process(rPrimitive.getChildren());
-
- // restore transformations
- updateViewInformation(aLastViewInformation3D);
- break;
- }
- case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D :
- {
- // ModifiedColorPrimitive3D; push, process and pop
- const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate = static_cast< const primitive3d::ModifiedColorPrimitive3D& >(*pBasePrimitive);
- const primitive3d::Primitive3DSequence& rSubSequence = rModifiedCandidate.getChildren();
-
- if(rSubSequence.hasElements())
- {
- maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
- process(rModifiedCandidate.getChildren());
- maBColorModifierStack.pop();
- }
- break;
- }
- case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
- {
- // PolygonHairlinePrimitive3D
- const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(*pBasePrimitive);
- basegfx::B2DPolygon a2DHairline(basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getViewInformation3D().getObjectToView()));
+ maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
+ process(rModifiedCandidate.getChildren());
+ maBColorModifierStack.pop();
+ }
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
+ {
+ // PolygonHairlinePrimitive3D
+ const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rCandidate);
+ basegfx::B2DPolygon a2DHairline(basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getViewInformation3D().getObjectToView()));
- if(a2DHairline.count())
- {
- a2DHairline.transform(getObjectTransformation());
- const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor()));
- const primitive2d::Primitive2DReference xRef(new primitive2d::PolygonHairlinePrimitive2D(a2DHairline, aModifiedColor));
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xRef);
- }
- break;
- }
- case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
- {
- // PolyPolygonMaterialPrimitive3D
- const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
- basegfx::B2DPolyPolygon a2DFill(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getViewInformation3D().getObjectToView()));
+ if(a2DHairline.count())
+ {
+ a2DHairline.transform(getObjectTransformation());
+ const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor()));
+ const primitive2d::Primitive2DReference xRef(new primitive2d::PolygonHairlinePrimitive2D(a2DHairline, aModifiedColor));
+ primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xRef);
+ }
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+ basegfx::B2DPolyPolygon a2DFill(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getViewInformation3D().getObjectToView()));
- if(a2DFill.count())
- {
- a2DFill.transform(getObjectTransformation());
- const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(rPrimitive.getMaterial().getColor()));
- const primitive2d::Primitive2DReference xRef(new primitive2d::PolyPolygonColorPrimitive2D(a2DFill, aModifiedColor));
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xRef);
- }
- break;
- }
- case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D :
- case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D :
- case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D :
- case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D :
- case PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D :
- {
- // TexturePrimitive3D: Process children, do not try to decompose
- const primitive3d::TexturePrimitive3D& rTexturePrimitive = static_cast< const primitive3d::TexturePrimitive3D& >(*pBasePrimitive);
- const primitive3d::Primitive3DSequence aChildren(rTexturePrimitive.getChildren());
+ if(a2DFill.count())
+ {
+ a2DFill.transform(getObjectTransformation());
+ const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(rPrimitive.getMaterial().getColor()));
+ const primitive2d::Primitive2DReference xRef(new primitive2d::PolyPolygonColorPrimitive2D(a2DFill, aModifiedColor));
+ primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xRef);
+ }
+ break;
+ }
+ case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D :
+ case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D :
+ case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D :
+ case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D :
+ case PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D :
+ {
+ // TexturePrimitive3D: Process children, do not try to decompose
+ const primitive3d::TexturePrimitive3D& rTexturePrimitive = static_cast< const primitive3d::TexturePrimitive3D& >(rCandidate);
+ const primitive3d::Primitive3DSequence aChildren(rTexturePrimitive.getChildren());
- if(aChildren.hasElements())
- {
- process(aChildren);
- }
- break;
- }
- case PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D :
- case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D :
- {
- // accept but ignore labels and shadow; these should be extracted seperately
- break;
- }
- default :
- {
- // process recursively
- process(pBasePrimitive->get3DDecomposition(getViewInformation3D()));
- break;
- }
- }
- }
- else
- {
- // unknown implementation, use UNO API call instead and process recursively
- const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence());
- process(xReference->getDecomposition(rViewParameters));
- }
+ if(aChildren.hasElements())
+ {
+ process(aChildren);
}
+ break;
+ }
+ case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D :
+ {
+ // accept but ignore labels and shadow; these should be extracted seperately
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
}
}
}
+
+ Geometry2DExtractingProcessor::Geometry2DExtractingProcessor(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B2DHomMatrix& rObjectTransformation)
+ : BaseProcessor3D(rViewInformation),
+ maPrimitive2DSequence(),
+ maObjectTransformation(rObjectTransformation),
+ maBColorModifierStack()
+ {
+ }
} // end of namespace processor3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor3d/makefile.mk b/drawinglayer/source/processor3d/makefile.mk
index 3d8650e7a26c..8ca0097c435a 100644
--- a/drawinglayer/source/processor3d/makefile.mk
+++ b/drawinglayer/source/processor3d/makefile.mk
@@ -4,9 +4,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: aw $ $Date: 2008-05-14 09:21:54 $
+# last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
#
# The Contents of this file are made available subject to
# the terms of GNU Lesser General Public License Version 2.1.
@@ -47,7 +47,6 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES= \
$(SLO)$/baseprocessor3d.obj \
$(SLO)$/defaultprocessor3d.obj \
- $(SLO)$/label3dextractor.obj \
$(SLO)$/shadow3dextractor.obj \
$(SLO)$/geometry2dextractor.obj \
$(SLO)$/zbufferprocessor3d.obj
diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx
index 749540a12cfc..66d3c073854f 100644
--- a/drawinglayer/source/processor3d/shadow3dextractor.cxx
+++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: shadow3dextractor.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -47,7 +47,6 @@
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive3d/sdrlabelprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -60,241 +59,206 @@ namespace drawinglayer
{
namespace processor3d
{
- Shadow3DExtractingProcessor::Shadow3DExtractingProcessor(
- const geometry::ViewInformation3D& rViewInformation,
- const basegfx::B2DHomMatrix& rObjectTransformation,
- const attribute::SdrLightingAttribute& rSdrLightingAttribute,
- const primitive3d::Primitive3DSequence& rPrimitiveSequence,
- double fShadowSlant)
- : BaseProcessor3D(rViewInformation),
- maPrimitive2DSequence(),
- mpPrimitive2DSequence(&maPrimitive2DSequence),
- maObjectTransformation(rObjectTransformation),
- maWorldToEye(),
- maEyeToView(),
- maLightNormal(),
- maShadowPlaneNormal(),
- maPlanePoint(),
- mfLightPlaneScalar(0.0),
- maPrimitiveColor(),
- mbShadowProjectionIsValid(false),
- mbConvert(false),
- mbUseProjection(false)
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ void Shadow3DExtractingProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
{
- // calculate shadow projection stuff
- if(rSdrLightingAttribute.getLightVector().size())
+ // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
+ switch(rCandidate.getPrimitiveID())
{
- // get light normal, plane normal and sclalar from it
- maLightNormal = rSdrLightingAttribute.getLightVector()[0].getDirection();
- maLightNormal.normalize();
- maShadowPlaneNormal = basegfx::B3DVector(0.0, sin(fShadowSlant), cos(fShadowSlant));
- maShadowPlaneNormal.normalize();
- mfLightPlaneScalar = maLightNormal.scalar(maShadowPlaneNormal);
-
- // use only when scalar is > 0.0, so the light is in front of the object
- if(basegfx::fTools::more(mfLightPlaneScalar, 0.0))
+ case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D :
{
- // prepare buffered WorldToEye and EyeToView
- maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation();
- maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
-
- // calculate range to get front edge around which to rotate the shadow's projection
- basegfx::B3DRange aContained3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(rPrimitiveSequence, getViewInformation3D()));
- aContained3DRange.transform(getWorldToEye());
- maPlanePoint.setX(maShadowPlaneNormal.getX() < 0.0 ? aContained3DRange.getMinX() : aContained3DRange.getMaxX());
- maPlanePoint.setY(maShadowPlaneNormal.getY() > 0.0 ? aContained3DRange.getMinY() : aContained3DRange.getMaxY());
- maPlanePoint.setZ(aContained3DRange.getMinZ() - (aContained3DRange.getDepth() / 8.0));
-
- // set flag that shadow projection is prepared and allowed
- mbShadowProjectionIsValid = true;
+ // shadow3d object. Call recursive with content and start conversion
+ const primitive3d::ShadowPrimitive3D& rPrimitive = static_cast< const primitive3d::ShadowPrimitive3D& >(rCandidate);
+
+ // set new target
+ primitive2d::Primitive2DSequence aNewSubList;
+ primitive2d::Primitive2DSequence* pLastTargetSequence = mpPrimitive2DSequence;
+ mpPrimitive2DSequence = &aNewSubList;
+
+ // activate convert
+ const bool bLastConvert(mbConvert);
+ mbConvert = true;
+
+ // set projection flag
+ const bool bLastUseProjection(mbUseProjection);
+ mbUseProjection = rPrimitive.getShadow3D();
+
+ // process content
+ process(rPrimitive.getChildren());
+
+ // restore values
+ mbUseProjection = bLastUseProjection;
+ mbConvert = bLastConvert;
+ mpPrimitive2DSequence = pLastTargetSequence;
+
+ // create 2d shadow primitive with result
+ const primitive2d::Primitive2DReference xRef(new primitive2d::ShadowPrimitive2D(rPrimitive.getShadowTransform(), rPrimitive.getShadowColor(), aNewSubList));
+
+ if(basegfx::fTools::more(rPrimitive.getShadowTransparence(), 0.0))
+ {
+ // create simpleTransparencePrimitive, add created primitives
+ const primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&xRef, 1L);
+ const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence()));
+ primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef2);
+ }
+ else
+ {
+ // add directly
+ primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef);
+ }
+ break;
}
- }
- }
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
+ {
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ if(mbShadowProjectionIsValid)
+ {
+ // update buffered WorldToEye and EyeToView
+ maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation();
+ maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
+ }
- void Shadow3DExtractingProcessor::process(const primitive3d::Primitive3DSequence& rSource)
- {
- if(rSource.hasElements())
- {
- const sal_Int32 nCount(rSource.getLength());
+ // let break down
+ process(rPrimitive.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation3D);
- for(sal_Int32 a(0L); a < nCount; a++)
+ if(mbShadowProjectionIsValid)
+ {
+ // update buffered WorldToEye and EyeToView
+ maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation();
+ maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
+ }
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
{
- // get reference
- const primitive3d::Primitive3DReference xReference(rSource[a]);
+ // PolygonHairlinePrimitive3D
+ if(mbConvert)
+ {
+ const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rCandidate);
+ basegfx::B2DPolygon a2DHairline;
- if(xReference.is())
+ if(mbUseProjection)
+ {
+ if(mbShadowProjectionIsValid)
+ {
+ a2DHairline = impDoShadowProjection(rPrimitive.getB3DPolygon());
+ }
+ }
+ else
+ {
+ a2DHairline = basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getViewInformation3D().getObjectToView());
+ }
+
+ if(a2DHairline.count())
+ {
+ a2DHairline.transform(getObjectTransformation());
+ const primitive2d::Primitive2DReference xRef(new primitive2d::PolygonHairlinePrimitive2D(a2DHairline, maPrimitiveColor));
+ primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef);
+ }
+ }
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ if(mbConvert)
{
- // try to cast to BasePrimitive3D implementation
- const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get());
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+ basegfx::B2DPolyPolygon a2DFill;
- if(pBasePrimitive)
+ if(mbUseProjection)
{
- // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch
- switch(pBasePrimitive->getPrimitiveID())
+ if(mbShadowProjectionIsValid)
{
- case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D :
- {
- // shadow3d object. Call recursive with content and start conversion
- const primitive3d::ShadowPrimitive3D& rPrimitive = static_cast< const primitive3d::ShadowPrimitive3D& >(*pBasePrimitive);
-
- // set new target
- primitive2d::Primitive2DSequence aNewSubList;
- primitive2d::Primitive2DSequence* pLastTargetSequence = mpPrimitive2DSequence;
- mpPrimitive2DSequence = &aNewSubList;
-
- // activate convert
- const bool bLastConvert(mbConvert);
- mbConvert = true;
-
- // set projection flag
- const bool bLastUseProjection(mbUseProjection);
- mbUseProjection = rPrimitive.getShadow3D();
-
- // process content
- process(rPrimitive.getChildren());
-
- // restore values
- mbUseProjection = bLastUseProjection;
- mbConvert = bLastConvert;
- mpPrimitive2DSequence = pLastTargetSequence;
-
- // create 2d shadow primitive with result
- const primitive2d::Primitive2DReference xRef(new primitive2d::ShadowPrimitive2D(rPrimitive.getShadowTransform(), rPrimitive.getShadowColor(), aNewSubList));
-
- if(basegfx::fTools::more(rPrimitive.getShadowTransparence(), 0.0))
- {
- // create simpleTransparencePrimitive, add created primitives
- const primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&xRef, 1L);
- const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence()));
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef2);
- }
- else
- {
- // add directly
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef);
- }
- break;
- }
- case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
- {
- // transform group. Remember current transformations
- const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(*pBasePrimitive);
- const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
-
- // create new transformation; add new object transform from right side
- const geometry::ViewInformation3D aNewViewInformation3D(
- aLastViewInformation3D.getTransformation() * rPrimitive.getTransformation(),
- aLastViewInformation3D.getOrientation(),
- aLastViewInformation3D.getProjection(),
- aLastViewInformation3D.getDeviceToView(),
- aLastViewInformation3D.getViewTime(),
- aLastViewInformation3D.getExtendedInformationSequence());
- updateViewInformation(aNewViewInformation3D);
-
- if(mbShadowProjectionIsValid)
- {
- // update buffered WorldToEye and EyeToView
- maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation();
- maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
- }
-
- // let break down
- process(rPrimitive.getChildren());
-
- // restore transformations
- updateViewInformation(aLastViewInformation3D);
-
- if(mbShadowProjectionIsValid)
- {
- // update buffered WorldToEye and EyeToView
- maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation();
- maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
- }
- break;
- }
- case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
- {
- // PolygonHairlinePrimitive3D
- if(mbConvert)
- {
- const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(*pBasePrimitive);
- basegfx::B2DPolygon a2DHairline;
-
- if(mbUseProjection)
- {
- if(mbShadowProjectionIsValid)
- {
- a2DHairline = impDoShadowProjection(rPrimitive.getB3DPolygon());
- }
- }
- else
- {
- a2DHairline = basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getViewInformation3D().getObjectToView());
- }
-
- if(a2DHairline.count())
- {
- a2DHairline.transform(getObjectTransformation());
- const primitive2d::Primitive2DReference xRef(new primitive2d::PolygonHairlinePrimitive2D(a2DHairline, maPrimitiveColor));
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef);
- }
- }
- break;
- }
- case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
- {
- // PolyPolygonMaterialPrimitive3D
- if(mbConvert)
- {
- const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
- basegfx::B2DPolyPolygon a2DFill;
-
- if(mbUseProjection)
- {
- if(mbShadowProjectionIsValid)
- {
- a2DFill = impDoShadowProjection(rPrimitive.getB3DPolyPolygon());
- }
- }
- else
- {
- a2DFill = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getViewInformation3D().getObjectToView());
- }
-
- if(a2DFill.count())
- {
- a2DFill.transform(getObjectTransformation());
- const primitive2d::Primitive2DReference xRef(new primitive2d::PolyPolygonColorPrimitive2D(a2DFill, maPrimitiveColor));
- primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef);
- }
- }
- break;
- }
- case PRIMITIVE3D_ID_SDRLABELPRIMITIVE3D :
- {
- // SdrLabelPrimitive3D
- // has no 3d shadow, accept and ignore
- break;
- }
- default :
- {
- // process recursively
- process(pBasePrimitive->get3DDecomposition(getViewInformation3D()));
- break;
- }
+ a2DFill = impDoShadowProjection(rPrimitive.getB3DPolyPolygon());
}
}
else
{
- // unknown implementation, use UNO API call instead and process recursively
- const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence());
- process(xReference->getDecomposition(rViewParameters));
+ a2DFill = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getViewInformation3D().getObjectToView());
+ }
+
+ if(a2DFill.count())
+ {
+ a2DFill.transform(getObjectTransformation());
+ const primitive2d::Primitive2DReference xRef(new primitive2d::PolyPolygonColorPrimitive2D(a2DFill, maPrimitiveColor));
+ primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef);
}
}
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
}
}
}
+ Shadow3DExtractingProcessor::Shadow3DExtractingProcessor(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rContained3DRange)
+ : BaseProcessor3D(rViewInformation),
+ maPrimitive2DSequence(),
+ mpPrimitive2DSequence(&maPrimitive2DSequence),
+ maObjectTransformation(rObjectTransformation),
+ maWorldToEye(),
+ maEyeToView(),
+ maLightNormal(rLightNormal),
+ maShadowPlaneNormal(),
+ maPlanePoint(),
+ mfLightPlaneScalar(0.0),
+ maPrimitiveColor(),
+ mbShadowProjectionIsValid(false),
+ mbConvert(false),
+ mbUseProjection(false)
+ {
+ // normalize light normal, get and normalize shadow plane normal and calculate scalar from it
+ maLightNormal.normalize();
+ maShadowPlaneNormal = basegfx::B3DVector(0.0, sin(fShadowSlant), cos(fShadowSlant));
+ maShadowPlaneNormal.normalize();
+ mfLightPlaneScalar = maLightNormal.scalar(maShadowPlaneNormal);
+
+ // use only when scalar is > 0.0, so the light is in front of the object
+ if(basegfx::fTools::more(mfLightPlaneScalar, 0.0))
+ {
+ // prepare buffered WorldToEye and EyeToView
+ maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation();
+ maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
+
+ // calculate range to get front edge around which to rotate the shadow's projection
+ basegfx::B3DRange aContained3DRange(rContained3DRange);
+ aContained3DRange.transform(getWorldToEye());
+ maPlanePoint.setX(maShadowPlaneNormal.getX() < 0.0 ? aContained3DRange.getMinX() : aContained3DRange.getMaxX());
+ maPlanePoint.setY(maShadowPlaneNormal.getY() > 0.0 ? aContained3DRange.getMinY() : aContained3DRange.getMaxY());
+ maPlanePoint.setZ(aContained3DRange.getMinZ() - (aContained3DRange.getDepth() / 8.0));
+
+ // set flag that shadow projection is prepared and allowed
+ mbShadowProjectionIsValid = true;
+ }
+ }
+
basegfx::B2DPolygon Shadow3DExtractingProcessor::impDoShadowProjection(const basegfx::B3DPolygon& rSource)
{
basegfx::B2DPolygon aRetval;
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
index 82b157ade202..7a6eefd90a4e 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: zbufferprocessor3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2008-06-10 09:29:34 $
+ * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -587,8 +587,8 @@ namespace drawinglayer
mbContainsTransparent(false)
{
// generate ViewSizes
- const double fFullViewSizeX((rViewInformation2D.getViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength());
- const double fFullViewSizeY((rViewInformation2D.getViewTransformation() * basegfx::B2DVector(0.0, fSizeY)).getLength());
+ const double fFullViewSizeX((rViewInformation2D.getObjectToViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength());
+ const double fFullViewSizeY((rViewInformation2D.getObjectToViewTransformation() * basegfx::B2DVector(0.0, fSizeY)).getLength());
const double fViewSizeX(fFullViewSizeX * rVisiblePart.getWidth());
const double fViewSizeY(fFullViewSizeY * rVisiblePart.getHeight());
@@ -603,10 +603,13 @@ namespace drawinglayer
mnAntiAlialize ? nRasterWidth * mnAntiAlialize : nRasterWidth,
mnAntiAlialize ? nRasterHeight * mnAntiAlialize : nRasterHeight);
OSL_ENSURE(mpBZPixelRaster, "ZBufferProcessor3D: Could not allocate basegfx::BZPixelRaster (!)");
- basegfx::B3DHomMatrix aDeviceToView;
- // create DeviceToView
- // outcome is [-1.0 .. 1.0] in X,Y and Z.
+ // create DeviceToView for Z-Buffer renderer since Z is handled
+ // different from standard 3D transformations (Z is mirrored). Also
+ // the transformation includes the step from unit device coordinates
+ // to discrete units ([-1.0 .. 1.0] -> [minDiscrete .. maxDiscrete]
+
+ basegfx::B3DHomMatrix aDeviceToView;
{
// step one:
@@ -634,17 +637,24 @@ namespace drawinglayer
aDeviceToView.scale(fFullViewSizeX, fFullViewSizeY, fMaxZDepth);
}
- // create world to eye transformation
- maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation();
-
- // create EyeToView transformation
- maWorldToView = aDeviceToView * getViewInformation3D().getProjection() * maWorldToEye;
-
- // create inverse EyeToView transformation
- maInvEyeToView = aDeviceToView * getViewInformation3D().getProjection();
+ // update local ViewInformation3D with own DeviceToView
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ getViewInformation3D().getObjectTransformation(),
+ getViewInformation3D().getOrientation(),
+ getViewInformation3D().getProjection(),
+ aDeviceToView,
+ getViewInformation3D().getViewTime(),
+ getViewInformation3D().getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // prepare inverse EyeToView transformation. This can be done in constructor
+ // since changes in object transformations when processing TransformPrimitive3Ds
+ // do not influence this prepared partial transformation
+ maInvEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection();
maInvEyeToView.invert();
// prepare maRasterRange
+ maRasterRange.reset();
maRasterRange.expand(basegfx::B2DPoint(0.0, 0.0));
maRasterRange.expand(basegfx::B2DPoint(mpBZPixelRaster->getWidth(), mpBZPixelRaster->getHeight()));