/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
E3dDragMethod::E3dDragMethod (
SdrDragView &_rView, const SdrMarkList& rMark,
E3dDragConstraint eConstr, bool bFull)
: SdrDragMethod(_rView),
meConstraint(eConstr),
mbMoveFull(bFull),
mbMovedAtAll(false)
{ // Create a unit for all the 3D objects present in the selection const size_t nCnt(rMark.GetMarkCount());
if(mbMoveFull)
{ // for non-visible 3D objects fallback to wireframe interaction for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
{
E3dObject* pE3dObj = DynCastE3dObject(rMark.GetMark(nObjs)->GetMarkedSdrObj());
// for migration from XOR to overlay void E3dDragMethod::CreateOverlayGeometry(
sdr::overlay::OverlayManager& rOverlayManager, const sdr::contact::ObjectContact& rObjectContact, bool/* bIsGeometrySizeValid */)
{ // We do client-side object manipulation with the Kit API if (comphelper::LibreOfficeKit::isActive()) return;
// transform to relative scene coordinates
basegfx::B2DPolyPolygon aPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform));
// transform to 2D view coordinates
aPolyPolygon.transform(rVCScene.getObjectTransformation());
aResult.append(aPolyPolygon);
}
}
}
}
if(aResult.count())
{
std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew( new sdr::overlay::OverlayPolyPolygonStripedAndFilled(
std::move(aResult)));
// Divide by the number if(nCnt > 1)
{
maGlobalCenter /= static_cast<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;
// 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;
// Use X,Y of the RotCenter and depth of the common object centre // as rotation point in the space
maGlobalCenter.setX(aRotCenter3D.getX());
maGlobalCenter.setY(aRotCenter3D.getY());
}
// E3dDragMove. This drag method is only required for translations inside // 3D scenes. If a 3D-scene itself moved, then this drag method will drag // not be used.
E3dDragMove::E3dDragMove(SdrDragView &_rView, const SdrMarkList& rMark,
SdrHdlKind eDrgHdl,
E3dDragConstraint eConstr, bool bFull)
: E3dDragMethod(_rView, rMark, eConstr, bFull),
meWhatDragHdl(eDrgHdl)
{ switch(meWhatDragHdl)
{ case SdrHdlKind::Left:
maScaleFixPos = maFullBound.RightCenter(); break; case SdrHdlKind::Right:
maScaleFixPos = maFullBound.LeftCenter(); break; case SdrHdlKind::Upper:
maScaleFixPos = maFullBound.BottomCenter(); break; case SdrHdlKind::Lower:
maScaleFixPos = maFullBound.TopCenter(); break; case SdrHdlKind::UpperLeft:
maScaleFixPos = maFullBound.BottomRight(); break; case SdrHdlKind::UpperRight:
maScaleFixPos = maFullBound.BottomLeft(); break; case SdrHdlKind::LowerLeft:
maScaleFixPos = maFullBound.TopRight(); break; case SdrHdlKind::LowerRight:
maScaleFixPos = maFullBound.TopLeft(); break; default: // Moving the object, SdrHdlKind::Move break;
}
// eventually switch movement from XY to XZ plane if(nModifier & KEY_MOD2)
{ double fZwi = aMoveHead3D.getY();
aMoveHead3D.setY(aMoveHead3D.getZ());
aMoveHead3D.setZ(fZwi);
// constraints? switch(meWhatDragHdl)
{ case SdrHdlKind::Left: case SdrHdlKind::Right: // to constrain on X -> Y equal
aScNext.setY(aScFixPos.getY()); break; case SdrHdlKind::Upper: case SdrHdlKind::Lower: // constrain to Y -> X equal
aScNext.setX(aScFixPos.getX()); break; default: break;
}
// get scale vector in eye coordinates
basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
aScaleVec.setZ(1.0);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.