diff options
author | Armin Weiss <aw@openoffice.org> | 2006-06-02 13:12:39 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2006-06-02 13:12:39 +0000 |
commit | fd28570ff1f54d3bb9879f0650fb0c308b933c44 (patch) | |
tree | f0001d0507a502c2ab5dcc1bc085d4337bd9eeb0 /drawinglayer | |
parent | d20e799551390411b32c4d398ea0c473af986a63 (diff) |
#i39523# added vector- and transformPrimitive
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx | 81 | ||||
-rw-r--r-- | drawinglayer/source/primitive3d/transformprimitive3d.cxx | 82 |
2 files changed, 163 insertions, 0 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx new file mode 100644 index 000000000000..16c83f88e524 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: transformprimitive3d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-06-02 14:11:41 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX +#define _DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX + +#ifndef _DRAWINGLAYER_PRIMITIVE_VECTORPRIMITIVE_HXX +#include <drawinglayer/primitive/vectorprimitive.hxx> +#endif + +#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX +#include <basegfx/matrix/b3dhommatrix.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive + { + class transformPrimitive3D : public vectorPrimitive + { + protected: + ::basegfx::B3DHomMatrix maTransformation; + + public: + transformPrimitive3D(const ::basegfx::B3DHomMatrix& rTransformation, const primitiveVector& rPrimitiveVector); + virtual ~transformPrimitive3D(); + + // get data + const ::basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; } + + // compare operator + virtual bool operator==(const basePrimitive& rPrimitive) const; + + // id generator + virtual PrimitiveID getID() const; + + // get 3D range of primitive (for 3D geometries). Default implementation uses decomposition, analog to getRange + virtual ::basegfx::B3DRange get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const; + }; + } // end of namespace primitive +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX + +// eof diff --git a/drawinglayer/source/primitive3d/transformprimitive3d.cxx b/drawinglayer/source/primitive3d/transformprimitive3d.cxx new file mode 100644 index 000000000000..7464ea0187fc --- /dev/null +++ b/drawinglayer/source/primitive3d/transformprimitive3d.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: transformprimitive3d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-06-02 14:12:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX +#include <drawinglayer/primitive3d/transformprimitive3d.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive + { + transformPrimitive3D::transformPrimitive3D(const ::basegfx::B3DHomMatrix& rTransformation, const primitiveVector& rPrimitiveVector) + : vectorPrimitive(rPrimitiveVector), + maTransformation(rTransformation) + { + } + + transformPrimitive3D::~transformPrimitive3D() + { + } + + bool transformPrimitive3D::operator==(const basePrimitive& rPrimitive) const + { + if(vectorPrimitive::operator==(rPrimitive)) + { + const transformPrimitive3D& rCompare = static_cast< const transformPrimitive3D& >(rPrimitive); + return (maTransformation == rCompare.maTransformation); + } + + return false; + } + + PrimitiveID transformPrimitive3D::getID() const + { + return CreatePrimitiveID('T', 'R', 'N', '3'); + } + + ::basegfx::B3DRange transformPrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + { + ::basegfx::B3DRange aRetval(::drawinglayer::primitive::get3DRangeFromVector(maPrimitiveVector, rViewInformation)); + aRetval.transform(maTransformation); + return aRetval; + } + } // end of namespace primitive +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof |