fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / main / VPolarTransformation.cxx
blobe75e2a13b19da67ba6df32b7b5458310f03b3510
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "VPolarTransformation.hxx"
21 #include "ViewDefines.hxx"
22 #include "CommonConverters.hxx"
23 #include <algorithm>
25 using namespace ::com::sun::star;
27 using ::com::sun::star::uno::Sequence;
28 using ::com::sun::star::uno::RuntimeException;
30 namespace chart
33 VPolarTransformation::VPolarTransformation( const PolarPlottingPositionHelper& rPositionHelper )
34 : m_aPositionHelper(rPositionHelper)
35 , m_aUnitCartesianToScene( rPositionHelper.getUnitCartesianToScene() )
39 VPolarTransformation::~VPolarTransformation()
43 // ____ XTransformation ____
44 Sequence< double > SAL_CALL VPolarTransformation::transform(
45 const Sequence< double >& rSourceValues )
46 throw (RuntimeException,
47 lang::IllegalArgumentException, std::exception)
49 double fScaledLogicAngle = rSourceValues[0];
50 double fScaledLogicRadius = rSourceValues[1];
52 if( m_aPositionHelper.isSwapXAndY() )
53 std::swap(fScaledLogicAngle,fScaledLogicRadius);
55 double fAngleDegree = m_aPositionHelper.transformToAngleDegree( fScaledLogicAngle, false );
56 double fAnglePi = fAngleDegree*F_PI/180.0;
57 double fRadius = m_aPositionHelper.transformToRadius( fScaledLogicRadius, false);
59 double fX=fRadius*cos(fAnglePi);
60 double fY=fRadius*sin(fAnglePi);
61 double fZ=rSourceValues[2];
63 //!! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector
64 ::basegfx::B3DPoint aPoint(fX,fY,fZ);
65 ::basegfx::B3DPoint aRet = m_aUnitCartesianToScene * aPoint;
66 return B3DPointToSequence(aRet);
69 sal_Int32 SAL_CALL VPolarTransformation::getSourceDimension()
70 throw (RuntimeException, std::exception)
72 return 3;
75 sal_Int32 SAL_CALL VPolarTransformation::getTargetDimension()
76 throw (RuntimeException, std::exception)
78 return 3;
81 } // namespace chart
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */