[Tizen] Remove Visible propert in View.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / VisualMaps.cs
1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15
16 namespace Tizen.NUI
17 {
18     using Tizen.NUI.BaseComponents;
19
20     /// <summary>
21     /// A class encapsulating the transform map of visual.
22     /// </summary>
23     public class VisualMap
24     {
25         private Vector2 _visualSize = null;
26         private Vector2 _visualOffset = null;
27         private Vector2 _visualOffsetPolicy = null;
28         private Vector2 _visualSizePolicy = null;
29         private Visual.AlignType? _visualOrigin = null;
30         private Visual.AlignType? _visualAnchorPoint = null;
31
32         private PropertyMap _visualTransformMap = null;
33
34         private int? _depthIndex = null;
35         protected PropertyMap _outputVisualMap = null;
36
37         internal string Name
38         {
39             set;
40             get;
41         }
42
43         internal int VisualIndex
44         {
45             set;
46             get;
47         }
48
49         internal VisualView Parent
50         {
51             set;
52             get;
53         }
54
55         public VisualMap()
56         {
57         }
58
59         /// <summary>
60         /// Get or set size of the visual.<br>
61         /// It can be either relative (percentage of the parent)
62         /// or absolute (in world units).<br>
63         /// Optional.
64         /// </summary>
65         public Size2D Size
66         {
67             get
68             {
69                 return _visualSize ?? (new Size2D(1, 1));
70             }
71             set
72             {
73                 _visualSize = value;
74                 if (_visualSizePolicy == null)
75                 {
76                     _visualSizePolicy = new Vector2(0.0f, 0.0f);
77                 }
78                 UpdateVisual();
79             }
80         }
81
82         /// <summary>
83         /// Get or set offset of the visual.<br>
84         /// It can be either relative (percentage of the parent)
85         /// or absolute (in world units).<br>
86         /// Optional.
87         /// </summary>
88         public Vector2 Position
89         {
90             get
91             {
92                 return _visualOffset ?? (new Vector2(0.0f, 0.0f));
93             }
94             set
95             {
96                 _visualOffset = value;
97                 if (_visualOffsetPolicy == null)
98                 {
99                     _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
100                 }
101                 UpdateVisual();
102             }
103         }
104
105         /// <summary>
106         /// Get or set relative size of the visual<br>
107         /// (percentage [0.0f to 1.0f] of the control).<br>
108         /// Optional.
109         /// </summary>
110         public RelativeVector2 RelativeSize
111         {
112             get
113             {
114                 return _visualSize ?? (new RelativeVector2(1.0f, 1.0f));
115             }
116             set
117             {
118                 _visualSize = value;
119                 _visualSizePolicy = new Vector2(0.0f, 0.0f);
120                 UpdateVisual();
121             }
122         }
123
124         /// <summary>
125         /// Get or set relative offset of the visual<br>
126         /// (percentage [0.0f to 1.0f] of the control).<br>
127         /// Optional.
128         /// </summary>
129         public RelativeVector2 RelativePosition
130         {
131             get
132             {
133                 return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f));
134             }
135             set
136             {
137                 _visualOffset = value;
138                 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
139                 UpdateVisual();
140             }
141         }
142
143         /// <summary>
144         /// Get or set whether the x and y offset values are relative<br>
145         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
146         /// Be default, both the x and the y offset is relative.<br>
147         /// Optional.
148         /// </summary>
149         public VisualTransformPolicyType PositionPolicy
150         {
151             get
152             {
153                 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f
154                     && _visualOffsetPolicy.Y == 1.0f)
155                 {
156                     return VisualTransformPolicyType.Absolute;
157                 }
158                 return VisualTransformPolicyType.Relative;
159             }
160             set
161             {
162                 switch (value)
163                 {
164                     case VisualTransformPolicyType.Relative:
165                         _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
166                         break;
167                     case VisualTransformPolicyType.Absolute:
168                         _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
169                         break;
170                     default:
171                         _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
172                         break;
173                 }
174                 UpdateVisual();
175             }
176         }
177
178         /// <summary>
179         /// Get or set whether the x offset values are relative<br>
180         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
181         /// Be default, the x offset is relative.<br>
182         /// Optional.
183         /// </summary>
184         public VisualTransformPolicyType PositionPolicyX
185         {
186             get
187             {
188                 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f)
189                 {
190                     return VisualTransformPolicyType.Absolute;
191                 }
192                 return VisualTransformPolicyType.Relative;
193             }
194             set
195             {
196                 if (_visualOffsetPolicy == null)
197                 {
198                     _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
199                 }
200
201                 switch (value)
202                 {
203                     case VisualTransformPolicyType.Relative:
204                         _visualOffsetPolicy.X = 0.0f;
205                         break;
206                     case VisualTransformPolicyType.Absolute:
207                         _visualOffsetPolicy.X = 1.0f;
208                         break;
209                     default:
210                         _visualOffsetPolicy.X = 0.0f;
211                         break;
212                 }
213
214                 UpdateVisual();
215             }
216         }
217
218         /// <summary>
219         /// Get or set whether the y offset values are relative<br>
220         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
221         /// Be default, the y offset is relative.<br>
222         /// Optional.
223         /// </summary>
224         public VisualTransformPolicyType PositionPolicyY
225         {
226             get
227             {
228                 if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f)
229                 {
230                     return VisualTransformPolicyType.Absolute;
231                 }
232                 return VisualTransformPolicyType.Relative;
233             }
234             set
235             {
236                 if (_visualOffsetPolicy == null)
237                 {
238                     _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
239                 }
240
241                 switch (value)
242                 {
243                     case VisualTransformPolicyType.Relative:
244                         _visualOffsetPolicy.Y = 0.0f;
245                         break;
246                     case VisualTransformPolicyType.Absolute:
247                         _visualOffsetPolicy.Y = 1.0f;
248                         break;
249                     default:
250                         _visualOffsetPolicy.Y = 0.0f;
251                         break;
252                 }
253                 UpdateVisual();
254             }
255         }
256
257         /// <summary>
258         /// Get or set whether the width or height size values are relative<br>
259         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
260         /// Be default, both the width and the height offset is relative to the control's size.<br>
261         /// Optional.
262         /// </summary>
263         public VisualTransformPolicyType SizePolicy
264         {
265             get
266             {
267                 if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f
268                     && _visualSizePolicy.Y == 1.0f)
269                 {
270                     return VisualTransformPolicyType.Absolute;
271                 }
272                 return VisualTransformPolicyType.Relative;
273             }
274             set
275             {
276                 switch (value)
277                 {
278                     case VisualTransformPolicyType.Relative:
279                         _visualSizePolicy = new Vector2(0.0f, 0.0f);
280                         break;
281                     case VisualTransformPolicyType.Absolute:
282                         _visualSizePolicy = new Vector2(1.0f, 1.0f);
283                         break;
284                     default:
285                         _visualSizePolicy = new Vector2(0.0f, 0.0f);
286                         break;
287                 }
288                 UpdateVisual();
289             }
290         }
291
292         /// <summary>
293         /// Get or set whether the width size values are relative<br>
294         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
295         /// Be default, the width value is relative to the control's width.<br>
296         /// Optional.
297         /// </summary>
298         public VisualTransformPolicyType SizePolicyWidth
299         {
300             get
301             {
302                 if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f)
303                 {
304                     return VisualTransformPolicyType.Absolute;
305                 }
306                 return VisualTransformPolicyType.Relative;
307             }
308             set
309             {
310                 if (_visualSizePolicy == null)
311                 {
312                     _visualSizePolicy = new Vector2(0.0f, 0.0f);
313                 }
314
315                 switch (value)
316                 {
317                     case VisualTransformPolicyType.Relative:
318                         _visualSizePolicy.Width = 0.0f;
319                         break;
320                     case VisualTransformPolicyType.Absolute:
321                         _visualSizePolicy.Width = 1.0f;
322                         break;
323                     default:
324                         _visualSizePolicy.Width = 0.0f;
325                         break;
326                 }
327                 UpdateVisual();
328             }
329         }
330
331         /// <summary>
332         /// Get or set whether the height size values are relative<br>
333         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
334         /// Be default, both the height value is relative to the control's height.<br>
335         /// Optional.
336         /// </summary>
337         public VisualTransformPolicyType SizePolicyHeight
338         {
339             get
340             {
341                 if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f)
342                 {
343                     return VisualTransformPolicyType.Absolute;
344                 }
345                 return VisualTransformPolicyType.Relative;
346             }
347             set
348             {
349                 if (_visualSizePolicy == null)
350                 {
351                     _visualSizePolicy = new Vector2(0.0f, 0.0f);
352                 }
353
354                 switch (value)
355                 {
356                     case VisualTransformPolicyType.Relative:
357                         _visualSizePolicy.Height = 0.0f;
358                         break;
359                     case VisualTransformPolicyType.Absolute:
360                         _visualSizePolicy.Height = 1.0f;
361                         break;
362                     default:
363                         _visualSizePolicy.Height = 0.0f;
364                         break;
365                 }
366                 UpdateVisual();
367             }
368         }
369
370         /// <summary>
371         /// Get or set the origin of the visual within its control area.<br>
372         /// By default, the origin is Center.<br>
373         /// Optional.
374         /// </summary>
375         public Visual.AlignType Origin
376         {
377             get
378             {
379                 return _visualOrigin ?? (Visual.AlignType.Center);
380             }
381             set
382             {
383                 _visualOrigin = value;
384                 UpdateVisual();
385             }
386         }
387
388         /// <summary>
389         /// Get or set the anchor-point of the visual.<br>
390         /// By default, the anchor point is Center.<br>
391         /// Optional.
392         /// </summary>
393         public Visual.AlignType AnchorPoint
394         {
395             get
396             {
397                 return _visualAnchorPoint ?? (Visual.AlignType.Center);
398             }
399             set
400             {
401                 _visualAnchorPoint = value;
402                 UpdateVisual();
403             }
404         }
405
406         /// <summary>
407         /// Get or set the depth index of the visual.<br>
408         /// By default, the depth index is 0.<br>
409         /// Optional.
410         /// </summary>
411         public int DepthIndex
412         {
413             get
414             {
415                 return _depthIndex ?? (0);
416             }
417             set
418             {
419                 _depthIndex = value;
420             }
421         }
422
423         private void ComposingTransformMap()
424         {
425             _visualTransformMap = new PropertyMap();
426             if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
427             if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
428             if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
429             if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
430             if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
431             if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
432         }
433
434         /// <summary>
435         /// Get the transform map used by the visual.
436         /// </summary>
437         public PropertyMap OutputTransformMap
438         {
439             get
440             {
441                 ComposingTransformMap();
442                 return _visualTransformMap;
443             }
444         }
445
446         protected virtual void ComposingPropertyMap()
447         {
448             _outputVisualMap = new PropertyMap();
449         }
450
451         /// <summary>
452         /// Get the property map to create the visual.
453         /// </summary>
454         public PropertyMap OutputVisualMap
455         {
456             get
457             {
458                 ComposingPropertyMap();
459                 return _outputVisualMap;
460             }
461         }
462
463         internal void UpdateVisual()
464         {
465             if (VisualIndex > 0)
466             {
467                 NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex);
468                 Parent.UpdateVisual(VisualIndex, Name, this);
469             }
470             else
471             {
472                 NUILog.Debug("VisualIndex was not set");
473             }
474         }
475
476         protected PropertyMap _shader = null;
477         //private PropertyMap _transform = null;
478         protected bool? _premultipliedAlpha = null;
479         protected Color _mixColor = null;
480         protected float? _opacity = null;
481         protected PropertyMap _commonlyUsedMap = null;
482
483         /// <summary>
484         /// The shader to use in the visual.
485         /// </summary>
486         public PropertyMap Shader
487         {
488             get
489             {
490                 return _shader;
491             }
492             set
493             {
494                 _shader = value;
495                 UpdateVisual();
496             }
497         }
498
499         /// <summary>
500         /// Enables/disables premultiplied alpha. <br>
501         /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type.
502         /// </summary>
503         public bool PremultipliedAlpha
504         {
505             get
506             {
507                 return _premultipliedAlpha ?? (false);
508             }
509             set
510             {
511                 _premultipliedAlpha = value;
512                 UpdateVisual();
513             }
514         }
515
516         /// <summary>
517         /// Mix color is a blend color for any visual.
518         /// </summary>
519         public Color MixColor
520         {
521             get
522             {
523                 return _mixColor;
524             }
525             set
526             {
527                 _mixColor = value;
528                 UpdateVisual();
529             }
530         }
531
532         /// <summary>
533         /// Opacity is the alpha component of the mixColor, above.
534         /// </summary>
535         public float Opacity
536         {
537             get
538             {
539                 return _opacity ?? (1.0f);
540             }
541             set
542             {
543                 _opacity = value;
544                 UpdateVisual();
545             }
546         }
547
548     }
549
550     /// <summary>
551     /// A class encapsulating the property map of a image visual.
552     /// </summary>
553     public class ImageVisual : VisualMap
554     {
555         public ImageVisual() : base()
556         {
557         }
558
559         private string _url = null;
560         private string _alphaMaskUrl = null;
561         private FittingModeType? _fittingMode = null;
562         private SamplingModeType? _samplingMode = null;
563         private int? _desiredWidth = null;
564         private int? _desiredHeight = null;
565         private bool? _synchronousLoading = false;
566         private bool? _borderOnly = null;
567         private Vector4 _pixelArea = null;
568         private WrapModeType? _wrapModeU = null;
569         private WrapModeType? _wrapModeV = null;
570
571         /// <summary>
572         /// Get or set the URL of the image.<br>
573         /// Mandatory.
574         /// </summary>
575         public string URL
576         {
577             get
578             {
579                 return _url;
580             }
581             set
582             {
583                 _url = value;
584                 UpdateVisual();
585             }
586         }
587
588         /// <summary>
589         /// Get or set the URL of the alpha mask.<br>
590         /// Optional.
591         /// </summary>
592         public string AlphaMaskURL
593         {
594             get
595             {
596                 return _alphaMaskUrl;
597             }
598             set
599             {
600                 _alphaMaskUrl = value;
601                 UpdateVisual();
602             }
603         }
604
605         /// <summary>
606         /// Get or set fitting options, used when resizing images to fit desired dimensions.<br>
607         /// If not supplied, default is FittingModeType.ShrinkToFit.<br>
608         /// For Normal Quad images only.<br>
609         /// Optional.
610         /// </summary>
611         public FittingModeType FittingMode
612         {
613             get
614             {
615                 return _fittingMode ?? (FittingModeType.ShrinkToFit);
616             }
617             set
618             {
619                 _fittingMode = value;
620                 UpdateVisual();
621             }
622         }
623
624         /// <summary>
625         /// Get or set filtering options, used when resizing images to sample original pixels.<br>
626         /// If not supplied, default is SamplingModeType.Box.<br>
627         /// For Normal Quad images only.<br>
628         /// Optional.
629         /// </summary>
630         public SamplingModeType SamplingMode
631         {
632             get
633             {
634                 return _samplingMode ?? (SamplingModeType.Box);
635             }
636             set
637             {
638                 _samplingMode = value;
639                 UpdateVisual();
640             }
641         }
642
643         /// <summary>
644         /// Get or set the desired image width.<br>
645         /// If not specified, the actual image width is used.<br>
646         /// For Normal Quad images only.<br>
647         /// Optional.
648         /// </summary>
649         public int DesiredWidth
650         {
651             get
652             {
653                 return _desiredWidth ?? (-1);
654             }
655             set
656             {
657                 _desiredWidth = value;
658                 UpdateVisual();
659             }
660         }
661
662         /// <summary>
663         /// Get or set the desired image height.<br>
664         /// If not specified, the actual image height is used.<br>
665         /// For Normal Quad images only.<br>
666         /// Optional.
667         /// </summary>
668         public int DesiredHeight
669         {
670             get
671             {
672                 return _desiredHeight ?? (-1);
673             }
674             set
675             {
676                 _desiredHeight = value;
677                 UpdateVisual();
678             }
679         }
680
681         /// <summary>
682         /// Get or set whether to load the image synchronously.<br>
683         /// If not specified, the default is false, i.e. the image is loaded asynchronously.<br>
684         /// For Normal Quad images only.<br>
685         /// Optional.
686         /// </summary>
687         public bool SynchronousLoading
688         {
689             get
690             {
691                 return _synchronousLoading ?? (false);
692             }
693             set
694             {
695                 _synchronousLoading = value;
696                 UpdateVisual();
697             }
698         }
699
700         /// <summary>
701         /// Get or set whether to draws the borders only(If true).<br>
702         /// If not specified, the default is false.<br>
703         /// For N-Patch images only.<br>
704         /// Optional.
705         /// </summary>
706         public bool BorderOnly
707         {
708             get
709             {
710                 return _borderOnly ?? (false);
711             }
712             set
713             {
714                 _borderOnly = value;
715                 UpdateVisual();
716             }
717         }
718
719         /// <summary>
720         /// Get or set the image area to be displayed.<br>
721         /// It is a rectangular area.<br>
722         /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
723         /// If not specified, the default value is Vector4(0.0, 0.0, 1.0, 1.0), i.e. the entire area of the image.<br>
724         /// For For Normal QUAD image only.<br>
725         /// Optional.
726         /// </summary>
727         public Vector4 PixelArea
728         {
729             get
730             {
731                 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
732             }
733             set
734             {
735                 _pixelArea = value;
736                 UpdateVisual();
737             }
738         }
739
740         /// <summary>
741         /// Get or set the wrap mode for u coordinate.<br>
742         /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br>
743         /// If not specified, the default is WrapModeType.Default(CLAMP).<br>
744         /// For Normal QUAD image only.<br>
745         /// Optional.
746         /// </summary>
747         public WrapModeType WrapModeU
748         {
749             get
750             {
751                 return _wrapModeU ?? (WrapModeType.Default);
752             }
753             set
754             {
755                 _wrapModeU = value;
756                 UpdateVisual();
757             }
758         }
759
760         /// <summary>
761         /// Get or set the wrap mode for v coordinate.<br>
762         /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br>
763         /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
764         /// If not specified, the default is WrapModeType.Default(CLAMP).<br>
765         /// For Normal QUAD image only.
766         /// Optional.
767         /// </summary>
768         public WrapModeType WrapModeV
769         {
770             get
771             {
772                 return _wrapModeV ?? (WrapModeType.Default);
773             }
774             set
775             {
776                 _wrapModeV = value;
777                 UpdateVisual();
778             }
779         }
780
781         protected override void ComposingPropertyMap()
782         {
783             if (_url != null)
784             {
785                 _outputVisualMap = new PropertyMap();
786                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
787                 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
788                 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
789                 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
790                 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
791                 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
792                 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
793                 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
794                 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
795                 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
796                 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
797                 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
798                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
799                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
800                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
801                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
802             }
803         }
804     }
805
806     /// <summary>
807     /// A class encapsulating the property map of a text visual.
808     /// </summary>
809     public class TextVisual : VisualMap
810     {
811         public TextVisual() : base()
812         {
813         }
814
815         private string _text = null;
816         private string _fontFamily = null;
817         private PropertyMap _fontStyle = null;
818         private float? _pointSize = null;
819         private bool? _multiLine = null;
820         private string _horizontalAlignment = null;
821         private string _verticalAlignment = null;
822         private Color _textColor = null;
823         private bool? _enableMarkup = null;
824
825         /// <summary>
826         /// Get or set the text to display in UTF-8 format.<br>
827         /// Mandatory.
828         /// </summary>
829         public string Text
830         {
831             get
832             {
833                 return _text;
834             }
835             set
836             {
837                 _text = value;
838                 UpdateVisual();
839             }
840         }
841
842         /// <summary>
843         /// Get or set the requested font family to use.<br>
844         /// Optional.
845         /// </summary>
846         public string FontFamily
847         {
848             get
849             {
850                 return _fontFamily;
851             }
852             set
853             {
854                 _fontFamily = value;
855                 UpdateVisual();
856             }
857         }
858
859         /// <summary>
860         /// Get or set the requested font style to use.<br>
861         /// Optional.
862         /// </summary>
863         public PropertyMap FontStyle
864         {
865             get
866             {
867                 return _fontStyle;
868             }
869             set
870             {
871                 _fontStyle = value;
872                 UpdateVisual();
873             }
874         }
875
876         /// <summary>
877         /// Get or set the size of font in points.<br>
878         /// Mandatory.
879         /// </summary>
880         public float PointSize
881         {
882             get
883             {
884                 return _pointSize ?? (0.0f);
885             }
886             set
887             {
888                 _pointSize = value;
889                 UpdateVisual();
890             }
891         }
892
893         /// <summary>
894         /// Get or set the single-line or multi-line layout option.<br>
895         /// If not specified, the default is false.<br>
896         /// Optional.
897         /// </summary>
898         public bool MultiLine
899         {
900             get
901             {
902                 return _multiLine ?? (false);
903             }
904             set
905             {
906                 _multiLine = value;
907                 UpdateVisual();
908             }
909         }
910
911         /// <summary>
912         /// Get or set the line horizontal alignment.<br>
913         /// If not specified, the default is Begin.<br>
914         /// Optional.
915         /// </summary>
916         public HorizontalAlignment HorizontalAlignment
917         {
918             get
919             {
920                 switch (_horizontalAlignment)
921                 {
922                     case "BEGIN":
923                         return HorizontalAlignment.Begin;
924                     case "CENTER":
925                         return HorizontalAlignment.Center;
926                     case "END":
927                         return HorizontalAlignment.End;
928                     default:
929                         return HorizontalAlignment.Begin;
930                 }
931             }
932             set
933             {
934                 switch (value)
935                 {
936                     case HorizontalAlignment.Begin:
937                     {
938                         _horizontalAlignment = "BEGIN";
939                         break;
940                     }
941                     case HorizontalAlignment.Center:
942                     {
943                         _horizontalAlignment = "CENTER";
944                         break;
945                     }
946                     case HorizontalAlignment.End:
947                     {
948                         _horizontalAlignment = "END";
949                         break;
950                     }
951                     default:
952                     {
953                         _horizontalAlignment = "BEGIN";
954                         break;
955                     }
956                 }
957                 UpdateVisual();
958             }
959         }
960
961         /// <summary>
962         /// Get or set the line vertical alignment.<br>
963         /// If not specified, the default is Top.<br>
964         /// Optional.
965         /// </summary>
966         public VerticalAlignment VerticalAlignment
967         {
968             get
969             {
970                 switch (_verticalAlignment)
971                 {
972                     case "TOP":
973                         return VerticalAlignment.Top;
974                     case "CENTER":
975                         return VerticalAlignment.Center;
976                     case "BOTTOM":
977                         return VerticalAlignment.Bottom;
978                     default:
979                         return VerticalAlignment.Top;
980                 }
981             }
982             set
983             {
984                 switch (value)
985                 {
986                     case VerticalAlignment.Top:
987                     {
988                         _verticalAlignment = "TOP";
989                         break;
990                     }
991                     case VerticalAlignment.Center:
992                     {
993                         _verticalAlignment = "CENTER";
994                         break;
995                     }
996                     case VerticalAlignment.Bottom:
997                     {
998                         _verticalAlignment = "BOTTOM";
999                         break;
1000                     }
1001                     default:
1002                     {
1003                         _verticalAlignment = "TOP";
1004                         break;
1005                     }
1006                 }
1007                 UpdateVisual();
1008             }
1009         }
1010
1011         /// <summary>
1012         /// Get or set the color of the text.<br>
1013         /// Optional.
1014         /// </summary>
1015         public Color TextColor
1016         {
1017             get
1018             {
1019                 return _textColor;
1020             }
1021             set
1022             {
1023                 _textColor = value;
1024                 UpdateVisual();
1025             }
1026         }
1027
1028         /// <summary>
1029         /// Get or set whether the mark-up processing is enabled.<br>
1030         /// Optional.
1031         /// </summary>
1032         public bool EnableMarkup
1033         {
1034             get
1035             {
1036                 return _enableMarkup ?? (false);
1037             }
1038             set
1039             {
1040                 _enableMarkup = value;
1041                 UpdateVisual();
1042             }
1043         }
1044
1045         protected override void ComposingPropertyMap()
1046         {
1047             if (_text != null && _pointSize != null)
1048             {
1049                 _outputVisualMap = new PropertyMap();
1050                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1051                 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1052                 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1053                 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1054                 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1055                 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1056                 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1057                 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1058                 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1059                 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1060                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1061                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1062                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1063                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1064             }
1065         }
1066     }
1067
1068     /// <summary>
1069     /// A class encapsulating the property map of a border visual.
1070     /// </summary>
1071     public class BorderVisual : VisualMap
1072     {
1073         public BorderVisual() : base()
1074         {
1075         }
1076
1077         private Color _color = null;
1078         private float? _size = null;
1079         private bool? _antiAliasing = null;
1080
1081         /// <summary>
1082         /// Get or set the color of the border.<br>
1083         /// Mandatory.
1084         /// </summary>
1085         public Color Color
1086         {
1087             get
1088             {
1089                 return _color;
1090             }
1091             set
1092             {
1093                 _color = value;
1094                 UpdateVisual();
1095             }
1096         }
1097
1098         /// <summary>
1099         /// Get or set the width of the border (in pixels).<br>
1100         /// Mandatory.
1101         /// </summary>
1102         public float BorderSize
1103         {
1104             get
1105             {
1106                 return _size ?? (-1.0f);
1107             }
1108             set
1109             {
1110                 _size = value;
1111                 UpdateVisual();
1112             }
1113         }
1114
1115         /// <summary>
1116         /// Get or set whether anti-aliasing of the border is required.<br>
1117         /// If not supplied, default is false.<br>
1118         /// Optional.
1119         /// </summary>
1120         public bool AntiAliasing
1121         {
1122             get
1123             {
1124                 return _antiAliasing ?? (false);
1125             }
1126             set
1127             {
1128                 _antiAliasing = value;
1129                 UpdateVisual();
1130             }
1131         }
1132
1133         protected override void ComposingPropertyMap()
1134         {
1135             if (_color != null && _size != null)
1136             {
1137                 _outputVisualMap = new PropertyMap();
1138                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1139                 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1140                 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1141                 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1142                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1143                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1144                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1145                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1146             }
1147         }
1148     }
1149
1150     /// <summary>
1151     /// A class encapsulating the property map of a color visual.
1152     /// </summary>
1153     public class ColorVisual : VisualMap
1154     {
1155         public ColorVisual() : base()
1156         {
1157         }
1158
1159         private Color _mixColorForColorVisual = null;
1160
1161         /// <summary>
1162         /// Get or set the solid color required.<br>
1163         /// Mandatory.
1164         /// </summary>
1165         public Color Color
1166         {
1167             get
1168             {
1169                 return _mixColorForColorVisual;
1170             }
1171             set
1172             {
1173                 _mixColorForColorVisual = value;
1174                 UpdateVisual();
1175             }
1176         }
1177
1178         protected override void ComposingPropertyMap()
1179         {
1180             if (_mixColorForColorVisual != null)
1181             {
1182                 _outputVisualMap = new PropertyMap();
1183                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1184                 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1185                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1186                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1187                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1188             }
1189         }
1190     }
1191
1192     /// <summary>
1193     /// A class encapsulating the property map of a gradient visual.
1194     /// </summary>
1195     public class GradientVisual : VisualMap
1196     {
1197         public GradientVisual() : base()
1198         {
1199         }
1200
1201         private Vector2 _startPosition = null;
1202         private Vector2 _endPosition = null;
1203         private Vector2 _center = null;
1204         private float? _radius = null;
1205         private PropertyArray _stopOffset = null;
1206         private PropertyArray _stopColor = null;
1207         private GradientVisualUnitsType? _units = null;
1208         private GradientVisualSpreadMethodType? _spreadMethod = null;
1209
1210         /// <summary>
1211         /// Get or set the start position of a linear gradient.<br>
1212         /// Mandatory for Linear.<br>
1213         /// </summary>
1214         public Vector2 StartPosition
1215         {
1216             get
1217             {
1218                 return _startPosition;
1219             }
1220             set
1221             {
1222                 _startPosition = value;
1223                 UpdateVisual();
1224             }
1225         }
1226
1227         /// <summary>
1228         /// Get or set the end position of a linear gradient.<br>
1229         /// Mandatory for Linear.<br>
1230         /// </summary>
1231         public Vector2 EndPosition
1232         {
1233             get
1234             {
1235                 return _endPosition;
1236             }
1237             set
1238             {
1239                 _endPosition = value;
1240                 UpdateVisual();
1241             }
1242         }
1243
1244         /// <summary>
1245         /// Get or set the center point of a radial gradient.<br>
1246         /// Mandatory for Radial.<br>
1247         /// </summary>
1248         public Vector2 Center
1249         {
1250             get
1251             {
1252                 return _center;
1253             }
1254             set
1255             {
1256                 _center = value;
1257                 UpdateVisual();
1258             }
1259         }
1260
1261         /// <summary>
1262         /// Get or set the size of the radius of a radial gradient.<br>
1263         /// Mandatory for Radial.<br>
1264         /// </summary>
1265         public float Radius
1266         {
1267             get
1268             {
1269                 return _radius ?? (-1.0f);
1270             }
1271             set
1272             {
1273                 _radius = value;
1274                 UpdateVisual();
1275             }
1276         }
1277
1278         /// <summary>
1279         /// Get or set all the stop offsets.<br>
1280         /// A PropertyArray of float.<br>
1281         /// If not supplied, default is 0.0f and 1.0f.<br>
1282         /// Optional.
1283         /// </summary>
1284         public PropertyArray StopOffset
1285         {
1286             get
1287             {
1288                 return _stopOffset;
1289             }
1290             set
1291             {
1292                 _stopOffset = value;
1293                 UpdateVisual();
1294             }
1295         }
1296
1297         /// <summary>
1298         /// Get or set the color at the stop offsets.<br>
1299         /// A PropertyArray of Color.<br>
1300         /// At least 2 values required to show a gradient.<br>
1301         /// Mandatory.
1302         /// </summary>
1303         public PropertyArray StopColor
1304         {
1305             get
1306             {
1307                 return _stopColor;
1308             }
1309             set
1310             {
1311                 _stopColor = value;
1312                 UpdateVisual();
1313             }
1314         }
1315
1316         /// <summary>
1317         /// Get or set defines the coordinate system for certain attributes of the points in a gradient.<br>
1318         /// If not supplied, default is GradientVisualUnitsType.ObjectBoundingBox.<br>
1319         /// Optional.
1320         /// </summary>
1321         public GradientVisualUnitsType Units
1322         {
1323             get
1324             {
1325                 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1326             }
1327             set
1328             {
1329                 _units = value;
1330                 UpdateVisual();
1331             }
1332         }
1333
1334         /// <summary>
1335         /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1336         /// If not supplied, default is GradientVisualSpreadMethodType.Pad.<br>
1337         /// Optional.
1338         /// </summary>
1339         public GradientVisualSpreadMethodType SpreadMethod
1340         {
1341             get
1342             {
1343                 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1344             }
1345             set
1346             {
1347                 _spreadMethod = value;
1348                 UpdateVisual();
1349             }
1350         }
1351
1352         protected override void ComposingPropertyMap()
1353         {
1354             if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1355             {
1356                 _outputVisualMap = new PropertyMap();
1357                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1358                 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1359                 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1360                 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1361                 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1362                 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1363                 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1364                 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1365                 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1366                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1367                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1368                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1369                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1370             }
1371         }
1372     }
1373
1374     /// <summary>
1375     /// A class encapsulating the property map of a mesh visual.
1376     /// </summary>
1377     public class MeshVisual : VisualMap
1378     {
1379         public MeshVisual() : base()
1380         {
1381         }
1382
1383         private string _objectURL = null;
1384         private string _materialtURL = null;
1385         private string _texturesPath = null;
1386         private MeshVisualShadingModeValue? _shadingMode = null;
1387         private bool? _useMipmapping = null;
1388         private bool? _useSoftNormals = null;
1389         private Vector3 _lightPosition = null;
1390
1391         /// <summary>
1392         /// Get or set the location of the ".obj" file.<br>
1393         /// Mandatory.
1394         /// </summary>
1395         public string ObjectURL
1396         {
1397             get
1398             {
1399                 return _objectURL;
1400             }
1401             set
1402             {
1403                 _objectURL = value;
1404                 UpdateVisual();
1405             }
1406         }
1407
1408         /// <summary>
1409         /// Get or set the location of the ".mtl" file.<br>
1410         /// If not specified, then a textureless object is assumed.<br>
1411         /// Optional.
1412         /// </summary>
1413         public string MaterialtURL
1414         {
1415             get
1416             {
1417                 return _materialtURL;
1418             }
1419             set
1420             {
1421                 _materialtURL = value;
1422                 UpdateVisual();
1423             }
1424         }
1425
1426         /// <summary>
1427         /// Get or set path to the directory the textures (including gloss and normal) are stored in.<br>
1428         /// Mandatory if using material.<br>
1429         /// </summary>
1430         public string TexturesPath
1431         {
1432             get
1433             {
1434                 return _texturesPath;
1435             }
1436             set
1437             {
1438                 _texturesPath = value;
1439                 UpdateVisual();
1440             }
1441         }
1442
1443         /// <summary>
1444         /// Get or set the type of shading mode that the mesh will use.<br>
1445         /// If anything the specified shading mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.<br>
1446         /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br>
1447         /// Optional.
1448         /// </summary>
1449         public MeshVisualShadingModeValue ShadingMode
1450         {
1451             get
1452             {
1453                 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1454             }
1455             set
1456             {
1457                 _shadingMode = value;
1458                 UpdateVisual();
1459             }
1460         }
1461
1462         /// <summary>
1463         /// Get or set whether to use mipmaps for textures or not.<br>
1464         /// If not specified, the default is true.<br>
1465         /// Optional.
1466         /// </summary>
1467         public bool UseMipmapping
1468         {
1469             get
1470             {
1471                 return _useMipmapping ?? (true);
1472             }
1473             set
1474             {
1475                 _useMipmapping = value;
1476                 UpdateVisual();
1477             }
1478         }
1479
1480         /// <summary>
1481         /// Get or set whether to average normals at each point to smooth textures or not.<br>
1482         /// If not specified, the default is true.<br>
1483         /// Optional.
1484         /// </summary>
1485         public bool UseSoftNormals
1486         {
1487             get
1488             {
1489                 return _useSoftNormals ?? (true);
1490             }
1491             set
1492             {
1493                 _useSoftNormals = value;
1494                 UpdateVisual();
1495             }
1496         }
1497
1498         /// <summary>
1499         /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1500         /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1501         /// and using all zeroes will place the light at the top left corner.<br>
1502         /// If not specified, the default is an offset outwards from the center of the screen.<br>
1503         /// Optional.
1504         /// </summary>
1505         public Vector3 LightPosition
1506         {
1507             get
1508             {
1509                 return _lightPosition;
1510             }
1511             set
1512             {
1513                 _lightPosition = value;
1514                 UpdateVisual();
1515             }
1516         }
1517
1518         protected override void ComposingPropertyMap()
1519         {
1520             if (_objectURL != null)
1521             {
1522                 _outputVisualMap = new PropertyMap();
1523                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1524                 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1525                 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1526                 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1527                 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1528                 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1529                 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1530                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1531                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1532                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1533                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1534             }
1535         }
1536     }
1537
1538     /// <summary>
1539     /// A class encapsulating the property map of a primetive visual.
1540     /// </summary>
1541     public class PrimitiveVisual : VisualMap
1542     {
1543         public PrimitiveVisual() : base()
1544         {
1545         }
1546
1547         private PrimitiveVisualShapeType? _shape = null;
1548         private Color _mixColorForPrimitiveVisual = null;
1549         private int? _slices = null;
1550         private int? _stacks = null;
1551         private float? _scaleTopRadius = null;
1552         private float? _scaleBottomRadius = null;
1553         private float? _scaleHeight = null;
1554         private float? _scaleRadius = null;
1555         private Vector3 _scaleDimensions = null;
1556         private float? _bevelPercentage = null;
1557         private float? _bevelSmoothness = null;
1558         private Vector3 _lightPosition = null;
1559
1560         /// <summary>
1561         /// Get or set the specific shape to render.<br>
1562         /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br>
1563         /// Optional.
1564         /// </summary>
1565         public PrimitiveVisualShapeType Shape
1566         {
1567             get
1568             {
1569                 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1570             }
1571             set
1572             {
1573                 _shape = value;
1574                 UpdateVisual();
1575             }
1576         }
1577
1578         /// <summary>
1579         /// Get or set the color of the shape.<br>
1580         /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).<br>
1581         /// Applies to ALL shapes.<br>
1582         /// Optional.
1583         /// </summary>
1584         public Color MixColor
1585         {
1586             get
1587             {
1588                 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1589             }
1590             set
1591             {
1592                 _mixColorForPrimitiveVisual = value;
1593                 UpdateVisual();
1594             }
1595         }
1596
1597         /// <summary>
1598         /// Get or set the number of slices as you go around the shape.<br>
1599         /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br>
1600         /// If not specified, the default is 128.<br>
1601         /// The range is from 1 to 255.<br>
1602         /// Optional.
1603         /// </summary>
1604         public int Slices
1605         {
1606             get
1607             {
1608                 return _slices ?? (128);
1609             }
1610             set
1611             {
1612                 _slices = value;
1613                 UpdateVisual();
1614             }
1615         }
1616
1617         /// <summary>
1618         /// Get or set the number of stacks as you go down the shape.<br>
1619         /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br>
1620         /// If not specified, the default is 128.<br>
1621         /// The range is from 1 to 255.<br>
1622         /// Optional.
1623         /// </summary>
1624         public int Stacks
1625         {
1626             get
1627             {
1628                 return _stacks ?? (128);
1629             }
1630             set
1631             {
1632                 _stacks = value;
1633                 UpdateVisual();
1634             }
1635         }
1636
1637         /// <summary>
1638         /// Get or set the scale of the radius of the top circle of a conical frustrum.<br>
1639         /// If not specified, the default is 1.0f.<br>
1640         /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br>
1641         /// Only values greater than or equal to 0.0f are accepted.<br>
1642         /// Optional.
1643         /// </summary>
1644         public float ScaleTopRadius
1645         {
1646             get
1647             {
1648                 return _scaleTopRadius ?? (1.0f);
1649             }
1650             set
1651             {
1652                 _scaleTopRadius = value;
1653                 UpdateVisual();
1654             }
1655         }
1656
1657         /// <summary>
1658         /// Get or set the scale of the radius of the bottom circle of a conical frustrum.<br>
1659         /// If not specified, the default is 1.5f.<br>
1660         /// Applies to:  - PrimitiveVisualShapeType.ConicalFrustrum<br>
1661         ///              - PrimitiveVisualShapeType.Cone<br>
1662         /// Only values greater than or equal to 0.0f are accepted.<br>
1663         /// Optional.
1664         /// </summary>
1665         public float ScaleBottomRadius
1666         {
1667             get
1668             {
1669                 return _scaleBottomRadius ?? (1.5f);
1670             }
1671             set
1672             {
1673                 _scaleBottomRadius = value;
1674                 UpdateVisual();
1675             }
1676         }
1677
1678         /// <summary>
1679         /// Get or set the scale of the height of a conic.<br>
1680         /// If not specified, the default is 3.0f.<br>
1681         /// Applies to:<br>
1682         ///      - PrimitiveVisualShapeType.ConicalFrustrum<br>
1683         ///      - PrimitiveVisualShapeType.Cone<br>
1684         ///      - PrimitiveVisualShapeType.Cylinder<br>
1685         /// Only values greater than or equal to 0.0f are accepted.<br>
1686         /// Optional.
1687         /// </summary>
1688         public float ScaleHeight
1689         {
1690             get
1691             {
1692                 return _scaleHeight ?? (3.0f);
1693             }
1694             set
1695             {
1696                 _scaleHeight = value;
1697                 UpdateVisual();
1698             }
1699         }
1700
1701         /// <summary>
1702         /// Get or set the scale of the radius of a cylinder.<br>
1703         /// If not specified, the default is 1.0f.<br>
1704         /// Applies to:<br>
1705         ///      - PrimitiveVisualShapeType.Cylinder<br>
1706         /// Only values greater than or equal to 0.0f are accepted.<br>
1707         /// Optional.
1708         /// </summary>
1709         public float ScaleRadius
1710         {
1711             get
1712             {
1713                 return _scaleRadius ?? (1.0f);
1714             }
1715             set
1716             {
1717                 _scaleRadius = value;
1718                 UpdateVisual();
1719             }
1720         }
1721
1722         /// <summary>
1723         /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br>
1724         /// If not specified, the default is Vector3.One.<br>
1725         /// Applies to:<br>
1726         ///      - PrimitiveVisualShapeType.Cube<br>
1727         ///      - PrimitiveVisualShapeType.Octahedron<br>
1728         ///      - PrimitiveVisualShapeType.BevelledCube<br>
1729         /// Each vector3 parameter should be greater than or equal to 0.0f.<br>
1730         /// Optional.
1731         /// </summary>
1732         public Vector3 ScaleDimensions
1733         {
1734             get
1735             {
1736                 return _scaleDimensions ?? (Vector3.One);
1737             }
1738             set
1739             {
1740                 _scaleDimensions = value;
1741                 UpdateVisual();
1742             }
1743         }
1744
1745         /// <summary>
1746         /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.<br>
1747         /// Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube.<br>
1748         /// If not specified, the default is 0.0f (no bevel).<br>
1749         /// Applies to:<br>
1750         ///      - PrimitiveVisualShapeType.BevelledCube<br>
1751         /// The range is from 0.0f to 1.0f.<br>
1752         /// Optional.
1753         /// </summary>
1754         public float BevelPercentage
1755         {
1756             get
1757             {
1758                 return _bevelPercentage ?? (0.0f);
1759             }
1760             set
1761             {
1762                 _bevelPercentage = value;
1763                 UpdateVisual();
1764             }
1765         }
1766
1767         /// <summary>
1768         /// Get or set defines how smooth the bevelled edges should be.<br>
1769         /// If not specified, the default is 0.0f (sharp edges).<br>
1770         /// Applies to:<br>
1771         ///      - PrimitiveVisualShapeType.BevelledCube<br>
1772         /// The range is from 0.0f to 1.0f.<br>
1773         /// Optional.
1774         /// </summary>
1775         public float BevelSmoothness
1776         {
1777             get
1778             {
1779                 return _bevelSmoothness ?? (0.0f);
1780             }
1781             set
1782             {
1783                 _bevelSmoothness = value;
1784                 UpdateVisual();
1785             }
1786         }
1787
1788         /// <summary>
1789         /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1790         /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1791         /// and using all zeroes will place the light at the top left corner.<br>
1792         /// If not specified, the default is an offset outwards from the center of the screen.<br>
1793         /// Applies to ALL shapes.<br>
1794         /// Optional.
1795         /// </summary>
1796         public Vector3 LightPosition
1797         {
1798             get
1799             {
1800                 return _lightPosition;
1801             }
1802             set
1803             {
1804                 _lightPosition = value;
1805                 UpdateVisual();
1806             }
1807         }
1808
1809         protected override void ComposingPropertyMap()
1810         {
1811             _outputVisualMap = new PropertyMap(); ;
1812             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
1813             if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
1814             if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
1815             if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
1816             if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
1817             if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
1818             if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
1819             if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
1820             if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
1821             if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
1822             if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
1823             if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
1824             if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
1825             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1826             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1827             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1828         }
1829     }
1830
1831     /// <summary>
1832     /// A class encapsulating the property map of a n-patch image visual.
1833     /// </summary>
1834     public class NPatchVisual : VisualMap
1835     {
1836         public NPatchVisual() : base()
1837         {
1838         }
1839
1840         private string _url = null;
1841         private bool? _borderOnly = null;
1842         private Rectangle _border = null;
1843
1844         /// <summary>
1845         /// Get or set the URL of the image.<br>
1846         /// Mandatory.
1847         /// </summary>
1848         public string URL
1849         {
1850             get
1851             {
1852                 return _url;
1853             }
1854             set
1855             {
1856                 _url = value;
1857                 UpdateVisual();
1858             }
1859         }
1860
1861         /// <summary>
1862         /// Get or set whether to draws the borders only(If true).<br>
1863         /// If not specified, the default is false.<br>
1864         /// For N-Patch images only.<br>
1865         /// Optional.
1866         /// </summary>
1867         public bool BorderOnly
1868         {
1869             get
1870             {
1871                 return _borderOnly ?? false;
1872             }
1873             set
1874             {
1875                 _borderOnly = value;
1876                 UpdateVisual();
1877             }
1878         }
1879
1880         /// <summary>
1881         /// The border of the image in the order: left, right, bottom, top.<br>
1882         /// For N-Patch images only.<br>
1883         /// Optional.
1884         /// </summary>
1885         public Rectangle Border
1886         {
1887             get
1888             {
1889                 return _border;
1890             }
1891             set
1892             {
1893                 _border = value;
1894                 UpdateVisual();
1895             }
1896         }
1897
1898         protected override void ComposingPropertyMap()
1899         {
1900             if (_url != null)
1901             {
1902                 _outputVisualMap = new PropertyMap();
1903                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
1904                 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
1905                 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1906                 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
1907                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1908                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1909                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1910                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1911             }
1912         }
1913     }
1914
1915     /// <summary>
1916     /// A class encapsulating the property map of a SVG visual.
1917     /// </summary>
1918     public class SVGVisual : VisualMap
1919     {
1920         public SVGVisual() : base()
1921         {
1922         }
1923
1924         private string _url = null;
1925
1926         public string URL
1927         {
1928             get
1929             {
1930                 return _url;
1931             }
1932             set
1933             {
1934                 _url = value;
1935                 UpdateVisual();
1936             }
1937         }
1938
1939         protected override void ComposingPropertyMap()
1940         {
1941             if (_url != null)
1942             {
1943                 _outputVisualMap = new PropertyMap();
1944                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
1945                 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
1946                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1947                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1948                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1949                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1950             }
1951         }
1952     }
1953
1954     /// <summary>
1955     /// A class encapsulating the property map of a Animated Image(AGIF) visual.
1956     /// </summary>
1957     public class AnimatedImageVisual : VisualMap
1958     {
1959         public AnimatedImageVisual() : base()
1960         {
1961         }
1962
1963         private string _url = null;
1964
1965         public string URL
1966         {
1967             get
1968             {
1969                 return _url;
1970             }
1971             set
1972             {
1973                 _url = value;
1974                 UpdateVisual();
1975             }
1976         }
1977
1978         protected override void ComposingPropertyMap()
1979         {
1980             if (_url != null)
1981             {
1982                 _outputVisualMap = new PropertyMap();
1983                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
1984                 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
1985                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1986                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1987                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1988                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1989             }
1990         }
1991     }
1992
1993
1994
1995     //temporary fix for TCT
1996     public class VisualAnimator : VisualMap
1997     {
1998         public VisualAnimator() : base()
1999         {
2000         }
2001
2002         private string _alphaFunction = null;
2003         private int _startTime = 0;
2004         private int _endTime = 0;
2005         private string _target = null;
2006         private string _propertyIndex = null;
2007         private object _destinationValue = null;
2008
2009         public AlphaFunction.BuiltinFunctions AlphaFunction
2010         {
2011             get
2012             {
2013                 switch (_alphaFunction)
2014                 {
2015                     case "LINEAR":
2016                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2017                     case "REVERSE":
2018                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2019                     case "EASE_IN_SQUARE":
2020                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2021                     case "EASE_OUT_SQUARE":
2022                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2023                     case "EASE_IN":
2024                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2025                     case "EASE_OUT":
2026                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2027                     case "EASE_IN_OUT":
2028                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2029                     case "EASE_IN_SINE":
2030                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2031                     case "EASE_OUT_SINE":
2032                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2033                     case "EASE_IN_OUT_SINE":
2034                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2035                     case "BOUNCE":
2036                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2037                     case "SIN":
2038                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2039                     case "EASE_OUT_BACK":
2040                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2041                     default:
2042                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2043                 }
2044             }
2045             set
2046             {
2047                 switch (value)
2048                 {
2049                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2050                         {
2051                             _alphaFunction = "LINEAR";
2052                             break;
2053                         }
2054                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2055                         {
2056                             _alphaFunction = "REVERSE";
2057                             break;
2058                         }
2059                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2060                         {
2061                             _alphaFunction = "EASE_IN_SQUARE";
2062                             break;
2063                         }
2064                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2065                         {
2066                             _alphaFunction = "EASE_OUT_SQUARE";
2067                             break;
2068                         }
2069                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2070                         {
2071                             _alphaFunction = "EASE_IN";
2072                             break;
2073                         }
2074                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2075                         {
2076                             _alphaFunction = "EASE_OUT";
2077                             break;
2078                         }
2079                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2080                         {
2081                             _alphaFunction = "EASE_IN_OUT";
2082                             break;
2083                         }
2084                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2085                         {
2086                             _alphaFunction = "EASE_IN_SINE";
2087                             break;
2088                         }
2089                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2090                         {
2091                             _alphaFunction = "EASE_OUT_SINE";
2092                             break;
2093                         }
2094                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2095                         {
2096                             _alphaFunction = "EASE_IN_OUT_SINE";
2097                             break;
2098                         }
2099                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2100                         {
2101                             _alphaFunction = "BOUNCE";
2102                             break;
2103                         }
2104                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2105                         {
2106                             _alphaFunction = "SIN";
2107                             break;
2108                         }
2109                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2110                         {
2111                             _alphaFunction = "EASE_OUT_BACK";
2112                             break;
2113                         }
2114                     default:
2115                         {
2116                             _alphaFunction = "DEFAULT";
2117                             break;
2118                         }
2119                 }
2120             }
2121         }
2122
2123         public int StartTime
2124         {
2125             get
2126             {
2127                 return _startTime;
2128             }
2129             set
2130             {
2131                 _startTime = value;
2132             }
2133         }
2134
2135         public int EndTime
2136         {
2137             get
2138             {
2139                 return _endTime;
2140             }
2141             set
2142             {
2143                 _endTime = value;
2144             }
2145         }
2146
2147         public string Target
2148         {
2149             get
2150             {
2151                 return _target;
2152             }
2153             set
2154             {
2155                 _target = value;
2156             }
2157         }
2158
2159         public string PropertyIndex
2160         {
2161             get
2162             {
2163                 return _propertyIndex;
2164             }
2165             set
2166             {
2167                 _propertyIndex = value;
2168             }
2169         }
2170
2171         public object DestinationValue
2172         {
2173             get
2174             {
2175                 return _destinationValue;
2176             }
2177             set
2178             {
2179                 _destinationValue = value;
2180             }
2181         }
2182
2183         protected override void ComposingPropertyMap()
2184         {
2185             PropertyMap _animator = new PropertyMap();
2186             _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2187
2188             PropertyMap _timePeriod = new PropertyMap();
2189             _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2190             _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2191             _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2192
2193             string _str1 = _propertyIndex.Substring(0, 1);
2194             string _str2 = _propertyIndex.Substring(1);
2195             string _str = _str1.ToLower() + _str2;
2196
2197             PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2198
2199             PropertyMap _transition = new PropertyMap();
2200             _transition.Add("target", new PropertyValue(_target));
2201             _transition.Add("property", new PropertyValue(_str));
2202             _transition.Add("targetValue", val);
2203             _transition.Add("animator", new PropertyValue(_animator));
2204
2205             _outputVisualMap = _transition;
2206         }
2207     }
2208     //temporary fix for TCT
2209
2210
2211
2212 }