X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Farc%2Farc-visual.cpp;h=71bb5388d96b423f7224eea201e323d9d318dadc;hp=618b75db5fb4d3636ce4e852f258aeb7456ae063;hb=564e9d67ee51b52b668e9791c13e14beeb63220e;hpb=160d5d7d3f87c50540f4083ac82458309a3a4610 diff --git a/dali-toolkit/internal/visuals/arc/arc-visual.cpp b/dali-toolkit/internal/visuals/arc/arc-visual.cpp index 618b75d..71bb538 100644 --- a/dali-toolkit/internal/visuals/arc/arc-visual.cpp +++ b/dali-toolkit/internal/visuals/arc/arc-visual.cpp @@ -23,6 +23,7 @@ //INTERNAL INCLUDES #include +#include #include #include #include @@ -159,6 +160,9 @@ ArcVisual::ArcVisual( VisualFactoryCache& factoryCache ) mStartAngle( 0.0f ), mSweepAngle( 360.0f ), mRadiusIndex( Property::INVALID_INDEX ), + mThicknessIndex( Property::INVALID_INDEX ), + mStartAngleIndex( Property::INVALID_INDEX ), + mSweepAngleIndex( Property::INVALID_INDEX ), mCapType( DevelArcVisual::Cap::BUTT ) { } @@ -176,6 +180,16 @@ void ArcVisual::DoSetProperties( const Property::Map& propertyMap ) { DALI_LOG_ERROR( "ArcVisual:DoSetProperties:: THICKNESS property has incorrect type: %d\n", thicknessValue->GetType() ); } + else + { + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetProperty( mThicknessIndex, mThickness ); + + // Need to calculate radius again + OnSetTransform(); + } + } } Property::Value* startAngleValue = propertyMap.Find( Toolkit::DevelArcVisual::Property::START_ANGLE, START_ANGLE_NAME ); @@ -185,6 +199,13 @@ void ArcVisual::DoSetProperties( const Property::Map& propertyMap ) { DALI_LOG_ERROR( "ArcVisual:DoSetProperties:: START_ANGLE property has incorrect type: %d\n", startAngleValue->GetType() ); } + else + { + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetProperty( mStartAngleIndex, mStartAngle ); + } + } } Property::Value* sweepAngleValue = propertyMap.Find( Toolkit::DevelArcVisual::Property::SWEEP_ANGLE, SWEEP_ANGLE_NAME ); @@ -194,6 +215,13 @@ void ArcVisual::DoSetProperties( const Property::Map& propertyMap ) { DALI_LOG_ERROR( "ArcVisual:DoSetProperties:: SWEEP_ANGLE property has incorrect type: %d\n", sweepAngleValue->GetType() ); } + else + { + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetProperty( mSweepAngleIndex, mSweepAngle ); + } + } } Property::Value* capValue = propertyMap.Find( Toolkit::DevelArcVisual::Property::CAP, CAP_NAME ); @@ -241,6 +269,23 @@ void ArcVisual::OnSetTransform() } } +void ArcVisual::OnDoAction( const Property::Index actionId, const Property::Value& attributes ) +{ + // Check if action is valid for this visual type and perform action if possible + switch( actionId ) + { + case DevelArcVisual::Action::UPDATE_PROPERTY: + { + Property::Map* map = attributes.GetMap(); + if( map ) + { + DoSetProperties( *map ); + } + break; + } + } +} + void ArcVisual::InitializeRenderer() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); @@ -267,10 +312,9 @@ void ArcVisual::InitializeRenderer() mImpl->mRenderer = Renderer::New( geometry, shader ); - mImpl->mRenderer.RegisterProperty( THICKNESS_NAME, mThickness ); - mImpl->mRenderer.RegisterProperty( START_ANGLE_NAME, mStartAngle ); - mImpl->mRenderer.RegisterProperty( SWEEP_ANGLE_NAME, mSweepAngle ); - mImpl->mRenderer.RegisterProperty( CAP_NAME, 0.0f ); + mThicknessIndex = mImpl->mRenderer.RegisterProperty( THICKNESS_NAME, mThickness ); + mStartAngleIndex = mImpl->mRenderer.RegisterProperty( START_ANGLE_NAME, mStartAngle ); + mSweepAngleIndex = mImpl->mRenderer.RegisterProperty( SWEEP_ANGLE_NAME, mSweepAngle ); mRadiusIndex = mImpl->mRenderer.RegisterProperty( RADIUS_NAME, mRadius );