2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* $RCSfile: dragmt3d.cxx,v $
|
2008-10-17 08:40:10 +00:00
|
|
|
* $Revision: 1.12.18.2 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 23:41:24 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 03:55:26 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_svx.hxx"
|
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
#include <dragmt3d.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/shl.hxx>
|
2007-06-27 17:02:18 +00:00
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#include <svx/dialmgr.hxx>
|
|
|
|
#include <svx/svddrgmt.hxx>
|
|
|
|
#include <svx/svdtrans.hxx>
|
|
|
|
#include <svx/obj3d.hxx>
|
|
|
|
#include <svx/polysc3d.hxx>
|
|
|
|
#include <svx/e3dundo.hxx>
|
|
|
|
#include <svx/dialogs.hrc>
|
2006-11-14 12:18:47 +00:00
|
|
|
#include <svx/sdr/overlay/overlaypolypolygon.hxx>
|
|
|
|
#include <svx/sdr/overlay/overlaymanager.hxx>
|
2008-10-17 08:40:10 +00:00
|
|
|
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
|
|
|
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
|
|
|
|
#include <drawinglayer/geometry/viewinformation3d.hxx>
|
|
|
|
#include <svx/e3dsceneupdater.hxx>
|
2006-11-14 12:18:47 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
TYPEINIT1(E3dDragMethod, SdrDragMethod);
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor aller 3D-DragMethoden
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
E3dDragMethod::E3dDragMethod (
|
2006-06-19 14:44:35 +00:00
|
|
|
SdrDragView &_rView,
|
2000-09-18 16:07:07 +00:00
|
|
|
const SdrMarkList& rMark,
|
|
|
|
E3dDragConstraint eConstr,
|
|
|
|
BOOL bFull)
|
2006-06-19 14:44:35 +00:00
|
|
|
: SdrDragMethod(_rView),
|
2008-10-17 08:40:10 +00:00
|
|
|
meConstraint(eConstr),
|
|
|
|
mbMoveFull(bFull),
|
|
|
|
mbMovedAtAll(FALSE)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Fuer alle in der selektion befindlichen 3D-Objekte
|
|
|
|
// eine Unit anlegen
|
2008-10-17 08:40:10 +00:00
|
|
|
const long nCnt(rMark.GetMarkCount());
|
|
|
|
static bool bDoInvalidate(false);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
for(long nObjs = 0;nObjs < nCnt;nObjs++)
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
|
|
|
|
|
|
|
|
if(pE3dObj)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
// fill new interaction unit
|
|
|
|
E3dDragMethodUnit aNewUnit;
|
|
|
|
aNewUnit.mp3DObj = pE3dObj;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// get transformations
|
|
|
|
aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(pE3dObj->GetParentObj())
|
|
|
|
{
|
|
|
|
// get transform between object and world, normally scene transform
|
|
|
|
aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->GetParentObj()->GetFullTransform();
|
|
|
|
aNewUnit.maInvDisplayTransform.invert();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// SnapRects der beteiligten Objekte invalidieren, um eine
|
|
|
|
// Neuberechnung beim Setzen der Marker zu erzwingen
|
2008-10-17 08:40:10 +00:00
|
|
|
if(bDoInvalidate)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
pE3dObj->SetRectsDirty();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
|
|
|
|
if(!mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
// create wireframe visualisation for parent coordinate system
|
|
|
|
aNewUnit.maWireframePoly.clear();
|
|
|
|
aNewUnit.maWireframePoly = pE3dObj->CreateWireframe();
|
|
|
|
aNewUnit.maWireframePoly.transform(aNewUnit.maTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// FullBound ermitteln
|
2008-10-17 08:40:10 +00:00
|
|
|
maFullBound.Union(pE3dObj->GetSnapRect());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Unit einfuegen
|
2008-10-17 08:40:10 +00:00
|
|
|
maGrp.push_back(aNewUnit);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-06-19 14:44:35 +00:00
|
|
|
void E3dDragMethod::TakeComment(XubString& /*rStr*/) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Erstelle das Drahtgittermodel fuer alle Aktionen
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
FASTBOOL E3dDragMethod::Beg()
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
if(E3DDRAG_CONSTR_Z == meConstraint)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
|
|
|
DragStat().Ref1() = maFullBound.Center();
|
|
|
|
|
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
|
|
|
rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
|
|
|
|
rCandidate.mnLastAngle = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
maLastPos = DragStat().GetStart();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(!mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Schluss
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-06-19 14:44:35 +00:00
|
|
|
FASTBOOL E3dDragMethod::End(FASTBOOL /*bCopy*/)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(!mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// WireFrame ausblenden
|
|
|
|
Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alle Transformationen anwenden und UnDo's anlegen
|
2008-10-17 08:40:10 +00:00
|
|
|
if(mbMovedAtAll)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rView.BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_ROTATE));
|
2008-10-17 08:40:10 +00:00
|
|
|
sal_uInt32 nOb(0);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
for(nOb=0;nOb<nCnt;nOb++)
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
|
|
|
E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
|
|
|
|
rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
|
|
|
|
rView.AddUndo(new E3dRotateUndoAction(rCandidate.mp3DObj->GetModel(),
|
|
|
|
rCandidate.mp3DObj, rCandidate.maInitTransform,
|
|
|
|
rCandidate.maTransform));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
rView.EndUndo();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Abbruch
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dDragMethod::Brk()
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
if(mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
if(mbMovedAtAll)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
|
|
|
|
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Transformation restaurieren
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
|
|
|
rCandidate.mp3DObj->SetTransform(rCandidate.maInitTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// WireFrame ausblenden
|
|
|
|
Hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Gemeinsames Mov()
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-06-19 14:44:35 +00:00
|
|
|
void E3dDragMethod::Mov(const Point& /*rPnt*/)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
mbMovedAtAll = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Zeichne das Drahtgittermodel
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2006-11-14 12:18:47 +00:00
|
|
|
// for migration from XOR to overlay
|
|
|
|
void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager, ::sdr::overlay::OverlayObjectList& rOverlayList)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
2006-11-14 12:18:47 +00:00
|
|
|
basegfx::B2DPolyPolygon aResult;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
2006-11-14 12:18:47 +00:00
|
|
|
SdrPageView* pPV = rView.GetSdrPageView();
|
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(pPV && pPV->HasMarkedObjPageView())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const basegfx::B3DPolyPolygon aCandidate(rCandidate.maWireframePoly);
|
|
|
|
const sal_uInt32 nPlyCnt(aCandidate.count());
|
|
|
|
|
|
|
|
if(nPlyCnt)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
|
|
|
|
const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
|
|
|
|
const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
|
|
|
|
const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
|
2006-11-14 12:18:47 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// transform to relative scene coordinates
|
|
|
|
basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// transform to 2D view coordinates
|
|
|
|
aPolyPolygon.transform(rVCScene.getObjectTransformation());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
aResult.append(aPolyPolygon);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-14 12:18:47 +00:00
|
|
|
|
|
|
|
if(aResult.count())
|
|
|
|
{
|
|
|
|
::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aResult);
|
|
|
|
rOverlayManager.add(*pNew);
|
|
|
|
rOverlayList.append(*pNew);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
|
|
|
E3dDragRotate
|
|
|
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
TYPEINIT1(E3dDragRotate, E3dDragMethod);
|
|
|
|
|
2006-06-19 14:44:35 +00:00
|
|
|
E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
|
2000-09-18 16:07:07 +00:00
|
|
|
const SdrMarkList& rMark,
|
|
|
|
E3dDragConstraint eConstr,
|
|
|
|
BOOL bFull)
|
2006-11-14 12:18:47 +00:00
|
|
|
: E3dDragMethod(_rView, rMark, eConstr, bFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Zentrum aller selektierten Objekte in Augkoordinaten holen
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(nCnt)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
const E3dScene *pScene = maGrp[0].mp3DObj->GetScene();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(pScene)
|
|
|
|
{
|
|
|
|
const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
|
|
|
|
const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
|
|
|
{
|
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
|
|
|
basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter();
|
|
|
|
const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
aObjCenter = aTransform * aObjCenter;
|
|
|
|
maGlobalCenter += aObjCenter;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Teilen durch Anzahl
|
|
|
|
if(nCnt > 1)
|
|
|
|
{
|
|
|
|
maGlobalCenter /= (double)nCnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get rotate center and transform to 3D eye coordinates
|
|
|
|
basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
|
|
|
|
|
|
|
|
// from world to relative scene using inverse getObjectTransformation()
|
|
|
|
basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
|
|
|
|
aInverseObjectTransform.invert();
|
|
|
|
aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// from 3D view to 3D eye
|
|
|
|
basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0);
|
|
|
|
basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
|
|
|
|
aInverseViewToEye.invert();
|
|
|
|
aRotCenter3D = aInverseViewToEye * aRotCenter3D;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// X,Y des RotCenter und Tiefe der gemeinsamen Objektmitte aus
|
|
|
|
// Rotationspunkt im Raum benutzen
|
2008-10-17 08:40:10 +00:00
|
|
|
maGlobalCenter.setX(aRotCenter3D.getX());
|
|
|
|
maGlobalCenter.setY(aRotCenter3D.getY());
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Das Objekt wird bewegt, bestimme die Winkel
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dDragRotate::Mov(const Point& rPnt)
|
|
|
|
{
|
|
|
|
// call parent
|
|
|
|
E3dDragMethod::Mov(rPnt);
|
|
|
|
|
|
|
|
if(DragStat().CheckMinMoved(rPnt))
|
|
|
|
{
|
|
|
|
// Modifier holen
|
2008-10-17 08:40:10 +00:00
|
|
|
sal_uInt16 nModifier = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if(rView.ISA(E3dView))
|
|
|
|
{
|
|
|
|
const MouseEvent& rLastMouse = ((E3dView&)rView).GetMouseEvent();
|
|
|
|
nModifier = rLastMouse.GetModifier();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alle Objekte rotieren
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
|
|
|
|
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Rotationswinkel bestimmen
|
|
|
|
double fWAngle, fHAngle;
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
if(E3DDRAG_CONSTR_Z == meConstraint)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) -
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
|
|
|
|
rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle;
|
2000-09-18 16:07:07 +00:00
|
|
|
fWAngle /= 100.0;
|
|
|
|
fHAngle = 0.0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X())
|
|
|
|
/ (double)maFullBound.GetWidth();
|
|
|
|
fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y())
|
|
|
|
/ (double)maFullBound.GetHeight();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
long nSnap = 0;
|
|
|
|
|
|
|
|
if(!rView.IsRotateAllowed(FALSE))
|
|
|
|
nSnap = 90;
|
|
|
|
|
|
|
|
if(nSnap != 0)
|
|
|
|
{
|
|
|
|
fWAngle = (double)(((long) fWAngle + nSnap/2) / nSnap * nSnap);
|
|
|
|
fHAngle = (double)(((long) fHAngle + nSnap/2) / nSnap * nSnap);
|
|
|
|
}
|
|
|
|
|
|
|
|
// nach radiant
|
|
|
|
fWAngle *= F_PI180;
|
|
|
|
fHAngle *= F_PI180;
|
|
|
|
|
|
|
|
// Transformation bestimmen
|
2006-11-14 12:18:47 +00:00
|
|
|
basegfx::B3DHomMatrix aRotMat;
|
2008-10-17 08:40:10 +00:00
|
|
|
if(E3DDRAG_CONSTR_Y & meConstraint)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(nModifier & KEY_MOD2)
|
2006-11-14 12:18:47 +00:00
|
|
|
aRotMat.rotate(0.0, 0.0, fWAngle);
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2006-11-14 12:18:47 +00:00
|
|
|
aRotMat.rotate(0.0, fWAngle, 0.0);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
else if(E3DDRAG_CONSTR_Z & meConstraint)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(nModifier & KEY_MOD2)
|
2006-11-14 12:18:47 +00:00
|
|
|
aRotMat.rotate(0.0, fWAngle, 0.0);
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2006-11-14 12:18:47 +00:00
|
|
|
aRotMat.rotate(0.0, 0.0, fWAngle);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
if(E3DDRAG_CONSTR_X & meConstraint)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 12:18:47 +00:00
|
|
|
aRotMat.rotate(fHAngle, 0.0, 0.0);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Transformation in Eye-Koordinaten, dort rotieren
|
|
|
|
// und zurueck
|
2008-10-17 08:40:10 +00:00
|
|
|
const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
|
|
|
|
const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
|
|
|
|
basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
|
|
|
|
aInverseOrientation.invert();
|
|
|
|
|
|
|
|
basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
|
|
|
|
aTransMat *= aViewInfo3D.getOrientation();
|
|
|
|
aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ());
|
2000-09-18 16:07:07 +00:00
|
|
|
aTransMat *= aRotMat;
|
2008-10-17 08:40:10 +00:00
|
|
|
aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
|
|
|
|
aTransMat *= aInverseOrientation;
|
|
|
|
aTransMat *= rCandidate.maInvDisplayTransform;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// ...und anwenden
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.maTransform *= aTransMat;
|
|
|
|
|
|
|
|
if(mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Hide();
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.maWireframePoly.transform(aTransMat);
|
2000-09-18 16:07:07 +00:00
|
|
|
Show();
|
|
|
|
}
|
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
maLastPos = rPnt;
|
2000-09-18 16:07:07 +00:00
|
|
|
DragStat().NextMove(rPnt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
Pointer E3dDragRotate::GetPointer() const
|
|
|
|
{
|
|
|
|
return Pointer(POINTER_ROTATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* E3dDragMove
|
|
|
|
|* Diese DragMethod wird nur bei Translationen innerhalb von 3D-Scenen
|
|
|
|
|* benoetigt. Wird eine 3D-Scene selbst verschoben, so wird diese DragMethod
|
|
|
|
|* nicht verwendet.
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
TYPEINIT1(E3dDragMove, E3dDragMethod);
|
|
|
|
|
2006-06-19 14:44:35 +00:00
|
|
|
E3dDragMove::E3dDragMove(SdrDragView &_rView,
|
2000-09-18 16:07:07 +00:00
|
|
|
const SdrMarkList& rMark,
|
|
|
|
SdrHdlKind eDrgHdl,
|
|
|
|
E3dDragConstraint eConstr,
|
|
|
|
BOOL bFull)
|
2006-11-14 12:18:47 +00:00
|
|
|
: E3dDragMethod(_rView, rMark, eConstr, bFull),
|
2008-10-17 08:40:10 +00:00
|
|
|
meWhatDragHdl(eDrgHdl)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
switch(meWhatDragHdl)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
case HDL_LEFT:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.RightCenter();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_RIGHT:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.LeftCenter();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_UPPER:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.BottomCenter();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_LOWER:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.TopCenter();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_UPLFT:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.BottomRight();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_UPRGT:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.BottomLeft();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_LWLFT:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.TopRight();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_LWRGT:
|
2008-10-17 08:40:10 +00:00
|
|
|
maScaleFixPos = maFullBound.TopLeft();
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Bewegen des Objektes, HDL_MOVE
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Override wenn IsResizeAtCenter()
|
|
|
|
if(rView.IsResizeAtCenter())
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
meWhatDragHdl = HDL_USER;
|
|
|
|
maScaleFixPos = maFullBound.Center();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Das Objekt wird bewegt, bestimme die Translation
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void E3dDragMove::Mov(const Point& rPnt)
|
|
|
|
{
|
|
|
|
// call parent
|
|
|
|
E3dDragMethod::Mov(rPnt);
|
|
|
|
|
|
|
|
if(DragStat().CheckMinMoved(rPnt))
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
if(HDL_MOVE == meWhatDragHdl)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Translation
|
|
|
|
// Bewegungsvektor bestimmen
|
2008-10-17 08:40:10 +00:00
|
|
|
basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()), 32768.0);
|
2006-11-14 12:18:47 +00:00
|
|
|
basegfx::B3DPoint aGlobalMoveTail(0.0, 0.0, 32768.0);
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Modifier holen
|
2008-10-17 08:40:10 +00:00
|
|
|
sal_uInt16 nModifier(0);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if(rView.ISA(E3dView))
|
|
|
|
{
|
|
|
|
const MouseEvent& rLastMouse = ((E3dView&)rView).GetMouseEvent();
|
|
|
|
nModifier = rLastMouse.GetModifier();
|
|
|
|
}
|
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
|
|
|
const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
|
|
|
|
const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
|
|
|
|
|
|
|
|
// move coor from 2d world to 3d Eye
|
|
|
|
basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()));
|
|
|
|
basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
|
|
|
|
basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
|
|
|
|
|
|
|
|
aInverseSceneTransform.invert();
|
|
|
|
aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D;
|
|
|
|
aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D;
|
|
|
|
|
|
|
|
basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5);
|
|
|
|
basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5);
|
|
|
|
basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
|
|
|
|
aInverseViewToEye.invert();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
aMoveHead3D = aInverseViewToEye * aMoveHead3D;
|
|
|
|
aMoveTail3D = aInverseViewToEye * aMoveTail3D;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// eventually switch movement from XY to XZ plane
|
2000-09-18 16:07:07 +00:00
|
|
|
if(nModifier & KEY_MOD2)
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
double fZwi = aMoveHead3D.getY();
|
|
|
|
aMoveHead3D.setY(aMoveHead3D.getZ());
|
|
|
|
aMoveHead3D.setZ(fZwi);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
fZwi = aMoveTail3D.getY();
|
|
|
|
aMoveTail3D.setY(aMoveTail3D.getZ());
|
|
|
|
aMoveTail3D.setZ(fZwi);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bewegungsvektor von Aug-Koordinaten nach Parent-Koordinaten
|
2008-10-17 08:40:10 +00:00
|
|
|
basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
|
|
|
|
aInverseOrientation.invert();
|
|
|
|
basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
aMoveHead3D = aCompleteTrans * aMoveHead3D;
|
|
|
|
aMoveTail3D = aCompleteTrans* aMoveTail3D;
|
|
|
|
|
|
|
|
// build transformation
|
2006-11-14 12:18:47 +00:00
|
|
|
basegfx::B3DHomMatrix aTransMat;
|
2008-10-17 08:40:10 +00:00
|
|
|
basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
|
2006-11-14 12:18:47 +00:00
|
|
|
aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// ...and apply
|
|
|
|
rCandidate.maTransform *= aTransMat;
|
|
|
|
|
|
|
|
if(mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Hide();
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.maWireframePoly.transform(aTransMat);
|
2000-09-18 16:07:07 +00:00
|
|
|
Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Skalierung
|
|
|
|
// Skalierungsvektor bestimmen
|
|
|
|
Point aStartPos = DragStat().GetStart();
|
2008-10-17 08:40:10 +00:00
|
|
|
const sal_uInt32 nCnt(maGrp.size());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
E3dDragMethodUnit& rCandidate = maGrp[nOb];
|
|
|
|
const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter());
|
|
|
|
|
|
|
|
// transform from 2D world view to 3D eye
|
|
|
|
const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
|
|
|
|
const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
|
|
|
|
|
|
|
|
basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y()));
|
|
|
|
basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y()));
|
|
|
|
basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y()));
|
|
|
|
basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
|
|
|
|
|
|
|
|
aInverseSceneTransform.invert();
|
|
|
|
aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
|
|
|
|
aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
|
|
|
|
aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
|
|
|
|
|
|
|
|
basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ());
|
|
|
|
basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ());
|
|
|
|
basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ());
|
|
|
|
basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
|
|
|
|
|
|
|
|
aInverseViewToEye.invert();
|
|
|
|
basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
|
|
|
|
basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
|
|
|
|
basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
|
|
|
|
|
|
|
|
// constraints?
|
|
|
|
switch(meWhatDragHdl)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
case HDL_LEFT:
|
|
|
|
case HDL_RIGHT:
|
2008-10-17 08:40:10 +00:00
|
|
|
// constrain to auf X -> Y equal
|
2006-11-14 12:18:47 +00:00
|
|
|
aScNext.setY(aScFixPos.getY());
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case HDL_UPPER:
|
|
|
|
case HDL_LOWER:
|
2008-10-17 08:40:10 +00:00
|
|
|
// constrain to auf Y -> X equal
|
2006-11-14 12:18:47 +00:00
|
|
|
aScNext.setX(aScFixPos.getX());
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
2006-06-19 14:44:35 +00:00
|
|
|
default:
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// get scale vector in eye coordinates
|
2006-11-14 12:18:47 +00:00
|
|
|
basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
|
|
|
|
aScaleVec.setZ(1.0);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 12:18:47 +00:00
|
|
|
if(aScaleVec.getX() != 0.0)
|
2008-10-17 08:40:10 +00:00
|
|
|
{
|
2006-11-14 12:18:47 +00:00
|
|
|
aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX());
|
2008-10-17 08:40:10 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2008-10-17 08:40:10 +00:00
|
|
|
{
|
2006-11-14 12:18:47 +00:00
|
|
|
aScaleVec.setX(1.0);
|
2008-10-17 08:40:10 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 12:18:47 +00:00
|
|
|
if(aScaleVec.getY() != 0.0)
|
2008-10-17 08:40:10 +00:00
|
|
|
{
|
2006-11-14 12:18:47 +00:00
|
|
|
aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
|
2008-10-17 08:40:10 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2008-10-17 08:40:10 +00:00
|
|
|
{
|
2006-11-14 12:18:47 +00:00
|
|
|
aScaleVec.setY(1.0);
|
2008-10-17 08:40:10 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// SHIFT-key used?
|
2000-09-18 16:07:07 +00:00
|
|
|
if(rView.IsOrtho())
|
|
|
|
{
|
2006-11-14 12:18:47 +00:00
|
|
|
if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
// X is biggest
|
2006-11-14 12:18:47 +00:00
|
|
|
aScaleVec.setY(aScaleVec.getX());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
// Y is biggest
|
2006-11-14 12:18:47 +00:00
|
|
|
aScaleVec.setX(aScaleVec.getY());
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-17 08:40:10 +00:00
|
|
|
// build transformation
|
|
|
|
basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
|
|
|
|
aInverseOrientation.invert();
|
|
|
|
|
|
|
|
basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform;
|
|
|
|
aNewTrans *= rCandidate.maDisplayTransform;
|
|
|
|
aNewTrans *= aViewInfo3D.getOrientation();
|
2006-11-14 12:18:47 +00:00
|
|
|
aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ());
|
|
|
|
aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
|
|
|
|
aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ());
|
2008-10-17 08:40:10 +00:00
|
|
|
aNewTrans *= aInverseOrientation;
|
|
|
|
aNewTrans *= rCandidate.maInvDisplayTransform;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// ...und anwenden
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.maTransform = aNewTrans;
|
|
|
|
|
|
|
|
if(mbMoveFull)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Hide();
|
2008-10-17 08:40:10 +00:00
|
|
|
rCandidate.maWireframePoly.clear();
|
|
|
|
rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe();
|
|
|
|
rCandidate.maWireframePoly.transform(rCandidate.maTransform);
|
2000-09-18 16:07:07 +00:00
|
|
|
Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
maLastPos = rPnt;
|
2000-09-18 16:07:07 +00:00
|
|
|
DragStat().NextMove(rPnt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
Pointer E3dDragMove::GetPointer() const
|
|
|
|
{
|
|
|
|
return Pointer(POINTER_MOVE);
|
|
|
|
}
|
|
|
|
|
2006-11-14 12:18:47 +00:00
|
|
|
// eof
|