2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* $RCSfile: sphere3d.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-11-14 12:22:07 +00:00
|
|
|
* $Revision: 1.17 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-11-14 12:22:07 +00:00
|
|
|
* last change: $Author: ihi $ $Date: 2006-11-14 13:22:07 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* 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.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* 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.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-08 21:42:47 +00:00
|
|
|
* 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
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 03:58:52 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_svx.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "svdstr.hrc"
|
|
|
|
#include "svdglob.hxx"
|
|
|
|
|
|
|
|
#ifndef _SVDMODEL_HXX
|
|
|
|
#include "svdmodel.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SVDPAGE_HXX
|
|
|
|
#include "svdpage.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _E3D_GLOBL3D_HXX
|
|
|
|
#include "globl3d.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _E3D_SPHERE3D_HXX
|
|
|
|
#include "sphere3d.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SVX_SVXIDS_HRC
|
|
|
|
#include "svxids.hrc"
|
|
|
|
#endif
|
|
|
|
|
2000-10-30 10:00:01 +00:00
|
|
|
#ifndef _SVX3DITEMS_HXX
|
|
|
|
#include "svx3ditems.hxx"
|
|
|
|
#endif
|
|
|
|
|
2003-11-24 15:38:07 +00:00
|
|
|
#ifndef _SDR_PROPERTIES_E3DSPHEREPROPERTIES_HXX
|
|
|
|
#include <svx/sdr/properties/e3dsphereproperties.hxx>
|
|
|
|
#endif
|
|
|
|
|
2004-11-03 09:42:27 +00:00
|
|
|
#ifndef _BGFX_VECTOR_B3DVECTOR_HXX
|
|
|
|
#include <basegfx/vector/b3dvector.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BGFX_POINT_B3DPOINT_HXX
|
|
|
|
#include <basegfx/point/b3dpoint.hxx>
|
|
|
|
#endif
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
|
|
|
|
#include <basegfx/polygon/b3dpolygon.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-11-24 15:38:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
sdr::properties::BaseProperties* E3dSphereObj::CreateObjectSpecificProperties()
|
|
|
|
{
|
|
|
|
return new sdr::properties::E3dSphereProperties(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
TYPEINIT1(E3dSphereObj, E3dCompoundObject);
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Kugel aus Polygonfacetten nach Laengen und Breitengrad aufbauen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize)
|
2000-09-18 16:07:07 +00:00
|
|
|
: E3dCompoundObject(rDefault)
|
|
|
|
{
|
|
|
|
// Defaults setzen
|
|
|
|
SetDefaultAttributes(rDefault);
|
|
|
|
|
|
|
|
// Uebergebene drueberbuegeln
|
|
|
|
aCenter = rCenter;
|
|
|
|
aSize = r3DSize;
|
|
|
|
|
|
|
|
// Geometrie erzeugen
|
|
|
|
CreateGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
E3dSphereObj::E3dSphereObj()
|
|
|
|
: E3dCompoundObject()
|
|
|
|
{
|
|
|
|
// Defaults setzen
|
|
|
|
E3dDefaultAttributes aDefault;
|
|
|
|
SetDefaultAttributes(aDefault);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Kugel erzeugen ohne die Polygone darin zu erzeugen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
// FG: Dieser Aufruf erfolgt von der 3D-Object Factory (objfac3d.cxx) und zwar ausschliesslich beim
|
|
|
|
// laden von Dokumenten. Hier braucht man keinen CreateSphere-Aufruf, denn die wirkliche
|
|
|
|
// Anzahl Segmente ist ja noch nicht bekannt. Dies war bis zum 10.2.97 ein (kleines)
|
|
|
|
// Speicherleck.
|
2006-06-19 14:47:38 +00:00
|
|
|
E3dSphereObj::E3dSphereObj(int /*dummy*/) // den Parameter braucht es um unterscheiden zu koennen, welcher
|
2000-09-18 16:07:07 +00:00
|
|
|
{ // der beiden Konstruktoren gemeint ist. Der obige halt per Default
|
|
|
|
// Defaults setzen
|
|
|
|
E3dDefaultAttributes aDefault;
|
|
|
|
SetDefaultAttributes(aDefault);
|
|
|
|
}
|
|
|
|
|
|
|
|
void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
|
|
|
|
{
|
|
|
|
// Defaults setzen
|
|
|
|
aCenter = rDefault.GetDefaultSphereCenter();
|
|
|
|
aSize = rDefault.GetDefaultSphereSize();
|
|
|
|
}
|
|
|
|
|
2001-07-10 09:09:51 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Give out simple line geometry
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolyPolygon E3dSphereObj::Get3DLineGeometry() const
|
2001-07-10 09:09:51 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolyPolygon aRetval;
|
2004-11-03 09:42:27 +00:00
|
|
|
|
2001-07-10 10:21:00 +00:00
|
|
|
// add geometry describing polygons to rLinePolyPolygon
|
2004-11-03 09:42:27 +00:00
|
|
|
const sal_uInt32 nCntHor((sal_uInt32)GetHorizontalSegments());
|
|
|
|
const sal_uInt32 nCntVer((sal_uInt32)GetVerticalSegments());
|
|
|
|
const sal_Bool bCreateHorizontal(sal_True);
|
|
|
|
const sal_Bool bCreateVertical(sal_True);
|
2001-07-10 10:21:00 +00:00
|
|
|
|
2004-11-03 09:42:27 +00:00
|
|
|
if(nCntHor && nCntVer && (bCreateHorizontal || bCreateVertical))
|
2001-07-10 10:21:00 +00:00
|
|
|
{
|
2004-11-03 09:42:27 +00:00
|
|
|
const double fHInc((double)DEG2RAD(360) / nCntHor);
|
|
|
|
const double fVInc((double)DEG2RAD(180) / nCntVer);
|
2006-11-14 12:22:07 +00:00
|
|
|
const basegfx::B3DVector aRadius(aSize / 2.0);
|
|
|
|
const basegfx::B3DPoint aCenterPos(aCenter);
|
2004-11-03 09:42:27 +00:00
|
|
|
double fHAng(0.0);
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolygon aAllPoints;
|
2004-11-03 09:42:27 +00:00
|
|
|
|
|
|
|
// create all sphere points
|
|
|
|
for(sal_uInt32 nH(0L); nH < nCntHor; nH++)
|
2001-07-10 10:21:00 +00:00
|
|
|
{
|
2004-11-03 09:42:27 +00:00
|
|
|
const double fHSin(sin(fHAng));
|
|
|
|
const double fHCos(cos(fHAng));
|
|
|
|
fHAng += fHInc;
|
|
|
|
double fVAng(DEG2RAD(90) - fVInc);
|
2001-07-10 10:21:00 +00:00
|
|
|
|
2004-11-03 09:42:27 +00:00
|
|
|
for(sal_uInt32 nV(1L); nV < nCntVer; nV++)
|
2001-07-10 10:21:00 +00:00
|
|
|
{
|
2004-11-03 09:42:27 +00:00
|
|
|
const double fVSin(sin(fVAng));
|
|
|
|
const double fVCos(cos(fVAng));
|
|
|
|
fVAng -= fVInc;
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPoint aNewPos(
|
2004-11-03 09:42:27 +00:00
|
|
|
aCenterPos.getX() + (aRadius.getX() * fVCos) * fHCos,
|
2006-11-14 12:22:07 +00:00
|
|
|
aCenterPos.getY() + (aRadius.getY() * fVSin),
|
2004-11-03 09:42:27 +00:00
|
|
|
aCenterPos.getZ() + (aRadius.getZ() * fVCos) * fHSin);
|
|
|
|
|
|
|
|
aAllPoints.append(aNewPos);
|
2001-07-10 10:21:00 +00:00
|
|
|
}
|
2004-11-03 09:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// create horizontal lines
|
|
|
|
if(bCreateHorizontal)
|
|
|
|
{
|
|
|
|
for(sal_uInt32 a(1L); a < nCntVer; a++)
|
2001-07-10 10:21:00 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolygon aNewHor;
|
2004-11-03 09:42:27 +00:00
|
|
|
sal_uInt32 nStartIndex(a - 1L);
|
|
|
|
|
|
|
|
for(sal_uInt32 b(0L); b < nCntHor; b++)
|
|
|
|
{
|
|
|
|
aNewHor.append(aAllPoints.getB3DPoint(nStartIndex));
|
|
|
|
nStartIndex += (nCntVer - 1L);
|
|
|
|
}
|
|
|
|
|
|
|
|
aNewHor.append(aNewHor.getB3DPoint(0L));
|
|
|
|
aRetval.append(aNewHor);
|
2001-07-10 10:21:00 +00:00
|
|
|
}
|
2004-11-03 09:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// create vertical lines
|
|
|
|
if(bCreateVertical)
|
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
const basegfx::B3DPoint aTopPos(aCenterPos.getX(), aCenterPos.getY() + aRadius.getY(), aCenterPos.getZ());
|
|
|
|
const basegfx::B3DPoint aBottomPos(aCenterPos.getX(), aCenterPos.getY() - aRadius.getY(), aCenterPos.getZ());
|
2004-11-03 09:42:27 +00:00
|
|
|
|
|
|
|
for(sal_uInt32 a(0L); a < nCntHor; a++)
|
2001-07-10 10:21:00 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolygon aNewVer;
|
2004-11-03 09:42:27 +00:00
|
|
|
aNewVer.append(aTopPos);
|
|
|
|
sal_uInt32 nStartIndex(a * (nCntVer - 1L));
|
2001-07-10 10:21:00 +00:00
|
|
|
|
2004-11-03 09:42:27 +00:00
|
|
|
for(sal_uInt32 b(1L); b < nCntVer; b++, nStartIndex++)
|
|
|
|
{
|
|
|
|
aNewVer.append(aAllPoints.getB3DPoint(nStartIndex));
|
|
|
|
}
|
|
|
|
|
|
|
|
aNewVer.append(aBottomPos);
|
|
|
|
aRetval.append(aNewVer);
|
2001-07-10 10:21:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-03 09:42:27 +00:00
|
|
|
return aRetval;
|
2001-07-10 09:09:51 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Geometrieerzeugung
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dSphereObj::CreateGeometry()
|
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
if ( GetHorizontalSegments() < 3L )
|
2003-11-24 15:38:07 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(3L));
|
2003-11-24 15:38:07 +00:00
|
|
|
}
|
2000-11-07 11:58:28 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
if ( GetHorizontalSegments() > 100L )
|
2003-11-24 15:38:07 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(100L));
|
2003-11-24 15:38:07 +00:00
|
|
|
}
|
2000-11-07 11:58:28 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
if ( GetVerticalSegments() < 2L )
|
2003-11-24 15:38:07 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(2L));
|
2003-11-24 15:38:07 +00:00
|
|
|
}
|
2000-11-07 11:58:28 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
if ( GetVerticalSegments() > 100L )
|
2003-11-24 15:38:07 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(100L));
|
2003-11-24 15:38:07 +00:00
|
|
|
}
|
2000-11-07 11:58:28 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Start der Geometrieerzeugung ankuendigen
|
|
|
|
StartCreateGeometry();
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DVector aRadius(aSize / 2.0);
|
2000-09-18 16:07:07 +00:00
|
|
|
double fHSin1, fHSin2, fHCos1, fHCos2;
|
|
|
|
double fHAng = 0;
|
2000-11-07 11:58:28 +00:00
|
|
|
double fHInc = DEG2RAD(360) / GetHorizontalSegments();
|
|
|
|
double fVInc = DEG2RAD(180) / GetVerticalSegments();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
fHSin2 = 0.0; // sin(0)
|
|
|
|
fHCos2 = 1.0; // cos(0)
|
2000-11-07 11:58:28 +00:00
|
|
|
sal_uInt16 nUpperBound = (sal_uInt16)GetHorizontalSegments();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-07 11:58:28 +00:00
|
|
|
for (USHORT nH = 0; nH < nUpperBound; nH++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
fHAng += fHInc;
|
|
|
|
fHSin1 = fHSin2;
|
|
|
|
fHSin2 = sin(fHAng);
|
|
|
|
fHCos1 = fHCos2;
|
|
|
|
fHCos2 = cos(fHAng);
|
|
|
|
|
|
|
|
double fRx, fRz;
|
|
|
|
double fVAng = DEG2RAD(90);
|
|
|
|
double fVSin1, fVSin2, fVCos1, fVCos2;
|
|
|
|
fVSin2 = 1.0; // sin(90)
|
|
|
|
fVCos2 = 0.0; // cos(90)
|
2000-11-07 11:58:28 +00:00
|
|
|
sal_uInt16 nUpperVert = (sal_uInt16)GetVerticalSegments();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-07 11:58:28 +00:00
|
|
|
for (USHORT nV = 0; nV < nUpperVert; nV++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
fVAng -= fVInc;
|
|
|
|
fVSin1 = fVSin2;
|
|
|
|
fVSin2 = sin(fVAng);
|
|
|
|
fVCos1 = fVCos2;
|
|
|
|
fVCos2 = cos(fVAng);
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPoint aPos1(aCenter);
|
|
|
|
fRx = aRadius.getX() * fVCos1;
|
|
|
|
fRz = aRadius.getZ() * fVCos1;
|
|
|
|
aPos1.setX(aPos1.getX() + (fRx * fHCos1));
|
|
|
|
aPos1.setY(aPos1.getY() + (aRadius.getY() * fVSin1));
|
|
|
|
aPos1.setZ(aPos1.getZ() + (fRz * fHSin1));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPoint aPos2(aPos1);
|
|
|
|
aPos2.setX(aCenter.getX() + fRx * fHCos2);
|
|
|
|
aPos2.setZ(aCenter.getZ() + fRz * fHSin2);
|
|
|
|
|
|
|
|
basegfx::B3DPoint aPos0(aCenter);
|
|
|
|
fRx = aRadius.getX() * fVCos2;
|
|
|
|
fRz = aRadius.getZ() * fVCos2;
|
|
|
|
aPos0.setX(aPos0.getX() + (fRx * fHCos1));
|
|
|
|
aPos0.setY(aPos0.getY() + (aRadius.getY() * fVSin2));
|
|
|
|
aPos0.setZ(aPos0.getZ() + (fRz * fHSin1));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPoint aPos3(aPos0);
|
|
|
|
aPos3.setX(aCenter.getX() + (fRx * fHCos2));
|
|
|
|
aPos3.setZ(aCenter.getZ() + (fRz * fHSin2));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolygon aRect3D;
|
|
|
|
basegfx::B2DPolygon aTexture2D;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
aRect3D.append(aPos0);
|
|
|
|
aRect3D.append(aPos1);
|
|
|
|
aRect3D.append(aPos2);
|
|
|
|
aRect3D.append(aPos3);
|
|
|
|
|
|
|
|
if(GetCreateTexture())
|
|
|
|
{
|
|
|
|
basegfx::B2DPoint aTex1;
|
|
|
|
aTex1.setX((double)(nUpperBound - (nH + 1)) / (double)nUpperBound);
|
|
|
|
aTex1.setY((double)nV / (double)nUpperVert);
|
|
|
|
|
|
|
|
basegfx::B2DPoint aTex2;
|
|
|
|
aTex2.setX((double)((nUpperBound - (nH + 1)) - 1) / (double)nUpperBound);
|
|
|
|
aTex2.setY(aTex1.getY());
|
|
|
|
|
|
|
|
basegfx::B2DPoint aTex3;
|
|
|
|
aTex3.setX(aTex2.getX());
|
|
|
|
aTex3.setY((double)(nV+1) / (double)nUpperVert);
|
|
|
|
|
|
|
|
basegfx::B2DPoint aTex0;
|
|
|
|
aTex0.setX(aTex1.getX());
|
|
|
|
aTex0.setY(aTex3.getY());
|
|
|
|
|
|
|
|
aTexture2D.append(aTex0);
|
|
|
|
aTexture2D.append(aTex1);
|
|
|
|
aTexture2D.append(aTex2);
|
|
|
|
aTexture2D.append(aTex3);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(GetCreateNormals())
|
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
basegfx::B3DPolygon aNormal3D;
|
|
|
|
basegfx::B3DVector aNorZwi;
|
|
|
|
|
|
|
|
aNorZwi = aRect3D.getB3DPoint(0L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
|
|
|
|
aNorZwi = aRect3D.getB3DPoint(1L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
|
|
|
|
aNorZwi = aRect3D.getB3DPoint(2L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
|
|
|
|
aNorZwi = aRect3D.getB3DPoint(3L); aNorZwi.normalize(); aNormal3D.append(aNorZwi);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if(GetCreateTexture())
|
2006-11-14 12:22:07 +00:00
|
|
|
{
|
|
|
|
AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), basegfx::B2DPolyPolygon(aTexture2D), FALSE);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2006-11-14 12:22:07 +00:00
|
|
|
{
|
|
|
|
AddGeometry(basegfx::B3DPolyPolygon(aRect3D), basegfx::B3DPolyPolygon(aNormal3D), FALSE);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
AddGeometry(basegfx::B3DPolyPolygon(aRect3D), FALSE);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// call parent
|
|
|
|
E3dCompoundObject::CreateGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Identifier zurueckgeben
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
UINT16 E3dSphereObj::GetObjIdentifier() const
|
|
|
|
{
|
|
|
|
return E3D_SPHEREOBJ_ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Wandle das Objekt in ein Gruppenobjekt bestehend aus n Polygonen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-06-19 14:47:38 +00:00
|
|
|
SdrObject *E3dSphereObj::DoConvertToPolyObj(BOOL /*bBezier*/) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Leer-Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
void E3dSphereObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 12:22:07 +00:00
|
|
|
if((nHSegs != GetHorizontalSegments() || nVSegs != GetVerticalSegments()) && (nHSegs != 0 || nVSegs != 0))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-11-24 15:38:07 +00:00
|
|
|
GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(nHSegs));
|
|
|
|
GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
bGeometryValid = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Zuweisungsoperator
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dSphereObj::operator=(const SdrObject& rObj)
|
|
|
|
{
|
|
|
|
// erstmal alle Childs kopieren
|
|
|
|
E3dCompoundObject::operator=(rObj);
|
|
|
|
|
|
|
|
// weitere Parameter kopieren
|
|
|
|
const E3dSphereObj& r3DObj = (const E3dSphereObj&) rObj;
|
|
|
|
|
|
|
|
aCenter = r3DObj.aCenter;
|
|
|
|
aSize = r3DObj.aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Lokale Parameter setzen mit Geometrieneuerzeugung
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
void E3dSphereObj::SetCenter(const basegfx::B3DPoint& rNew)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(aCenter != rNew)
|
|
|
|
{
|
|
|
|
aCenter = rNew;
|
|
|
|
bGeometryValid = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-14 12:22:07 +00:00
|
|
|
void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(aSize != rNew)
|
|
|
|
{
|
|
|
|
aSize = rNew;
|
|
|
|
bGeometryValid = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Get the name of the object (singular)
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dSphereObj::TakeObjNameSingul(XubString& rName) const
|
|
|
|
{
|
|
|
|
rName=ImpGetResStr(STR_ObjNameSingulSphere3d);
|
2002-06-07 11:08:48 +00:00
|
|
|
|
|
|
|
String aName( GetName() );
|
|
|
|
if(aName.Len())
|
|
|
|
{
|
|
|
|
rName += sal_Unicode(' ');
|
|
|
|
rName += sal_Unicode('\'');
|
|
|
|
rName += aName;
|
|
|
|
rName += sal_Unicode('\'');
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Get the name of the object (plural)
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dSphereObj::TakeObjNamePlural(XubString& rName) const
|
|
|
|
{
|
|
|
|
rName=ImpGetResStr(STR_ObjNamePluralSphere3d);
|
|
|
|
}
|
|
|
|
|
2004-11-03 09:42:27 +00:00
|
|
|
// eof
|