diff options
Diffstat (limited to 'chart2/source/view/diagram')
-rw-r--r-- | chart2/source/view/diagram/VDiagram.cxx | 137 |
1 files changed, 70 insertions, 67 deletions
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index acffb369e200..70f930aa8623 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -523,6 +523,72 @@ void VDiagram::createShapes_3d() "com.sun.star.drawing.Shape3DSceneObject" ) ), uno::UNO_QUERY ); m_xLogicTarget->add(m_xOuterGroupShape); + uno::Reference< drawing::XShapes > xOuterGroup_Shapes = + uno::Reference<drawing::XShapes>( m_xOuterGroupShape, uno::UNO_QUERY ); + + + //------------------------------------------------------------------------- + //create additional group to manipulate the aspect ratio of the whole diagram: + xOuterGroup_Shapes = m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, rtl::OUString() ); + + m_xAspectRatio3D = uno::Reference< beans::XPropertySet >( xOuterGroup_Shapes, uno::UNO_QUERY ); + + //--------------------------- + + bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram ); + + //add walls + { + uno::Reference< beans::XPropertySet > xWallProp( NULL ); + if( m_xDiagram.is() ) + xWallProp=uno::Reference< beans::XPropertySet >( m_xDiagram->getWall()); + + rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model + if( !bAddFloorAndWall ) + aWallCID = rtl::OUString(); + uno::Reference< drawing::XShapes > xWallGroup_Shapes( m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, aWallCID ) ); + //add left wall + { + double xPos = 0.0; + CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); + if( CuboidPlanePosition_Right==eLeftWallPos ) + xPos = FIXED_SIZE_FOR_3D_CHART_VOLUME; + Stripe aStripe( drawing::Position3D(xPos,0,0) + , drawing::Direction3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) + , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) ); + + uno::Reference< drawing::XShape > xShape = + m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe + , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true ); + if( !bAddFloorAndWall ) + { + //we always need this object as dummy object for correct scene dimensions + //but it should not be visible in this case: + ShapeFactory::makeShapeInvisible( xShape ); + } + } + //add back wall + { + double zPos = 0.0; + CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); + if( CuboidPlanePosition_Front==eBackWallPos ) + zPos = FIXED_SIZE_FOR_3D_CHART_VOLUME; + Stripe aStripe( drawing::Position3D(0,0,zPos) + , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) + , drawing::Direction3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) ); + + uno::Reference< drawing::XShape > xShape = + m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe + , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true ); + if( !bAddFloorAndWall ) + { + //we always need this object as dummy object for correct scene dimensions + //but it should not be visible in this case: + ShapeFactory::makeShapeInvisible( xShape ); + } + } + } + try { uno::Reference< beans::XPropertySet > xSourceProp( m_xDiagram, uno::UNO_QUERY_THROW ); @@ -563,6 +629,8 @@ void VDiagram::createShapes_3d() else aEffectiveTranformation.shearXY(m_fYAnglePi,-m_fXAnglePi); + //#i98497# 3D charts are rendered with wrong size + E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape )); xDestProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX ), uno::makeAny( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aEffectiveTranformation ) ) ); } @@ -572,20 +640,6 @@ void VDiagram::createShapes_3d() ASSERT_EXCEPTION( ex ); } - uno::Reference< drawing::XShapes > xOuterGroup_Shapes = - uno::Reference<drawing::XShapes>( m_xOuterGroupShape, uno::UNO_QUERY ); - - - //------------------------------------------------------------------------- - //create additional group to manipulate the aspect ratio of the whole diagram: - xOuterGroup_Shapes = m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, rtl::OUString() ); - - m_xAspectRatio3D = uno::Reference< beans::XPropertySet >( xOuterGroup_Shapes, uno::UNO_QUERY ); - - //--------------------------- - - bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram ); - //add floor plate { uno::Reference< beans::XPropertySet > xFloorProp( NULL ); @@ -623,6 +677,7 @@ void VDiagram::createShapes_3d() aM.rotate(F_PI/2.0,0.0,0.0); aM.translate(0.0,FLOOR_THICKNESS, 0.0); drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM); + E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape )); xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX ) , uno::makeAny(aHM) ); } @@ -643,59 +698,6 @@ void VDiagram::createShapes_3d() ShapeFactory::setShapeName( xShape, aFloorCID ); } } - - //--------------------------- - //add walls - { - uno::Reference< beans::XPropertySet > xWallProp( NULL ); - if( m_xDiagram.is() ) - xWallProp=uno::Reference< beans::XPropertySet >( m_xDiagram->getWall()); - - rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model - if( !bAddFloorAndWall ) - aWallCID = rtl::OUString(); - uno::Reference< drawing::XShapes > xWallGroup_Shapes( m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, aWallCID ) ); - //add left wall - { - double xPos = 0.0; - CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); - if( CuboidPlanePosition_Right==eLeftWallPos ) - xPos = FIXED_SIZE_FOR_3D_CHART_VOLUME; - Stripe aStripe( drawing::Position3D(xPos,0,0) - , drawing::Direction3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) - , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) ); - - uno::Reference< drawing::XShape > xShape = - m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe - , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true ); - if( !bAddFloorAndWall ) - { - //we always need this object as dummy object for correct scene dimensions - //but it should not be visible in this case: - ShapeFactory::makeShapeInvisible( xShape ); - } - } - //add back wall - { - double zPos = 0.0; - CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); - if( CuboidPlanePosition_Front==eBackWallPos ) - zPos = FIXED_SIZE_FOR_3D_CHART_VOLUME; - Stripe aStripe( drawing::Position3D(0,0,zPos) - , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) - , drawing::Direction3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) ); - - uno::Reference< drawing::XShape > xShape = - m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe - , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true ); - if( !bAddFloorAndWall ) - { - //we always need this object as dummy object for correct scene dimensions - //but it should not be visible in this case: - ShapeFactory::makeShapeInvisible( xShape ); - } - } - } //--------------------------- //create an additional scene for the smaller inner coordinate region: @@ -716,6 +718,7 @@ void VDiagram::createShapes_3d() ::basegfx::B3DHomMatrix aM; aM.translate(GRID_TO_WALL_DISTANCE/fXScale, (FLOOR_THICKNESS+GRID_TO_WALL_DISTANCE)/fYScale, GRID_TO_WALL_DISTANCE/fZScale); aM.scale( fXScale, fYScale, fZScale ); + E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape )); xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX ) , uno::makeAny(BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aM)) ); } |