Fixed Visual base property map getter to actually get the property.
Enables addition of visuals via following setup in a CustomView:
private VisualBase _imageVisual;
[ScriptableProperty()]
public PropertyMap ImageVisual
{
get
{
return _imageVisual.Creation;
}
set
{
_imageVisual = VisualFactory.Get().CreateVisual( value );
RegisterVisual( GetPropertyIndex("ImageVisual", _imageVisual );
}
}
Then in code, can use
var imageVisual = new ImageVisual();
imageVisual.URL = value;
imageVisual.AlphaMaskURL = _maskURL;
imageVisual.MaskContentScale = 1.6f;
imageVisual.CropToMask = true;
ImageVisual = imageVisual.OutputVisualMap;
Change-Id: If31703b1684db30d9ed319be62e8b091ee62cdbb
Signed-off-by: David Steele <david.steele@samsung.com>
{ "Size", PropertyType.Vector2 },
{ "Position",PropertyType.Vector3 },
{ "Color", PropertyType.Vector4 },
{ "Size", PropertyType.Vector2 },
{ "Position",PropertyType.Vector3 },
{ "Color", PropertyType.Vector4 },
+ { "PropertyArray", PropertyType.Array },
+ { "PropertyMap", PropertyType.Map },
// { "Matrix3", PropertyType.MATRIX3 }, commented out until we need to use Matrices from JSON
// { "Matrix", PropertyType.MATRIX },
};
// { "Matrix3", PropertyType.MATRIX3 }, commented out until we need to use Matrices from JSON
// { "Matrix", PropertyType.MATRIX },
};
// Cycle through each property in the class
foreach (System.Reflection.PropertyInfo propertyInfo in viewType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public))
{
// Cycle through each property in the class
foreach (System.Reflection.PropertyInfo propertyInfo in viewType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public))
{
if (propertyInfo.CanRead)
{
if (propertyInfo.CanRead)
{
IEnumerable<Attribute> ie_attrs = propertyInfo.GetCustomAttributes<Attribute>();
List<Attribute> li_attrs = new List<Attribute>(ie_attrs);
System.Attribute[] attrs = li_attrs.ToArray();
IEnumerable<Attribute> ie_attrs = propertyInfo.GetCustomAttributes<Attribute>();
List<Attribute> li_attrs = new List<Attribute>(ie_attrs);
System.Attribute[] attrs = li_attrs.ToArray();
if (view != null)
{
System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName);
if (view != null)
{
System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName);
// We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type
System.Type type = propertyInfo.PropertyType;
bool ok = false;
// We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type
System.Type type = propertyInfo.PropertyType;
bool ok = false;
propertyInfo.SetValue(view, (Color)value);
};
}
propertyInfo.SetValue(view, (Color)value);
};
}
+ else if (type.Equals(typeof(PropertyMap)))
+ {
+ PropertyMap map = new PropertyMap();
+ ok = propValue.Get(map);
+ if( ok )
+ {
+ propertyInfo.SetValue( view, map );
+ }
+ }
+ else if (type.Equals(typeof(PropertyArray)))
+ {
+ PropertyArray array = new PropertyArray();
+ ok = propValue.Get(array);
+ if( ok )
+ {
+ propertyInfo.SetValue( view, array );
+ }
+ }
- throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value");
+ throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName );
/// </summary>
public PropertyMap Creation
{
/// </summary>
public PropertyMap Creation
{
- CreatePropertyMap(value);
+ PropertyMap map = new PropertyMap();
+ CreatePropertyMap(map);
+ return map;
}
}
internal void CreatePropertyMap(PropertyMap map)
}
}
internal void CreatePropertyMap(PropertyMap map)