LibreOffice Module chart2 (master) 1
VPolarTransformation.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21
22using namespace ::com::sun::star;
23
24using ::com::sun::star::uno::Sequence;
25
26namespace chart
27{
28
30 : m_aPositionHelper(rPositionHelper)
31 , m_aUnitCartesianToScene( rPositionHelper.getUnitCartesianToScene() )
32{
33}
34
36{
37}
38
39// ____ XTransformation2 ____
40css::drawing::Position3D VPolarTransformation::transform(
41 const Sequence< double >& rSourceValues ) const
42{
43 double fScaledLogicAngle = rSourceValues[0];
44 double fScaledLogicRadius = rSourceValues[1];
45
47 std::swap(fScaledLogicAngle,fScaledLogicRadius);
48
49 double fAngleDegree = m_aPositionHelper.transformToAngleDegree( fScaledLogicAngle, false );
50 double fAnglePi = basegfx::deg2rad(fAngleDegree);
51 double fRadius = m_aPositionHelper.transformToRadius( fScaledLogicRadius, false);
52
53 double fX=fRadius*cos(fAnglePi);
54 double fY=fRadius*sin(fAnglePi);
55 double fZ=rSourceValues[2];
56
58 ::basegfx::B3DPoint aPoint(fX,fY,fZ);
60 return css::drawing::Position3D(aRet.getX(), aRet.getY(), aRet.getZ());
61}
62
63css::drawing::Position3D VPolarTransformation::transform(
64 const css::drawing::Position3D& rSourceValues ) const
65{
66 double fScaledLogicAngle = rSourceValues.PositionX;
67 double fScaledLogicRadius = rSourceValues.PositionY;
68
70 std::swap(fScaledLogicAngle,fScaledLogicRadius);
71
72 double fAngleDegree = m_aPositionHelper.transformToAngleDegree( fScaledLogicAngle, false );
73 double fAnglePi = basegfx::deg2rad(fAngleDegree);
74 double fRadius = m_aPositionHelper.transformToRadius( fScaledLogicRadius, false);
75
76 double fX=fRadius*cos(fAnglePi);
77 double fY=fRadius*sin(fAnglePi);
78 double fZ=rSourceValues.PositionZ;
79
81 ::basegfx::B3DPoint aPoint(fX,fY,fZ);
83 return css::drawing::Position3D(aRet.getX(), aRet.getY(), aRet.getZ());
84}
85
86} // namespace chart
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TYPE getX() const
TYPE getZ() const
TYPE getY() const
double transformToAngleDegree(double fLogicValueOnAngleAxis, bool bDoScaling=true) const
Given a value in the angle axis scale range (e.g.
double transformToRadius(double fLogicValueOnRadiusAxis, bool bDoScaling=true) const
Given a value in the radius axis scale range, it returns the normalized value.
virtual css::drawing::Position3D transform(const css::uno::Sequence< double > &rSourceValues) const override
VPolarTransformation(const PolarPlottingPositionHelper &rPositionHelper)
::basegfx::B3DHomMatrix m_aUnitCartesianToScene
PolarPlottingPositionHelper m_aPositionHelper
virtual ~VPolarTransformation() override
constexpr double deg2rad(double v)