Kaydet (Commit) fe01a68e authored tarafından Markus Mohrhard's avatar Markus Mohrhard

refactor the chart test code a bit

üst 81b4ac4f
......@@ -97,6 +97,7 @@ $(eval $(call gb_Library_add_exception_objects,chartview,\
chart2/source/view/main/Clipping \
chart2/source/view/main/DataPointSymbolSupplier \
chart2/source/view/main/DrawModelWrapper \
chart2/source/view/main/DumpHelper \
chart2/source/view/main/LabelPositionHelper \
chart2/source/view/main/Linear3DTransformation \
chart2/source/view/main/PlotterBase \
......
......@@ -598,6 +598,9 @@ void AreaChart::createShapes()
if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
if(mbDump)
maDumpHelper.writeElement("AreaChart-Shapes");
//the text labels should be always on top of the other series shapes
//for area chart the error bars should be always on top of the other series shapes
......@@ -987,6 +990,9 @@ void AreaChart::createShapes()
}
*/
if(mbDump)
maDumpHelper.endElement();
//remove and delete series-group-shape if empty
//... todo
......
......@@ -158,6 +158,7 @@ VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeMode
, m_xColorScheme()
, m_pExplicitCategoriesProvider(0)
, m_bPointsWereSkipped(false)
, mbDump(ENABLE_DUMP)
{
OSL_POSTCOND(m_xChartTypeModel.is(),"no XChartType available in view, fallback to default values may be wrong");
}
......@@ -431,6 +432,14 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
{
uno::Reference< drawing::XShape > xTextShape;
if(mbDump)
{
maDumpHelper.writeElement("DataLabel");
maDumpHelper.writeAttribute("Value", fValue);
maDumpHelper.writeAttribute("SumValue", fSumValue);
maDumpHelper.writePointElement(rScreenPosition2D);
}
try
{
awt::Point aScreenPosition2D(rScreenPosition2D);
......@@ -2161,10 +2170,19 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForSeries(
default:
break;
};
if(mbDump)
{
maDumpHelper.writeElement("LegendSymbolForSeries");
}
Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
xTarget, eLegendSymbolStyle, xShapeFactory
, rSeries.getPropertiesOfSeries(), ePropType, aExplicitSymbol ));
if(mbDump)
maDumpHelper.endElement();
return xShape;
}
......@@ -2217,9 +2235,19 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint(
}
}
if (mbDump)
{
maDumpHelper.writeElement("LegendSymbolForPoint");
}
Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
xTarget, eLegendSymbolStyle, xShapeFactory, xPointSet, ePropType, aExplicitSymbol ));
if (mbDump)
{
maDumpHelper.endElement();
}
return xShape;
}
......@@ -2237,6 +2265,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
if( ! ( xShapeFactory.is() && xTarget.is() && xContext.is() ) )
return aResult;
if(mbDump)
{
maDumpHelper.writeElement("LegendEntriesForSeries");
}
try
{
ViewLegendEntry aEntry;
......@@ -2353,6 +2386,10 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
{
ASSERT_EXCEPTION( ex );
}
if(mbDump)
maDumpHelper.endElement();
return aResult;
}
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#ifndef _CHART2_DUMPHELPER_HXX
#define _CHART2_DUMPHELPER_HXX
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/DoubleSequenceSequence.hpp>
#define ENABLE_DUMP 0
namespace chart
{
class DumpHelper
{
private:
//XmlTextWriterPtr pWriter;
public:
//void writeStripe(const Stripe& rStripe);
void writeElement(const char*);
void writeAttribute(const char* pAttrName, const char* pAttrValue);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Position3D& rPosition);
void writeAttribute(const char* pAttrName, const rtl::OUString& rName);
void writeAttribute(const char* pAttrName, const sal_Int32);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Direction3D& rPosition);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PointSequenceSequence& rPoints);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonShape3D& rPoints);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonBezierCoords& rCoords);
void writePointElement(const com::sun::star::awt::Point& rPoint);
void writeDoubleSequence(const char* pName, const com::sun::star::drawing::DoubleSequenceSequence& rSequence);
void endElement();
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -28,6 +28,7 @@
#ifndef _CHART2_VIEW_SHAPEFACTORY_HXX
#define _CHART2_VIEW_SHAPEFACTORY_HXX
#include "DumpHelper.hxx"
#include "PropertyMapper.hxx"
#include "VLineProperties.hxx"
#include "BaseGFXHelper.hxx"
......@@ -43,36 +44,12 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#define ENABLE_DUMP 0
//.............................................................................
namespace chart
{
//.............................................................................
class DumpHelper
{
private:
//XmlTextWriterPtr pWriter;
public:
//void writeStripe(const Stripe& rStripe);
void writeElement(const char*);
void writeAttribute(const char* pAttrName, const char* pAttrValue);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Position3D& rPosition);
void writeAttribute(const char* pAttrName, const rtl::OUString& rName);
void writeAttribute(const char* pAttrName, const sal_Int32);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::Direction3D& rPosition);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PointSequenceSequence& rPoints);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonShape3D& rPoints);
void writeAttribute(const char* pAttrName, const com::sun::star::drawing::PolyPolygonBezierCoords& rCoords);
void writePointElement(const com::sun::star::awt::Point& rPoint);
void writeDoubleSequence(const char* pName, const com::sun::star::drawing::DoubleSequenceSequence& rSequence);
void endElement();
};
class Stripe;
class ShapeFactory
{
......@@ -278,7 +255,7 @@ private:
m_xShapeFactory;
bool mbDump;
DumpHelper maDumpHerlper;
DumpHelper maDumpHelper;
};
//.............................................................................
......
......@@ -28,6 +28,7 @@
#ifndef _CHART2_VSERIESPLOTTER_HXX
#define _CHART2_VSERIESPLOTTER_HXX
#include "DumpHelper.hxx"
#include "PlotterBase.hxx"
#include "VDataSeries.hxx"
#include "LabelAlignment.hxx"
......@@ -437,6 +438,9 @@ protected: //member
::com::sun::star::uno::Sequence< sal_Int32 > m_aCoordinateSystemResolution;
bool m_bPointsWereSkipped;
DumpHelper maDumpHelper;
bool mbDump;
private: //member
typedef std::map< sal_Int32 , ExplicitScaleData > tSecondaryValueScales;
tSecondaryValueScales m_aSecondaryValueScales;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#include "DumpHelper.hxx"
#include <iostream>
#include <rtl/oustringostreaminserter.hxx>
using namespace com::sun::star;
namespace chart
{
/*
void DumpHelper::writeStripe(const Stripe& rStripe)
{
std::cout << "Stripe" << std::endl;
}*/
void DumpHelper::writeElement(const char* pName)
{
std::cout << pName << std::endl;
}
void DumpHelper::writeAttribute(const char* pAttrName, const rtl::OUString& rName)
{
std::cout << pAttrName << " " << rName << std::endl;
}
void DumpHelper::writeAttribute(const char* pAttrName, const char* pAttrValue)
{
std::cout << pAttrName << " " << pAttrValue << std::endl;
}
void DumpHelper::writeAttribute(const char* pAttrName, const drawing::Position3D& rPos)
{
std::cout << pAttrName << " " << rPos.PositionX << "," << rPos.PositionY << "," << rPos.PositionZ << std::endl;
}
void DumpHelper::writeAttribute(const char* pAttrName, const drawing::Direction3D& rDirection)
{
std::cout << pAttrName << " " << rDirection.DirectionX << "," << rDirection.DirectionY << "," << rDirection.DirectionZ << std::endl;
}
void DumpHelper::writeAttribute(const char* pAttrName, const sal_Int32 nValue)
{
std::cout << pAttrName << " " << nValue << std::endl;
}
void DumpHelper::writePointElement(const awt::Point& rPoint)
{
std::cout << "Point" << " " << rPoint.X << "," << rPoint.Y << std::endl;
}
void DumpHelper::writeDoubleSequence(const char* pName, const drawing::DoubleSequenceSequence& rSequence)
{
writeElement(pName);
writeElement("OuterSequence");
sal_Int32 nLength1 = rSequence.getLength();
for (sal_Int32 i = 0; i < nLength1; ++i)
{
writeElement("InnerSequence");
const uno::Sequence<double>& aInnerSequence = rSequence[i];
sal_Int32 nLength2 = aInnerSequence.getLength();
for( sal_Int32 j = 0; j < nLength2; ++j)
{
std::cout << "Value: " << aInnerSequence[j];
}
endElement();
}
endElement();
}
void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PointSequenceSequence& rSequence)
{
std::cout << pAttrName << " " << std::endl;
sal_Int32 nLength1 = rSequence.getLength();
writeElement("OuterSequence");
for (sal_Int32 i = 0; i < nLength1; ++i)
{
writeElement("InnerSequence");
const uno::Sequence<awt::Point>& aInnerSequence = rSequence[i];
sal_Int32 nLength2 = aInnerSequence.getLength();
for( sal_Int32 j = 0; j < nLength2; ++j)
{
writePointElement(aInnerSequence[j]);
}
endElement();
}
endElement();
}
void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonShape3D& rShape)
{
std::cout << pAttrName << " " << std::endl;
writeDoubleSequence("SequenceX", rShape.SequenceX);
writeDoubleSequence("SequenceY", rShape.SequenceY);
writeDoubleSequence("SequenceZ", rShape.SequenceZ);
}
void DumpHelper::writeAttribute(const char* pAttrName, const drawing::PolyPolygonBezierCoords& )
{
std::cout << pAttrName << " " << std::endl;
}
void DumpHelper::endElement()
{
std::cout << "EndElement" << std::endl;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment