diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-01-01 17:11:36 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-01-29 08:09:24 +0100 |
commit | d2b065acabf064378a9956ec3bb352dcd78cd06b (patch) | |
tree | 68c743f9385e8063cec21ab686de039494b56d08 /chart2 | |
parent | a04699cc42cbfe86e50693385e6ecc73ce95ce0a (diff) |
move code out of the factory into the OpenGL implementation
one step closer to a stateless factory
Change-Id: If491a53d9ce0d27244d4df293de7792019539c33
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/inc/DummyXShape.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 49 | ||||
-rw-r--r-- | chart2/source/view/main/OpenglShapeFactory.cxx | 91 |
3 files changed, 51 insertions, 91 deletions
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx index 915b5aa6fd62..31ff4850f40d 100644 --- a/chart2/source/view/inc/DummyXShape.hxx +++ b/chart2/source/view/inc/DummyXShape.hxx @@ -353,6 +353,8 @@ public: DummyLine2D(const drawing::PointSequenceSequence& rPoints, const VLineProperties* pProperties); DummyLine2D(const awt::Size& rSize, const awt::Point& rPosition); + virtual void render() SAL_OVERRIDE; + private: drawing::PointSequenceSequence maPoints; }; diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 1bfe0cb0d905..03e1c6ba4f8f 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -404,6 +404,55 @@ DummyLine2D::DummyLine2D(const awt::Size& rSize, const awt::Point& rPosition) setSize(rSize); } +void DummyLine2D::render() +{ + DummyChart* pChart = getRootShape(); + std::map< OUString, uno::Any >::const_iterator itr = maProperties.find(UNO_NAME_LINECOLOR); + if(itr != maProperties.end()) + { + //set line color + uno::Any co = itr->second; + sal_Int32 nColorValue = co.get<sal_Int32>(); + SAL_WARN("chart2.opengl", "*colorvalue = " << nColorValue); + sal_uInt8 R = (nColorValue & 0x00FF0000) >> 16; + sal_uInt8 G = (nColorValue & 0x0000FF00) >> 8; + sal_uInt8 B = (nColorValue & 0x000000FF); + pChart->m_GLRender.SetLine2DColor(R, G, B); + + SAL_WARN("chart2.opengl", "*colorvalue = " << nColorValue << ", R = " << R << ", G = " << G << ", B = " << B); + } + else + SAL_WARN("chart2.opengl", "no line color set"); + + //set line width + itr = maProperties.find(UNO_NAME_LINEWIDTH); + if(itr != maProperties.end()) + { + uno::Any cow = itr->second; + sal_Int32 nWidth = cow.get<sal_Int32>(); + pChart->m_GLRender.SetLine2DWidth(nWidth); + + SAL_WARN("chart2.opengl", "width = " << nWidth); + } + else + SAL_WARN("chart2.opengl", "no line width set"); + + sal_Int32 pointsscount = maPoints.getLength(); + for(sal_Int32 i = 0; i < pointsscount; i++) + { + com::sun::star::uno::Sequence<com::sun::star::awt::Point>& points = maPoints[i]; + sal_Int32 pointscount = points.getLength(); + for(sal_Int32 j = 0; j < pointscount; j++) + { + com::sun::star::awt::Point& p = points[j]; + pChart->m_GLRender.SetLine2DShapePoint((float)p.X, (float)p.Y, pointscount); + } + + } + pChart->m_GLRender.RenderLine2FBO(GL_TRUE); + +} + DummyRectangle::DummyRectangle() { } diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx index a36b98ad0405..71b19bd731da 100644 --- a/chart2/source/view/main/OpenglShapeFactory.cxx +++ b/chart2/source/view/main/OpenglShapeFactory.cxx @@ -362,97 +362,6 @@ uno::Reference< drawing::XShape > dummy::DummyLine2D* pLine = new dummy::DummyLine2D(rPoints, pLineProperties); xTarget->add(pLine); - dummy::DummyChart *pChart = (dummy::DummyChart *)m_pChart; - if (!m_pChart) - { - SAL_WARN("chart2.opengl", "createLine2D::DummyChart = NULL"); - } - - -//create shape - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( - "com.sun.star.drawing.PolyLineShape" ), uno::UNO_QUERY ); -// xTarget->add(xShape); - - //set properties - uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); - OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet"); - if( xProp.is()) - { - try - { - //Polygon - xProp->setPropertyValue( UNO_NAME_POLYPOLYGON - , uno::makeAny( rPoints ) ); - - if(pLineProperties) - { - //Transparency - if(pLineProperties->Transparence.hasValue()) - xProp->setPropertyValue( UNO_NAME_LINETRANSPARENCE - , pLineProperties->Transparence ); - - //LineStyle - if(pLineProperties->LineStyle.hasValue()) - xProp->setPropertyValue( UNO_NAME_LINESTYLE - , pLineProperties->LineStyle ); - - //LineWidth - if(pLineProperties->Width.hasValue()) - xProp->setPropertyValue( UNO_NAME_LINEWIDTH - , pLineProperties->Width ); - - //LineColor - if(pLineProperties->Color.hasValue()) - xProp->setPropertyValue( UNO_NAME_LINECOLOR - , pLineProperties->Color ); - - //LineDashName - if(pLineProperties->DashName.hasValue()) - xProp->setPropertyValue( "LineDashName" - , pLineProperties->DashName ); - } - } - catch( const uno::Exception& e ) - { - ASSERT_EXCEPTION( e ); - } - - } - //set line color - uno::Any co = xProp->getPropertyValue(UNO_NAME_LINECOLOR); - long *colorvalue = (long*)co.getValue(); - SAL_WARN("chart2.opengl", "*colorvalue = " << (*colorvalue)); - sal_uInt8 R = ((*colorvalue) & 0x00FF0000) >> 16; - sal_uInt8 G = ((*colorvalue) & 0x0000FF00) >> 8; - sal_uInt8 B = ((*colorvalue) & 0x000000FF); - pChart->m_GLRender.SetLine2DColor(R, G, B); - - SAL_WARN("chart2.opengl", "*colorvalue = " << (*colorvalue) << ", R = " << (int)R << ", G = " << (int)G << ", B = " << (int)B); - - //set line width - uno::Any cow = xProp->getPropertyValue(UNO_NAME_LINEWIDTH); - long *width = (long*)cow.getValue(); - pChart->m_GLRender.SetLine2DWidth((int)(*width)); - - SAL_WARN("chart2.opengl", "width = " << (*width)); - - com::sun::star::uno::Sequence<drawing::PointSequence> pointss = rPoints; - int pointsscount = pointss.getLength(); - for(int i = 0; i < pointsscount; i++) - { - com::sun::star::uno::Sequence<com::sun::star::awt::Point> points = pointss[i]; - int pointscount = points.getLength(); - for(int j = 0; j < pointscount; j++) - { - com::sun::star::awt::Point p = points[j]; - pChart->m_GLRender.SetLine2DShapePoint((float)p.X, (float)p.Y, pointscount); - // printf("point x:%ld,y:%ld\n",p.X,p.Y); - } - - } - pChart->m_GLRender.RenderLine2FBO(GL_TRUE); return pLine; } |