diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-12 11:26:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-12 13:36:19 +0100 |
commit | d1bc9d8510299aa9c31589ecb31457b98e644e58 (patch) | |
tree | f886e87d85be3aa29f0af123911b16d436846c06 /chart2/source | |
parent | 2d627b37643ba7308fec6ec5acb9e89cdaa6dfa3 (diff) |
remove unused code
Change-Id: Ieb5100dab1ed8af23e765926a8a1f33d75132406
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128311
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/inc/CommonConverters.hxx | 16 | ||||
-rw-r--r-- | chart2/source/tools/CommonConverters.cxx | 63 | ||||
-rw-r--r-- | chart2/source/view/charttypes/Splines.cxx | 403 | ||||
-rw-r--r-- | chart2/source/view/charttypes/Splines.hxx | 9 | ||||
-rw-r--r-- | chart2/source/view/inc/PropertyMapper.hxx | 5 | ||||
-rw-r--r-- | chart2/source/view/inc/ShapeFactory.hxx | 16 | ||||
-rw-r--r-- | chart2/source/view/main/PropertyMapper.cxx | 50 | ||||
-rw-r--r-- | chart2/source/view/main/ShapeFactory.cxx | 100 |
8 files changed, 0 insertions, 662 deletions
diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx index bbe5ec92cb7b..d10bf91984c8 100644 --- a/chart2/source/inc/CommonConverters.hxx +++ b/chart2/source/inc/CommonConverters.hxx @@ -100,9 +100,6 @@ OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly( , sal_Int32 nPointIndex, sal_Int32 nPolyIndex ); OOO_DLLPUBLIC_CHARTTOOLS -void addPolygon( css::drawing::PolyPolygonShape3D& rRet - , const css::drawing::PolyPolygonShape3D& rAdd ); -OOO_DLLPUBLIC_CHARTTOOLS void addPolygon( std::vector<std::vector<css::drawing::Position3D>>& rRet , const std::vector<std::vector<css::drawing::Position3D>>& rAdd ); /** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D @@ -130,9 +127,6 @@ css::drawing::PointSequenceSequence PolyToPointSequence( */ OOO_DLLPUBLIC_CHARTTOOLS basegfx::B2DPolyPolygon PolyToB2DPolyPolygon( - const css::drawing::PolyPolygonShape3D& rPolyPolygon ); -OOO_DLLPUBLIC_CHARTTOOLS -basegfx::B2DPolyPolygon PolyToB2DPolyPolygon( const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon ); /** drawing::PointSequenceSequence + drawing::PointSequenceSequence @@ -169,21 +163,11 @@ OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point Position3DToAWTPoint( const css::drawin */ OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size Direction3DToAWTSize( const css::drawing::Direction3D& rDirection ); -/** B3DPoint -> Sequence<double> -*/ -OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint ); - /** Sequence<double> -> drawing::Position3D */ OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D SequenceToPosition3D( const css::uno::Sequence< double >& rSeq ); -/** drawing::Position3D -> Sequence<double> -*/ - -OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double > - Position3DToSequence( const css::drawing::Position3D& rPosition ); - /** chart2::XDataSequence -> uno::Sequence< double > */ diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index 0c8f8bd8665a..20a3346f69b0 100644 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -245,32 +245,6 @@ drawing::Position3D getPointFromPoly( const std::vector<std::vector<css::drawing return aRet; } -void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd ) -{ - sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength(); - sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount; - rRet.SequenceX.realloc( nOuterCount ); - auto pSequenceX = rRet.SequenceX.getArray(); - rRet.SequenceY.realloc( nOuterCount ); - auto pSequenceY = rRet.SequenceY.getArray(); - rRet.SequenceZ.realloc( nOuterCount ); - auto pSequenceZ = rRet.SequenceZ.getArray(); - - sal_Int32 nIndex = 0; - sal_Int32 nOuter = nOuterCount - nAddOuterCount; - for( ; nOuter < nOuterCount; nOuter++ ) - { - if( nIndex >= nAddOuterCount ) - break; - - pSequenceX[nOuter] = rAdd.SequenceX[nIndex]; - pSequenceY[nOuter] = rAdd.SequenceY[nIndex]; - pSequenceZ[nOuter] = rAdd.SequenceZ[nIndex]; - - nIndex++; - } -} - void addPolygon( std::vector<std::vector<css::drawing::Position3D>>& rRet, const std::vector<std::vector<css::drawing::Position3D>>& rAdd ) { sal_Int32 nAddOuterCount = rAdd.size(); @@ -418,33 +392,6 @@ drawing::PointSequenceSequence PolyToPointSequence( } basegfx::B2DPolyPolygon PolyToB2DPolyPolygon( - const drawing::PolyPolygonShape3D& rPolyPolygon ) -{ - basegfx::B2DPolyPolygon aRetval; - - for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++) - { - basegfx::B2DPolygon aNewPolygon; - sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength(); - if(nInnerLength) - { - aNewPolygon.reserve(nInnerLength); - for( sal_Int32 nM = 0; nM < nInnerLength; nM++) - { - auto X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]); - auto Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]); - aNewPolygon.append(basegfx::B2DPoint(X, Y)); - } - // check for closed state flag - basegfx::utils::checkClosed(aNewPolygon); - } - aRetval.append(std::move(aNewPolygon)); - } - - return aRetval; -} - -basegfx::B2DPolyPolygon PolyToB2DPolyPolygon( const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon ) { basegfx::B2DPolyPolygon aRetval; @@ -531,11 +478,6 @@ awt::Size Direction3DToAWTSize( const drawing::Direction3D& rDirection ) return aRet; } -uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint ) -{ - return { rPoint.getX(), rPoint.getY(), rPoint.getZ() }; -} - drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq ) { OSL_ENSURE(rSeq.getLength()==3,"The sequence needs to have length 3 for conversion into vector"); @@ -547,11 +489,6 @@ drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq ) return aRet; } -uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPosition ) -{ - return { rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ }; -} - using namespace ::com::sun::star::chart2; uno::Sequence< double > DataSequenceToDoubleSequence( diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx index c79fbbcb9fc7..bd54b266345a 100644 --- a/chart2/source/view/charttypes/Splines.cxx +++ b/chart2/source/view/charttypes/Splines.cxx @@ -532,126 +532,6 @@ void applyNtoParameterT(const lcl_tSizeType i,const double tk,const sal_uInt32 p // Calculates uniform parametric splines with subinterval length 1, // according ODF1.2 part 1, chapter 'chart interpolation'. void SplineCalculater::CalculateCubicSplines( - const drawing::PolyPolygonShape3D& rInput - , drawing::PolyPolygonShape3D& rResult - , sal_uInt32 nGranularity ) -{ - OSL_PRECOND( nGranularity > 0, "Granularity is invalid" ); - - sal_uInt32 nOuterCount = rInput.SequenceX.getLength(); - - rResult.SequenceX.realloc(nOuterCount); - rResult.SequenceY.realloc(nOuterCount); - rResult.SequenceZ.realloc(nOuterCount); - - auto pSequenceX = rResult.SequenceX.getArray(); - auto pSequenceY = rResult.SequenceY.getArray(); - auto pSequenceZ = rResult.SequenceZ.getArray(); - - if( !nOuterCount ) - return; - - for( sal_uInt32 nOuter = 0; nOuter < nOuterCount; ++nOuter ) - { - if( rInput.SequenceX[nOuter].getLength() <= 1 ) - continue; //we need at least two points - - sal_uInt32 nMaxIndexPoints = rInput.SequenceX[nOuter].getLength()-1; // is >=1 - const double* pOldX = rInput.SequenceX[nOuter].getConstArray(); - const double* pOldY = rInput.SequenceY[nOuter].getConstArray(); - const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray(); - - std::vector < double > aParameter(nMaxIndexPoints+1); - aParameter[0]=0.0; - for( sal_uInt32 nIndex=1; nIndex<=nMaxIndexPoints; nIndex++ ) - { - aParameter[nIndex]=aParameter[nIndex-1]+1; - } - - // Split the calculation to X, Y and Z coordinate - tPointVecType aInputX; - aInputX.resize(nMaxIndexPoints+1); - tPointVecType aInputY; - aInputY.resize(nMaxIndexPoints+1); - tPointVecType aInputZ; - aInputZ.resize(nMaxIndexPoints+1); - for (sal_uInt32 nN=0;nN<=nMaxIndexPoints; nN++ ) - { - aInputX[ nN ].first=aParameter[nN]; - aInputX[ nN ].second=pOldX[ nN ]; - aInputY[ nN ].first=aParameter[nN]; - aInputY[ nN ].second=pOldY[ nN ]; - aInputZ[ nN ].first=aParameter[nN]; - aInputZ[ nN ].second=pOldZ[ nN ]; - } - - // generate a spline for each coordinate. It holds the complete - // information to calculate each point of the curve - std::unique_ptr<lcl_SplineCalculation> aSplineX; - std::unique_ptr<lcl_SplineCalculation> aSplineY; - // lcl_SplineCalculation* aSplineZ; the z-coordinates of all points in - // a data series are equal. No spline calculation needed, but copy - // coordinate to output - - if( pOldX[ 0 ] == pOldX[nMaxIndexPoints] && - pOldY[ 0 ] == pOldY[nMaxIndexPoints] && - pOldZ[ 0 ] == pOldZ[nMaxIndexPoints] && - nMaxIndexPoints >=2 ) - { // periodic spline - aSplineX.reset(new lcl_SplineCalculation( std::move(aInputX))); - aSplineY.reset(new lcl_SplineCalculation( std::move(aInputY))); - // aSplineZ = new lcl_SplineCalculation( aInputZ) ; - } - else // generate the kind "natural spline" - { - double fXDerivation = std::numeric_limits<double>::infinity(); - double fYDerivation = std::numeric_limits<double>::infinity(); - aSplineX.reset(new lcl_SplineCalculation( std::move(aInputX), fXDerivation, fXDerivation )); - aSplineY.reset(new lcl_SplineCalculation( std::move(aInputY), fYDerivation, fYDerivation )); - } - - // fill result polygon with calculated values - pSequenceX[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); - pSequenceY[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); - pSequenceZ[nOuter].realloc( nMaxIndexPoints*nGranularity + 1); - - double* pNewX = pSequenceX[nOuter].getArray(); - double* pNewY = pSequenceY[nOuter].getArray(); - double* pNewZ = pSequenceZ[nOuter].getArray(); - - sal_uInt32 nNewPointIndex = 0; // Index in result points - - for( sal_uInt32 ni = 0; ni < nMaxIndexPoints; ni++ ) - { - // given point is surely a curve point - pNewX[nNewPointIndex] = pOldX[ni]; - pNewY[nNewPointIndex] = pOldY[ni]; - pNewZ[nNewPointIndex] = pOldZ[ni]; - nNewPointIndex++; - - // calculate intermediate points - double fInc = ( aParameter[ ni+1 ] - aParameter[ni] ) / static_cast< double >( nGranularity ); - for(sal_uInt32 nj = 1; nj < nGranularity; nj++) - { - double fParam = aParameter[ni] + ( fInc * static_cast< double >( nj ) ); - - pNewX[nNewPointIndex]=aSplineX->GetInterpolatedValue( fParam ); - pNewY[nNewPointIndex]=aSplineY->GetInterpolatedValue( fParam ); - // pNewZ[nNewPointIndex]=aSplineZ->GetInterpolatedValue( fParam ); - pNewZ[nNewPointIndex] = pOldZ[ni]; - nNewPointIndex++; - } - } - // add last point - pNewX[nNewPointIndex] = pOldX[nMaxIndexPoints]; - pNewY[nNewPointIndex] = pOldY[nMaxIndexPoints]; - pNewZ[nNewPointIndex] = pOldZ[nMaxIndexPoints]; - } -} - -// Calculates uniform parametric splines with subinterval length 1, -// according ODF1.2 part 1, chapter 'chart interpolation'. -void SplineCalculater::CalculateCubicSplines( const std::vector<std::vector<css::drawing::Position3D>>& rInput , std::vector<std::vector<css::drawing::Position3D>>& rResult , sal_uInt32 nGranularity ) @@ -757,289 +637,6 @@ void SplineCalculater::CalculateCubicSplines( } } -// The implementation follows closely ODF1.2 spec, chapter chart:interpolation -// using the same names as in spec as far as possible, without prefix. -// More details can be found on -// Dr. C.-K. Shene: CS3621 Introduction to Computing with Geometry Notes -// Unit 9: Interpolation and Approximation/Curve Global Interpolation -// Department of Computer Science, Michigan Technological University -// http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/ -// [last called 2011-05-20] -void SplineCalculater::CalculateBSplines( - const css::drawing::PolyPolygonShape3D& rInput - , css::drawing::PolyPolygonShape3D& rResult - , sal_uInt32 nResolution - , sal_uInt32 nDegree ) -{ - // nResolution is ODF1.2 file format attribute chart:spline-resolution and - // ODF1.2 spec variable k. Causion, k is used as index in the spec in addition. - // nDegree is ODF1.2 file format attribute chart:spline-order and - // ODF1.2 spec variable p - OSL_ASSERT( nResolution > 1 ); - OSL_ASSERT( nDegree >= 1 ); - - // limit the b-spline degree at 15 to prevent insanely large sets of points - sal_uInt32 p = std::min<sal_uInt32>(nDegree, 15); - - sal_Int32 nOuterCount = rInput.SequenceX.getLength(); - - rResult.SequenceX.realloc(nOuterCount); - rResult.SequenceY.realloc(nOuterCount); - rResult.SequenceZ.realloc(nOuterCount); - - auto pSequenceX = rResult.SequenceX.getArray(); - auto pSequenceY = rResult.SequenceY.getArray(); - auto pSequenceZ = rResult.SequenceZ.getArray(); - - if( !nOuterCount ) - return; // no input - - for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter ) - { - if( rInput.SequenceX[nOuter].getLength() <= 1 ) - continue; // need at least 2 points, next piece of the series - - // Copy input to vector of points and remove adjacent double points. The - // Z-coordinate is equal for all points in a series and holds the depth - // in 3D mode, simple copying is enough. - lcl_tSizeType nMaxIndexPoints = rInput.SequenceX[nOuter].getLength()-1; // is >=1 - const double* pOldX = rInput.SequenceX[nOuter].getConstArray(); - const double* pOldY = rInput.SequenceY[nOuter].getConstArray(); - const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray(); - double fZCoordinate = pOldZ[0]; - tPointVecType aPointsIn; - aPointsIn.resize(nMaxIndexPoints+1); - for (lcl_tSizeType i = 0; i <= nMaxIndexPoints; ++i ) - { - aPointsIn[ i ].first = pOldX[i]; - aPointsIn[ i ].second = pOldY[i]; - } - aPointsIn.erase( std::unique( aPointsIn.begin(), aPointsIn.end()), - aPointsIn.end() ); - - // n is the last valid index to the reduced aPointsIn - // There are n+1 valid data points. - const lcl_tSizeType n = aPointsIn.size() - 1; - if (n < 1 || p > n) - continue; // need at least 2 points, degree p needs at least n+1 points - // next piece of series - - std::unique_ptr<double[]> t(new double [n+1]); - if (!createParameterT(aPointsIn, t.get())) - { - continue; // next piece of series - } - - lcl_tSizeType m = n + p + 1; - std::unique_ptr<double[]> u(new double [m+1]); - createKnotVector(n, p, t.get(), u.get()); - - // The matrix N contains the B-spline basis functions applied to parameters. - // In each row only p+1 adjacent elements are non-zero. The starting - // column in a higher row is equal or greater than in the lower row. - // To store this matrix the non-zero elements are shifted to column 0 - // and the amount of shifting is remembered in an array. - std::unique_ptr<double*[]> aMatN(new double*[n+1]); - for (lcl_tSizeType row = 0; row <=n; ++row) - { - aMatN[row] = new double[p+1]; - for (sal_uInt32 col = 0; col <= p; ++col) - aMatN[row][col] = 0.0; - } - std::unique_ptr<lcl_tSizeType[]> aShift(new lcl_tSizeType[n+1]); - aMatN[0][0] = 1.0; //all others are zero - aShift[0] = 0; - aMatN[n][0] = 1.0; - aShift[n] = n; - for (lcl_tSizeType k = 1; k<=n-1; ++k) - { // all basis functions are applied to t_k, - // results are elements in row k in matrix N - - // find the one interval with u_i <= t_k < u_(i+1) - // remember u_0 = ... = u_p = 0.0 and u_(m-p) = ... u_m = 1.0 and 0<t_k<1 - lcl_tSizeType i = p; - while (u[i] > t[k] || t[k] >= u[i+1]) - { - ++i; - } - - // index in reduced matrix aMatN = (index in full matrix N) - (i-p) - aShift[k] = i - p; - - applyNtoParameterT(i, t[k], p, u.get(), aMatN[k]); - } // next row k - - // Get matrix C of control points from the matrix equation aMatN * C = aPointsIn - // aPointsIn is overwritten with C. - // Gaussian elimination is possible without pivoting, see reference - lcl_tSizeType r = 0; // true row index - lcl_tSizeType c = 0; // true column index - double fDivisor = 1.0; // used for diagonal element - double fEliminate = 1.0; // used for the element, that will become zero - double fHelp; - tPointType aHelp; - lcl_tSizeType nHelp; // used in triangle change - bool bIsSuccessful = true; - for (c = 0 ; c <= n && bIsSuccessful; ++c) - { - // search for first non-zero downwards - r = c; - while ( r < n && aMatN[r][c-aShift[r]] == 0 ) - { - ++r; - } - if (aMatN[r][c-aShift[r]] == 0.0) - { - // Matrix N is singular, although this is mathematically impossible - bIsSuccessful = false; - } - else - { - // exchange total row r with total row c if necessary - if (r != c) - { - for ( sal_uInt32 i = 0; i <= p ; ++i) - { - fHelp = aMatN[r][i]; - aMatN[r][i] = aMatN[c][i]; - aMatN[c][i] = fHelp; - } - aHelp = aPointsIn[r]; - aPointsIn[r] = aPointsIn[c]; - aPointsIn[c] = aHelp; - nHelp = aShift[r]; - aShift[r] = aShift[c]; - aShift[c] = nHelp; - } - - // divide row c, so that element(c,c) becomes 1 - fDivisor = aMatN[c][c-aShift[c]]; // not zero, see above - for (sal_uInt32 i = 0; i <= p; ++i) - { - aMatN[c][i] /= fDivisor; - } - aPointsIn[c].first /= fDivisor; - aPointsIn[c].second /= fDivisor; - - // eliminate forward, examine row c+1 to n-1 (worst case) - // stop if first non-zero element in row has an higher column as c - // look at nShift for that, elements in nShift are equal or increasing - for ( r = c+1; r < n && aShift[r]<=c ; ++r) - { - fEliminate = aMatN[r][0]; - if (fEliminate != 0.0) // else accidentally zero, nothing to do - { - for (sal_uInt32 i = 1; i <= p; ++i) - { - aMatN[r][i-1] = aMatN[r][i] - fEliminate * aMatN[c][i]; - } - aMatN[r][p]=0; - aPointsIn[r].first -= fEliminate * aPointsIn[c].first; - aPointsIn[r].second -= fEliminate * aPointsIn[c].second; - ++aShift[r]; - } - } - } - }// upper triangle form is reached - if( bIsSuccessful) - { - // eliminate backwards, begin with last column - for (lcl_tSizeType cc = n; cc >= 1; --cc ) - { - // In row cc the diagonal element(cc,cc) == 1 and all elements left from - // diagonal are zero and do not influence other rows. - // Full matrix N has semibandwidth < p, therefore element(r,c) is - // zero, if abs(r-cc)>=p. abs(r-cc)=cc-r, because r<cc. - r = cc - 1; - while ( r !=0 && cc-r < p ) - { - fEliminate = aMatN[r][ cc - aShift[r] ]; - if ( fEliminate != 0.0) // else element is accidentally zero, no action needed - { - // row r -= fEliminate * row cc only relevant for right side - aMatN[r][cc - aShift[r]] = 0.0; - aPointsIn[r].first -= fEliminate * aPointsIn[cc].first; - aPointsIn[r].second -= fEliminate * aPointsIn[cc].second; - } - --r; - } - } - // aPointsIn contains the control points now. - - // calculate the intermediate points according given resolution - // using deBoor-Cox algorithm - lcl_tSizeType nNewSize = nResolution * n + 1; - pSequenceX[nOuter].realloc(nNewSize); - pSequenceY[nOuter].realloc(nNewSize); - pSequenceZ[nOuter].realloc(nNewSize); - double* pNewX = pSequenceX[nOuter].getArray(); - double* pNewY = pSequenceY[nOuter].getArray(); - double* pNewZ = pSequenceZ[nOuter].getArray(); - pNewX[0] = aPointsIn[0].first; - pNewY[0] = aPointsIn[0].second; - pNewZ[0] = fZCoordinate; // Precondition: z-coordinates of all points of a series are equal - pNewX[nNewSize -1 ] = aPointsIn[n].first; - pNewY[nNewSize -1 ] = aPointsIn[n].second; - pNewZ[nNewSize -1 ] = fZCoordinate; - std::unique_ptr<double[]> aP(new double[m+1]); - lcl_tSizeType nLow = 0; - for ( lcl_tSizeType nTIndex = 0; nTIndex <= n-1; ++nTIndex) - { - for (sal_uInt32 nResolutionStep = 1; - nResolutionStep <= nResolution && ( nTIndex != n-1 || nResolutionStep != nResolution); - ++nResolutionStep) - { - lcl_tSizeType nNewIndex = nTIndex * nResolution + nResolutionStep; - double ux = t[nTIndex] + nResolutionStep * ( t[nTIndex+1] - t[nTIndex]) /nResolution; - - // get index nLow, so that u[nLow]<= ux < u[nLow +1] - // continue from previous nLow - while ( u[nLow] <= ux) - { - ++nLow; - } - --nLow; - - // x-coordinate - for (lcl_tSizeType i = nLow-p; i <= nLow; ++i) - { - aP[i] = aPointsIn[i].first; - } - for (sal_uInt32 lcl_Degree = 1; lcl_Degree <= p; ++lcl_Degree) - { - for (lcl_tSizeType i = nLow; i >= nLow + lcl_Degree - p; --i) - { - double fFactor = ( ux - u[i] ) / ( u[i+p+1-lcl_Degree] - u[i]); - aP[i] = (1 - fFactor)* aP[i-1] + fFactor * aP[i]; - } - } - pNewX[nNewIndex] = aP[nLow]; - - // y-coordinate - for (lcl_tSizeType i = nLow - p; i <= nLow; ++i) - { - aP[i] = aPointsIn[i].second; - } - for (sal_uInt32 lcl_Degree = 1; lcl_Degree <= p; ++lcl_Degree) - { - for (lcl_tSizeType i = nLow; i >= nLow +lcl_Degree - p; --i) - { - double fFactor = ( ux - u[i] ) / ( u[i+p+1-lcl_Degree] - u[i]); - aP[i] = (1 - fFactor)* aP[i-1] + fFactor * aP[i]; - } - } - pNewY[nNewIndex] = aP[nLow]; - pNewZ[nNewIndex] = fZCoordinate; - } - } - } - for (lcl_tSizeType row = 0; row <=n; ++row) - { - delete[] aMatN[row]; - } - } // next piece of the series -} - void SplineCalculater::CalculateBSplines( const std::vector<std::vector<css::drawing::Position3D>>& rInput , std::vector<std::vector<css::drawing::Position3D>>& rResult diff --git a/chart2/source/view/charttypes/Splines.hxx b/chart2/source/view/charttypes/Splines.hxx index 3cd36131550e..b83c13931b47 100644 --- a/chart2/source/view/charttypes/Splines.hxx +++ b/chart2/source/view/charttypes/Splines.hxx @@ -32,20 +32,11 @@ class SplineCalculater { public: static void CalculateCubicSplines( - const css::drawing::PolyPolygonShape3D& rPoints - , css::drawing::PolyPolygonShape3D& rResult - , sal_uInt32 nGranularity ); - static void CalculateCubicSplines( const std::vector<std::vector<css::drawing::Position3D>>& rPoints , std::vector<std::vector<css::drawing::Position3D>>& rResult , sal_uInt32 nGranularity ); static void CalculateBSplines( - const css::drawing::PolyPolygonShape3D& rPoints - , css::drawing::PolyPolygonShape3D& rResult - , sal_uInt32 nGranularity - , sal_uInt32 nSplineDepth ); - static void CalculateBSplines( const std::vector<std::vector<css::drawing::Position3D>>& rPoints , std::vector<std::vector<css::drawing::Position3D>>& rResult , sal_uInt32 nGranularity diff --git a/chart2/source/view/inc/PropertyMapper.hxx b/chart2/source/view/inc/PropertyMapper.hxx index 897876128429..652a6a05131c 100644 --- a/chart2/source/view/inc/PropertyMapper.hxx +++ b/chart2/source/view/inc/PropertyMapper.hxx @@ -92,11 +92,6 @@ public: static void setMultiProperties( const tNameSequence& rNames , const tAnySequence& rValues - , const css::uno::Reference< css::beans::XPropertySet >& xTarget ); - - static void setMultiProperties( - const tNameSequence& rNames - , const tAnySequence& rValues , SvxShape& xTarget ); static const tPropertyNameMap& getPropertyNameMapForCharacterProperties(); diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index e8ff694f32cc..c9e7aab8384a 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -69,16 +69,9 @@ enum SymbolEnum { Symbol_Square=0 class ShapeFactory { - css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory; - - ShapeFactory(css::uno::Reference< css::lang::XMultiServiceFactory> const & xFactory) - {m_xShapeFactory = xFactory;} - public: enum class StackPosition { Top, Bottom }; - static ShapeFactory* getOrCreateShapeFactory(const css::uno::Reference< css::lang::XMultiServiceFactory>& xFactory); - ShapeFactory() = delete; static rtl::Reference< SvxShapeGroup > @@ -152,19 +145,11 @@ public: static rtl::Reference<Svx3DExtrudeObject> createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget - , const css::drawing::PolyPolygonShape3D& rPolyPolygon - , double fDepth); - static rtl::Reference<Svx3DExtrudeObject> - createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon , double fDepth); static SdrPathObj* createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget - , const css::drawing::PolyPolygonShape3D& rPolyPolygon - , bool bSetZOrderToZero = true); - static SdrPathObj* - createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon , bool bSetZOrderToZero = true); @@ -273,7 +258,6 @@ public: static OUString getStackedString( const OUString& rString, bool bStacked ); - static bool hasPolygonAnyLines( css::drawing::PolyPolygonShape3D& rPoly ); static bool hasPolygonAnyLines( const std::vector<std::vector<css::drawing::Position3D>>& rPoly ); static bool isPolygonEmptyOrSinglePoint( css::drawing::PolyPolygonShape3D& rPoly ); static bool isPolygonEmptyOrSinglePoint( const std::vector<std::vector<css::drawing::Position3D>>& rPoly ); diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index c8edc21aa852..3003ca9ccfe9 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -616,56 +616,6 @@ void PropertyMapper::setMultiProperties( } } -void PropertyMapper::setMultiProperties( - const tNameSequence& rNames - , const tAnySequence& rValues - , const css::uno::Reference< - css::beans::XPropertySet >& xTarget ) -{ - bool bSuccess = false; - try - { - uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY ); - if( xShapeMultiProp.is() ) - { - xShapeMultiProp->setPropertyValues( rNames, rValues ); - bSuccess = true; - } - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance - } - - if(bSuccess) - return; - - try - { - sal_Int32 nCount = std::max( rNames.getLength(), rValues.getLength() ); - OUString aPropName; - uno::Any aValue; - for( sal_Int32 nN = 0; nN < nCount; nN++ ) - { - aPropName = rNames[nN]; - aValue = rValues[nN]; - - try - { - xTarget->setPropertyValue( aPropName, aValue ); - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } - } - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } -} - void PropertyMapper::getTextLabelMultiPropertyLists( const uno::Reference< beans::XPropertySet >& xSourceProp , tNameSequence& rPropNames, tAnySequence& rPropValues diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 92167165ba14..65edbda37094 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -1058,59 +1058,6 @@ rtl::Reference<Svx3DPolygonObject> rtl::Reference<Svx3DExtrudeObject> ShapeFactory::createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget - , const drawing::PolyPolygonShape3D& rPolyPolygon - , double fDepth ) -{ - if( !xTarget.is() ) - return nullptr; - - if( !rPolyPolygon.SequenceX.hasElements()) - return nullptr; - - //create shape - rtl::Reference<Svx3DExtrudeObject> xShape = new Svx3DExtrudeObject(nullptr); - xShape->setShapeKind(SdrObjKind::E3D_Extrusion); - xTarget->add(xShape); - - //set properties - try - { - uno::Sequence<OUString> aPropertyNames{ - UNO_NAME_3D_EXTRUDE_DEPTH, - UNO_NAME_3D_PERCENT_DIAGONAL, - UNO_NAME_3D_POLYPOLYGON3D, - UNO_NAME_3D_DOUBLE_SIDED, - }; - - uno::Sequence<uno::Any> aPropertyValues { - uno::Any(sal_Int32(fDepth)), // depth - uno::Any(sal_Int16(0)), // PercentDiagonal - uno::Any(rPolyPolygon), // Polygon - uno::Any(true) // DoubleSided - }; - - //the z component of the polygon is now ignored by the drawing layer, - //so we need to translate the object via transformation matrix - - //Matrix for position - if (rPolyPolygon.SequenceZ.hasElements()&& rPolyPolygon.SequenceZ[0].hasElements()) - { - basegfx::B3DHomMatrix aM; - aM.translate(0, 0, rPolyPolygon.SequenceZ[0][0]); - drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM); - lcl_addProperty(aPropertyNames, aPropertyValues, UNO_NAME_3D_TRANSFORM_MATRIX, uno::Any(aHM)); - } - xShape->setPropertyValues(aPropertyNames, aPropertyValues); - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } - return xShape; -} - -rtl::Reference<Svx3DExtrudeObject> - ShapeFactory::createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon , double fDepth ) { @@ -1166,38 +1113,6 @@ rtl::Reference<Svx3DExtrudeObject> SdrPathObj* ShapeFactory::createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget - , const drawing::PolyPolygonShape3D& rPolyPolygon - , bool bSetZOrderToZero ) -{ - if( !xTarget.is() ) - return nullptr; - - //create shape - SdrPathObj* pPath = new SdrPathObj(xTarget->GetSdrObject()->getSdrModelFromSdrObject(), SdrObjKind::Polygon); - if (bSetZOrderToZero) - // insert at ZOrder 0, an area should always be behind other shapes - xTarget->GetSdrObject()->GetSubList()->InsertObject(pPath, 0); - else - xTarget->GetSdrObject()->GetSubList()->InsertObject(pPath); - - //set properties - try - { - // Polygon - basegfx::B2DPolyPolygon aNewPolyPolygon( PolyToB2DPolyPolygon(rPolyPolygon) ); - // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm - pPath->ForceMetricToItemPoolMetric(aNewPolyPolygon); - pPath->SetPathPoly(aNewPolyPolygon); - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } - return pPath; -} - -SdrPathObj* - ShapeFactory::createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon , bool bSetZOrderToZero ) { @@ -2516,12 +2431,6 @@ rtl::Reference<SvxShapeText> return xShape; } -ShapeFactory* ShapeFactory::getOrCreateShapeFactory(const uno::Reference< lang::XMultiServiceFactory>& xFactory) -{ - static ShapeFactory* pShapeFactory = new ShapeFactory(xFactory); - return pShapeFactory; -} - rtl::Reference<SvxShapeGroupAnyD> ShapeFactory::getChartRootShape( const rtl::Reference<SvxDrawPage>& xDrawPage ) { @@ -2638,15 +2547,6 @@ OUString ShapeFactory::getStackedString( const OUString& rString, bool bStacked return aStackStr.makeStringAndClear(); } -bool ShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly) -{ - // #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true - for( auto const & i : std::as_const(rPoly.SequenceX) ) - if( i.getLength() > 1 ) - return true; - return false; -} - bool ShapeFactory::hasPolygonAnyLines( const std::vector<std::vector<css::drawing::Position3D>>& rPoly) { // #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true |