/* -*- 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 .
*/
// no transparence for 3d objects
rInfo.bTransparenceAllowed = false;
// Convert 3D objects in a group of polygons: // At first not only possible, because the creation of a group of // 2D polygons would be required which need to be sorted by depth, // ie at intersections be cut relative to each other. Also the texture // coordinates were an unsolved problem.
rInfo.bCanConvToPoly = false;
rInfo.bCanConvToContour = false;
rInfo.bCanConvToPathLineToArea = false;
rInfo.bCanConvToPolyLineToArea = false;
}
// resize object, used from old 2d interfaces, e.g. in Move/Scale dialog (F4) void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
{ // Movement in X, Y in the eye coordinate system
E3dScene* pScene(getRootE3dSceneFromE3dObject());
if(nullptr == pScene)
{ return;
}
// transform pos from 2D world to 3D eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
basegfx::B2DPoint aScaleCenter2D(static_cast<double>(rRef.X()), static_cast<double>(rRef.Y()));
basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
// Move object in 2D is needed when using cursor keys void E3dObject::NbcMove(const Size& rSize)
{ // Movement in X, Y in the eye coordinate system
E3dScene* pScene(getRootE3dSceneFromE3dObject());
if(nullptr == pScene)
{ return;
}
//Dimensions of the scene in 3D and 2D for comparison
tools::Rectangle aRect = pScene->GetSnapRect();
basegfx::B3DHomMatrix aInvDispTransform;
E3dScene* pParent(getParentE3dSceneFromE3dObject());
// BoundVolume from 3d world to 3d eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
aEyeVol.transform(aViewInfo3D.getOrientation());
if ((aRect.GetWidth() == 0) || (aRect.GetHeight() == 0)) throw o3tl::divide_by_zero();
// movement vector to local coordinates of objects' parent
basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
aInverseOrientation.invert();
basegfx::B3DHomMatrix aCompleteTrans(aInvDispTransform * aInverseOrientation);
// Inform parent of changes in the structure (eg by transformation), in this // process the object in which the change has occurred is returned. void E3dObject::StructureChanged()
{
E3dScene* pParent(getParentE3dSceneFromE3dObject());
if(pVCOfE3D)
{ // BoundVolume is without 3D object transformation, use correct sequence const drawinglayer::primitive3d::Primitive3DContainer& xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform());
// Pass on the changes in transformation to all child objects void E3dObject::SetTransformChanged()
{
InvalidateBoundVolume();
mbTfHasChanged = true;
}
// Define the hierarchical transformation over all Parents, store in // maFullTransform and return them const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
{ if(mbTfHasChanged)
{
basegfx::B3DHomMatrix aNewFullTransformation(maTransformation);
E3dScene* pParent(getParentE3dSceneFromE3dObject());
// 2D-rotation of a 3D-body, normally this is done by the scene itself. // This is however a correct implementation, because everything that has // happened is a rotation around the axis perpendicular to the screen and that // is regardless of how the scene has been rotated up until now. void E3dObject::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{ // So currently the gluepoints are defined relative to the scene aOutRect. // Before turning the gluepoints are defined relative to the page. They // take no part in the rotation of the scene. To ensure this, there is the // SetGlueReallyAbsolute(sal_True); double fAngleInRad = toRadians(nAngle);
SetBoundAndSnapRectsDirty(); // This forces a recalculation of all BoundRects
NbcRotateGluePoints(rRef,nAngle,sn,cs); // Rotate the gluepoints (who still // have coordinates relative to the // original page)
SetGlueReallyAbsolute(false); // from now they are again relative to BoundRect (that is defined as aOutRect)
}
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.