LibreOffice Module chart2 (master) 1
VPolarRadiusAxis.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
20#include "VPolarRadiusAxis.hxx"
21#include "VCartesianAxis.hxx"
23#include <Axis.hxx>
24#include <CommonConverters.hxx>
26
27namespace chart
28{
29using namespace ::com::sun::star;
30using namespace ::com::sun::star::chart2;
31
33 , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
34 , sal_Int32 nDimensionCount )
35 : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 1/*nDimensionIndex*/, nDimensionCount )
36{
42
44 m_aAxisProperties,xNumberFormatsSupplier,1/*nDimensionIndex*/,nDimensionCount
46}
47
49{
50}
51
52void VPolarRadiusAxis::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
53{
55 m_apAxisWithLabels->setTransformationSceneToScreen( rMatrix );
56}
57
59 const ExplicitScaleData& rScale
60 , const ExplicitIncrementData& rIncrement )
61{
62 VPolarAxis::setExplicitScaleAndIncrement( rScale, rIncrement );
63 m_apAxisWithLabels->setExplicitScaleAndIncrement( rScale, rIncrement );
64}
65
67 , const rtl::Reference<SvxShapeGroupAnyD>& xFinalTarget
68 , const OUString& rCID )
69{
70 VPolarAxis::initPlotter( xLogicTarget, xFinalTarget, rCID );
71 m_apAxisWithLabels->initPlotter( xLogicTarget, xFinalTarget, rCID );
72}
73
74void VPolarRadiusAxis::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
75{
76 VPolarAxis::setScales( std::vector(rScales), bSwapXAndYAxis );
77 m_apAxisWithLabels->setScales( std::move(rScales), bSwapXAndYAxis );
78}
79
80void VPolarRadiusAxis::initAxisLabelProperties( const css::awt::Size& rFontReferenceSize
81 , const css::awt::Rectangle& rMaximumSpaceForLabels )
82{
83 VPolarAxis::initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
84 m_apAxisWithLabels->initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
85}
86
88{
89 return 2;
90}
91
93{
94 //returns true if all is ready for further shape creation and any shapes need to be created
95 if( !isAnythingToDraw() )
96 return false;
97
98 if( m_xGroupShape_Shapes.is() )
99 return true;
100
101 return true;
102}
103
105{
106 m_apAxisWithLabels->createMaximumLabels();
107}
108
110{
111 m_apAxisWithLabels->updatePositions();
112}
113
115{
116 m_apAxisWithLabels->createLabels();
117}
118
120{
121 if( !prepareShapeCreation() )
122 return;
123
124 const ExplicitScaleData& rAngleScale = m_pPosHelper->getScales()[0];
125 const ExplicitIncrementData& rAngleIncrement = m_aIncrements[0];
126
127 TickInfoArraysType aAngleTickInfos;
128 TickFactory aAngleTickFactory( rAngleScale, rAngleIncrement );
129 aAngleTickFactory.getAllTicks( aAngleTickInfos );
130
131 uno::Reference< XScaling > xInverseScaling;
132 if( rAngleScale.Scaling.is() )
133 xInverseScaling = rAngleScale.Scaling->getInverseScaling();
134
135 AxisProperties aAxisProperties(m_aAxisProperties);
136
137 sal_Int32 nTick = 0;
138 EquidistantTickIter aIter( aAngleTickInfos, rAngleIncrement, 0 );
139 for( TickInfo* pTickInfo = aIter.firstInfo()
140 ; pTickInfo; pTickInfo = aIter.nextInfo(), nTick++ )
141 {
142 if( nTick == 0 )
143 {
144 m_apAxisWithLabels->createShapes();
145 continue;
146 }
147
148 //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
149 aAxisProperties.m_pfMainLinePositionAtOtherAxis = pTickInfo->getUnscaledTickValue();
150 aAxisProperties.m_bDisplayLabels=false;
151
152 VCartesianAxis aAxis(aAxisProperties,m_xNumberFormatsSupplier
153 ,1,2,new PolarPlottingPositionHelper());
157 aAxis.setScales( std::vector(m_pPosHelper->getScales()), false );
159 aAxis.createShapes();
160 }
161}
162
163} //namespace chart
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual TickInfo * nextInfo() override
virtual TickInfo * firstInfo() override
rtl::Reference< SvxShapeGroupAnyD > m_xLogicTarget
Definition: PlotterBase.hxx:69
rtl::Reference< SvxShapeGroupAnyD > m_xFinalTarget
Definition: PlotterBase.hxx:70
virtual void setScales(std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis)
Definition: PlotterBase.cxx:51
virtual void initPlotter(const rtl::Reference< SvxShapeGroupAnyD > &xLogicTarget, const rtl::Reference< SvxShapeGroupAnyD > &xFinalTarget, const OUString &rCID)
Definition: PlotterBase.cxx:36
void getAllTicks(TickInfoArraysType &rAllTickInfos) const
Definition: Tickmarks.cxx:119
AxisLabelProperties m_aAxisLabelProperties
Definition: VAxisBase.hxx:89
virtual void initAxisLabelProperties(const css::awt::Size &rFontReferenceSize, const css::awt::Rectangle &rMaximumSpaceForLabels)
Definition: VAxisBase.cxx:57
virtual void setExplicitScaleAndIncrement(const ExplicitScaleData &rScale, const ExplicitIncrementData &rIncrement) override
Definition: VAxisBase.cxx:148
AxisProperties m_aAxisProperties
Definition: VAxisBase.hxx:88
css::uno::Reference< css::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier
Definition: VAxisBase.hxx:87
rtl::Reference< SvxShapeGroupAnyD > m_xGroupShape_Shapes
Definition: VAxisBase.hxx:93
ExplicitScaleData m_aScale
::basegfx::B3DHomMatrix m_aMatrixScreenToScene
virtual void setTransformationSceneToScreen(const css::drawing::HomogenMatrix &rMatrix) override
ExplicitIncrementData m_aIncrement
virtual void createShapes() override
std::vector< ExplicitIncrementData > m_aIncrements
Definition: VPolarAxis.hxx:49
std::unique_ptr< PolarPlottingPositionHelper > m_pPosHelper
Definition: VPolarAxis.hxx:48
virtual bool isAnythingToDraw() override
Definition: VPolarAxis.cxx:57
virtual sal_Int32 estimateMaximumAutoMainIncrementCount() override
virtual void initPlotter(const rtl::Reference< SvxShapeGroupAnyD > &xLogicTarget, const rtl::Reference< SvxShapeGroupAnyD > &xFinalTarget, const OUString &rCID) override
virtual void createShapes() override
virtual void createLabels() override
virtual void setExplicitScaleAndIncrement(const ExplicitScaleData &rScale, const ExplicitIncrementData &rIncrement) override
virtual void setScales(std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis) override
virtual void initAxisLabelProperties(const css::awt::Size &rFontReferenceSize, const css::awt::Rectangle &rMaximumSpaceForLabels) override
virtual bool prepareShapeCreation() override
virtual void setTransformationSceneToScreen(const css::drawing::HomogenMatrix &rMatrix) override
virtual void createMaximumLabels() override
VPolarRadiusAxis(const AxisProperties &rAxisProperties, const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier, sal_Int32 nDimensionCount)
virtual void updatePositions() override
virtual ~VPolarRadiusAxis() override
std::unique_ptr< VCartesianAxis > m_apAxisWithLabels
std::vector< TickInfoArrayType > TickInfoArraysType
Definition: Tickmarks.hxx:59
@ LABEL_ALIGN_RIGHT
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix(const ::basegfx::B3DHomMatrix &rM)
diverse methods for class conversions; e.g.
double mfInnerTickDirection
which direction the labels are to be drawn.
LabelAlignment meAlignment
which direction the inner tickmarks are to be drawn.
css::awt::Size m_aFontReferenceSize
css::awt::Rectangle m_aMaximumSpaceForLabels
std::optional< double > m_pfMainLinePositionAtOtherAxis
void init(bool bCartesian=false)
AxisLabelAlignment maLabelAlignment
describes how tickmarks are positioned on the scale of an axis.
This structure contains the explicit values for a scale like Minimum and Maximum.
css::uno::Reference< css::chart2::XScaling > Scaling