From d6fead18ff8cc7fca3feb1aa1789e47583796814 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Tue, 11 Oct 2016 10:51:00 +0100 Subject: [PATCH] Add SetProperty and GetProperty to Visuals. Change-Id: I532253e148c2957b258ee6c2fd99650cde683f7a Signed-off-by: Victor Cebollada --- .../src/dali-toolkit-internal/CMakeLists.txt | 1 + .../src/dali-toolkit-internal/utc-Dali-Visuals.cpp | 72 ++++++++++++++++++++++ .../src/dali-toolkit/utc-Dali-Visual.cpp | 42 ++++++++++++- .../devel-api/visual-factory/visual-base.cpp | 10 +++ .../devel-api/visual-factory/visual-base.h | 17 +++++ .../internal/visuals/border/border-visual.cpp | 11 ++++ .../internal/visuals/border/border-visual.h | 10 +++ .../internal/visuals/color/color-visual.cpp | 21 +++++++ dali-toolkit/internal/visuals/color/color-visual.h | 10 +++ .../internal/visuals/gradient/gradient-visual.cpp | 11 ++++ .../internal/visuals/gradient/gradient-visual.h | 10 +++ .../internal/visuals/image/batch-image-visual.cpp | 11 ++++ .../internal/visuals/image/batch-image-visual.h | 10 +++ .../internal/visuals/image/image-visual.cpp | 11 ++++ dali-toolkit/internal/visuals/image/image-visual.h | 10 +++ dali-toolkit/internal/visuals/mesh/mesh-visual.cpp | 11 ++++ dali-toolkit/internal/visuals/mesh/mesh-visual.h | 10 +++ .../internal/visuals/npatch/npatch-visual.cpp | 11 ++++ .../internal/visuals/npatch/npatch-visual.h | 10 +++ .../visuals/primitive/primitive-visual.cpp | 11 ++++ .../internal/visuals/primitive/primitive-visual.h | 10 +++ dali-toolkit/internal/visuals/svg/svg-visual.cpp | 11 ++++ dali-toolkit/internal/visuals/svg/svg-visual.h | 10 +++ dali-toolkit/internal/visuals/visual-base-impl.cpp | 36 +++++++++++ dali-toolkit/internal/visuals/visual-base-impl.h | 28 +++++++++ .../visuals/wireframe/wireframe-visual.cpp | 11 ++++ .../internal/visuals/wireframe/wireframe-visual.h | 9 +++ 27 files changed, 424 insertions(+), 1 deletion(-) create mode 100644 automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals.cpp diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index d2316e8..05380dd 100644 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -19,6 +19,7 @@ SET(TC_SOURCES utc-Dali-Text-Layout.cpp utc-Dali-Text-Controller.cpp utc-Dali-VisualFactoryResolveUrl.cpp + utc-Dali-Visuals.cpp ) # Append list of test harness files (Won't get parsed for test cases) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals.cpp new file mode 100644 index 0000000..a4bfbcb --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include + +#include +#include +#include +#include + +using namespace Dali::Toolkit::Internal; + +namespace +{ + +class DummyWireframeVisual : public WireframeVisual +{ +public: + + DummyWireframeVisual( VisualFactoryCache& factoryCache ) + : WireframeVisual( factoryCache ) + {} + + virtual ~DummyWireframeVisual() + {} + + void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) + { + WireframeVisual::DoSetProperty( index, propertyValue ); + } + + Dali::Property::Value DoGetProperty( Dali::Property::Index index ) + { + return WireframeVisual::DoGetProperty( index ); + } +}; + +} // namespace + +int UtcDaliWireframeVisual(void) +{ + // The goal of this test case is to cover the WireframeVisual::DoSetProperty() and + // WireframeVisual::DoGetProperty() which are unreachable from the public API. + + tet_infoline( " UtcDaliWireframeVisual" ); + + VisualFactoryCache* visualFactoryCache = new VisualFactoryCache(); + + DummyWireframeVisual visual( *visualFactoryCache ); + + visual.DoSetProperty( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::WIREFRAME ); + Dali::Property::Value value = visual.DoGetProperty( Dali::Toolkit::Visual::Property::TYPE ); + + tet_result(TET_PASS); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 6de8e23..577213d 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -308,6 +308,10 @@ int UtcDaliVisualGetPropertyMap1(void) DALI_TEST_CHECK( colorValue ); DALI_TEST_CHECK( colorValue->Get() == Color::CYAN ); + // Test the properties. TODO: to be completed. + colorVisual.SetProperty( ColorVisual::Property::MIX_COLOR, Color::RED ); + Property::Value value = colorVisual.GetProperty( ColorVisual::Property::MIX_COLOR ); + END_TEST; } @@ -358,6 +362,10 @@ int UtcDaliVisualGetPropertyMap2(void) DALI_TEST_CHECK( colorValue ); DALI_TEST_CHECK( colorValue->Get() == 10.f ); + // Test the properties. TODO: to be completed. + borderVisual.SetProperty( BorderVisual::Property::COLOR, Color::RED ); + Property::Value value = borderVisual.GetProperty( BorderVisual::Property::COLOR ); + END_TEST; } @@ -425,6 +433,10 @@ int UtcDaliVisualGetPropertyMap3(void) DALI_TEST_EQUALS( colorArray->GetElementAt(0).Get(), Color::RED , Math::MACHINE_EPSILON_100, TEST_LOCATION ); DALI_TEST_EQUALS( colorArray->GetElementAt(1).Get(), Color::GREEN , Math::MACHINE_EPSILON_100, TEST_LOCATION ); + // Test the properties. TODO: to be completed. + gradientVisual.SetProperty( GradientVisual::Property::STOP_COLOR, Color::RED ); + Property::Value gradientValue = gradientVisual.GetProperty( GradientVisual::Property::STOP_COLOR ); + END_TEST; } @@ -609,6 +621,10 @@ int UtcDaliVisualGetPropertyMap5(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == false ); + // Test the properties. TODO: to be completed. + imageVisual.SetProperty( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); + Property::Value imageValue = imageVisual.GetProperty( ImageVisual::Property::URL ); + END_TEST; } @@ -640,6 +656,10 @@ int UtcDaliVisualGetPropertyMap6(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() ); + // Test the properties. TODO: to be completed. + nPatchVisual.SetProperty( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME ); + Property::Value nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::URL ); + END_TEST; } @@ -652,7 +672,7 @@ int UtcDaliVisualGetPropertyMap7(void) VisualFactory factory = VisualFactory::Get(); Property::Map propertyMap; propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME ); + propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME ); Visual::Base svgVisual = factory.CreateVisual( propertyMap ); Property::Map resultMap; @@ -679,6 +699,10 @@ int UtcDaliVisualGetPropertyMap7(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == TEST_SVG_FILE_NAME ); + // Test the properties. TODO: to be completed. + svgVisual.SetProperty( ImageVisual::Property::URL, TEST_SVG_FILE_NAME ); + Property::Value svgValue = svgVisual.GetProperty( ImageVisual::Property::URL ); + END_TEST; } @@ -727,6 +751,10 @@ int UtcDaliVisualGetPropertyMap8(void) DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION ); + // Test the properties. TODO: to be completed. + meshVisual.SetProperty( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME ); + Property::Value meshValue = meshVisual.GetProperty( MeshVisual::Property::OBJECT_URL ); + END_TEST; } @@ -814,6 +842,10 @@ int UtcDaliVisualGetPropertyMap9(void) DALI_TEST_CHECK( value ); DALI_TEST_EQUALS( value->Get(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION ); + // Test the properties. TODO: to be completed. + primitiveVisual.SetProperty( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE ); + Property::Value primitiveValue = primitiveVisual.GetProperty( PrimitiveVisual::Property::SHAPE ); + END_TEST; } @@ -853,6 +885,10 @@ int UtcDaliVisualGetPropertyMapBatchImageVisual(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == 30 ); + // Test the properties. TODO: to be completed. + batchImageVisual.SetProperty( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); + Property::Value primitiveValue = batchImageVisual.GetProperty( ImageVisual::Property::URL ); + END_TEST; } @@ -1088,5 +1124,9 @@ int UtcDaliVisualWireframeVisual(void) Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER ); DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() == Visual::WIREFRAME ); + + // Test the properties. TODO: to be completed. + Property::Value primitiveValue = visual.GetProperty( Visual::Property::TYPE ); + END_TEST; } diff --git a/dali-toolkit/devel-api/visual-factory/visual-base.cpp b/dali-toolkit/devel-api/visual-factory/visual-base.cpp index 072ea6b..0c39ff5 100644 --- a/dali-toolkit/devel-api/visual-factory/visual-base.cpp +++ b/dali-toolkit/devel-api/visual-factory/visual-base.cpp @@ -100,6 +100,16 @@ void Visual::Base::CreatePropertyMap( Property::Map& map ) const GetImplementation( *this ).CreatePropertyMap( map ); } +void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + GetImplementation( *this ).SetProperty( index, propertyValue ); +} + +Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index ) +{ + return GetImplementation( *this ).GetProperty( index ); +} + } // namespace Toolkit } // namespace Dali diff --git a/dali-toolkit/devel-api/visual-factory/visual-base.h b/dali-toolkit/devel-api/visual-factory/visual-base.h index 74ca640..8429b41 100644 --- a/dali-toolkit/devel-api/visual-factory/visual-base.h +++ b/dali-toolkit/devel-api/visual-factory/visual-base.h @@ -150,6 +150,23 @@ public: */ void CreatePropertyMap( Dali::Property::Map& map ) const; + /** + * @brief Sets the value of an existing property. + * + * @param [in] index The index of the property. + * @param [in] propertyValue The new value of the property. + */ + void SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @brief Retrieves a property value. + * + * @param [in] index The index of the property. + * + * @return The property value. + */ + Dali::Property::Value GetProperty( Dali::Property::Index index ); + public: // Not intended for application developers explicit DALI_INTERNAL Base(Internal::Visual::Base *impl); diff --git a/dali-toolkit/internal/visuals/border/border-visual.cpp b/dali-toolkit/internal/visuals/border/border-visual.cpp index 7f7c7b5..0c27103 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.cpp +++ b/dali-toolkit/internal/visuals/border/border-visual.cpp @@ -160,6 +160,17 @@ void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing ); } +void BorderVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value BorderVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void BorderVisual::InitializeRenderer() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::BORDER_GEOMETRY ); diff --git a/dali-toolkit/internal/visuals/border/border-visual.h b/dali-toolkit/internal/visuals/border/border-visual.h index 8a44250..c1e30d8 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.h +++ b/dali-toolkit/internal/visuals/border/border-visual.h @@ -78,6 +78,16 @@ protected: */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + public: /** diff --git a/dali-toolkit/internal/visuals/color/color-visual.cpp b/dali-toolkit/internal/visuals/color/color-visual.cpp index 6406bcc..a1ef6d2 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.cpp +++ b/dali-toolkit/internal/visuals/color/color-visual.cpp @@ -105,6 +105,27 @@ void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor ); } +void ColorVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO + /* David Steele comented : + + Some things to bear in mind: + + We currently keep a copy of the mix color in the ColorVisual object, which is then used to instantiate the registered property on the renderer. + + The user can get the renderer and animate the mixColor property (it's registered, so is automatically a scene-graph property). + + The GetProperty method will have to read from the renderer, or from the cached value in the Visual, and the SetProperty will have to write to cache and to the renderer if present. + */ +} + +Dali::Property::Value ColorVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void ColorVisual::InitializeRenderer() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); diff --git a/dali-toolkit/internal/visuals/color/color-visual.h b/dali-toolkit/internal/visuals/color/color-visual.h index 2805d6a..88fb152 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.h +++ b/dali-toolkit/internal/visuals/color/color-visual.h @@ -67,6 +67,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp index 41999cc..f30ff03 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp @@ -279,6 +279,17 @@ void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const } } +void GradientVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value GradientVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void GradientVisual::InitializeRenderer() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.h b/dali-toolkit/internal/visuals/gradient/gradient-visual.h index 2f5d06c..1726c51 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.h +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.h @@ -103,6 +103,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** * @copydoc Visual::Base::DoInitialize diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp index 10418b7..46244aa 100644 --- a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp @@ -259,6 +259,17 @@ void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const } } +void BatchImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value BatchImageVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + Shader BatchImageVisual::GetBatchShader( VisualFactoryCache& factoryCache ) { Shader shader = factoryCache.GetShader( VisualFactoryCache::BATCH_IMAGE_SHADER ); diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.h b/dali-toolkit/internal/visuals/image/batch-image-visual.h index 646dad7..e5536e9 100644 --- a/dali-toolkit/internal/visuals/image/batch-image-visual.h +++ b/dali-toolkit/internal/visuals/image/batch-image-visual.h @@ -65,6 +65,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 540f7c2..4e545ab 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -641,6 +641,17 @@ void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV ); } +void ImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value ImageVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping ) { Shader shader; diff --git a/dali-toolkit/internal/visuals/image/image-visual.h b/dali-toolkit/internal/visuals/image/image-visual.h index 2c48913..c3f2217 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.h +++ b/dali-toolkit/internal/visuals/image/image-visual.h @@ -100,6 +100,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** * @copydoc Visual::Base::DoInitialize diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp b/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp index eafe9e8..5f8d4e0 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp @@ -389,6 +389,17 @@ void MeshVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::MeshVisual::Property::LIGHT_POSITION, mLightPosition ); } +void MeshVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value MeshVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void MeshVisual::InitializeRenderer() { //Try to load the geometry from the file. diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.h b/dali-toolkit/internal/visuals/mesh/mesh-visual.h index 4a2927c..a05f848 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.h +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.h @@ -79,6 +79,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp index 3bf5728..77d522e 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -405,6 +405,17 @@ void NPatchVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly ); } +void NPatchVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value NPatchVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void NPatchVisual::ChangeRenderer( bool oldBorderOnly, size_t oldGridX, size_t oldGridY ) { //check to see if the border style has changed diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index e6c4872..366d2b5 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -77,6 +77,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp index 325a9cd..956714b 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp @@ -405,6 +405,17 @@ void PrimitiveVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::PrimitiveVisual::Property::LIGHT_POSITION, mLightPosition ); } +void PrimitiveVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value PrimitiveVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void PrimitiveVisual::InitializeRenderer() { if( !mGeometry ) diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.h b/dali-toolkit/internal/visuals/primitive/primitive-visual.h index 054e9f0..04f1d3d 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.h +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.h @@ -125,6 +125,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.cpp b/dali-toolkit/internal/visuals/svg/svg-visual.cpp index 832fd19..6c0bcfb 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.cpp +++ b/dali-toolkit/internal/visuals/svg/svg-visual.cpp @@ -150,6 +150,17 @@ void SvgVisual::DoCreatePropertyMap( Property::Map& map ) const } } +void SvgVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value SvgVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void SvgVisual::SetImage( const std::string& imageUrl, ImageDimensions size ) { if( mImageUrl != imageUrl ) diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.h b/dali-toolkit/internal/visuals/svg/svg-visual.h index 81672e5..c040f47 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.h +++ b/dali-toolkit/internal/visuals/svg/svg-visual.h @@ -78,6 +78,16 @@ public: // from Visual */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + protected: /** diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 8356de5..32f8b8d 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -172,6 +172,42 @@ bool Visual::Base::GetIsFromCache() const return mImpl->mFlags & Impl::IS_FROM_CACHE; } +void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) && + ( index > VISUAL_PROPERTY_BASE_START_INDEX ) && // Change the type of visual is not allowed. + "Property index is out of bounds" ); + + if( index < VISUAL_PROPERTY_START_INDEX ) + { + // TODO set the properties of the visual base. + } + else + { + DoSetProperty( index, propertyValue ); + } +} + +Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index ) +{ + DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) && + ( index >= VISUAL_PROPERTY_BASE_START_INDEX ) && + "Property index is out of bounds" ); + + Dali::Property::Value value; + + if( index < VISUAL_PROPERTY_START_INDEX ) + { + // TODO retrieve the properties of the visual base. + } + else + { + value = DoGetProperty( index ); + } + + return value; +} + } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/visuals/visual-base-impl.h b/dali-toolkit/internal/visuals/visual-base-impl.h index 3820bd0..8334841 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.h +++ b/dali-toolkit/internal/visuals/visual-base-impl.h @@ -135,6 +135,16 @@ public: */ void SetCustomShader( const Property::Map& propertyMap ); + /** + * @copydoc Toolkit::Visual::Base::SetProperty + */ + void SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Toolkit::Visual::Base::GetProperty + */ + Dali::Property::Value GetProperty( Dali::Property::Index index ); + protected: /** @@ -198,6 +208,24 @@ protected: */ bool GetIsFromCache() const; +protected: + /** + * @brief Called by SetProperty(). To be overriden by derived clases in order to set properties. + * + * @param [in] index The index of the property. + * @param [in] propertyValue The new value of the property. + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) = 0; + + /** + * @brief Called by GetProperty(). To be overriden by derived classes in order to retrieve properties. + * + * @param [in] index The index of the property. + * + * @return The property value. + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ) = 0; + private: // Undefined diff --git a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp index 4299eb6..551e14f 100644 --- a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp @@ -86,6 +86,17 @@ void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::WIREFRAME ); } +void WireframeVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value WireframeVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + void WireframeVisual::InitializeRenderer() { mImpl->mRenderer = mFactoryCache.GetWireframeRenderer(); diff --git a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h index c0d8682..805e2c7 100644 --- a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h @@ -62,6 +62,15 @@ protected: */ virtual void DoCreatePropertyMap( Property::Map& map ) const; + /** + * @copydoc Visual::Base::DoSetProperty + */ + virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @copydoc Visual::Base::DoGetProperty + */ + virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); private: /** -- 2.7.4